Add -Xopt-in command line argument

As per https://github.com/Kotlin/KEEP/pull/201
This commit is contained in:
Alexander Udalov
2019-12-17 10:35:04 +01:00
parent cdbabf224f
commit e009c7064e
3 changed files with 10 additions and 1 deletions
@@ -175,6 +175,13 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
)
var useExperimental: Array<String>? by FreezableVar(null)
@Argument(
value = "-Xopt-in",
valueDescription = "<fq.name>",
description = "Enable usages of API that requires opt-in with an opt-in requirement marker with the given fully qualified name"
)
var optIn: Array<String>? 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(