@@ -38,7 +38,7 @@ def depFun(args: List[Type], resultType: Type, isContextual: Boolean, paramNames
3838 else make(args, resultType)
3939 mt.toFunctionType(alwaysDependent = true )
4040
41- /** An exception thrown if a @retains argument is not syntactically a CaptureRef */
41+ /** An exception thrown if a @retains argument is not syntactically a Capability */
4242class IllegalCaptureRef (tpe : Type )(using Context ) extends Exception (tpe.show)
4343
4444/** A base trait for data producing addenda to error messages */
@@ -50,21 +50,21 @@ def ccState(using Context): CCState =
5050
5151extension (tree : Tree )
5252
53- /** Map tree with CaptureRef type to its type ,
53+ /** Map tree with a Capability type to the corresponding capability ,
5454 * map CapSet^{refs} to the `refs` references,
5555 * throw IllegalCaptureRef otherwise
5656 */
57- def toCaptureRefs (using Context ): List [CaptureRef ] = tree match
57+ def toCapabilities (using Context ): List [Capability ] = tree match
5858 case ReachCapabilityApply (arg) =>
59- arg.toCaptureRefs .map(_.reach)
59+ arg.toCapabilities .map(_.reach)
6060 case ReadOnlyCapabilityApply (arg) =>
61- arg.toCaptureRefs .map(_.readOnly)
61+ arg.toCapabilities .map(_.readOnly)
6262 case CapsOfApply (arg) =>
63- arg.toCaptureRefs
63+ arg.toCapabilities
6464 case _ => tree.tpe.dealiasKeepAnnots match
6565 case ref : TermRef if ref.isCapRef =>
6666 GlobalCap :: Nil
67- case ref : CaptureRef if ref.isTrackableRef =>
67+ case ref : Capability if ref.isTrackableRef =>
6868 ref :: Nil
6969 case AnnotatedType (parent, ann)
7070 if ann.symbol.isRetains && parent.derivesFrom(defn.Caps_CapSet ) =>
@@ -79,7 +79,7 @@ extension (tree: Tree)
7979 tree.getAttachment(Captures ) match
8080 case Some (refs) => refs
8181 case None =>
82- val refs = CaptureSet (tree.retainedElems.flatMap(_.toCaptureRefs )* )
82+ val refs = CaptureSet (tree.retainedElems.flatMap(_.toCapabilities )* )
8383 // .showing(i"toCaptureSet $tree --> $result", capt)
8484 tree.putAttachment(Captures , refs)
8585 refs
@@ -95,7 +95,7 @@ extension (tree: Tree)
9595
9696extension (tp : Type )
9797
98- /** Is this type a CaptureRef that can be tracked?
98+ /** Is this type a Capability that can be tracked?
9999 * This is true for
100100 * - all ThisTypes and all TermParamRef,
101101 * - stable TermRefs with NoPrefix or ThisTypes as prefixes,
@@ -120,9 +120,9 @@ extension (tp: Type)
120120 false
121121
122122 /** The capture set of a type. This is:
123- * - For trackable capture references : The singleton capture set consisting of
123+ * - For trackable capabilities : The singleton capture set consisting of
124124 * just the reference, provided the underlying capture set of their info is not empty.
125- * - For other capture references : The capture set of their info
125+ * - For other capabilities : The capture set of their info
126126 * - For all other types: The result of CaptureSet.ofType
127127 */
128128 final def captureSet (using Context ): CaptureSet = tp match
@@ -149,7 +149,7 @@ extension (tp: Type)
149149 deepCaptureSet(includeTypevars = false )
150150
151151 /** A type capturing `ref` */
152- def capturing (ref : CaptureRef )(using Context ): Type =
152+ def capturing (ref : Capability )(using Context ): Type =
153153 if tp.captureSet.accountsFor(ref) then tp
154154 else CapturingType (tp, ref.singletonCaptureSet)
155155
@@ -200,7 +200,7 @@ extension (tp: Type)
200200 /** The capture set consisting of all top-level captures of `tp` that appear under a box.
201201 * Unlike for `boxed` this also considers parents of capture types, unions and
202202 * intersections, and type proxies other than abstract types.
203- * Furthermore, if the original type is a capture ref `x`, it replaces boxed universal sets
203+ * Furthermore, if the original type is a capability `x`, it replaces boxed universal sets
204204 * on the fly with x*.
205205 */
206206 def boxedCaptureSet (using Context ): CaptureSet =
@@ -215,7 +215,7 @@ extension (tp: Type)
215215 pcs ++ reachRef.singletonCaptureSet
216216 case _ =>
217217 pcs ++ refs
218- case ref : CaptureRef if ref.isTracked && ! pre.exists => getBoxed(ref, ref)
218+ case ref : Capability if ref.isTracked && ! pre.exists => getBoxed(ref, ref)
219219 case tp : TypeRef if tp.symbol.isAbstractOrParamType => CaptureSet .empty
220220 case tp : TypeProxy => getBoxed(tp.superType, pre)
221221 case tp : AndType => getBoxed(tp.tp1, pre) ** getBoxed(tp.tp2, pre)
@@ -249,7 +249,7 @@ extension (tp: Type)
249249 def forceBoxStatus (boxed : Boolean )(using Context ): Type = tp.widenDealias match
250250 case tp @ CapturingType (parent, refs) if tp.isBoxed != boxed =>
251251 val refs1 = tp match
252- case ref : CaptureRef if ref.isTracked || ref.isReach || ref.isReadOnly =>
252+ case ref : Capability if ref.isTracked || ref.isReach || ref.isReadOnly =>
253253 ref.singletonCaptureSet
254254 case _ => refs
255255 CapturingType (parent, refs1, boxed)
@@ -347,7 +347,7 @@ extension (tp: Type)
347347 mapOver(t)
348348 tm(tp)
349349
350- /** If `x` is a capture ref , replace all no-flip covariant occurrences of `cap`
350+ /** If `x` is a capability , replace all no-flip covariant occurrences of `cap`
351351 * in type `tp` with `x*`.
352352 */
353353 def withReachCaptures (ref : Type )(using Context ): Type = ref match
@@ -620,9 +620,9 @@ object ContainsImpl:
620620
621621/** An extractor for a contains parameter */
622622object ContainsParam :
623- def unapply (sym : Symbol )(using Context ): Option [(TypeRef , CaptureRef )] =
623+ def unapply (sym : Symbol )(using Context ): Option [(TypeRef , Capability )] =
624624 sym.info.dealias match
625- case AppliedType (tycon, (cs : TypeRef ) :: (ref : CaptureRef ) :: Nil )
625+ case AppliedType (tycon, (cs : TypeRef ) :: (ref : Capability ) :: Nil )
626626 if tycon.typeSymbol == defn.Caps_ContainsTrait
627627 && cs.typeSymbol.isAbstractOrParamType => Some ((cs, ref))
628628 case _ => None
0 commit comments