Skip to content

Commit dfa89ef

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 4c53c67 commit dfa89ef

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
802802
}
803803
if (sym.is(ModuleClass)) {
804804
val name =
805-
if (sym.isPackageObject) sym.owner.name
805+
if (sym.isPackageObject && sym.name == tpnme.PACKAGE) sym.owner.name
806806
else sym.name.stripModuleClassSuffix
807807
kindString(sym) ~~ (nameString(name) + idString(sym))
808808
}

0 commit comments

Comments
 (0)