JVM: fix type mapping of big arity suspend function types
The code in IrTypeMapper was incorrectly translated from KotlinTypeMapper during the development of JVM IR. The `classDescriptor.hasBigArity` condition in KotlinTypeMapper was checking if the class represents a function or a suspend function with big arity, and the suspend function part was lost during conversion. This resulted in incorrect generic signature being generated, which led to malformed type exceptions from reflection, and compilation errors from kapt stub generation. Also, change a comment in irCodegenUtils to avoid confusion of numbered function types (kotlin.jvm.functions.Function1, ...) with the big-arity type kotlin.jvm.functions.FunctionN. #KT-58375 Fixed
This commit is contained in:
committed by
Space Team
parent
f659b63aef
commit
c06ec84bb1
@@ -0,0 +1,34 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_REFLECT
|
||||
// WITH_COROUTINES
|
||||
|
||||
import helpers.*
|
||||
import kotlin.coroutines.*
|
||||
import kotlin.coroutines.intrinsics.*
|
||||
import kotlin.reflect.full.*
|
||||
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
interface Flow<T>
|
||||
|
||||
class C
|
||||
|
||||
suspend fun foo(
|
||||
f: suspend (C, C, C, C, C, C, C, C, C, C, C, C, C, C, C, C, C, C, C, C, C, C, C) -> String
|
||||
): String =
|
||||
f(C(), C(), C(), C(), C(), C(), C(), C(), C(), C(), C(), C(), C(), C(), C(), C(), C(), C(), C(), C(), C(), C(), C())
|
||||
|
||||
fun box(): String {
|
||||
var res = "Fail"
|
||||
builder {
|
||||
val f: suspend (C, C, C, C, C, C, C, C, C, C, C, C, C, C, C, C, C, C, C, C, C, C, C) -> String = {
|
||||
_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ ->
|
||||
"OK"
|
||||
}
|
||||
res = ::foo.callSuspend(f)
|
||||
}
|
||||
return res
|
||||
}
|
||||
Reference in New Issue
Block a user