[FIR] Make annotations arguments lazy in RawFirBuilder

Add more tests with annotations with arguments
This commit is contained in:
Egor Kulikov
2022-12-29 14:58:08 +01:00
committed by teamcity
parent ce262b0fb8
commit c5f13c5e7a
3 changed files with 141 additions and 14 deletions
@@ -8,8 +8,6 @@
AnnotationTarget.TYPE
) annotation class base
@base annotation class derived
@base class correct(@base val x: Int) {
@base constructor(): this(0)
}
@@ -26,3 +24,33 @@
}
@base val z = 0
@base val x: Map<@base Int, List<@base Int>> = mapOf()
@Target(
AnnotationTarget.CLASS,
AnnotationTarget.PROPERTY,
AnnotationTarget.LOCAL_VARIABLE,
AnnotationTarget.VALUE_PARAMETER,
AnnotationTarget.CONSTRUCTOR,
AnnotationTarget.FUNCTION,
AnnotationTarget.TYPE
) @base annotation class derived(val x: Int): base
@derived(1) class correctDerived(@derived(1) val x: Int) {
@base constructor(): this(0)
}
@derived(1) enum class MyDerived {
@derived(1) FIRST,
@derived(1) SECOND
}
@derived(1) fun fooDerived(@derived(1) y: @derived(1) Int): Int {
@derived(1) fun bar(@derived(1) z: @derived(1) Int) = z + 1
@derived(1) val local = bar(y)
return local
}
@derived(1) val zDerived = 0
@derived(1) val xDerived: Map<@derived(1) Int, List<@derived(1) Int>> = mapOf()
@@ -4,12 +4,6 @@ FILE: annotation.kt
super<R|kotlin/Any|>()
}
}
@base() public? final? annotation class derived : R|kotlin/Annotation| {
public? constructor(): R|derived| {
super<R|kotlin/Any|>()
}
}
@base() public? final? class correct : R|kotlin/Any| {
public? constructor(@base() x: Int): R|correct| {
@@ -44,3 +38,49 @@ FILE: annotation.kt
@base() public? final? fun foo(@base() y: @base() Int): Int { LAZY_BLOCK }
@base() public? final? val z: <implicit> = LAZY_EXPRESSION
public? get(): <implicit>
@base() public? final? val x: Map<@base() Int, List<@base() Int>> = LAZY_EXPRESSION
public? get(): Map<@base() Int, List<@base() Int>>
@Target(LAZY_EXPRESSION, LAZY_EXPRESSION, LAZY_EXPRESSION, LAZY_EXPRESSION, LAZY_EXPRESSION, LAZY_EXPRESSION, LAZY_EXPRESSION) @base() public? final? annotation class derived : base, R|kotlin/Annotation| {
public? constructor(x: Int): R|derived| {
LAZY_super<R|kotlin/Any|>
}
public? final? val x: Int = R|<local>/x|
public? get(): Int
}
@derived(LAZY_EXPRESSION) public? final? class correctDerived : R|kotlin/Any| {
public? constructor(@derived(LAZY_EXPRESSION) x: Int): R|correctDerived| {
LAZY_super<R|kotlin/Any|>
}
@derived(LAZY_EXPRESSION) public? final? val x: Int = R|<local>/x|
public? get(): Int
@base() public? constructor(): R|correctDerived| {
LAZY_this<R|correctDerived|>
}
}
@derived(LAZY_EXPRESSION) public? final? enum class MyDerived : R|kotlin/Enum<MyDerived>| {
private constructor(): R|MyDerived| {
super<R|kotlin/Enum<MyDerived>|>()
}
@derived(LAZY_EXPRESSION) public final static enum entry FIRST: R|MyDerived| = LAZY_EXPRESSION
@derived(LAZY_EXPRESSION) public final static enum entry SECOND: R|MyDerived| = LAZY_EXPRESSION
public final static fun values(): R|kotlin/Array<MyDerived>| {
}
public final static fun valueOf(value: R|kotlin/String|): R|MyDerived| {
}
public final static val entries: R|kotlin/enums/EnumEntries<MyDerived>|
public get(): R|kotlin/enums/EnumEntries<MyDerived>|
}
@derived(LAZY_EXPRESSION) public? final? fun fooDerived(@derived(LAZY_EXPRESSION) y: @derived(LAZY_EXPRESSION) Int): Int { LAZY_BLOCK }
@derived(LAZY_EXPRESSION) public? final? val zDerived: <implicit> = LAZY_EXPRESSION
public? get(): <implicit>
@derived(LAZY_EXPRESSION) public? final? val xDerived: Map<@derived(LAZY_EXPRESSION) Int, List<@derived(LAZY_EXPRESSION) Int>> = LAZY_EXPRESSION
public? get(): Map<@derived(LAZY_EXPRESSION) Int, List<@derived(LAZY_EXPRESSION) Int>>
@@ -4,12 +4,6 @@ FILE: annotation.kt
super<R|kotlin/Any|>()
}
}
@base() public? final? annotation class derived : R|kotlin/Annotation| {
public? [ContainingClassKey=derived] constructor(): R|derived| {
super<R|kotlin/Any|>()
}
}
@base() public? final? class correct : R|kotlin/Any| {
public? [ContainingClassKey=correct] constructor([CorrespondingProperty=/correct.x] @base() x: Int): R|correct| {
@@ -63,3 +57,68 @@ FILE: annotation.kt
}
@base() public? final? val z: <implicit> = IntegerLiteral(0)
public? get(): <implicit>
@base() public? final? val x: Map<@base() Int, List<@base() Int>> = mapOf#()
public? get(): Map<@base() Int, List<@base() Int>>
@Target(AnnotationTarget#.CLASS#, AnnotationTarget#.PROPERTY#, AnnotationTarget#.LOCAL_VARIABLE#, AnnotationTarget#.VALUE_PARAMETER#, AnnotationTarget#.CONSTRUCTOR#, AnnotationTarget#.FUNCTION#, AnnotationTarget#.TYPE#) @base() public? final? annotation class derived : base, R|kotlin/Annotation| {
public? [ContainingClassKey=derived] constructor([CorrespondingProperty=/derived.x] x: Int): R|derived| {
super<R|kotlin/Any|>()
}
public? final? [IsFromPrimaryConstructor=true] val x: Int = R|<local>/x|
public? [ContainingClassKey=derived] get(): Int
}
@derived(IntegerLiteral(1)) public? final? class correctDerived : R|kotlin/Any| {
public? [ContainingClassKey=correctDerived] constructor([CorrespondingProperty=/correctDerived.x] @derived(IntegerLiteral(1)) x: Int): R|correctDerived| {
super<R|kotlin/Any|>()
}
@derived(IntegerLiteral(1)) public? final? [IsFromPrimaryConstructor=true] val x: Int = R|<local>/x|
public? [ContainingClassKey=correctDerived] get(): Int
@base() public? [ContainingClassKey=correctDerived] constructor(): R|correctDerived| {
this<R|correctDerived|>(IntegerLiteral(0))
}
}
@derived(IntegerLiteral(1)) public? final? enum class MyDerived : R|kotlin/Enum<MyDerived>| {
private [ContainingClassKey=MyDerived] constructor(): R|MyDerived| {
super<R|kotlin/Enum<MyDerived>|>()
}
@derived(IntegerLiteral(1)) public final static [ContainingClassKey=MyDerived] enum entry FIRST: R|MyDerived| = object : R|MyDerived| {
private [ContainingClassKey=<anonymous>] constructor(): R|<anonymous>| {
super<R|MyDerived|>()
}
}
@derived(IntegerLiteral(1)) public final static [ContainingClassKey=MyDerived] enum entry SECOND: R|MyDerived| = object : R|MyDerived| {
private [ContainingClassKey=<anonymous>] constructor(): R|<anonymous>| {
super<R|MyDerived|>()
}
}
public final static [ContainingClassKey=MyDerived] fun values(): R|kotlin/Array<MyDerived>| {
}
public final static [ContainingClassKey=MyDerived] fun valueOf(value: R|kotlin/String|): R|MyDerived| {
}
public final static [ContainingClassKey=MyDerived] val entries: R|kotlin/enums/EnumEntries<MyDerived>|
public get(): R|kotlin/enums/EnumEntries<MyDerived>|
}
@derived(IntegerLiteral(1)) public? final? fun fooDerived(@derived(IntegerLiteral(1)) y: @derived(IntegerLiteral(1)) Int): Int {
@derived(IntegerLiteral(1)) local final? fun bar(@derived(IntegerLiteral(1)) z: @derived(IntegerLiteral(1)) Int): <implicit> {
^bar z#.plus#(IntegerLiteral(1))
}
@derived(IntegerLiteral(1)) lval local: <implicit> = bar#(y#)
^fooDerived local#
}
@derived(IntegerLiteral(1)) public? final? val zDerived: <implicit> = IntegerLiteral(0)
public? get(): <implicit>
@derived(IntegerLiteral(1)) public? final? val xDerived: Map<@derived(IntegerLiteral(1)) Int, List<@derived(IntegerLiteral(1)) Int>> = mapOf#()
public? get(): Map<@derived(IntegerLiteral(1)) Int, List<@derived(IntegerLiteral(1)) Int>>