summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-11-25 14:19:43 -0800
committerPaul Phillips <paulp@improving.org>2012-11-25 14:23:58 -0800
commit089cc9fee43a84ce4b93bf3c51b22136216bd831 (patch)
tree20fdff591d194bdd20a9e29c952cded52a1b7b2e /src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
parent2a8291a3568abc848e79acaacd82e90932a77c8a (diff)
downloadscala-089cc9fee43a84ce4b93bf3c51b22136216bd831.tar.gz
scala-089cc9fee43a84ce4b93bf3c51b22136216bd831.tar.bz2
scala-089cc9fee43a84ce4b93bf3c51b22136216bd831.zip
Fix for SI-6712, bug in object lifting.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/RefChecks.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/RefChecks.scala16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
index ee7805cb3d..599c0d3f14 100644
--- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
@@ -1264,13 +1264,15 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans
val cdef = ClassDef(mods | MODULE, name.toTypeName, Nil, impl) setSymbol classSym setType NoType
def findOrCreateModuleVar() = localTyper.typedPos(tree.pos) {
- lazy val createModuleVar = gen.mkModuleVarDef(sym)
- sym.enclClass.info.decl(nme.moduleVarName(sym.name.toTermName)) match {
- // In case we are dealing with local symbol then we already have
- // to correct error with forward reference
- case NoSymbol => createModuleVar
- case vsym => ValDef(vsym)
- }
+ // See SI-5012, SI-6712.
+ val vsym = (
+ if (sym.owner.isTerm) NoSymbol
+ else sym.enclClass.info.decl(nme.moduleVarName(sym.name.toTermName))
+ )
+ // In case we are dealing with local symbol then we already have
+ // to correct error with forward reference
+ if (vsym == NoSymbol) gen.mkModuleVarDef(sym)
+ else ValDef(vsym)
}
def createStaticModuleAccessor() = afterRefchecks {
val method = (