diff options
author | Josh Suereth <Joshua.Suereth@gmail.com> | 2012-10-31 08:10:59 -0700 |
---|---|---|
committer | Josh Suereth <Joshua.Suereth@gmail.com> | 2012-10-31 08:10:59 -0700 |
commit | bf7e234d4964af2e3d95e149edccc66f4dc25b9e (patch) | |
tree | b13d38682676a7e76532b1c2c38c2b3103e51586 /src/compiler | |
parent | ae0171321b94c42a36d0987503450ce2657fd516 (diff) | |
parent | 0527b2549bcada2fda2201daa630369b377d0877 (diff) | |
download | scala-bf7e234d4964af2e3d95e149edccc66f4dc25b9e.tar.gz scala-bf7e234d4964af2e3d95e149edccc66f4dc25b9e.tar.bz2 scala-bf7e234d4964af2e3d95e149edccc66f4dc25b9e.zip |
Merge pull request #1532 from hubertp/2.10.0-wip-issue/5031
Fixes SI-5031 for separate compilation scenario.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala | 5 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala | 5 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala index f9eeb41e6d..6d7948f0a9 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala @@ -558,7 +558,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters { def innerClassSymbolFor(s: Symbol): Symbol = if (s.isClass) s else if (s.isModule) s.moduleClass else NoSymbol - /** Return the a name of this symbol that can be used on the Java platform. It removes spaces from names. + /** Return the name of this symbol that can be used on the Java platform. It removes spaces from names. * * Special handling: * scala.Nothing erases to scala.runtime.Nothing$ @@ -607,7 +607,8 @@ abstract class GenASM extends SubComponent with BytecodeWriters { case None => reverseJavaName.put(internalName, trackedSym) case Some(oldsym) => - assert((oldsym == trackedSym) || (oldsym == RuntimeNothingClass) || (oldsym == RuntimeNullClass), // In contrast, neither NothingClass nor NullClass show up bytecode-level. + assert((oldsym == trackedSym) || (oldsym == RuntimeNothingClass) || (oldsym == RuntimeNullClass) || + (oldsym.isModuleClass && (oldsym.sourceModule == trackedSym.sourceModule)), // In contrast, neither NothingClass nor NullClass show up bytecode-level. "how can getCommonSuperclass() do its job if different class symbols get the same bytecode-level internal name: " + internalName) } } diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala index 8fd8dfaf83..9caafe6912 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala @@ -94,7 +94,10 @@ abstract class ClassfileParser { pushBusy(root) { this.in = new AbstractFileReader(file) this.clazz = if (root.isModule) root.companionClass else root - this.staticModule = clazz.companionModule + // WARNING! do no use clazz.companionModule to find staticModule. + // In a situation where root can be defined, but its companionClass not, + // this would give incorrect results (see SI-5031 in separate compilation scenario) + this.staticModule = if (root.isModule) root else root.companionModule this.isScala = false parseHeader |