From 8d79a6ae0396340dbefe5a9f5573b74a2a7cbddd Mon Sep 17 00:00:00 2001 From: Kristoffer Andersen Date: Fri, 10 Jul 2020 15:43:49 +0200 Subject: [PATCH] [JVM IR] Copy inline class constructor annotations --- .../jetbrains/kotlin/backend/jvm/lower/JvmInlineClassLowering.kt | 1 + .../publishedApiAnnotationOnInlineClassConstructor.kt | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmInlineClassLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmInlineClassLowering.kt index 115f5ebb65b..5b1c4b88c35 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmInlineClassLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmInlineClassLowering.kt @@ -474,6 +474,7 @@ private class JvmInlineClassLowering(private val context: JvmBackendContext) : F // Don't create a default argument stub for the primary constructor irConstructor.valueParameters.forEach { it.defaultValue = null } copyParameterDeclarationsFrom(irConstructor) + annotations += irConstructor.annotations body = context.createIrBuilder(this.symbol).irBlockBody(this) { +irDelegatingConstructorCall(context.irBuiltIns.anyClass.owner.constructors.single()) +irSetField( diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/publishedApiAnnotationOnInlineClassConstructor.kt b/compiler/testData/codegen/bytecodeListing/inlineClasses/publishedApiAnnotationOnInlineClassConstructor.kt index c4b954eb558..0f122f258d6 100644 --- a/compiler/testData/codegen/bytecodeListing/inlineClasses/publishedApiAnnotationOnInlineClassConstructor.kt +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/publishedApiAnnotationOnInlineClassConstructor.kt @@ -1,5 +1,4 @@ // !LANGUAGE: +InlineClasses -// IGNORE_BACKEND: JVM_IR @Suppress("NON_PUBLIC_PRIMARY_CONSTRUCTOR_OF_INLINE_CLASS") inline class Z @PublishedApi internal constructor(val value: Int) \ No newline at end of file