@@ -134,6 +134,8 @@ class PlainPrinter(_ctx: Context) extends Printer {
134134
135135 protected def argText (arg : Type , isErased : Boolean = false ): Text =
136136 keywordText(" erased " ).provided(isErased)
137+ ~ specialAnnotText(defn.UseAnnot , arg)
138+ ~ specialAnnotText(defn.ConsumeAnnot , arg)
137139 ~ homogenizeArg(arg).match
138140 case arg : TypeBounds => " ?" ~ toText(arg)
139141 case arg => toText(arg)
@@ -376,13 +378,17 @@ class PlainPrinter(_ctx: Context) extends Printer {
376378 try " (" ~ toTextRef(tp) ~ " : " ~ toTextGlobal(tp.underlying) ~ " )"
377379 finally elideCapabilityCaps = saved
378380
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+
379386 protected def paramsText (lam : LambdaType ): Text = {
380387 def paramText (ref : ParamRef ) =
381388 val erased = ref.underlying.hasAnnotation(defn.ErasedParamAnnot )
382- def maybeAnnotsText (sym : ClassSymbol ): Text =
383- Str (s " @ ${sym.name} " ).provided(ref.underlying.hasAnnotation(sym))
384389 keywordText(" erased " ).provided(erased)
385- ~ maybeAnnotsText(defn.UseAnnot ) ~ maybeAnnotsText(defn.ConsumeAnnot )
390+ ~ specialAnnotText(defn.UseAnnot , ref.underlying)
391+ ~ specialAnnotText(defn.ConsumeAnnot , ref.underlying)
386392 ~ ParamRefNameString (ref) ~ hashStr(lam) ~ toTextRHS(ref.underlying, isParameter = true )
387393 Text (lam.paramRefs.map(paramText), " , " )
388394 }
0 commit comments