[FIR] Add `-Xdata-flow-based-exhaustiveness`
^KT-78484
diff --git a/compiler/arguments/resources/kotlin-compiler-arguments.json b/compiler/arguments/resources/kotlin-compiler-arguments.json
index 9c589ed..e0324dd 100644
--- a/compiler/arguments/resources/kotlin-compiler-arguments.json
+++ b/compiler/arguments/resources/kotlin-compiler-arguments.json
@@ -2609,6 +2609,37 @@
}
},
{
+ "name": "-Xdata-flow-based-exhaustiveness",
+ "shortName": null,
+ "deprecatedName": null,
+ "description": {
+ "current": "Enable `when` exhaustiveness improvements that rely on data-flow analysis.",
+ "valueInVersions": []
+ },
+ "delimiter": null,
+ "valueType": {
+ "type": "org.jetbrains.kotlin.arguments.dsl.types.BooleanType",
+ "isNullable": {
+ "current": false,
+ "valueInVersions": []
+ },
+ "defaultValue": {
+ "current": false,
+ "valueInVersions": []
+ }
+ },
+ "valueDescription": {
+ "current": null,
+ "valueInVersions": []
+ },
+ "releaseVersionsMetadata": {
+ "introducedVersion": "1.4.0",
+ "stabilizedVersion": "1.4.0",
+ "deprecatedVersion": null,
+ "removedVersion": null
+ }
+ },
+ {
"name": "Xdirect-java-actualization",
"shortName": null,
"deprecatedName": null,
diff --git a/compiler/arguments/src/org/jetbrains/kotlin/arguments/description/CommonCompilerArguments.kt b/compiler/arguments/src/org/jetbrains/kotlin/arguments/description/CommonCompilerArguments.kt
index e904d01..715b26f 100644
--- a/compiler/arguments/src/org/jetbrains/kotlin/arguments/description/CommonCompilerArguments.kt
+++ b/compiler/arguments/src/org/jetbrains/kotlin/arguments/description/CommonCompilerArguments.kt
@@ -711,6 +711,18 @@
compilerArgument {
+ name = "-Xdata-flow-based-exhaustiveness"
+ description = "Enable `when` exhaustiveness improvements that rely on data-flow analysis.".asReleaseDependent()
+ valueType = BooleanType.defaultFalse
+
+ additionalAnnotations(Enables(LanguageFeature.DataFlowBasedExhaustiveness))
+
+ @OptIn(TemporaryCompilerArgumentLifecycle::class)
+ stubLifecycle()
+ }
+
+
+ compilerArgument {
name = "Xdirect-java-actualization"
description = "Enable experimental direct Java actualization support.".asReleaseDependent()
valueType = BooleanType.defaultFalse
diff --git a/compiler/cli/cli-common/gen/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt b/compiler/cli/cli-common/gen/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt
index ba1c969..024d46e 100644
--- a/compiler/cli/cli-common/gen/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt
+++ b/compiler/cli/cli-common/gen/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt
@@ -678,6 +678,17 @@
}
@Argument(
+ value = "--Xdata-flow-based-exhaustiveness",
+ description = "Enable `when` exhaustiveness improvements that rely on data-flow analysis.",
+ )
+ @Enables(LanguageFeature.DataFlowBasedExhaustiveness)
+ var xdataFlowBasedExhaustiveness: Boolean = false
+ set(value) {
+ checkFrozen()
+ field = value
+ }
+
+ @Argument(
value = "-Xdirect-java-actualization",
description = "Enable experimental direct Java actualization support.",
)
diff --git a/compiler/cli/cli-common/gen/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArgumentsCopyGenerated.kt b/compiler/cli/cli-common/gen/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArgumentsCopyGenerated.kt
index c16fb06..009478b 100644
--- a/compiler/cli/cli-common/gen/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArgumentsCopyGenerated.kt
+++ b/compiler/cli/cli-common/gen/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArgumentsCopyGenerated.kt
@@ -92,6 +92,7 @@
to.verifyIrVisibility = from.verifyIrVisibility
to.warningLevels = from.warningLevels?.copyOf()
to.whenGuards = from.whenGuards
+ to.xdataFlowBasedExhaustiveness = from.xdataFlowBasedExhaustiveness
return to
}
diff --git a/compiler/cli/cli-common/gen/org/jetbrains/kotlin/cli/common/arguments/ConfigureCommonLanguageFeatures.kt b/compiler/cli/cli-common/gen/org/jetbrains/kotlin/cli/common/arguments/ConfigureCommonLanguageFeatures.kt
index efcb25e..f340c7bb 100644
--- a/compiler/cli/cli-common/gen/org/jetbrains/kotlin/cli/common/arguments/ConfigureCommonLanguageFeatures.kt
+++ b/compiler/cli/cli-common/gen/org/jetbrains/kotlin/cli/common/arguments/ConfigureCommonLanguageFeatures.kt
@@ -46,6 +46,10 @@
put(LanguageFeature.BreakContinueInInlineLambdas, LanguageFeature.State.ENABLED)
}
+ if (arguments.xdataFlowBasedExhaustiveness) {
+ put(LanguageFeature.DataFlowBasedExhaustiveness, LanguageFeature.State.ENABLED)
+ }
+
if (arguments.directJavaActualization) {
put(LanguageFeature.DirectJavaActualization, LanguageFeature.State.ENABLED)
}
diff --git a/compiler/testData/cli/js/jsHelp.out b/compiler/testData/cli/js/jsHelp.out
index 3e0735b..e5a9d86 100644
--- a/compiler/testData/cli/js/jsHelp.out
+++ b/compiler/testData/cli/js/jsHelp.out
@@ -26,6 +26,8 @@
-opt-in <fq.name> Enable API usages that require opt-in with an opt-in requirement marker with the given fully qualified name.
-P plugin:<pluginId>:<optionName>=<value>
Pass an option to a plugin.
+ --Xdata-flow-based-exhaustiveness
+ Enable `when` exhaustiveness improvements that rely on data-flow analysis.
-help (-h) Print a synopsis of standard options.
-X Print a synopsis of advanced options.
-version Display the compiler version.
diff --git a/compiler/testData/cli/jvm/help.out b/compiler/testData/cli/jvm/help.out
index f12b644..fa3bc00 100644
--- a/compiler/testData/cli/jvm/help.out
+++ b/compiler/testData/cli/jvm/help.out
@@ -32,6 +32,8 @@
-opt-in <fq.name> Enable API usages that require opt-in with an opt-in requirement marker with the given fully qualified name.
-P plugin:<pluginId>:<optionName>=<value>
Pass an option to a plugin.
+ --Xdata-flow-based-exhaustiveness
+ Enable `when` exhaustiveness improvements that rely on data-flow analysis.
-help (-h) Print a synopsis of standard options.
-X Print a synopsis of advanced options.
-version Display the compiler version.