Support SAM conversion in psi2ir
SAM conversion takes a function value (function type or a subtype), and produces a SAM interface value.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
// WITH_JDK
|
||||
// FILE: samConversions.kt
|
||||
fun J.test0(a: Runnable) {
|
||||
J.runStatic(a)
|
||||
runIt(a)
|
||||
}
|
||||
|
||||
fun test1() {
|
||||
J.runStatic { test1() }
|
||||
}
|
||||
|
||||
fun J.test2() {
|
||||
runIt { test1() }
|
||||
}
|
||||
|
||||
fun J.test3(a: () -> Unit) {
|
||||
run2(a, a)
|
||||
}
|
||||
|
||||
fun J.test4(a: () -> Unit, b: () -> Unit, flag: Boolean) {
|
||||
runIt(if (flag) a else b)
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
public class J {
|
||||
public static void runStatic(Runnable r) {}
|
||||
|
||||
public void runIt(Runnable r) {}
|
||||
|
||||
public void run2(Runnable r1, Runnable r2) {}
|
||||
}
|
||||
Reference in New Issue
Block a user