diff options
author | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-07-05 14:59:26 +0200 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-07-11 17:01:33 +0200 |
commit | d852c9b8b4f261bff3bd32127f70378225bb6831 (patch) | |
tree | d6c4c466c40ffa3e886100d3c43f803272a5bddd /test/files/pos | |
parent | 12e1a9a5826e6b76687d65520929f41c9498777b (diff) | |
download | scala-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')
-rw-r--r-- | test/files/pos/t6022.flags | 1 | ||||
-rw-r--r-- | test/files/pos/t6022.scala | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/test/files/pos/t6022.flags b/test/files/pos/t6022.flags new file mode 100644 index 0000000000..e8fb65d50c --- /dev/null +++ b/test/files/pos/t6022.flags @@ -0,0 +1 @@ +-Xfatal-warnings
\ No newline at end of file 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 |