diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotation.kt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotation.kt index 89045a09b50..9ecbe057897 100644 --- a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotation.kt +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotation.kt @@ -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() diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotation.lazyBodies.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotation.lazyBodies.txt index b4d072d51f5..d2c817f92eb 100644 --- a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotation.lazyBodies.txt +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotation.lazyBodies.txt @@ -4,12 +4,6 @@ FILE: annotation.kt super() } - } - @base() public? final? annotation class derived : R|kotlin/Annotation| { - public? constructor(): R|derived| { - super() - } - } @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: = LAZY_EXPRESSION public? get(): + @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 + } + + public? final? val x: Int = R|/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 + } + + @derived(LAZY_EXPRESSION) public? final? val x: Int = R|/x| + public? get(): Int + + @base() public? constructor(): R|correctDerived| { + LAZY_this + } + + } + @derived(LAZY_EXPRESSION) public? final? enum class MyDerived : R|kotlin/Enum| { + private constructor(): R|MyDerived| { + super|>() + } + + @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| { + } + + public final static fun valueOf(value: R|kotlin/String|): R|MyDerived| { + } + + public final static val entries: R|kotlin/enums/EnumEntries| + public get(): R|kotlin/enums/EnumEntries| + + } + @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: = LAZY_EXPRESSION + public? get(): + @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>> diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotation.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotation.txt index f3fead5b38c..2efc6d36123 100644 --- a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotation.txt +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotation.txt @@ -4,12 +4,6 @@ FILE: annotation.kt super() } - } - @base() public? final? annotation class derived : R|kotlin/Annotation| { - public? [ContainingClassKey=derived] constructor(): R|derived| { - super() - } - } @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: = IntegerLiteral(0) public? get(): + @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() + } + + public? final? [IsFromPrimaryConstructor=true] val x: Int = R|/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() + } + + @derived(IntegerLiteral(1)) public? final? [IsFromPrimaryConstructor=true] val x: Int = R|/x| + public? [ContainingClassKey=correctDerived] get(): Int + + @base() public? [ContainingClassKey=correctDerived] constructor(): R|correctDerived| { + this(IntegerLiteral(0)) + } + + } + @derived(IntegerLiteral(1)) public? final? enum class MyDerived : R|kotlin/Enum| { + private [ContainingClassKey=MyDerived] constructor(): R|MyDerived| { + super|>() + } + + @derived(IntegerLiteral(1)) public final static [ContainingClassKey=MyDerived] enum entry FIRST: R|MyDerived| = object : R|MyDerived| { + private [ContainingClassKey=] constructor(): R|| { + super() + } + + } + + @derived(IntegerLiteral(1)) public final static [ContainingClassKey=MyDerived] enum entry SECOND: R|MyDerived| = object : R|MyDerived| { + private [ContainingClassKey=] constructor(): R|| { + super() + } + + } + + public final static [ContainingClassKey=MyDerived] fun values(): R|kotlin/Array| { + } + + public final static [ContainingClassKey=MyDerived] fun valueOf(value: R|kotlin/String|): R|MyDerived| { + } + + public final static [ContainingClassKey=MyDerived] val entries: R|kotlin/enums/EnumEntries| + public get(): R|kotlin/enums/EnumEntries| + + } + @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): { + ^bar z#.plus#(IntegerLiteral(1)) + } + + @derived(IntegerLiteral(1)) lval local: = bar#(y#) + ^fooDerived local# + } + @derived(IntegerLiteral(1)) public? final? val zDerived: = IntegerLiteral(0) + public? get(): + @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>>