Files
kotlin-fork/compiler/testData/codegen/box/callableReference/adaptedReferences/noReflectionForAdaptedCallableReferencesWithSuspendConversion.kt
T
2021-02-15 17:08:13 +03:00

26 lines
646 B
Kotlin
Vendored

// !LANGUAGE: +SuspendConversion
// TARGET_BACKEND: JVM
// 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"
}