@@ -232,9 +232,7 @@ extension (tp: Type)
232
232
case tp @ ReachCapability (_) =>
233
233
tp.singletonCaptureSet
234
234
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
238
236
case tp : SingletonCaptureRef if tp.isTrackableRef =>
239
237
tp.reach.singletonCaptureSet
240
238
case _ =>
@@ -285,20 +283,10 @@ extension (tp: Type)
285
283
* are of the form this.C but their pathroot is still this.C, not this.
286
284
*/
287
285
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
290
288
case tp1 => tp1
291
289
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
-
302
290
/** If this part starts with `C.this`, the class `C`.
303
291
* Otherwise, if it starts with a reference `r`, `r`'s owner.
304
292
* Otherwise NoSymbol.
0 commit comments