@@ -57,10 +57,9 @@ object TypeOps:
57
57
58
58
/** The TypeMap handling the asSeenFrom */
59
59
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
62
60
63
61
/** The number of range approximations in invariant or contravariant positions
62
+ * performed by this TypeMap.
64
63
* - Incremented each time we produce a range.
65
64
* - Decremented each time we drop a prefix range by forwarding to a type alias
66
65
* or singleton type.
@@ -83,22 +82,8 @@ object TypeOps:
83
82
case _ =>
84
83
if (thiscls.derivesFrom(cls) && pre.baseType(thiscls).exists)
85
84
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)
102
87
else pre
103
88
else if (pre.termSymbol.is(Package ) && ! thiscls.is(Package ))
104
89
toPrefix(pre.select(nme.PACKAGE ), cls, thiscls)
@@ -131,11 +116,6 @@ object TypeOps:
131
116
// derived infos have already been subjected to asSeenFrom, hence to need to apply the map again.
132
117
tp
133
118
134
- // override protected def expandBounds(tp: TypeBounds): Type = {
135
- // approximated = true
136
- // super.expandBounds(tp)
137
- // }
138
-
139
119
override protected def useAlternate (tp : Type ): Type =
140
120
assert(approxCount > 0 )
141
121
approxCount -= 1
0 commit comments