diff options
author | Martin Odersky <odersky@gmail.com> | 2013-08-23 16:46:03 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-08-23 16:46:03 +0200 |
commit | 922717bd8a1ae60ddd48be2248f0c6d49fb44763 (patch) | |
tree | 111d1ec7a9b12501aa57b0e7af32b15611c71394 /src/dotty/tools/dotc/ast/TreeInfo.scala | |
parent | 873a3bc1a273974d7d47de054e68a92c29a359e8 (diff) | |
download | dotty-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.scala | 7 |
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 = { |