NI: Fix regression for star-projections approximation
See the test added ^KT-35703 Fixed
This commit is contained in:
+4
-1
@@ -83,7 +83,10 @@ interface NewTypeSubstitutor: TypeSubstitutorMarker {
|
||||
if (innerType is StubType || substitutedInnerType is StubType) {
|
||||
return NewCapturedType(
|
||||
capturedType.captureStatus,
|
||||
NewCapturedTypeConstructor(TypeProjectionImpl(typeConstructor.projection.projectionKind, substitutedInnerType)),
|
||||
NewCapturedTypeConstructor(
|
||||
TypeProjectionImpl(typeConstructor.projection.projectionKind, substitutedInnerType),
|
||||
typeParameter = typeConstructor.typeParameter
|
||||
),
|
||||
lowerType = if (capturedType.lowerType != null) substitutedInnerType else null
|
||||
)
|
||||
} else {
|
||||
|
||||
@@ -485,12 +485,14 @@ abstract class AbstractTypeApproximator(val ctx: TypeSystemInferenceExtensionCon
|
||||
|
||||
val argumentType = newArguments[index]?.getType() ?: argument.getType()
|
||||
|
||||
val capturedType = argumentType.lowerBoundIfFlexible().asCapturedType()
|
||||
val capturedStarProjectionOrNull =
|
||||
argumentType.lowerBoundIfFlexible().asCapturedType()?.typeConstructorProjection()?.takeIf { it.isStarProjection() }
|
||||
capturedType?.typeConstructorProjection()?.takeIf { it.isStarProjection() }
|
||||
|
||||
if (capturedStarProjectionOrNull != null &&
|
||||
(effectiveVariance == TypeVariance.OUT || effectiveVariance == TypeVariance.INV) &&
|
||||
toSuper
|
||||
toSuper &&
|
||||
capturedType.typeParameter() == parameter
|
||||
) {
|
||||
newArguments[index] = capturedStarProjectionOrNull
|
||||
continue@loop
|
||||
|
||||
Reference in New Issue
Block a user