@@ -50,28 +50,6 @@ def ccState(using Context): CCState =
5050
5151extension (tree : Tree )
5252
53- /** Map tree with a Capability type to the corresponding capability,
54- * map CapSet^{refs} to the `refs` references,
55- * throw IllegalCaptureRef otherwise
56- */
57- // def toCapabilities(using Context): List[Capability] = tree match
58- // case ReachCapabilityApply(arg) =>
59- // arg.toCapabilities.map(_.reach)
60- // case ReadOnlyCapabilityApply(arg) =>
61- // arg.toCapabilities.map(_.readOnly)
62- // case CapsOfApply(arg) =>
63- // arg.toCapabilities
64- // case _ => tree.tpe.dealiasKeepAnnots match
65- // case ref: TermRef if ref.isCapRef =>
66- // GlobalCap :: Nil
67- // case ref: Capability if ref.isTrackableRef =>
68- // ref :: Nil
69- // case AnnotatedType(parent, ann)
70- // if ann.symbol.isRetains && parent.derivesFrom(defn.Caps_CapSet) =>
71- // ann.tree.toCaptureSet.elems.toList
72- // case tpe =>
73- // throw IllegalCaptureRef(tpe) // if this was compiled from cc syntax, problem should have been reported at Typer
74-
7553 /** Convert a @retains or @retainsByName annotation tree to the capture set it represents.
7654 * For efficience, the result is cached as an Attachment on the tree.
7755 */
@@ -82,6 +60,7 @@ extension (tree: Tree)
8260 val refs = CaptureSet (tree.retainedSet.retainedElements* )
8361 tree.putAttachment(Captures , refs)
8462 refs
63+
8564 /** The type representing the capture set of retains annotation.
8665 */
8766 def retainedSet (using Context ): Type =
@@ -584,11 +563,16 @@ end AnnotatedCapability
584563 */
585564object ReadOnlyCapability extends AnnotatedCapability (defn.ReadOnlyCapabilityAnnot )
586565
587- /** An extractor for `ref @annotation.internal. reachCapability`, which is used to express
566+ /** An extractor for `ref @reachCapability`, which is used to express
588567 * the reach capability `ref*` as a type.
589568 */
590569object ReachCapability extends AnnotatedCapability (defn.ReachCapabilityAnnot )
591570
571+ /** An extractor for `ref @amaybeCapability`, which is used to express
572+ * the maybe capability `ref?` as a type.
573+ */
574+ object MaybeCapability extends AnnotatedCapability (defn.MaybeCapabilityAnnot )
575+
592576/** An extractor for all kinds of function types as well as method and poly types.
593577 * It includes aliases of function types such as `=>`. TODO: Can we do without?
594578 * @return 1st half: The argument types or empty if this is a type function
0 commit comments