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 | |
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')
-rw-r--r-- | src/dotty/tools/dotc/ast/TreeInfo.scala | 7 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 1 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/Applications.scala | 2 |
3 files changed, 6 insertions, 4 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 = { diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index 8f10816e9..61af2b2a5 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -613,7 +613,6 @@ object Types { case _ => true } - /* Not sure whether we'll need this final def firstParamTypes: List[Type] = this match { case mt: MethodType => mt.paramTypes diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala index e5e8be05b..99e29fb30 100644 --- a/src/dotty/tools/dotc/typer/Applications.scala +++ b/src/dotty/tools/dotc/typer/Applications.scala @@ -451,7 +451,7 @@ trait Applications extends Compatibility { self: Typer => new ApplyToTyped(app, fun, methRef, args, resultType).result def typedApply(fun: Tree, methRef: TermRef, args: List[Tree], resultType: Type)(implicit ctx: Context): Tree = - typedApply(untpd.Apply(untpd.TypedSplice(fun), Nil), fun, methRef, args, resultType) + typedApply(untpd.Apply(untpd.TypedSplice(fun), args), fun, methRef, args, resultType) def typedApply(tree: untpd.Apply, pt: Type)(implicit ctx: Context): Tree = { if (ctx.mode is Mode.Pattern) |