diff options
author | Lukas Rytz <lukas.rytz@epfl.ch> | 2010-08-11 12:32:07 +0000 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@epfl.ch> | 2010-08-11 12:32:07 +0000 |
commit | 3b8fee9184ebe1be9dfea690e180918b176726a3 (patch) | |
tree | 2d98c8eaeae5ad6119925778d2d18c59deadd7bc | |
parent | 41bfef808702c291d69d5f742628e1304632bdda (diff) | |
download | scala-3b8fee9184ebe1be9dfea690e180918b176726a3.tar.gz scala-3b8fee9184ebe1be9dfea690e180918b176726a3.tar.bz2 scala-3b8fee9184ebe1be9dfea690e180918b176726a3.zip |
Correct fix for see #3726.
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/TreeInfo.scala | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/TreeInfo.scala b/src/compiler/scala/tools/nsc/ast/TreeInfo.scala index 546e62f85a..394e9709a1 100644 --- a/src/compiler/scala/tools/nsc/ast/TreeInfo.scala +++ b/src/compiler/scala/tools/nsc/ast/TreeInfo.scala @@ -85,6 +85,13 @@ abstract class TreeInfo { tree.symbol.isStable && isPureExpr(qual) case TypeApply(fn, _) => isPureExpr(fn) + case Apply(fn, List()) => + /* Note: After uncurry, field accesses are represented as Apply(getter, Nil), + * so an Apply can also be pure. + * However, before typing, applications of nullary functional values are also + * Apply(function, Nil) trees. To prevent them from being treated as pure, + * we check that the callee is a method. */ + fn.symbol.isMethod && isPureExpr(fn) case Typed(expr, _) => isPureExpr(expr) case Block(stats, expr) => |