Skip to content

Commit 64d613b

Browse files
committed
Fix printing of match types
Since we don't use function types for cases anymore, we have to insert the `=>` explicitly.
1 parent 62ffcd5 commit 64d613b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,10 @@ class PlainPrinter(_ctx: Context) extends Printer {
166166
changePrec(OrTypePrec) { toText(tp1) ~ " | " ~ atPrec(OrTypePrec + 1) { toText(tp2) } }
167167
case MatchType(bound, scrutinee, cases) =>
168168
changePrec(GlobalPrec) {
169-
def caseText(tp: Type): Text = "case " ~ toText(tp)
169+
def caseText(tp: Type): Text = tp match {
170+
case defn.MatchCase(pat, body) => "case " ~ toText(pat) ~ " => " ~ toText(body)
171+
case _ => "case " ~ toText(tp)
172+
}
170173
def casesText = Text(cases.map(caseText), "\n")
171174
atPrec(InfixPrec) { toText(scrutinee) } ~
172175
keywordStr(" match ") ~ "{" ~ casesText ~ "}" ~

0 commit comments

Comments
 (0)