We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 68b7b75 commit 9a41716Copy full SHA for 9a41716
compiler/src/dotty/tools/dotc/typer/Typer.scala
@@ -2855,7 +2855,9 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
2855
val pkg = pid1.symbol
2856
pid1 match
2857
case pid1: RefTree if pkg.is(Package) =>
2858
- if ctx.owner != defn.EmptyPackageClass then
+ if ctx.owner != defn.RootClass // valid top-level "package _root_"
2859
+ && ctx.owner != defn.EmptyPackageClass // valid "package _root_" after parser's "package <empty>" wrapper
2860
+ then
2861
checkNonRootName(pid1.name, pid1.span)
2862
inContext(ctx.packageContext(tree, pkg)) {
2863
// If it exists, complete the class containing the top-level definitions
0 commit comments