aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/ast/TreeInfo.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-08-23 16:46:03 +0200
committerMartin Odersky <odersky@gmail.com>2013-08-23 16:46:03 +0200
commit922717bd8a1ae60ddd48be2248f0c6d49fb44763 (patch)
tree111d1ec7a9b12501aa57b0e7af32b15611c71394 /src/dotty/tools/dotc/ast/TreeInfo.scala
parent873a3bc1a273974d7d47de054e68a92c29a359e8 (diff)
downloaddotty-922717bd8a1ae60ddd48be2248f0c6d49fb44763.tar.gz
dotty-922717bd8a1ae60ddd48be2248f0c6d49fb44763.tar.bz2
dotty-922717bd8a1ae60ddd48be2248f0c6d49fb44763.zip
Fixed two problems that lead to over-zealous lifting.
Diffstat (limited to 'src/dotty/tools/dotc/ast/TreeInfo.scala')
-rw-r--r--src/dotty/tools/dotc/ast/TreeInfo.scala7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/ast/TreeInfo.scala b/src/dotty/tools/dotc/ast/TreeInfo.scala
index 416c64079..adc268943 100644
--- a/src/dotty/tools/dotc/ast/TreeInfo.scala
+++ b/src/dotty/tools/dotc/ast/TreeInfo.scala
@@ -278,9 +278,9 @@ trait TypedTreeInfo extends TreeInfo[Type] {self: Trees.Instance[Type] =>
| Literal(_) =>
true
case Ident(_) =>
- tree.symbol is Stable
+ isIdempotentRef(tree)
case Select(qual, _) =>
- tree.symbol.isStable && isIdempotentExpr(qual)
+ isIdempotentRef(tree) && isIdempotentExpr(qual)
case TypeApply(fn, _) =>
isIdempotentExpr(fn)
/*
@@ -305,6 +305,9 @@ trait TypedTreeInfo extends TreeInfo[Type] {self: Trees.Instance[Type] =>
false
}
+ private def isIdempotentRef(tree: tpd.Tree)(implicit ctx: Context) =
+ tree.symbol.isStable || !tree.tpe.widen.isParameterless
+
/** Is symbol potentially a getter of a mutable variable?
*/
def mayBeVarGetter(sym: Symbol)(implicit ctx: Context): Boolean = {