Skip to content

Commit 444cffa

Browse files
committed
Be more careful where we fill in missing companion objects
- There might be several overloaded variants - There might be members with the same name that are not modules. These should be left alone.
1 parent 280744e commit 444cffa

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

compiler/src/dotty/tools/dotc/typer/Namer.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -708,11 +708,11 @@ class Namer { typer: Typer =>
708708
val classSym = ctx.effectiveScope.lookup(className.encode)
709709
if (classSym.isDefinedInCurrentRun) {
710710
val moduleName = className.toTermName
711-
val moduleSym = ctx.effectiveScope.lookup(moduleName.encode)
712-
if (!moduleSym.isDefinedInCurrentRun) {
713-
val absentModuleSymbol = ctx.newModuleSymbol(ctx.owner, moduleName, EmptyFlags, EmptyFlags, (_, _) => NoType)
714-
enterSymbol(absentModuleSymbol)
715-
}
711+
for (moduleSym <- ctx.effectiveScope.lookupAll(moduleName.encode))
712+
if (moduleSym.is(Module) && !moduleSym.isDefinedInCurrentRun) {
713+
val absentModuleSymbol = ctx.newModuleSymbol(ctx.owner, moduleName, EmptyFlags, EmptyFlags, (_, _) => NoType)
714+
enterSymbol(absentModuleSymbol)
715+
}
716716
}
717717
}
718718
}

0 commit comments

Comments
 (0)