From eb1d52a99b7a5c7a0e849762ce02accc4a4ff22b Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Tue, 21 Jan 2014 13:46:22 +0100 Subject: SI-5954 Add a TODO comment with an idea for future work As the prophet once said: "'Tis better to never do at all than to have do and undo" Let's try that in 2.12. --- src/compiler/scala/tools/nsc/typechecker/Namers.scala | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index fd093614b5..51fbb390ed 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -443,6 +443,13 @@ 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 _) -- cgit v1.2.3