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