NI: Approximate captured-for-star-projections to *

^KT-35602 Fixed
This commit is contained in:
Denis Zharkov
2019-12-23 18:03:54 +03:00
parent 7728102a77
commit 0b385cc532
14 changed files with 434 additions and 228 deletions
@@ -485,6 +485,17 @@ abstract class AbstractTypeApproximator(val ctx: TypeSystemInferenceExtensionCon
val argumentType = newArguments[index]?.getType() ?: argument.getType()
val capturedStarProjectionOrNull =
argumentType.lowerBoundIfFlexible().asCapturedType()?.typeConstructorProjection()?.takeIf { it.isStarProjection() }
if (capturedStarProjectionOrNull != null &&
(effectiveVariance == TypeVariance.OUT || effectiveVariance == TypeVariance.INV) &&
toSuper
) {
newArguments[index] = capturedStarProjectionOrNull
continue@loop
}
when (effectiveVariance) {
null -> {
return if (conf.errorType) {