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 @@ -537,9 +537,8 @@ class SepCheck(checker: CheckCaptures.CheckerAPI) extends tpd.TreeTraverser:
537
537
val badParams = mutable.ListBuffer [Symbol ]()
538
538
def currentOwner = role.dclSym.orElse(ctx.owner)
539
539
for hiddenRef <- prune(refsToCheck, tpe, role) do
540
- val proot = hiddenRef.pathRootOrShared
541
- if ! proot.widen.derivesFromSharedCapability then
542
- proot match
540
+ if ! hiddenRef.derivesFromSharedCapability then
541
+ hiddenRef.pathRoot match
543
542
case ref : TermRef =>
544
543
val refSym = ref.symbol
545
544
if currentOwner.enclosingMethodOrClass.isProperlyContainedIn(refSym.maybeOwner.enclosingMethodOrClass) then
@@ -575,7 +574,7 @@ class SepCheck(checker: CheckCaptures.CheckerAPI) extends tpd.TreeTraverser:
575
574
role match
576
575
case _ : TypeRole .Argument | _ : TypeRole .Qualifier =>
577
576
for ref <- refsToCheck do
578
- if ! ref.pathRootOrShared. derivesFromSharedCapability then
577
+ if ! ref.derivesFromSharedCapability then
579
578
consumed.put(ref, pos)
580
579
case _ =>
581
580
end checkConsumedRefs
You can’t perform that action at this time.
0 commit comments