diff options
author | Paul Phillips <paulp@improving.org> | 2010-10-05 15:34:37 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-10-05 15:34:37 +0000 |
commit | 7553e6901d52ace00bfcb670336c480766c8301c (patch) | |
tree | 720e9fa758661c6d5cc51340b4b693433d00d696 /test/files/neg/bug3683b.scala | |
parent | a4cf7b1ec5dade69b41e59469b9b3f65415b9822 (diff) | |
download | scala-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/bug3683b.scala')
-rw-r--r-- | test/files/neg/bug3683b.scala | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/files/neg/bug3683b.scala b/test/files/neg/bug3683b.scala new file mode 100644 index 0000000000..646e418121 --- /dev/null +++ b/test/files/neg/bug3683b.scala @@ -0,0 +1,21 @@ +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 fail for including X() + def f1(w: W[Bar]): Int = { + w match { + case X() => 1 + case XX() => 2 + case Y() => 1 + case Z(z) => f1(z) + } + } +}
\ No newline at end of file |