diff options
author | Paul Phillips <paulp@improving.org> | 2011-07-13 06:58:04 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-07-13 06:58:04 +0000 |
commit | d8e882ad5ccd7006a4304d9378a7a9328f55e173 (patch) | |
tree | a18c07da73515be37e48b1bd1c15ed1e8f3df0ce /test/files/run | |
parent | e032852d12a301fb8ee8b10fe1f6a6f6eb09b7d4 (diff) | |
download | scala-d8e882ad5ccd7006a4304d9378a7a9328f55e173.tar.gz scala-d8e882ad5ccd7006a4304d9378a7a9328f55e173.tar.bz2 scala-d8e882ad5ccd7006a4304d9378a7a9328f55e173.zip |
Bounded wildcard types arising during pattern t...
Bounded wildcard types arising during pattern type inference can cause
unnecessary crashes. Closes #1048, review by odersky.
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/bug1048.check | 2 | ||||
-rw-r--r-- | test/files/run/bug1048.scala | 21 |
2 files changed, 23 insertions, 0 deletions
diff --git a/test/files/run/bug1048.check b/test/files/run/bug1048.check new file mode 100644 index 0000000000..f1e5eeed2d --- /dev/null +++ b/test/files/run/bug1048.check @@ -0,0 +1,2 @@ +3 +2 diff --git a/test/files/run/bug1048.scala b/test/files/run/bug1048.scala new file mode 100644 index 0000000000..5eaeaa25c6 --- /dev/null +++ b/test/files/run/bug1048.scala @@ -0,0 +1,21 @@ +final case class W[A](v: A) + +object E { + def unapply(w: W[Any]): Option[Any] = None +} + +object Bug { + def bug[A](e: Either[W[_], A]) = e match { + case Left(E(x)) => 1 + case Right(x) => 2 + case _ => 3 + } +} + +object Test { + def main(args: Array[String]): Unit = { + println(Bug.bug(Left(W(5)))) + println(Bug.bug(Right(5))) + } +} + |