Skip to content

Commit 30bd0a7

Browse files
committed
Fix exception when calling makePackageObjPrefixExplicit with the root package
1 parent e29195d commit 30bd0a7

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

compiler/src/dotty/tools/dotc/core/TypeOps.scala

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -314,11 +314,14 @@ trait TypeOps { this: Context => // TODO: Make standalone object.
314314
case _ =>
315315
tpe
316316
}
317-
tpe.prefix match {
318-
case pre: ThisType if pre.cls is Package => tryInsert(pre.cls)
319-
case pre: TermRef if pre.symbol is Package => tryInsert(pre.symbol.moduleClass)
320-
case _ => tpe
321-
}
317+
if (tpe.symbol.isRoot)
318+
tpe
319+
else
320+
tpe.prefix match {
321+
case pre: ThisType if pre.cls is Package => tryInsert(pre.cls)
322+
case pre: TermRef if pre.symbol is Package => tryInsert(pre.symbol.moduleClass)
323+
case _ => tpe
324+
}
322325
}
323326

324327
/** Normalize a list of parent types of class `cls` that may contain refinements

0 commit comments

Comments
 (0)