Skip to content

Commit dff1924

Browse files
committed
Update PlainPrinter.scala to support new syntax
Implicitly assumed there is only one (leading) type parameter clause
1 parent 55a122d commit dff1924

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Diff for: compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala

+4-3
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,8 @@ class PlainPrinter(_ctx: Context) extends Printer {
211211
~ keywordText("erased ").provided(tp.isErasedMethod)
212212
~ keywordText("implicit ").provided(tp.isImplicitMethod && !tp.isContextualMethod)
213213
~ paramsText(tp)
214-
~ (if tp.resultType.isInstanceOf[MethodType] then ")" else "): ")
214+
~ ")"
215+
~ (Str(": ") provided !tp.resultType.isInstanceOf[MethodOrPoly])
215216
~ toText(tp.resultType)
216217
}
217218
case tp: ExprType =>
@@ -223,7 +224,7 @@ class PlainPrinter(_ctx: Context) extends Printer {
223224
case tp: PolyType =>
224225
changePrec(GlobalPrec) {
225226
"[" ~ paramsText(tp) ~ "]" ~ lambdaHash(tp) ~
226-
(Str(": ") provided !tp.resultType.isInstanceOf[MethodType]) ~
227+
(Str(": ") provided !tp.resultType.isInstanceOf[MethodOrPoly]) ~
227228
toTextGlobal(tp.resultType)
228229
}
229230
case AnnotatedType(tpe, annot) =>
@@ -418,7 +419,7 @@ class PlainPrinter(_ctx: Context) extends Printer {
418419
(if (isParameter) ": => " else ": ") ~ toTextGlobal(tp.widenExpr)
419420
case tp: PolyType =>
420421
"[" ~ paramsText(tp) ~ "]"
421-
~ (Str(": ") provided !tp.resultType.isInstanceOf[MethodType])
422+
~ (Str(": ") provided !tp.resultType.isInstanceOf[MethodOrPoly])
422423
~ toTextGlobal(tp.resultType)
423424
case tp =>
424425
": " ~ toTextGlobal(tp)

0 commit comments

Comments
 (0)