@@ -16,6 +16,7 @@ import util.{SimpleIdentitySet, Property}
1616import util .common .alwaysTrue
1717import scala .collection .mutable
1818import config .Config .ccAllowUnsoundMaps
19+ import language .experimental .pureFunctions
1920
2021/** A class for capture sets. Capture sets can be constants or variables.
2122 * Capture sets support inclusion constraints <:< where <:< is subcapturing.
@@ -37,7 +38,7 @@ import config.Config.ccAllowUnsoundMaps
3738 * if the mapped function is either a bijection or if it is idempotent
3839 * on capture references (c.f. doc comment on `map` below).
3940 */
40- sealed abstract class CaptureSet extends Showable :
41+ sealed abstract class CaptureSet extends Showable , caps. Pure :
4142 import CaptureSet .*
4243
4344 /** The elements of this capture set. For capture variables,
@@ -222,7 +223,7 @@ sealed abstract class CaptureSet extends Showable:
222223 /** The largest subset (via <:<) of this capture set that only contains elements
223224 * for which `p` is true.
224225 */
225- def filter (p : CaptureRef = > Boolean )(using Context ): CaptureSet =
226+ def filter (p : CaptureRef - > Boolean )(using Context ): CaptureSet =
226227 if this .isConst then
227228 val elems1 = elems.filter(p)
228229 if elems1 == elems then this
@@ -372,8 +373,10 @@ object CaptureSet:
372373 def isConst = isSolved
373374 def isAlwaysEmpty = false
374375
375- /** A handler to be invoked if the root reference `*` is added to this set */
376- var rootAddedHandler : () => Context ?=> Unit = () => ()
376+ /** A handler to be invoked if the root reference `*` is added to this set
377+ * The handler is pure in the sense that it will only output diagnostics.
378+ */
379+ var rootAddedHandler : () -> Context ?-> Unit = () => ()
377380
378381 var description : String = " "
379382
@@ -421,7 +424,7 @@ object CaptureSet:
421424 else
422425 CompareResult .fail(this )
423426
424- override def disallowRootCapability (handler : () = > Context ?= > Unit )(using Context ): this .type =
427+ override def disallowRootCapability (handler : () - > Context ?- > Unit )(using Context ): this .type =
425428 rootAddedHandler = handler
426429 super .disallowRootCapability(handler)
427430
@@ -613,7 +616,7 @@ object CaptureSet:
613616
614617 /** A variable with elements given at any time as { x <- source.elems | p(x) } */
615618 class Filtered private [CaptureSet ]
616- (val source : Var , p : CaptureRef = > Boolean )(using @ constructorOnly ctx : Context )
619+ (val source : Var , p : CaptureRef - > Boolean )(using @ constructorOnly ctx : Context )
617620 extends DerivedVar (source.elems.filter(p)):
618621
619622 override def addNewElems (newElems : Refs , origin : CaptureSet )(using Context , VarState ): CompareResult =
0 commit comments