Skip to content

Commit becf98a

Browse files
Merge pull request #4187 from dotty-staging/fix-#4185
Fix #4185: Do not check names for modules that will not be emitted
2 parents 215234e + 9aa2915 commit becf98a

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

compiler/src/dotty/tools/backend/jvm/GenBCode.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,11 @@ class GenBCodePipeline(val entryPoints: List[Symbol], val int: DottyBackendInter
207207
}
208208
}
209209
checkName(claszSymbol)
210-
if (int.symHelper(claszSymbol).isModuleClass)
211-
checkName(claszSymbol.companionModule)
210+
if (int.symHelper(claszSymbol).isModuleClass) {
211+
val companionModule = claszSymbol.companionModule
212+
if (int.symHelper(companionModule.owner).isPackageClass)
213+
checkName(companionModule)
214+
}
212215

213216
// -------------- mirror class, if needed --------------
214217
val mirrorC =

compiler/test/dotty/tools/dotc/CompilationTests.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ class CompilationTests extends ParallelTesting {
5959
compileFile("tests/pos-special/i3323b.scala", defaultOptions.and("-Xfatal-warnings")) +
6060
compileFile("tests/pos-special/i3589-b.scala", defaultOptions.and("-Xfatal-warnings")) +
6161
compileFile("tests/pos-special/i4166.scala", defaultOptions.and("-Xfatal-warnings")) +
62+
compileFile("tests/pos-special/i4185.scala", defaultOptions.and("-Xfatal-warnings")) +
6263
compileFile("tests/pos-special/completeFromSource/Test.scala", defaultOptions.and("-sourcepath", "tests/pos-special")) +
6364
compileFile("tests/pos-special/completeFromSource/Test2.scala", defaultOptions.and("-sourcepath", "tests/pos-special")) +
6465
compileFile("tests/pos-special/completeFromSource/Test3.scala", defaultOptions.and("-sourcepath", "tests/pos-special", "-scansource")) +

tests/pos-special/i4185.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
object ord {
2+
class Ord
3+
object Ord
4+
}

0 commit comments

Comments
 (0)