Support tailrec suspend functions in JVM backend
The main problem is that inside a state machine for a named suspend function parameters of it's owner are available as a usual captured closure parameters (i.e. through synthetic fields), while TailRecursion codegen expects that parameters are straight local variables. So, the solution is just to define local var for each of real parameters (all but the last continuation parameters) for tailrec functions. #KT-15759 Fixed
This commit is contained in:
+15
@@ -5042,6 +5042,21 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/coroutines/featureIntersection")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class FeatureIntersection extends AbstractIrBlackBoxCodegenTest {
|
||||
public void testAllFilesPresentInFeatureIntersection() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/coroutines/featureIntersection"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("tailrec.kt")
|
||||
public void testTailrec() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/featureIntersection/tailrec.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/coroutines/intLikeVarSpilling")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Reference in New Issue
Block a user