@@ -478,6 +478,11 @@ object Types {
478
478
*/
479
479
def isDeclaredVarianceLambda : Boolean = false
480
480
481
+ /** Is this type a CaptureRef that can be tracked?
482
+ * This is true for all ThisTypes or ParamRefs but only for some NamedTypes.
483
+ */
484
+ def isTrackableRef (using Context ): Boolean = false
485
+
481
486
/** Does this type contain wildcard types? */
482
487
final def containsWildcardTypes (using Context ) =
483
488
existsPart(_.isInstanceOf [WildcardType ], StopAt .Static , forceLazy = false )
@@ -2149,15 +2154,10 @@ object Types {
2149
2154
private var myCaptureSetRunId : Int = NoRunId
2150
2155
private var mySingletonCaptureSet : CaptureSet .Const | Null = null
2151
2156
2152
- /** Can the reference be tracked? This is true for all ThisTypes or ParamRefs
2153
- * but only for some NamedTypes.
2154
- */
2155
- def canBeTracked (using Context ): Boolean
2156
-
2157
2157
/** Is the reference tracked? This is true if it can be tracked and the capture
2158
2158
* set of the underlying type is not always empty.
2159
2159
*/
2160
- final def isTracked (using Context ): Boolean = canBeTracked && ! captureSetOfInfo.isAlwaysEmpty
2160
+ final def isTracked (using Context ): Boolean = isTrackableRef && ! captureSetOfInfo.isAlwaysEmpty
2161
2161
2162
2162
/** Is this reference the root capability `cap` ? */
2163
2163
def isRootCapability (using Context ): Boolean = false
@@ -2190,7 +2190,7 @@ object Types {
2190
2190
2191
2191
override def captureSet (using Context ): CaptureSet =
2192
2192
val cs = captureSetOfInfo
2193
- if canBeTracked && ! cs.isAlwaysEmpty then singletonCaptureSet else cs
2193
+ if isTrackableRef && ! cs.isAlwaysEmpty then singletonCaptureSet else cs
2194
2194
end CaptureRef
2195
2195
2196
2196
/** A trait for types that bind other types that refer to them.
@@ -2887,7 +2887,7 @@ object Types {
2887
2887
* They are subsumed in the capture sets of the enclosing class.
2888
2888
* TODO: ^^^ What about call-by-name?
2889
2889
*/
2890
- def canBeTracked (using Context ) =
2890
+ override def isTrackableRef (using Context ) =
2891
2891
((prefix eq NoPrefix )
2892
2892
|| symbol.is(ParamAccessor ) && (prefix eq symbol.owner.thisType)
2893
2893
|| isRootCapability
@@ -2897,7 +2897,7 @@ object Types {
2897
2897
name == nme.CAPTURE_ROOT && symbol == defn.captureRoot
2898
2898
2899
2899
override def normalizedRef (using Context ): CaptureRef =
2900
- if canBeTracked then symbol.termRef else this
2900
+ if isTrackableRef then symbol.termRef else this
2901
2901
}
2902
2902
2903
2903
abstract case class TypeRef (override val prefix : Type ,
@@ -3050,7 +3050,7 @@ object Types {
3050
3050
// can happen in IDE if `cls` is stale
3051
3051
}
3052
3052
3053
- def canBeTracked (using Context ) = true
3053
+ override def isTrackableRef (using Context ) = true
3054
3054
3055
3055
override def computeHash (bs : Binders ): Int = doHash(bs, tref)
3056
3056
@@ -4661,9 +4661,9 @@ object Types {
4661
4661
*/
4662
4662
abstract case class TermParamRef (binder : TermLambda , paramNum : Int ) extends ParamRef , CaptureRef {
4663
4663
type BT = TermLambda
4664
- def canBeTracked (using Context ) = true
4665
4664
def kindString : String = " Term"
4666
4665
def copyBoundType (bt : BT ): Type = bt.paramRefs(paramNum)
4666
+ override def isTrackableRef (using Context ) = true
4667
4667
}
4668
4668
4669
4669
private final class TermParamRefImpl (binder : TermLambda , paramNum : Int ) extends TermParamRef (binder, paramNum)
@@ -5728,11 +5728,11 @@ object Types {
5728
5728
5729
5729
/** A restriction of this map to a function on tracked CaptureRefs */
5730
5730
def forward (ref : CaptureRef ): CaptureRef = this (ref) match
5731
- case result : CaptureRef if result.canBeTracked => result
5731
+ case result : CaptureRef if result.isTrackableRef => result
5732
5732
5733
5733
/** A restriction of the inverse to a function on tracked CaptureRefs */
5734
5734
def backward (ref : CaptureRef ): CaptureRef = inverse(ref) match
5735
- case result : CaptureRef if result.canBeTracked => result
5735
+ case result : CaptureRef if result.isTrackableRef => result
5736
5736
end BiTypeMap
5737
5737
5738
5738
abstract class TypeMap (implicit protected var mapCtx : Context )
0 commit comments