@@ -227,7 +227,11 @@ sealed abstract class CaptureSet extends Showable:
227
227
elems.forall(that.mightAccountFor)
228
228
&& ! that.elems.forall(this .mightAccountFor)
229
229
230
- /** The subcapturing test, taking an explicit VarState. */
230
+ /** The subcapturing test.
231
+ * @param frozen if true, no new variables or dependent sets are allowed to
232
+ * be added when making this test. An attempt to add either
233
+ * will result in failure.
234
+ */
231
235
final def subCaptures (that : CaptureSet , vs : VarState )(using Context ): CompareResult =
232
236
subCaptures(that)(using ctx, vs)
233
237
@@ -388,7 +392,7 @@ sealed abstract class CaptureSet extends Showable:
388
392
override def toText (printer : Printer ): Text =
389
393
printer.toTextCaptureSet(this ) ~~ description
390
394
391
- /** Apply function `f` to the elements. Typically used for printing.
395
+ /** Apply function `f` to the elements. Typcially used for printing.
392
396
* Overridden in HiddenSet so that we don't run into infinite recursions
393
397
*/
394
398
def processElems [T ](f : Refs => T ): T = f(elems)
@@ -403,10 +407,10 @@ object CaptureSet:
403
407
/** If set to `true`, capture stack traces that tell us where sets are created */
404
408
private final val debugSets = false
405
409
406
- val emptyRefs : Refs = SimpleIdentitySet .empty
410
+ val emptySet = SimpleIdentitySet .empty
407
411
408
412
/** The empty capture set `{}` */
409
- val empty : CaptureSet .Const = Const (emptyRefs )
413
+ val empty : CaptureSet .Const = Const (emptySet )
410
414
411
415
/** The universal capture set `{cap}` */
412
416
def universal (using Context ): CaptureSet =
@@ -462,7 +466,7 @@ object CaptureSet:
462
466
* nulls, this provides more lenient checking against compilation units that
463
467
* were not yet compiled with capture checking on.
464
468
*/
465
- object Fluid extends Const (emptyRefs ):
469
+ object Fluid extends Const (emptySet ):
466
470
override def isAlwaysEmpty = false
467
471
override def addThisElem (elem : CaptureRef )(using Context , VarState ) = CompareResult .OK
468
472
override def accountsFor (x : CaptureRef )(using Context , VarState ): Boolean = true
@@ -471,7 +475,7 @@ object CaptureSet:
471
475
end Fluid
472
476
473
477
/** The subclass of captureset variables with given initial elements */
474
- class Var (override val owner : Symbol = NoSymbol , initialElems : Refs = emptyRefs , val level : Level = undefinedLevel, underBox : Boolean = false )(using @ constructorOnly ictx : Context ) extends CaptureSet :
478
+ class Var (override val owner : Symbol = NoSymbol , initialElems : Refs = emptySet , val level : Level = undefinedLevel, underBox : Boolean = false )(using @ constructorOnly ictx : Context ) extends CaptureSet :
475
479
476
480
/** A unique identification number for diagnostics */
477
481
val id =
@@ -489,7 +493,7 @@ object CaptureSet:
489
493
/** The sets currently known to be dependent sets (i.e. new additions to this set
490
494
* are propagated to these dependent sets.)
491
495
*/
492
- var deps : Deps = SimpleIdentitySet .empty
496
+ var deps : Deps = emptySet
493
497
494
498
def isConst = isSolved
495
499
def isAlwaysEmpty = isSolved && elems.isEmpty
@@ -923,16 +927,16 @@ object CaptureSet:
923
927
cs1.elems.filter(cs2.mightAccountFor) ++ cs2.elems.filter(cs1.mightAccountFor)
924
928
925
929
/** A capture set variable used to record the references hidden by a Fresh.Cap instance */
926
- class HiddenSet (initialHidden : Refs = emptyRefs )(using @ constructorOnly ictx : Context )
930
+ class HiddenSet (initialHidden : Refs = emptySet )(using @ constructorOnly ictx : Context )
927
931
extends Var (initialElems = initialHidden):
928
932
929
933
/** Apply function `f` to `elems` while setting `elems` to empty for the
930
- * duration. This is used to escape infinite recursions if two Fresh .Caps
934
+ * duration. This is used to escape infinite recursions if two Frash .Caps
931
935
* refer to each other in their hidden sets.
932
936
*/
933
937
override def processElems [T ](f : Refs => T ): T =
934
938
val savedElems = elems
935
- elems = emptyRefs
939
+ elems = emptySet
936
940
try f(savedElems)
937
941
finally elems = savedElems
938
942
end HiddenSet
0 commit comments