@@ -420,46 +420,48 @@ object TypeOps:
420
420
sym.is(Package ) || sym.isStatic && isStaticPrefix(pre.prefix)
421
421
case _ => true
422
422
423
- def apply (tp : Type ): Type = tp match {
424
- case tp : TermRef
425
- if toAvoid(tp.symbol) || partsToAvoid(Nil , tp.info).nonEmpty =>
426
- tp.info.widenExpr.dealias match {
427
- case info : SingletonType => apply(info)
428
- case info => range(defn.NothingType , apply(info))
429
- }
430
- case tp : TypeRef if toAvoid(tp.symbol) =>
431
- tp.info match {
432
- case info : AliasingBounds =>
433
- apply(info.alias)
434
- case TypeBounds (lo, hi) =>
435
- range(atVariance(- variance)(apply(lo)), apply(hi))
436
- case info : ClassInfo =>
437
- range(defn.NothingType , apply(classBound(info)))
438
- case _ =>
439
- emptyRange // should happen only in error cases
440
- }
441
- case tp : ThisType =>
442
- // ThisType is only used inside a class.
443
- // Therefore, either they don't appear in the type to be avoided, or
444
- // it must be a class that encloses the block whose type is to be avoided.
445
- tp
446
- case tp : SkolemType if partsToAvoid(Nil , tp.info).nonEmpty =>
447
- range(defn.NothingType , apply(tp.info))
448
- case tp : TypeVar if mapCtx.typerState.constraint.contains(tp) =>
449
- val lo = TypeComparer .instanceType(
450
- tp.origin, fromBelow = variance > 0 || variance == 0 && tp.hasLowerBound)(using mapCtx)
451
- val lo1 = apply(lo)
452
- if (lo1 ne lo) lo1 else tp
453
- case tp : LazyRef =>
454
- if localParamRefs.contains(tp.ref) then tp
455
- else if isExpandingBounds then emptyRange
456
- else mapOver(tp)
457
- case tl : HKTypeLambda =>
458
- localParamRefs ++= tl.paramRefs
459
- mapOver(tl)
460
- case _ =>
461
- mapOver(tp)
462
- }
423
+ def apply (tp : Type ): Type =
424
+ val tp1 = tp match
425
+ case tp : TermRef
426
+ if toAvoid(tp.symbol) || partsToAvoid(Nil , tp.info).nonEmpty =>
427
+ tp.info.widenExpr.dealias match {
428
+ case info : SingletonType => apply(info)
429
+ case info => range(defn.NothingType , apply(info))
430
+ }
431
+ case tp : TypeRef if toAvoid(tp.symbol) =>
432
+ tp.info match {
433
+ case info : AliasingBounds =>
434
+ apply(info.alias)
435
+ case TypeBounds (lo, hi) =>
436
+ range(atVariance(- variance)(apply(lo)), apply(hi))
437
+ case info : ClassInfo =>
438
+ range(defn.NothingType , apply(classBound(info)))
439
+ case _ =>
440
+ emptyRange // should happen only in error cases
441
+ }
442
+ case tp : ThisType =>
443
+ // ThisType is only used inside a class.
444
+ // Therefore, either they don't appear in the type to be avoided, or
445
+ // it must be a class that encloses the block whose type is to be avoided.
446
+ tp
447
+ case tp : SkolemType if partsToAvoid(Nil , tp.info).nonEmpty =>
448
+ range(defn.NothingType , apply(tp.info))
449
+ case tp : TypeVar if mapCtx.typerState.constraint.contains(tp) =>
450
+ val lo = TypeComparer .instanceType(
451
+ tp.origin, fromBelow = variance > 0 || variance == 0 && tp.hasLowerBound)(using mapCtx)
452
+ val lo1 = apply(lo)
453
+ if (lo1 ne lo) lo1 else tp
454
+ case tp : LazyRef =>
455
+ if localParamRefs.contains(tp.ref) then tp
456
+ else if isExpandingBounds then emptyRange
457
+ else mapOver(tp)
458
+ case tl : HKTypeLambda =>
459
+ localParamRefs ++= tl.paramRefs
460
+ mapOver(tl)
461
+ case _ =>
462
+ mapOver(tp)
463
+ if tp1 ne tp then tp1.normalized else tp
464
+ end apply
463
465
464
466
/** Three deviations from standard derivedSelect:
465
467
* 1. We first try a widening conversion to the type's info with
0 commit comments