Skip to content

Commit fe3125f

Browse files
committed
Fix printing of function type trees
1 parent ddb9c01 commit fe3125f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,9 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
511511
changePrec(OrTypePrec) { toText(args(0)) ~ " | " ~ atPrec(OrTypePrec + 1) { toText(args(1)) } }
512512
else if (tpt.symbol == defn.andType && args.length == 2)
513513
changePrec(AndTypePrec) { toText(args(0)) ~ " & " ~ atPrec(AndTypePrec + 1) { toText(args(1)) } }
514+
else if defn.isFunctionClass(tpt.symbol)
515+
&& tpt.isInstanceOf[TypeTree] && tree.hasType && !printDebug
516+
then changePrec(GlobalPrec) { toText(tree.typeOpt) }
514517
else args match
515518
case arg :: _ if arg.isTerm =>
516519
toTextLocal(tpt) ~ "(" ~ Text(args.map(argText), ", ") ~ ")"

0 commit comments

Comments
 (0)