Support restricted suspend lambdas in JVM_IR

#KT-40135 Fixed
This commit is contained in:
Ilmir Usmanov
2020-07-29 14:49:15 +02:00
parent 2c205410fa
commit fa8c6deb18
7 changed files with 85 additions and 27 deletions
@@ -0,0 +1,22 @@
// WITH_RUNTIME
// TARGET_BACKEND: JVM
import kotlin.coroutines.*
@RestrictsSuspension
interface Marker {
fun restricted()
}
var lambda: Any? = null
fun acceptsRestricted(c: suspend Marker.() -> Unit) {
lambda = c
}
fun box(): String {
acceptsRestricted {}
@Suppress("INVISIBLE_REFERENCE")
return if (lambda is kotlin.coroutines.jvm.internal.RestrictedSuspendLambda) "OK"
else "FAIL"
}