Fix deserialization of kotlin.suspend when LV=1.3 is used

Before this change, kotlin.suspend was being loaded as having a common
function type instead of suspend function type.

With LV=1.3, we expect that suspend function types should have
new Continuation interface as a last type argument, while
kotlin.suspend is built with LV=1.2 and has old Continuation.

This change might be reverted once stdlib will be rebuilt with LV=1.3

NB: kotlin.suspend doesn't need to be intrinsified since it only returns
its parameter with checkcast to kotlinin.jvm.functions.Function1
(i.e., it doesn't refer the coroutines package)

 #KT-24861 Fixed
This commit is contained in:
Denis Zharkov
2018-06-20 20:09:09 +03:00
parent 3d3d21cb93
commit a644cbb5ed
10 changed files with 74 additions and 21 deletions
@@ -1,10 +1,10 @@
// !API_VERSION: 1.2
// IGNORE_BACKEND: JS_IR
// WITH_RUNTIME
// COMMON_COROUTINES_TEST
// WITH_COROUTINES
import helpers.*
import kotlin.coroutines.experimental.*
import kotlin.coroutines.experimental.intrinsics.*
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
suspend fun suspendHere(v: String): String = suspendCoroutineOrReturn { x ->
x.resume(v)
@@ -1,6 +1,5 @@
import kotlin.coroutines.experimental.Continuation
import kotlin.coroutines.experimental.CoroutineContext
import kotlin.coroutines.experimental.startCoroutine
// COMMON_COROUTINES_TEST
import COROUTINES_PACKAGE.*
fun bar() {
suspend {
@@ -7493,8 +7493,15 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
}
@TestMetadata("suspendModifier.kt")
public void testSuspendModifier() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/suspendModifier.kt");
public void testSuspendModifier_1_2() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/suspendModifier.kt");
doTestWithCoroutinesPackageReplacement(fileName, "kotlin.coroutines.experimental");
}
@TestMetadata("suspendModifier.kt")
public void testSuspendModifier_1_3() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/suspendModifier.kt");
doTestWithCoroutinesPackageReplacement(fileName, "kotlin.coroutines");
}
}
@@ -1520,8 +1520,15 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
}
@TestMetadata("suspendLambda.kt")
public void testSuspendLambda() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendLambda.kt");
public void testSuspendLambda_1_2() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendLambda.kt");
doTestWithCoroutinesPackageReplacement(fileName, "kotlin.coroutines.experimental");
}
@TestMetadata("suspendLambda.kt")
public void testSuspendLambda_1_3() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendLambda.kt");
doTestWithCoroutinesPackageReplacement(fileName, "kotlin.coroutines");
}
@TestMetadata("suspendOverridability.kt")
@@ -1520,8 +1520,15 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno
}
@TestMetadata("suspendLambda.kt")
public void testSuspendLambda() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendLambda.kt");
public void testSuspendLambda_1_2() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendLambda.kt");
doTestWithCoroutinesPackageReplacement(fileName, "kotlin.coroutines.experimental");
}
@TestMetadata("suspendLambda.kt")
public void testSuspendLambda_1_3() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendLambda.kt");
doTestWithCoroutinesPackageReplacement(fileName, "kotlin.coroutines");
}
@TestMetadata("suspendOverridability.kt")
@@ -7493,8 +7493,15 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
}
@TestMetadata("suspendModifier.kt")
public void testSuspendModifier() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/suspendModifier.kt");
public void testSuspendModifier_1_2() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/suspendModifier.kt");
doTestWithCoroutinesPackageReplacement(fileName, "kotlin.coroutines.experimental");
}
@TestMetadata("suspendModifier.kt")
public void testSuspendModifier_1_3() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/suspendModifier.kt");
doTestWithCoroutinesPackageReplacement(fileName, "kotlin.coroutines");
}
}
@@ -7493,8 +7493,15 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
}
@TestMetadata("suspendModifier.kt")
public void testSuspendModifier() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/suspendModifier.kt");
public void testSuspendModifier_1_2() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/suspendModifier.kt");
doTestWithCoroutinesPackageReplacement(fileName, "kotlin.coroutines.experimental");
}
@TestMetadata("suspendModifier.kt")
public void testSuspendModifier_1_3() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/suspendFunctionTypeCall/suspendModifier.kt");
doTestWithCoroutinesPackageReplacement(fileName, "kotlin.coroutines");
}
}