@@ -4198,13 +4198,6 @@ object Types {
41984198 val tp1 = tp.prefix.lookupRefined(tp.name)
41994199 if (tp1.exists) this (x, tp1) else applyToPrefix(x, tp)
42004200 }
4201- case tp : TermRef =>
4202- if (stopAtStatic && tp.currentSymbol.isStatic) x
4203- else applyToPrefix(x, tp)
4204-
4205- case _ : ThisType
4206- | _ : BoundType
4207- | NoPrefix => x
42084201
42094202 case tp @ AppliedType (tycon, args) =>
42104203 @ tailrec def foldArgs (x : T , tparams : List [ParamInfo ], args : List [Type ]): T =
@@ -4222,8 +4215,25 @@ object Types {
42224215 }
42234216 foldArgs(this (x, tycon), tp.typeParams, args)
42244217
4225- case tp : RefinedType =>
4226- this (this (x, tp.parent), tp.refinedInfo)
4218+ case _ : BoundType | _ : ThisType => x
4219+
4220+ case tp : LambdaType =>
4221+ variance = - variance
4222+ val y = foldOver(x, tp.paramInfos)
4223+ variance = - variance
4224+ this (y, tp.resultType)
4225+
4226+ case NoPrefix => x
4227+
4228+ case tp : TermRef =>
4229+ if (stopAtStatic && tp.currentSymbol.isStatic) x
4230+ else applyToPrefix(x, tp)
4231+
4232+ case tp : TypeVar =>
4233+ this (x, tp.underlying)
4234+
4235+ case ExprType (restpe) =>
4236+ this (x, restpe)
42274237
42284238 case bounds @ TypeBounds (lo, hi) =>
42294239 if (lo eq hi) atVariance(0 )(this (x, lo))
@@ -4234,50 +4244,41 @@ object Types {
42344244 this (y, hi)
42354245 }
42364246
4237- case tp : RecType =>
4238- this (x, tp.parent )
4247+ case tp : AndOrType =>
4248+ this (this ( x, tp.tp1), tp.tp2 )
42394249
4240- case ExprType (restpe ) =>
4241- this (x, restpe )
4250+ case AnnotatedType (underlying, annot ) =>
4251+ this (applyToAnnot( x, annot), underlying )
42424252
4243- case tp : TypeVar =>
4244- this (x, tp.underlying )
4253+ case tp : ProtoType =>
4254+ tp.fold (x, this )
42454255
4246- case SuperType (thistp, supertp) =>
4247- this (this (x, thistp), supertp)
4256+ case tp : RefinedType =>
4257+ this (this (x, tp.parent), tp.refinedInfo)
4258+
4259+ case tp : WildcardType =>
4260+ this (x, tp.optBounds)
42484261
42494262 case tp @ ClassInfo (prefix, _, _, _, _) =>
42504263 this (x, prefix)
42514264
4252- case tp : LambdaType =>
4253- variance = - variance
4254- val y = foldOver(x, tp.paramInfos)
4255- variance = - variance
4256- this (y, tp.resultType)
4257-
4258- case tp : AndOrType =>
4259- this (this (x, tp.tp1), tp.tp2)
4265+ case tp : JavaArrayType =>
4266+ this (x, tp.elemType)
42604267
42614268 case tp : SkolemType =>
42624269 this (x, tp.info)
42634270
42644271 case tp @ TypeArgRef (prefix, _, _) =>
42654272 atVariance(0 )(this (x, prefix))
42664273
4267- case AnnotatedType (underlying, annot) =>
4268- this (applyToAnnot(x, annot), underlying)
4269-
4270- case tp : WildcardType =>
4271- this (x, tp.optBounds)
4272-
4273- case tp : JavaArrayType =>
4274- this (x, tp.elemType)
4274+ case SuperType (thistp, supertp) =>
4275+ this (this (x, thistp), supertp)
42754276
42764277 case tp : LazyRef =>
42774278 this (x, tp.ref)
42784279
4279- case tp : ProtoType =>
4280- tp.fold (x, this )
4280+ case tp : RecType =>
4281+ this (x, tp.parent )
42814282
42824283 case _ => x
42834284 }}
@@ -4314,19 +4315,23 @@ object Types {
43144315 else {
43154316 seen += tp
43164317 tp match {
4317- case tp : TermRef =>
4318- apply(foldOver(maybeAdd(x, tp), tp), tp.underlying)
43194318 case tp : TypeRef =>
43204319 foldOver(maybeAdd(x, tp), tp)
4320+ case tp : ThisType =>
4321+ apply(x, tp.tref)
4322+ case NoPrefix =>
4323+ foldOver(x, tp)
4324+ case tp : TermRef =>
4325+ apply(foldOver(maybeAdd(x, tp), tp), tp.underlying)
4326+ case tp : AppliedType =>
4327+ foldOver(x, tp)
43214328 case TypeBounds (lo, hi) =>
43224329 if (! excludeLowerBounds) apply(x, lo)
43234330 apply(x, hi)
4324- case tp : ThisType =>
4325- apply(x, tp.tref)
4326- case tp : ConstantType =>
4327- apply(x, tp.underlying)
43284331 case tp : ParamRef =>
43294332 apply(x, tp.underlying)
4333+ case tp : ConstantType =>
4334+ apply(x, tp.underlying)
43304335 case _ =>
43314336 foldOver(x, tp)
43324337 }
0 commit comments