From 7dcdbf283b822505f7264868aae29ea705034a57 Mon Sep 17 00:00:00 2001 From: Igor Chevdar Date: Wed, 21 Apr 2021 17:25:38 +0500 Subject: [PATCH] [box-tests] Added test --- .../FirBlackBoxCodegenTestGenerated.java | 6 +++ .../box/enum/initEntriesInCompanionObject2.kt | 53 +++++++++++++++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 6 +++ .../IrBlackBoxCodegenTestGenerated.java | 6 +++ .../LightAnalysisModeTestGenerated.java | 5 ++ .../IrJsCodegenBoxES6TestGenerated.java | 5 ++ .../IrJsCodegenBoxTestGenerated.java | 5 ++ .../semantics/JsCodegenBoxTestGenerated.java | 5 ++ .../IrCodegenBoxWasmTestGenerated.java | 5 ++ 9 files changed, 96 insertions(+) create mode 100644 compiler/testData/codegen/box/enum/initEntriesInCompanionObject2.kt diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java index 6565c3d7d5f..b0eb588e4f7 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java @@ -14298,6 +14298,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/enum/initEntriesInCompanionObject.kt"); } + @Test + @TestMetadata("initEntriesInCompanionObject2.kt") + public void testInitEntriesInCompanionObject2() throws Exception { + runTest("compiler/testData/codegen/box/enum/initEntriesInCompanionObject2.kt"); + } + @Test @TestMetadata("initEntriesInValueOf.kt") public void testInitEntriesInValueOf() throws Exception { diff --git a/compiler/testData/codegen/box/enum/initEntriesInCompanionObject2.kt b/compiler/testData/codegen/box/enum/initEntriesInCompanionObject2.kt new file mode 100644 index 00000000000..7a8b0162e65 --- /dev/null +++ b/compiler/testData/codegen/box/enum/initEntriesInCompanionObject2.kt @@ -0,0 +1,53 @@ +// IGNORE_BACKEND: JS +// IGNORE_BACKEND: WASM + +var l = "" + +enum class Foo { + FOO, + BAR; + init { + l += "Foo.$name;" + } + + companion object { + init { + l += "Foo.CO;" + } + + val boo = 22 + } +} + +enum class Foo2 { + FOO, + BAR; + + init { + l += "Foo2.$name;" + } + + companion object { + init { + l += "Foo2.CO;" + } + + val boo = 22 + } +} + +fun box(): String { + try { + enumValueOf("NO") + } catch (e: Throwable) { + l += "caught;" + } + + if (l != "Foo.FOO;Foo.BAR;Foo.CO;caught;") return "Failure 0: l = $l" + + l = "" + enumValueOf("BAR") + if (l != "Foo2.FOO;Foo2.BAR;Foo2.CO;") return "Failure 1: l = $l" + + return "OK" +} \ No newline at end of file diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java index ae4d60c8b1d..33055ce4e0b 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java @@ -14298,6 +14298,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/enum/initEntriesInCompanionObject.kt"); } + @Test + @TestMetadata("initEntriesInCompanionObject2.kt") + public void testInitEntriesInCompanionObject2() throws Exception { + runTest("compiler/testData/codegen/box/enum/initEntriesInCompanionObject2.kt"); + } + @Test @TestMetadata("initEntriesInValueOf.kt") public void testInitEntriesInValueOf() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index d131e6e80f2..3de2da87981 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -14298,6 +14298,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/enum/initEntriesInCompanionObject.kt"); } + @Test + @TestMetadata("initEntriesInCompanionObject2.kt") + public void testInitEntriesInCompanionObject2() throws Exception { + runTest("compiler/testData/codegen/box/enum/initEntriesInCompanionObject2.kt"); + } + @Test @TestMetadata("initEntriesInValueOf.kt") public void testInitEntriesInValueOf() throws Exception { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 7768c6ed4b3..174a6965e67 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -11709,6 +11709,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/enum/initEntriesInCompanionObject.kt"); } + @TestMetadata("initEntriesInCompanionObject2.kt") + public void testInitEntriesInCompanionObject2() throws Exception { + runTest("compiler/testData/codegen/box/enum/initEntriesInCompanionObject2.kt"); + } + @TestMetadata("initEntriesInValueOf.kt") public void testInitEntriesInValueOf() throws Exception { runTest("compiler/testData/codegen/box/enum/initEntriesInValueOf.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index fbe6753b1a2..ded6681c749 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -10483,6 +10483,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/enum/initEntriesInCompanionObject.kt"); } + @TestMetadata("initEntriesInCompanionObject2.kt") + public void testInitEntriesInCompanionObject2() throws Exception { + runTest("compiler/testData/codegen/box/enum/initEntriesInCompanionObject2.kt"); + } + @TestMetadata("initEntriesInValueOf.kt") public void testInitEntriesInValueOf() throws Exception { runTest("compiler/testData/codegen/box/enum/initEntriesInValueOf.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 5d9b7a8b390..28f51f66285 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -9894,6 +9894,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/enum/initEntriesInCompanionObject.kt"); } + @TestMetadata("initEntriesInCompanionObject2.kt") + public void testInitEntriesInCompanionObject2() throws Exception { + runTest("compiler/testData/codegen/box/enum/initEntriesInCompanionObject2.kt"); + } + @TestMetadata("initEntriesInValueOf.kt") public void testInitEntriesInValueOf() throws Exception { runTest("compiler/testData/codegen/box/enum/initEntriesInValueOf.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 2e108c52d94..6353718e80f 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -9894,6 +9894,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/enum/initEntriesInCompanionObject.kt"); } + @TestMetadata("initEntriesInCompanionObject2.kt") + public void testInitEntriesInCompanionObject2() throws Exception { + runTest("compiler/testData/codegen/box/enum/initEntriesInCompanionObject2.kt"); + } + @TestMetadata("initEntriesInValueOf.kt") public void testInitEntriesInValueOf() throws Exception { runTest("compiler/testData/codegen/box/enum/initEntriesInValueOf.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index 72dbcda88cd..f37c35e53cf 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -4792,6 +4792,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest runTest("compiler/testData/codegen/box/enum/initEntriesInCompanionObject.kt"); } + @TestMetadata("initEntriesInCompanionObject2.kt") + public void testInitEntriesInCompanionObject2() throws Exception { + runTest("compiler/testData/codegen/box/enum/initEntriesInCompanionObject2.kt"); + } + @TestMetadata("initEntriesInValueOf.kt") public void testInitEntriesInValueOf() throws Exception { runTest("compiler/testData/codegen/box/enum/initEntriesInValueOf.kt");