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:
+10
@@ -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
|
||||
|
||||
+1
@@ -44,6 +44,7 @@ where advanced options include:
|
||||
-Xexplicit-api={strict|warning|disable}
|
||||
Force compiler to report errors on all public API declarations without explicit visibility or return type.
|
||||
Use 'warning' level to issue warnings instead of errors.
|
||||
-Xinference-compatibility Enable compatibility changes for generic type inference algorithm
|
||||
-Xinline-classes Enable experimental inline classes
|
||||
-Xintellij-plugin-root=<path> Path to the kotlin-compiler.jar or directory where IntelliJ configuration files can be found
|
||||
-Xlegacy-smart-cast-after-try Allow var smart casts despite assignment in try block
|
||||
|
||||
+1
@@ -127,6 +127,7 @@ where advanced options include:
|
||||
-Xexplicit-api={strict|warning|disable}
|
||||
Force compiler to report errors on all public API declarations without explicit visibility or return type.
|
||||
Use 'warning' level to issue warnings instead of errors.
|
||||
-Xinference-compatibility Enable compatibility changes for generic type inference algorithm
|
||||
-Xinline-classes Enable experimental inline classes
|
||||
-Xintellij-plugin-root=<path> Path to the kotlin-compiler.jar or directory where IntelliJ configuration files can be found
|
||||
-Xlegacy-smart-cast-after-try Allow var smart casts despite assignment in try block
|
||||
|
||||
@@ -135,6 +135,7 @@ enum class LanguageFeature(
|
||||
DisableCompatibilityModeForNewInference(KOTLIN_1_5, defaultState = LanguageFeature.State.DISABLED),
|
||||
AdaptedCallableReferenceAgainstReflectiveType(KOTLIN_1_5, defaultState = LanguageFeature.State.DISABLED),
|
||||
ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated(KOTLIN_1_5, kind = BUG_FIX),
|
||||
InferenceCompatibility(KOTLIN_1_5, kind = BUG_FIX),
|
||||
|
||||
// Temporarily disabled, see KT-27084/KT-22379
|
||||
SoundSmartcastFromLoopConditionForLoopAssignedVariables(sinceVersion = null, kind = BUG_FIX),
|
||||
|
||||
Reference in New Issue
Block a user