Cleanup: LanguageFeature.defaultState -> LanguageFeature.isEnabledWithWarning
Review: https://jetbrains.team/p/kt/reviews/7418 `State` enum contains `DISABLED` item which is redundant for `LanguageFeature`. It's redundant because `sinceVersion = null` is used to express the same semantic. I had to reorder some items in the enum because otherwise `testLanguageFeatureOrder` fails. I could keep the same logic in `testLanguageFeatureOrder` but I would need to make `isEnabledWithWarning` public which I don't want to. Anyway, it's not obvious what is more readable: keep `isEnabledWithWarning = true` items at the end or at the beginning. Also all effectively disabled features (`sinceVersion = null` or `defaultState = State.DISABLED`) are now moved to the "Experimental" section at the end which is obviously better.
This commit is contained in:
@@ -393,7 +393,7 @@ class CodeConformanceTest : TestCase() {
|
||||
|
||||
fun testLanguageFeatureOrder() {
|
||||
val values = enumValues<LanguageFeature>()
|
||||
val enabledFeatures = values.filter { it.sinceVersion != null && it.defaultState == LanguageFeature.State.ENABLED }
|
||||
val enabledFeatures = values.filter { it.sinceVersion != null }
|
||||
|
||||
if (enabledFeatures.sortedBy { it.sinceVersion!! } != enabledFeatures) {
|
||||
val (a, b) = enabledFeatures.zipWithNext().first { (a, b) -> a.sinceVersion!! > b.sinceVersion!! }
|
||||
|
||||
Reference in New Issue
Block a user