Skip to content

Commit dcfebd8

Browse files
committed
Better printing of anonymous classes.
Now prints `C{...}` instead of `$anon`.
1 parent 52d6ac3 commit dcfebd8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/dotty/tools/dotc/printing/PlainPrinter.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,8 @@ class PlainPrinter(_ctx: Context) extends Printer {
354354

355355
def toText(sym: Symbol): Text =
356356
(kindString(sym) ~~ {
357-
if (hasMeaninglessName(sym)) simpleNameString(sym.owner) + idString(sym)
357+
if (sym.isAnonymousClass) toText(sym.info.parents, " with ") ~ "{...}"
358+
else if (hasMeaninglessName(sym)) simpleNameString(sym.owner) + idString(sym)
358359
else nameString(sym)
359360
}).close
360361

0 commit comments

Comments
 (0)