summaryrefslogtreecommitdiff
path: root/test/files/pos/t6022.scala
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2012-07-05 14:59:26 +0200
committerAdriaan Moors <adriaan.moors@epfl.ch>2012-07-11 17:01:33 +0200
commitd852c9b8b4f261bff3bd32127f70378225bb6831 (patch)
treed6c4c466c40ffa3e886100d3c43f803272a5bddd /test/files/pos/t6022.scala
parent12e1a9a5826e6b76687d65520929f41c9498777b (diff)
downloadscala-d852c9b8b4f261bff3bd32127f70378225bb6831.tar.gz
scala-d852c9b8b4f261bff3bd32127f70378225bb6831.tar.bz2
scala-d852c9b8b4f261bff3bd32127f70378225bb6831.zip
SI-6022 model type-test-implication better
we use subtyping as a model for implication between instanceof tests i.e., when S <:< T we assume x.isInstanceOf[S] implies x.isInstanceOf[T] unfortunately this is not true in general. SI-6022 expects instanceOfTpImplies(ProductClass.tpe, AnyRefClass.tpe), but ProductClass.tpe <:< AnyRefClass.tpe does not hold because Product extends Any however, if x.isInstanceOf[Product] holds, so does x.isInstanceOf[AnyRef], and that's all we care about when modeling type tests
Diffstat (limited to 'test/files/pos/t6022.scala')
-rw-r--r--test/files/pos/t6022.scala7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/files/pos/t6022.scala b/test/files/pos/t6022.scala
new file mode 100644
index 0000000000..522c3352c7
--- /dev/null
+++ b/test/files/pos/t6022.scala
@@ -0,0 +1,7 @@
+class Test {
+ (null: Any) match {
+ case x: AnyRef if false =>
+ case list: Option[_] =>
+ case product: Product => // change Product to String and it's all good
+ }
+} \ No newline at end of file