summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Namers.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2014-01-21 13:46:22 +0100
committerJason Zaugg <jzaugg@gmail.com>2014-01-21 13:46:22 +0100
commiteb1d52a99b7a5c7a0e849762ce02accc4a4ff22b (patch)
tree781873e73d942338b874331f6f1c9fef8ae92c5a /src/compiler/scala/tools/nsc/typechecker/Namers.scala
parent357905c9555f8081784acd1912cf0681b145ca8b (diff)
downloadscala-eb1d52a99b7a5c7a0e849762ce02accc4a4ff22b.tar.gz
scala-eb1d52a99b7a5c7a0e849762ce02accc4a4ff22b.tar.bz2
scala-eb1d52a99b7a5c7a0e849762ce02accc4a4ff22b.zip
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.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Namers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala7
1 files changed, 7 insertions, 0 deletions
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 _)