Map nullable type parameter with nullable inline class upper bound

which, in turn, has primitive or nullable underlying type to inline
class.
 #KT-32162
This commit is contained in:
Ilmir Usmanov
2021-12-30 16:52:38 +01:00
parent e8977d77e6
commit a7e2f7a6b6
4 changed files with 23 additions and 14 deletions
@@ -82,7 +82,12 @@ object AbstractTypeMapper {
return when {
typeConstructor.isTypeParameter() -> {
val typeParameter = typeConstructor.asTypeParameter()
val asmType = mapType(context, typeParameter.representativeUpperBound(), mode, null)
val upperBound = typeParameter.representativeUpperBound()
val newType = if (upperBound.typeConstructor().isInlineClass() && type.isNullableType())
upperBound.makeNullable()
else upperBound
val asmType = mapType(context, newType, mode, null)
sw?.writeTypeVariable(typeParameter.getName(), asmType)
asmType
}