diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-02-26 13:20:03 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-03-02 10:36:22 +0100 |
commit | 387fbf459efe5bb89f3d7a76c819f72b8f8fd58f (patch) | |
tree | 50783d1987088f7f7e084fe8e8d0d882376ea0de /src/reflect | |
parent | 88b2915790a6a2ccfa490de6e36aa355148a42b2 (diff) | |
download | scala-387fbf459efe5bb89f3d7a76c819f72b8f8fd58f.tar.gz scala-387fbf459efe5bb89f3d7a76c819f72b8f8fd58f.tar.bz2 scala-387fbf459efe5bb89f3d7a76c819f72b8f8fd58f.zip |
SI-7185 Avoid NPE in TreeInfo.isExprSafeToInline
We got there typechecking code with a redundant
layer of Block.
We can't express that in source code, so we test
this with manual tree construction and with XML
literals, which as reported produce such trees.
Diffstat (limited to 'src/reflect')
-rw-r--r-- | src/reflect/scala/reflect/internal/TreeInfo.scala | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/reflect/scala/reflect/internal/TreeInfo.scala b/src/reflect/scala/reflect/internal/TreeInfo.scala index 3040486076..3e74b5d22d 100644 --- a/src/reflect/scala/reflect/internal/TreeInfo.scala +++ b/src/reflect/scala/reflect/internal/TreeInfo.scala @@ -98,7 +98,8 @@ abstract class TreeInfo { // 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 && !fn.symbol.isLazy && isExprSafeToInline(fn) + // The callee might also be a Block, which has a null symbol, so we guard against that (SI-7185) + fn.symbol != null && fn.symbol.isMethod && !fn.symbol.isLazy && isExprSafeToInline(fn) case Typed(expr, _) => isExprSafeToInline(expr) case Block(stats, expr) => |