diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt index 695a0523831..d15d331e2dc 100644 --- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt +++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt @@ -175,6 +175,13 @@ abstract class CommonCompilerArguments : CommonToolArguments() { ) var useExperimental: Array? by FreezableVar(null) + @Argument( + value = "-Xopt-in", + valueDescription = "", + description = "Enable usages of API that requires opt-in with an opt-in requirement marker with the given fully qualified name" + ) + var optIn: Array? by FreezableVar(null) + @Argument( value = "-Xproper-ieee754-comparisons", description = "Generate proper IEEE 754 comparisons in all cases if values are statically known to be of primitive numeric types" @@ -333,7 +340,7 @@ abstract class CommonCompilerArguments : CommonToolArguments() { put(AnalysisFlags.experimental, experimentalFqNames) collector.report(CompilerMessageSeverity.WARNING, "'-Xexperimental' is deprecated and will be removed in a future release") } - put(AnalysisFlags.useExperimental, useExperimental?.toList().orEmpty()) + put(AnalysisFlags.useExperimental, useExperimental?.toList().orEmpty() + optIn?.toList().orEmpty()) put(AnalysisFlags.explicitApiVersion, apiVersion != null) put(AnalysisFlags.allowResultReturnType, allowResultReturnType) ExplicitApiMode.fromString(explicitApi)?.also { put(AnalysisFlags.explicitApiMode, it) } ?: collector.report( diff --git a/compiler/testData/cli/js/jsExtraHelp.out b/compiler/testData/cli/js/jsExtraHelp.out index 4051b0dc2b1..799be8f4263 100644 --- a/compiler/testData/cli/js/jsExtraHelp.out +++ b/compiler/testData/cli/js/jsExtraHelp.out @@ -42,6 +42,7 @@ where advanced options include: -Xnew-inference Enable new experimental generic type inference algorithm -Xno-check-actual Do not check presence of 'actual' modifier in multi-platform projects -Xno-inline Disable method inlining + -Xopt-in= Enable usages of API that requires opt-in with an opt-in requirement marker with the given fully qualified name -Xphases-to-dump Dump backend state both before and after these phases -Xphases-to-dump-after Dump backend state after these phases -Xphases-to-dump-before Dump backend state before these phases diff --git a/compiler/testData/cli/jvm/extraHelp.out b/compiler/testData/cli/jvm/extraHelp.out index de73f6c090f..7cca178f792 100644 --- a/compiler/testData/cli/jvm/extraHelp.out +++ b/compiler/testData/cli/jvm/extraHelp.out @@ -99,6 +99,7 @@ where advanced options include: -Xnew-inference Enable new experimental generic type inference algorithm -Xno-check-actual Do not check presence of 'actual' modifier in multi-platform projects -Xno-inline Disable method inlining + -Xopt-in= Enable usages of API that requires opt-in with an opt-in requirement marker with the given fully qualified name -Xphases-to-dump Dump backend state both before and after these phases -Xphases-to-dump-after Dump backend state after these phases -Xphases-to-dump-before Dump backend state before these phases