@@ -134,6 +134,8 @@ class PlainPrinter(_ctx: Context) extends Printer {
134
134
135
135
protected def argText (arg : Type , isErased : Boolean = false ): Text =
136
136
keywordText(" erased " ).provided(isErased)
137
+ ~ specialAnnotText(defn.UseAnnot , arg)
138
+ ~ specialAnnotText(defn.ConsumeAnnot , arg)
137
139
~ homogenizeArg(arg).match
138
140
case arg : TypeBounds => " ?" ~ toText(arg)
139
141
case arg => toText(arg)
@@ -376,13 +378,17 @@ class PlainPrinter(_ctx: Context) extends Printer {
376
378
try " (" ~ toTextRef(tp) ~ " : " ~ toTextGlobal(tp.underlying) ~ " )"
377
379
finally elideCapabilityCaps = saved
378
380
381
+ /** Print the annotation that are meant to be on the parameter symbol but was moved
382
+ * to parameter types. Examples are `@use` and `@consume`. */
383
+ protected def specialAnnotText (sym : ClassSymbol , tp : Type ): Text =
384
+ Str (s " @ ${sym.name} " ).provided(tp.hasAnnotation(sym))
385
+
379
386
protected def paramsText (lam : LambdaType ): Text = {
380
387
def paramText (ref : ParamRef ) =
381
388
val erased = ref.underlying.hasAnnotation(defn.ErasedParamAnnot )
382
- def maybeAnnotsText (sym : ClassSymbol ): Text =
383
- Str (s " @ ${sym.name} " ).provided(ref.underlying.hasAnnotation(sym))
384
389
keywordText(" erased " ).provided(erased)
385
- ~ maybeAnnotsText(defn.UseAnnot ) ~ maybeAnnotsText(defn.ConsumeAnnot )
390
+ ~ specialAnnotText(defn.UseAnnot , ref.underlying)
391
+ ~ specialAnnotText(defn.ConsumeAnnot , ref.underlying)
386
392
~ ParamRefNameString (ref) ~ hashStr(lam) ~ toTextRHS(ref.underlying, isParameter = true )
387
393
Text (lam.paramRefs.map(paramText), " , " )
388
394
}
0 commit comments