@@ -3286,32 +3286,37 @@ object Types {
3286
3286
private var myDependencyStatus : DependencyStatus = Unknown
3287
3287
private var myParamDependencyStatus : DependencyStatus = Unknown
3288
3288
3289
- private def depStatus (initial : DependencyStatus , tp : Type )(using Context ): DependencyStatus = {
3290
- def combine (x : DependencyStatus , y : DependencyStatus ) = {
3289
+ private def depStatus (initial : DependencyStatus , tp : Type )(using Context ): DependencyStatus =
3290
+ def combine (x : DependencyStatus , y : DependencyStatus ) =
3291
3291
val status = (x & StatusMask ) max (y & StatusMask )
3292
3292
val provisional = (x | y) & Provisional
3293
- (if (status == TrueDeps ) status else status | provisional).toByte
3294
- }
3295
- val depStatusAcc = new TypeAccumulator [DependencyStatus ] {
3296
- def apply (status : DependencyStatus , tp : Type ) =
3297
- if (status == TrueDeps ) status
3298
- else
3299
- tp match {
3300
- case TermParamRef (`thisLambdaType`, _) => TrueDeps
3301
- case tp : TypeRef =>
3302
- val status1 = foldOver(status, tp)
3303
- tp.info match { // follow type alias to avoid dependency
3304
- case TypeAlias (alias) if status1 == TrueDeps && status != TrueDeps =>
3305
- combine(apply(status, alias), FalseDeps )
3306
- case _ =>
3307
- status1
3308
- }
3309
- case tp : TypeVar if ! tp.isInstantiated => combine(status, Provisional )
3310
- case _ => foldOver(status, tp)
3293
+ (if status == TrueDeps then status else status | provisional).toByte
3294
+ def compute (status : DependencyStatus , tp : Type , theAcc : TypeAccumulator [DependencyStatus ]): DependencyStatus =
3295
+ def applyPrefix (tp : NamedType ) =
3296
+ if tp.currentSymbol.isStatic then status
3297
+ else compute(status, tp.prefix, theAcc)
3298
+ if status == TrueDeps then status
3299
+ else tp match
3300
+ case tp : TypeRef =>
3301
+ val status1 = applyPrefix(tp)
3302
+ tp.info match { // follow type alias to avoid dependency
3303
+ case TypeAlias (alias) if status1 == TrueDeps =>
3304
+ combine(compute(status, alias, theAcc), FalseDeps )
3305
+ case _ =>
3306
+ status1
3311
3307
}
3312
- }
3313
- depStatusAcc(initial, tp)
3314
- }
3308
+ case tp : TypeVar if ! tp.isInstantiated => combine(status, Provisional )
3309
+ case TermParamRef (`thisLambdaType`, _) => TrueDeps
3310
+ case tp : TermRef => applyPrefix(tp)
3311
+ case _ : ThisType | _ : BoundType | NoPrefix => status
3312
+ case _ =>
3313
+ val acc =
3314
+ if theAcc != null then theAcc
3315
+ else new TypeAccumulator [DependencyStatus ]:
3316
+ def apply (status : DependencyStatus , tp : Type ) = compute(status, tp, this )
3317
+ acc.foldOver(status, tp)
3318
+ compute(initial, tp, null )
3319
+ end depStatus
3315
3320
3316
3321
/** The dependency status of this method. Some examples:
3317
3322
*
0 commit comments