Skip to content

Commit 10e182b

Browse files
committed
Fix AppliedTermRef pretty printing
1 parent 058c673 commit 10e182b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ class PlainPrinter(_ctx: Context) extends Printer {
142142
toTextRef(tp) ~ ".type"
143143
case tp: TermRef if tp.denot.isOverloaded =>
144144
"<overloaded " ~ toTextRef(tp) ~ ">"
145+
case tp: AppliedTermRef =>
146+
"{" ~ toTextRef(tp) ~ "}"
145147
case tp: TypeRef =>
146148
if (printWithoutPrefix.contains(tp.symbol))
147149
toText(tp.name)
@@ -291,8 +293,11 @@ class PlainPrinter(_ctx: Context) extends Printer {
291293
case tp: TermRef =>
292294
toTextPrefix(tp.prefix) ~ selectionString(tp)
293295
case AppliedTermRef(fn, args) =>
294-
// TODO(gsps): Print AppliedTermRef as in surface syntax (using curly braces)
295-
(toTextRef(fn) ~ "(" ~ Text(args map argText, ", ") ~ ")").close
296+
val argTexts = args.map {
297+
case arg: SingletonType => toTextRef(arg)
298+
case arg => argText(arg)
299+
}
300+
(toTextRef(fn) ~ "(" ~ Text(argTexts, ", ") ~ ")").close
296301
case tp: ThisType =>
297302
nameString(tp.cls) + ".this"
298303
case SuperType(thistpe: SingletonType, _) =>

0 commit comments

Comments
 (0)