From 15c41b261020317ec2415ce2b43a3cc04dcaf62d Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Tue, 10 Aug 2021 15:02:35 +0300 Subject: [PATCH] JVM_IR KT-47984 add test for argument reordering --- .../FirBlackBoxInlineCodegenTestGenerated.java | 16 ++++++++++++++++ .../callArgumentReordering.kt | 17 +++++++++++++++++ .../BlackBoxInlineCodegenTestGenerated.java | 16 ++++++++++++++++ ...KotlinAgainstInlineKotlinTestGenerated.java | 16 ++++++++++++++++ .../IrBlackBoxInlineCodegenTestGenerated.java | 16 ++++++++++++++++ ...KotlinAgainstInlineKotlinTestGenerated.java | 16 ++++++++++++++++ ...KotlinAgainstInlineKotlinTestGenerated.java | 16 ++++++++++++++++ .../JvmIrAgainstOldBoxInlineTestGenerated.java | 16 ++++++++++++++++ .../JvmOldAgainstIrBoxInlineTestGenerated.java | 16 ++++++++++++++++ .../IrJsCodegenInlineES6TestGenerated.java | 18 ++++++++++++++++++ .../IrJsCodegenInlineTestGenerated.java | 18 ++++++++++++++++++ .../JsCodegenInlineTestGenerated.java | 18 ++++++++++++++++++ 12 files changed, 199 insertions(+) create mode 100644 compiler/testData/codegen/boxInline/inlineArgsInplace/callArgumentReordering.kt diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxInlineCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxInlineCodegenTestGenerated.java index 4e3088a4628..50e1878ff91 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxInlineCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxInlineCodegenTestGenerated.java @@ -2311,6 +2311,22 @@ public class FirBlackBoxInlineCodegenTestGenerated extends AbstractFirBlackBoxIn } } + @Nested + @TestMetadata("compiler/testData/codegen/boxInline/inlineArgsInplace") + @TestDataPath("$PROJECT_ROOT") + public class InlineArgsInplace { + @Test + public void testAllFilesPresentInInlineArgsInplace() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineArgsInplace"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("callArgumentReordering.kt") + public void testCallArgumentReordering() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineArgsInplace/callArgumentReordering.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/testData/codegen/boxInline/inlineArgsInplace/callArgumentReordering.kt b/compiler/testData/codegen/boxInline/inlineArgsInplace/callArgumentReordering.kt new file mode 100644 index 00000000000..92618361779 --- /dev/null +++ b/compiler/testData/codegen/boxInline/inlineArgsInplace/callArgumentReordering.kt @@ -0,0 +1,17 @@ +// WITH_RUNTIME +// NO_CHECK_LAMBDA_INLINING + +// FILE: 1.kt +var s = "" + +@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") +@kotlin.internal.InlineOnly +inline fun foo(s1: String, s2: String) = s1 + s2 + +// FILE: 2.kt +fun box(): String { + val t = foo(s2 = { s += "O"; "K" }(), s1 = { s += "K"; "O" }()) + if (t != "OK") return "Failed: t=$t" + if (s != "OK") return "Failed: s=$s" + return "OK" +} diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxInlineCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxInlineCodegenTestGenerated.java index d473ad01024..80816e222ad 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxInlineCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxInlineCodegenTestGenerated.java @@ -2299,6 +2299,22 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo } } + @Nested + @TestMetadata("compiler/testData/codegen/boxInline/inlineArgsInplace") + @TestDataPath("$PROJECT_ROOT") + public class InlineArgsInplace { + @Test + public void testAllFilesPresentInInlineArgsInplace() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineArgsInplace"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @Test + @TestMetadata("callArgumentReordering.kt") + public void testCallArgumentReordering() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineArgsInplace/callArgumentReordering.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java index 8410fc4669a..654dc12d9d4 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java @@ -2299,6 +2299,22 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi } } + @Nested + @TestMetadata("compiler/testData/codegen/boxInline/inlineArgsInplace") + @TestDataPath("$PROJECT_ROOT") + public class InlineArgsInplace { + @Test + public void testAllFilesPresentInInlineArgsInplace() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineArgsInplace"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @Test + @TestMetadata("callArgumentReordering.kt") + public void testCallArgumentReordering() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineArgsInplace/callArgumentReordering.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxInlineCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxInlineCodegenTestGenerated.java index faf6bd89bd0..3e0e8b91b95 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxInlineCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxInlineCodegenTestGenerated.java @@ -2311,6 +2311,22 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli } } + @Nested + @TestMetadata("compiler/testData/codegen/boxInline/inlineArgsInplace") + @TestDataPath("$PROJECT_ROOT") + public class InlineArgsInplace { + @Test + public void testAllFilesPresentInInlineArgsInplace() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineArgsInplace"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("callArgumentReordering.kt") + public void testCallArgumentReordering() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineArgsInplace/callArgumentReordering.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrCompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrCompileKotlinAgainstInlineKotlinTestGenerated.java index 5b66d051e88..9f402eb71d0 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrCompileKotlinAgainstInlineKotlinTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrCompileKotlinAgainstInlineKotlinTestGenerated.java @@ -2311,6 +2311,22 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC } } + @Nested + @TestMetadata("compiler/testData/codegen/boxInline/inlineArgsInplace") + @TestDataPath("$PROJECT_ROOT") + public class InlineArgsInplace { + @Test + public void testAllFilesPresentInInlineArgsInplace() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineArgsInplace"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("callArgumentReordering.kt") + public void testCallArgumentReordering() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineArgsInplace/callArgumentReordering.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java index e390242d60a..4a9170f0410 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java @@ -2311,6 +2311,22 @@ public class IrSerializeCompileKotlinAgainstInlineKotlinTestGenerated extends Ab } } + @Nested + @TestMetadata("compiler/testData/codegen/boxInline/inlineArgsInplace") + @TestDataPath("$PROJECT_ROOT") + public class InlineArgsInplace { + @Test + public void testAllFilesPresentInInlineArgsInplace() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineArgsInplace"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("callArgumentReordering.kt") + public void testCallArgumentReordering() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineArgsInplace/callArgumentReordering.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmIrAgainstOldBoxInlineTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmIrAgainstOldBoxInlineTestGenerated.java index cfdc2b3d82e..a1c1bebdb1a 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmIrAgainstOldBoxInlineTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmIrAgainstOldBoxInlineTestGenerated.java @@ -2311,6 +2311,22 @@ public class JvmIrAgainstOldBoxInlineTestGenerated extends AbstractJvmIrAgainstO } } + @Nested + @TestMetadata("compiler/testData/codegen/boxInline/inlineArgsInplace") + @TestDataPath("$PROJECT_ROOT") + public class InlineArgsInplace { + @Test + public void testAllFilesPresentInInlineArgsInplace() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineArgsInplace"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_MULTI_MODULE_IR_AGAINST_OLD, true); + } + + @Test + @TestMetadata("callArgumentReordering.kt") + public void testCallArgumentReordering() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineArgsInplace/callArgumentReordering.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmOldAgainstIrBoxInlineTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmOldAgainstIrBoxInlineTestGenerated.java index 483d1bebf73..d0a25b25509 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmOldAgainstIrBoxInlineTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmOldAgainstIrBoxInlineTestGenerated.java @@ -2299,6 +2299,22 @@ public class JvmOldAgainstIrBoxInlineTestGenerated extends AbstractJvmOldAgainst } } + @Nested + @TestMetadata("compiler/testData/codegen/boxInline/inlineArgsInplace") + @TestDataPath("$PROJECT_ROOT") + public class InlineArgsInplace { + @Test + public void testAllFilesPresentInInlineArgsInplace() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineArgsInplace"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR, true); + } + + @Test + @TestMetadata("callArgumentReordering.kt") + public void testCallArgumentReordering() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineArgsInplace/callArgumentReordering.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses") @TestDataPath("$PROJECT_ROOT") diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java index f6c5af42fe1..b0dbfc75f09 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java @@ -1826,6 +1826,24 @@ public class IrJsCodegenInlineES6TestGenerated extends AbstractIrJsCodegenInline } } + @TestMetadata("compiler/testData/codegen/boxInline/inlineArgsInplace") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class InlineArgsInplace extends AbstractIrJsCodegenInlineES6Test { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); + } + + public void testAllFilesPresentInInlineArgsInplace() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineArgsInplace"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); + } + + @TestMetadata("callArgumentReordering.kt") + public void testCallArgumentReordering() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineArgsInplace/callArgumentReordering.kt"); + } + } + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java index 54deeb93221..cf2dd8bc90d 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java @@ -1826,6 +1826,24 @@ public class IrJsCodegenInlineTestGenerated extends AbstractIrJsCodegenInlineTes } } + @TestMetadata("compiler/testData/codegen/boxInline/inlineArgsInplace") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class InlineArgsInplace extends AbstractIrJsCodegenInlineTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); + } + + public void testAllFilesPresentInInlineArgsInplace() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineArgsInplace"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + + @TestMetadata("callArgumentReordering.kt") + public void testCallArgumentReordering() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineArgsInplace/callArgumentReordering.kt"); + } + } + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java index 558c4aa4828..753645e856b 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java @@ -1826,6 +1826,24 @@ public class JsCodegenInlineTestGenerated extends AbstractJsCodegenInlineTest { } } + @TestMetadata("compiler/testData/codegen/boxInline/inlineArgsInplace") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class InlineArgsInplace extends AbstractJsCodegenInlineTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); + } + + public void testAllFilesPresentInInlineArgsInplace() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/inlineArgsInplace"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); + } + + @TestMetadata("callArgumentReordering.kt") + public void testCallArgumentReordering() throws Exception { + runTest("compiler/testData/codegen/boxInline/inlineArgsInplace/callArgumentReordering.kt"); + } + } + @TestMetadata("compiler/testData/codegen/boxInline/inlineClasses") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class)