@@ -128,6 +128,12 @@ trait CaptureRef extends TypeProxy, ValueType:
128
128
final def isExclusive (using Context ): Boolean =
129
129
! isReadOnly && (isRootCapability || captureSetOfInfo.isExclusive)
130
130
131
+ /** The owning symbol associated with a capability this is
132
+ * - for Fresh capabilities: the owner of the hidden set
133
+ * - for TermRefs and TypeRefs: the symbol it refers to
134
+ * - for derived and path capabilities: the owner of the underlying capability
135
+ * - otherwise NoSymbol
136
+ */
131
137
final def ccOwner (using Context ): Symbol = this match
132
138
case root.Fresh (hidden) =>
133
139
hidden.owner
@@ -143,7 +149,12 @@ trait CaptureRef extends TypeProxy, ValueType:
143
149
case _ =>
144
150
NoSymbol
145
151
146
- final def adjustedOwner (using Context ): Symbol =
152
+ /** The symbol that represents the level closest-enclosing ccOwner.
153
+ * Symbols representing levels are
154
+ * - class symbols, but not inner (non-static) module classes
155
+ * - method symbols, but not accessors or constructors
156
+ */
157
+ final def levelOwner (using Context ): Symbol =
147
158
def adjust (owner : Symbol ): Symbol =
148
159
if ! owner.exists
149
160
|| owner.isClass && (! owner.is(Flags .Module ) || owner.isStatic)
@@ -296,7 +307,7 @@ trait CaptureRef extends TypeProxy, ValueType:
296
307
case x @ root.Fresh (hidden) =>
297
308
def levelOK =
298
309
if ccConfig.useFreshLevels && ! CCState .ignoreFreshLevels then
299
- val yOwner = y.adjustedOwner
310
+ val yOwner = y.levelOwner
300
311
yOwner.isStaticOwner || x.ccOwner.isContainedIn(yOwner)
301
312
else
302
313
! y.stripReadOnly.isCap
0 commit comments