aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/transform/TypeTestsCasts.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-10-11 12:14:06 +0200
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2014-10-12 10:52:08 +0200
commit3c6cf3936228fc317b90ffca8b5d9dda2883e508 (patch)
tree2ac4a5b41c9f0e05fc964e865869cf79b3602a05 /src/dotty/tools/dotc/transform/TypeTestsCasts.scala
parent74fa107dab3c2442bf14753926bb82f7325645ad (diff)
downloaddotty-3c6cf3936228fc317b90ffca8b5d9dda2883e508.tar.gz
dotty-3c6cf3936228fc317b90ffca8b5d9dda2883e508.tar.bz2
dotty-3c6cf3936228fc317b90ffca8b5d9dda2883e508.zip
TypeTestCasts should test and cast wrt erased types
Diffstat (limited to 'src/dotty/tools/dotc/transform/TypeTestsCasts.scala')
-rw-r--r--src/dotty/tools/dotc/transform/TypeTestsCasts.scala7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/transform/TypeTestsCasts.scala b/src/dotty/tools/dotc/transform/TypeTestsCasts.scala
index 6f5f29b60..c25e81af9 100644
--- a/src/dotty/tools/dotc/transform/TypeTestsCasts.scala
+++ b/src/dotty/tools/dotc/transform/TypeTestsCasts.scala
@@ -13,6 +13,7 @@ import core.TypeErasure.isUnboundedGeneric
import typer.ErrorReporting._
import ast.Trees._
import Erasure.Boxing._
+import core.TypeErasure._
/** This transform normalizes type tests and type casts,
* also replacing type tests with singleton argument type with reference equality check
@@ -92,11 +93,11 @@ trait TypeTestsCasts {
else
derivedTree(qual, defn.Any_asInstanceOf, argType)
}
-
+ def erasedArg = erasure(tree.args.head.tpe)
if (sym eq defn.Any_isInstanceOf)
- transformIsInstanceOf(qual, tree.args.head.tpe)
+ transformIsInstanceOf(qual, erasedArg)
else if (sym eq defn.Any_asInstanceOf)
- transformAsInstanceOf(tree.args.head.tpe)
+ transformAsInstanceOf(erasedArg)
else tree
case _ =>