@@ -131,6 +131,9 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
131
131
else simpleNameString(tsym)
132
132
}
133
133
134
+ private def arrow (isGiven : Boolean ): String =
135
+ if isGiven then " ?=>" else " =>"
136
+
134
137
override def toText (tp : Type ): Text = controlled {
135
138
def toTextTuple (args : List [Type ]): Text =
136
139
" (" ~ argsText(args) ~ " )"
@@ -145,19 +148,19 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
145
148
atPrec(InfixPrec ) { argText(args.head) }
146
149
else
147
150
" ("
148
- ~ keywordText(" given " ).provided(isGiven)
149
151
~ keywordText(" erased " ).provided(isErased)
150
152
~ argsText(args.init)
151
153
~ " )"
152
- argStr ~ " => " ~ argText(args.last)
154
+ argStr ~ " " ~ arrow(isGiven) ~ " " ~ argText(args.last)
153
155
}
154
156
155
157
def toTextDependentFunction (appType : MethodType ): Text =
156
158
" ("
157
- ~ keywordText(" given " ).provided(appType.isImplicitMethod)
158
159
~ keywordText(" erased " ).provided(appType.isErasedMethod)
159
160
~ paramsText(appType)
160
- ~ " ) => "
161
+ ~ " ) "
162
+ ~ arrow(appType.isImplicitMethod)
163
+ ~ " "
161
164
~ toText(appType.resultType)
162
165
163
166
def isInfixType (tp : Type ): Boolean = tp match {
@@ -577,12 +580,11 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
577
580
case (arg @ ValDef (_, tpt, _)) :: Nil if tpt.isEmpty => argToText(arg)
578
581
case _ =>
579
582
" ("
580
- ~ keywordText(" given " ).provided(isGiven)
581
583
~ keywordText(" erased " ).provided(isErased)
582
584
~ Text (args.map(argToText), " , " )
583
585
~ " )"
584
586
}
585
- argsText ~ " => " ~ toText(body)
587
+ argsText ~ " " ~ arrow(isGiven) ~ " " ~ toText(body)
586
588
case PolyFunction (targs, body) =>
587
589
val targsText = " [" ~ Text (targs.map((arg : Tree ) => toText(arg)), " , " ) ~ " ]"
588
590
changePrec(GlobalPrec ) {
0 commit comments