diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java index bd373fc9b82..53026982f9f 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java @@ -9981,6 +9981,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/coroutines/generate.kt"); } + @Test + @TestMetadata("genericSignatureForSuspendImpl.kt") + public void testGenericSignatureForSuspendImpl() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/genericSignatureForSuspendImpl.kt"); + } + @Test @TestMetadata("handleException.kt") public void testHandleException() throws Exception { diff --git a/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/FunctionCodegen.kt b/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/FunctionCodegen.kt index 4a4d249d994..6c7c972a646 100644 --- a/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/FunctionCodegen.kt +++ b/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/FunctionCodegen.kt @@ -60,7 +60,8 @@ class FunctionCodegen(private val irFunction: IrFunction, private val classCodeg signature.genericsSignature .takeIf { (irFunction.isInline && irFunction.origin != IrDeclarationOrigin.FUNCTION_FOR_DEFAULT_PARAMETER) || - !isSynthetic && irFunction.origin != IrDeclarationOrigin.LOCAL_FUNCTION_FOR_LAMBDA + (!isSynthetic && irFunction.origin != IrDeclarationOrigin.LOCAL_FUNCTION_FOR_LAMBDA) || + (irFunction.origin == JvmLoweredDeclarationOrigin.SUSPEND_IMPL_STATIC_FUNCTION) }, getThrownExceptions(irFunction)?.toTypedArray() ) diff --git a/compiler/testData/codegen/box/coroutines/genericSignatureForSuspendImpl.kt b/compiler/testData/codegen/box/coroutines/genericSignatureForSuspendImpl.kt new file mode 100644 index 00000000000..579791cd466 --- /dev/null +++ b/compiler/testData/codegen/box/coroutines/genericSignatureForSuspendImpl.kt @@ -0,0 +1,37 @@ +// TARGET_BACKEND: JVM +// FULL_JDK +// WITH_STDLIB +// WITH_COROUTINES + +package test + +import kotlin.coroutines.* +import java.lang.reflect.* +import kotlin.test.assertEquals + +open class MyClass { + open suspend fun fooTypeParameter() = reifiedType>() +} + +class Foo + +open class TypeBase + +inline fun reifiedType(): Type { + val base = object : TypeBase() {} + val superType = base::class.java.genericSuperclass!! + return (superType as ParameterizedType).actualTypeArguments.first()!! +} + +fun runBlocking(c: suspend () -> Unit) { + c.startCoroutine(Continuation(EmptyCoroutineContext){ + it.getOrThrow() + }) +} + +fun box(): String { + runBlocking { + assertEquals("test.Foo", MyClass().fooTypeParameter().toString()) + } + return "OK" +} \ No newline at end of file diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java index 52c907928fe..592b0dfb4cc 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java @@ -9861,6 +9861,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/coroutines/generate.kt"); } + @Test + @TestMetadata("genericSignatureForSuspendImpl.kt") + public void testGenericSignatureForSuspendImpl() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/genericSignatureForSuspendImpl.kt"); + } + @Test @TestMetadata("handleException.kt") public void testHandleException() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index 935c687d606..d5f71e7a3ac 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -9981,6 +9981,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/coroutines/generate.kt"); } + @Test + @TestMetadata("genericSignatureForSuspendImpl.kt") + public void testGenericSignatureForSuspendImpl() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/genericSignatureForSuspendImpl.kt"); + } + @Test @TestMetadata("handleException.kt") public void testHandleException() throws Exception { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 2ea42a3ce40..e6584179325 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -7759,6 +7759,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/coroutines/generate.kt"); } + @TestMetadata("genericSignatureForSuspendImpl.kt") + public void testGenericSignatureForSuspendImpl() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/genericSignatureForSuspendImpl.kt"); + } + @TestMetadata("handleException.kt") public void testHandleException() throws Exception { runTest("compiler/testData/codegen/box/coroutines/handleException.kt");