Skip to content

Commit 50fe6eb

Browse files
committed
Merge pull request #849 from dotty-staging/fix-#840
Fix #840
2 parents 56f9ab8 + f786ce5 commit 50fe6eb

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/dotty/tools/dotc/transform/Erasure.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ object Erasure extends TypeTestsCasts{
400400
}
401401

402402
override def typedTypeApply(tree: untpd.TypeApply, pt: Type)(implicit ctx: Context) = {
403-
val ntree = interceptTypeApply(tree.asInstanceOf[TypeApply])
403+
val ntree = interceptTypeApply(tree.asInstanceOf[TypeApply])(ctx.withPhase(ctx.erasurePhase))
404404

405405
ntree match {
406406
case TypeApply(fun, args) =>

src/dotty/tools/dotc/transform/TypeTestsCasts.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ trait TypeTestsCasts {
4747

4848
def transformIsInstanceOf(expr:Tree, argType: Type): Tree = {
4949
def argCls = argType.classSymbol
50-
if (expr.tpe <:< argType)
50+
if ((expr.tpe <:< argType) && isPureExpr(expr))
5151
Literal(Constant(true)) withPos tree.pos
5252
else if (argCls.isPrimitiveValueClass)
5353
if (qualCls.isPrimitiveValueClass) Literal(Constant(qualCls == argCls)) withPos tree.pos

0 commit comments

Comments
 (0)