[FIR-TEST] Move analysis tests to separate module
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
// FILE: MyFunction.java
|
||||
public interface MyFunction<T, R> {
|
||||
R foo(T x);
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
fun main() {
|
||||
MyFunction<Int, String>{ x ->
|
||||
x.toInt().toString()
|
||||
}
|
||||
|
||||
MyFunction { x: Int ->
|
||||
x.toString()
|
||||
}
|
||||
|
||||
MyFunction { x ->
|
||||
""
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
FILE: main.kt
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
R|/MyFunction|<R|kotlin/Int|, R|kotlin/String|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Int|): R|kotlin/String| {
|
||||
^ R|<local>/x|.R|kotlin/Int.toInt|().R|kotlin/Any.toString|()
|
||||
}
|
||||
)
|
||||
R|/MyFunction|<R|ft<kotlin/Int, kotlin/Int?>!|, R|ft<kotlin/String, kotlin/String?>!|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Int|): R|kotlin/String| {
|
||||
^ R|<local>/x|.R|kotlin/Any.toString|()
|
||||
}
|
||||
)
|
||||
R|/MyFunction|<R|kotlin/Any?|, R|ft<kotlin/String, kotlin/String?>!|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Any?|): R|kotlin/String| {
|
||||
^ String()
|
||||
}
|
||||
)
|
||||
}
|
||||
Vendored
+38
@@ -0,0 +1,38 @@
|
||||
// FILE: MyFunction.java
|
||||
public interface MyFunction<T, R> {
|
||||
R foo(T x);
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
fun foo1(x: MyFunction<Int, String>) {}
|
||||
fun foo2(x: MyFunction<in Number, out CharSequence>) {}
|
||||
fun <X, Y> foo3(f: MyFunction<X, Y>, x: X) {}
|
||||
|
||||
fun main() {
|
||||
foo1(MyFunction { x ->
|
||||
x.toInt().toString()
|
||||
})
|
||||
|
||||
foo2(MyFunction { x ->
|
||||
x.toInt().toString()
|
||||
})
|
||||
|
||||
<!INAPPLICABLE_CANDIDATE!>foo2<!>(MyFunction { x: Int ->
|
||||
x.toString()
|
||||
})
|
||||
|
||||
foo3(
|
||||
MyFunction { x ->
|
||||
(x + 1).toString()
|
||||
},
|
||||
1
|
||||
)
|
||||
|
||||
foo3(
|
||||
MyFunction { x: Number ->
|
||||
x.toInt().toString()
|
||||
},
|
||||
2
|
||||
)
|
||||
}
|
||||
Vendored
+29
@@ -0,0 +1,29 @@
|
||||
FILE: main.kt
|
||||
public final fun foo1(x: R|MyFunction<kotlin/Int, kotlin/String>|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun foo2(x: R|MyFunction<in kotlin/Number, out kotlin/CharSequence>|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun <X, Y> foo3(f: R|MyFunction<X, Y>|, x: R|X|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
R|/foo1|(R|/MyFunction|<R|kotlin/Int|, R|kotlin/String|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Int|): R|kotlin/String| {
|
||||
^ R|<local>/x|.R|kotlin/Int.toInt|().R|kotlin/Any.toString|()
|
||||
}
|
||||
))
|
||||
R|/foo2|(R|/MyFunction|<R|kotlin/Number|, R|ft<kotlin/String, kotlin/String?>!|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Number|): R|kotlin/String| {
|
||||
^ R|<local>/x|.R|kotlin/Number.toInt|().R|kotlin/Any.toString|()
|
||||
}
|
||||
))
|
||||
<Inapplicable(INAPPLICABLE): [/foo2]>#(R|/MyFunction|<R|ft<kotlin/Int, kotlin/Int?>!|, R|ft<kotlin/String, kotlin/String?>!|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Int|): R|kotlin/String| {
|
||||
^ R|<local>/x|.R|kotlin/Any.toString|()
|
||||
}
|
||||
))
|
||||
R|/foo3|<R|kotlin/Int|, R|ft<kotlin/String, kotlin/String?>!|>(R|/MyFunction|<R|kotlin/Int|, R|ft<kotlin/String, kotlin/String?>!|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Int|): R|kotlin/String| {
|
||||
^ R|<local>/x|.R|kotlin/Int.plus|(Int(1)).R|kotlin/Any.toString|()
|
||||
}
|
||||
), Int(1))
|
||||
R|/foo3|<R|kotlin/Int|, R|ft<kotlin/String, kotlin/String?>!|>(R|/MyFunction|<R|kotlin/Int|, R|ft<kotlin/String, kotlin/String?>!|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Number|): R|kotlin/String| {
|
||||
^ R|<local>/x|.R|kotlin/Number.toInt|().R|kotlin/Any.toString|()
|
||||
}
|
||||
), Int(2))
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// TODO: This interface must be marked as "fun" ones that modifier is supported
|
||||
interface MyRunnable {
|
||||
fun foo(x: Int): Boolean
|
||||
}
|
||||
|
||||
fun foo(m: MyRunnable) {}
|
||||
|
||||
fun main() {
|
||||
foo(MyRunnable { x ->
|
||||
x > 1
|
||||
})
|
||||
|
||||
foo(MyRunnable({ it > 1 }))
|
||||
|
||||
val x = { x: Int -> x > 1 }
|
||||
|
||||
foo(MyRunnable(x))
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
FILE: kotlinSam.kt
|
||||
public abstract interface MyRunnable : R|kotlin/Any| {
|
||||
public abstract fun foo(x: R|kotlin/Int|): R|kotlin/Boolean|
|
||||
|
||||
}
|
||||
public final fun foo(m: R|MyRunnable|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
R|/foo|(R|/MyRunnable|(<L> = MyRunnable@fun <anonymous>(x: R|kotlin/Int|): R|kotlin/Boolean| {
|
||||
^ CMP(>, R|<local>/x|.R|kotlin/Int.compareTo|(Int(1)))
|
||||
}
|
||||
))
|
||||
R|/foo|(R|/MyRunnable|(MyRunnable@fun <anonymous>(it: R|kotlin/Int|): R|kotlin/Boolean| {
|
||||
^ CMP(>, R|<local>/it|.R|kotlin/Int.compareTo|(Int(1)))
|
||||
}
|
||||
))
|
||||
lval x: R|(kotlin/Int) -> kotlin/Boolean| = fun <anonymous>(x: R|kotlin/Int|): R|kotlin/Boolean| {
|
||||
^ CMP(>, R|<local>/x|.R|kotlin/Int.compareTo|(Int(1)))
|
||||
}
|
||||
|
||||
R|/foo|(R|/MyRunnable|(R|<local>/x|))
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// FILE: MyRunnable.java
|
||||
public interface MyRunnable {
|
||||
boolean foo(int x);
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
fun foo(m: MyRunnable) {}
|
||||
|
||||
fun MyRunnable(x: (Int) -> Boolean) = 1
|
||||
|
||||
fun main() {
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>(MyRunnable { x ->
|
||||
x > 1
|
||||
})
|
||||
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>(MyRunnable({ it > 1 }))
|
||||
|
||||
val x = { x: Int -> x > 1 }
|
||||
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>(MyRunnable(x))
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
FILE: main.kt
|
||||
public final fun foo(m: R|MyRunnable|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun MyRunnable(x: R|(kotlin/Int) -> kotlin/Boolean|): R|kotlin/Int| {
|
||||
^MyRunnable Int(1)
|
||||
}
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
<Inapplicable(INAPPLICABLE): [/foo]>#(R|/MyRunnable|(<L> = MyRunnable@fun <anonymous>(x: R|kotlin/Int|): R|kotlin/Boolean| {
|
||||
^ CMP(>, R|<local>/x|.R|kotlin/Int.compareTo|(Int(1)))
|
||||
}
|
||||
))
|
||||
<Inapplicable(INAPPLICABLE): [/foo]>#(R|/MyRunnable|(MyRunnable@fun <anonymous>(it: R|kotlin/Int|): R|kotlin/Boolean| {
|
||||
^ CMP(>, R|<local>/it|.R|kotlin/Int.compareTo|(Int(1)))
|
||||
}
|
||||
))
|
||||
lval x: R|(kotlin/Int) -> kotlin/Boolean| = fun <anonymous>(x: R|kotlin/Int|): R|kotlin/Boolean| {
|
||||
^ CMP(>, R|<local>/x|.R|kotlin/Int.compareTo|(Int(1)))
|
||||
}
|
||||
|
||||
<Inapplicable(INAPPLICABLE): [/foo]>#(R|/MyRunnable|(R|<local>/x|))
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
fun foo(runnable: Runnable) {}
|
||||
|
||||
fun main() {
|
||||
foo(Runnable {})
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
FILE: runnable.kt
|
||||
public final fun foo(runnable: R|java/lang/Runnable|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
R|/foo|(R|java/lang/Runnable|(<L> = Runnable@fun <anonymous>(): R|kotlin/Unit| {
|
||||
Unit
|
||||
}
|
||||
))
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// FILE: MyRunnable.java
|
||||
public interface MyRunnable {
|
||||
boolean foo(int x);
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
fun foo(m: MyRunnable) {}
|
||||
|
||||
fun main() {
|
||||
foo(MyRunnable { x ->
|
||||
x > 1
|
||||
})
|
||||
|
||||
foo(MyRunnable({ it > 1 }))
|
||||
|
||||
val x = { x: Int -> x > 1 }
|
||||
|
||||
foo(MyRunnable(x))
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
FILE: main.kt
|
||||
public final fun foo(m: R|MyRunnable|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
R|/foo|(R|/MyRunnable|(<L> = MyRunnable@fun <anonymous>(x: R|kotlin/Int|): R|kotlin/Boolean| {
|
||||
^ CMP(>, R|<local>/x|.R|kotlin/Int.compareTo|(Int(1)))
|
||||
}
|
||||
))
|
||||
R|/foo|(R|/MyRunnable|(MyRunnable@fun <anonymous>(it: R|kotlin/Int|): R|kotlin/Boolean| {
|
||||
^ CMP(>, R|<local>/it|.R|kotlin/Int.compareTo|(Int(1)))
|
||||
}
|
||||
))
|
||||
lval x: R|(kotlin/Int) -> kotlin/Boolean| = fun <anonymous>(x: R|kotlin/Int|): R|kotlin/Boolean| {
|
||||
^ CMP(>, R|<local>/x|.R|kotlin/Int.compareTo|(Int(1)))
|
||||
}
|
||||
|
||||
R|/foo|(R|/MyRunnable|(R|<local>/x|))
|
||||
}
|
||||
Reference in New Issue
Block a user