JVM: Suspend converted references inherit AdaptedFunctionReference

This commit is contained in:
Dmitry Petrov
2020-04-28 13:40:00 +03:00
parent deecb6a28e
commit 878e838f0b
8 changed files with 58 additions and 11 deletions
@@ -0,0 +1,26 @@
// !LANGUAGE: +SuspendConversion
// TARGET_BACKEND: JVM
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
import kotlin.reflect.KCallable
private fun check(label: String, fn: Any) {
if (fn is KCallable<*>) {
throw AssertionError("$label is KCallable, ${fn::class.java.simpleName}")
}
}
fun checkSuspend(label: String, fn: suspend () -> Unit) = check(label, fn)
fun checkSuspendAny(label: String, fn: suspend () -> Any) = check(label, fn)
fun withSuspendConversion() {}
class CCtorAsSuspend()
fun box(): String {
checkSuspend("::withSuspendConversion", ::withSuspendConversion)
checkSuspendAny("::CCtorAsSuspend", ::CCtorAsSuspend)
return "OK"
}