[NI] Use effective variance for equal approximated type

It's totally safe from the point of type system and reduces extra `out` projections that can add problems with subtyping
This commit is contained in:
Mikhail Zarechenskiy
2017-12-06 16:29:47 +03:00
parent 874267b79d
commit 6c27a49114
@@ -406,7 +406,12 @@ class TypeApproximator {
}
}
newArguments[index] = TypeProjectionImpl(Variance.OUT_VARIANCE, approximatedSuperType)
if (NewKotlinTypeChecker.equalTypes(argumentType, approximatedSuperType)) {
newArguments[index] = approximatedSuperType.asTypeProjection()
}
else {
newArguments[index] = TypeProjectionImpl(Variance.OUT_VARIANCE, approximatedSuperType)
}
}
}
}