@@ -152,12 +152,23 @@ object Capabilities:
152
152
val hiddenSet = CaptureSet .HiddenSet (owner, this : @ unchecked)
153
153
// fails initialization check without the @unchecked
154
154
155
+ /** Is this fresh cap (definitely) classified? If that's the case, the
156
+ * classifier cannot be changed anymore.
157
+ * We need to distinguish `FreshCap`s that can still be classified from
158
+ * ones that cannot. Once a `FreshCap` is part of a constant capture set,
159
+ * it gets classified by the type that prefixes the set and that classification
160
+ * cannot be changed anymore. But other `FreshCap`s are created as members of
161
+ * variable sets and then their classification status is open and can be
162
+ * constrained further.
163
+ */
155
164
private [Capabilities ] var isClassified = false
156
165
157
166
override def equals (that : Any ) = that match
158
167
case that : FreshCap => this eq that
159
168
case _ => false
160
169
170
+ /** Is this fresh cap at the right level to be able to subsume `ref`?
171
+ */
161
172
def acceptsLevelOf (ref : Capability )(using Context ): Boolean =
162
173
if ccConfig.useFreshLevels && ! CCState .collapseFresh then
163
174
val refOwner = ref.levelOwner
@@ -166,6 +177,9 @@ object Capabilities:
166
177
case ResultCap (_) | _ : ParamRef => false
167
178
case _ => true
168
179
180
+ /** Classify this FreshCap as `cls`, provided `isClassified` is still false.
181
+ * @param freeze Deterermines future `isClassified` state.
182
+ */
169
183
def adoptClassifier (cls : ClassSymbol , freeze : Boolean )(using Context ): Unit =
170
184
if ! isClassified then
171
185
hiddenSet.adoptClassifier(cls)
0 commit comments