aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dotty/tools/dotc/transform/TypeTestsCasts.scala2
-rw-r--r--tests/run/i1490.check3
-rw-r--r--tests/run/i1490.scala13
3 files changed, 17 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/transform/TypeTestsCasts.scala b/src/dotty/tools/dotc/transform/TypeTestsCasts.scala
index 6de2bf44c..3774127fa 100644
--- a/src/dotty/tools/dotc/transform/TypeTestsCasts.scala
+++ b/src/dotty/tools/dotc/transform/TypeTestsCasts.scala
@@ -100,7 +100,7 @@ trait TypeTestsCasts {
* The transform happens before erasure of `argType`, thus cannot be merged
* with `transformIsInstanceOf`, which depends on erased type of `argType`.
*/
- def transformOrTypeTest(qual: Tree, argType: Type): Tree = argType match {
+ def transformOrTypeTest(qual: Tree, argType: Type): Tree = argType.dealias match {
case OrType(tp1, tp2) =>
evalOnce(qual) { fun =>
transformOrTypeTest(fun, tp1)
diff --git a/tests/run/i1490.check b/tests/run/i1490.check
new file mode 100644
index 000000000..9e8a46acf
--- /dev/null
+++ b/tests/run/i1490.check
@@ -0,0 +1,3 @@
+true
+true
+false
diff --git a/tests/run/i1490.scala b/tests/run/i1490.scala
new file mode 100644
index 000000000..554bc3940
--- /dev/null
+++ b/tests/run/i1490.scala
@@ -0,0 +1,13 @@
+class Base {
+ type T = Int | Boolean
+ def test(x: Object) = x.isInstanceOf[T]
+}
+
+object Test {
+ def main(args: Array[String]) = {
+ val b = new Base
+ println(b.test(Int.box(3)))
+ println(b.test(Boolean.box(false)))
+ println(b.test(Double.box(3.4)))
+ }
+} \ No newline at end of file