Do not write generics for $suspendImpl synthetic method
#KT-18252 Fixed
This commit is contained in:
@@ -229,6 +229,13 @@ public class FunctionCodegen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
asmMethod = CoroutineCodegenUtilKt.getImplForOpenMethod(asmMethod, v.getThisName());
|
asmMethod = CoroutineCodegenUtilKt.getImplForOpenMethod(asmMethod, v.getThisName());
|
||||||
|
// remove generic signature as it's unnecessary for synthetic methods
|
||||||
|
jvmSignature =
|
||||||
|
new JvmMethodGenericSignature(
|
||||||
|
asmMethod,
|
||||||
|
jvmSignature.getValueParameters(),
|
||||||
|
null
|
||||||
|
);
|
||||||
|
|
||||||
mv.visitMethodInsn(
|
mv.visitMethodInsn(
|
||||||
Opcodes.INVOKESTATIC,
|
Opcodes.INVOKESTATIC,
|
||||||
|
|||||||
+60
@@ -0,0 +1,60 @@
|
|||||||
|
// WITH_RUNTIME
|
||||||
|
// WITH_COROUTINES
|
||||||
|
// FILE: main.kt
|
||||||
|
// TARGET_BACKEND: JVM
|
||||||
|
import helpers.*
|
||||||
|
import kotlin.coroutines.experimental.*
|
||||||
|
import kotlin.coroutines.experimental.intrinsics.*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
open class A(val v: String) {
|
||||||
|
suspend fun suspendThere(v: String): String = suspendCoroutineOrReturn { x ->
|
||||||
|
x.resume(v)
|
||||||
|
COROUTINE_SUSPENDED
|
||||||
|
}
|
||||||
|
|
||||||
|
open suspend fun suspendHere(): String = suspendThere("O") + suspendThere(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
class B(v: String) : A(v) {
|
||||||
|
override suspend fun suspendHere(): String = super.suspendHere() + suspendThere("56")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun builder(c: suspend A.() -> Unit) {
|
||||||
|
c.startCoroutine(B("K"), EmptyContinuation)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
var result = JavaClass.foo()
|
||||||
|
|
||||||
|
if (result != "OK56") return "fail 1: $result"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: JavaClass.java
|
||||||
|
import kotlin.coroutines.experimental.*;
|
||||||
|
public class JavaClass {
|
||||||
|
public static String foo() {
|
||||||
|
final String[] res = new String[1];
|
||||||
|
|
||||||
|
new B("K").suspendHere(new Continuation<String>() {
|
||||||
|
@Override
|
||||||
|
public CoroutineContext getContext() {
|
||||||
|
return EmptyCoroutineContext.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void resume(String s) {
|
||||||
|
res[0] = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void resumeWithException(Throwable throwable) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return res[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
+6
@@ -5704,6 +5704,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("openFunWithJava.kt")
|
||||||
|
public void testOpenFunWithJava() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/openFunWithJava.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("operators.kt")
|
@TestMetadata("operators.kt")
|
||||||
public void testOperators() throws Exception {
|
public void testOperators() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/operators.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/operators.kt");
|
||||||
|
|||||||
@@ -5704,6 +5704,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("openFunWithJava.kt")
|
||||||
|
public void testOpenFunWithJava() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/openFunWithJava.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("operators.kt")
|
@TestMetadata("operators.kt")
|
||||||
public void testOperators() throws Exception {
|
public void testOperators() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/operators.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/operators.kt");
|
||||||
|
|||||||
@@ -5704,6 +5704,12 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("openFunWithJava.kt")
|
||||||
|
public void testOpenFunWithJava() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/openFunWithJava.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("operators.kt")
|
@TestMetadata("operators.kt")
|
||||||
public void testOperators() throws Exception {
|
public void testOperators() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/operators.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/operators.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user