@@ -91,22 +91,13 @@ sealed abstract class CaptureSet extends Showable:
9191 final def isUniversal (using Context ) =
9292 elems.exists(_.isCap)
9393
94- /** Does this capture set contain the root reference `cap` as element? */
95- final def isUniversalOrFresh (using Context ) =
96- elems.exists(_.isCapOrFresh)
97-
9894 /** Does this capture set contain a root reference `cap` or `cap.rd` as element? */
9995 final def containsRootCapability (using Context ) =
10096 elems.exists(_.isRootCapability)
10197
10298 final def containsCap (using Context ) =
10399 elems.exists(_.stripReadOnly.isCap)
104100
105- final def isUnboxable (using Context ) =
106- elems.exists:
107- case Existential .Vble (_) => true
108- case elem => elem.isRootCapability
109-
110101 final def isReadOnly (using Context ): Boolean =
111102 elems.forall(_.isReadOnly)
112103
@@ -151,7 +142,7 @@ sealed abstract class CaptureSet extends Showable:
151142 * capture set.
152143 */
153144 protected final def addNewElem (elem : CaptureRef )(using ctx : Context , vs : VarState ): CompareResult =
154- if elem.isMaxCapability || ! vs.isOpen then
145+ if elem.isRootCapability || ! vs.isOpen then
155146 addThisElem(elem)
156147 else
157148 addThisElem(elem).orElse:
@@ -195,7 +186,7 @@ sealed abstract class CaptureSet extends Showable:
195186 elems.exists(_.subsumes(x))
196187 || // Even though subsumes already follows captureSetOfInfo, this is not enough.
197188 // For instance x: C^{y, z}. Then neither y nor z subsumes x but {y, z} accounts for x.
198- ! x.isMaxCapability
189+ ! x.isRootCapability
199190 && ! x.derivesFrom(defn.Caps_CapSet )
200191 && ! (vs.isSeparating && x.captureSetOfInfo.containsRootCapability)
201192 // in VarState.Separate, don't try to widen to cap since that might succeed with {cap} <: {cap}
@@ -216,7 +207,7 @@ sealed abstract class CaptureSet extends Showable:
216207 def mightAccountFor (x : CaptureRef )(using Context ): Boolean =
217208 reporting.trace(i " $this mightAccountFor $x, ${x.captureSetOfInfo}? " , show = true ):
218209 elems.exists(_.subsumes(x)(using ctx, VarState .ClosedUnrecorded ))
219- || ! x.isMaxCapability
210+ || ! x.isRootCapability
220211 && {
221212 val elems = x.captureSetOfInfo.elems
222213 ! elems.isEmpty && elems.forall(mightAccountFor)
@@ -352,7 +343,7 @@ sealed abstract class CaptureSet extends Showable:
352343
353344 /** Invoke handler if this set has (or later aquires) the root capability `cap` */
354345 def disallowRootCapability (handler : () => Context ?=> Unit )(using Context ): this .type =
355- if isUnboxable then handler()
346+ if containsRootCapability then handler()
356347 this
357348
358349 /** Invoke handler on the elements to ensure wellformedness of the capture set.
@@ -1302,7 +1293,7 @@ object CaptureSet:
13021293 case ReadOnlyCapability (ref1) =>
13031294 ref1.captureSetOfInfo.map(ReadOnlyMap ())
13041295 case _ =>
1305- if ref.isMaxCapability then ref.singletonCaptureSet
1296+ if ref.isRootCapability then ref.singletonCaptureSet
13061297 else ofType(ref.underlying, followResult = false )
13071298
13081299 /** Capture set of a type
@@ -1435,7 +1426,7 @@ object CaptureSet:
14351426 override def toAdd (using Context ) =
14361427 for CompareResult .LevelError (cs, ref) <- ccState.levelError.toList yield
14371428 ccState.levelError = None
1438- if ref.isRootCapability then
1429+ if ref.stripReadOnly.isCapOrFresh then
14391430 def capStr = if ref.isReadOnly then " cap.rd" else " cap"
14401431 i """
14411432 |
0 commit comments