Files
kotlin-fork/compiler/testData/ir/irText/expressions/sam/samConversions.kt
T
Dmitry Petrov 85f55dec9a Support SAM conversion in psi2ir
SAM conversion takes a function value (function type or a subtype),
and produces a SAM interface value.
2018-12-19 10:58:34 +03:00

31 lines
497 B
Kotlin
Vendored

// 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) {}
}