@@ -4198,14 +4198,6 @@ object Types {
4198
4198
val tp1 = tp.prefix.lookupRefined(tp.name)
4199
4199
if (tp1.exists) this (x, tp1) else applyToPrefix(x, tp)
4200
4200
}
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
4208
-
4209
4201
case tp @ AppliedType (tycon, args) =>
4210
4202
@ tailrec def foldArgs (x : T , tparams : List [ParamInfo ], args : List [Type ]): T =
4211
4203
if (args.isEmpty) {
@@ -4221,10 +4213,20 @@ object Types {
4221
4213
foldArgs(acc, tparams.tail, args.tail)
4222
4214
}
4223
4215
foldArgs(this (x, tycon), tp.typeParams, args)
4224
-
4225
- case tp : RefinedType =>
4226
- this (this (x, tp.parent), tp.refinedInfo)
4227
-
4216
+ case _ : BoundType | _ : ThisType => x
4217
+ case tp : LambdaType =>
4218
+ variance = - variance
4219
+ val y = foldOver(x, tp.paramInfos)
4220
+ variance = - variance
4221
+ this (y, tp.resultType)
4222
+ case NoPrefix => x
4223
+ case tp : TermRef =>
4224
+ if (stopAtStatic && tp.currentSymbol.isStatic) x
4225
+ else applyToPrefix(x, tp)
4226
+ case tp : TypeVar =>
4227
+ this (x, tp.underlying)
4228
+ case ExprType (restpe) =>
4229
+ this (x, restpe)
4228
4230
case bounds @ TypeBounds (lo, hi) =>
4229
4231
if (lo eq hi) atVariance(0 )(this (x, lo))
4230
4232
else {
@@ -4233,52 +4235,30 @@ object Types {
4233
4235
variance = - variance
4234
4236
this (y, hi)
4235
4237
}
4236
-
4237
- case tp : RecType =>
4238
- this (x, tp.parent)
4239
-
4240
- case ExprType (restpe) =>
4241
- this (x, restpe)
4242
-
4243
- case tp : TypeVar =>
4244
- this (x, tp.underlying)
4245
-
4246
- case SuperType (thistp, supertp) =>
4247
- this (this (x, thistp), supertp)
4248
-
4249
- case tp @ ClassInfo (prefix, _, _, _, _) =>
4250
- this (x, prefix)
4251
-
4252
- case tp : LambdaType =>
4253
- variance = - variance
4254
- val y = foldOver(x, tp.paramInfos)
4255
- variance = - variance
4256
- this (y, tp.resultType)
4257
-
4258
4238
case tp : AndOrType =>
4259
4239
this (this (x, tp.tp1), tp.tp2)
4260
-
4261
- case tp : SkolemType =>
4262
- this (x, tp.info)
4263
-
4264
- case tp @ TypeArgRef (prefix, _, _) =>
4265
- atVariance(0 )(this (x, prefix))
4266
-
4267
4240
case AnnotatedType (underlying, annot) =>
4268
4241
this (applyToAnnot(x, annot), underlying)
4269
-
4242
+ case tp : ProtoType =>
4243
+ tp.fold(x, this )
4244
+ case tp : RefinedType =>
4245
+ this (this (x, tp.parent), tp.refinedInfo)
4270
4246
case tp : WildcardType =>
4271
4247
this (x, tp.optBounds)
4272
-
4248
+ case tp @ ClassInfo (prefix, _, _, _, _) =>
4249
+ this (x, prefix)
4273
4250
case tp : JavaArrayType =>
4274
4251
this (x, tp.elemType)
4275
-
4252
+ case tp : SkolemType =>
4253
+ this (x, tp.info)
4254
+ case tp @ TypeArgRef (prefix, _, _) =>
4255
+ atVariance(0 )(this (x, prefix))
4256
+ case SuperType (thistp, supertp) =>
4257
+ this (this (x, thistp), supertp)
4276
4258
case tp : LazyRef =>
4277
4259
this (x, tp.ref)
4278
-
4279
- case tp : ProtoType =>
4280
- tp.fold(x, this )
4281
-
4260
+ case tp : RecType =>
4261
+ this (x, tp.parent)
4282
4262
case _ => x
4283
4263
}}
4284
4264
@@ -4446,3 +4426,15 @@ object Types {
4446
4426
4447
4427
implicit def decorateTypeApplications (tpe : Type ): TypeApplications = new TypeApplications (tpe)
4448
4428
}
4429
+
4430
+ object stats {
4431
+ val map = scala.collection.mutable.LinkedHashMap .empty[String , Int ]
4432
+
4433
+ def register (name : String ): Unit = map.update(name, map.getOrElse(name, 0 ) + 1 )
4434
+
4435
+ override def toString : String = {
4436
+ (" =" * 20 ) + " \n " +
4437
+ map.toArray.sortBy(_._2).reverse.mkString(" \n " ) +
4438
+ " \n " + (" -" * 20 )
4439
+ }
4440
+ }
0 commit comments