@@ -58,8 +58,7 @@ extension (tree: Tree)
5858 tree.putAttachment(Captures , refs)
5959 refs
6060
61- /** The type representing the capture set of retains annotation.
62- */
61+ /** The type representing the capture set of @retains, @retainsCap or @retainsByName annotation. */
6362 def retainedSet (using Context ): Type =
6463 tree match
6564 case Apply (TypeApply (_, refs :: Nil ), _) => refs.tpe
@@ -93,8 +92,7 @@ extension (tp: Type)
9392 if tp.isNothingType then Nil
9493 else tp :: Nil // should be checked by wellformedness
9594
96- /** A list of capabilities tof a retained set.
97- */
95+ /** A list of capabilities of a retained set. */
9896 def retainedElements (using Context ): List [Capability ] =
9997 retainedElementsRaw.map(_.toCapability)
10098
@@ -530,6 +528,9 @@ class CleanupRetains(using Context) extends TypeMap:
530528 RetainingType (tp, defn.NothingType , byName = annot.symbol == defn.RetainsByNameAnnot )
531529 case _ => mapOver(tp)
532530
531+ /** A base class for extractors that match annotated types with a specific
532+ * Capability annotation.
533+ */
533534abstract class AnnotatedCapability (annotCls : Context ?=> ClassSymbol ):
534535 def apply (tp : Type )(using Context ): AnnotatedType =
535536 AnnotatedType (tp, Annotation (annotCls, util.Spans .NoSpan ))
0 commit comments