Support non local return generation, support non local return inlining
This commit is contained in:
@@ -90,12 +90,12 @@ public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void doTestMultiFileWithInlineCheck(@NotNull String firstFileName) {
|
||||
firstFileName = firstFileName.substring("compiler/testData/codegen/".length());
|
||||
List<String> ifiles = new ArrayList<String>(2);
|
||||
ifiles.add(firstFileName);
|
||||
ifiles.add(firstFileName.substring(0, firstFileName.length() - "1.kt".length()) + "2.kt");
|
||||
firstFileName = relativePath(new File(firstFileName));
|
||||
List<String> inputFiles = new ArrayList<String>(2);
|
||||
inputFiles.add(firstFileName);
|
||||
inputFiles.add(firstFileName.substring(0, firstFileName.length() - "1.kt".length()) + "2.kt");
|
||||
|
||||
doTestMultiFile(ifiles);
|
||||
doTestMultiFile(inputFiles);
|
||||
InlineTestUtil.checkNoCallsToInline(initializedClassLoader.getAllGeneratedFiles());
|
||||
}
|
||||
|
||||
|
||||
+84
-1
@@ -31,7 +31,7 @@ import org.jetbrains.jet.codegen.generated.AbstractBlackBoxCodegenTest;
|
||||
/** This class is generated by {@link org.jetbrains.jet.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("compiler/testData/codegen/boxInline")
|
||||
@InnerTestClasses({BlackBoxInlineCodegenTestGenerated.AnonymousObject.class, BlackBoxInlineCodegenTestGenerated.Builders.class, BlackBoxInlineCodegenTestGenerated.Capture.class, BlackBoxInlineCodegenTestGenerated.Complex.class, BlackBoxInlineCodegenTestGenerated.DefaultValues.class, BlackBoxInlineCodegenTestGenerated.LambdaClassClash.class, BlackBoxInlineCodegenTestGenerated.LambdaTransformation.class, BlackBoxInlineCodegenTestGenerated.LocalFunInLambda.class, BlackBoxInlineCodegenTestGenerated.NoInline.class, BlackBoxInlineCodegenTestGenerated.Simple.class, BlackBoxInlineCodegenTestGenerated.Special.class, BlackBoxInlineCodegenTestGenerated.Trait.class, BlackBoxInlineCodegenTestGenerated.TryCatchFinally.class})
|
||||
@InnerTestClasses({BlackBoxInlineCodegenTestGenerated.AnonymousObject.class, BlackBoxInlineCodegenTestGenerated.Builders.class, BlackBoxInlineCodegenTestGenerated.Capture.class, BlackBoxInlineCodegenTestGenerated.Complex.class, BlackBoxInlineCodegenTestGenerated.DefaultValues.class, BlackBoxInlineCodegenTestGenerated.LambdaClassClash.class, BlackBoxInlineCodegenTestGenerated.LambdaTransformation.class, BlackBoxInlineCodegenTestGenerated.LocalFunInLambda.class, BlackBoxInlineCodegenTestGenerated.NoInline.class, BlackBoxInlineCodegenTestGenerated.NonLocalReturns.class, BlackBoxInlineCodegenTestGenerated.Simple.class, BlackBoxInlineCodegenTestGenerated.Special.class, BlackBoxInlineCodegenTestGenerated.Trait.class, BlackBoxInlineCodegenTestGenerated.TryCatchFinally.class})
|
||||
public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
public void testAllFilesPresentInBoxInline() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/codegen/boxInline"), Pattern.compile("^(.+)\\.1.kt$"), true);
|
||||
@@ -269,6 +269,88 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxCodegenT
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/nonLocalReturns")
|
||||
@InnerTestClasses({NonLocalReturns.Deparenthesize.class, NonLocalReturns.TryFinally.class})
|
||||
public static class NonLocalReturns extends AbstractBlackBoxCodegenTest {
|
||||
public void testAllFilesPresentInNonLocalReturns() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/codegen/boxInline/nonLocalReturns"), Pattern.compile("^(.+)\\.1.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("explicitLocalReturn.1.kt")
|
||||
public void testExplicitLocalReturn() throws Exception {
|
||||
doTestMultiFileWithInlineCheck("compiler/testData/codegen/boxInline/nonLocalReturns/explicitLocalReturn.1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("justReturnInLambda.1.kt")
|
||||
public void testJustReturnInLambda() throws Exception {
|
||||
doTestMultiFileWithInlineCheck("compiler/testData/codegen/boxInline/nonLocalReturns/justReturnInLambda.1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nestedNonLocals.1.kt")
|
||||
public void testNestedNonLocals() throws Exception {
|
||||
doTestMultiFileWithInlineCheck("compiler/testData/codegen/boxInline/nonLocalReturns/nestedNonLocals.1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noInlineLocalReturn.1.kt")
|
||||
public void testNoInlineLocalReturn() throws Exception {
|
||||
doTestMultiFileWithInlineCheck("compiler/testData/codegen/boxInline/nonLocalReturns/noInlineLocalReturn.1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("propertyAccessors.1.kt")
|
||||
public void testPropertyAccessors() throws Exception {
|
||||
doTestMultiFileWithInlineCheck("compiler/testData/codegen/boxInline/nonLocalReturns/propertyAccessors.1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple.1.kt")
|
||||
public void testSimple() throws Exception {
|
||||
doTestMultiFileWithInlineCheck("compiler/testData/codegen/boxInline/nonLocalReturns/simple.1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleVoid.1.kt")
|
||||
public void testSimpleVoid() throws Exception {
|
||||
doTestMultiFileWithInlineCheck("compiler/testData/codegen/boxInline/nonLocalReturns/simpleVoid.1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/nonLocalReturns/deparenthesize")
|
||||
public static class Deparenthesize extends AbstractBlackBoxCodegenTest {
|
||||
public void testAllFilesPresentInDeparenthesize() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/codegen/boxInline/nonLocalReturns/deparenthesize"), Pattern.compile("^(.+)\\.1.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("bracket.1.kt")
|
||||
public void testBracket() throws Exception {
|
||||
doTestMultiFileWithInlineCheck("compiler/testData/codegen/boxInline/nonLocalReturns/deparenthesize/bracket.1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("labeled.1.kt")
|
||||
public void testLabeled() throws Exception {
|
||||
doTestMultiFileWithInlineCheck("compiler/testData/codegen/boxInline/nonLocalReturns/deparenthesize/labeled.1.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally")
|
||||
public static class TryFinally extends AbstractBlackBoxCodegenTest {
|
||||
public void testAllFilesPresentInTryFinally() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally"), Pattern.compile("^(.+)\\.1.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("external.1.kt")
|
||||
public void testExternal() throws Exception {
|
||||
doTestMultiFileWithInlineCheck("compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/external.1.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Test innerSuite() {
|
||||
TestSuite suite = new TestSuite("NonLocalReturns");
|
||||
suite.addTestSuite(NonLocalReturns.class);
|
||||
suite.addTestSuite(Deparenthesize.class);
|
||||
suite.addTestSuite(TryFinally.class);
|
||||
return suite;
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/simple")
|
||||
public static class Simple extends AbstractBlackBoxCodegenTest {
|
||||
public void testAllFilesPresentInSimple() throws Exception {
|
||||
@@ -428,6 +510,7 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxCodegenT
|
||||
suite.addTestSuite(LambdaTransformation.class);
|
||||
suite.addTestSuite(LocalFunInLambda.class);
|
||||
suite.addTestSuite(NoInline.class);
|
||||
suite.addTest(NonLocalReturns.innerSuite());
|
||||
suite.addTestSuite(Simple.class);
|
||||
suite.addTestSuite(Special.class);
|
||||
suite.addTestSuite(Trait.class);
|
||||
|
||||
+4
-4
@@ -65,11 +65,11 @@ public abstract class AbstractCompileKotlinAgainstKotlinTest extends TestCaseWit
|
||||
}
|
||||
|
||||
public void doBoxTestWithInlineCheck(@NotNull String firstFileName) throws Exception {
|
||||
List<String> ifiles = new ArrayList<String>(2);
|
||||
ifiles.add(firstFileName);
|
||||
ifiles.add(firstFileName.substring(0, firstFileName.length() - "1.kt".length()) + "2.kt");
|
||||
List<String> inputFiles = new ArrayList<String>(2);
|
||||
inputFiles.add(firstFileName);
|
||||
inputFiles.add(firstFileName.substring(0, firstFileName.length() - "1.kt".length()) + "2.kt");
|
||||
|
||||
ArrayList<OutputFile> files = doBoxTest(ifiles);
|
||||
ArrayList<OutputFile> files = doBoxTest(inputFiles);
|
||||
InlineTestUtil.checkNoCallsToInline(files);
|
||||
}
|
||||
|
||||
|
||||
+84
-1
@@ -31,7 +31,7 @@ import org.jetbrains.jet.jvm.compiler.AbstractCompileKotlinAgainstKotlinTest;
|
||||
/** This class is generated by {@link org.jetbrains.jet.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("compiler/testData/codegen/boxInline")
|
||||
@InnerTestClasses({CompileKotlinAgainstInlineKotlinTestGenerated.AnonymousObject.class, CompileKotlinAgainstInlineKotlinTestGenerated.Builders.class, CompileKotlinAgainstInlineKotlinTestGenerated.Capture.class, CompileKotlinAgainstInlineKotlinTestGenerated.Complex.class, CompileKotlinAgainstInlineKotlinTestGenerated.DefaultValues.class, CompileKotlinAgainstInlineKotlinTestGenerated.LambdaClassClash.class, CompileKotlinAgainstInlineKotlinTestGenerated.LambdaTransformation.class, CompileKotlinAgainstInlineKotlinTestGenerated.LocalFunInLambda.class, CompileKotlinAgainstInlineKotlinTestGenerated.NoInline.class, CompileKotlinAgainstInlineKotlinTestGenerated.Simple.class, CompileKotlinAgainstInlineKotlinTestGenerated.Special.class, CompileKotlinAgainstInlineKotlinTestGenerated.Trait.class, CompileKotlinAgainstInlineKotlinTestGenerated.TryCatchFinally.class})
|
||||
@InnerTestClasses({CompileKotlinAgainstInlineKotlinTestGenerated.AnonymousObject.class, CompileKotlinAgainstInlineKotlinTestGenerated.Builders.class, CompileKotlinAgainstInlineKotlinTestGenerated.Capture.class, CompileKotlinAgainstInlineKotlinTestGenerated.Complex.class, CompileKotlinAgainstInlineKotlinTestGenerated.DefaultValues.class, CompileKotlinAgainstInlineKotlinTestGenerated.LambdaClassClash.class, CompileKotlinAgainstInlineKotlinTestGenerated.LambdaTransformation.class, CompileKotlinAgainstInlineKotlinTestGenerated.LocalFunInLambda.class, CompileKotlinAgainstInlineKotlinTestGenerated.NoInline.class, CompileKotlinAgainstInlineKotlinTestGenerated.NonLocalReturns.class, CompileKotlinAgainstInlineKotlinTestGenerated.Simple.class, CompileKotlinAgainstInlineKotlinTestGenerated.Special.class, CompileKotlinAgainstInlineKotlinTestGenerated.Trait.class, CompileKotlinAgainstInlineKotlinTestGenerated.TryCatchFinally.class})
|
||||
public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompileKotlinAgainstKotlinTest {
|
||||
public void testAllFilesPresentInBoxInline() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/codegen/boxInline"), Pattern.compile("^(.+)\\.1.kt$"), true);
|
||||
@@ -269,6 +269,88 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/nonLocalReturns")
|
||||
@InnerTestClasses({NonLocalReturns.Deparenthesize.class, NonLocalReturns.TryFinally.class})
|
||||
public static class NonLocalReturns extends AbstractCompileKotlinAgainstKotlinTest {
|
||||
public void testAllFilesPresentInNonLocalReturns() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/codegen/boxInline/nonLocalReturns"), Pattern.compile("^(.+)\\.1.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("explicitLocalReturn.1.kt")
|
||||
public void testExplicitLocalReturn() throws Exception {
|
||||
doBoxTestWithInlineCheck("compiler/testData/codegen/boxInline/nonLocalReturns/explicitLocalReturn.1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("justReturnInLambda.1.kt")
|
||||
public void testJustReturnInLambda() throws Exception {
|
||||
doBoxTestWithInlineCheck("compiler/testData/codegen/boxInline/nonLocalReturns/justReturnInLambda.1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nestedNonLocals.1.kt")
|
||||
public void testNestedNonLocals() throws Exception {
|
||||
doBoxTestWithInlineCheck("compiler/testData/codegen/boxInline/nonLocalReturns/nestedNonLocals.1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noInlineLocalReturn.1.kt")
|
||||
public void testNoInlineLocalReturn() throws Exception {
|
||||
doBoxTestWithInlineCheck("compiler/testData/codegen/boxInline/nonLocalReturns/noInlineLocalReturn.1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("propertyAccessors.1.kt")
|
||||
public void testPropertyAccessors() throws Exception {
|
||||
doBoxTestWithInlineCheck("compiler/testData/codegen/boxInline/nonLocalReturns/propertyAccessors.1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple.1.kt")
|
||||
public void testSimple() throws Exception {
|
||||
doBoxTestWithInlineCheck("compiler/testData/codegen/boxInline/nonLocalReturns/simple.1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleVoid.1.kt")
|
||||
public void testSimpleVoid() throws Exception {
|
||||
doBoxTestWithInlineCheck("compiler/testData/codegen/boxInline/nonLocalReturns/simpleVoid.1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/nonLocalReturns/deparenthesize")
|
||||
public static class Deparenthesize extends AbstractCompileKotlinAgainstKotlinTest {
|
||||
public void testAllFilesPresentInDeparenthesize() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/codegen/boxInline/nonLocalReturns/deparenthesize"), Pattern.compile("^(.+)\\.1.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("bracket.1.kt")
|
||||
public void testBracket() throws Exception {
|
||||
doBoxTestWithInlineCheck("compiler/testData/codegen/boxInline/nonLocalReturns/deparenthesize/bracket.1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("labeled.1.kt")
|
||||
public void testLabeled() throws Exception {
|
||||
doBoxTestWithInlineCheck("compiler/testData/codegen/boxInline/nonLocalReturns/deparenthesize/labeled.1.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally")
|
||||
public static class TryFinally extends AbstractCompileKotlinAgainstKotlinTest {
|
||||
public void testAllFilesPresentInTryFinally() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally"), Pattern.compile("^(.+)\\.1.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("external.1.kt")
|
||||
public void testExternal() throws Exception {
|
||||
doBoxTestWithInlineCheck("compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/external.1.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Test innerSuite() {
|
||||
TestSuite suite = new TestSuite("NonLocalReturns");
|
||||
suite.addTestSuite(NonLocalReturns.class);
|
||||
suite.addTestSuite(Deparenthesize.class);
|
||||
suite.addTestSuite(TryFinally.class);
|
||||
return suite;
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/simple")
|
||||
public static class Simple extends AbstractCompileKotlinAgainstKotlinTest {
|
||||
public void testAllFilesPresentInSimple() throws Exception {
|
||||
@@ -428,6 +510,7 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
|
||||
suite.addTestSuite(LambdaTransformation.class);
|
||||
suite.addTestSuite(LocalFunInLambda.class);
|
||||
suite.addTestSuite(NoInline.class);
|
||||
suite.addTest(NonLocalReturns.innerSuite());
|
||||
suite.addTestSuite(Simple.class);
|
||||
suite.addTestSuite(Special.class);
|
||||
suite.addTestSuite(Trait.class);
|
||||
|
||||
Reference in New Issue
Block a user