@@ -155,8 +155,15 @@ class PlainPrinter(_ctx: Context) extends Printer {
155155 else if ! cs.isConst && cs.elems.isEmpty then " ?"
156156 else " {" ~ Text (cs.elems.toList.map(toTextCaptureRef), " , " ) ~ " }"
157157
158+ /** Print capturing type, overridden in RefinedPrinter to account for
159+ * capturing function types.
160+ */
158161 protected def toTextCapturing (parent : Type , refsText : Text , boxText : Text ): Text =
159- changePrec(InfixPrec )(boxText ~ toTextLocal(parent) ~ " ^" ~ refsText)
162+ changePrec(InfixPrec ):
163+ boxText ~ toTextLocal(parent) ~ " ^"
164+ ~ (refsText provided refsText != rootSetText)
165+
166+ final protected def rootSetText = Str (" {*}" )
160167
161168 def toText (tp : Type ): Text = controlled {
162169 homogenize(tp) match {
@@ -214,7 +221,8 @@ class PlainPrinter(_ctx: Context) extends Printer {
214221 }.close
215222 case tp @ EventuallyCapturingType (parent, refs) =>
216223 val boxText : Text = Str (" box " ) provided tp.isBoxed // && ctx.settings.YccDebug.value
217- toTextCapturing(parent, toTextCaptureSet(refs), boxText)
224+ val refsText = if refs.isUniversal then rootSetText else toTextCaptureSet(refs)
225+ toTextCapturing(parent, refsText, boxText)
218226 case tp : PreviousErrorType if ctx.settings.XprintTypes .value =>
219227 " <error>" // do not print previously reported error message because they may try to print this error type again recuresevely
220228 case tp : ErrorType =>
0 commit comments