Mark projection of a nullable captured type as not null during simplification constrains with it and a nullable type variable
^KT-41913 Fixed
This commit is contained in:
+3
-7
@@ -209,20 +209,16 @@ abstract class AbstractTypeCheckerContextForConstraintSystem : AbstractTypeCheck
|
||||
if (typeVariable.isMarkedNullable()) {
|
||||
val typeVariableTypeConstructor = typeVariable.typeConstructor()
|
||||
val subTypeConstructor = subType.typeConstructor()
|
||||
|
||||
if (
|
||||
val resultType = if (
|
||||
!subTypeConstructor.isTypeVariable() &&
|
||||
typeVariableTypeConstructor.isTypeVariable() &&
|
||||
(typeVariableTypeConstructor as TypeVariableTypeConstructorMarker).isContainedInInvariantOrContravariantPositions()
|
||||
) {
|
||||
if (subType.isCapturedType()) {
|
||||
(subType as CapturedTypeMarker).withNotNullProjection()
|
||||
} else {
|
||||
subType.withNullability(false)
|
||||
}
|
||||
subType.withNullability(false)
|
||||
} else {
|
||||
subType.makeDefinitelyNotNullOrNotNull()
|
||||
}
|
||||
if (resultType is CapturedTypeMarker) resultType.withNotNullProjection() else resultType
|
||||
} else subType
|
||||
|
||||
is FlexibleTypeMarker -> {
|
||||
|
||||
Reference in New Issue
Block a user