@@ -3926,13 +3926,9 @@ object Types {
3926
3926
| _ : BoundType
3927
3927
| NoPrefix => tp
3928
3928
3929
- case tp : AppliedType => // @!!! use atVariance
3930
- def mapArg (arg : Type , tparam : ParamInfo ): Type = {
3931
- val saved = variance
3932
- variance *= tparam.paramVariance
3933
- try this (arg)
3934
- finally variance = saved
3935
- }
3929
+ case tp : AppliedType =>
3930
+ def mapArg (arg : Type , tparam : ParamInfo ): Type =
3931
+ atVariance(variance * tparam.paramVariance)(this (arg))
3936
3932
derivedAppliedType(tp, this (tp.tycon),
3937
3933
tp.args.zipWithConserve(tp.typeParams)(mapArg))
3938
3934
@@ -3974,11 +3970,7 @@ object Types {
3974
3970
mapOverLambda
3975
3971
3976
3972
case tp @ TypeArgRef (prefix, _, _) =>
3977
- val saved = variance
3978
- variance = 0
3979
- val prefix1 = this (prefix)
3980
- variance = saved
3981
- derivedTypeArgRef(tp, prefix1)
3973
+ derivedTypeArgRef(tp, atVariance(0 )(this (prefix)))
3982
3974
3983
3975
case tp @ SuperType (thistp, supertp) =>
3984
3976
derivedSuperType(tp, this (thistp), this (supertp))
@@ -4359,13 +4351,9 @@ object Types {
4359
4351
assert(tparams.isEmpty)
4360
4352
x
4361
4353
}
4362
- else { // @@!!! use atVariance
4354
+ else {
4363
4355
val tparam = tparams.head
4364
- val saved = variance
4365
- variance *= tparam.paramVariance
4366
- val acc =
4367
- try this (x, args.head)
4368
- finally variance = saved
4356
+ val acc = atVariance(variance * tparam.paramVariance)(this (x, args.head))
4369
4357
foldArgs(acc, tparams.tail, args.tail)
4370
4358
}
4371
4359
foldArgs(this (x, tycon), tp.typeParams, args)
0 commit comments