Minor. Add regression test
#KT-52561 Fixed
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
// WITH_STDLIB
|
||||
// WITH_COROUTINES
|
||||
import helpers.*
|
||||
import kotlin.coroutines.*
|
||||
import kotlin.coroutines.intrinsics.*
|
||||
|
||||
fun someCondition() = true
|
||||
|
||||
suspend fun suspendHere() = suspendCoroutineUninterceptedOrReturn {
|
||||
it.resume(Unit)
|
||||
COROUTINE_SUSPENDED
|
||||
}
|
||||
|
||||
fun expectString(x: String?) {
|
||||
if (x != "TEST") error("FAIL: $x")
|
||||
}
|
||||
|
||||
suspend fun test(block: (String) -> Unit) {
|
||||
val string: String? = "TEST".takeIf { true }
|
||||
check(string != null) // smartcast from String? to String
|
||||
expectString(string)
|
||||
suspendHere()
|
||||
expectString(string)
|
||||
block(string)
|
||||
}
|
||||
|
||||
|
||||
fun box(): String {
|
||||
suspend { test {} }.startCoroutine(EmptyContinuation)
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user