Skip to content

Commit 0ff5354

Browse files
committed
Simplify variance computations
1 parent f50cb20 commit 0ff5354

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/dotty/tools/dotc/core/Types.scala

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3422,9 +3422,7 @@ object Types {
34223422
case tp: HKApply =>
34233423
def mapArg(arg: Type, tparam: TypeParamInfo): Type = {
34243424
val saved = variance
3425-
val pvariance = tparam.paramVariance
3426-
if (pvariance < 0) variance = -variance
3427-
else if (pvariance == 0) variance = 0
3425+
variance *= tparam.paramVariance
34283426
try this(arg)
34293427
finally variance = saved
34303428
}
@@ -3638,9 +3636,7 @@ object Types {
36383636
else {
36393637
val tparam = tparams.head
36403638
val saved = variance
3641-
val pvariance = tparam.paramVariance
3642-
if (pvariance < 0) variance = -variance
3643-
else if (pvariance == 0) variance = 0
3639+
variance *= tparam.paramVariance
36443640
val acc =
36453641
try this(x, args.head)
36463642
finally variance = saved

0 commit comments

Comments
 (0)