From 9809230089c966bc1f88dbedd2f00fda57d5acc4 Mon Sep 17 00:00:00 2001 From: Francesco Protopapa Date: Thu, 14 Nov 2024 14:27:16 +0100 Subject: [PATCH] [Tests] Drop tests using `isInitialized` on a property from another file In 1.9 `lateinit` access behavior was unified across JVM, JS, and Native with `NativeJsProhibitLateinitIsInitializedIntrinsicWithoutPrivateAccess`. Recent lowerings changes now modify `lateinit` declarations outside their file, causing validation errors on Native. Since Native became stable in 1.9.20 and for stable Native disabling old features is not supported, these tests can be dropped for Native. ^KT-71141 Fixed --- ...LFirBlackBoxCodegenBasedTestGenerated.java | 6 ----- ...rsedBlackBoxCodegenBasedTestGenerated.java | 6 ----- .../isInitializedMultiFile.kt | 3 ++- .../topLevelPropertyMultiModule.kt | 22 ------------------- ...nBoxWithInlinedFunInKlibTestGenerated.java | 6 ----- ...veUnboundIrSerializationTestGenerated.java | 6 ----- .../FirNativeCodegenBoxTestGenerated.java | 6 ----- .../FirNativeCodegenBoxTestNoPLGenerated.java | 6 ----- .../NativeCodegenBoxTestGenerated.java | 6 ----- .../NativeCodegenBoxTestNoPLGenerated.java | 6 ----- 10 files changed, 2 insertions(+), 71 deletions(-) delete mode 100644 compiler/testData/codegen/box/properties/lateinit/isInitializedAndDeinitialize/topLevelPropertyMultiModule.kt diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirBlackBoxCodegenBasedTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirBlackBoxCodegenBasedTestGenerated.java index 8bd335cb43208..a764baa636ddd 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirBlackBoxCodegenBasedTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirBlackBoxCodegenBasedTestGenerated.java @@ -44523,12 +44523,6 @@ public void testSimpleIsInitialized() { public void testTopLevelProperty() { runTest("compiler/testData/codegen/box/properties/lateinit/isInitializedAndDeinitialize/topLevelProperty.kt"); } - - @Test - @TestMetadata("topLevelPropertyMultiModule.kt") - public void testTopLevelPropertyMultiModule() { - runTest("compiler/testData/codegen/box/properties/lateinit/isInitializedAndDeinitialize/topLevelPropertyMultiModule.kt"); - } } @Nested diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirReversedBlackBoxCodegenBasedTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirReversedBlackBoxCodegenBasedTestGenerated.java index 7b2727ad7f4e3..ff144e7e06734 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirReversedBlackBoxCodegenBasedTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirReversedBlackBoxCodegenBasedTestGenerated.java @@ -44523,12 +44523,6 @@ public void testSimpleIsInitialized() { public void testTopLevelProperty() { runTest("compiler/testData/codegen/box/properties/lateinit/isInitializedAndDeinitialize/topLevelProperty.kt"); } - - @Test - @TestMetadata("topLevelPropertyMultiModule.kt") - public void testTopLevelPropertyMultiModule() { - runTest("compiler/testData/codegen/box/properties/lateinit/isInitializedAndDeinitialize/topLevelPropertyMultiModule.kt"); - } } @Nested diff --git a/compiler/testData/codegen/box/properties/lateinit/isInitializedAndDeinitialize/isInitializedMultiFile.kt b/compiler/testData/codegen/box/properties/lateinit/isInitializedAndDeinitialize/isInitializedMultiFile.kt index eaa530538a4d4..d4f5061cc055f 100644 --- a/compiler/testData/codegen/box/properties/lateinit/isInitializedAndDeinitialize/isInitializedMultiFile.kt +++ b/compiler/testData/codegen/box/properties/lateinit/isInitializedAndDeinitialize/isInitializedMultiFile.kt @@ -1,7 +1,8 @@ // LANGUAGE: -NativeJsProhibitLateinitIsInitializedIntrinsicWithoutPrivateAccess // WITH_STDLIB // On JVM, isInitialized on a property from another file is forbidden because lateinit-ness is not included in the an ABI of a property. -// IGNORE_BACKEND_K1: JVM, JVM_IR +// Native became stable in 1.9.20 while `NativeJsProhibitLateinitIsInitializedIntrinsicWithoutPrivateAccess` was introduced in 1.9. Disabling old features in stable Native is not supported. +// IGNORE_BACKEND_K1: JVM, JVM_IR, NATIVE // In K2, isInitialized on a property from another file is forbidden for all backends. // IGNORE_BACKEND_K2: ANY // IGNORE_LIGHT_ANALYSIS diff --git a/compiler/testData/codegen/box/properties/lateinit/isInitializedAndDeinitialize/topLevelPropertyMultiModule.kt b/compiler/testData/codegen/box/properties/lateinit/isInitializedAndDeinitialize/topLevelPropertyMultiModule.kt deleted file mode 100644 index a433b0abff980..0000000000000 --- a/compiler/testData/codegen/box/properties/lateinit/isInitializedAndDeinitialize/topLevelPropertyMultiModule.kt +++ /dev/null @@ -1,22 +0,0 @@ -// TARGET_BACKEND: NATIVE -// In K2, isInitialized on a property from another file is forbidden for all backends. -// IGNORE_BACKEND_K2: NATIVE -// LANGUAGE: -NativeJsProhibitLateinitIsInitializedIntrinsicWithoutPrivateAccess -// WITH_STDLIB - -// MODULE: lib -// FILE: lib.kt -package lib - -lateinit var bar: String - -// MODULE: main(lib) -// FILE: box.kt -import lib.* - -fun box(): String { - if (::bar.isInitialized) return "Fail 1" - bar = "OK" - if (!::bar.isInitialized) return "Fail 2" - return bar -} diff --git a/native/native.tests/klib-ir-inliner/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxWithInlinedFunInKlibTestGenerated.java b/native/native.tests/klib-ir-inliner/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxWithInlinedFunInKlibTestGenerated.java index 585fdb4491733..0c6d3b67cedb2 100644 --- a/native/native.tests/klib-ir-inliner/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxWithInlinedFunInKlibTestGenerated.java +++ b/native/native.tests/klib-ir-inliner/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxWithInlinedFunInKlibTestGenerated.java @@ -35526,12 +35526,6 @@ public void testSideEffects() { public void testTopLevelProperty() { runTest("compiler/testData/codegen/box/properties/lateinit/isInitializedAndDeinitialize/topLevelProperty.kt"); } - - @Test - @TestMetadata("topLevelPropertyMultiModule.kt") - public void testTopLevelPropertyMultiModule() { - runTest("compiler/testData/codegen/box/properties/lateinit/isInitializedAndDeinitialize/topLevelPropertyMultiModule.kt"); - } } @Nested diff --git a/native/native.tests/klib-ir-inliner/tests-gen/org/jetbrains/kotlin/konan/test/inlining/NativeUnboundIrSerializationTestGenerated.java b/native/native.tests/klib-ir-inliner/tests-gen/org/jetbrains/kotlin/konan/test/inlining/NativeUnboundIrSerializationTestGenerated.java index 111144e2aee3e..7b15b5e16da5e 100644 --- a/native/native.tests/klib-ir-inliner/tests-gen/org/jetbrains/kotlin/konan/test/inlining/NativeUnboundIrSerializationTestGenerated.java +++ b/native/native.tests/klib-ir-inliner/tests-gen/org/jetbrains/kotlin/konan/test/inlining/NativeUnboundIrSerializationTestGenerated.java @@ -33315,12 +33315,6 @@ public void testSideEffects() { public void testTopLevelProperty() { runTest("compiler/testData/codegen/box/properties/lateinit/isInitializedAndDeinitialize/topLevelProperty.kt"); } - - @Test - @TestMetadata("topLevelPropertyMultiModule.kt") - public void testTopLevelPropertyMultiModule() { - runTest("compiler/testData/codegen/box/properties/lateinit/isInitializedAndDeinitialize/topLevelPropertyMultiModule.kt"); - } } @Nested diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestGenerated.java index 5d953314be5bc..83d8574efd900 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestGenerated.java @@ -35144,12 +35144,6 @@ public void testSideEffects() { public void testTopLevelProperty() { runTest("compiler/testData/codegen/box/properties/lateinit/isInitializedAndDeinitialize/topLevelProperty.kt"); } - - @Test - @TestMetadata("topLevelPropertyMultiModule.kt") - public void testTopLevelPropertyMultiModule() { - runTest("compiler/testData/codegen/box/properties/lateinit/isInitializedAndDeinitialize/topLevelPropertyMultiModule.kt"); - } } @Nested diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestNoPLGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestNoPLGenerated.java index e11a9cd70beeb..938b9b85f6de8 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestNoPLGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestNoPLGenerated.java @@ -35910,12 +35910,6 @@ public void testSideEffects() { public void testTopLevelProperty() { runTest("compiler/testData/codegen/box/properties/lateinit/isInitializedAndDeinitialize/topLevelProperty.kt"); } - - @Test - @TestMetadata("topLevelPropertyMultiModule.kt") - public void testTopLevelPropertyMultiModule() { - runTest("compiler/testData/codegen/box/properties/lateinit/isInitializedAndDeinitialize/topLevelPropertyMultiModule.kt"); - } } @Nested diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestGenerated.java index 19072c4ce73ff..2c2ebecbe38d2 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestGenerated.java @@ -33736,12 +33736,6 @@ public void testSideEffects() { public void testTopLevelProperty() { runTest("compiler/testData/codegen/box/properties/lateinit/isInitializedAndDeinitialize/topLevelProperty.kt"); } - - @Test - @TestMetadata("topLevelPropertyMultiModule.kt") - public void testTopLevelPropertyMultiModule() { - runTest("compiler/testData/codegen/box/properties/lateinit/isInitializedAndDeinitialize/topLevelPropertyMultiModule.kt"); - } } @Nested diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestNoPLGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestNoPLGenerated.java index 80ee18d6efbd6..5620af41066b0 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestNoPLGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestNoPLGenerated.java @@ -34491,12 +34491,6 @@ public void testSideEffects() { public void testTopLevelProperty() { runTest("compiler/testData/codegen/box/properties/lateinit/isInitializedAndDeinitialize/topLevelProperty.kt"); } - - @Test - @TestMetadata("topLevelPropertyMultiModule.kt") - public void testTopLevelPropertyMultiModule() { - runTest("compiler/testData/codegen/box/properties/lateinit/isInitializedAndDeinitialize/topLevelPropertyMultiModule.kt"); - } } @Nested