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:
Dmitry Petrov
2018-12-17 17:00:58 +03:00
parent 2c327564d5
commit 85f55dec9a
15 changed files with 494 additions and 19 deletions
@@ -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) {}
}