summaryrefslogtreecommitdiff
path: root/test/files/neg/bug3683a.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-10-05 15:34:37 +0000
committerPaul Phillips <paulp@improving.org>2010-10-05 15:34:37 +0000
commit7553e6901d52ace00bfcb670336c480766c8301c (patch)
tree720e9fa758661c6d5cc51340b4b693433d00d696 /test/files/neg/bug3683a.scala
parenta4cf7b1ec5dade69b41e59469b9b3f65415b9822 (diff)
downloadscala-7553e6901d52ace00bfcb670336c480766c8301c.tar.gz
scala-7553e6901d52ace00bfcb670336c480766c8301c.tar.bz2
scala-7553e6901d52ace00bfcb670336c480766c8301c.zip
Improves exhaustiveness analysis to not warn ab...
Improves exhaustiveness analysis to not warn about types which cannot match due to nonconformant type parameters. Also, look at the different warnings emitted in the test case based on the presence of a constraint. Nifty! Closes #3683, no review.
Diffstat (limited to 'test/files/neg/bug3683a.scala')
-rw-r--r--test/files/neg/bug3683a.scala20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/files/neg/bug3683a.scala b/test/files/neg/bug3683a.scala
new file mode 100644
index 0000000000..6d1915213a
--- /dev/null
+++ b/test/files/neg/bug3683a.scala
@@ -0,0 +1,20 @@
+sealed trait Foo
+sealed trait Bar extends Foo
+sealed trait W[T >: Bar <: Foo]
+case class X() extends W[Foo]
+case class XX() extends W[Bar]
+case class Y() extends W[Bar]
+case class Z[T >: Bar <: Foo](
+ z1: W[T]
+) extends W[T]
+
+object Main {
+ // should warn for not including XX()
+ def f1(w: W[Bar]): Int = {
+ w match {
+ // case XX() => 2
+ case Y() => 1
+ case Z(z) => f1(z)
+ }
+ }
+} \ No newline at end of file