diff options
author | Martin Odersky <odersky@gmail.com> | 2014-10-11 12:14:06 +0200 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2014-10-12 10:52:08 +0200 |
commit | 3c6cf3936228fc317b90ffca8b5d9dda2883e508 (patch) | |
tree | 2ac4a5b41c9f0e05fc964e865869cf79b3602a05 | |
parent | 74fa107dab3c2442bf14753926bb82f7325645ad (diff) | |
download | dotty-3c6cf3936228fc317b90ffca8b5d9dda2883e508.tar.gz dotty-3c6cf3936228fc317b90ffca8b5d9dda2883e508.tar.bz2 dotty-3c6cf3936228fc317b90ffca8b5d9dda2883e508.zip |
TypeTestCasts should test and cast wrt erased types
-rw-r--r-- | src/dotty/tools/dotc/transform/TypeTestsCasts.scala | 7 |
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 _ => |