diff options
author | Paul Phillips <paulp@improving.org> | 2010-04-17 19:44:24 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-04-17 19:44:24 +0000 |
commit | 0ffb0708fa5b154f53e35973d99239a94af755ca (patch) | |
tree | cf60d981b2678cd0e950128723d9c7b1c11262d2 | |
parent | ff714a46212b8280918243a1a7f9b54f2f045880 (diff) | |
download | scala-0ffb0708fa5b154f53e35973d99239a94af755ca.tar.gz scala-0ffb0708fa5b154f53e35973d99239a94af755ca.tar.bz2 scala-0ffb0708fa5b154f53e35973d99239a94af755ca.zip |
Fix and test case for forwarder duplicate bug.
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala | 4 | ||||
-rw-r--r-- | test/files/run/bug3004.scala | 14 |
2 files changed, 16 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala index 5318c76311..dc193b03db 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala @@ -851,7 +851,7 @@ abstract class GenJVM extends SubComponent { def addForwarders(jclass: JClass, module: Symbol) { addForwarders(jclass, module, _ => true) } def addForwarders(jclass: JClass, module: Symbol, cond: (Symbol) => Boolean) { def conflictsIn(cls: Symbol, name: Name) = - cls.info.nonPrivateMembers.exists(_.name == name) + cls.info.members exists (_.name == name) /** List of parents shared by both class and module, so we don't add forwarders * for methods defined there - bug #1804 */ @@ -874,7 +874,7 @@ abstract class GenJVM extends SubComponent { atPhase(currentRun.picklerPhase) ( m.owner != definitions.ObjectClass && m.isMethod - && !m.hasFlag(Flags.CASE | Flags.PROTECTED | Flags.DEFERRED | Flags.SPECIALIZED) + && !m.hasFlag(Flags.CASE | Flags.PRIVATE | Flags.PROTECTED | Flags.DEFERRED | Flags.SPECIALIZED) && !m.isConstructor && !m.isStaticMember && !(m.owner == definitions.AnyClass) diff --git a/test/files/run/bug3004.scala b/test/files/run/bug3004.scala new file mode 100644 index 0000000000..a1e9c6c72f --- /dev/null +++ b/test/files/run/bug3004.scala @@ -0,0 +1,14 @@ +object MyClass { + val duplicate: Int = 10 +} + +class MyClass { + private val duplicate = MyClass.duplicate +} + +object Test { + def main(args: Array[String]): Unit = { + val x = new MyClass + () + } +} |