[JVM_IR] Fix inline class default method codegen.

Do not coroutine transform static inline class replacements that
forward to a default interface suspend method. No boxing has to
take place on return (as the default interface method always
boxes) so we can simply forward the call.

^KT-49645 Fixed
This commit is contained in:
Mads Ager
2021-11-23 15:15:33 +01:00
committed by Alexander Udalov
parent 50f610cfd8
commit 529944fe9c
7 changed files with 69 additions and 5 deletions
+30
View File
@@ -0,0 +1,30 @@
// WITH_STDLIB
// WITH_COROUTINES
// TARGET_BACKEND: JVM
import helpers.*
import kotlin.coroutines.*
interface Cont1 {
suspend fun flaf() = "O"
suspend fun toResult(): Result<String> {
val x = flaf()
return Result.success(x + "K")
}
}
@JvmInline
private value class ContImpl(val a: String) : Cont1
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
fun box(): String {
var result = "FAIL"
builder {
result = ContImpl("A").toResult().getOrThrow()
}
return result
}