@@ -151,24 +151,37 @@ extension (tp: Type)
151151 case tp : ObjectCapability => tp.captureSetOfInfo
152152 case _ => CaptureSet .ofType(tp, followResult = false )
153153
154- /** The deep capture set of a type. This is by default the union of all
154+ /** Compute a captureset by traversing parts of this type. This is by default the union of all
155155 * covariant capture sets embedded in the widened type, as computed by
156156 * `CaptureSet.ofTypeDeeply`. If that set is nonempty, and the type is
157157 * a singleton capability `x` or a reach capability `x*`, the deep capture
158158 * set can be narrowed to`{x*}`.
159+ * @param includeTypevars if true, return a new FreshCap for every type parameter
160+ * or abstract type with an Any upper bound. Types with
161+ * defined upper bound are always mapped to the dcs of their bound
162+ * @param includeBoxed if true, include capture sets found in boxed parts of this type
159163 */
160- def deepCaptureSet (includeTypevars : Boolean , includeBoxed : Boolean = true )(using Context ): CaptureSet =
164+ def computeDeepCaptureSet (includeTypevars : Boolean , includeBoxed : Boolean = true )(using Context ): CaptureSet =
161165 val dcs = CaptureSet .ofTypeDeeply(tp.widen.stripCapturing, includeTypevars, includeBoxed)
162166 if dcs.isAlwaysEmpty then tp.captureSet
163167 else tp match
164168 case tp : ObjectCapability if tp.isTrackableRef => tp.reach.singletonCaptureSet
165169 case _ => tp.captureSet ++ dcs
166170
171+ /** The deep capture set of a type. This is by default the union of all
172+ * covariant capture sets embedded in the widened type, as computed by
173+ * `CaptureSet.ofTypeDeeply`. If that set is nonempty, and the type is
174+ * a singleton capability `x` or a reach capability `x*`, the deep capture
175+ * set can be narrowed to`{x*}`.
176+ */
167177 def deepCaptureSet (using Context ): CaptureSet =
168- deepCaptureSet (includeTypevars = false )
178+ computeDeepCaptureSet (includeTypevars = false )
169179
180+ /** The span capture set of a type. This is analogous to deepCaptureSet but ignoring
181+ * capture sets in boxed parts.
182+ */
170183 def spanCaptureSet (using Context ): CaptureSet =
171- deepCaptureSet (includeTypevars = false , includeBoxed = false )
184+ computeDeepCaptureSet (includeTypevars = false , includeBoxed = false )
172185
173186 /** A type capturing `ref` */
174187 def capturing (ref : Capability )(using Context ): Type =
0 commit comments