@@ -43,7 +43,7 @@ trait TypeOps { this: Context => // TODO: Make standalone object.
43
43
* for more complicated types.
44
44
*/
45
45
final def asSeenFrom (tp : Type , pre : Type , cls : Symbol ): Type = {
46
- val m = if (pre.isStable || ! ctx.phase.isTyper ) null else new AsSeenFromMap (pre, cls)
46
+ val m = if (isLegalPrefix( pre) ) null else new AsSeenFromMap (pre, cls)
47
47
var res = asSeenFrom(tp, pre, cls, m)
48
48
if (m != null && m.unstable) asSeenFrom(tp, SkolemType (pre), cls) else res
49
49
}
@@ -61,7 +61,7 @@ trait TypeOps { this: Context => // TODO: Make standalone object.
61
61
if ((pre eq NoType ) || (pre eq NoPrefix ) || (cls is PackageClass ))
62
62
tp
63
63
else if (thiscls.derivesFrom(cls) && pre.baseTypeRef(thiscls).exists) {
64
- if (theMap != null && theMap.currentVariance <= 0 && ! pre.isStable )
64
+ if (theMap != null && theMap.currentVariance <= 0 && ! isLegalPrefix( pre) )
65
65
theMap.unstable = true
66
66
pre match {
67
67
case SuperType (thispre, _) => thispre
@@ -111,6 +111,9 @@ trait TypeOps { this: Context => // TODO: Make standalone object.
111
111
}
112
112
}
113
113
114
+ private def isLegalPrefix (pre : Type )(implicit ctx : Context ) =
115
+ pre.isStable || ! ctx.phase.isTyper
116
+
114
117
/** The TypeMap handling the asSeenFrom in more complicated cases */
115
118
class AsSeenFromMap (pre : Type , cls : Symbol ) extends TypeMap {
116
119
def apply (tp : Type ) = asSeenFrom(tp, pre, cls, this )
0 commit comments