aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-10-23 09:46:51 +0200
committerMartin Odersky <odersky@gmail.com>2015-10-23 09:46:51 +0200
commitf786ce5903670c7496e8a295ec1a49a6e512c896 (patch)
treedf2788decf5bafcff34c9d80e98219e7d4da63f2 /src
parent82afe5f3f4d0286a0202a959e03871eb7454dbec (diff)
downloaddotty-f786ce5903670c7496e8a295ec1a49a6e512c896.tar.gz
dotty-f786ce5903670c7496e8a295ec1a49a6e512c896.tar.bz2
dotty-f786ce5903670c7496e8a295ec1a49a6e512c896.zip
Don't drop impure expressions when eliding isInstanceOf tests.
Diffstat (limited to 'src')
-rw-r--r--src/dotty/tools/dotc/transform/TypeTestsCasts.scala2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/transform/TypeTestsCasts.scala b/src/dotty/tools/dotc/transform/TypeTestsCasts.scala
index 4ce64da33..98b8357b9 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