From 1e7cc00dcbc14f7b753e7ada543e1b2d332c9ba3 Mon Sep 17 00:00:00 2001 From: "vladislav.grechko" Date: Sat, 27 Jan 2024 16:49:48 +0100 Subject: [PATCH] [FIR] Serialize type annotations of vararg parameters in metadata ^KT-63899: Fixed --- .../kotlin/fir/serialization/FirElementSerializer.kt | 3 ++- .../serialization/typeAnnotation.jvm_abi.txt | 9 --------- .../serialization/typeAnnotation.kt | 1 - 3 files changed, 2 insertions(+), 11 deletions(-) delete mode 100644 compiler/testData/codegen/box/involvesIrInterpreter/serialization/typeAnnotation.jvm_abi.txt diff --git a/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/FirElementSerializer.kt b/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/FirElementSerializer.kt index 3c522e64f0a..cd6dadc440b 100644 --- a/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/FirElementSerializer.kt +++ b/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/FirElementSerializer.kt @@ -784,7 +784,7 @@ class FirElementSerializer private constructor( parameter: FirValueParameter, index: Int, function: FirFunction, - additionalAnnotations: List = emptyList() + additionalAnnotations: List = emptyList(), ): ProtoBuf.ValueParameter.Builder = whileAnalysing(session, parameter) { val builder = ProtoBuf.ValueParameter.newBuilder() @@ -812,6 +812,7 @@ class FirElementSerializer private constructor( if (parameter.isVararg) { val varargElementType = parameter.returnTypeRef.coneType.varargElementType() + .withAttributes(parameter.returnTypeRef.annotations.computeTypeAttributes(session, shouldExpandTypeAliases = false)) if (useTypeTable()) { builder.varargElementTypeId = typeId(varargElementType) } else { diff --git a/compiler/testData/codegen/box/involvesIrInterpreter/serialization/typeAnnotation.jvm_abi.txt b/compiler/testData/codegen/box/involvesIrInterpreter/serialization/typeAnnotation.jvm_abi.txt deleted file mode 100644 index c8d4b02d109..00000000000 --- a/compiler/testData/codegen/box/involvesIrInterpreter/serialization/typeAnnotation.jvm_abi.txt +++ /dev/null @@ -1,9 +0,0 @@ -MODULE lib - CLASS LibKt.class - PACKAGE METADATA - FUNCTION withVararg([B)V - Property: class.metadata.function.valueParameters - K1 - (vararg args: @TypeAnnotation(str = "ByteAnno") kotlin/Byte /* kotlin/ByteArray */) - K2 - (vararg args: kotlin/Byte /* kotlin/ByteArray */) diff --git a/compiler/testData/codegen/box/involvesIrInterpreter/serialization/typeAnnotation.kt b/compiler/testData/codegen/box/involvesIrInterpreter/serialization/typeAnnotation.kt index efe58a21b4d..6520739bbea 100644 --- a/compiler/testData/codegen/box/involvesIrInterpreter/serialization/typeAnnotation.kt +++ b/compiler/testData/codegen/box/involvesIrInterpreter/serialization/typeAnnotation.kt @@ -1,7 +1,6 @@ // DONT_TARGET_EXACT_BACKEND: JVM // DONT_TARGET_EXACT_BACKEND: JS // WITH_STDLIB -// JVM_ABI_K1_K2_DIFF: KT-63899 // MODULE: lib // FILE: lib.kt