Minor. Add regression test

#KT-52561 Fixed
This commit is contained in:
Ilmir Usmanov
2022-05-29 19:19:47 +02:00
committed by teamcity
parent 4a7a0126f2
commit f922684169
9 changed files with 77 additions and 0 deletions
+31
View File
@@ -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"
}