summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Vigdorchik <eugenevigdorchik@epfl.ch>2011-01-03 19:13:05 +0000
committerEugene Vigdorchik <eugenevigdorchik@epfl.ch>2011-01-03 19:13:05 +0000
commit4e0d481418774c6013d03bfb16a553e47a075779 (patch)
treeb2dbbc85c09bfc4434eb31a9a12f7f753d665181
parent635bc9c17b0d35e9cf8029cf24aee8d3594a143f (diff)
downloadscala-4e0d481418774c6013d03bfb16a553e47a075779.tar.gz
scala-4e0d481418774c6013d03bfb16a553e47a075779.tar.bz2
scala-4e0d481418774c6013d03bfb16a553e47a075779.zip
Clear caseClassOfModuleClass lazily, otherwise ...
Clear caseClassOfModuleClass lazily, otherwise we lose information calculated during the namer phase upon next run triggered by the presentation compiler. Review by odersky.
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index 5e03c048c7..fc19188d9e 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -47,7 +47,9 @@ trait Namers { self: Analyzer =>
// synthetic `copy' (reps `apply', `unapply') methods are added. To compute
// their signatures, the corresponding ClassDef is needed.
// During naming, for each case class module symbol, the corresponding ClassDef
- // is stored in this map.
+ // is stored in this map. The map is cleared lazily, i.e. when the new symbol
+ // is created with the same name, the old one (if present) is wiped out, or the
+ // entry is deleted when it is used and no longer needed.
private[typechecker] val caseClassOfModuleClass = new HashMap[Symbol, ClassDef]
// Default getters of constructors are added to the companion object in the
@@ -59,7 +61,6 @@ trait Namers { self: Analyzer =>
private[typechecker] val classAndNamerOfModule = new HashMap[Symbol, (ClassDef, Namer)]
def resetNamer() {
- caseClassOfModuleClass.clear
classAndNamerOfModule.clear
}
@@ -203,6 +204,7 @@ trait Namers { self: Analyzer =>
updatePosFlags(c, tree.pos, tree.mods.flags)
setPrivateWithin(tree, c, tree.mods)
} else {
+ caseClassOfModuleClass -= c
var sym = context.owner.newClass(tree.pos, tree.name)
sym = sym.setFlag(tree.mods.flags | inConstructorFlag)
sym = setPrivateWithin(tree, sym, tree.mods)