Fix mapping of nullable generic underlying types of inline classes

#KT-32162 Fixed
This commit is contained in:
Ilmir Usmanov
2022-02-22 00:15:32 +01:00
committed by teamcity
parent 981f8b1871
commit 8811f62300
77 changed files with 3400 additions and 131 deletions
@@ -13,6 +13,7 @@ import org.jetbrains.kotlin.name.SpecialNames
import org.jetbrains.kotlin.resolve.isInlineClass
import org.jetbrains.kotlin.types.*
import org.jetbrains.kotlin.types.checker.SimpleClassicTypeSystemContext
import org.jetbrains.kotlin.types.typeUtil.makeNullable
import org.jetbrains.kotlin.types.typeUtil.replaceArgumentsWithStarProjections
import org.jetbrains.kotlin.types.typeUtil.representativeUpperBound
import org.jetbrains.kotlin.utils.DO_NOTHING_3
@@ -146,8 +147,10 @@ fun <T : Any> mapType(
}
descriptor is TypeParameterDescriptor -> {
val upperBound = descriptor.representativeUpperBound
val type = mapType(
descriptor.representativeUpperBound, factory, mode, typeMappingConfiguration,
if (kotlinType.isMarkedNullable) upperBound.makeNullable() else upperBound,
factory, mode, typeMappingConfiguration,
writeGenericType = DO_NOTHING_3, descriptorTypeWriter = null
)
descriptorTypeWriter?.writeTypeVariable(descriptor.getName(), type)