Skip to content

Commit 63e42d3

Browse files
committed
Add assertion to ensure: if the parents of a module is empty, it must be a package.
1 parent 8f4210e commit 63e42d3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1963,7 +1963,10 @@ trait Applications extends Compatibility {
19631963
def widenPrefix(alt: TermRef): Type = alt.prefix.widen match
19641964
case pre: (TypeRef | ThisType) if pre.typeSymbol.is(Module) =>
19651965
val ps = pre.parents
1966-
if ps.isEmpty then pre
1966+
if ps.isEmpty then
1967+
// The parents of a module class are non-empty, unless the module is a package.
1968+
assert(pre.typeSymbol.is(Package), pre)
1969+
pre
19671970
else ps.reduceLeft(TypeComparer.andType(_, _))
19681971
case wpre => wpre
19691972

0 commit comments

Comments
 (0)