diff --git a/src/dotty/tools/dotc/transform/Erasure.scala b/src/dotty/tools/dotc/transform/Erasure.scala index b1c8969976a5..a414c639958a 100644 --- a/src/dotty/tools/dotc/transform/Erasure.scala +++ b/src/dotty/tools/dotc/transform/Erasure.scala @@ -400,7 +400,7 @@ object Erasure extends TypeTestsCasts{ } override def typedTypeApply(tree: untpd.TypeApply, pt: Type)(implicit ctx: Context) = { - val ntree = interceptTypeApply(tree.asInstanceOf[TypeApply]) + val ntree = interceptTypeApply(tree.asInstanceOf[TypeApply])(ctx.withPhase(ctx.erasurePhase)) ntree match { case TypeApply(fun, args) => diff --git a/src/dotty/tools/dotc/transform/TypeTestsCasts.scala b/src/dotty/tools/dotc/transform/TypeTestsCasts.scala index 4ce64da33dd0..98b8357b99be 100644 --- a/src/dotty/tools/dotc/transform/TypeTestsCasts.scala +++ b/src/dotty/tools/dotc/transform/TypeTestsCasts.scala @@ -47,7 +47,7 @@ trait TypeTestsCasts { def transformIsInstanceOf(expr:Tree, argType: Type): Tree = { def argCls = argType.classSymbol - if (expr.tpe <:< argType) + if ((expr.tpe <:< argType) && isPureExpr(expr)) Literal(Constant(true)) withPos tree.pos else if (argCls.isPrimitiveValueClass) if (qualCls.isPrimitiveValueClass) Literal(Constant(qualCls == argCls)) withPos tree.pos