@@ -157,8 +157,8 @@ extension (tp: Type)
157
157
* a singleton capability `x` or a reach capability `x*`, the deep capture
158
158
* set can be narrowed to`{x*}`.
159
159
*/
160
- def deepCaptureSet (includeTypevars : Boolean )(using Context ): CaptureSet =
161
- val dcs = CaptureSet .ofTypeDeeply(tp.widen.stripCapturing, includeTypevars)
160
+ def deepCaptureSet (includeTypevars : Boolean , includeBoxed : Boolean = true )(using Context ): CaptureSet =
161
+ val dcs = CaptureSet .ofTypeDeeply(tp.widen.stripCapturing, includeTypevars, includeBoxed )
162
162
if dcs.isAlwaysEmpty then tp.captureSet
163
163
else tp match
164
164
case tp : ObjectCapability if tp.isTrackableRef => tp.reach.singletonCaptureSet
@@ -167,6 +167,9 @@ extension (tp: Type)
167
167
def deepCaptureSet (using Context ): CaptureSet =
168
168
deepCaptureSet(includeTypevars = false )
169
169
170
+ def spanCaptureSet (using Context ): CaptureSet =
171
+ deepCaptureSet(includeTypevars = false , includeBoxed = false )
172
+
170
173
/** A type capturing `ref` */
171
174
def capturing (ref : Capability )(using Context ): Type =
172
175
if tp.captureSet.accountsFor(ref) then tp
@@ -362,7 +365,7 @@ extension (tp: Type)
362
365
*/
363
366
def derivesFromCapTraitDeeply (cls : ClassSymbol )(using Context ): Boolean =
364
367
val accumulate = new DeepTypeAccumulator [Boolean ]:
365
- def capturingCase (acc : Boolean , parent : Type , refs : CaptureSet ) =
368
+ def capturingCase (acc : Boolean , parent : Type , refs : CaptureSet , boxed : Boolean ) =
366
369
this (acc, parent)
367
370
&& (parent.derivesFromCapTrait(cls)
368
371
|| refs.isConst && refs.elems.forall(_.derivesFromCapTrait(cls)))
@@ -734,15 +737,15 @@ object ContainsParam:
734
737
abstract class DeepTypeAccumulator [T ](using Context ) extends TypeAccumulator [T ]:
735
738
val seen = util.HashSet [Symbol ]()
736
739
737
- protected def capturingCase (acc : T , parent : Type , refs : CaptureSet ): T
740
+ protected def capturingCase (acc : T , parent : Type , refs : CaptureSet , boxed : Boolean ): T
738
741
739
742
protected def abstractTypeCase (acc : T , t : TypeRef , upperBound : Type ): T
740
743
741
744
def apply (acc : T , t : Type ) =
742
745
if variance < 0 then acc
743
746
else t.dealias match
744
747
case t @ CapturingType (parent, cs) =>
745
- capturingCase(acc, parent, cs)
748
+ capturingCase(acc, parent, cs, t.isBoxed )
746
749
case t : TypeRef if t.symbol.isAbstractOrParamType && ! seen.contains(t.symbol) =>
747
750
seen += t.symbol
748
751
abstractTypeCase(acc, t, t.info.bounds.hi)
0 commit comments