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:
committed by
Space Team
parent
94f1c579df
commit
901ff06e90
+6
@@ -10765,6 +10765,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/coroutines/suspendImplBridge.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suspendImplTypeParameters.kt")
|
||||
public void testSuspendImplTypeParameters() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/suspendImplTypeParameters.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suspendInCycle.kt")
|
||||
public void testSuspendInCycle() throws Exception {
|
||||
|
||||
+2
-1
@@ -225,7 +225,8 @@ private class AddContinuationLowering(context: JvmBackendContext) : SuspendLower
|
||||
else
|
||||
JavaDescriptorVisibilities.PACKAGE_VISIBILITY,
|
||||
isFakeOverride = false,
|
||||
copyMetadata = false
|
||||
copyMetadata = false,
|
||||
typeParametersFromContext = irFunction.parentAsClass.typeParameters,
|
||||
)
|
||||
static.body = irFunction.moveBodyTo(static)
|
||||
// Fixup dispatch parameter to outer class
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
+6
@@ -10765,6 +10765,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/coroutines/suspendImplBridge.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suspendImplTypeParameters.kt")
|
||||
public void testSuspendImplTypeParameters() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/suspendImplTypeParameters.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suspendInCycle.kt")
|
||||
public void testSuspendInCycle() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user