diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-03-10 09:11:50 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-03-10 10:10:42 +0100 |
commit | 33b499cd04342a49bd5c4f5bf0e2fab88b69069c (patch) | |
tree | a5aff002f2d3255322cf9dac6c63a826f984e285 /src/compiler | |
parent | 889020dfab9f99a3198528fedb699c061027acab (diff) | |
download | scala-33b499cd04342a49bd5c4f5bf0e2fab88b69069c.tar.gz scala-33b499cd04342a49bd5c4f5bf0e2fab88b69069c.tar.bz2 scala-33b499cd04342a49bd5c4f5bf0e2fab88b69069c.zip |
SI-7233 Account for aliased imports in eta expansion.
Buggy:
treeCopy.Select(sel, sel.qual, sel.name) setSymbol null
Select(sel, sel.qual, sel.name)
Okay:
treeCopy.Select(sel, sel.qual, sel.name)
Select(sel, sel.qual, sel.symbol.name) // but doesn't copyAttrs!
It is an easy mistake to make, I've found one more occurance:
def foo(a: Any) = { import a.{toString => toS}; toS }
error: uncaught exception during compilation: scala.reflect.internal.FatalError
scala.reflect.internal.FatalError: class Object does not have a member toS
at scala.reflect.internal.Definitions$DefinitionsClass.scala$reflect$internal$Definitions$DefinitionsClass$$fatalMissingSymbol(Definitions.scala:1028)
A followup commit will address that problem.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/EtaExpansion.scala | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/EtaExpansion.scala b/src/compiler/scala/tools/nsc/typechecker/EtaExpansion.scala index bbba7e0435..57b9dfe3e4 100644 --- a/src/compiler/scala/tools/nsc/typechecker/EtaExpansion.scala +++ b/src/compiler/scala/tools/nsc/typechecker/EtaExpansion.scala @@ -101,6 +101,7 @@ trait EtaExpansion { self: Analyzer => case TypeApply(fn, args) => treeCopy.TypeApply(tree, liftoutPrefix(fn), args) setType null case Select(qual, name) => + val name = tree.symbol.name // account for renamed imports, SI-7233 treeCopy.Select(tree, liftout(qual, false), name) setSymbol NoSymbol setType null case Ident(name) => tree |