[FIR] Don't enable features without sinceKotlin in Progressive Mode
There are two BUG_FIX features that have been added to the compiler, without a clear decision to enable them somewhere in the future. Since there is no decision to force users rewrite their code, such features should not be enabled in Progressive Mode. ^KT-62644 Fixed ^KT-62143 Fixed
This commit is contained in:
committed by
Space Team
parent
9366847e96
commit
ba9baa7457
+1
-1
@@ -883,7 +883,7 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
|
||||
}
|
||||
|
||||
if (progressiveMode) {
|
||||
LanguageFeature.values().filter { it.kind.enabledInProgressiveMode }.forEach {
|
||||
LanguageFeature.entries.filter { it.enabledInProgressiveMode }.forEach {
|
||||
// Don't overwrite other settings: users may want to turn off some particular
|
||||
// breaking change manually instead of turning off whole progressive mode
|
||||
if (!contains(it)) put(it, LanguageFeature.State.ENABLED)
|
||||
|
||||
@@ -392,6 +392,13 @@ enum class LanguageFeature(
|
||||
DISABLED("Disabled");
|
||||
}
|
||||
|
||||
/**
|
||||
* If 'true', then this feature will be automatically enabled under '-progressive' mode.
|
||||
*
|
||||
* Please, see `canBeEnabledInProgressiveMode` in [Kind] for more details.
|
||||
*/
|
||||
val enabledInProgressiveMode: Boolean get() = kind.canBeEnabledInProgressiveMode && sinceVersion != null
|
||||
|
||||
/**
|
||||
* # [forcesPreReleaseBinaries]
|
||||
* If 'true', then enabling this feature (e.g. by '-XXLanguage:', or dedicated '-X'-flag)
|
||||
@@ -404,8 +411,8 @@ enum class LanguageFeature(
|
||||
* generate 'kotlin-compiler' as pre-release.
|
||||
*
|
||||
*
|
||||
* # [enabledInProgressiveMode]
|
||||
* If 'true', then this feature will be automatically enabled under '-progressive' mode.
|
||||
* # [canBeEnabledInProgressiveMode]
|
||||
* If 'true', then this feature will be automatically enabled under '-progressive' mode if `sinceKotlin` is set.
|
||||
*
|
||||
* Restrictions for using this flag for particular feature follow from restrictions of the progressive mode:
|
||||
* - enabling it *must not* break compatibility with non-progressive compiler, i.e. code written under progressive
|
||||
@@ -418,9 +425,9 @@ enum class LanguageFeature(
|
||||
* Example: silently changing semantics of generated low-level code is not fine, but deprecating some language
|
||||
* construction immediately instead of a going through complete deprecation cycle is fine.
|
||||
*
|
||||
* NB: Currently, [enabledInProgressiveMode] makes sense only for features with [sinceVersion] > [LanguageVersion.LATEST_STABLE]
|
||||
* NB: Currently, [canBeEnabledInProgressiveMode] makes sense only for features with [sinceVersion] > [LanguageVersion.LATEST_STABLE]
|
||||
*/
|
||||
enum class Kind(val enabledInProgressiveMode: Boolean, val forcesPreReleaseBinaries: Boolean) {
|
||||
enum class Kind(val canBeEnabledInProgressiveMode: Boolean, val forcesPreReleaseBinaries: Boolean) {
|
||||
/**
|
||||
* Simple bug fix which just forbids some language constructions.
|
||||
* Rule of thumb: it turns "green code" into "red".
|
||||
|
||||
Reference in New Issue
Block a user