Support subject variable in specialized code generators for 'when'

This commit is contained in:
Dmitry Petrov
2018-06-09 17:00:25 +03:00
parent 3528405666
commit 34b76a3718
17 changed files with 427 additions and 20 deletions
@@ -20664,6 +20664,79 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
public void testStatement() throws Exception {
runTest("compiler/testData/codegen/box/when/stringOptimization/statement.kt");
}
@TestMetadata("temporaryVarInWhenByStringIsDisposedProperly.kt")
public void testTemporaryVarInWhenByStringIsDisposedProperly() throws Exception {
runTest("compiler/testData/codegen/box/when/stringOptimization/temporaryVarInWhenByStringIsDisposedProperly.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/when/whenSubjectVariable")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class WhenSubjectVariable extends AbstractIrJsCodegenBoxTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
}
public void testAllFilesPresentInWhenSubjectVariable() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/when/whenSubjectVariable"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS_IR, true);
}
@TestMetadata("captureSubjectVariable.kt")
public void testCaptureSubjectVariable() throws Exception {
runTest("compiler/testData/codegen/box/when/whenSubjectVariable/captureSubjectVariable.kt");
}
@TestMetadata("denseIntSwitchWithSubjectVariable.kt")
public void testDenseIntSwitchWithSubjectVariable() throws Exception {
runTest("compiler/testData/codegen/box/when/whenSubjectVariable/denseIntSwitchWithSubjectVariable.kt");
}
@TestMetadata("equalityWithSubjectVariable.kt")
public void testEqualityWithSubjectVariable() throws Exception {
runTest("compiler/testData/codegen/box/when/whenSubjectVariable/equalityWithSubjectVariable.kt");
}
@TestMetadata("ieee754Equality.kt")
public void testIeee754Equality() throws Exception {
runTest("compiler/testData/codegen/box/when/whenSubjectVariable/ieee754Equality.kt");
}
@TestMetadata("ieee754EqualityWithSmartCast.kt")
public void testIeee754EqualityWithSmartCast() throws Exception {
runTest("compiler/testData/codegen/box/when/whenSubjectVariable/ieee754EqualityWithSmartCast.kt");
}
@TestMetadata("isCheckOnSubjectVariable.kt")
public void testIsCheckOnSubjectVariable() throws Exception {
runTest("compiler/testData/codegen/box/when/whenSubjectVariable/isCheckOnSubjectVariable.kt");
}
@TestMetadata("rangeCheckOnSubjectVariable.kt")
public void testRangeCheckOnSubjectVariable() throws Exception {
runTest("compiler/testData/codegen/box/when/whenSubjectVariable/rangeCheckOnSubjectVariable.kt");
}
@TestMetadata("sparseIntSwitchWithSubjectVariable.kt")
public void testSparseIntSwitchWithSubjectVariable() throws Exception {
runTest("compiler/testData/codegen/box/when/whenSubjectVariable/sparseIntSwitchWithSubjectVariable.kt");
}
@TestMetadata("whenByEnum.kt")
public void testWhenByEnum() throws Exception {
runTest("compiler/testData/codegen/box/when/whenSubjectVariable/whenByEnum.kt");
}
@TestMetadata("whenByNullableEnum.kt")
public void testWhenByNullableEnum() throws Exception {
runTest("compiler/testData/codegen/box/when/whenSubjectVariable/whenByNullableEnum.kt");
}
@TestMetadata("whenByString.kt")
public void testWhenByString() throws Exception {
runTest("compiler/testData/codegen/box/when/whenSubjectVariable/whenByString.kt");
}
}
}
}
@@ -19542,6 +19542,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
public void testStatement() throws Exception {
runTest("compiler/testData/codegen/box/when/stringOptimization/statement.kt");
}
@TestMetadata("temporaryVarInWhenByStringIsDisposedProperly.kt")
public void testTemporaryVarInWhenByStringIsDisposedProperly() throws Exception {
runTest("compiler/testData/codegen/box/when/stringOptimization/temporaryVarInWhenByStringIsDisposedProperly.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/when/whenSubjectVariable")
@@ -19561,6 +19566,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/when/whenSubjectVariable/captureSubjectVariable.kt");
}
@TestMetadata("denseIntSwitchWithSubjectVariable.kt")
public void testDenseIntSwitchWithSubjectVariable() throws Exception {
runTest("compiler/testData/codegen/box/when/whenSubjectVariable/denseIntSwitchWithSubjectVariable.kt");
}
@TestMetadata("equalityWithSubjectVariable.kt")
public void testEqualityWithSubjectVariable() throws Exception {
runTest("compiler/testData/codegen/box/when/whenSubjectVariable/equalityWithSubjectVariable.kt");
@@ -19585,6 +19595,26 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
public void testRangeCheckOnSubjectVariable() throws Exception {
runTest("compiler/testData/codegen/box/when/whenSubjectVariable/rangeCheckOnSubjectVariable.kt");
}
@TestMetadata("sparseIntSwitchWithSubjectVariable.kt")
public void testSparseIntSwitchWithSubjectVariable() throws Exception {
runTest("compiler/testData/codegen/box/when/whenSubjectVariable/sparseIntSwitchWithSubjectVariable.kt");
}
@TestMetadata("whenByEnum.kt")
public void testWhenByEnum() throws Exception {
runTest("compiler/testData/codegen/box/when/whenSubjectVariable/whenByEnum.kt");
}
@TestMetadata("whenByNullableEnum.kt")
public void testWhenByNullableEnum() throws Exception {
runTest("compiler/testData/codegen/box/when/whenSubjectVariable/whenByNullableEnum.kt");
}
@TestMetadata("whenByString.kt")
public void testWhenByString() throws Exception {
runTest("compiler/testData/codegen/box/when/whenSubjectVariable/whenByString.kt");
}
}
}
}