summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Namers.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-09-26 12:13:03 -0700
committerPaul Phillips <paulp@improving.org>2012-09-26 12:24:44 -0700
commit83b5d4c0c9af462fc562c571f17dfcd00f47255d (patch)
tree711c1d198e9b226b1592b65742d2b0c1d61e86bc /src/compiler/scala/tools/nsc/typechecker/Namers.scala
parentb45a91fe228be063b9f9192cc135459f32d82ae0 (diff)
downloadscala-83b5d4c0c9af462fc562c571f17dfcd00f47255d.tar.gz
scala-83b5d4c0c9af462fc562c571f17dfcd00f47255d.tar.bz2
scala-83b5d4c0c9af462fc562c571f17dfcd00f47255d.zip
Comments explaining some brokenness in Namers.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Namers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index df8eb9c6b9..55ec8bead4 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -161,6 +161,9 @@ trait Namers extends MethodSynthesis {
else innerNamer
}
+ // FIXME - this logic needs to be thoroughly explained
+ // and justified. I know it's wrong with repect to package
+ // objects, but I think it's also wrong in other ways.
protected def conflict(newS: Symbol, oldS: Symbol) = (
( !oldS.isSourceMethod
|| nme.isSetterName(newS.name)
@@ -188,6 +191,19 @@ trait Namers extends MethodSynthesis {
/** Enter symbol into given scope and return symbol itself */
def enterInScope(sym: Symbol, scope: Scope): Symbol = {
+ // FIXME - this is broken in a number of ways.
+ //
+ // 1) If "sym" allows overloading, that is not itself sufficient to skip
+ // the check, because "prev.sym" also must allow overloading.
+ //
+ // 2) There is nothing which reconciles a package's scope with
+ // the package object's scope. This is the source of many bugs
+ // with e.g. defining a case class in a package object. When
+ // compiling against classes, the class symbol is created in the
+ // package and in the package object, and the conflict is undetected.
+ // There is also a non-deterministic outcome for situations like
+ // an object with the same name as a method in the package object.
+
// allow for overloaded methods
if (!allowsOverload(sym)) {
val prev = scope.lookupEntry(sym.name)