Skip to content

Commit 9c8976d

Browse files
committed
Hack ClassFileParser to not treat Null$ or Nothing$ as modules.
They are classes.
1 parent 4b948aa commit 9c8976d

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/dotty/tools/dotc/core/StdNames.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,9 @@ object StdNames {
510510
val wrap: N = "wrap"
511511
val zero: N = "zero"
512512
val zip: N = "zip"
513+
val nothingRuntimeClass: N = "scala.runtime.Nothing$"
514+
val nullRuntimeClass: N = "scala.runtime.Null$"
515+
513516

514517
val synthSwitch: N = "$synthSwitch"
515518

src/dotty/tools/dotc/core/pickling/ClassfileParser.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,9 @@ class ClassfileParser(
875875
val start = starts(index)
876876
if (in.buf(start).toInt != CONSTANT_CLASS) errorBadTag(start)
877877
val name = getExternalName(in.getChar(start + 1))
878-
if (name.isModuleClassName) c = ctx.requiredModule(name.sourceModuleName)
878+
if (name.isModuleClassName && (name ne nme.nothingRuntimeClass) && (name ne nme.nullRuntimeClass))
879+
// Null$ and Nothing$ ARE classes
880+
c = ctx.requiredModule(name.sourceModuleName)
879881
else c = classNameToSymbol(name)
880882
values(index) = c
881883
}

0 commit comments

Comments
 (0)