[NI] Fix CST calculation for covariant type projections

This commit is contained in:
Mikhail Zarechenskiy
2020-01-16 13:34:34 +03:00
parent 082cbae74a
commit 4f74515508
6 changed files with 48 additions and 2 deletions
@@ -388,7 +388,8 @@ object NewCommonSuperTypeCalculator {
return if (equalToEachOtherType == null) {
createTypeArgument(commonSuperType(argumentTypes, depth + 1), TypeVariance.OUT)
} else {
createTypeArgument(equalToEachOtherType.getType(), TypeVariance.INV)
val thereIsNotInv = arguments.any { it.getVariance() != TypeVariance.INV }
createTypeArgument(equalToEachOtherType.getType(), if (thereIsNotInv) TypeVariance.OUT else TypeVariance.INV)
}
} else {
val type = intersectTypes(arguments.map { it.getType() })