JVM IR: Copy type parameters from class to suspendImpl

These type parameters where used in function parameters,
but since suspendImpl is static function, it has no access
to class type parameters. Solution is to copy them to
the function itself.

 #KT-55125 Fixed
This commit is contained in:
Ilmir Usmanov
2022-11-30 19:29:55 +01:00
committed by Space Team
parent 94f1c579df
commit 901ff06e90
4 changed files with 34 additions and 1 deletions
@@ -0,0 +1,20 @@
// TARGET_BACKEND: JVM_IR
// WITH_STDLIB
// FULL_JDK
abstract class AbstractPersistence<T, U> {
open suspend fun fetch(identifier: U): T? = null
}
fun box(): String {
val genericString =
AbstractPersistence::class.java.declaredMethods
.single { it.name.contains("\$suspendImpl") }
.toGenericString()
if (!genericString.startsWith("static <T,U>")) {
return genericString
}
return "OK"
}