@@ -232,9 +232,7 @@ extension (tp: Type)
232232 case tp @ ReachCapability (_) =>
233233 tp.singletonCaptureSet
234234 case ReadOnlyCapability (ref) =>
235- val refDcs = ref.deepCaptureSet(includeTypevars)
236- if refDcs.isConst then CaptureSet (refDcs.elems.map(_.readOnly))
237- else refDcs // this case should not happen for correct programs
235+ ref.deepCaptureSet(includeTypevars).readOnly
238236 case tp : SingletonCaptureRef if tp.isTrackableRef =>
239237 tp.reach.singletonCaptureSet
240238 case _ =>
@@ -285,20 +283,10 @@ extension (tp: Type)
285283 * are of the form this.C but their pathroot is still this.C, not this.
286284 */
287285 final def pathRoot (using Context ): Type = tp.dealias match
288- case tp1 : TermRef if tp1.symbol.maybeOwner.isClass => tp1.prefix.pathRoot
289- case tp1 : TypeRef if ! tp1.symbol.is( Param ) => tp1.prefix.pathRoot
286+ case tp1 : NamedType if tp1.symbol.maybeOwner.isClass && ! tp1.symbol.is( TypeParam ) =>
287+ tp1.prefix.pathRoot
290288 case tp1 => tp1
291289
292- /** The first element of a path type, but stop at references extending
293- * SharedCapability.
294- */
295- final def pathRootOrShared (using Context ): Type =
296- if tp.derivesFromSharedCapability then tp
297- else tp.dealias match
298- case tp1 : TermRef if tp1.symbol.maybeOwner.isClass => tp1.prefix.pathRoot
299- case tp1 : TypeRef if ! tp1.symbol.is(Param ) => tp1.prefix.pathRoot
300- case tp1 => tp1
301-
302290 /** If this part starts with `C.this`, the class `C`.
303291 * Otherwise, if it starts with a reference `r`, `r`'s owner.
304292 * Otherwise NoSymbol.
0 commit comments