Minor: add test to call callable references from Java

This commit is contained in:
Ilmir Usmanov
2018-07-04 15:38:09 +03:00
parent 4e8cc53962
commit 4ec82cad90
11 changed files with 111 additions and 29 deletions
@@ -0,0 +1,33 @@
// IGNORE_BACKEND: JS, JS_IR, NATIVE
// COMMON_COROUTINES_TEST
// WITH_COROUTINES
// WITH_REFLECT
// FILE: test.kt
import kotlin.reflect.KSuspendFunction0
class Test {
suspend fun o() = "O"
fun forCall(): KSuspendFunction0<String> {
return ::o
}
suspend fun k() = "K"
fun forInvoke(): SuspendFunction0<String> {
return ::k
}
}
// FILE: Checker.java
import helpers.*;
class Checker {
public static String check() {
Test test = new Test();
return ((String) test.forCall().call(new EmptyContinuation())) +
((String) test.forInvoke().invoke(new EmptyContinuation()));
}
}
// FILE: box.kt
fun box() = Checker.check()