summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Namers.scala
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2014-02-14 23:49:53 +0100
committerEugene Burmako <xeno.by@gmail.com>2014-02-14 23:49:53 +0100
commit465e538ef59171ac7d9e811dbdaec776f8a64ac7 (patch)
tree159f11ee7736daffa1a25abaaca9da49418a7ab6 /src/compiler/scala/tools/nsc/typechecker/Namers.scala
parent3dff364399d63c2dd317eb7bdf03f9d5216b2936 (diff)
parente86675f582ed8fef880f71744241f30e0d57a51c (diff)
downloadscala-465e538ef59171ac7d9e811dbdaec776f8a64ac7.tar.gz
scala-465e538ef59171ac7d9e811dbdaec776f8a64ac7.tar.bz2
scala-465e538ef59171ac7d9e811dbdaec776f8a64ac7.zip
Merge remote-tracking branch 'origin/master' into topic/palladium0
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Namers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index 60cae0c880..9b5b0e1f37 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -169,6 +169,13 @@ trait Namers extends MethodSynthesis {
def updatePosFlags(sym: Symbol, pos: Position, flags: Long): Symbol = {
debuglog("[overwrite] " + sym)
val newFlags = (sym.flags & LOCKED) | flags
+ sym.rawInfo match {
+ case tr: TypeRef =>
+ // !!! needed for: pos/t5954d; the uniques type cache will happilly serve up the same TypeRef
+ // over this mutated symbol, and we witness a stale cache for `parents`.
+ tr.invalidateCaches()
+ case _ =>
+ }
sym reset NoType setFlag newFlags setPos pos
sym.moduleClass andAlso (updatePosFlags(_, pos, moduleClassFlags(flags)))
@@ -457,6 +464,17 @@ trait Namers extends MethodSynthesis {
var m: Symbol = context.scope lookupModule tree.name
val moduleFlags = tree.mods.flags | MODULE
if (m.isModule && !m.isPackage && inCurrentScope(m) && (currentRun.canRedefine(m) || m.isSynthetic)) {
+ // This code accounts for the way the package objects found in the classpath are opened up
+ // early by the completer of the package itself. If the `packageobjects` phase then finds
+ // the same package object in sources, we have to clean the slate and remove package object
+ // members from the package class.
+ //
+ // TODO SI-4695 Pursue the approach in https://github.com/scala/scala/pull/2789 that avoids
+ // opening up the package object on the classpath at all if one exists in source.
+ if (m.isPackageObject) {
+ val packageScope = m.enclosingPackageClass.rawInfo.decls
+ packageScope.filter(_.owner != m.enclosingPackageClass).toList.foreach(packageScope unlink _)
+ }
updatePosFlags(m, tree.pos, moduleFlags)
setPrivateWithin(tree, m)
m.moduleClass andAlso (setPrivateWithin(tree, _))