@@ -190,19 +190,25 @@ class GenBCodePipeline(val entryPoints: List[Symbol], val int: DottyBackendInter
190
190
val claszSymbol = cd.symbol
191
191
192
192
// GenASM checks this before classfiles are emitted, https://github.com/scala/scala/commit/e4d1d930693ac75d8eb64c2c3c69f2fc22bec739
193
- val lowercaseJavaClassName = claszSymbol.name.toString.toLowerCase
194
- caseInsensitively.get(lowercaseJavaClassName) match {
195
- case None =>
196
- caseInsensitively.put(lowercaseJavaClassName, claszSymbol)
197
- case Some (dupClassSym) =>
198
- // Order is not deterministic so we enforce lexicographic order between the duplicates for error-reporting
199
- if (claszSymbol.name.toString < dupClassSym.name.toString)
200
- ctx.warning(s " Class ${claszSymbol.name} differs only in case from ${dupClassSym.name}. " +
201
- " Such classes will overwrite one another on case-insensitive filesystems." , claszSymbol.pos)
202
- else
203
- ctx.warning(s " Class ${dupClassSym.name} differs only in case from ${claszSymbol.name}. " +
204
- " Such classes will overwrite one another on case-insensitive filesystems." , dupClassSym.pos)
193
+ def checkName (claszSymbol : Symbol ): Unit = {
194
+ val lowercaseJavaClassName = claszSymbol.effectiveName.toString.toLowerCase
195
+ caseInsensitively.get(lowercaseJavaClassName) match {
196
+ case None =>
197
+ caseInsensitively.put(lowercaseJavaClassName, claszSymbol)
198
+ case Some (dupClassSym) =>
199
+ if (claszSymbol.effectiveName.toString != dupClassSym.effectiveName.toString) {
200
+ // Order is not deterministic so we enforce lexicographic order between the duplicates for error-reporting
201
+ val (cl1, cl2) =
202
+ if (claszSymbol.effectiveName.toString < dupClassSym.effectiveName.toString) (claszSymbol, dupClassSym)
203
+ else (dupClassSym, claszSymbol)
204
+ ctx.warning(s " Class ${cl1.effectiveName} differs only in case from ${cl2.effectiveName}. " +
205
+ " Such classes will overwrite one another on case-insensitive filesystems." , cl1.pos)
206
+ }
207
+ }
205
208
}
209
+ checkName(claszSymbol)
210
+ if (int.symHelper(claszSymbol).isModuleClass)
211
+ checkName(claszSymbol.companionModule)
206
212
207
213
// -------------- mirror class, if needed --------------
208
214
val mirrorC =
0 commit comments