FIR IDE: move analysis api fir testdata to the analysis directory

This commit is contained in:
Ilya Kirillov
2021-09-14 17:22:32 +02:00
parent 4d52b354af
commit 42f0536904
705 changed files with 0 additions and 0 deletions
@@ -0,0 +1,9 @@
class Base(
val p1: Int
)
class Sub(
override val p1: Int
) : Base(p1) {
constructor(i : Int, j : Int) : <expr>super(i + j)</expr>
}
@@ -0,0 +1,4 @@
KtDelegatedConstructorCall:
argumentMapping = { i + j -> (p1: kotlin.Int) }
targetFunction = <constructor>(p1: kotlin.Int): Base
kind = SUPER_CALL
@@ -0,0 +1,9 @@
class Base(
val p1: Int
)
class Sub(
p: Int
) : Base(p), Unresolved {
constructor(s: String) : <expr>super(s)</expr>
}
@@ -0,0 +1,4 @@
KtDelegatedConstructorCall:
argumentMapping = { s -> (p1: kotlin.Int) }
targetFunction = ERR<Argument type mismatch: actual type is kotlin/String but kotlin/Int was expected, [<constructor>(p1: kotlin.Int): Base]>
kind = SUPER_CALL
@@ -0,0 +1,9 @@
class Base(
val p1: Int
)
class Sub(
override val p1: Int
) : Base(p1) {
constructor(s: String) : <expr>this(s.length)</expr>
}
@@ -0,0 +1,4 @@
KtDelegatedConstructorCall:
argumentMapping = { s.length -> (p1: kotlin.Int) }
targetFunction = <constructor>(p1: kotlin.Int): Sub
kind = THIS_CALL
@@ -0,0 +1,9 @@
class Base(
val p1: Int
)
class Sub(
p: Int
) : Base(p), Unresolved {
constructor(i : Int, j : Int) : <expr>this(i, j, i * j)</expr>
}
@@ -0,0 +1,4 @@
KtDelegatedConstructorCall:
argumentMapping = { }
targetFunction = ERR<None of the following functions are applicable: [/Sub.Sub, /Sub.Sub], [<constructor>(p: kotlin.Int): Sub, <constructor>(i: kotlin.Int, j: kotlin.Int): Sub]>
kind = THIS_CALL
@@ -0,0 +1,5 @@
fun function(a: Int) {}
fun call() {
<expr>function(1)</expr>
}
@@ -0,0 +1,3 @@
KtFunctionCall:
argumentMapping = { 1 -> (a: kotlin.Int) }
targetFunction = /function(a: kotlin.Int): kotlin.Unit
@@ -0,0 +1,5 @@
fun function(a: Int, b: (String) -> Boolean) {}
fun call() {
<expr>function(1) { s -> true }</expr>
}
@@ -0,0 +1,3 @@
KtFunctionCall:
argumentMapping = { 1 -> (a: kotlin.Int), { s -> true } -> (b: kotlin.Function1<kotlin.String, kotlin.Boolean>) }
targetFunction = /function(a: kotlin.Int, b: kotlin.Function1<kotlin.String, kotlin.Boolean>): kotlin.Unit
@@ -0,0 +1,5 @@
fun function(a: Int, b: String) {}
fun call() {
<expr>function(b = "foo", a = 1)</expr>
}
@@ -0,0 +1,3 @@
KtFunctionCall:
argumentMapping = { "foo" -> (b: kotlin.String), 1 -> (a: kotlin.Int) }
targetFunction = /function(a: kotlin.Int, b: kotlin.String): kotlin.Unit
@@ -0,0 +1,5 @@
fun function(a: Int, b: (String) -> Boolean) {}
fun call() {
<expr>function(1, { s -> true })</expr>
}
@@ -0,0 +1,3 @@
KtFunctionCall:
argumentMapping = { 1 -> (a: kotlin.Int), { s -> true } -> (b: kotlin.Function1<kotlin.String, kotlin.Boolean>) }
targetFunction = /function(a: kotlin.Int, b: kotlin.Function1<kotlin.String, kotlin.Boolean>): kotlin.Unit
@@ -0,0 +1,6 @@
fun function(vararg a: Int) {}
fun call() {
val args = intArrayOf(1, 2, 3)
<expr>function(*args)</expr>
}
@@ -0,0 +1,3 @@
KtFunctionCall:
argumentMapping = { args -> (vararg a: kotlin.Int) }
targetFunction = /function(vararg a: kotlin.Int): kotlin.Unit
@@ -0,0 +1,5 @@
fun function(vararg a: Int) {}
fun call() {
<expr>function(1, 2, 3)</expr>
}
@@ -0,0 +1,3 @@
KtFunctionCall:
argumentMapping = { 1 -> (vararg a: kotlin.Int), 2 -> (vararg a: kotlin.Int), 3 -> (vararg a: kotlin.Int) }
targetFunction = /function(vararg a: kotlin.Int): kotlin.Unit
@@ -0,0 +1,5 @@
fun String.function(a: Int) {}
fun call() {
"str".<expr>function(1)</expr>
}
@@ -0,0 +1,3 @@
KtFunctionCall:
argumentMapping = { 1 -> (a: kotlin.Int) }
targetFunction = /function(<receiver>: kotlin.String, a: kotlin.Int): kotlin.Unit
@@ -0,0 +1,5 @@
fun String.function(a: Int) {}
fun call() {
"str"?.<expr>function(1)</expr>
}
@@ -0,0 +1,3 @@
KtFunctionCall:
argumentMapping = { 1 -> (a: kotlin.Int) }
targetFunction = /function(<receiver>: kotlin.String, a: kotlin.Int): kotlin.Unit
@@ -0,0 +1,7 @@
class A {
constructor(i: Int)
}
fun call() {
val a = <expr>A(42)</expr>
}
@@ -0,0 +1,3 @@
KtFunctionCall:
argumentMapping = { 42 -> (i: kotlin.Int) }
targetFunction = <constructor>(i: kotlin.Int): A
@@ -0,0 +1,5 @@
class A
fun call() {
val a = <expr>A()</expr>
}
@@ -0,0 +1,3 @@
KtFunctionCall:
argumentMapping = { }
targetFunction = <constructor>(): A
@@ -0,0 +1,7 @@
// FILE: call.kt
fun call() {
val a = <expr>A()</expr>
}
// FILE: A.java
class A {}
@@ -0,0 +1,3 @@
KtFunctionCall:
argumentMapping = { }
targetFunction = <constructor>(): A
@@ -0,0 +1,7 @@
class C {
operator fun get(a: Int, b: String): Boolean = true
}
fun call(c: C) {
val res = <expr>c[1, "foo"]</expr>
}
@@ -0,0 +1,3 @@
KtFunctionCall:
argumentMapping = { 1 -> (a: kotlin.Int), "foo" -> (b: kotlin.String) }
targetFunction = /C.get(a: kotlin.Int, b: kotlin.String): kotlin.Boolean
@@ -0,0 +1,7 @@
class C {
operator fun get(a: Int, b: String): Boolean = true
}
fun call(c: C) {
val res = <expr>c[1]</expr>
}
@@ -0,0 +1,3 @@
KtFunctionCall:
argumentMapping = { 1 -> (a: kotlin.Int) }
targetFunction = ERR<No value passed for parameter 'b', [/C.get(a: kotlin.Int, b: kotlin.String): kotlin.Boolean]>
@@ -0,0 +1,7 @@
class C {
operator fun get(a: Int, b: String): Boolean = true
}
fun call(c: C) {
val res = <expr>c[1, "foo", false]</expr>
}
@@ -0,0 +1,3 @@
KtFunctionCall:
argumentMapping = { 1 -> (a: kotlin.Int), "foo" -> (b: kotlin.String) }
targetFunction = ERR<Too many arguments for public final operator fun /C.get(a: R|kotlin/Int|, b: R|kotlin/String|): R|kotlin/Boolean|, [/C.get(a: kotlin.Int, b: kotlin.String): kotlin.Boolean]>
@@ -0,0 +1,7 @@
class C {
operator fun set(a: Int, b: String, value: Boolean) {}
}
fun call(c: C) {
<expr>c[1, "foo"]</expr> = false
}
@@ -0,0 +1,3 @@
KtFunctionCall:
argumentMapping = { 1 -> (a: kotlin.Int), "foo" -> (b: kotlin.String), false -> (value: kotlin.Boolean) }
targetFunction = /C.set(a: kotlin.Int, b: kotlin.String, value: kotlin.Boolean): kotlin.Unit
@@ -0,0 +1,7 @@
class C {
operator fun set(a: Int, b: String, value: Boolean) {}
}
fun call(c: C) {
<expr>c[1]</expr> = false
}
@@ -0,0 +1,3 @@
KtFunctionCall:
argumentMapping = { 1 -> (a: kotlin.Int), false -> (value: kotlin.Boolean) }
targetFunction = ERR<No value passed for parameter 'b', [/C.set(a: kotlin.Int, b: kotlin.String, value: kotlin.Boolean): kotlin.Unit]>
@@ -0,0 +1,7 @@
class C {
operator fun set(a: Int, b: String, value: Boolean) {}
}
fun call(c: C) {
<expr>c[1, "foo", 3.14]</expr> = false
}
@@ -0,0 +1,3 @@
KtFunctionCall:
argumentMapping = { 1 -> (a: kotlin.Int), "foo" -> (b: kotlin.String), false -> (value: kotlin.Boolean) }
targetFunction = ERR<Too many arguments for public final operator fun /C.set(a: R|kotlin/Int|, b: R|kotlin/String|, value: R|kotlin/Boolean|): R|kotlin/Unit|, [/C.set(a: kotlin.Int, b: kotlin.String, value: kotlin.Boolean): kotlin.Unit]>
@@ -0,0 +1,10 @@
// FILE: call.kt
fun call() {
val javaClass = JavaClass()
javaClass.<expr>javaMethod()</expr>
}
// FILE: JavaClass.java
class JavaClass {
void javaMethod() {}
}
@@ -0,0 +1,3 @@
KtFunctionCall:
argumentMapping = { }
targetFunction = /JavaClass.javaMethod(): kotlin.Unit
@@ -0,0 +1,10 @@
// FILE: call.kt
fun call() {
val javaClass = JavaClass()
javaClass.<expr>foo</expr>
}
// FILE: JavaClass.java
class JavaClass {
int getFoo() { return 42; }
}
@@ -0,0 +1,3 @@
KtFunctionCall:
argumentMapping = { }
targetFunction = /JavaClass.getFoo(): kotlin.Int
@@ -0,0 +1,18 @@
// FILE: call.kt
fun call() {
val javaClass = JavaClass()
javaClass.<expr>sub</expr>.foo = 42
}
// FILE: JavaClass.java
class JavaClass {
private JavaSubClass instance = new JavaSubClass();
JavaSubClass getSub() { return instance; }
}
// FILE: JavaSubClass.java
class JavaSubClass {
private int foo = -1;
int getFoo() { return foo; }
void setFoo(int v) { foo = v; }
}
@@ -0,0 +1,3 @@
KtFunctionCall:
argumentMapping = { }
targetFunction = /JavaClass.getSub(): ft<JavaSubClass, JavaSubClass?>
@@ -0,0 +1,12 @@
// FILE: call.kt
fun call() {
val javaClass = JavaClass()
javaClass.<expr>foo</expr> = 42
}
// FILE: JavaClass.java
class JavaClass {
private int foo = -1;
int getFoo() { return foo; }
void setFoo(int v) { foo = v; }
}
@@ -0,0 +1,3 @@
KtFunctionCall:
argumentMapping = { 42 -> (v: kotlin.Int) }
targetFunction = /JavaClass.setFoo(v: kotlin.Int): kotlin.Unit
@@ -0,0 +1,13 @@
// FILE: call.kt
fun call() {
val javaClass = JavaClass()
// Intentionally incomplete to see if `foo` refers to `setFoo`.
javaClass.<expr>foo</expr> =
}
// FILE: JavaClass.java
class JavaClass {
private int foo = -1;
int getFoo() { return foo; }
void setFoo(int v) { foo = v; }
}
@@ -0,0 +1,3 @@
KtFunctionCall:
argumentMapping = { }
targetFunction = ERR<Setter value is missing, [/JavaClass.setFoo(v: kotlin.Int): kotlin.Unit]>
@@ -0,0 +1,9 @@
fun call {
val ktClass = KtClass()
ktClass.<expr>foo</expr>
}
class KtClass {
val foo: Int
get() = 42
}
@@ -0,0 +1,3 @@
KtFunctionCall:
argumentMapping = { }
targetFunction = <getter>(): kotlin.Int
@@ -0,0 +1,13 @@
fun call() {
val ktClass = KtClass()
ktClass.<expr>instance</expr>.foo = 42
}
class KtClass {
val instance : KtSubClass = KtSubClass()
}
class KtSubClass {
var foo : Int = -1
}
@@ -0,0 +1,3 @@
KtFunctionCall:
argumentMapping = { }
targetFunction = <getter>(): KtSubClass
@@ -0,0 +1,8 @@
fun call {
val ktClass = KtClass()
ktClass.<expr>foo</expr> = 42
}
class KtClass {
var foo : Int = -1
}
@@ -0,0 +1,3 @@
KtFunctionCall:
argumentMapping = { 42 -> (value: kotlin.Int) }
targetFunction = <setter>(value: kotlin.Int): kotlin.Unit
@@ -0,0 +1,5 @@
infix fun <A, B> A.to(other: B) = this
open class A<T>(x: T)
class B : A(<expr>1 to 2</expr>)
@@ -0,0 +1,3 @@
KtFunctionCall:
argumentMapping = { 2 -> (other: B) }
targetFunction = /to(<receiver>: A, other: B): A
@@ -0,0 +1,5 @@
fun x() {
<expr>foo(1)</expr>
}
fun foo(){}
@@ -0,0 +1,3 @@
KtFunctionCall:
argumentMapping = { }
targetFunction = ERR<Too many arguments for public final fun /foo(): R|kotlin/Unit|, [/foo(): kotlin.Unit]>
@@ -0,0 +1,5 @@
interface I
class A(
p : Int
) : I, <expr>Unresolved(p)</expr>
@@ -0,0 +1,4 @@
KtDelegatedConstructorCall:
argumentMapping = { }
targetFunction = ERR<Unresolved reference: Unresolved, []>
kind = SUPER_CALL
@@ -0,0 +1,3 @@
fun call(x: (Int) -> String) {
<expr>x(1)</expr>
}
@@ -0,0 +1,4 @@
KtFunctionalTypeVariableCall:
target = x: kotlin.Function1<kotlin.Int, kotlin.String>
argumentMapping = { 1 -> (p1: kotlin.Int) }
targetFunction = kotlin/Function1.invoke(p1: kotlin.Int): kotlin.String
@@ -0,0 +1,5 @@
operator fun Int.invoke(): String {}
fun call(x: kotlin.int) {
<expr>x()</expr>
}
@@ -0,0 +1,3 @@
KtFunctionCall:
argumentMapping = { }
targetFunction = /invoke(<receiver>: kotlin.Int): kotlin.String