From 0518b84b0b1497acaa6ca09588eb1b4677476fa8 Mon Sep 17 00:00:00 2001 From: Victor Petukhov Date: Tue, 15 Feb 2022 16:52:43 +0300 Subject: [PATCH] [FE] Remove unused `SoundSmartcastFromLoopConditionForLoopAssignedVariables` language feature --- ...CompilerTestFE10TestdataTestGenerated.java | 12 +++-------- ...irOldFrontendDiagnosticsTestGenerated.java | 12 +++-------- ...DiagnosticsWithLightTreeTestGenerated.java | 12 +++-------- ...whileWithAssertInConditionAndBreak.fir.kt} | 2 -- ... => whileWithAssertInConditionAndBreak.kt} | 2 -- ...=> whileWithAssertInConditionAndBreak.txt} | 0 ...WithAssertInConditionAndBreakBefore.fir.kt | 21 ------------------- ...hileWithAssertInConditionAndBreakBefore.kt | 21 ------------------- ...ileWithAssertInConditionAndBreakBefore.txt | 4 ---- .../test/runners/DiagnosticTestGenerated.java | 12 +++-------- .../kotlin/config/LanguageVersionSettings.kt | 3 --- 11 files changed, 12 insertions(+), 89 deletions(-) rename compiler/testData/diagnostics/tests/smartCasts/loops/{whileWithAssertInConditionAndBreakAfter.fir.kt => whileWithAssertInConditionAndBreak.fir.kt} (87%) rename compiler/testData/diagnostics/tests/smartCasts/loops/{whileWithAssertInConditionAndBreakAfter.kt => whileWithAssertInConditionAndBreak.kt} (88%) rename compiler/testData/diagnostics/tests/smartCasts/loops/{whileWithAssertInConditionAndBreakAfter.txt => whileWithAssertInConditionAndBreak.txt} (100%) delete mode 100644 compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakBefore.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakBefore.kt delete mode 100644 compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakBefore.txt diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java index f99712ba121..6dee0b68fe2 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java @@ -28996,15 +28996,9 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag } @Test - @TestMetadata("whileWithAssertInConditionAndBreakAfter.kt") - public void testWhileWithAssertInConditionAndBreakAfter() throws Exception { - runTest("compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakAfter.kt"); - } - - @Test - @TestMetadata("whileWithAssertInConditionAndBreakBefore.kt") - public void testWhileWithAssertInConditionAndBreakBefore() throws Exception { - runTest("compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakBefore.kt"); + @TestMetadata("whileWithAssertInConditionAndBreak.kt") + public void testWhileWithAssertInConditionAndBreak() throws Exception { + runTest("compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreak.kt"); } } diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java index 3a1e113e60c..e4bf2ab8254 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java @@ -28996,15 +28996,9 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti } @Test - @TestMetadata("whileWithAssertInConditionAndBreakAfter.kt") - public void testWhileWithAssertInConditionAndBreakAfter() throws Exception { - runTest("compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakAfter.kt"); - } - - @Test - @TestMetadata("whileWithAssertInConditionAndBreakBefore.kt") - public void testWhileWithAssertInConditionAndBreakBefore() throws Exception { - runTest("compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakBefore.kt"); + @TestMetadata("whileWithAssertInConditionAndBreak.kt") + public void testWhileWithAssertInConditionAndBreak() throws Exception { + runTest("compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreak.kt"); } } diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java index 698f881c3ff..d9462fac4d6 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java @@ -28996,15 +28996,9 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac } @Test - @TestMetadata("whileWithAssertInConditionAndBreakAfter.kt") - public void testWhileWithAssertInConditionAndBreakAfter() throws Exception { - runTest("compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakAfter.kt"); - } - - @Test - @TestMetadata("whileWithAssertInConditionAndBreakBefore.kt") - public void testWhileWithAssertInConditionAndBreakBefore() throws Exception { - runTest("compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakBefore.kt"); + @TestMetadata("whileWithAssertInConditionAndBreak.kt") + public void testWhileWithAssertInConditionAndBreak() throws Exception { + runTest("compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreak.kt"); } } diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakAfter.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreak.fir.kt similarity index 87% rename from compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakAfter.fir.kt rename to compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreak.fir.kt index 304eee4bd4f..f4267ca9837 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakAfter.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreak.fir.kt @@ -1,5 +1,3 @@ -// !LANGUAGE: +SoundSmartcastFromLoopConditionForLoopAssignedVariables - fun foo() { var x: String? = "123" while (x!!.length < 42) { diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakAfter.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreak.kt similarity index 88% rename from compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakAfter.kt rename to compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreak.kt index 9a6a6f19871..e4efe4ab12a 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakAfter.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreak.kt @@ -1,5 +1,3 @@ -// !LANGUAGE: +SoundSmartcastFromLoopConditionForLoopAssignedVariables - fun foo() { var x: String? = "123" while (x!!.length < 42) { diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakAfter.txt b/compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreak.txt similarity index 100% rename from compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakAfter.txt rename to compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreak.txt diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakBefore.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakBefore.fir.kt deleted file mode 100644 index f324ac77928..00000000000 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakBefore.fir.kt +++ /dev/null @@ -1,21 +0,0 @@ -// !LANGUAGE: -SoundSmartcastFromLoopConditionForLoopAssignedVariables - -fun foo() { - var x: String? = "123" - while (x!!.length < 42) { - x = null - break - - } - x.length // 'x' is unsoundly smartcasted here -} - -fun bar() { - var x: List? = ArrayList(1) - for (i in x!!) { - x = null - break - - } - x.size // 'x' is unsoundly smartcasted here -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakBefore.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakBefore.kt deleted file mode 100644 index 51d3655fd56..00000000000 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakBefore.kt +++ /dev/null @@ -1,21 +0,0 @@ -// !LANGUAGE: -SoundSmartcastFromLoopConditionForLoopAssignedVariables - -fun foo() { - var x: String? = "123" - while (x!!.length < 42) { - x = null - break - - } - x.length // 'x' is unsoundly smartcasted here -} - -fun bar() { - var x: List? = ArrayList(1) - for (i in x!!) { - x = null - break - - } - x.size // 'x' is unsoundly smartcasted here -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakBefore.txt b/compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakBefore.txt deleted file mode 100644 index a34eb4a98fa..00000000000 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakBefore.txt +++ /dev/null @@ -1,4 +0,0 @@ -package - -public fun bar(): kotlin.Unit -public fun foo(): kotlin.Unit diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java index 8d472172a07..f55e5e55bac 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java @@ -29086,15 +29086,9 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { } @Test - @TestMetadata("whileWithAssertInConditionAndBreakAfter.kt") - public void testWhileWithAssertInConditionAndBreakAfter() throws Exception { - runTest("compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakAfter.kt"); - } - - @Test - @TestMetadata("whileWithAssertInConditionAndBreakBefore.kt") - public void testWhileWithAssertInConditionAndBreakBefore() throws Exception { - runTest("compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakBefore.kt"); + @TestMetadata("whileWithAssertInConditionAndBreak.kt") + public void testWhileWithAssertInConditionAndBreak() throws Exception { + runTest("compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreak.kt"); } } diff --git a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt index 52322b92d71..c3edac43eb9 100644 --- a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt +++ b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt @@ -269,9 +269,6 @@ enum class LanguageFeature( ProhibitEnumDeclaringClass(KOTLIN_1_9, kind = BUG_FIX), // KT-49653 StopPropagatingDeprecationThroughOverrides(KOTLIN_1_9, kind = BUG_FIX), // KT-47902 - // Temporarily disabled, see KT-27084/KT-22379 - SoundSmartcastFromLoopConditionForLoopAssignedVariables(sinceVersion = null, kind = BUG_FIX), - // Disabled for indefinite time. See KT-48535 and related discussion ApproximateIntegerLiteralTypesInReceiverPosition(sinceVersion = null),