File tree 2 files changed +5
-16
lines changed
compiler/src/dotty/tools/dotc/cc
2 files changed +5
-16
lines changed Original file line number Diff line number Diff line change @@ -285,20 +285,10 @@ extension (tp: Type)
285
285
* are of the form this.C but their pathroot is still this.C, not this.
286
286
*/
287
287
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
288
+ case tp1 : NamedType if tp1.symbol.maybeOwner.isClass && ! tp1.symbol.is( TypeParam ) =>
289
+ tp1.prefix.pathRoot
290
290
case tp1 => tp1
291
291
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
292
/** If this part starts with `C.this`, the class `C`.
303
293
* Otherwise, if it starts with a reference `r`, `r`'s owner.
304
294
* Otherwise NoSymbol.
Original file line number Diff line number Diff line change @@ -551,9 +551,8 @@ class SepCheck(checker: CheckCaptures.CheckerAPI) extends tpd.TreeTraverser:
551
551
val badParams = mutable.ListBuffer [Symbol ]()
552
552
def currentOwner = role.dclSym.orElse(ctx.owner)
553
553
for hiddenRef <- prune(refsToCheck, tpe, role) do
554
- val proot = hiddenRef.pathRootOrShared
555
- if ! proot.widen.derivesFromSharedCapability then
556
- proot match
554
+ if ! hiddenRef.derivesFromSharedCapability then
555
+ hiddenRef.pathRoot match
557
556
case ref : TermRef =>
558
557
val refSym = ref.symbol
559
558
if currentOwner.enclosingMethodOrClass.isProperlyContainedIn(refSym.maybeOwner.enclosingMethodOrClass) then
@@ -589,7 +588,7 @@ class SepCheck(checker: CheckCaptures.CheckerAPI) extends tpd.TreeTraverser:
589
588
role match
590
589
case _ : TypeRole .Argument | _ : TypeRole .Qualifier =>
591
590
for ref <- refsToCheck do
592
- if ! ref.pathRootOrShared. derivesFromSharedCapability then
591
+ if ! ref.derivesFromSharedCapability then
593
592
consumed.put(ref, pos)
594
593
case _ =>
595
594
end checkConsumedRefs
You can’t perform that action at this time.
0 commit comments