Introduce a compiler X-flag to use the builder inference by default for all calls

^KT-48622 Fixed
This commit is contained in:
Victor Petukhov
2021-09-06 12:56:00 +03:00
parent df700117c3
commit 86d8468b8b
7 changed files with 39 additions and 0 deletions
@@ -374,6 +374,13 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
)
var unrestrictedBuilderInference: Boolean by FreezableVar(false)
@Argument(
value = "-Xenable-builder-inference",
description = "Use the builder inference by default, for all calls with lambdas which can't be resolved without it.\n" +
"The corresponding calls' declarations may not be marked with @BuilderInference."
)
var enableBuilderInference: Boolean by FreezableVar(false)
@Argument(
value = "-Xself-upper-bound-inference",
description = "Support inferring type arguments based on only self upper bounds of the corresponding type parameters"
@@ -422,6 +429,10 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
put(LanguageFeature.UnrestrictedBuilderInference, LanguageFeature.State.ENABLED)
}
if (enableBuilderInference) {
put(LanguageFeature.UseBuilderInferenceWithoutAnnotation, LanguageFeature.State.ENABLED)
}
if (selfUpperBoundInference) {
put(LanguageFeature.TypeInferenceOnCallsWithSelfTypes, LanguageFeature.State.ENABLED)
}