diff options
author | Lukas Rytz <lukas.rytz@epfl.ch> | 2010-05-04 14:40:10 +0000 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@epfl.ch> | 2010-05-04 14:40:10 +0000 |
commit | 185b1c828a7f859b32b136e873373a9b79edc304 (patch) | |
tree | 984febdc294a050184ad7f55cb4d3d1bddae75b9 /src/compiler/scala/tools/nsc/typechecker/Namers.scala | |
parent | 20192c84a98212ba2de6f52553b4ec7dafb6c6c3 (diff) | |
download | scala-185b1c828a7f859b32b136e873373a9b79edc304.tar.gz scala-185b1c828a7f859b32b136e873373a9b79edc304.tar.bz2 scala-185b1c828a7f859b32b136e873373a9b79edc304.zip |
close #3384.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Namers.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Namers.scala | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index a7f573f98b..37f8a21bf8 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -607,17 +607,6 @@ trait Namers { self: Analyzer => vparamss.map(_.map(enterValueParam)) } - /** - * Finds the companion module of a class symbol. Calling .companionModule - * does not work for classes defined inside methods. - */ - private def companionModuleOf(clazz: Symbol) = { - var res = clazz.companionModule - if (res == NoSymbol) - res = context.lookup(clazz.name.toTermName, clazz.owner) - res - } - private def templateSig(templ: Template): Type = { val clazz = context.owner def checkParent(tpt: Tree): Type = { @@ -738,7 +727,7 @@ trait Namers { self: Analyzer => // @check: this seems to work only if the type completer of the class runs before the one of the // module class: the one from the module class removes the entry form caseClassOfModuleClass (see above). if (clazz.isClass && !clazz.hasFlag(MODULE)) { - Namers.this.caseClassOfModuleClass get companionModuleOf(clazz).moduleClass match { + Namers.this.caseClassOfModuleClass get companionModuleOf(clazz, context).moduleClass match { case Some(cdef) => def hasCopy(decls: Scope) = { decls.iterator exists (_.name == nme.copy) @@ -997,7 +986,7 @@ trait Namers { self: Analyzer => val parentNamer = if (isConstr) { val (cdef, nmr) = moduleNamer.getOrElse { - val module = companionModuleOf(meth.owner) + val module = companionModuleOf(meth.owner, context) module.initialize // call type completer (typedTemplate), adds the // module's templateNamer to classAndNamerOfModule val (cdef, nmr) = classAndNamerOfModule(module) |