Fix issue #KT-24475

* count coroutine metadata references during RemoveUnusedImport pass in JsInliner
* add cases to test usage of stdlib symbols in inlined functions
This commit is contained in:
Roman Artemev
2018-07-17 19:26:05 +03:00
committed by Roman Artemev
parent 75c7045ea7
commit 14b1f0ef6a
12 changed files with 149 additions and 6 deletions
@@ -0,0 +1,50 @@
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND: NATIVE
// WITH_COROUTINES
// WITH_RUNTIME
// COMMON_COROUTINES_TEST
// MODULE: lib(support)
// FILE: lib.kt
import helpers.*
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
suspend inline fun <R> inlined(
crossinline step: suspend () -> R
): R = notInlined { step() }
suspend fun <R> notInlined(
block: suspend () -> R
): R = block()
// MODULE: main(lib, support)
// FILE: main.kt
// WITH_COROUTINES
// WITH_RUNTIME
// COMMON_COROUTINES_TEST
import helpers.*
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
var result = "FAIL"
suspend fun test() {
inlined {
result = "OK"
}
}
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
fun box(): String {
builder {
test()
}
return result
}
@@ -7033,6 +7033,16 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/coroutines/multiModule"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM_IR, true);
}
@TestMetadata("inlineCrossModule.kt")
public void testInlineCrossModule_1_2() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineCrossModule.kt", "kotlin.coroutines.experimental");
}
@TestMetadata("inlineCrossModule.kt")
public void testInlineCrossModule_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineCrossModule.kt", "kotlin.coroutines");
}
@TestMetadata("inlineFunctionWithOptionalParam.kt")
public void testInlineFunctionWithOptionalParam_1_2() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineFunctionWithOptionalParam.kt", "kotlin.coroutines.experimental");
@@ -7033,6 +7033,16 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/coroutines/multiModule"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("inlineCrossModule.kt")
public void testInlineCrossModule_1_2() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineCrossModule.kt", "kotlin.coroutines.experimental");
}
@TestMetadata("inlineCrossModule.kt")
public void testInlineCrossModule_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineCrossModule.kt", "kotlin.coroutines");
}
@TestMetadata("inlineFunctionWithOptionalParam.kt")
public void testInlineFunctionWithOptionalParam_1_2() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineFunctionWithOptionalParam.kt", "kotlin.coroutines.experimental");
@@ -7033,6 +7033,16 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/coroutines/multiModule"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("inlineCrossModule.kt")
public void testInlineCrossModule_1_2() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineCrossModule.kt", "kotlin.coroutines.experimental");
}
@TestMetadata("inlineCrossModule.kt")
public void testInlineCrossModule_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineCrossModule.kt", "kotlin.coroutines");
}
@TestMetadata("inlineFunctionWithOptionalParam.kt")
public void testInlineFunctionWithOptionalParam_1_2() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/multiModule/inlineFunctionWithOptionalParam.kt", "kotlin.coroutines.experimental");