File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed
compiler/src/dotty/tools/dotc/cc Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -489,7 +489,7 @@ object Capabilities:
489
489
case _ /* : GlobalCap | ResultCap | ParamRef */ => NoSymbol
490
490
491
491
final def visibility (using Context ): Symbol = this match
492
- case self : FreshCap => ccOwner.enclosingMethodOrClass
492
+ case self : FreshCap => adjustOwner( ccOwner)
493
493
case _ =>
494
494
val vis = ccOwner
495
495
if vis.is(Param ) then vis.owner else vis
@@ -500,13 +500,14 @@ object Capabilities:
500
500
* - method symbols, but not accessors or constructors
501
501
*/
502
502
final def levelOwner (using Context ): Symbol =
503
- def adjust (owner : Symbol ): Symbol =
504
- if ! owner.exists
505
- || owner.isClass && (! owner.is(Flags .Module ) || owner.isStatic)
506
- || owner.is(Flags .Method , butNot = Flags .Accessor ) && ! owner.isConstructor
507
- then owner
508
- else adjust(owner.owner)
509
- adjust(ccOwner)
503
+ adjustOwner(ccOwner)
504
+
505
+ private def adjustOwner (owner : Symbol )(using Context ): Symbol =
506
+ if ! owner.exists
507
+ || owner.isClass && (! owner.is(Flags .Module ) || owner.isStatic)
508
+ || owner.is(Flags .Method , butNot = Flags .Accessor )
509
+ then owner
510
+ else adjustOwner(owner.owner)
510
511
511
512
/** Tests whether the capability derives from capability class `cls`. */
512
513
def derivesFromCapTrait (cls : ClassSymbol )(using Context ): Boolean = this match
You can’t perform that action at this time.
0 commit comments