diff options
author | Martin Odersky <odersky@gmail.com> | 2016-07-13 13:58:51 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-07-13 13:58:51 +0200 |
commit | 0ff5354e2a5e3f29234d6d761177f9228d8da522 (patch) | |
tree | 48b4065cf4b0201eb6a9b9f28e76d64302592e2c /src/dotty/tools | |
parent | f50cb2040494e622f17a1bcc323424a27129fc3a (diff) | |
download | dotty-0ff5354e2a5e3f29234d6d761177f9228d8da522.tar.gz dotty-0ff5354e2a5e3f29234d6d761177f9228d8da522.tar.bz2 dotty-0ff5354e2a5e3f29234d6d761177f9228d8da522.zip |
Simplify variance computations
Diffstat (limited to 'src/dotty/tools')
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index d1e5ba47d..284e9535e 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -3422,9 +3422,7 @@ object Types { case tp: HKApply => def mapArg(arg: Type, tparam: TypeParamInfo): Type = { val saved = variance - val pvariance = tparam.paramVariance - if (pvariance < 0) variance = -variance - else if (pvariance == 0) variance = 0 + variance *= tparam.paramVariance try this(arg) finally variance = saved } @@ -3638,9 +3636,7 @@ object Types { else { val tparam = tparams.head val saved = variance - val pvariance = tparam.paramVariance - if (pvariance < 0) variance = -variance - else if (pvariance == 0) variance = 0 + variance *= tparam.paramVariance val acc = try this(x, args.head) finally variance = saved |