@@ -91,22 +91,13 @@ sealed abstract class CaptureSet extends Showable:
91
91
final def isUniversal (using Context ) =
92
92
elems.exists(_.isCap)
93
93
94
- /** Does this capture set contain the root reference `cap` as element? */
95
- final def isUniversalOrFresh (using Context ) =
96
- elems.exists(_.isCapOrFresh)
97
-
98
94
/** Does this capture set contain a root reference `cap` or `cap.rd` as element? */
99
95
final def containsRootCapability (using Context ) =
100
96
elems.exists(_.isRootCapability)
101
97
102
98
final def containsCap (using Context ) =
103
99
elems.exists(_.stripReadOnly.isCap)
104
100
105
- final def isUnboxable (using Context ) =
106
- elems.exists:
107
- case Existential .Vble (_) => true
108
- case elem => elem.isRootCapability
109
-
110
101
final def isReadOnly (using Context ): Boolean =
111
102
elems.forall(_.isReadOnly)
112
103
@@ -151,7 +142,7 @@ sealed abstract class CaptureSet extends Showable:
151
142
* capture set.
152
143
*/
153
144
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
155
146
addThisElem(elem)
156
147
else
157
148
addThisElem(elem).orElse:
@@ -195,7 +186,7 @@ sealed abstract class CaptureSet extends Showable:
195
186
elems.exists(_.subsumes(x))
196
187
|| // Even though subsumes already follows captureSetOfInfo, this is not enough.
197
188
// 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
199
190
&& ! x.derivesFrom(defn.Caps_CapSet )
200
191
&& ! (vs.isSeparating && x.captureSetOfInfo.containsRootCapability)
201
192
// 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:
216
207
def mightAccountFor (x : CaptureRef )(using Context ): Boolean =
217
208
reporting.trace(i " $this mightAccountFor $x, ${x.captureSetOfInfo}? " , show = true ):
218
209
elems.exists(_.subsumes(x)(using ctx, VarState .ClosedUnrecorded ))
219
- || ! x.isMaxCapability
210
+ || ! x.isRootCapability
220
211
&& {
221
212
val elems = x.captureSetOfInfo.elems
222
213
! elems.isEmpty && elems.forall(mightAccountFor)
@@ -352,7 +343,7 @@ sealed abstract class CaptureSet extends Showable:
352
343
353
344
/** Invoke handler if this set has (or later aquires) the root capability `cap` */
354
345
def disallowRootCapability (handler : () => Context ?=> Unit )(using Context ): this .type =
355
- if isUnboxable then handler()
346
+ if containsRootCapability then handler()
356
347
this
357
348
358
349
/** Invoke handler on the elements to ensure wellformedness of the capture set.
@@ -1302,7 +1293,7 @@ object CaptureSet:
1302
1293
case ReadOnlyCapability (ref1) =>
1303
1294
ref1.captureSetOfInfo.map(ReadOnlyMap ())
1304
1295
case _ =>
1305
- if ref.isMaxCapability then ref.singletonCaptureSet
1296
+ if ref.isRootCapability then ref.singletonCaptureSet
1306
1297
else ofType(ref.underlying, followResult = false )
1307
1298
1308
1299
/** Capture set of a type
@@ -1435,7 +1426,7 @@ object CaptureSet:
1435
1426
override def toAdd (using Context ) =
1436
1427
for CompareResult .LevelError (cs, ref) <- ccState.levelError.toList yield
1437
1428
ccState.levelError = None
1438
- if ref.isRootCapability then
1429
+ if ref.stripReadOnly.isCapOrFresh then
1439
1430
def capStr = if ref.isReadOnly then " cap.rd" else " cap"
1440
1431
i """
1441
1432
|
0 commit comments