Skip to content

Commit

Permalink
Add assertion to ensure: if the parents of a module is empty, it must…
Browse files Browse the repository at this point in the history
… be a package.
  • Loading branch information
noti0na1 committed Oct 3, 2024
1 parent 8f4210e commit 63e42d3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion compiler/src/dotty/tools/dotc/typer/Applications.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1963,7 +1963,10 @@ trait Applications extends Compatibility {
def widenPrefix(alt: TermRef): Type = alt.prefix.widen match
case pre: (TypeRef | ThisType) if pre.typeSymbol.is(Module) =>
val ps = pre.parents
if ps.isEmpty then pre
if ps.isEmpty then
// The parents of a module class are non-empty, unless the module is a package.
assert(pre.typeSymbol.is(Package), pre)
pre
else ps.reduceLeft(TypeComparer.andType(_, _))
case wpre => wpre

Expand Down

0 comments on commit 63e42d3

Please sign in to comment.