Correctly support nullability in type arguments for serializer<T>() intrinsic.

Nullability info should be added to TYPE_OF operation marker.

Fixes https://github.com/Kotlin/kotlinx.serialization/issues/2265
This commit is contained in:
Leonid Startsev
2023-04-19 12:03:32 +02:00
committed by Space Team
parent 8cc9f911d5
commit ef9074e24d
5 changed files with 64 additions and 3 deletions
@@ -225,13 +225,13 @@ class SerializationJvmIrIntrinsicSupport(
*
* Operation detection in new compilers performed by voidMagicApiCall.
*/
private fun InstructionAdapter.putReifyMarkerIfNeeded(type: KotlinTypeMarker, intrinsicType: IntrinsicType): Boolean =
private fun InstructionAdapter.putReifyMarkerIfNeeded(type: IrType, intrinsicType: IntrinsicType): Boolean =
with(typeSystemContext) {
val typeDescriptor = type.typeConstructor().getTypeParameterClassifier()
if (typeDescriptor != null) { // need further reification
ReifiedTypeInliner.putReifiedOperationMarkerIfNeeded(
typeDescriptor,
false,
type.isMarkedNullable(),
ReifiedTypeInliner.OperationKind.TYPE_OF,
this@putReifyMarkerIfNeeded,
typeSystemContext