FIR: Support lambda inference from platform types
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
// WITH_RUNTIME
|
||||
// FILE: JavaClass.java
|
||||
public class JavaClass {
|
||||
public static void foo1(kotlin.jvm.functions.Function0<Integer> x) {}
|
||||
public static void foo2(kotlin.jvm.functions.Function1<Integer, String> x) {}
|
||||
public static <T> void foo3(kotlin.jvm.functions.Function1<T, String> x, T y) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
fun main() {
|
||||
JavaClass.foo1 { 123 }
|
||||
|
||||
|
||||
JavaClass.foo2 { (it + 2).toString() }
|
||||
JavaClass.foo2({ (it + 3).toString() })
|
||||
val y = { x: Int -> x.toString() }
|
||||
JavaClass.foo2(y)
|
||||
|
||||
|
||||
JavaClass.foo3({ (it + 4).toString() }, 5)
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
FILE: main.kt
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
Q|JavaClass|.R|/JavaClass.foo1|(<L> = foo1@fun <anonymous>(): R|ft<kotlin/Int, kotlin/Int?>!| <kind=EXACTLY_ONCE> {
|
||||
Int(123)
|
||||
}
|
||||
)
|
||||
Q|JavaClass|.R|/JavaClass.foo2|(<L> = foo2@fun <anonymous>(it: R|ft<kotlin/Int, kotlin/Int?>!|): R|ft<kotlin/String, kotlin/String?>!| <kind=EXACTLY_ONCE> {
|
||||
R|<local>/it|.R|kotlin/Int.plus|(Int(2)).R|kotlin/Any.toString|()
|
||||
}
|
||||
)
|
||||
Q|JavaClass|.R|/JavaClass.foo2|(foo2@fun <anonymous>(it: R|ft<kotlin/Int, kotlin/Int?>!|): R|ft<kotlin/String, kotlin/String?>!| <kind=EXACTLY_ONCE> {
|
||||
R|<local>/it|.R|kotlin/Int.plus|(Int(3)).R|kotlin/Any.toString|()
|
||||
}
|
||||
)
|
||||
lval y: R|kotlin/Function1<kotlin/Int, kotlin/String>| = fun <anonymous>(x: R|kotlin/Int|): R|kotlin/String| {
|
||||
R|<local>/x|.R|kotlin/Any.toString|()
|
||||
}
|
||||
|
||||
Q|JavaClass|.R|/JavaClass.foo2|(R|<local>/y|)
|
||||
Q|JavaClass|.R|/JavaClass.foo3|<R|ft<kotlin/Int, kotlin/Int>|>(foo3@fun <anonymous>(it: R|ft<kotlin/Int, kotlin/Int>|): R|ft<kotlin/String, kotlin/String?>!| <kind=EXACTLY_ONCE> {
|
||||
R|<local>/it|.R|kotlin/Int.plus|(Int(4)).R|kotlin/Any.toString|()
|
||||
}
|
||||
, Int(5))
|
||||
}
|
||||
Reference in New Issue
Block a user