[K/N] Use suspend function desugaring lowerings.

This commit is contained in:
Pavel Kunyavskiy
2022-09-05 16:14:29 +02:00
committed by Space Team
parent 8886e1b8b4
commit 817dba8564
19 changed files with 227 additions and 169 deletions
@@ -4,6 +4,7 @@
*/
package codegen.function.unreachable_statement_after_return
import kotlin.coroutines.*
fun test1(): Any? {
return 1
@@ -25,10 +26,42 @@ fun test4(): Int {
42
}
suspend fun test5(): Any? {
return 5
42
}
suspend fun test6(): Int? {
return 6
42
}
suspend fun test7(): Any {
return 7
42
}
suspend fun test8(): Int {
return 8
42
}
@Suppress("UNCHECKED_CAST")
private fun <T> (suspend () -> T).runCoroutine() : T {
var result : Any? = null
startCoroutine(Continuation(EmptyCoroutineContext) { result = it.getOrThrow() })
return result as T
}
fun main() {
println(test1())
println(test2())
println(test3())
println(test4())
println(::test5.runCoroutine())
println(::test6.runCoroutine())
println(::test7.runCoroutine())
println(::test8.runCoroutine())
}