Add language feature for inference compatibility mode

The feature is intended for updates in the inference algorithm
that change behaviour compared to the previous stable version.
This commit is contained in:
Pavel Kirpichenkov
2020-09-18 12:01:42 +03:00
parent 896fbbd1a3
commit 1465e10f12
4 changed files with 13 additions and 0 deletions
@@ -358,6 +358,12 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
)
var deserializeFakeOverrides: Boolean by FreezableVar(false)
@Argument(
value = "-Xinference-compatibility",
description = "Enable compatibility changes for generic type inference algorithm"
)
var inferenceCompatibility: Boolean by FreezableVar(false)
open fun configureAnalysisFlags(collector: MessageCollector): MutableMap<AnalysisFlag<*>, Any> {
return HashMap<AnalysisFlag<*>, Any>().apply {
put(AnalysisFlags.skipMetadataVersionCheck, skipMetadataVersionCheck)
@@ -432,6 +438,10 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
put(LanguageFeature.MixedNamedArgumentsInTheirOwnPosition, LanguageFeature.State.ENABLED)
}
if (inferenceCompatibility) {
put(LanguageFeature.InferenceCompatibility, LanguageFeature.State.ENABLED)
}
if (progressiveMode) {
LanguageFeature.values().filter { it.kind.enabledInProgressiveMode }.forEach {
// Don't overwrite other settings: users may want to turn off some particular