Skip to content

Commit

Permalink
More low-level printing under -Yprint-debug
Browse files Browse the repository at this point in the history
  • Loading branch information
odersky committed Jun 6, 2019
1 parent 32c93e4 commit 6b3b446
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ class PlainPrinter(_ctx: Context) extends Printer {
def toText(sym: Symbol): Text =
(kindString(sym) ~~ {
if (sym.isAnonymousClass) toTextParents(sym.info.parents) ~~ "{...}"
else if (hasMeaninglessName(sym)) simpleNameString(sym.owner) + idString(sym)
else if (hasMeaninglessName(sym) && !printDebug) simpleNameString(sym.owner) + idString(sym)
else nameString(sym)
}).close

Expand Down
6 changes: 4 additions & 2 deletions compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
tp match {
case tp: ThisType if !printDebug =>
if (tp.cls.isAnonymousClass) return keywordStr("this")
if (tp.cls is ModuleClass) return fullNameString(tp.cls.sourceModule)
if (tp.cls.is(ModuleClass)) return fullNameString(tp.cls.sourceModule)
case _ =>
}
super.toTextRef(tp)
Expand Down Expand Up @@ -851,7 +851,9 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
case _ =>
}
def name =
if (sym.is(ModuleClass) && sym.isPackageObject && sym.name.stripModuleClassSuffix == tpnme.PACKAGE)
if (printDebug)
nameString(sym)
else if (sym.is(ModuleClass) && sym.isPackageObject && sym.name.stripModuleClassSuffix == tpnme.PACKAGE)
nameString(sym.owner.name)
else if (sym.is(ModuleClass))
nameString(sym.name.stripModuleClassSuffix)
Expand Down

0 comments on commit 6b3b446

Please sign in to comment.