@@ -376,9 +376,9 @@ object Capabilities:
376376 case tp : SetCapability => tp.captureSetOfInfo.isReadOnly
377377 case _ => this ne stripReadOnly
378378
379+ /** The restriction of this capability or NoSymbol if there is none */
379380 final def restriction (using Context ): Symbol = this match
380381 case Restricted (_, cls) => cls
381- case ReadOnly (ref1) => ref1.restriction
382382 case Maybe (ref1) => ref1.restriction
383383 case _ => NoSymbol
384384
@@ -396,10 +396,9 @@ object Capabilities:
396396 case Maybe (ref1) => ref1.stripReadOnly.maybe
397397 case _ => this
398398
399- /** Drop restrictions with clss `cls` or a superclass of `cls` */
399+ /** Drop restrictions with class `cls` or a superclass of `cls` */
400400 final def stripRestricted (cls : ClassSymbol )(using Context ): Capability = this match
401401 case Restricted (ref1, cls1) if cls.isSubClass(cls1) => ref1
402- case ReadOnly (ref1) => ref1.stripRestricted(cls).readOnly
403402 case Maybe (ref1) => ref1.stripRestricted(cls).maybe
404403 case _ => this
405404
@@ -408,7 +407,6 @@ object Capabilities:
408407
409408 final def stripReach (using Context ): Capability = this match
410409 case Reach (ref1) => ref1
411- case ReadOnly (ref1) => ref1.stripReach.readOnly
412410 case Restricted (ref1, cls) => ref1.stripReach.restrict(cls)
413411 case Maybe (ref1) => ref1.stripReach.maybe
414412 case _ => this
@@ -590,7 +588,6 @@ object Capabilities:
590588 def computeHiddenSet (f : Refs => Refs )(using Context ): Refs = this match
591589 case self : FreshCap => f(self.hiddenSet.elems)
592590 case Restricted (elem1, cls) => elem1.computeHiddenSet(f).map(_.restrict(cls))
593- case ReadOnly (elem1) => elem1.computeHiddenSet(f).map(_.readOnly)
594591 case _ => emptyRefs
595592
596593 /** The transitive classifiers of this capability. */
@@ -608,8 +605,6 @@ object Capabilities:
608605 assert(cls != defn.AnyClass )
609606 if cls == defn.NothingClass then ClassifiedAs (Nil )
610607 else ClassifiedAs (cls :: Nil )
611- case ReadOnly (ref1) =>
612- ref1.transClassifiers
613608 case Maybe (ref1) =>
614609 ref1.transClassifiers
615610 case Reach (_) =>
@@ -633,8 +628,6 @@ object Capabilities:
633628 case Restricted (_, cls1) =>
634629 assert(cls != defn.AnyClass )
635630 cls1.isSubClass(cls)
636- case ReadOnly (ref1) =>
637- ref1.tryClassifyAs(cls)
638631 case Maybe (ref1) =>
639632 ref1.tryClassifyAs(cls)
640633 case Reach (_) =>
@@ -655,7 +648,6 @@ object Capabilities:
655648 cs.forall(c => leastClassifier(c, cls) == defn.NothingClass )
656649 case _ => false
657650 isEmpty || ref1.isKnownEmpty
658- case ReadOnly (ref1) => ref1.isKnownEmpty
659651 case Maybe (ref1) => ref1.isKnownEmpty
660652 case _ => false
661653
@@ -716,7 +708,6 @@ object Capabilities:
716708 case _ => false
717709 || viaInfo(y.info)(subsumingRefs(this , _))
718710 case Maybe (y1) => this .stripMaybe.subsumes(y1)
719- case ReadOnly (y1) => this .stripReadOnly.subsumes(y1)
720711 case Restricted (y1, cls) => this .stripRestricted(cls).subsumes(y1)
721712 case y : TypeRef if y.derivesFrom(defn.Caps_CapSet ) =>
722713 // The upper and lower bounds don't have to be in the form of `CapSet^{...}`.
@@ -803,7 +794,6 @@ object Capabilities:
803794 y.isKnownClassifiedAs(cls) && x1.maxSubsumes(y, canAddHidden)
804795 case _ =>
805796 y match
806- case ReadOnly (y1) => this .stripReadOnly.maxSubsumes(y1, canAddHidden)
807797 case Restricted (y1, cls) => this .stripRestricted(cls).maxSubsumes(y1, canAddHidden)
808798 case _ => false
809799
@@ -891,7 +881,6 @@ object Capabilities:
891881 case c : DerivedCapability =>
892882 val c1 = c.underlying.toType
893883 c match
894- case ReadOnly (_) => ReadOnlyCapability (c1)
895884 case Restricted (_, cls) => OnlyCapability (c1, cls)
896885 case _ : Reach => ReachCapability (c1)
897886 case _ : Maybe => MaybeCapability (c1)
0 commit comments