Skip to content

Commit 5ca28dd

Browse files
committed
Better printing of NamedTuple type trees
Use the sugared representation, not the raw NamedTuple type tree.
1 parent db2464f commit 5ca28dd

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,12 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
573573
changePrec(AndTypePrec) { toText(args(0)) ~ " & " ~ atPrec(AndTypePrec + 1) { toText(args(1)) } }
574574
else if defn.isFunctionSymbol(tpt.symbol)
575575
&& tpt.isInstanceOf[TypeTree] && tree.hasType && !printDebug
576-
then changePrec(GlobalPrec) { toText(tree.typeOpt) }
576+
then
577+
changePrec(GlobalPrec) { toText(tree.typeOpt) }
578+
else if tpt.symbol == defn.NamedTupleTypeRef.symbol
579+
&& !printDebug && tree.typeOpt.exists
580+
then
581+
toText(tree.typeOpt)
577582
else args match
578583
case arg :: _ if arg.isTerm =>
579584
toTextLocal(tpt) ~ "(" ~ Text(args.map(argText), ", ") ~ ")"

0 commit comments

Comments
 (0)