@@ -152,12 +152,23 @@ object Capabilities:
152152 val hiddenSet = CaptureSet .HiddenSet (owner, this : @ unchecked)
153153 // fails initialization check without the @unchecked
154154
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+ */
155164 private [Capabilities ] var isClassified = false
156165
157166 override def equals (that : Any ) = that match
158167 case that : FreshCap => this eq that
159168 case _ => false
160169
170+ /** Is this fresh cap at the right level to be able to subsume `ref`?
171+ */
161172 def acceptsLevelOf (ref : Capability )(using Context ): Boolean =
162173 if ccConfig.useFreshLevels && ! CCState .collapseFresh then
163174 val refOwner = ref.levelOwner
@@ -166,6 +177,9 @@ object Capabilities:
166177 case ResultCap (_) | _ : ParamRef => false
167178 case _ => true
168179
180+ /** Classify this FreshCap as `cls`, provided `isClassified` is still false.
181+ * @param freeze Deterermines future `isClassified` state.
182+ */
169183 def adoptClassifier (cls : ClassSymbol , freeze : Boolean )(using Context ): Unit =
170184 if ! isClassified then
171185 hiddenSet.adoptClassifier(cls)
0 commit comments