diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLoadK1CompiledKotlinGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLoadK1CompiledKotlinGenerated.java index 3156acf1d72..9856330a5d8 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLoadK1CompiledKotlinGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLoadK1CompiledKotlinGenerated.java @@ -78,6 +78,12 @@ public class FirLoadK1CompiledKotlinGenerated extends AbstractFirLoadK1CompiledK runTest("compiler/testData/loadJava/compiledKotlin/annotations/PrimitiveArrayArguments.kt"); } + @Test + @TestMetadata("SelfReferentialAnnotation.kt") + public void testSelfReferentialAnnotation() throws Exception { + runTest("compiler/testData/loadJava/compiledKotlin/annotations/SelfReferentialAnnotation.kt"); + } + @Test @TestMetadata("SimpleAnnotation.kt") public void testSimpleAnnotation() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLoadK2CompiledKotlinGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLoadK2CompiledKotlinGenerated.java index 3837f33eab0..202585e7d97 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLoadK2CompiledKotlinGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLoadK2CompiledKotlinGenerated.java @@ -78,6 +78,12 @@ public class FirLoadK2CompiledKotlinGenerated extends AbstractFirLoadK2CompiledK runTest("compiler/testData/loadJava/compiledKotlin/annotations/PrimitiveArrayArguments.kt"); } + @Test + @TestMetadata("SelfReferentialAnnotation.kt") + public void testSelfReferentialAnnotation() throws Exception { + runTest("compiler/testData/loadJava/compiledKotlin/annotations/SelfReferentialAnnotation.kt"); + } + @Test @TestMetadata("SimpleAnnotation.kt") public void testSimpleAnnotation() throws Exception { diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt index 927dd54efc2..4a1067ee7b5 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt @@ -661,7 +661,7 @@ class Fir2IrDeclarationStorage( signatureComposer.composeSignature(constructor, forceTopLevelPrivate = forceTopLevelPrivate) } val visibility = if (irParent.isAnonymousObject) Visibilities.Public else constructor.visibility - val created = constructor.convertWithOffsets { startOffset, endOffset -> + return constructor.convertWithOffsets { startOffset, endOffset -> declareIrConstructor(signature) { symbol -> classifierStorage.preCacheTypeParameters(constructor, symbol) irFactory.createConstructor( @@ -671,14 +671,15 @@ class Fir2IrDeclarationStorage( isInline = false, isExternal = false, isPrimary = isPrimary, isExpect = constructor.isExpect ).apply { metadata = FirMetadataSource.Function(constructor) + // Add to cache before generating parameters to prevent an infinite loop when an annotation value parameter is annotated + // with the annotation itself. + constructorCache[constructor] = this enterScope(this) bindAndDeclareParameters(constructor, irParent, isStatic = false, forSetter = false) leaveScope(this) } } } - constructorCache[constructor] = created - return created } fun getOrCreateIrConstructor( 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 0af3d4ae101..056da5b261a 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 @@ -645,52 +645,46 @@ class CallAndReferenceGenerator( val type = coneType?.toIrType() val symbol = type?.classifierOrNull val irConstructorCall = annotation.convertWithOffsets { startOffset, endOffset -> - when (symbol) { - is IrClassSymbol -> { - val irClass = symbol.owner - val irConstructor = (annotation.toResolvedCallableSymbol() as? FirConstructorSymbol)?.let { - this.declarationStorage.getIrConstructorSymbol(it) - } ?: run { - // Fallback for FirReferencePlaceholderForResolvedAnnotations from jar - val fir = coneType.lookupTag.toSymbol(session)?.fir as? FirClass - var constructorSymbol: FirConstructorSymbol? = null - fir?.unsubstitutedScope( - session, - scopeSession, - withForcedTypeCalculator = true, - memberRequiredPhase = null, - )?.processDeclaredConstructors { - if (it.fir.isPrimary && constructorSymbol == null) { - constructorSymbol = it - } - } - - constructorSymbol?.let { - this.declarationStorage.getIrConstructorSymbol(it) - } - } - if (irConstructor == null) { - IrErrorCallExpressionImpl(startOffset, endOffset, type, "No annotation constructor found: ${irClass.name}") - } else { - IrConstructorCallImpl( - startOffset, endOffset, type, irConstructor, - valueArgumentsCount = irConstructor.owner.valueParameters.size, - typeArgumentsCount = annotation.typeArguments.size, - constructorTypeArgumentsCount = 0 - ) - } - - } - - else -> { - IrErrorCallExpressionImpl( - startOffset, - endOffset, - type ?: createErrorType(), - "Unresolved reference: ${annotation.render()}" - ) - } + if (symbol !is IrClassSymbol) { + return@convertWithOffsets IrErrorCallExpressionImpl( + startOffset, endOffset, type ?: createErrorType(), "Unresolved reference: ${annotation.render()}" + ) } + + val irClass = symbol.owner + val firConstructorSymbol = annotation.toResolvedCallableSymbol() as? FirConstructorSymbol + ?: run { + // Fallback for FirReferencePlaceholderForResolvedAnnotations from jar + val fir = coneType.lookupTag.toSymbol(session)?.fir as? FirClass + var constructorSymbol: FirConstructorSymbol? = null + fir?.unsubstitutedScope( + session, + scopeSession, + withForcedTypeCalculator = true, + memberRequiredPhase = null, + )?.processDeclaredConstructors { + if (it.fir.isPrimary && constructorSymbol == null) { + constructorSymbol = it + } + } + constructorSymbol + } ?: return@convertWithOffsets IrErrorCallExpressionImpl( + startOffset, endOffset, type, "No annotation constructor found: ${irClass.name}" + ) + + val irConstructor = declarationStorage.getIrConstructorSymbol(firConstructorSymbol) + + IrConstructorCallImpl( + startOffset, endOffset, type, irConstructor, + // Get the number of value arguments from FIR because of a possible cycle where an annotation constructor + // parameter is annotated with the same annotation. + // In this case, the IR value parameters won't be initialized yet, and we will get 0 from + // `irConstructor.owner.valueParameters.size`. + // See KT-58294 + valueArgumentsCount = firConstructorSymbol.valueParameterSymbols.size, + typeArgumentsCount = annotation.typeArguments.size, + constructorTypeArgumentsCount = 0 + ) } return visitor.withAnnotationMode { val annotationCall = annotation.toAnnotationCall() 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 74055e55048..ad96f1a46eb 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 @@ -377,6 +377,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr runTest("compiler/testData/codegen/box/annotations/retentionInJava.kt"); } + @Test + @TestMetadata("selfReferentialAnnotation.kt") + public void testSelfReferentialAnnotation() throws Exception { + runTest("compiler/testData/codegen/box/annotations/selfReferentialAnnotation.kt"); + } + @Test @TestMetadata("singleAssignmentToVarargInAnnotation.kt") public void testSingleAssignmentToVarargInAnnotation() 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 afb12cc5055..2384a6c8062 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 @@ -377,6 +377,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo runTest("compiler/testData/codegen/box/annotations/retentionInJava.kt"); } + @Test + @TestMetadata("selfReferentialAnnotation.kt") + public void testSelfReferentialAnnotation() throws Exception { + runTest("compiler/testData/codegen/box/annotations/selfReferentialAnnotation.kt"); + } + @Test @TestMetadata("singleAssignmentToVarargInAnnotation.kt") public void testSingleAssignmentToVarargInAnnotation() throws Exception { diff --git a/compiler/testData/codegen/box/annotations/selfReferentialAnnotation.fir.ir.txt b/compiler/testData/codegen/box/annotations/selfReferentialAnnotation.fir.ir.txt new file mode 100644 index 00000000000..87b6de5437a --- /dev/null +++ b/compiler/testData/codegen/box/annotations/selfReferentialAnnotation.fir.ir.txt @@ -0,0 +1,159 @@ +FILE fqName: fileName:/selfReferentialAnnotation.kt + CLASS ANNOTATION_CLASS name:Ann modality:OPEN visibility:public superTypes:[kotlin.Annotation] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Ann + CONSTRUCTOR visibility:public <> (e:kotlin.Int) returnType:.Ann [primary] + VALUE_PARAMETER name:e index:0 type:kotlin.Int + annotations: + Ann(e = '1') + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ANNOTATION_CLASS name:Ann modality:OPEN visibility:public superTypes:[kotlin.Annotation]' + PROPERTY name:e visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:e type:kotlin.Int visibility:private [final] + EXPRESSION_BODY + GET_VAR 'e: kotlin.Int declared in .Ann.' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Ann) returnType:kotlin.Int + correspondingProperty: PROPERTY name:e visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Ann + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.Int declared in .Ann' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:e type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null + receiver: GET_VAR ': .Ann declared in .Ann.' type=.Ann origin=null + 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 [fake_override,operator] declared in kotlin.Annotation + $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 [fake_override] declared in kotlin.Annotation + $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 [fake_override] declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS ANNOTATION_CLASS name:MyRequiresOptIn modality:OPEN visibility:public superTypes:[kotlin.Annotation] + annotations: + MyRequiresOptIn(a = '', b = GET_ENUM 'ENUM_ENTRY name:ERROR' type=.MyRequiresOptIn.MyLevel) + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.MyRequiresOptIn + CONSTRUCTOR visibility:public <> (a:kotlin.String, b:.MyRequiresOptIn.MyLevel) returnType:.MyRequiresOptIn [primary] + VALUE_PARAMETER name:a index:0 type:kotlin.String + EXPRESSION_BODY + CONST String type=kotlin.String value="" + VALUE_PARAMETER name:b index:1 type:.MyRequiresOptIn.MyLevel + annotations: + MyRequiresOptIn(a = '', b = GET_ENUM 'ENUM_ENTRY name:WARNING' type=.MyRequiresOptIn.MyLevel) + EXPRESSION_BODY + GET_ENUM 'ENUM_ENTRY name:ERROR' type=.MyRequiresOptIn.MyLevel + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ANNOTATION_CLASS name:MyRequiresOptIn modality:OPEN visibility:public superTypes:[kotlin.Annotation]' + PROPERTY name:a visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:a type:kotlin.String visibility:private [final] + EXPRESSION_BODY + GET_VAR 'a: kotlin.String declared in .MyRequiresOptIn.' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.MyRequiresOptIn) returnType:kotlin.String + correspondingProperty: PROPERTY name:a visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.MyRequiresOptIn + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .MyRequiresOptIn' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:a type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .MyRequiresOptIn declared in .MyRequiresOptIn.' type=.MyRequiresOptIn origin=null + PROPERTY name:b visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:b type:.MyRequiresOptIn.MyLevel visibility:private [final] + EXPRESSION_BODY + GET_VAR 'b: .MyRequiresOptIn.MyLevel declared in .MyRequiresOptIn.' type=.MyRequiresOptIn.MyLevel origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.MyRequiresOptIn) returnType:.MyRequiresOptIn.MyLevel + correspondingProperty: PROPERTY name:b visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.MyRequiresOptIn + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): .MyRequiresOptIn.MyLevel declared in .MyRequiresOptIn' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:b type:.MyRequiresOptIn.MyLevel visibility:private [final]' type=.MyRequiresOptIn.MyLevel origin=null + receiver: GET_VAR ': .MyRequiresOptIn declared in .MyRequiresOptIn.' type=.MyRequiresOptIn origin=null + CLASS ENUM_CLASS name:MyLevel modality:FINAL visibility:public superTypes:[kotlin.Enum<.MyRequiresOptIn.MyLevel>] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.MyRequiresOptIn.MyLevel + CONSTRUCTOR visibility:private <> () returnType:.MyRequiresOptIn.MyLevel [primary] + BLOCK_BODY + ENUM_CONSTRUCTOR_CALL 'public constructor (name: kotlin.String, ordinal: kotlin.Int) [primary] declared in kotlin.Enum' + : .MyRequiresOptIn.MyLevel + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:MyLevel modality:FINAL visibility:public superTypes:[kotlin.Enum<.MyRequiresOptIn.MyLevel>]' + ENUM_ENTRY name:WARNING + init: EXPRESSION_BODY + ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .MyRequiresOptIn.MyLevel' + ENUM_ENTRY name:ERROR + init: EXPRESSION_BODY + ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .MyRequiresOptIn.MyLevel' + FUN ENUM_CLASS_SPECIAL_MEMBER name:values visibility:public modality:FINAL <> () returnType:kotlin.Array<.MyRequiresOptIn.MyLevel> + SYNTHETIC_BODY kind=ENUM_VALUES + FUN ENUM_CLASS_SPECIAL_MEMBER name:valueOf visibility:public modality:FINAL <> (value:kotlin.String) returnType:.MyRequiresOptIn.MyLevel + VALUE_PARAMETER name:value index:0 type:kotlin.String + SYNTHETIC_BODY kind=ENUM_VALUEOF + PROPERTY ENUM_CLASS_SPECIAL_MEMBER name:entries visibility:public modality:FINAL [val] + FUN ENUM_CLASS_SPECIAL_MEMBER name: visibility:public modality:FINAL <> () returnType:kotlin.enums.EnumEntries<.MyRequiresOptIn.MyLevel> + correspondingProperty: PROPERTY ENUM_CLASS_SPECIAL_MEMBER name:entries visibility:public modality:FINAL [val] + SYNTHETIC_BODY kind=ENUM_ENTRIES + FUN FAKE_OVERRIDE name:clone visibility:protected modality:FINAL <> ($this:kotlin.Enum) returnType:kotlin.Any [fake_override] + overridden: + protected final fun clone (): kotlin.Any declared in kotlin.Enum + $this: VALUE_PARAMETER name: type:kotlin.Enum + FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum, other:.MyRequiresOptIn.MyLevel) returnType:kotlin.Int [fake_override,operator] + overridden: + public final fun compareTo (other: E of kotlin.Enum): kotlin.Int [operator] declared in kotlin.Enum + $this: VALUE_PARAMETER name: type:kotlin.Enum + VALUE_PARAMETER name:other index:0 type:.MyRequiresOptIn.MyLevel + FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Enum, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public final fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Enum + $this: VALUE_PARAMETER name: type:kotlin.Enum + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:FINAL <> ($this:kotlin.Enum) returnType:kotlin.Int [fake_override] + overridden: + public final fun hashCode (): kotlin.Int declared in kotlin.Enum + $this: VALUE_PARAMETER name: type:kotlin.Enum + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Enum) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Enum + $this: VALUE_PARAMETER name: type:kotlin.Enum + PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + annotations: + IntrinsicConstEvaluation + overridden: + public final name: kotlin.String [val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:kotlin.Enum) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.String declared in kotlin.Enum + $this: VALUE_PARAMETER name: type:kotlin.Enum + PROPERTY FAKE_OVERRIDE name:ordinal visibility:public modality:FINAL [fake_override,val] + overridden: + public final ordinal: kotlin.Int [val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:kotlin.Enum) returnType:kotlin.Int [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:ordinal visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.Int declared in kotlin.Enum + $this: VALUE_PARAMETER name: type:kotlin.Enum + FUN FAKE_OVERRIDE name:getDeclaringClass visibility:public modality:FINAL <> ($this:kotlin.Enum) returnType:@[FlexibleNullability] java.lang.Class<@[FlexibleNullability] .MyRequiresOptIn.MyLevel?>? [fake_override] + overridden: + public final fun getDeclaringClass (): @[FlexibleNullability] java.lang.Class<@[FlexibleNullability] E of kotlin.Enum?>? declared in kotlin.Enum + $this: VALUE_PARAMETER name: type:kotlin.Enum + FUN FAKE_OVERRIDE name:finalize visibility:protected/*protected and package*/ modality:FINAL <> ($this:kotlin.Enum) returnType:kotlin.Unit [fake_override] + overridden: + protected/*protected and package*/ final fun finalize (): kotlin.Unit declared in kotlin.Enum + $this: VALUE_PARAMETER name: type:kotlin.Enum + 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 [fake_override,operator] declared in kotlin.Annotation + $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 [fake_override] declared in kotlin.Annotation + $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 [fake_override] declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String + BLOCK_BODY + 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/selfReferentialAnnotation.fir.txt b/compiler/testData/codegen/box/annotations/selfReferentialAnnotation.fir.txt new file mode 100644 index 00000000000..42217e20fbf --- /dev/null +++ b/compiler/testData/codegen/box/annotations/selfReferentialAnnotation.fir.txt @@ -0,0 +1,43 @@ +FILE: selfReferentialAnnotation.kt + public final annotation class Ann : R|kotlin/Annotation| { + public constructor(@R|Ann|(e = Int(1)) e: R|kotlin/Int|): R|Ann| { + super() + } + + public final val e: R|kotlin/Int| = R|/e| + public get(): R|kotlin/Int| + + } + @R|MyRequiresOptIn|(a = String(), b = Q|MyRequiresOptIn.MyLevel|.R|/MyRequiresOptIn.MyLevel.ERROR|) public final annotation class MyRequiresOptIn : R|kotlin/Annotation| { + public constructor(a: R|kotlin/String| = String(), @R|MyRequiresOptIn|(a = String(), b = Q|MyRequiresOptIn.MyLevel|.R|/MyRequiresOptIn.MyLevel.WARNING|) b: R|MyRequiresOptIn.MyLevel| = Q|MyRequiresOptIn.MyLevel|.R|/MyRequiresOptIn.MyLevel.ERROR|): R|MyRequiresOptIn| { + super() + } + + public final val a: R|kotlin/String| = R|/a| + public get(): R|kotlin/String| + + public final val b: R|MyRequiresOptIn.MyLevel| = R|/b| + public get(): R|MyRequiresOptIn.MyLevel| + + public final enum class MyLevel : R|kotlin/Enum| { + private constructor(): R|MyRequiresOptIn.MyLevel| { + super|>() + } + + public final static enum entry WARNING: R|MyRequiresOptIn.MyLevel| + public final static enum entry ERROR: R|MyRequiresOptIn.MyLevel| + public final static fun values(): R|kotlin/Array| { + } + + public final static fun valueOf(value: R|kotlin/String|): R|MyRequiresOptIn.MyLevel| { + } + + public final static val entries: R|kotlin/enums/EnumEntries| + public get(): R|kotlin/enums/EnumEntries| + + } + + } + public final fun box(): R|kotlin/String| { + ^box String(OK) + } diff --git a/compiler/testData/codegen/box/annotations/selfReferentialAnnotation.ir.txt b/compiler/testData/codegen/box/annotations/selfReferentialAnnotation.ir.txt new file mode 100644 index 00000000000..879ab251f42 --- /dev/null +++ b/compiler/testData/codegen/box/annotations/selfReferentialAnnotation.ir.txt @@ -0,0 +1,159 @@ +FILE fqName: fileName:/selfReferentialAnnotation.kt + CLASS ANNOTATION_CLASS name:Ann modality:OPEN visibility:public superTypes:[kotlin.Annotation] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Ann + CONSTRUCTOR visibility:public <> (e:kotlin.Int) returnType:.Ann [primary] + VALUE_PARAMETER name:e index:0 type:kotlin.Int + annotations: + Ann(e = '1') + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ANNOTATION_CLASS name:Ann modality:OPEN visibility:public superTypes:[kotlin.Annotation]' + PROPERTY name:e visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:e type:kotlin.Int visibility:private [final] + EXPRESSION_BODY + GET_VAR 'e: kotlin.Int declared in .Ann.' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Ann) returnType:kotlin.Int + correspondingProperty: PROPERTY name:e visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Ann + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.Int declared in .Ann' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:e type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null + receiver: GET_VAR ': .Ann declared in .Ann.' type=.Ann origin=null + 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 [fake_override,operator] declared in kotlin.Annotation + $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 [fake_override] declared in kotlin.Annotation + $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 [fake_override] declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS ANNOTATION_CLASS name:MyRequiresOptIn modality:OPEN visibility:public superTypes:[kotlin.Annotation] + annotations: + MyRequiresOptIn(a = '', b = GET_ENUM 'ENUM_ENTRY name:ERROR' type=.MyRequiresOptIn.MyLevel) + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.MyRequiresOptIn + CONSTRUCTOR visibility:public <> (a:kotlin.String, b:.MyRequiresOptIn.MyLevel) returnType:.MyRequiresOptIn [primary] + VALUE_PARAMETER name:a index:0 type:kotlin.String + EXPRESSION_BODY + CONST String type=kotlin.String value="" + VALUE_PARAMETER name:b index:1 type:.MyRequiresOptIn.MyLevel + annotations: + MyRequiresOptIn(a = '', b = GET_ENUM 'ENUM_ENTRY name:WARNING' type=.MyRequiresOptIn.MyLevel) + EXPRESSION_BODY + GET_ENUM 'ENUM_ENTRY name:ERROR' type=.MyRequiresOptIn.MyLevel + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ANNOTATION_CLASS name:MyRequiresOptIn modality:OPEN visibility:public superTypes:[kotlin.Annotation]' + PROPERTY name:a visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:a type:kotlin.String visibility:private [final] + EXPRESSION_BODY + GET_VAR 'a: kotlin.String declared in .MyRequiresOptIn.' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.MyRequiresOptIn) returnType:kotlin.String + correspondingProperty: PROPERTY name:a visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.MyRequiresOptIn + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .MyRequiresOptIn' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:a type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .MyRequiresOptIn declared in .MyRequiresOptIn.' type=.MyRequiresOptIn origin=null + PROPERTY name:b visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:b type:.MyRequiresOptIn.MyLevel visibility:private [final] + EXPRESSION_BODY + GET_VAR 'b: .MyRequiresOptIn.MyLevel declared in .MyRequiresOptIn.' type=.MyRequiresOptIn.MyLevel origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.MyRequiresOptIn) returnType:.MyRequiresOptIn.MyLevel + correspondingProperty: PROPERTY name:b visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.MyRequiresOptIn + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): .MyRequiresOptIn.MyLevel declared in .MyRequiresOptIn' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:b type:.MyRequiresOptIn.MyLevel visibility:private [final]' type=.MyRequiresOptIn.MyLevel origin=null + receiver: GET_VAR ': .MyRequiresOptIn declared in .MyRequiresOptIn.' type=.MyRequiresOptIn origin=null + CLASS ENUM_CLASS name:MyLevel modality:FINAL visibility:public superTypes:[kotlin.Enum<.MyRequiresOptIn.MyLevel>] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.MyRequiresOptIn.MyLevel + CONSTRUCTOR visibility:private <> () returnType:.MyRequiresOptIn.MyLevel [primary] + BLOCK_BODY + ENUM_CONSTRUCTOR_CALL 'public constructor (name: kotlin.String, ordinal: kotlin.Int) [primary] declared in kotlin.Enum' + : .MyRequiresOptIn.MyLevel + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:MyLevel modality:FINAL visibility:public superTypes:[kotlin.Enum<.MyRequiresOptIn.MyLevel>]' + ENUM_ENTRY name:WARNING + init: EXPRESSION_BODY + ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .MyRequiresOptIn.MyLevel' + ENUM_ENTRY name:ERROR + init: EXPRESSION_BODY + ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .MyRequiresOptIn.MyLevel' + PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + annotations: + IntrinsicConstEvaluation + overridden: + public final name: kotlin.String [val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:kotlin.Enum<.MyRequiresOptIn.MyLevel>) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.String declared in kotlin.Enum + $this: VALUE_PARAMETER name: type:kotlin.Enum<.MyRequiresOptIn.MyLevel> + PROPERTY FAKE_OVERRIDE name:ordinal visibility:public modality:FINAL [fake_override,val] + overridden: + public final ordinal: kotlin.Int [val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:kotlin.Enum<.MyRequiresOptIn.MyLevel>) returnType:kotlin.Int [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:ordinal visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.Int declared in kotlin.Enum + $this: VALUE_PARAMETER name: type:kotlin.Enum<.MyRequiresOptIn.MyLevel> + FUN FAKE_OVERRIDE name:clone visibility:protected modality:FINAL <> ($this:kotlin.Enum<.MyRequiresOptIn.MyLevel>) returnType:kotlin.Any [fake_override] + overridden: + protected final fun clone (): kotlin.Any declared in kotlin.Enum + $this: VALUE_PARAMETER name: type:kotlin.Enum<.MyRequiresOptIn.MyLevel> + FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum<.MyRequiresOptIn.MyLevel>, other:.MyRequiresOptIn.MyLevel) returnType:kotlin.Int [fake_override,operator] + overridden: + public final fun compareTo (other: E of kotlin.Enum): kotlin.Int [operator] declared in kotlin.Enum + $this: VALUE_PARAMETER name: type:kotlin.Enum<.MyRequiresOptIn.MyLevel> + VALUE_PARAMETER name:other index:0 type:.MyRequiresOptIn.MyLevel + FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Enum<.MyRequiresOptIn.MyLevel>, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public final fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Enum + $this: VALUE_PARAMETER name: type:kotlin.Enum<.MyRequiresOptIn.MyLevel> + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:finalize visibility:protected/*protected and package*/ modality:FINAL <> ($this:kotlin.Enum<.MyRequiresOptIn.MyLevel>) returnType:kotlin.Unit [fake_override] + overridden: + protected/*protected and package*/ final fun finalize (): kotlin.Unit declared in kotlin.Enum + $this: VALUE_PARAMETER name: type:kotlin.Enum<.MyRequiresOptIn.MyLevel> + FUN FAKE_OVERRIDE name:getDeclaringClass visibility:public modality:FINAL <> ($this:kotlin.Enum<.MyRequiresOptIn.MyLevel>) returnType:@[FlexibleNullability] java.lang.Class<@[FlexibleNullability] .MyRequiresOptIn.MyLevel?>? [fake_override] + overridden: + public final fun getDeclaringClass (): @[FlexibleNullability] java.lang.Class<@[FlexibleNullability] E of kotlin.Enum?>? declared in kotlin.Enum + $this: VALUE_PARAMETER name: type:kotlin.Enum<.MyRequiresOptIn.MyLevel> + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:FINAL <> ($this:kotlin.Enum<.MyRequiresOptIn.MyLevel>) returnType:kotlin.Int [fake_override] + overridden: + public final fun hashCode (): kotlin.Int declared in kotlin.Enum + $this: VALUE_PARAMETER name: type:kotlin.Enum<.MyRequiresOptIn.MyLevel> + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Enum<.MyRequiresOptIn.MyLevel>) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Enum + $this: VALUE_PARAMETER name: type:kotlin.Enum<.MyRequiresOptIn.MyLevel> + FUN ENUM_CLASS_SPECIAL_MEMBER name:values visibility:public modality:FINAL <> () returnType:kotlin.Array<.MyRequiresOptIn.MyLevel> + SYNTHETIC_BODY kind=ENUM_VALUES + FUN ENUM_CLASS_SPECIAL_MEMBER name:valueOf visibility:public modality:FINAL <> (value:kotlin.String) returnType:.MyRequiresOptIn.MyLevel + VALUE_PARAMETER name:value index:0 type:kotlin.String + SYNTHETIC_BODY kind=ENUM_VALUEOF + PROPERTY ENUM_CLASS_SPECIAL_MEMBER name:entries visibility:public modality:FINAL [val] + FUN ENUM_CLASS_SPECIAL_MEMBER name: visibility:public modality:FINAL <> () returnType:kotlin.enums.EnumEntries<.MyRequiresOptIn.MyLevel> + correspondingProperty: PROPERTY ENUM_CLASS_SPECIAL_MEMBER name:entries visibility:public modality:FINAL [val] + SYNTHETIC_BODY kind=ENUM_ENTRIES + 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 [fake_override,operator] declared in kotlin.Annotation + $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 [fake_override] declared in kotlin.Annotation + $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 [fake_override] declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String + BLOCK_BODY + 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/selfReferentialAnnotation.kt b/compiler/testData/codegen/box/annotations/selfReferentialAnnotation.kt new file mode 100644 index 00000000000..4b8adc554f0 --- /dev/null +++ b/compiler/testData/codegen/box/annotations/selfReferentialAnnotation.kt @@ -0,0 +1,17 @@ +// FIR_DUMP +// DUMP_IR + +annotation class Ann(@Ann(1) val e: Int) + +@MyRequiresOptIn("", MyRequiresOptIn.MyLevel.ERROR) +public annotation class MyRequiresOptIn( + val a: String = "", + @MyRequiresOptIn("", MyRequiresOptIn.MyLevel.WARNING) val b: MyLevel = MyLevel.ERROR +) { + public enum class MyLevel { + WARNING, + ERROR, + } +} + +fun box() = "OK" \ No newline at end of file diff --git a/compiler/testData/loadJava/compiledKotlin/annotations/SelfReferentialAnnotation.fir.txt b/compiler/testData/loadJava/compiledKotlin/annotations/SelfReferentialAnnotation.fir.txt new file mode 100644 index 00000000000..d41d7572fcc --- /dev/null +++ b/compiler/testData/loadJava/compiledKotlin/annotations/SelfReferentialAnnotation.fir.txt @@ -0,0 +1,34 @@ +public final annotation class Ann : R|kotlin/Annotation| { + public final val e: R|kotlin/Int| + public get(): R|kotlin/Int| + + public constructor(e: R|kotlin/Int|): R|test/Ann| + +} + +@R|test/MyRequiresOptIn|(a = String(), b = R|test/MyRequiresOptIn.MyLevel.ERROR|) public final annotation class MyRequiresOptIn : R|kotlin/Annotation| { + public final val a: R|kotlin/String| = String() + public get(): R|kotlin/String| + + public final val b: R|test/MyRequiresOptIn.MyLevel| = test/MyRequiresOptIn.MyLevel.ERROR + public get(): R|test/MyRequiresOptIn.MyLevel| + + public constructor(a: R|kotlin/String| = STUB, b: R|test/MyRequiresOptIn.MyLevel| = STUB): R|test/MyRequiresOptIn| + + public final enum class MyLevel : R|kotlin/Enum| { + private constructor(): R|test/MyRequiresOptIn.MyLevel| + + public final static enum entry WARNING: R|test/MyRequiresOptIn.MyLevel| + public final static enum entry ERROR: R|test/MyRequiresOptIn.MyLevel| + public final static fun values(): R|kotlin/Array| { + } + + public final static fun valueOf(value: R|kotlin/String|): R|test/MyRequiresOptIn.MyLevel| { + } + + public final static val entries: R|kotlin/enums/EnumEntries| + public get(): R|kotlin/enums/EnumEntries| + + } + +} diff --git a/compiler/testData/loadJava/compiledKotlin/annotations/SelfReferentialAnnotation.kt b/compiler/testData/loadJava/compiledKotlin/annotations/SelfReferentialAnnotation.kt new file mode 100644 index 00000000000..cc631db2a91 --- /dev/null +++ b/compiler/testData/loadJava/compiledKotlin/annotations/SelfReferentialAnnotation.kt @@ -0,0 +1,17 @@ +// NO_CHECK_SOURCE_VS_BINARY +// MUTE_REASON: KT-58935 + +package test + +annotation class Ann(@Ann(1) val e: Int) + +@MyRequiresOptIn("", MyRequiresOptIn.MyLevel.ERROR) +public annotation class MyRequiresOptIn( + val a: String = "", + @MyRequiresOptIn("", MyRequiresOptIn.MyLevel.WARNING) val b: MyLevel = MyLevel.ERROR +) { + public enum class MyLevel { + WARNING, + ERROR, + } +} \ No newline at end of file diff --git a/compiler/testData/loadJava/compiledKotlin/annotations/SelfReferentialAnnotation.txt b/compiler/testData/loadJava/compiledKotlin/annotations/SelfReferentialAnnotation.txt new file mode 100644 index 00000000000..7840f8e9253 --- /dev/null +++ b/compiler/testData/loadJava/compiledKotlin/annotations/SelfReferentialAnnotation.txt @@ -0,0 +1,37 @@ +package test + +public final annotation class Ann : kotlin.Annotation { + /*primary*/ public constructor Ann(/*0*/ e: kotlin.Int) + public final val e: kotlin.Int + public final fun ``(): kotlin.Int +} + +@test.MyRequiresOptIn(a = "", b = MyLevel.ERROR) public final annotation class MyRequiresOptIn : kotlin.Annotation { + /*primary*/ public constructor MyRequiresOptIn(/*0*/ a: kotlin.String = ..., /*1*/ b: test.MyRequiresOptIn.MyLevel = ...) + public final val a: kotlin.String = "" + public final fun ``(): kotlin.String + public final val b: test.MyRequiresOptIn.MyLevel = MyLevel.ERROR + public final fun ``(): test.MyRequiresOptIn.MyLevel + + public final enum class MyLevel : kotlin.Enum { + enum entry WARNING + + enum entry ERROR + + /*primary*/ private constructor MyLevel() + @kotlin.internal.IntrinsicConstEvaluation public final override /*1*/ /*fake_override*/ val name: kotlin.String + public final override /*1*/ /*fake_override*/ fun ``(): kotlin.String + public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int + public final override /*1*/ /*fake_override*/ fun ``(): kotlin.Int + protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any + public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: test.MyRequiresOptIn.MyLevel): kotlin.Int + protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit + public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class! + + // Static members + public final /*synthesized*/ val entries: kotlin.enums.EnumEntries + public final /*synthesized*/ fun ``(): kotlin.enums.EnumEntries + public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): test.MyRequiresOptIn.MyLevel + public final /*synthesized*/ fun values(): kotlin.Array + } +} 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 b1e4e7df33e..e11c242438c 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 @@ -329,6 +329,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/annotations/retentionInJava.kt"); } + @Test + @TestMetadata("selfReferentialAnnotation.kt") + public void testSelfReferentialAnnotation() throws Exception { + runTest("compiler/testData/codegen/box/annotations/selfReferentialAnnotation.kt"); + } + @Test @TestMetadata("singleAssignmentToVarargInAnnotation.kt") public void testSingleAssignmentToVarargInAnnotation() 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 8190e4726bc..243e3f4c1cd 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 @@ -377,6 +377,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/annotations/retentionInJava.kt"); } + @Test + @TestMetadata("selfReferentialAnnotation.kt") + public void testSelfReferentialAnnotation() throws Exception { + runTest("compiler/testData/codegen/box/annotations/selfReferentialAnnotation.kt"); + } + @Test @TestMetadata("singleAssignmentToVarargInAnnotation.kt") public void testSingleAssignmentToVarargInAnnotation() 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 d251e0f770b..c72c5f9f2a7 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 @@ -377,6 +377,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack runTest("compiler/testData/codegen/box/annotations/retentionInJava.kt"); } + @Test + @TestMetadata("selfReferentialAnnotation.kt") + public void testSelfReferentialAnnotation() throws Exception { + runTest("compiler/testData/codegen/box/annotations/selfReferentialAnnotation.kt"); + } + @Test @TestMetadata("singleAssignmentToVarargInAnnotation.kt") public void testSingleAssignmentToVarargInAnnotation() 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 7e73314e85b..fd9f66185b3 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -288,6 +288,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/annotations/retentionInJava.kt"); } + @TestMetadata("selfReferentialAnnotation.kt") + public void testSelfReferentialAnnotation() throws Exception { + runTest("compiler/testData/codegen/box/annotations/selfReferentialAnnotation.kt"); + } + @TestMetadata("singleAssignmentToVarargInAnnotation.kt") public void testSingleAssignmentToVarargInAnnotation() throws Exception { runTest("compiler/testData/codegen/box/annotations/singleAssignmentToVarargInAnnotation.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/LoadJavaTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/LoadJavaTestGenerated.java index 30fd7515377..1bdaac8da5d 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/LoadJavaTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/LoadJavaTestGenerated.java @@ -1764,6 +1764,11 @@ public class LoadJavaTestGenerated extends AbstractLoadJavaTest { runTest("compiler/testData/loadJava/compiledKotlin/annotations/PrimitiveArrayArguments.kt"); } + @TestMetadata("SelfReferentialAnnotation.kt") + public void testSelfReferentialAnnotation() throws Exception { + runTest("compiler/testData/loadJava/compiledKotlin/annotations/SelfReferentialAnnotation.kt"); + } + @TestMetadata("SimpleAnnotation.kt") public void testSimpleAnnotation() throws Exception { runTest("compiler/testData/loadJava/compiledKotlin/annotations/SimpleAnnotation.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/LoadKotlinWithTypeTableTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/LoadKotlinWithTypeTableTestGenerated.java index 0bf0814a693..be94b496acc 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/LoadKotlinWithTypeTableTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/LoadKotlinWithTypeTableTestGenerated.java @@ -76,6 +76,11 @@ public class LoadKotlinWithTypeTableTestGenerated extends AbstractLoadKotlinWith runTest("compiler/testData/loadJava/compiledKotlin/annotations/PrimitiveArrayArguments.kt"); } + @TestMetadata("SelfReferentialAnnotation.kt") + public void testSelfReferentialAnnotation() throws Exception { + runTest("compiler/testData/loadJava/compiledKotlin/annotations/SelfReferentialAnnotation.kt"); + } + @TestMetadata("SimpleAnnotation.kt") public void testSimpleAnnotation() throws Exception { runTest("compiler/testData/loadJava/compiledKotlin/annotations/SimpleAnnotation.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/ir/IrLoadJavaTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/ir/IrLoadJavaTestGenerated.java index 2eb85ce66d4..b816356a72e 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/ir/IrLoadJavaTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/ir/IrLoadJavaTestGenerated.java @@ -1765,6 +1765,11 @@ public class IrLoadJavaTestGenerated extends AbstractIrLoadJavaTest { runTest("compiler/testData/loadJava/compiledKotlin/annotations/PrimitiveArrayArguments.kt"); } + @TestMetadata("SelfReferentialAnnotation.kt") + public void testSelfReferentialAnnotation() throws Exception { + runTest("compiler/testData/loadJava/compiledKotlin/annotations/SelfReferentialAnnotation.kt"); + } + @TestMetadata("SimpleAnnotation.kt") public void testSimpleAnnotation() throws Exception { runTest("compiler/testData/loadJava/compiledKotlin/annotations/SimpleAnnotation.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/javac/LoadJavaUsingJavacTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/javac/LoadJavaUsingJavacTestGenerated.java index e62b787a0b5..73c671a4795 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/javac/LoadJavaUsingJavacTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/jvm/compiler/javac/LoadJavaUsingJavacTestGenerated.java @@ -1764,6 +1764,11 @@ public class LoadJavaUsingJavacTestGenerated extends AbstractLoadJavaUsingJavacT runTest("compiler/testData/loadJava/compiledKotlin/annotations/PrimitiveArrayArguments.kt"); } + @TestMetadata("SelfReferentialAnnotation.kt") + public void testSelfReferentialAnnotation() throws Exception { + runTest("compiler/testData/loadJava/compiledKotlin/annotations/SelfReferentialAnnotation.kt"); + } + @TestMetadata("SimpleAnnotation.kt") public void testSimpleAnnotation() throws Exception { runTest("compiler/testData/loadJava/compiledKotlin/annotations/SimpleAnnotation.kt"); diff --git a/core/descriptors.runtime/tests/org/jetbrains/kotlin/jvm/runtime/JvmRuntimeDescriptorLoaderTestGenerated.java b/core/descriptors.runtime/tests/org/jetbrains/kotlin/jvm/runtime/JvmRuntimeDescriptorLoaderTestGenerated.java index 36ba58bfab1..e9df01c1701 100644 --- a/core/descriptors.runtime/tests/org/jetbrains/kotlin/jvm/runtime/JvmRuntimeDescriptorLoaderTestGenerated.java +++ b/core/descriptors.runtime/tests/org/jetbrains/kotlin/jvm/runtime/JvmRuntimeDescriptorLoaderTestGenerated.java @@ -78,6 +78,11 @@ public class JvmRuntimeDescriptorLoaderTestGenerated extends AbstractJvmRuntimeD runTest("compiler/testData/loadJava/compiledKotlin/annotations/PrimitiveArrayArguments.kt"); } + @TestMetadata("SelfReferentialAnnotation.kt") + public void testSelfReferentialAnnotation() throws Exception { + runTest("compiler/testData/loadJava/compiledKotlin/annotations/SelfReferentialAnnotation.kt"); + } + @TestMetadata("SimpleAnnotation.kt") public void testSimpleAnnotation() throws Exception { runTest("compiler/testData/loadJava/compiledKotlin/annotations/SimpleAnnotation.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java index 152f1f3b38a..2f1186b3316 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java @@ -71,6 +71,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/annotations/resolveWithLowPriorityAnnotation.kt"); } + @Test + @TestMetadata("selfReferentialAnnotation.kt") + public void testSelfReferentialAnnotation() throws Exception { + runTest("compiler/testData/codegen/box/annotations/selfReferentialAnnotation.kt"); + } + @Nested @TestMetadata("compiler/testData/codegen/box/annotations/annotatedLambda") @TestDataPath("$PROJECT_ROOT") 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 e9fdb6e13d9..b59f4a90d8d 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 @@ -71,6 +71,12 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest { runTest("compiler/testData/codegen/box/annotations/resolveWithLowPriorityAnnotation.kt"); } + @Test + @TestMetadata("selfReferentialAnnotation.kt") + public void testSelfReferentialAnnotation() throws Exception { + runTest("compiler/testData/codegen/box/annotations/selfReferentialAnnotation.kt"); + } + @Nested @TestMetadata("compiler/testData/codegen/box/annotations/annotatedLambda") @TestDataPath("$PROJECT_ROOT") 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 f0baf97d346..b202a3bdac7 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 @@ -71,6 +71,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/annotations/resolveWithLowPriorityAnnotation.kt"); } + @Test + @TestMetadata("selfReferentialAnnotation.kt") + public void testSelfReferentialAnnotation() throws Exception { + runTest("compiler/testData/codegen/box/annotations/selfReferentialAnnotation.kt"); + } + @Nested @TestMetadata("compiler/testData/codegen/box/annotations/annotatedLambda") @TestDataPath("$PROJECT_ROOT") 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 5049beb7816..3247f096964 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 @@ -71,6 +71,12 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes runTest("compiler/testData/codegen/box/annotations/resolveWithLowPriorityAnnotation.kt"); } + @Test + @TestMetadata("selfReferentialAnnotation.kt") + public void testSelfReferentialAnnotation() throws Exception { + runTest("compiler/testData/codegen/box/annotations/selfReferentialAnnotation.kt"); + } + @Nested @TestMetadata("compiler/testData/codegen/box/annotations/annotatedLambda") @TestDataPath("$PROJECT_ROOT") 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 95dd63e919b..60d6bb16a08 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 @@ -82,6 +82,12 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe runTest("compiler/testData/codegen/box/annotations/resolveWithLowPriorityAnnotation.kt"); } + @Test + @TestMetadata("selfReferentialAnnotation.kt") + public void testSelfReferentialAnnotation() throws Exception { + runTest("compiler/testData/codegen/box/annotations/selfReferentialAnnotation.kt"); + } + @Nested @TestMetadata("compiler/testData/codegen/box/annotations/annotatedLambda") @TestDataPath("$PROJECT_ROOT") 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 3ed9d86995f..80bfad5cfb8 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 @@ -88,6 +88,12 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB runTest("compiler/testData/codegen/box/annotations/resolveWithLowPriorityAnnotation.kt"); } + @Test + @TestMetadata("selfReferentialAnnotation.kt") + public void testSelfReferentialAnnotation() throws Exception { + runTest("compiler/testData/codegen/box/annotations/selfReferentialAnnotation.kt"); + } + @Nested @TestMetadata("compiler/testData/codegen/box/annotations/annotatedLambda") @TestDataPath("$PROJECT_ROOT") 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 20d2b4c67ea..f5c405b0003 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 @@ -80,6 +80,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest runTest("compiler/testData/codegen/box/annotations/resolveWithLowPriorityAnnotation.kt"); } + @Test + @TestMetadata("selfReferentialAnnotation.kt") + public void testSelfReferentialAnnotation() throws Exception { + runTest("compiler/testData/codegen/box/annotations/selfReferentialAnnotation.kt"); + } + @Nested @TestMetadata("compiler/testData/codegen/box/annotations/annotatedLambda") @TestDataPath("$PROJECT_ROOT") 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 f1f2b43819a..94e3e5af7f8 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 @@ -83,6 +83,12 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT runTest("compiler/testData/codegen/box/annotations/resolveWithLowPriorityAnnotation.kt"); } + @Test + @TestMetadata("selfReferentialAnnotation.kt") + public void testSelfReferentialAnnotation() throws Exception { + runTest("compiler/testData/codegen/box/annotations/selfReferentialAnnotation.kt"); + } + @Nested @TestMetadata("compiler/testData/codegen/box/annotations/annotatedLambda") @TestDataPath("$PROJECT_ROOT") diff --git a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/IrCodegenBoxWasmTestGenerated.java b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/IrCodegenBoxWasmTestGenerated.java index 732938e060b..b26894df5e5 100644 --- a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/IrCodegenBoxWasmTestGenerated.java +++ b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/IrCodegenBoxWasmTestGenerated.java @@ -73,6 +73,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest runTest("compiler/testData/codegen/box/annotations/resolveWithLowPriorityAnnotation.kt"); } + @TestMetadata("selfReferentialAnnotation.kt") + public void testSelfReferentialAnnotation() throws Exception { + runTest("compiler/testData/codegen/box/annotations/selfReferentialAnnotation.kt"); + } + @TestMetadata("compiler/testData/codegen/box/annotations/annotatedLambda") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class)