WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions compiler/src/dotty/tools/dotc/core/Types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6796,13 +6796,19 @@ object Types extends TypeUtils {
// non-range arguments L1, ..., Ln and H1, ..., Hn such that
// C[L1, ..., Ln] <: C[H1, ..., Hn] by taking the right limits of
// ranges that appear in as co- or contravariant arguments.
// Fail for non-variant argument ranges (see use-site else branch below).
// If successful, the L-arguments are in loBut, the H-arguments in hiBuf.
// Fail for non-trivial non-variant argument ranges (see use-site else branch below).
// If successful, the L-arguments are in loBuf, the H-arguments in hiBuf.
// @return operation succeeded for all arguments.
def distributeArgs(args: List[Type], tparams: List[ParamInfo]): Boolean = args match {
case Range(lo, hi) :: args1 =>
val v = tparams.head.paramVarianceSign
if (v == 0) false
if (v == 0) {
if (lo == hi) {
loBuf += lo; hiBuf += hi
distributeArgs(args1, tparams.tail)
}
else false
}
else {
if (v > 0) { loBuf += lo; hiBuf += hi }
else { loBuf += hi; hiBuf += lo }
Expand Down
Loading