@@ -157,8 +157,8 @@ extension (tp: Type)
157157 * a singleton capability `x` or a reach capability `x*`, the deep capture
158158 * set can be narrowed to`{x*}`.
159159 */
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 )
162162 if dcs.isAlwaysEmpty then tp.captureSet
163163 else tp match
164164 case tp : ObjectCapability if tp.isTrackableRef => tp.reach.singletonCaptureSet
@@ -167,6 +167,9 @@ extension (tp: Type)
167167 def deepCaptureSet (using Context ): CaptureSet =
168168 deepCaptureSet(includeTypevars = false )
169169
170+ def spanCaptureSet (using Context ): CaptureSet =
171+ deepCaptureSet(includeTypevars = false , includeBoxed = false )
172+
170173 /** A type capturing `ref` */
171174 def capturing (ref : Capability )(using Context ): Type =
172175 if tp.captureSet.accountsFor(ref) then tp
@@ -362,7 +365,7 @@ extension (tp: Type)
362365 */
363366 def derivesFromCapTraitDeeply (cls : ClassSymbol )(using Context ): Boolean =
364367 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 ) =
366369 this (acc, parent)
367370 && (parent.derivesFromCapTrait(cls)
368371 || refs.isConst && refs.elems.forall(_.derivesFromCapTrait(cls)))
@@ -734,15 +737,15 @@ object ContainsParam:
734737abstract class DeepTypeAccumulator [T ](using Context ) extends TypeAccumulator [T ]:
735738 val seen = util.HashSet [Symbol ]()
736739
737- protected def capturingCase (acc : T , parent : Type , refs : CaptureSet ): T
740+ protected def capturingCase (acc : T , parent : Type , refs : CaptureSet , boxed : Boolean ): T
738741
739742 protected def abstractTypeCase (acc : T , t : TypeRef , upperBound : Type ): T
740743
741744 def apply (acc : T , t : Type ) =
742745 if variance < 0 then acc
743746 else t.dealias match
744747 case t @ CapturingType (parent, cs) =>
745- capturingCase(acc, parent, cs)
748+ capturingCase(acc, parent, cs, t.isBoxed )
746749 case t : TypeRef if t.symbol.isAbstractOrParamType && ! seen.contains(t.symbol) =>
747750 seen += t.symbol
748751 abstractTypeCase(acc, t, t.info.bounds.hi)
0 commit comments