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 31b8e95d177..89045a09b50 100644 --- a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotation.kt +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotation.kt @@ -1,4 +1,12 @@ -@Target(AnnotationTarget.ANNOTATION_CLASS) annotation class base +@Target( + AnnotationTarget.CLASS, + AnnotationTarget.PROPERTY, + AnnotationTarget.LOCAL_VARIABLE, + AnnotationTarget.VALUE_PARAMETER, + AnnotationTarget.CONSTRUCTOR, + AnnotationTarget.FUNCTION, + AnnotationTarget.TYPE +) annotation class base @base annotation class derived 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 64bec678f9f..65f4281778e 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 @@ -1,5 +1,5 @@ FILE: annotation.kt - @Target(AnnotationTarget#.ANNOTATION_CLASS#) public? final? annotation class base : R|kotlin/Annotation| { + @Target(AnnotationTarget#.CLASS#, AnnotationTarget#.PROPERTY#, AnnotationTarget#.LOCAL_VARIABLE#, AnnotationTarget#.VALUE_PARAMETER#, AnnotationTarget#.CONSTRUCTOR#, AnnotationTarget#.FUNCTION#, AnnotationTarget#.TYPE#) public? final? annotation class base : R|kotlin/Annotation| { public? constructor(): R|base| { super() } 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 9968ef381f1..363c62df575 100644 --- a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotation.txt +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotation.txt @@ -1,5 +1,5 @@ FILE: annotation.kt - @Target(AnnotationTarget#.ANNOTATION_CLASS#) public? final? annotation class base : R|kotlin/Annotation| { + @Target(AnnotationTarget#.CLASS#, AnnotationTarget#.PROPERTY#, AnnotationTarget#.LOCAL_VARIABLE#, AnnotationTarget#.VALUE_PARAMETER#, AnnotationTarget#.CONSTRUCTOR#, AnnotationTarget#.FUNCTION#, AnnotationTarget#.TYPE#) public? final? annotation class base : R|kotlin/Annotation| { public? constructor(): R|base| { super() } diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/functionTypes.kt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/functionTypes.kt index 60a3246170d..f0da90981f0 100644 --- a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/functionTypes.kt +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/functionTypes.kt @@ -1,4 +1,4 @@ -fun simpleRun(f: (T) -> Unit): Unit = f() +fun simpleRun(f: () -> T): T = f() fun List.simpleMap(f: (T) -> R): R { diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/functionTypes.lazyBodies.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/functionTypes.lazyBodies.txt index e711d763e44..03c9400b12b 100644 --- a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/functionTypes.lazyBodies.txt +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/functionTypes.lazyBodies.txt @@ -1,4 +1,4 @@ FILE: functionTypes.kt - public? final? fun simpleRun(f: ( (T) -> Unit )): Unit { LAZY_BLOCK } + public? final? fun simpleRun(f: ( () -> T )): T { LAZY_BLOCK } public? final? fun List.simpleMap(f: ( (T) -> R )): R { LAZY_BLOCK } public? final? fun simpleWith(t: T, f: ( T.() -> Unit )): Unit { LAZY_BLOCK } diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/functionTypes.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/functionTypes.txt index b52fe95b978..3b91ed064bd 100644 --- a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/functionTypes.txt +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/functionTypes.txt @@ -1,5 +1,5 @@ FILE: functionTypes.kt - public? final? fun simpleRun(f: ( (T) -> Unit )): Unit { + public? final? fun simpleRun(f: ( () -> T )): T { ^simpleRun f#() } public? final? fun List.simpleMap(f: ( (T) -> R )): R { diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/annotated.kt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/annotated.kt index 5d6132423ff..a0f2dfa1ef8 100644 --- a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/annotated.kt +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/annotated.kt @@ -1,4 +1,4 @@ -@Target(AnnotationTarget.EXPRESSION) +@Target(AnnotationTarget.EXPRESSION, AnnotationTarget.LOCAL_VARIABLE) @Retention(AnnotationRetention.SOURCE) annotation class Ann @@ -12,7 +12,7 @@ fun foo(arg: Int): Int { return 42 } -data class Two(x: Int, y: Int) +data class Two(val x: Int, val y: Int) fun bar(two: Two) { val (@Ann x, @Ann y) = two diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/annotated.lazyBodies.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/annotated.lazyBodies.txt index 05ff58f92e8..b3c4fec3283 100644 --- a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/annotated.lazyBodies.txt +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/annotated.lazyBodies.txt @@ -1,5 +1,5 @@ FILE: annotated.kt - @Target(AnnotationTarget#.EXPRESSION#) @Retention(AnnotationRetention#.SOURCE#) public? final? annotation class Ann : R|kotlin/Annotation| { + @Target(AnnotationTarget#.EXPRESSION#, AnnotationTarget#.LOCAL_VARIABLE#) @Retention(AnnotationRetention#.SOURCE#) public? final? annotation class Ann : R|kotlin/Annotation| { public? constructor(): R|Ann| { super() } @@ -11,7 +11,17 @@ FILE: annotated.kt super() } - public final fun copy(): R|Two| + public? final? val x: Int = R|/x| + public? get(): Int + + public? final? val y: Int = R|/y| + public? get(): Int + + public final operator fun component1(): Int + + public final operator fun component2(): Int + + public final fun copy(x: Int = this@R|/Two|.R|/Two.x|, y: Int = this@R|/Two|.R|/Two.y|): R|Two| } public? final? fun bar(two: Two): R|kotlin/Unit| { LAZY_BLOCK } diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/annotated.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/annotated.txt index 2230c16c088..581b07b0e50 100644 --- a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/annotated.txt +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/annotated.txt @@ -1,5 +1,5 @@ FILE: annotated.kt - @Target(AnnotationTarget#.EXPRESSION#) @Retention(AnnotationRetention#.SOURCE#) public? final? annotation class Ann : R|kotlin/Annotation| { + @Target(AnnotationTarget#.EXPRESSION#, AnnotationTarget#.LOCAL_VARIABLE#) @Retention(AnnotationRetention#.SOURCE#) public? final? annotation class Ann : R|kotlin/Annotation| { public? constructor(): R|Ann| { super() } @@ -25,7 +25,17 @@ FILE: annotated.kt super() } - public final fun copy(): R|Two| + public? final? val x: Int = R|/x| + public? get(): Int + + public? final? val y: Int = R|/y| + public? get(): Int + + public final operator fun component1(): Int + + public final operator fun component2(): Int + + public final fun copy(x: Int = this@R|/Two|.R|/Two.x|, y: Int = this@R|/Two|.R|/Two.y|): R|Two| } public? final? fun bar(two: Two): R|kotlin/Unit| { diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/calls.kt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/calls.kt index ed0109b1f66..97f05006344 100644 --- a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/calls.kt +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/calls.kt @@ -1,9 +1,9 @@ // WITH_RUNTIME -infix fun distance(x: Int, y: Int) = x + y +infix fun Int.distance(y: Int) = this + y fun test(): Int = 3 distance 4 -fun testRegular(): Int = distance(3, 4) +fun testRegular(): Int = 3.distance(4) class My(var x: Int) { operator fun invoke() = x diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/calls.lazyBodies.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/calls.lazyBodies.txt index 4c74d63bf1a..5c8391a0ae7 100644 --- a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/calls.lazyBodies.txt +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/calls.lazyBodies.txt @@ -1,5 +1,5 @@ FILE: calls.kt - public? final? infix fun distance(x: Int, y: Int): { LAZY_BLOCK } + public? final? infix fun Int.distance(y: Int): { LAZY_BLOCK } public? final? fun test(): Int { LAZY_BLOCK } public? final? fun testRegular(): Int { LAZY_BLOCK } public? final? class My : R|kotlin/Any| { diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/calls.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/calls.txt index 2005d1eaa72..3f443cd11f1 100644 --- a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/calls.txt +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/calls.txt @@ -1,12 +1,12 @@ FILE: calls.kt - public? final? infix fun distance(x: Int, y: Int): { - ^distance x#.plus#(y#) + public? final? infix fun Int.distance(y: Int): { + ^distance this#.plus#(y#) } public? final? fun test(): Int { ^test IntegerLiteral(3).distance#(IntegerLiteral(4)) } public? final? fun testRegular(): Int { - ^testRegular distance#(IntegerLiteral(3), IntegerLiteral(4)) + ^testRegular IntegerLiteral(3).distance#(IntegerLiteral(4)) } public? final? class My : R|kotlin/Any| { public? constructor(x: Int): R|My| { diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/locals.kt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/locals.kt index e002b071297..9ec084a9a71 100644 --- a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/locals.kt +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/locals.kt @@ -6,7 +6,7 @@ fun withLocals(p: Int): Int { val x = Local(42).diff() fun sum(y: Int, z: Int, f: (Int, Int) -> Int): Int { - return x + f(y + z) + return x + f(y, z) } val code = (object : Any() { diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/locals.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/locals.txt index ad51f3afe51..c3aa9d8e15e 100644 --- a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/locals.txt +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/locals.txt @@ -16,7 +16,7 @@ FILE: locals.kt lval x: = Local#(IntegerLiteral(42)).diff#() local final? fun sum(y: Int, z: Int, f: ( (Int, Int) -> Int )): Int { - ^sum x#.plus#(f#(y#.plus#(z#))) + ^sum x#.plus#(f#(y#, z#)) } lval code: = object : Any {