Add tests for issues fixed in JVM IR and other obsolete issues
#KT-6007 #KT-16445 #KT-17753 #KT-22488 #KT-23881 #KT-24135 #KT-26360 #KT-27427 #KT-27449 #KT-27830 #KT-28042 #KT-29595 #KT-30708 #KT-32793
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
// IGNORE_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// KT-27830
|
||||
|
||||
import helpers.EmptyContinuation
|
||||
import kotlin.coroutines.*
|
||||
|
||||
fun box(): String {
|
||||
var result = "Fail"
|
||||
suspend {
|
||||
do {
|
||||
go {
|
||||
result = "OK"
|
||||
}
|
||||
} while (false)
|
||||
}.startCoroutine(EmptyContinuation)
|
||||
return result
|
||||
}
|
||||
|
||||
suspend inline fun go(block: suspend () -> Unit) {
|
||||
block()
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
// IGNORE_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
|
||||
import helpers.EmptyContinuation
|
||||
import kotlin.coroutines.*
|
||||
|
||||
var result = ""
|
||||
lateinit var c: Continuation<Unit>
|
||||
|
||||
fun builder(block: suspend () -> Unit) {
|
||||
block.startCoroutine(EmptyContinuation())
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val flow = foo {
|
||||
bar()
|
||||
result += "O"
|
||||
}
|
||||
builder {
|
||||
flow()
|
||||
}
|
||||
c.resume(Unit)
|
||||
return result
|
||||
}
|
||||
|
||||
suspend fun bar() {
|
||||
return suspendCoroutine { cont: Continuation<Unit> ->
|
||||
c = cont
|
||||
}
|
||||
}
|
||||
|
||||
inline fun foo(crossinline coroutine: suspend () -> Unit): suspend () -> Unit {
|
||||
return {
|
||||
coroutine.invoke()
|
||||
result += "K"
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
// IGNORE_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// KT-27449
|
||||
|
||||
import helpers.EmptyContinuation
|
||||
import kotlin.coroutines.*
|
||||
|
||||
var result = "Fail"
|
||||
|
||||
suspend fun doAction() {
|
||||
suspend fun run(
|
||||
a: String,
|
||||
f: suspend (String) -> Unit = { input -> result = input }
|
||||
) {
|
||||
f(a)
|
||||
}
|
||||
|
||||
run("OK")
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
suspend {
|
||||
doAction()
|
||||
}.startCoroutine(EmptyContinuation)
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user