Minor: add test to call callable references from Java
This commit is contained in:
+33
@@ -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()
|
||||
Reference in New Issue
Block a user