From 607d38f96f7b93f4469388094e55b771d74c745a Mon Sep 17 00:00:00 2001 From: Mads Ager Date: Thu, 29 Jun 2023 16:01:40 +0200 Subject: [PATCH] [K2 plugin] Support simple arguments in annotation metadata extension. ^KT-58968 ^KT-60051 Fixed --- .../Fir2IrAnnotationsFromPluginRegistrar.kt | 37 ++++++++++++++-- .../kotlin/fir/plugin/annotations.kt | 12 +++++- .../plugin/TransformerForAddingAnnotations.kt | 43 ++++++++++++++++++- ...notationsGeneratedInBackend.fir.k2.jvm.txt | 14 +++--- ...otationsGeneratedInBackend.fir.k2.klib.txt | 14 +++--- .../annotationsGeneratedInBackend.fir.kt.txt | 16 +++---- 6 files changed, 109 insertions(+), 27 deletions(-) diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrAnnotationsFromPluginRegistrar.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrAnnotationsFromPluginRegistrar.kt index 892fe49a00f..50a4be765f1 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrAnnotationsFromPluginRegistrar.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrAnnotationsFromPluginRegistrar.kt @@ -10,6 +10,8 @@ import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.declarations.utils.classId import org.jetbrains.kotlin.fir.expressions.FirAnnotation import org.jetbrains.kotlin.fir.expressions.builder.buildAnnotation +import org.jetbrains.kotlin.fir.expressions.builder.buildAnnotationArgumentMapping +import org.jetbrains.kotlin.fir.expressions.builder.buildConstExpression import org.jetbrains.kotlin.fir.expressions.impl.FirEmptyAnnotationArgumentMapping import org.jetbrains.kotlin.fir.packageFqName import org.jetbrains.kotlin.fir.resolve.providers.firProvider @@ -21,18 +23,30 @@ import org.jetbrains.kotlin.fir.types.toFirResolvedTypeRef import org.jetbrains.kotlin.fir.types.toLookupTag import org.jetbrains.kotlin.ir.declarations.IrDeclaration import org.jetbrains.kotlin.ir.declarations.nameWithPackage +import org.jetbrains.kotlin.ir.expressions.IrConst +import org.jetbrains.kotlin.ir.expressions.IrConstKind import org.jetbrains.kotlin.ir.expressions.IrConstructorCall import org.jetbrains.kotlin.ir.util.* import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.types.ConstantValueKind import org.jetbrains.kotlin.utils.addToStdlib.runIf class Fir2IrAnnotationsFromPluginRegistrar(private val components: Fir2IrComponents) : IrAnnotationsFromPluginRegistrar() { private val generatedIrDeclarationsByFileByOffset = mutableMapOf, MutableList>>() + private fun IrConstructorCall.hasOnlySupportedAnnotationArgumentTypes(): Boolean { + for (i in 0 until valueArgumentsCount) { + if (getValueArgument(i) !is IrConst<*>) { + return false + } + } + return true + } + override fun addMetadataVisibleAnnotationsToElement(declaration: IrDeclaration, annotations: List) { - require(annotations.all { it.valueArgumentsCount == 0 && it.typeArgumentsCount == 0 }) { - "Saving annotations with arguments from IR to metadata is not supported yet. See KT-58968" + require(annotations.all { it.typeArgumentsCount == 0 && it.hasOnlySupportedAnnotationArgumentTypes() }) { + "Saving annotations with arguments from IR to metadata is only supported for basic constants. See KT-58968" } annotations.forEach { require(it.symbol.owner.constructedClass.isAnnotationClass) { "${it.render()} is not an annotation constructor call" } @@ -98,7 +112,24 @@ class Fir2IrAnnotationsFromPluginRegistrar(private val components: Fir2IrCompone .toLookupTag() .constructClassType(typeArguments = emptyArray(), isNullable = false) .toFirResolvedTypeRef() - argumentMapping = FirEmptyAnnotationArgumentMapping + argumentMapping = buildAnnotationArgumentMapping { + for (i in 0 until this@toFirAnnotation.valueArgumentsCount) { + val name = this@toFirAnnotation.symbol.owner.valueParameters[i].name + val argument = this@toFirAnnotation.getValueArgument(i) as IrConst<*> + this.mapping[name] = when (argument.kind) { + IrConstKind.Boolean -> buildConstExpression(source = null, ConstantValueKind.Boolean, argument.value as Boolean) + IrConstKind.Byte -> buildConstExpression(source = null, ConstantValueKind.Byte, argument.value as Byte) + IrConstKind.Char -> buildConstExpression(source = null, ConstantValueKind.Char, argument.value as Char) + IrConstKind.Double -> buildConstExpression(source = null, ConstantValueKind.Double, argument.value as Double) + IrConstKind.Float -> buildConstExpression(source = null, ConstantValueKind.Float, argument.value as Float) + IrConstKind.Int -> buildConstExpression(source = null, ConstantValueKind.Int, argument.value as Int) + IrConstKind.Long -> buildConstExpression(source = null, ConstantValueKind.Long, argument.value as Long) + IrConstKind.Null -> buildConstExpression(source = null, ConstantValueKind.Null, null) + IrConstKind.Short -> buildConstExpression(source = null, ConstantValueKind.Short, argument.value as Short) + IrConstKind.String -> buildConstExpression(source = null, ConstantValueKind.String, argument.value as String) + } + } + } } } } diff --git a/plugins/fir-plugin-prototype/plugin-annotations/src/commonMain/kotlin/org/jetbrains/kotlin/fir/plugin/annotations.kt b/plugins/fir-plugin-prototype/plugin-annotations/src/commonMain/kotlin/org/jetbrains/kotlin/fir/plugin/annotations.kt index 76d25bf8446..d74e4f867d7 100644 --- a/plugins/fir-plugin-prototype/plugin-annotations/src/commonMain/kotlin/org/jetbrains/kotlin/fir/plugin/annotations.kt +++ b/plugins/fir-plugin-prototype/plugin-annotations/src/commonMain/kotlin/org/jetbrains/kotlin/fir/plugin/annotations.kt @@ -42,4 +42,14 @@ annotation class AllPropertiesConstructor annotation class AddAnnotations -annotation class AnnotationToAdd +annotation class AnnotationToAdd( + val booleanValue: Boolean, + val byteValue: Byte, + val charValue: Char, + val doubleValue: Double, + val floatValue: Float, + val intValue: Int, + val longValue: Long, + val shortValue: Short, + val stringValue: String +) diff --git a/plugins/fir-plugin-prototype/src/org/jetbrains/kotlin/ir/plugin/TransformerForAddingAnnotations.kt b/plugins/fir-plugin-prototype/src/org/jetbrains/kotlin/ir/plugin/TransformerForAddingAnnotations.kt index 34b4d5d4752..1da09c0ed61 100644 --- a/plugins/fir-plugin-prototype/src/org/jetbrains/kotlin/ir/plugin/TransformerForAddingAnnotations.kt +++ b/plugins/fir-plugin-prototype/src/org/jetbrains/kotlin/ir/plugin/TransformerForAddingAnnotations.kt @@ -7,7 +7,11 @@ package org.jetbrains.kotlin.ir.plugin import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext import org.jetbrains.kotlin.ir.IrElement +import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET import org.jetbrains.kotlin.ir.declarations.* +import org.jetbrains.kotlin.ir.expressions.IrConst +import org.jetbrains.kotlin.ir.expressions.IrConstKind +import org.jetbrains.kotlin.ir.expressions.impl.IrConstImpl import org.jetbrains.kotlin.ir.expressions.impl.IrConstructorCallImpl import org.jetbrains.kotlin.ir.types.defaultType import org.jetbrains.kotlin.ir.util.constructors @@ -66,7 +70,44 @@ class TransformerForAddingAnnotations(val context: IrPluginContext) : IrElementV val annotationCall = IrConstructorCallImpl.fromSymbolOwner( type = annotationClass.defaultType, constructorSymbol = annotationConstructor.symbol - ) + ).also { + it.putValueArgument( + 0, + IrConstImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, context.irBuiltIns.booleanType, IrConstKind.Boolean, true) + ) + it.putValueArgument( + 1, + IrConstImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, context.irBuiltIns.byteType, IrConstKind.Byte, 1) + ) + it.putValueArgument( + 2, + IrConstImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, context.irBuiltIns.charType, IrConstKind.Char, 'c') + ) + it.putValueArgument( + 3, + IrConstImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, context.irBuiltIns.doubleType, IrConstKind.Double, 4.2) + ) + it.putValueArgument( + 4, + IrConstImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, context.irBuiltIns.floatType, IrConstKind.Float, 2.4f) + ) + it.putValueArgument( + 5, + IrConstImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, context.irBuiltIns.intType, IrConstKind.Int, 42) + ) + it.putValueArgument( + 6, + IrConstImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, context.irBuiltIns.longType, IrConstKind.Long, 24L) + ) + it.putValueArgument( + 7, + IrConstImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, context.irBuiltIns.shortType, IrConstKind.Short, 7) + ) + it.putValueArgument( + 8, + IrConstImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, context.irBuiltIns.stringType, IrConstKind.String, "OK") + ) + } context.annotationsRegistrar.addMetadataVisibleAnnotationsToElement(declaration, annotationCall) } } diff --git a/plugins/fir-plugin-prototype/testData/firLoadK2Compiled/annotationsGeneratedInBackend.fir.k2.jvm.txt b/plugins/fir-plugin-prototype/testData/firLoadK2Compiled/annotationsGeneratedInBackend.fir.k2.jvm.txt index 8be543f4685..c075a1a8c26 100644 --- a/plugins/fir-plugin-prototype/testData/firLoadK2Compiled/annotationsGeneratedInBackend.fir.k2.jvm.txt +++ b/plugins/fir-plugin-prototype/testData/firLoadK2Compiled/annotationsGeneratedInBackend.fir.k2.jvm.txt @@ -1,13 +1,13 @@ -@R|org/jetbrains/kotlin/fir/plugin/AddAnnotations|() @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|() public final class Some : R|kotlin/Any| { - @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|() public final fun foo(): R|kotlin/Unit| +@R|org/jetbrains/kotlin/fir/plugin/AddAnnotations|() @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|(booleanValue = Boolean(true), byteValue = Byte(1), charValue = Char(c), doubleValue = Double(4.2), floatValue = Float(2.4), intValue = Int(42), longValue = Long(24), shortValue = Short(7), stringValue = String(OK)) public final class Some : R|kotlin/Any| { + @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|(booleanValue = Boolean(true), byteValue = Byte(1), charValue = Char(c), doubleValue = Double(4.2), floatValue = Float(2.4), intValue = Int(42), longValue = Long(24), shortValue = Short(7), stringValue = String(OK)) public final fun foo(): R|kotlin/Unit| - @PROPERTY:R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|() field:@FIELD:R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|() public final val x: R|kotlin/Int| - @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|() public get(): R|kotlin/Int| + @PROPERTY:R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|(booleanValue = Boolean(true), byteValue = Byte(1), charValue = Char(c), doubleValue = Double(4.2), floatValue = Float(2.4), intValue = Int(42), longValue = Long(24), shortValue = Short(7), stringValue = String(OK)) field:@FIELD:R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|(booleanValue = Boolean(true), byteValue = Byte(1), charValue = Char(c), doubleValue = Double(4.2), floatValue = Float(2.4), intValue = Int(42), longValue = Long(24), shortValue = Short(7), stringValue = String(OK)) public final val x: R|kotlin/Int| + @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|(booleanValue = Boolean(true), byteValue = Byte(1), charValue = Char(c), doubleValue = Double(4.2), floatValue = Float(2.4), intValue = Int(42), longValue = Long(24), shortValue = Short(7), stringValue = String(OK)) public get(): R|kotlin/Int| - @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|() public constructor(@R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|() x: R|kotlin/Int|): R|test/Some| + @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|(booleanValue = Boolean(true), byteValue = Byte(1), charValue = Char(c), doubleValue = Double(4.2), floatValue = Float(2.4), intValue = Int(42), longValue = Long(24), shortValue = Short(7), stringValue = String(OK)) public constructor(@R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|(booleanValue = Boolean(true), byteValue = Byte(1), charValue = Char(c), doubleValue = Double(4.2), floatValue = Float(2.4), intValue = Int(42), longValue = Long(24), shortValue = Short(7), stringValue = String(OK)) x: R|kotlin/Int|): R|test/Some| - @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|() public final class Derived : R|kotlin/Any| { - @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|() public constructor(): R|test/Some.Derived| + @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|(booleanValue = Boolean(true), byteValue = Byte(1), charValue = Char(c), doubleValue = Double(4.2), floatValue = Float(2.4), intValue = Int(42), longValue = Long(24), shortValue = Short(7), stringValue = String(OK)) public final class Derived : R|kotlin/Any| { + @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|(booleanValue = Boolean(true), byteValue = Byte(1), charValue = Char(c), doubleValue = Double(4.2), floatValue = Float(2.4), intValue = Int(42), longValue = Long(24), shortValue = Short(7), stringValue = String(OK)) public constructor(): R|test/Some.Derived| } diff --git a/plugins/fir-plugin-prototype/testData/firLoadK2Compiled/annotationsGeneratedInBackend.fir.k2.klib.txt b/plugins/fir-plugin-prototype/testData/firLoadK2Compiled/annotationsGeneratedInBackend.fir.k2.klib.txt index 4f9fe62e554..8b998bb9d20 100644 --- a/plugins/fir-plugin-prototype/testData/firLoadK2Compiled/annotationsGeneratedInBackend.fir.k2.klib.txt +++ b/plugins/fir-plugin-prototype/testData/firLoadK2Compiled/annotationsGeneratedInBackend.fir.k2.klib.txt @@ -1,13 +1,13 @@ -@R|org/jetbrains/kotlin/fir/plugin/AddAnnotations|() @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|() @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|() public final class Some : R|kotlin/Any| { - @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|() @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|() public final fun foo(): R|kotlin/Unit| +@R|org/jetbrains/kotlin/fir/plugin/AddAnnotations|() @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|(booleanValue = Boolean(true), byteValue = Byte(1), charValue = Char(c), doubleValue = Double(4.2), floatValue = Float(2.4), intValue = Int(42), longValue = Long(24), shortValue = Short(7), stringValue = String(OK)) @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|(booleanValue = Boolean(true), byteValue = Byte(1), charValue = Char(c), doubleValue = Double(4.2), floatValue = Float(2.4), intValue = Int(42), longValue = Long(24), shortValue = Short(7), stringValue = String(OK)) public final class Some : R|kotlin/Any| { + @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|(booleanValue = Boolean(true), byteValue = Byte(1), charValue = Char(c), doubleValue = Double(4.2), floatValue = Float(2.4), intValue = Int(42), longValue = Long(24), shortValue = Short(7), stringValue = String(OK)) @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|(booleanValue = Boolean(true), byteValue = Byte(1), charValue = Char(c), doubleValue = Double(4.2), floatValue = Float(2.4), intValue = Int(42), longValue = Long(24), shortValue = Short(7), stringValue = String(OK)) public final fun foo(): R|kotlin/Unit| - @PROPERTY:R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|() @PROPERTY:R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|() @PROPERTY:R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|() @PROPERTY:R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|() @PROPERTY:R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|() public final val x: R|kotlin/Int| - @PROPERTY_GETTER:R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|() @PROPERTY_GETTER:R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|() @PROPERTY_GETTER:R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|() @PROPERTY_GETTER:R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|() @PROPERTY_GETTER:R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|() public get(): R|kotlin/Int| + @PROPERTY:R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|(booleanValue = Boolean(true), byteValue = Byte(1), charValue = Char(c), doubleValue = Double(4.2), floatValue = Float(2.4), intValue = Int(42), longValue = Long(24), shortValue = Short(7), stringValue = String(OK)) @PROPERTY:R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|(booleanValue = Boolean(true), byteValue = Byte(1), charValue = Char(c), doubleValue = Double(4.2), floatValue = Float(2.4), intValue = Int(42), longValue = Long(24), shortValue = Short(7), stringValue = String(OK)) @PROPERTY:R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|(booleanValue = Boolean(true), byteValue = Byte(1), charValue = Char(c), doubleValue = Double(4.2), floatValue = Float(2.4), intValue = Int(42), longValue = Long(24), shortValue = Short(7), stringValue = String(OK)) @PROPERTY:R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|(booleanValue = Boolean(true), byteValue = Byte(1), charValue = Char(c), doubleValue = Double(4.2), floatValue = Float(2.4), intValue = Int(42), longValue = Long(24), shortValue = Short(7), stringValue = String(OK)) @PROPERTY:R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|(booleanValue = Boolean(true), byteValue = Byte(1), charValue = Char(c), doubleValue = Double(4.2), floatValue = Float(2.4), intValue = Int(42), longValue = Long(24), shortValue = Short(7), stringValue = String(OK)) public final val x: R|kotlin/Int| + @PROPERTY_GETTER:R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|(booleanValue = Boolean(true), byteValue = Byte(1), charValue = Char(c), doubleValue = Double(4.2), floatValue = Float(2.4), intValue = Int(42), longValue = Long(24), shortValue = Short(7), stringValue = String(OK)) @PROPERTY_GETTER:R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|(booleanValue = Boolean(true), byteValue = Byte(1), charValue = Char(c), doubleValue = Double(4.2), floatValue = Float(2.4), intValue = Int(42), longValue = Long(24), shortValue = Short(7), stringValue = String(OK)) @PROPERTY_GETTER:R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|(booleanValue = Boolean(true), byteValue = Byte(1), charValue = Char(c), doubleValue = Double(4.2), floatValue = Float(2.4), intValue = Int(42), longValue = Long(24), shortValue = Short(7), stringValue = String(OK)) @PROPERTY_GETTER:R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|(booleanValue = Boolean(true), byteValue = Byte(1), charValue = Char(c), doubleValue = Double(4.2), floatValue = Float(2.4), intValue = Int(42), longValue = Long(24), shortValue = Short(7), stringValue = String(OK)) @PROPERTY_GETTER:R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|(booleanValue = Boolean(true), byteValue = Byte(1), charValue = Char(c), doubleValue = Double(4.2), floatValue = Float(2.4), intValue = Int(42), longValue = Long(24), shortValue = Short(7), stringValue = String(OK)) public get(): R|kotlin/Int| - @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|() public constructor(@R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|() @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|() @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|() @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|() @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|() x: R|kotlin/Int|): R|test/Some| + @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|(booleanValue = Boolean(true), byteValue = Byte(1), charValue = Char(c), doubleValue = Double(4.2), floatValue = Float(2.4), intValue = Int(42), longValue = Long(24), shortValue = Short(7), stringValue = String(OK)) public constructor(@R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|(booleanValue = Boolean(true), byteValue = Byte(1), charValue = Char(c), doubleValue = Double(4.2), floatValue = Float(2.4), intValue = Int(42), longValue = Long(24), shortValue = Short(7), stringValue = String(OK)) @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|(booleanValue = Boolean(true), byteValue = Byte(1), charValue = Char(c), doubleValue = Double(4.2), floatValue = Float(2.4), intValue = Int(42), longValue = Long(24), shortValue = Short(7), stringValue = String(OK)) @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|(booleanValue = Boolean(true), byteValue = Byte(1), charValue = Char(c), doubleValue = Double(4.2), floatValue = Float(2.4), intValue = Int(42), longValue = Long(24), shortValue = Short(7), stringValue = String(OK)) @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|(booleanValue = Boolean(true), byteValue = Byte(1), charValue = Char(c), doubleValue = Double(4.2), floatValue = Float(2.4), intValue = Int(42), longValue = Long(24), shortValue = Short(7), stringValue = String(OK)) @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|(booleanValue = Boolean(true), byteValue = Byte(1), charValue = Char(c), doubleValue = Double(4.2), floatValue = Float(2.4), intValue = Int(42), longValue = Long(24), shortValue = Short(7), stringValue = String(OK)) x: R|kotlin/Int|): R|test/Some| - @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|() @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|() @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|() public final class Derived : R|kotlin/Any| { - @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|() @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|() @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|() public constructor(): R|test/Some.Derived| + @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|(booleanValue = Boolean(true), byteValue = Byte(1), charValue = Char(c), doubleValue = Double(4.2), floatValue = Float(2.4), intValue = Int(42), longValue = Long(24), shortValue = Short(7), stringValue = String(OK)) @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|(booleanValue = Boolean(true), byteValue = Byte(1), charValue = Char(c), doubleValue = Double(4.2), floatValue = Float(2.4), intValue = Int(42), longValue = Long(24), shortValue = Short(7), stringValue = String(OK)) @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|(booleanValue = Boolean(true), byteValue = Byte(1), charValue = Char(c), doubleValue = Double(4.2), floatValue = Float(2.4), intValue = Int(42), longValue = Long(24), shortValue = Short(7), stringValue = String(OK)) public final class Derived : R|kotlin/Any| { + @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|(booleanValue = Boolean(true), byteValue = Byte(1), charValue = Char(c), doubleValue = Double(4.2), floatValue = Float(2.4), intValue = Int(42), longValue = Long(24), shortValue = Short(7), stringValue = String(OK)) @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|(booleanValue = Boolean(true), byteValue = Byte(1), charValue = Char(c), doubleValue = Double(4.2), floatValue = Float(2.4), intValue = Int(42), longValue = Long(24), shortValue = Short(7), stringValue = String(OK)) @R|org/jetbrains/kotlin/fir/plugin/AnnotationToAdd|(booleanValue = Boolean(true), byteValue = Byte(1), charValue = Char(c), doubleValue = Double(4.2), floatValue = Float(2.4), intValue = Int(42), longValue = Long(24), shortValue = Short(7), stringValue = String(OK)) public constructor(): R|test/Some.Derived| } diff --git a/plugins/fir-plugin-prototype/testData/firLoadK2Compiled/annotationsGeneratedInBackend.fir.kt.txt b/plugins/fir-plugin-prototype/testData/firLoadK2Compiled/annotationsGeneratedInBackend.fir.kt.txt index 6fb4695cadf..5c7dfd2c91c 100644 --- a/plugins/fir-plugin-prototype/testData/firLoadK2Compiled/annotationsGeneratedInBackend.fir.kt.txt +++ b/plugins/fir-plugin-prototype/testData/firLoadK2Compiled/annotationsGeneratedInBackend.fir.kt.txt @@ -1,28 +1,28 @@ package test @AddAnnotations -@AnnotationToAdd +@AnnotationToAdd(booleanValue = true, byteValue = 1B, charValue = 'c', doubleValue = 4.2, floatValue = 2.4F, intValue = 42, longValue = 24L, shortValue = 7S, stringValue = "OK") class Some { - @AnnotationToAdd - constructor(@AnnotationToAdd x: Int) /* primary */ { + @AnnotationToAdd(booleanValue = true, byteValue = 1B, charValue = 'c', doubleValue = 4.2, floatValue = 2.4F, intValue = 42, longValue = 24L, shortValue = 7S, stringValue = "OK") + constructor(@AnnotationToAdd(booleanValue = true, byteValue = 1B, charValue = 'c', doubleValue = 4.2, floatValue = 2.4F, intValue = 42, longValue = 24L, shortValue = 7S, stringValue = "OK") x: Int) /* primary */ { super/*Any*/() /* () */ } - @AnnotationToAdd + @AnnotationToAdd(booleanValue = true, byteValue = 1B, charValue = 'c', doubleValue = 4.2, floatValue = 2.4F, intValue = 42, longValue = 24L, shortValue = 7S, stringValue = "OK") val x: Int field = x - @AnnotationToAdd + @AnnotationToAdd(booleanValue = true, byteValue = 1B, charValue = 'c', doubleValue = 4.2, floatValue = 2.4F, intValue = 42, longValue = 24L, shortValue = 7S, stringValue = "OK") get - @AnnotationToAdd + @AnnotationToAdd(booleanValue = true, byteValue = 1B, charValue = 'c', doubleValue = 4.2, floatValue = 2.4F, intValue = 42, longValue = 24L, shortValue = 7S, stringValue = "OK") fun foo() { } - @AnnotationToAdd + @AnnotationToAdd(booleanValue = true, byteValue = 1B, charValue = 'c', doubleValue = 4.2, floatValue = 2.4F, intValue = 42, longValue = 24L, shortValue = 7S, stringValue = "OK") class Derived { - @AnnotationToAdd + @AnnotationToAdd(booleanValue = true, byteValue = 1B, charValue = 'c', doubleValue = 4.2, floatValue = 2.4F, intValue = 42, longValue = 24L, shortValue = 7S, stringValue = "OK") constructor() /* primary */ { super/*Any*/() /* () */