From a2b8493f477972f26db8914dde9ae83b0fd50e62 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Thu, 21 Oct 2021 12:49:36 +0300 Subject: [PATCH] [FE 1.0] Prohibit using non exhaustive if and when in rhs of elvis expression ^KT-44705 ^KT-49349 Fixed --- ...CompilerTestFE10TestdataTestGenerated.java | 12 +++++++ ...irOldFrontendDiagnosticsTestGenerated.java | 12 +++++++ ...DiagnosticsWithLightTreeTestGenerated.java | 12 +++++++ .../cfg/ControlFlowInformationProviderImpl.kt | 35 ++++++++++++++++--- .../kotlin/cfg/ControlFlowProcessor.kt | 5 ++- .../jetbrains/kotlin/diagnostics/Errors.java | 2 ++ .../rendering/DefaultErrorMessages.java | 2 ++ .../controlStructures/ifWhenWithoutElse.kt | 4 +-- .../nonExhaustiveIfInElvis_after.kt | 30 ++++++++++++++++ .../nonExhaustiveIfInElvis_after.txt | 7 ++++ .../nonExhaustiveIfInElvis_before.fir.kt | 29 +++++++++++++++ .../nonExhaustiveIfInElvis_before.kt | 29 +++++++++++++++ .../nonExhaustiveIfInElvis_before.txt | 7 ++++ .../loops/elvisIfBreakInsideWhileTrue.kt | 2 +- .../test/runners/DiagnosticTestGenerated.java | 12 +++++++ .../kotlin/config/LanguageVersionSettings.kt | 1 + 16 files changed, 192 insertions(+), 9 deletions(-) create mode 100644 compiler/testData/diagnostics/tests/controlStructures/nonExhaustiveIfInElvis_after.kt create mode 100644 compiler/testData/diagnostics/tests/controlStructures/nonExhaustiveIfInElvis_after.txt create mode 100644 compiler/testData/diagnostics/tests/controlStructures/nonExhaustiveIfInElvis_before.fir.kt create mode 100644 compiler/testData/diagnostics/tests/controlStructures/nonExhaustiveIfInElvis_before.kt create mode 100644 compiler/testData/diagnostics/tests/controlStructures/nonExhaustiveIfInElvis_before.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 0a549f6f1a2..28e2d5a1ada 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 @@ -6289,6 +6289,18 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag runTest("compiler/testData/diagnostics/tests/controlStructures/nestedLoopsWithMultipleLabels.kt"); } + @Test + @TestMetadata("nonExhaustiveIfInElvis_after.kt") + public void testNonExhaustiveIfInElvis_after() throws Exception { + runTest("compiler/testData/diagnostics/tests/controlStructures/nonExhaustiveIfInElvis_after.kt"); + } + + @Test + @TestMetadata("nonExhaustiveIfInElvis_before.kt") + public void testNonExhaustiveIfInElvis_before() throws Exception { + runTest("compiler/testData/diagnostics/tests/controlStructures/nonExhaustiveIfInElvis_before.kt"); + } + @Test @TestMetadata("notAFunctionLabel_after.kt") public void testNotAFunctionLabel_after() throws Exception { 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 1cb774e47c3..e734e56640d 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 @@ -6289,6 +6289,18 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti runTest("compiler/testData/diagnostics/tests/controlStructures/nestedLoopsWithMultipleLabels.kt"); } + @Test + @TestMetadata("nonExhaustiveIfInElvis_after.kt") + public void testNonExhaustiveIfInElvis_after() throws Exception { + runTest("compiler/testData/diagnostics/tests/controlStructures/nonExhaustiveIfInElvis_after.kt"); + } + + @Test + @TestMetadata("nonExhaustiveIfInElvis_before.kt") + public void testNonExhaustiveIfInElvis_before() throws Exception { + runTest("compiler/testData/diagnostics/tests/controlStructures/nonExhaustiveIfInElvis_before.kt"); + } + @Test @TestMetadata("notAFunctionLabel_after.kt") public void testNotAFunctionLabel_after() throws Exception { 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 9963a0bc5c2..b71b564d1ec 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 @@ -6289,6 +6289,18 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac runTest("compiler/testData/diagnostics/tests/controlStructures/nestedLoopsWithMultipleLabels.kt"); } + @Test + @TestMetadata("nonExhaustiveIfInElvis_after.kt") + public void testNonExhaustiveIfInElvis_after() throws Exception { + runTest("compiler/testData/diagnostics/tests/controlStructures/nonExhaustiveIfInElvis_after.kt"); + } + + @Test + @TestMetadata("nonExhaustiveIfInElvis_before.kt") + public void testNonExhaustiveIfInElvis_before() throws Exception { + runTest("compiler/testData/diagnostics/tests/controlStructures/nonExhaustiveIfInElvis_before.kt"); + } + @Test @TestMetadata("notAFunctionLabel_after.kt") public void testNotAFunctionLabel_after() throws Exception { diff --git a/compiler/frontend/cfg/src/org/jetbrains/kotlin/cfg/ControlFlowInformationProviderImpl.kt b/compiler/frontend/cfg/src/org/jetbrains/kotlin/cfg/ControlFlowInformationProviderImpl.kt index 6662510795b..faa6ccecc90 100644 --- a/compiler/frontend/cfg/src/org/jetbrains/kotlin/cfg/ControlFlowInformationProviderImpl.kt +++ b/compiler/frontend/cfg/src/org/jetbrains/kotlin/cfg/ControlFlowInformationProviderImpl.kt @@ -5,6 +5,7 @@ package org.jetbrains.kotlin.cfg +import com.intellij.psi.PsiElement import com.intellij.psi.util.PsiTreeUtil.getParentOfType import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.cfg.TailRecursionKind.* @@ -43,14 +44,10 @@ import org.jetbrains.kotlin.resolve.bindingContextUtil.getEnclosingDescriptor import org.jetbrains.kotlin.resolve.bindingContextUtil.isUsedAsExpression import org.jetbrains.kotlin.resolve.bindingContextUtil.isUsedAsResultOfLambda import org.jetbrains.kotlin.resolve.bindingContextUtil.isUsedAsStatement -import org.jetbrains.kotlin.resolve.calls.util.getResolvedCall import org.jetbrains.kotlin.resolve.calls.checkers.findDestructuredVariable import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall import org.jetbrains.kotlin.resolve.calls.model.VariableAsFunctionResolvedCall -import org.jetbrains.kotlin.resolve.calls.util.getDispatchReceiverWithSmartCast -import org.jetbrains.kotlin.resolve.calls.util.hasThisOrNoDispatchReceiver -import org.jetbrains.kotlin.resolve.calls.util.FakeCallableDescriptorForObject -import org.jetbrains.kotlin.resolve.calls.util.isSingleUnderscore +import org.jetbrains.kotlin.resolve.calls.util.* import org.jetbrains.kotlin.resolve.checkers.PlatformDiagnosticSuppressor import org.jetbrains.kotlin.resolve.descriptorUtil.isEffectivelyExternal import org.jetbrains.kotlin.resolve.descriptorUtil.module @@ -943,6 +940,13 @@ class ControlFlowInformationProviderImpl private constructor( } else { checkImplicitCastOnConditionalExpression(element) } + } else if (!languageVersionSettings.supportsFeature(LanguageFeature.ProhibitNonExhaustiveIfInRhsOfElvis)) { + val parent = element.deparenthesizedParent + if (parent is KtBinaryExpression) { + if (parent.operationToken === KtTokens.ELVIS) { + trace.report(INVALID_IF_AS_EXPRESSION_WARNING.on(element.getIfKeyword())) + } + } } } } @@ -1036,6 +1040,18 @@ class ControlFlowInformationProviderImpl private constructor( } } } + if ( + !usedAsExpression && + missingCases.isNotEmpty() && + !languageVersionSettings.supportsFeature(LanguageFeature.ProhibitNonExhaustiveIfInRhsOfElvis) + ) { + val parent = element.deparenthesizedParent + if (parent is KtBinaryExpression) { + if (parent.operationToken === KtTokens.ELVIS) { + trace.report(NO_ELSE_IN_WHEN_WARNING.on(element, missingCases)) + } + } + } } } } @@ -1355,4 +1371,13 @@ class ControlFlowInformationProviderImpl private constructor( || diagnosticFactory === UNUSED_ANONYMOUS_PARAMETER || diagnosticFactory === UNUSED_CHANGED_VALUE } + + private val PsiElement.deparenthesizedParent: PsiElement + get() { + var result = parent + while (result is KtParenthesizedExpression || result is KtLabeledExpression || result is KtAnnotatedExpression) { + result = result.parent + } + return result + } } diff --git a/compiler/frontend/cfg/src/org/jetbrains/kotlin/cfg/ControlFlowProcessor.kt b/compiler/frontend/cfg/src/org/jetbrains/kotlin/cfg/ControlFlowProcessor.kt index b557853aa8e..b20b05d3a12 100644 --- a/compiler/frontend/cfg/src/org/jetbrains/kotlin/cfg/ControlFlowProcessor.kt +++ b/compiler/frontend/cfg/src/org/jetbrains/kotlin/cfg/ControlFlowProcessor.kt @@ -346,7 +346,10 @@ class ControlFlowProcessor( builder.jumpOnTrue(afterElvis, expression, builder.getBoundValue(left)) generateInstructions(right) builder.bindLabel(afterElvis) - mergeValues(listOf(left, right).filterNotNull(), expression) + mergeValues(listOfNotNull(left, right), expression) + if (right != null && languageVersionSettings?.supportsFeature(LanguageFeature.ProhibitNonExhaustiveIfInRhsOfElvis) == true) { + trace.record(USED_AS_EXPRESSION, right, true) + } } else { if (!generateCall(expression)) { generateBothArgumentsAndMark(expression) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index db534890bb3..7d028877d75 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -997,6 +997,7 @@ public interface Errors { DiagnosticFactory0 SENSELESS_NULL_IN_WHEN = DiagnosticFactory0.create(WARNING); DiagnosticFactory0 INVALID_IF_AS_EXPRESSION = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 INVALID_IF_AS_EXPRESSION_WARNING = DiagnosticFactory0.create(WARNING); DiagnosticFactoryForDeprecation0 CONFUSING_BRANCH_CONDITION = DiagnosticFactoryForDeprecation0.create(LanguageFeature.ProhibitConfusingSyntaxInWhenBranches); // Nullability @@ -1079,6 +1080,7 @@ public interface Errors { DiagnosticFactory0 ELSE_MISPLACED_IN_WHEN = DiagnosticFactory0.create(ERROR, ELSE_ENTRY); DiagnosticFactory0 REDUNDANT_ELSE_IN_WHEN = DiagnosticFactory0.create(WARNING, ELSE_ENTRY); DiagnosticFactory1> NO_ELSE_IN_WHEN = DiagnosticFactory1.create(ERROR, WHEN_EXPRESSION); + DiagnosticFactory1> NO_ELSE_IN_WHEN_WARNING = DiagnosticFactory1.create(WARNING, WHEN_EXPRESSION); DiagnosticFactory1> NON_EXHAUSTIVE_WHEN = DiagnosticFactory1.create(WARNING, WHEN_EXPRESSION); DiagnosticFactory2> NON_EXHAUSTIVE_WHEN_STATEMENT = DiagnosticFactory2.create(WARNING, WHEN_EXPRESSION); DiagnosticFactory1> diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java index 725ecd2430f..b8b9143fb5f 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java @@ -632,6 +632,7 @@ public class DefaultErrorMessages { MAP.put(ILLEGAL_DECLARATION_IN_WHEN_SUBJECT, "Illegal variable declaration in 'when' subject: {0}. Should be a simple val with an initializer", STRING); MAP.put(NO_ELSE_IN_WHEN, "''when'' expression must be exhaustive, add necessary {0}", RENDER_WHEN_MISSING_CASES); + MAP.put(NO_ELSE_IN_WHEN_WARNING, "''when'' expression must be exhaustive, add necessary {0}", RENDER_WHEN_MISSING_CASES); MAP.put(NON_EXHAUSTIVE_WHEN, "''when'' expression on enum is recommended to be exhaustive, add {0}", RENDER_WHEN_MISSING_CASES); MAP.put(NON_EXHAUSTIVE_WHEN_STATEMENT, "Non exhaustive ''when'' statements on {0} will be prohibited in 1.7, add {1}", STRING, RENDER_WHEN_MISSING_CASES); MAP.put(NON_EXHAUSTIVE_WHEN_ON_SEALED_CLASS, "''when'' expression on sealed classes is recommended to be exhaustive, add {0}", RENDER_WHEN_MISSING_CASES); @@ -833,6 +834,7 @@ public class DefaultErrorMessages { MAP.put(SENSELESS_NULL_IN_WHEN, "Expression under 'when' is never equal to null"); MAP.put(INVALID_IF_AS_EXPRESSION, "'if' must have both main and 'else' branches if used as an expression"); + MAP.put(INVALID_IF_AS_EXPRESSION_WARNING, "'if' must have both main and 'else' branches if used as an expression"); MAP.put(CONFUSING_BRANCH_CONDITION, "The logical expressions may be understood ambiguously in when with subject branches. Please wrap it with parenthesis"); MAP.put(OVERRIDING_FINAL_MEMBER, "''{0}'' in ''{1}'' is final and cannot be overridden", NAME, NAME); diff --git a/compiler/testData/diagnostics/tests/controlStructures/ifWhenWithoutElse.kt b/compiler/testData/diagnostics/tests/controlStructures/ifWhenWithoutElse.kt index 29b41b366ca..2a4bee30751 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/ifWhenWithoutElse.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/ifWhenWithoutElse.kt @@ -56,8 +56,8 @@ fun g6(): Unit = when { true -> 42 } fun foo1(x: String?) { "" + if (true) 42 w@while (true) { - x ?: if (true) break - x ?: when { true -> break@w } + x ?: if (true) break + x ?: when { true -> break@w } } } diff --git a/compiler/testData/diagnostics/tests/controlStructures/nonExhaustiveIfInElvis_after.kt b/compiler/testData/diagnostics/tests/controlStructures/nonExhaustiveIfInElvis_after.kt new file mode 100644 index 00000000000..c006f9fb7a7 --- /dev/null +++ b/compiler/testData/diagnostics/tests/controlStructures/nonExhaustiveIfInElvis_after.kt @@ -0,0 +1,30 @@ +// FIR_IDENTICAL +// LANGUAGE: +ProhibitNonExhaustiveIfInRhsOfElvis +// DIAGNOSTICS: -USELESS_ELVIS +// ISSUE: KT-44705 + +fun test_1(x: String?, y: String?) { + while (true) { + x ?: if (y == null) break + } +} + +fun test_2(x: String?, y: String?) { + while (true) { + val z = x ?: if (y == null) break + } +} + +fun test_3(x: String?, y: String?) { + while (true) { + x ?: when { true -> break } + x ?: when (y) { "hello" -> break } + } +} + +fun test_4(x: String?, y: String?) { + while (true) { + val a = x ?: when { true -> break } + val b = x ?: when (y) { "hello" -> break } + } +} diff --git a/compiler/testData/diagnostics/tests/controlStructures/nonExhaustiveIfInElvis_after.txt b/compiler/testData/diagnostics/tests/controlStructures/nonExhaustiveIfInElvis_after.txt new file mode 100644 index 00000000000..b16e2238e65 --- /dev/null +++ b/compiler/testData/diagnostics/tests/controlStructures/nonExhaustiveIfInElvis_after.txt @@ -0,0 +1,7 @@ +package + +public fun test_1(/*0*/ x: kotlin.String?, /*1*/ y: kotlin.String?): kotlin.Unit +public fun test_2(/*0*/ x: kotlin.String?, /*1*/ y: kotlin.String?): kotlin.Unit +public fun test_3(/*0*/ x: kotlin.String?, /*1*/ y: kotlin.String?): kotlin.Unit +public fun test_4(/*0*/ x: kotlin.String?, /*1*/ y: kotlin.String?): kotlin.Unit + diff --git a/compiler/testData/diagnostics/tests/controlStructures/nonExhaustiveIfInElvis_before.fir.kt b/compiler/testData/diagnostics/tests/controlStructures/nonExhaustiveIfInElvis_before.fir.kt new file mode 100644 index 00000000000..83f91bb375d --- /dev/null +++ b/compiler/testData/diagnostics/tests/controlStructures/nonExhaustiveIfInElvis_before.fir.kt @@ -0,0 +1,29 @@ +// LANGUAGE: -ProhibitNonExhaustiveIfInRhsOfElvis +// DIAGNOSTICS: -USELESS_ELVIS +// ISSUE: KT-44705 + +fun test_1(x: String?, y: String?) { + while (true) { + x ?: if (y == null) break + } +} + +fun test_2(x: String?, y: String?) { + while (true) { + val z = x ?: if (y == null) break + } +} + +fun test_3(x: String?, y: String?) { + while (true) { + x ?: when { true -> break } + x ?: when (y) { "hello" -> break } + } +} + +fun test_4(x: String?, y: String?) { + while (true) { + val a = x ?: when { true -> break } + val b = x ?: when (y) { "hello" -> break } + } +} diff --git a/compiler/testData/diagnostics/tests/controlStructures/nonExhaustiveIfInElvis_before.kt b/compiler/testData/diagnostics/tests/controlStructures/nonExhaustiveIfInElvis_before.kt new file mode 100644 index 00000000000..c6656d86f22 --- /dev/null +++ b/compiler/testData/diagnostics/tests/controlStructures/nonExhaustiveIfInElvis_before.kt @@ -0,0 +1,29 @@ +// LANGUAGE: -ProhibitNonExhaustiveIfInRhsOfElvis +// DIAGNOSTICS: -USELESS_ELVIS +// ISSUE: KT-44705 + +fun test_1(x: String?, y: String?) { + while (true) { + x ?: if (y == null) break + } +} + +fun test_2(x: String?, y: String?) { + while (true) { + val z = x ?: if (y == null) break + } +} + +fun test_3(x: String?, y: String?) { + while (true) { + x ?: when { true -> break } + x ?: when (y) { "hello" -> break } + } +} + +fun test_4(x: String?, y: String?) { + while (true) { + val a = x ?: when { true -> break } + val b = x ?: when (y) { "hello" -> break } + } +} diff --git a/compiler/testData/diagnostics/tests/controlStructures/nonExhaustiveIfInElvis_before.txt b/compiler/testData/diagnostics/tests/controlStructures/nonExhaustiveIfInElvis_before.txt new file mode 100644 index 00000000000..b16e2238e65 --- /dev/null +++ b/compiler/testData/diagnostics/tests/controlStructures/nonExhaustiveIfInElvis_before.txt @@ -0,0 +1,7 @@ +package + +public fun test_1(/*0*/ x: kotlin.String?, /*1*/ y: kotlin.String?): kotlin.Unit +public fun test_2(/*0*/ x: kotlin.String?, /*1*/ y: kotlin.String?): kotlin.Unit +public fun test_3(/*0*/ x: kotlin.String?, /*1*/ y: kotlin.String?): kotlin.Unit +public fun test_4(/*0*/ x: kotlin.String?, /*1*/ y: kotlin.String?): kotlin.Unit + diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/elvisIfBreakInsideWhileTrue.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/elvisIfBreakInsideWhileTrue.kt index 520459f73a9..86612589d05 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/elvisIfBreakInsideWhileTrue.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/elvisIfBreakInsideWhileTrue.kt @@ -1,6 +1,6 @@ public fun foo(x: String?, y: String?): Int { while (true) { - x ?: if (y == null) break + x ?: if (y == null) break // y is nullable if x != null y.length } 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 3363d832aa7..fde5f86d02a 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 @@ -6295,6 +6295,18 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/controlStructures/nestedLoopsWithMultipleLabels.kt"); } + @Test + @TestMetadata("nonExhaustiveIfInElvis_after.kt") + public void testNonExhaustiveIfInElvis_after() throws Exception { + runTest("compiler/testData/diagnostics/tests/controlStructures/nonExhaustiveIfInElvis_after.kt"); + } + + @Test + @TestMetadata("nonExhaustiveIfInElvis_before.kt") + public void testNonExhaustiveIfInElvis_before() throws Exception { + runTest("compiler/testData/diagnostics/tests/controlStructures/nonExhaustiveIfInElvis_before.kt"); + } + @Test @TestMetadata("notAFunctionLabel_after.kt") public void testNotAFunctionLabel_after() throws Exception { diff --git a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt index 9d876ca965c..21ec8583fdc 100644 --- a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt +++ b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt @@ -235,6 +235,7 @@ enum class LanguageFeature( JvmPermittedSubclassesAttributeForSealed(KOTLIN_1_7), ForbidUsingExtensionPropertyTypeParameterInDelegate(KOTLIN_1_7, kind = BUG_FIX), ProhibitConfusingSyntaxInWhenBranches(KOTLIN_1_7, kind = BUG_FIX), // KT-48385 + ProhibitNonExhaustiveIfInRhsOfElvis(KOTLIN_1_7, kind = BUG_FIX), // KT-44705 // Temporarily disabled, see KT-27084/KT-22379 SoundSmartcastFromLoopConditionForLoopAssignedVariables(sinceVersion = null, kind = BUG_FIX),