diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2014-11-06 15:18:41 +1000 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2014-11-07 18:19:31 +1000 |
commit | 8d84b62fc9ca2bc01c7e3119088ddac185695124 (patch) | |
tree | d4d1af8c69bee6c9b697842923aad4882320302f /src/compiler | |
parent | 33393c759cc6081cffc3089baf806c08d64dbffc (diff) | |
download | scala-8d84b62fc9ca2bc01c7e3119088ddac185695124.tar.gz scala-8d84b62fc9ca2bc01c7e3119088ddac185695124.tar.bz2 scala-8d84b62fc9ca2bc01c7e3119088ddac185695124.zip |
SI-7974 Fix over-eager optimization of Symbol literals
A classic mistake of discarding a non-trivial qualifier.
We actually should have fixed this before merging #3149, as it
was raised in review, but I suppose we got too caught up in the
difficulty of resolving the right overload of `Symbol_apply` that we
forgot.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/CleanUp.scala | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/CleanUp.scala b/src/compiler/scala/tools/nsc/transform/CleanUp.scala index e5a19205ae..c29826551b 100644 --- a/src/compiler/scala/tools/nsc/transform/CleanUp.scala +++ b/src/compiler/scala/tools/nsc/transform/CleanUp.scala @@ -520,7 +520,9 @@ abstract class CleanUp extends Statics with Transform with ast.TreeDSL { * And, finally, be advised - Scala's Symbol literal (scala.Symbol) and the Symbol class of the compiler * have little in common. */ - case Apply(fn, (arg @ Literal(Constant(symname: String))) :: Nil) if fn.symbol == Symbol_apply && !currentClass.isTrait => + case Apply(fn @ Select(qual, _), (arg @ Literal(Constant(symname: String))) :: Nil) + if treeInfo.isQualifierSafeToElide(qual) && fn.symbol == Symbol_apply && !currentClass.isTrait => + def transformApply = { // add the symbol name to a map if it's not there already val rhs = gen.mkMethodCall(Symbol_apply, arg :: Nil) |