From 06e370b0120348271a3c3e32d86335af5cce9272 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Thu, 27 Jul 2023 15:09:31 +0200 Subject: [PATCH] K2: use `Any?` as last argument when serializing suspend types K1 uses `Any?` in `transformSuspendFunctionToRuntimeFunctionType`, so use `Any?` in K2 too. This type is not used for anything, it's just an artifact of how suspend types are represented in metadata. It's removed during deserialization (see `TypeDeserializer.createSuspendFunctionType` or `FirTypeDeserializer.createSuspendFunctionType`). So it's not a user-visible change. The only effect is that it reduces differences in metadata between K1 and K2, namely in the test `libraries/tools/kotlinp/testData/ValueClass.kt`. --- .../jetbrains/kotlin/fir/serialization/serializationUtil.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/serializationUtil.kt b/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/serializationUtil.kt index 804f88dab51..f88099dd321 100644 --- a/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/serializationUtil.kt +++ b/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/serializationUtil.kt @@ -41,7 +41,7 @@ fun ConeKotlinType.suspendFunctionTypeToFunctionTypeWithContinuation(session: Fi typeArguments = (typeArguments.dropLast(1) + continuationClassId.toLookupTag().constructClassType( arrayOf(lastTypeArgument), isNullable = false - ) + lastTypeArgument).toTypedArray(), + ) + session.builtinTypes.nullableAnyType.type).toTypedArray(), isNullable = fullyExpandedType.isNullable, attributes = fullyExpandedType.attributes ) @@ -49,4 +49,4 @@ fun ConeKotlinType.suspendFunctionTypeToFunctionTypeWithContinuation(session: Fi fun FirMemberDeclaration.shouldBeSerialized(actualizedExpectDeclaration: Set?): Boolean { return !isExpect || actualizedExpectDeclaration == null || this !in actualizedExpectDeclaration -} \ No newline at end of file +}