@@ -227,7 +227,11 @@ sealed abstract class CaptureSet extends Showable:
227227 elems.forall(that.mightAccountFor)
228228 && ! that.elems.forall(this .mightAccountFor)
229229
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+ */
231235 final def subCaptures (that : CaptureSet , vs : VarState )(using Context ): CompareResult =
232236 subCaptures(that)(using ctx, vs)
233237
@@ -388,7 +392,7 @@ sealed abstract class CaptureSet extends Showable:
388392 override def toText (printer : Printer ): Text =
389393 printer.toTextCaptureSet(this ) ~~ description
390394
391- /** Apply function `f` to the elements. Typically used for printing.
395+ /** Apply function `f` to the elements. Typcially used for printing.
392396 * Overridden in HiddenSet so that we don't run into infinite recursions
393397 */
394398 def processElems [T ](f : Refs => T ): T = f(elems)
@@ -403,10 +407,10 @@ object CaptureSet:
403407 /** If set to `true`, capture stack traces that tell us where sets are created */
404408 private final val debugSets = false
405409
406- val emptyRefs : Refs = SimpleIdentitySet .empty
410+ val emptySet = SimpleIdentitySet .empty
407411
408412 /** The empty capture set `{}` */
409- val empty : CaptureSet .Const = Const (emptyRefs )
413+ val empty : CaptureSet .Const = Const (emptySet )
410414
411415 /** The universal capture set `{cap}` */
412416 def universal (using Context ): CaptureSet =
@@ -462,7 +466,7 @@ object CaptureSet:
462466 * nulls, this provides more lenient checking against compilation units that
463467 * were not yet compiled with capture checking on.
464468 */
465- object Fluid extends Const (emptyRefs ):
469+ object Fluid extends Const (emptySet ):
466470 override def isAlwaysEmpty = false
467471 override def addThisElem (elem : CaptureRef )(using Context , VarState ) = CompareResult .OK
468472 override def accountsFor (x : CaptureRef )(using Context , VarState ): Boolean = true
@@ -471,7 +475,7 @@ object CaptureSet:
471475 end Fluid
472476
473477 /** 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 :
475479
476480 /** A unique identification number for diagnostics */
477481 val id =
@@ -489,7 +493,7 @@ object CaptureSet:
489493 /** The sets currently known to be dependent sets (i.e. new additions to this set
490494 * are propagated to these dependent sets.)
491495 */
492- var deps : Deps = SimpleIdentitySet .empty
496+ var deps : Deps = emptySet
493497
494498 def isConst = isSolved
495499 def isAlwaysEmpty = isSolved && elems.isEmpty
@@ -923,16 +927,16 @@ object CaptureSet:
923927 cs1.elems.filter(cs2.mightAccountFor) ++ cs2.elems.filter(cs1.mightAccountFor)
924928
925929 /** 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 )
927931 extends Var (initialElems = initialHidden):
928932
929933 /** 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
931935 * refer to each other in their hidden sets.
932936 */
933937 override def processElems [T ](f : Refs => T ): T =
934938 val savedElems = elems
935- elems = emptyRefs
939+ elems = emptySet
936940 try f(savedElems)
937941 finally elems = savedElems
938942 end HiddenSet
0 commit comments