summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2009-03-24 18:51:57 +0000
committerPaul Phillips <paulp@improving.org>2009-03-24 18:51:57 +0000
commit4145de88b48e68746ae1669d1cc1f3d0f6bc89e2 (patch)
tree538c3468e33e4db4aa5768dc2da012d3913c2021 /src/compiler
parente33a70721e4c147bfc316f3e6d1bcd058021805c (diff)
downloadscala-4145de88b48e68746ae1669d1cc1f3d0f6bc89e2.tar.gz
scala-4145de88b48e68746ae1669d1cc1f3d0f6bc89e2.tar.bz2
scala-4145de88b48e68746ae1669d1cc1f3d0f6bc89e2.zip
fix for #1804
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
index 1dcc068cc2..c2096fe161 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
@@ -729,6 +729,17 @@ abstract class GenJVM extends SubComponent {
def conflictsIn(cls: Symbol, name: Name) =
cls.info.nonPrivateMembers.exists(_.name == name)
+ /** List of parents shared by both class and module, so we don't add forwarders
+ * for methods defined there - bug #1804 */
+ lazy val commonParents = {
+ val cps = module.info.baseClasses
+ val mps = module.linkedClassOfModule.info.baseClasses
+ cps.filter(mps contains)
+ }
+ /* the setter doesn't show up in members so we inspect the name */
+ def conflictsInCommonParent(name: Name) =
+ commonParents exists { cp => name startsWith (cp.name + "$") }
+
/** Should method `m' get a forwarder in the mirror class? */
def shouldForward(m: Symbol): Boolean =
atPhase(currentRun.picklerPhase) (
@@ -740,7 +751,9 @@ abstract class GenJVM extends SubComponent {
&& !(m.owner == definitions.AnyClass)
&& !module.isSubClass(module.linkedClassOfModule)
&& !conflictsIn(definitions.ObjectClass, m.name)
- && !conflictsIn(module.linkedClassOfModule, m.name))
+ && !conflictsInCommonParent(m.name)
+ && !conflictsIn(module.linkedClassOfModule, m.name)
+ )
assert(module.isModuleClass)
if (settings.debug.value)