diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt index a2f2d934464..3d23d4e524c 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt @@ -796,7 +796,7 @@ class CallAndReferenceGenerator( if (argumentMapping != null && (visitor.annotationMode || argumentMapping.isNotEmpty())) { if (valueParameters != null) { return applyArgumentsWithReorderingIfNeeded( - argumentMapping, valueParameters, substitutor, contextReceiverCount, + argumentMapping, valueParameters, substitutor, contextReceiverCount, call, ) } } @@ -873,6 +873,7 @@ class CallAndReferenceGenerator( valueParameters: List, substitutor: ConeSubstitutor, contextReceiverCount: Int, + call: FirCall, ): IrExpression { val converted = argumentMapping.entries.map { (argument, parameter) -> parameter to convertArgument(argument, parameter, substitutor) @@ -905,11 +906,11 @@ class CallAndReferenceGenerator( putValueArgument(valueParameters.indexOf(parameter) + contextReceiverCount, irArgument) } if (visitor.annotationMode) { + val function = call.calleeReference?.toResolvedCallableSymbol()?.fir as? FirFunction for ((index, parameter) in valueParameters.withIndex()) { if (parameter.isVararg && !argumentMapping.containsValue(parameter)) { - val defaultValue = parameter.defaultValue - val value = if (defaultValue != null) { - convertArgument(defaultValue, parameter, ConeSubstitutor.Empty) + val value = if (function?.itOrExpectHasDefaultParameterValue(index) == true) { + null } else { val elementType = parameter.returnTypeRef.toIrType() IrVarargImpl( diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java index 6e2fd6e1ff1..2aaeb3ed6ff 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java @@ -83,6 +83,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr runTest("compiler/testData/codegen/box/annotations/annotationTargets.kt"); } + @Test + @TestMetadata("annotationWithDefaultArgInDifferentModule.kt") + public void testAnnotationWithDefaultArgInDifferentModule() throws Exception { + runTest("compiler/testData/codegen/box/annotations/annotationWithDefaultArgInDifferentModule.kt"); + } + @Test @TestMetadata("annotationWithKotlinProperty.kt") public void testAnnotationWithKotlinProperty() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java index 291f885c584..c7bd3040727 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java @@ -83,6 +83,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo runTest("compiler/testData/codegen/box/annotations/annotationTargets.kt"); } + @Test + @TestMetadata("annotationWithDefaultArgInDifferentModule.kt") + public void testAnnotationWithDefaultArgInDifferentModule() throws Exception { + runTest("compiler/testData/codegen/box/annotations/annotationWithDefaultArgInDifferentModule.kt"); + } + @Test @TestMetadata("annotationWithKotlinProperty.kt") public void testAnnotationWithKotlinProperty() throws Exception { diff --git a/compiler/testData/codegen/box/annotations/annotationWithDefaultArgInDifferentModule.kt b/compiler/testData/codegen/box/annotations/annotationWithDefaultArgInDifferentModule.kt new file mode 100644 index 00000000000..3f888b5e107 --- /dev/null +++ b/compiler/testData/codegen/box/annotations/annotationWithDefaultArgInDifferentModule.kt @@ -0,0 +1,12 @@ +// MODULE: lib1 +// FILE: lib1.kt + +annotation class MyConfig( + vararg val profiles: String = [], +) + +// MODULE: box(lib1) +// FILE: box.kt + +@MyConfig +fun box() = "OK" diff --git a/compiler/testData/codegen/box/annotations/javaAnnotationArrayValueDefault.fir.ir.txt b/compiler/testData/codegen/box/annotations/javaAnnotationArrayValueDefault.fir.ir.txt new file mode 100644 index 00000000000..c2fc404591d --- /dev/null +++ b/compiler/testData/codegen/box/annotations/javaAnnotationArrayValueDefault.fir.ir.txt @@ -0,0 +1,249 @@ +Module: lib +Module: main +FILE fqName: fileName:/1.kt + CLASS CLASS name:MyClass1 modality:FINAL visibility:public superTypes:[kotlin.Any] + annotations: + JavaAnn(value = ) + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.MyClass1 + CONSTRUCTOR visibility:public <> () returnType:.MyClass1 [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:MyClass1 modality:FINAL visibility:public superTypes:[kotlin.Any]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:MyClass2 modality:FINAL visibility:public superTypes:[kotlin.Any] + annotations: + JavaAnn(value = ) + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.MyClass2 + CONSTRUCTOR visibility:public <> () returnType:.MyClass2 [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:MyClass2 modality:FINAL visibility:public superTypes:[kotlin.Any]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:MyClass3 modality:FINAL visibility:public superTypes:[kotlin.Any] + annotations: + JavaAnn(value = ['asd']) + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.MyClass3 + CONSTRUCTOR visibility:public <> () returnType:.MyClass3 [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:MyClass3 modality:FINAL visibility:public superTypes:[kotlin.Any]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:MyClass4 modality:FINAL visibility:public superTypes:[kotlin.Any] + annotations: + JavaAnn(value = []) + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.MyClass4 + CONSTRUCTOR visibility:public <> () returnType:.MyClass4 [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:MyClass4 modality:FINAL visibility:public superTypes:[kotlin.Any]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String + BLOCK_BODY + VAR name:value1 type:kotlin.Array [val] + CALL 'public abstract fun (): kotlin.Array declared in .JavaAnn' type=kotlin.Array origin=GET_PROPERTY + $this: CALL 'public open fun getAnnotation (p0: @[FlexibleNullability] java.lang.Class<@[FlexibleNullability] A of java.lang.Class.getAnnotation?>?): @[FlexibleNullability] A of java.lang.Class.getAnnotation? declared in java.lang.Class' type=@[FlexibleNullability] .JavaAnn? origin=null + : @[FlexibleNullability] .JavaAnn? + $this: CALL 'public final fun (): java.lang.Class> declared in kotlin.jvm' type=java.lang.Class<.MyClass1> origin=GET_PROPERTY + : .MyClass1 + $receiver: CLASS_REFERENCE 'CLASS CLASS name:MyClass1 modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<.MyClass1> + p0: CALL 'public final fun (): java.lang.Class> declared in kotlin.jvm' type=java.lang.Class<.JavaAnn> origin=GET_PROPERTY + : .JavaAnn + $receiver: CLASS_REFERENCE 'CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB ANNOTATION_CLASS name:JavaAnn modality:FINAL visibility:public/*package*/ superTypes:[kotlin.Any; kotlin.Annotation]' type=kotlin.reflect.KClass<.JavaAnn> + WHEN type=kotlin.Unit origin=IF + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: CALL 'public final fun (): kotlin.Int declared in kotlin.Array' type=kotlin.Int origin=GET_PROPERTY + $this: GET_VAR 'val value1: kotlin.Array declared in .box' type=kotlin.Array origin=null + arg1: CONST Int type=kotlin.Int value=2 + then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="fail1: " + CALL 'public final fun (): kotlin.Int declared in kotlin.Array' type=kotlin.Int origin=GET_PROPERTY + $this: GET_VAR 'val value1: kotlin.Array declared in .box' type=kotlin.Array origin=null + WHEN type=kotlin.Unit origin=IF + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array declared in kotlin.Array' type=kotlin.String origin=null + $this: GET_VAR 'val value1: kotlin.Array declared in .box' type=kotlin.Array origin=null + index: CONST Int type=kotlin.Int value=0 + arg1: CONST String type=kotlin.String value="d1" + then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="fail2: " + CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array declared in kotlin.Array' type=kotlin.String origin=null + $this: GET_VAR 'val value1: kotlin.Array declared in .box' type=kotlin.Array origin=null + index: CONST Int type=kotlin.Int value=0 + WHEN type=kotlin.Unit origin=IF + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array declared in kotlin.Array' type=kotlin.String origin=null + $this: GET_VAR 'val value1: kotlin.Array declared in .box' type=kotlin.Array origin=null + index: CONST Int type=kotlin.Int value=1 + arg1: CONST String type=kotlin.String value="d2" + then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="fail3: " + CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array declared in kotlin.Array' type=kotlin.String origin=null + $this: GET_VAR 'val value1: kotlin.Array declared in .box' type=kotlin.Array origin=null + index: CONST Int type=kotlin.Int value=1 + VAR name:value2 type:kotlin.Array [val] + CALL 'public abstract fun (): kotlin.Array declared in .JavaAnn' type=kotlin.Array origin=GET_PROPERTY + $this: CALL 'public open fun getAnnotation (p0: @[FlexibleNullability] java.lang.Class<@[FlexibleNullability] A of java.lang.Class.getAnnotation?>?): @[FlexibleNullability] A of java.lang.Class.getAnnotation? declared in java.lang.Class' type=@[FlexibleNullability] .JavaAnn? origin=null + : @[FlexibleNullability] .JavaAnn? + $this: CALL 'public final fun (): java.lang.Class> declared in kotlin.jvm' type=java.lang.Class<.MyClass2> origin=GET_PROPERTY + : .MyClass2 + $receiver: CLASS_REFERENCE 'CLASS CLASS name:MyClass2 modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<.MyClass2> + p0: CALL 'public final fun (): java.lang.Class> declared in kotlin.jvm' type=java.lang.Class<.JavaAnn> origin=GET_PROPERTY + : .JavaAnn + $receiver: CLASS_REFERENCE 'CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB ANNOTATION_CLASS name:JavaAnn modality:FINAL visibility:public/*package*/ superTypes:[kotlin.Any; kotlin.Annotation]' type=kotlin.reflect.KClass<.JavaAnn> + WHEN type=kotlin.Unit origin=IF + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: CALL 'public final fun (): kotlin.Int declared in kotlin.Array' type=kotlin.Int origin=GET_PROPERTY + $this: GET_VAR 'val value2: kotlin.Array declared in .box' type=kotlin.Array origin=null + arg1: CONST Int type=kotlin.Int value=2 + then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="fail4: " + CALL 'public final fun (): kotlin.Int declared in kotlin.Array' type=kotlin.Int origin=GET_PROPERTY + $this: GET_VAR 'val value2: kotlin.Array declared in .box' type=kotlin.Array origin=null + WHEN type=kotlin.Unit origin=IF + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array declared in kotlin.Array' type=kotlin.String origin=null + $this: GET_VAR 'val value2: kotlin.Array declared in .box' type=kotlin.Array origin=null + index: CONST Int type=kotlin.Int value=0 + arg1: CONST String type=kotlin.String value="d1" + then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="fail5: " + CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array declared in kotlin.Array' type=kotlin.String origin=null + $this: GET_VAR 'val value2: kotlin.Array declared in .box' type=kotlin.Array origin=null + index: CONST Int type=kotlin.Int value=0 + WHEN type=kotlin.Unit origin=IF + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array declared in kotlin.Array' type=kotlin.String origin=null + $this: GET_VAR 'val value2: kotlin.Array declared in .box' type=kotlin.Array origin=null + index: CONST Int type=kotlin.Int value=1 + arg1: CONST String type=kotlin.String value="d2" + then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="fail6: " + CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array declared in kotlin.Array' type=kotlin.String origin=null + $this: GET_VAR 'val value2: kotlin.Array declared in .box' type=kotlin.Array origin=null + index: CONST Int type=kotlin.Int value=1 + VAR name:value3 type:kotlin.Array [val] + CALL 'public abstract fun (): kotlin.Array declared in .JavaAnn' type=kotlin.Array origin=GET_PROPERTY + $this: CALL 'public open fun getAnnotation (p0: @[FlexibleNullability] java.lang.Class<@[FlexibleNullability] A of java.lang.Class.getAnnotation?>?): @[FlexibleNullability] A of java.lang.Class.getAnnotation? declared in java.lang.Class' type=@[FlexibleNullability] .JavaAnn? origin=null + : @[FlexibleNullability] .JavaAnn? + $this: CALL 'public final fun (): java.lang.Class> declared in kotlin.jvm' type=java.lang.Class<.MyClass3> origin=GET_PROPERTY + : .MyClass3 + $receiver: CLASS_REFERENCE 'CLASS CLASS name:MyClass3 modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<.MyClass3> + p0: CALL 'public final fun (): java.lang.Class> declared in kotlin.jvm' type=java.lang.Class<.JavaAnn> origin=GET_PROPERTY + : .JavaAnn + $receiver: CLASS_REFERENCE 'CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB ANNOTATION_CLASS name:JavaAnn modality:FINAL visibility:public/*package*/ superTypes:[kotlin.Any; kotlin.Annotation]' type=kotlin.reflect.KClass<.JavaAnn> + WHEN type=kotlin.Unit origin=IF + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: CALL 'public final fun (): kotlin.Int declared in kotlin.Array' type=kotlin.Int origin=GET_PROPERTY + $this: GET_VAR 'val value3: kotlin.Array declared in .box' type=kotlin.Array origin=null + arg1: CONST Int type=kotlin.Int value=1 + then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="fail7: " + CALL 'public final fun (): kotlin.Int declared in kotlin.Array' type=kotlin.Int origin=GET_PROPERTY + $this: GET_VAR 'val value3: kotlin.Array declared in .box' type=kotlin.Array origin=null + WHEN type=kotlin.Unit origin=IF + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array declared in kotlin.Array' type=kotlin.String origin=null + $this: GET_VAR 'val value3: kotlin.Array declared in .box' type=kotlin.Array origin=null + index: CONST Int type=kotlin.Int value=0 + arg1: CONST String type=kotlin.String value="asd" + then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="fail8: " + CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array declared in kotlin.Array' type=kotlin.String origin=null + $this: GET_VAR 'val value3: kotlin.Array declared in .box' type=kotlin.Array origin=null + index: CONST Int type=kotlin.Int value=0 + VAR name:value4 type:kotlin.Array [val] + CALL 'public abstract fun (): kotlin.Array declared in .JavaAnn' type=kotlin.Array origin=GET_PROPERTY + $this: CALL 'public open fun getAnnotation (p0: @[FlexibleNullability] java.lang.Class<@[FlexibleNullability] A of java.lang.Class.getAnnotation?>?): @[FlexibleNullability] A of java.lang.Class.getAnnotation? declared in java.lang.Class' type=@[FlexibleNullability] .JavaAnn? origin=null + : @[FlexibleNullability] .JavaAnn? + $this: CALL 'public final fun (): java.lang.Class> declared in kotlin.jvm' type=java.lang.Class<.MyClass4> origin=GET_PROPERTY + : .MyClass4 + $receiver: CLASS_REFERENCE 'CLASS CLASS name:MyClass4 modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<.MyClass4> + p0: CALL 'public final fun (): java.lang.Class> declared in kotlin.jvm' type=java.lang.Class<.JavaAnn> origin=GET_PROPERTY + : .JavaAnn + $receiver: CLASS_REFERENCE 'CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB ANNOTATION_CLASS name:JavaAnn modality:FINAL visibility:public/*package*/ superTypes:[kotlin.Any; kotlin.Annotation]' type=kotlin.reflect.KClass<.JavaAnn> + WHEN type=kotlin.Unit origin=IF + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: CALL 'public final fun (): kotlin.Int declared in kotlin.Array' type=kotlin.Int origin=GET_PROPERTY + $this: GET_VAR 'val value4: kotlin.Array declared in .box' type=kotlin.Array origin=null + arg1: CONST Int type=kotlin.Int value=0 + then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="fail 9: " + CALL 'public final fun (): kotlin.Int declared in kotlin.Array' type=kotlin.Int origin=GET_PROPERTY + $this: GET_VAR 'val value4: kotlin.Array declared in .box' type=kotlin.Array origin=null + RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' + CONST String type=kotlin.String value="OK" diff --git a/compiler/testData/codegen/box/annotations/javaAnnotationArrayValueDefault.ir.txt b/compiler/testData/codegen/box/annotations/javaAnnotationArrayValueDefault.ir.txt new file mode 100644 index 00000000000..521a05d51da --- /dev/null +++ b/compiler/testData/codegen/box/annotations/javaAnnotationArrayValueDefault.ir.txt @@ -0,0 +1,253 @@ +Module: lib +Module: main +FILE fqName: fileName:/1.kt + CLASS CLASS name:MyClass1 modality:FINAL visibility:public superTypes:[kotlin.Any] + annotations: + JavaAnn(value = ) + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.MyClass1 + CONSTRUCTOR visibility:public <> () returnType:.MyClass1 [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:MyClass1 modality:FINAL visibility:public superTypes:[kotlin.Any]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:MyClass2 modality:FINAL visibility:public superTypes:[kotlin.Any] + annotations: + JavaAnn(value = ) + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.MyClass2 + CONSTRUCTOR visibility:public <> () returnType:.MyClass2 [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:MyClass2 modality:FINAL visibility:public superTypes:[kotlin.Any]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:MyClass3 modality:FINAL visibility:public superTypes:[kotlin.Any] + annotations: + JavaAnn(value = ['asd']) + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.MyClass3 + CONSTRUCTOR visibility:public <> () returnType:.MyClass3 [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:MyClass3 modality:FINAL visibility:public superTypes:[kotlin.Any]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:MyClass4 modality:FINAL visibility:public superTypes:[kotlin.Any] + annotations: + JavaAnn(value = []) + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.MyClass4 + CONSTRUCTOR visibility:public <> () returnType:.MyClass4 [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:MyClass4 modality:FINAL visibility:public superTypes:[kotlin.Any]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String + BLOCK_BODY + VAR name:value1 type:kotlin.Array [val] + CALL 'public final fun (): kotlin.Array declared in .JavaAnn' type=kotlin.Array origin=GET_PROPERTY + $this: TYPE_OP type=.JavaAnn origin=IMPLICIT_NOTNULL typeOperand=.JavaAnn + CALL 'public open fun getAnnotation (p0: @[FlexibleNullability] java.lang.Class<@[FlexibleNullability] A of java.lang.Class.getAnnotation?>?): @[FlexibleNullability] A of java.lang.Class.getAnnotation? declared in java.lang.Class' type=@[FlexibleNullability] .JavaAnn? origin=null + : @[FlexibleNullability] .JavaAnn? + $this: CALL 'public final fun (): java.lang.Class> declared in kotlin.jvm' type=java.lang.Class<.MyClass1> origin=GET_PROPERTY + : .MyClass1 + $receiver: CLASS_REFERENCE 'CLASS CLASS name:MyClass1 modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<.MyClass1> + p0: CALL 'public final fun (): java.lang.Class> declared in kotlin.jvm' type=java.lang.Class<.JavaAnn> origin=GET_PROPERTY + : .JavaAnn + $receiver: CLASS_REFERENCE 'CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB ANNOTATION_CLASS name:JavaAnn modality:OPEN visibility:public/*package*/ superTypes:[kotlin.Annotation]' type=kotlin.reflect.KClass<.JavaAnn> + WHEN type=kotlin.Unit origin=IF + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: CALL 'public final fun (): kotlin.Int declared in kotlin.Array' type=kotlin.Int origin=GET_PROPERTY + $this: GET_VAR 'val value1: kotlin.Array declared in .box' type=kotlin.Array origin=null + arg1: CONST Int type=kotlin.Int value=2 + then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="fail1: " + CALL 'public final fun (): kotlin.Int declared in kotlin.Array' type=kotlin.Int origin=GET_PROPERTY + $this: GET_VAR 'val value1: kotlin.Array declared in .box' type=kotlin.Array origin=null + WHEN type=kotlin.Unit origin=IF + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array declared in kotlin.Array' type=kotlin.String origin=GET_ARRAY_ELEMENT + $this: GET_VAR 'val value1: kotlin.Array declared in .box' type=kotlin.Array origin=null + index: CONST Int type=kotlin.Int value=0 + arg1: CONST String type=kotlin.String value="d1" + then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="fail2: " + CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array declared in kotlin.Array' type=kotlin.String origin=GET_ARRAY_ELEMENT + $this: GET_VAR 'val value1: kotlin.Array declared in .box' type=kotlin.Array origin=null + index: CONST Int type=kotlin.Int value=0 + WHEN type=kotlin.Unit origin=IF + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array declared in kotlin.Array' type=kotlin.String origin=GET_ARRAY_ELEMENT + $this: GET_VAR 'val value1: kotlin.Array declared in .box' type=kotlin.Array origin=null + index: CONST Int type=kotlin.Int value=1 + arg1: CONST String type=kotlin.String value="d2" + then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="fail3: " + CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array declared in kotlin.Array' type=kotlin.String origin=GET_ARRAY_ELEMENT + $this: GET_VAR 'val value1: kotlin.Array declared in .box' type=kotlin.Array origin=null + index: CONST Int type=kotlin.Int value=1 + VAR name:value2 type:kotlin.Array [val] + CALL 'public final fun (): kotlin.Array declared in .JavaAnn' type=kotlin.Array origin=GET_PROPERTY + $this: TYPE_OP type=.JavaAnn origin=IMPLICIT_NOTNULL typeOperand=.JavaAnn + CALL 'public open fun getAnnotation (p0: @[FlexibleNullability] java.lang.Class<@[FlexibleNullability] A of java.lang.Class.getAnnotation?>?): @[FlexibleNullability] A of java.lang.Class.getAnnotation? declared in java.lang.Class' type=@[FlexibleNullability] .JavaAnn? origin=null + : @[FlexibleNullability] .JavaAnn? + $this: CALL 'public final fun (): java.lang.Class> declared in kotlin.jvm' type=java.lang.Class<.MyClass2> origin=GET_PROPERTY + : .MyClass2 + $receiver: CLASS_REFERENCE 'CLASS CLASS name:MyClass2 modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<.MyClass2> + p0: CALL 'public final fun (): java.lang.Class> declared in kotlin.jvm' type=java.lang.Class<.JavaAnn> origin=GET_PROPERTY + : .JavaAnn + $receiver: CLASS_REFERENCE 'CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB ANNOTATION_CLASS name:JavaAnn modality:OPEN visibility:public/*package*/ superTypes:[kotlin.Annotation]' type=kotlin.reflect.KClass<.JavaAnn> + WHEN type=kotlin.Unit origin=IF + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: CALL 'public final fun (): kotlin.Int declared in kotlin.Array' type=kotlin.Int origin=GET_PROPERTY + $this: GET_VAR 'val value2: kotlin.Array declared in .box' type=kotlin.Array origin=null + arg1: CONST Int type=kotlin.Int value=2 + then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="fail4: " + CALL 'public final fun (): kotlin.Int declared in kotlin.Array' type=kotlin.Int origin=GET_PROPERTY + $this: GET_VAR 'val value2: kotlin.Array declared in .box' type=kotlin.Array origin=null + WHEN type=kotlin.Unit origin=IF + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array declared in kotlin.Array' type=kotlin.String origin=GET_ARRAY_ELEMENT + $this: GET_VAR 'val value2: kotlin.Array declared in .box' type=kotlin.Array origin=null + index: CONST Int type=kotlin.Int value=0 + arg1: CONST String type=kotlin.String value="d1" + then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="fail5: " + CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array declared in kotlin.Array' type=kotlin.String origin=GET_ARRAY_ELEMENT + $this: GET_VAR 'val value2: kotlin.Array declared in .box' type=kotlin.Array origin=null + index: CONST Int type=kotlin.Int value=0 + WHEN type=kotlin.Unit origin=IF + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array declared in kotlin.Array' type=kotlin.String origin=GET_ARRAY_ELEMENT + $this: GET_VAR 'val value2: kotlin.Array declared in .box' type=kotlin.Array origin=null + index: CONST Int type=kotlin.Int value=1 + arg1: CONST String type=kotlin.String value="d2" + then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="fail6: " + CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array declared in kotlin.Array' type=kotlin.String origin=GET_ARRAY_ELEMENT + $this: GET_VAR 'val value2: kotlin.Array declared in .box' type=kotlin.Array origin=null + index: CONST Int type=kotlin.Int value=1 + VAR name:value3 type:kotlin.Array [val] + CALL 'public final fun (): kotlin.Array declared in .JavaAnn' type=kotlin.Array origin=GET_PROPERTY + $this: TYPE_OP type=.JavaAnn origin=IMPLICIT_NOTNULL typeOperand=.JavaAnn + CALL 'public open fun getAnnotation (p0: @[FlexibleNullability] java.lang.Class<@[FlexibleNullability] A of java.lang.Class.getAnnotation?>?): @[FlexibleNullability] A of java.lang.Class.getAnnotation? declared in java.lang.Class' type=@[FlexibleNullability] .JavaAnn? origin=null + : @[FlexibleNullability] .JavaAnn? + $this: CALL 'public final fun (): java.lang.Class> declared in kotlin.jvm' type=java.lang.Class<.MyClass3> origin=GET_PROPERTY + : .MyClass3 + $receiver: CLASS_REFERENCE 'CLASS CLASS name:MyClass3 modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<.MyClass3> + p0: CALL 'public final fun (): java.lang.Class> declared in kotlin.jvm' type=java.lang.Class<.JavaAnn> origin=GET_PROPERTY + : .JavaAnn + $receiver: CLASS_REFERENCE 'CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB ANNOTATION_CLASS name:JavaAnn modality:OPEN visibility:public/*package*/ superTypes:[kotlin.Annotation]' type=kotlin.reflect.KClass<.JavaAnn> + WHEN type=kotlin.Unit origin=IF + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: CALL 'public final fun (): kotlin.Int declared in kotlin.Array' type=kotlin.Int origin=GET_PROPERTY + $this: GET_VAR 'val value3: kotlin.Array declared in .box' type=kotlin.Array origin=null + arg1: CONST Int type=kotlin.Int value=1 + then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="fail7: " + CALL 'public final fun (): kotlin.Int declared in kotlin.Array' type=kotlin.Int origin=GET_PROPERTY + $this: GET_VAR 'val value3: kotlin.Array declared in .box' type=kotlin.Array origin=null + WHEN type=kotlin.Unit origin=IF + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array declared in kotlin.Array' type=kotlin.String origin=GET_ARRAY_ELEMENT + $this: GET_VAR 'val value3: kotlin.Array declared in .box' type=kotlin.Array origin=null + index: CONST Int type=kotlin.Int value=0 + arg1: CONST String type=kotlin.String value="asd" + then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="fail8: " + CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array declared in kotlin.Array' type=kotlin.String origin=GET_ARRAY_ELEMENT + $this: GET_VAR 'val value3: kotlin.Array declared in .box' type=kotlin.Array origin=null + index: CONST Int type=kotlin.Int value=0 + VAR name:value4 type:kotlin.Array [val] + CALL 'public final fun (): kotlin.Array declared in .JavaAnn' type=kotlin.Array origin=GET_PROPERTY + $this: TYPE_OP type=.JavaAnn origin=IMPLICIT_NOTNULL typeOperand=.JavaAnn + CALL 'public open fun getAnnotation (p0: @[FlexibleNullability] java.lang.Class<@[FlexibleNullability] A of java.lang.Class.getAnnotation?>?): @[FlexibleNullability] A of java.lang.Class.getAnnotation? declared in java.lang.Class' type=@[FlexibleNullability] .JavaAnn? origin=null + : @[FlexibleNullability] .JavaAnn? + $this: CALL 'public final fun (): java.lang.Class> declared in kotlin.jvm' type=java.lang.Class<.MyClass4> origin=GET_PROPERTY + : .MyClass4 + $receiver: CLASS_REFERENCE 'CLASS CLASS name:MyClass4 modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<.MyClass4> + p0: CALL 'public final fun (): java.lang.Class> declared in kotlin.jvm' type=java.lang.Class<.JavaAnn> origin=GET_PROPERTY + : .JavaAnn + $receiver: CLASS_REFERENCE 'CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB ANNOTATION_CLASS name:JavaAnn modality:OPEN visibility:public/*package*/ superTypes:[kotlin.Annotation]' type=kotlin.reflect.KClass<.JavaAnn> + WHEN type=kotlin.Unit origin=IF + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: CALL 'public final fun (): kotlin.Int declared in kotlin.Array' type=kotlin.Int origin=GET_PROPERTY + $this: GET_VAR 'val value4: kotlin.Array declared in .box' type=kotlin.Array origin=null + arg1: CONST Int type=kotlin.Int value=0 + then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="fail 9: " + CALL 'public final fun (): kotlin.Int declared in kotlin.Array' type=kotlin.Int origin=GET_PROPERTY + $this: GET_VAR 'val value4: kotlin.Array declared in .box' type=kotlin.Array origin=null + RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' + CONST String type=kotlin.String value="OK" diff --git a/compiler/testData/codegen/box/annotations/javaAnnotationArrayValueDefault.kt b/compiler/testData/codegen/box/annotations/javaAnnotationArrayValueDefault.kt index 922f400bda7..9bc529c469a 100644 --- a/compiler/testData/codegen/box/annotations/javaAnnotationArrayValueDefault.kt +++ b/compiler/testData/codegen/box/annotations/javaAnnotationArrayValueDefault.kt @@ -1,5 +1,6 @@ // TARGET_BACKEND: JVM // WITH_STDLIB +// DUMP_IR // MODULE: lib // FILE: JavaAnn.java diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java index dda819bb82c..b38f8302068 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java @@ -71,6 +71,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/annotations/annotationTargets.kt"); } + @Test + @TestMetadata("annotationWithDefaultArgInDifferentModule.kt") + public void testAnnotationWithDefaultArgInDifferentModule() throws Exception { + runTest("compiler/testData/codegen/box/annotations/annotationWithDefaultArgInDifferentModule.kt"); + } + @Test @TestMetadata("annotationWithKotlinProperty.kt") public void testAnnotationWithKotlinProperty() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index 41d94fa8e39..243e43b64ac 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -83,6 +83,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/annotations/annotationTargets.kt"); } + @Test + @TestMetadata("annotationWithDefaultArgInDifferentModule.kt") + public void testAnnotationWithDefaultArgInDifferentModule() throws Exception { + runTest("compiler/testData/codegen/box/annotations/annotationWithDefaultArgInDifferentModule.kt"); + } + @Test @TestMetadata("annotationWithKotlinProperty.kt") public void testAnnotationWithKotlinProperty() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java index f5bbe68d5f4..eef54a9609b 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java @@ -83,6 +83,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack runTest("compiler/testData/codegen/box/annotations/annotationTargets.kt"); } + @Test + @TestMetadata("annotationWithDefaultArgInDifferentModule.kt") + public void testAnnotationWithDefaultArgInDifferentModule() throws Exception { + runTest("compiler/testData/codegen/box/annotations/annotationWithDefaultArgInDifferentModule.kt"); + } + @Test @TestMetadata("annotationWithKotlinProperty.kt") public void testAnnotationWithKotlinProperty() throws Exception { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index dbeb7b8fbde..891d54407aa 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -83,6 +83,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/annotations/annotationTargets.kt"); } + @TestMetadata("annotationWithDefaultArgInDifferentModule.kt") + public void testAnnotationWithDefaultArgInDifferentModule() throws Exception { + runTest("compiler/testData/codegen/box/annotations/annotationWithDefaultArgInDifferentModule.kt"); + } + @TestMetadata("annotationWithKotlinProperty.kt") public void testAnnotationWithKotlinProperty() throws Exception { runTest("compiler/testData/codegen/box/annotations/annotationWithKotlinProperty.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java index 442c126ebb4..97f2217658c 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java @@ -35,6 +35,12 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/annotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } + @Test + @TestMetadata("annotationWithDefaultArgInDifferentModule.kt") + public void testAnnotationWithDefaultArgInDifferentModule() throws Exception { + runTest("compiler/testData/codegen/box/annotations/annotationWithDefaultArgInDifferentModule.kt"); + } + @Test @TestMetadata("genericAnnotations.kt") public void testGenericAnnotations() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java index 3afba50fd95..e2c39be9ded 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java @@ -35,6 +35,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/annotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } + @Test + @TestMetadata("annotationWithDefaultArgInDifferentModule.kt") + public void testAnnotationWithDefaultArgInDifferentModule() throws Exception { + runTest("compiler/testData/codegen/box/annotations/annotationWithDefaultArgInDifferentModule.kt"); + } + @Test @TestMetadata("genericAnnotations.kt") public void testGenericAnnotations() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java index 87b0ca29560..490f7edbdfb 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java @@ -35,6 +35,12 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/annotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } + @Test + @TestMetadata("annotationWithDefaultArgInDifferentModule.kt") + public void testAnnotationWithDefaultArgInDifferentModule() throws Exception { + runTest("compiler/testData/codegen/box/annotations/annotationWithDefaultArgInDifferentModule.kt"); + } + @Test @TestMetadata("genericAnnotations.kt") public void testGenericAnnotations() throws Exception { diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestGenerated.java index e3b100cd2af..af03cbfdf8a 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestGenerated.java @@ -46,6 +46,12 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/annotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); } + @Test + @TestMetadata("annotationWithDefaultArgInDifferentModule.kt") + public void testAnnotationWithDefaultArgInDifferentModule() throws Exception { + runTest("compiler/testData/codegen/box/annotations/annotationWithDefaultArgInDifferentModule.kt"); + } + @Test @TestMetadata("genericAnnotations.kt") public void testGenericAnnotations() throws Exception { diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestNoPLGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestNoPLGenerated.java index 3d65cfcf722..992983252cb 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestNoPLGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestNoPLGenerated.java @@ -52,6 +52,12 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/annotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); } + @Test + @TestMetadata("annotationWithDefaultArgInDifferentModule.kt") + public void testAnnotationWithDefaultArgInDifferentModule() throws Exception { + runTest("compiler/testData/codegen/box/annotations/annotationWithDefaultArgInDifferentModule.kt"); + } + @Test @TestMetadata("genericAnnotations.kt") public void testGenericAnnotations() throws Exception { diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java index 1968d1b87d9..d28ca988eba 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java @@ -44,6 +44,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/annotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); } + @Test + @TestMetadata("annotationWithDefaultArgInDifferentModule.kt") + public void testAnnotationWithDefaultArgInDifferentModule() throws Exception { + runTest("compiler/testData/codegen/box/annotations/annotationWithDefaultArgInDifferentModule.kt"); + } + @Test @TestMetadata("genericAnnotations.kt") public void testGenericAnnotations() throws Exception { diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestNoPLGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestNoPLGenerated.java index b9a5098fcf4..5c5b225cd70 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestNoPLGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestNoPLGenerated.java @@ -47,6 +47,12 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/annotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); } + @Test + @TestMetadata("annotationWithDefaultArgInDifferentModule.kt") + public void testAnnotationWithDefaultArgInDifferentModule() throws Exception { + runTest("compiler/testData/codegen/box/annotations/annotationWithDefaultArgInDifferentModule.kt"); + } + @Test @TestMetadata("genericAnnotations.kt") public void testGenericAnnotations() throws Exception { diff --git a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmCodegenBoxTestGenerated.java b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmCodegenBoxTestGenerated.java index 0e2de9ca819..530ef5d2e48 100644 --- a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmCodegenBoxTestGenerated.java +++ b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmCodegenBoxTestGenerated.java @@ -35,6 +35,12 @@ public class FirWasmCodegenBoxTestGenerated extends AbstractFirWasmCodegenBoxTes KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/annotations"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); } + @Test + @TestMetadata("annotationWithDefaultArgInDifferentModule.kt") + public void testAnnotationWithDefaultArgInDifferentModule() throws Exception { + runTest("compiler/testData/codegen/box/annotations/annotationWithDefaultArgInDifferentModule.kt"); + } + @Test @TestMetadata("genericAnnotations.kt") public void testGenericAnnotations() throws Exception { diff --git a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/K1WasmCodegenBoxTestGenerated.java b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/K1WasmCodegenBoxTestGenerated.java index eb8131cb49a..1f8755935b9 100644 --- a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/K1WasmCodegenBoxTestGenerated.java +++ b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/K1WasmCodegenBoxTestGenerated.java @@ -35,6 +35,12 @@ public class K1WasmCodegenBoxTestGenerated extends AbstractK1WasmCodegenBoxTest KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/annotations"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); } + @Test + @TestMetadata("annotationWithDefaultArgInDifferentModule.kt") + public void testAnnotationWithDefaultArgInDifferentModule() throws Exception { + runTest("compiler/testData/codegen/box/annotations/annotationWithDefaultArgInDifferentModule.kt"); + } + @Test @TestMetadata("genericAnnotations.kt") public void testGenericAnnotations() throws Exception {