diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-04-23 12:36:59 -0700 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-04-23 12:36:59 -0700 |
commit | 2e0079e870911ed64c3b959fd5500ee316c936d7 (patch) | |
tree | 9aa3a330565975d597673f1ed15051c85f15d8b8 /test/files | |
parent | efbac9d481a7a1d29c2377692b910a1a5ffcabd1 (diff) | |
parent | c1327dcd99a6ca84d2550b8e4894ec7ee5ee2420 (diff) | |
download | scala-2e0079e870911ed64c3b959fd5500ee316c936d7.tar.gz scala-2e0079e870911ed64c3b959fd5500ee316c936d7.tar.bz2 scala-2e0079e870911ed64c3b959fd5500ee316c936d7.zip |
Merge pull request #2420 from retronym/ticket/6675-2
SI-6675 Avoid spurious warning about pattern bind arity.
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/pos/t6675.flags | 1 | ||||
-rw-r--r-- | test/files/pos/t6675.scala | 20 |
2 files changed, 21 insertions, 0 deletions
diff --git a/test/files/pos/t6675.flags b/test/files/pos/t6675.flags new file mode 100644 index 0000000000..e8fb65d50c --- /dev/null +++ b/test/files/pos/t6675.flags @@ -0,0 +1 @@ +-Xfatal-warnings
\ No newline at end of file diff --git a/test/files/pos/t6675.scala b/test/files/pos/t6675.scala new file mode 100644 index 0000000000..f3bebea5be --- /dev/null +++ b/test/files/pos/t6675.scala @@ -0,0 +1,20 @@ +object LeftOrRight { + def unapply[A](value: Either[A, A]): Option[A] = value match { + case scala.Left(x) => Some(x) + case scala.Right(x) => Some(x) + } +} + +object Test { + (Left((0, 0)): Either[(Int, Int), (Int, Int)]) match { + case LeftOrRight(pair @ (a, b)) => a // false -Xlint warning: "extractor pattern binds a single value to a Product2 of type (Int, Int)" + } + + (Left((0, 0)): Either[(Int, Int), (Int, Int)]) match { + case LeftOrRight((a, b)) => a // false -Xlint warning: "extractor pattern binds a single value to a Product2 of type (Int, Int)" + } + + (Left((0, 0)): Either[(Int, Int), (Int, Int)]) match { + case LeftOrRight(a, b) => a // false -Xlint warning: "extractor pattern binds a single value to a Product2 of type (Int, Int)" + } +} |