[FIR2IR] Fix infinite loop between annotation and annotation parameter
When an annotation constructor value parameter is annotated with the very same annotation, FIR2IR went in an infinite loop when trying to generate it. To fix this, the constructor is added to the Fir2IrDeclarationStorage cache before generating the value parameters. To accommodate for the missing parameters, the value arguments count is determined using the FIR.
This commit is contained in:
committed by
Space Team
parent
fc75402f65
commit
d1ce55cbd2
+34
@@ -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<test/MyRequiresOptIn.MyLevel>| {
|
||||
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<test/MyRequiresOptIn.MyLevel>| {
|
||||
}
|
||||
|
||||
public final static fun valueOf(value: R|kotlin/String|): R|test/MyRequiresOptIn.MyLevel| {
|
||||
}
|
||||
|
||||
public final static val entries: R|kotlin/enums/EnumEntries<test/MyRequiresOptIn.MyLevel>|
|
||||
public get(): R|kotlin/enums/EnumEntries<test/MyRequiresOptIn.MyLevel>|
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+17
@@ -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,
|
||||
}
|
||||
}
|
||||
+37
@@ -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 `<get-e>`(): 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 `<get-a>`(): kotlin.String
|
||||
public final val b: test.MyRequiresOptIn.MyLevel = MyLevel.ERROR
|
||||
public final fun `<get-b>`(): test.MyRequiresOptIn.MyLevel
|
||||
|
||||
public final enum class MyLevel : kotlin.Enum<test.MyRequiresOptIn.MyLevel> {
|
||||
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 `<get-name>`(): kotlin.String
|
||||
public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun `<get-ordinal>`(): 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<test.MyRequiresOptIn.MyLevel!>!
|
||||
|
||||
// Static members
|
||||
public final /*synthesized*/ val entries: kotlin.enums.EnumEntries<test.MyRequiresOptIn.MyLevel>
|
||||
public final /*synthesized*/ fun `<get-entries>`(): kotlin.enums.EnumEntries<test.MyRequiresOptIn.MyLevel>
|
||||
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): test.MyRequiresOptIn.MyLevel
|
||||
public final /*synthesized*/ fun values(): kotlin.Array<test.MyRequiresOptIn.MyLevel>
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user