Capture notnullable type if type variable is nullable

This commit is contained in:
Svetlana Isakova
2014-12-09 18:46:50 +03:00
parent da8fdbd23e
commit 0149e8048c
6 changed files with 36 additions and 13 deletions
@@ -380,7 +380,13 @@ public class ConstraintSystemImpl : ConstraintSystem {
constraintPosition: ConstraintPosition
) {
val typeBounds = getTypeBounds(parameterType)
val capturedType = createCapturedType(constrainingTypeProjection)
val typeProjection = if (parameterType.isMarkedNullable()) {
TypeProjectionImpl(constrainingTypeProjection.getProjectionKind(), TypeUtils.makeNotNullable(constrainingTypeProjection.getType()))
}
else {
constrainingTypeProjection
}
val capturedType = createCapturedType(typeProjection)
typeBounds.addBound(EXACT_BOUND, capturedType, constraintPosition)
}