@@ -57,10 +57,9 @@ object TypeOps:
5757
5858 /** The TypeMap handling the asSeenFrom */
5959 class AsSeenFromMap (pre : Type , cls : Symbol )(using Context ) extends ApproximatingTypeMap , IdempotentCaptRefMap {
60- /** Set to true when the result of `apply` was approximated to avoid an unstable prefix. */
61- private var approximated : Boolean = false
6260
6361 /** The number of range approximations in invariant or contravariant positions
62+ * performed by this TypeMap.
6463 * - Incremented each time we produce a range.
6564 * - Decremented each time we drop a prefix range by forwarding to a type alias
6665 * or singleton type.
@@ -83,22 +82,8 @@ object TypeOps:
8382 case _ =>
8483 if (thiscls.derivesFrom(cls) && pre.baseType(thiscls).exists)
8584 if (variance <= 0 && ! isLegalPrefix(pre))
86- if true then
87- approxCount += 1
88- range(defn.NothingType , pre)
89- else
90- if (variance < 0 ) {
91- approximated = true
92- defn.NothingType
93- }
94- else
95- // Don't set the `approximated` flag yet: if this is a prefix
96- // of a path, we might be able to dealias the path instead
97- // (this is handled in `ApproximatingTypeMap`). If dealiasing
98- // is not possible, then `expandBounds` will end up being
99- // called which we override to set the `approximated` flag.
100- range(defn.NothingType , pre)
101-
85+ approxCount += 1
86+ range(defn.NothingType , pre)
10287 else pre
10388 else if (pre.termSymbol.is(Package ) && ! thiscls.is(Package ))
10489 toPrefix(pre.select(nme.PACKAGE ), cls, thiscls)
@@ -131,11 +116,6 @@ object TypeOps:
131116 // derived infos have already been subjected to asSeenFrom, hence to need to apply the map again.
132117 tp
133118
134- // override protected def expandBounds(tp: TypeBounds): Type = {
135- // approximated = true
136- // super.expandBounds(tp)
137- // }
138-
139119 override protected def useAlternate (tp : Type ): Type =
140120 assert(approxCount > 0 )
141121 approxCount -= 1
0 commit comments