Do not transform state-machine when inlining

Sometimes, state-machine, generated in inline functions with
crossinline parameter, is transformed, since all usages should be
renamed.
However, this is wrong: in this case, we will have state-machine
inside state-machine.
This fix addresses the issue.

 #KT-25893 Fixed
This commit is contained in:
Ilmir Usmanov
2018-10-09 22:42:28 +03:00
parent d3908aeb2e
commit 0934db8fbd
9 changed files with 317 additions and 142 deletions
@@ -1090,6 +1090,16 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/bytecodeText/coroutines"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("crossinlineSuspendContinuation_1_2.kt")
public void testCrossinlineSuspendContinuation_1_2() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/coroutines/crossinlineSuspendContinuation_1_2.kt");
}
@TestMetadata("crossinlineSuspendContinuation_1_3.kt")
public void testCrossinlineSuspendContinuation_1_3() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/coroutines/crossinlineSuspendContinuation_1_3.kt");
}
@TestMetadata("doNotReassignContinuation.kt")
public void testDoNotReassignContinuation() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/coroutines/doNotReassignContinuation.kt");
@@ -1297,6 +1307,29 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
runTestWithPackageReplacement("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling/usedInVarStore.kt", "kotlin.coroutines");
}
}
@TestMetadata("compiler/testData/codegen/bytecodeText/coroutines/stateMachine")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class StateMachine extends AbstractBytecodeTextTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
}
public void testAllFilesPresentInStateMachine() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/bytecodeText/coroutines/stateMachine"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("kt25893.kt")
public void testKt25893() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/coroutines/stateMachine/kt25893.kt");
}
@TestMetadata("withTypeParameter.kt")
public void testWithTypeParameter() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/coroutines/stateMachine/withTypeParameter.kt");
}
}
}
@TestMetadata("compiler/testData/codegen/bytecodeText/deadCodeElimination")