summaryrefslogtreecommitdiff
path: root/test/files/neg/patmat-type-check.check
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-09-27 06:41:17 -0700
committerPaul Phillips <paulp@improving.org>2012-09-27 09:24:04 -0700
commit96d4a8646b1962fac2f2fc443b56c6619221b43c (patch)
treebd39f411275452bb5db2335da966ac8042cd504f /test/files/neg/patmat-type-check.check
parent17b409b7832f541e3d52d2776c8ff3c47574ae0f (diff)
downloadscala-96d4a8646b1962fac2f2fc443b56c6619221b43c.tar.gz
scala-96d4a8646b1962fac2f2fc443b56c6619221b43c.tar.bz2
scala-96d4a8646b1962fac2f2fc443b56c6619221b43c.zip
Nailed down the "impossible match" logic.
I will again defer to a comment. /** Given classes A and B, can it be shown that nothing which is * an A will ever be a subclass of something which is a B? This * entails not only showing that !(A isSubClass B) but that the * same is true of all their subclasses. Restated for symmetry: * the same value cannot be a member of both A and B. * * 1) A must not be a subclass of B, nor B of A (the trivial check) * 2) One of A or B must be completely knowable (see isKnowable) * 3) Assuming A is knowable, the proposition is true if * !(A' isSubClass B) for all A', where A' is a subclass of A. * * Due to symmetry, the last condition applies as well in reverse. */
Diffstat (limited to 'test/files/neg/patmat-type-check.check')
-rw-r--r--test/files/neg/patmat-type-check.check10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/files/neg/patmat-type-check.check b/test/files/neg/patmat-type-check.check
index e045841ce1..721217c314 100644
--- a/test/files/neg/patmat-type-check.check
+++ b/test/files/neg/patmat-type-check.check
@@ -1,3 +1,12 @@
+patmat-type-check.scala:11: warning: fruitless type test: a value of type Test.Bop4[T] cannot also be a Seq[A]
+ def s3[T](x: Bop4[T]) = x match { case Seq('b', 'o', 'b') => true }
+ ^
+patmat-type-check.scala:15: warning: fruitless type test: a value of type Test.Bop5[_$1,T1,T2] cannot also be a Seq[A]
+ def s4[T1, T2](x: Bop5[_, T1, T2]) = x match { case Seq('b', 'o', 'b') => true }
+ ^
+patmat-type-check.scala:19: warning: fruitless type test: a value of type Test.Bop3[T] cannot also be a Seq[A]
+ def f4[T](x: Bop3[T]) = x match { case Seq('b', 'o', 'b') => true }
+ ^
patmat-type-check.scala:22: error: scrutinee is incompatible with pattern type;
found : Seq[A]
required: String
@@ -18,4 +27,5 @@ patmat-type-check.scala:30: error: scrutinee is incompatible with pattern type;
required: Test.Bop3[Char]
def f4[T](x: Bop3[Char]) = x match { case Seq('b', 'o', 'b') => true } // fail
^
+three warnings found
four errors found