@@ -149,15 +149,16 @@ class PlainPrinter(_ctx: Context) extends Printer {
149
149
+ defn.ObjectClass
150
150
+ defn.FromJavaObjectSymbol
151
151
152
- def toTextCaptureSet (cs : CaptureSet ): Text =
153
- def nestingLevelStr = cs match
154
- case cs : CaptureSet .Var if showNestingLevel => s " <in ${cs.owner.show}/ ${cs.owner.ccNestingLevel}> "
155
- case _ => " "
152
+ def toTextCaptureSet (cs : CaptureSet , describe : Boolean ): Text =
153
+ def descr = Str (cs.description).provided(describe)
154
+ ~ cs.match
155
+ case cs : CaptureSet .Var if showNestingLevel => s " <in ${cs.owner.show}/ ${cs.owner.ccNestingLevel}> "
156
+ case _ => " "
156
157
if printDebug && ! cs.isConst then cs.toString
157
158
else if ctx.settings.YccDebug .value then cs.show
158
159
else if cs == CaptureSet .Fluid then " <fluid>"
159
- else if ! cs.isConst && cs.elems.isEmpty then Str (" ?" ) ~ nestingLevelStr
160
- else " {" ~ Text (cs.elems.toList.map(toTextCaptureRef), " , " ) ~ " }" ~ nestingLevelStr
160
+ else if ! cs.isConst && cs.elems.isEmpty then Str (" ?" ) ~~ descr
161
+ else " {" ~ Text (cs.elems.toList.map(toTextCaptureRef), " , " ) ~ " }" ~~ descr
161
162
162
163
/** Print capturing type, overridden in RefinedPrinter to account for
163
164
* capturing function types.
@@ -225,7 +226,7 @@ class PlainPrinter(_ctx: Context) extends Printer {
225
226
}.close
226
227
case tp @ EventuallyCapturingType (parent, refs) =>
227
228
val boxText : Text = Str (" box " ) provided tp.isBoxed // && ctx.settings.YccDebug.value
228
- val refsText = if refs.isUniversal then rootSetText else toTextCaptureSet(refs)
229
+ val refsText = if refs.isUniversal then rootSetText else toTextCaptureSet(refs, describe = false )
229
230
toTextCapturing(parent, refsText, boxText)
230
231
case tp : PreviousErrorType if ctx.settings.XprintTypes .value =>
231
232
" <error>" // do not print previously reported error message because they may try to print this error type again recuresevely
@@ -250,7 +251,7 @@ class PlainPrinter(_ctx: Context) extends Printer {
250
251
case ExprType (restp) =>
251
252
def arrowText : Text = restp match
252
253
case ct @ EventuallyCapturingType (parent, refs) if ct.annot.symbol == defn.RetainsByNameAnnot =>
253
- if refs.isUniversal then Str (" =>" ) else Str (" ->" ) ~ toTextCaptureSet(refs)
254
+ if refs.isUniversal then Str (" =>" ) else Str (" ->" ) ~ toTextCaptureSet(refs, describe = false )
254
255
case _ =>
255
256
if Feature .pureFunsEnabled then " ->" else " =>"
256
257
changePrec(GlobalPrec )(arrowText ~ " " ~ toText(restp))
0 commit comments