Skip to content

Commit 97f06e0

Browse files
committed
Refine condition for printing package objects
AN old-style package object of package `p` printed `package object p`. Since there are now several possible toplevel source files, we can't do the same for toplevel source file. I am not yet quite sure what to do instead. For the moment, we just print the name of the generated object.
1 parent a105398 commit 97f06e0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
807807
}
808808
if (sym.is(ModuleClass)) {
809809
val name =
810-
if (sym.isPackageObject) sym.owner.name
810+
if (sym.isPackageObject && sym.name == tpnme.PACKAGE) sym.owner.name
811811
else sym.name.stripModuleClassSuffix
812812
kindString(sym) ~~ (nameString(name) + idString(sym))
813813
}

0 commit comments

Comments
 (0)