Correctly map nullable generic underlying value of inline class

if upper bound is primitive type.
 #KT-32162
This commit is contained in:
Ilmir Usmanov
2022-01-03 14:59:21 +01:00
parent 71729ec43c
commit 2fedb97d16
17 changed files with 478 additions and 4 deletions
@@ -83,7 +83,9 @@ object AbstractTypeMapper {
typeConstructor.isTypeParameter() -> {
val typeParameter = typeConstructor.asTypeParameter()
val upperBound = typeParameter.representativeUpperBound()
val newType = if (upperBound.typeConstructor().isInlineClass() && type.isNullableType())
val upperBoundIsPrimitiveOrInlineClass =
upperBound.typeConstructor().isInlineClass() || upperBound is SimpleTypeMarker && upperBound.isPrimitiveType()
val newType = if (upperBoundIsPrimitiveOrInlineClass && type.isNullableType())
upperBound.makeNullable()
else upperBound