JVM_IR: fix Result types in continuations & remove more codegen hacks

#KT-47129 Fixed
This commit is contained in:
pyos
2021-06-04 15:39:40 +02:00
committed by Ilmir Usmanov
parent e8490f950a
commit 0bd8d16fe2
13 changed files with 69 additions and 17 deletions
@@ -0,0 +1,17 @@
// WITH_RUNTIME
import kotlin.coroutines.*
fun <T> runBlocking(c: suspend () -> T): T {
var res: T? = null
c.startCoroutine(Continuation(EmptyCoroutineContext) {
res = it.getOrThrow()
})
return res!!
}
fun box(): String = runBlocking { // Non-inline lambda;
run { // In it an inline lambda
val foo = { Result.success("OK") } // Unboxes Result.
foo().getOrNull()!!
}
}