diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/evaluate/IrConstTransformer.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/evaluate/IrConstTransformer.kt index 841c1f02993..de2add80961 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/evaluate/IrConstTransformer.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/evaluate/IrConstTransformer.kt @@ -36,6 +36,8 @@ class IrConstTransformer(irModuleFragment: IrModuleFragment) : IrElementTransfor } override fun visitField(declaration: IrField): IrStatement { + transformAnnotations(declaration) + val initializer = declaration.initializer val expression = initializer?.expression ?: return declaration if (expression is IrConst<*>) return declaration @@ -47,8 +49,13 @@ class IrConstTransformer(irModuleFragment: IrModuleFragment) : IrElementTransfor return declaration } - override fun visitClass(declaration: IrClass): IrStatement { - declaration.annotations.forEach { + override fun visitDeclaration(declaration: IrDeclaration): IrStatement { + transformAnnotations(declaration) + return super.visitDeclaration(declaration) + } + + private fun transformAnnotations(annotationContainer: IrAnnotationContainer) { + annotationContainer.annotations.forEach { for (i in 0 until it.valueArgumentsCount) { val arg = it.getValueArgument(i) ?: continue if (arg.accept(IrCompileTimeChecker(mode = EvaluationMode.ONLY_BUILTINS), null)) { @@ -57,7 +64,6 @@ class IrConstTransformer(irModuleFragment: IrModuleFragment) : IrElementTransfor } } } - return super.visitClass(declaration) } private fun IrExpression.convertToConstIfPossible(type: IrType): IrExpression { diff --git a/compiler/testData/codegen/box/reflection/createAnnotation/floatingPointParameters.kt b/compiler/testData/codegen/box/reflection/createAnnotation/floatingPointParameters.kt index f67d260c479..2cb772f245f 100644 --- a/compiler/testData/codegen/box/reflection/createAnnotation/floatingPointParameters.kt +++ b/compiler/testData/codegen/box/reflection/createAnnotation/floatingPointParameters.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // IGNORE_BACKEND: JS_IR // IGNORE_BACKEND: JS_IR_ES6 // TODO: muted automatically, investigate should it be ran for JS or not