From d74d5085254f70c84c1c4371e2615ef956379308 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Mon, 13 Mar 2017 13:04:06 +0300 Subject: [PATCH] Introduce LanguageFeature.State, drop coroutines-related pseudofeatures Previously there were three LanguageFeature instances -- Coroutines, DoNotWarnOnCoroutines and ErrorOnCoroutines -- which were handled very awkwardly in the compiler and in the IDE to basically support a language feature with a more complex state: not just enabled/disabled, but also enabled with warning and enabled with error. Introduce a new enum LanguageFeature.State for this and allow LanguageVersionSettings to get the state of any language feature with 'getFeatureSupport'. One noticeable drawback of this approach is that looking at the API, one may assume that any language feature can be in one of the four states (enabled, warning, error, disabled). This is not true however; there's only one language feature at the moment (coroutines) for which these intermediate states (warning, error) are handled in any way. This may be refactored further by abstracting the logic that checks the language feature availability so that it would work exactly the same for any feature. Another issue is that the difference among ENABLED_WITH_ERROR and DISABLED is not clear. They are left as separate states because at the moment, different diagnostics are reported in these two cases and quick-fixes in IDE rely on that Original commit: 32826c168638f516bdb764b28c90d7bf3f9f5c13 --- .../src/org/jetbrains/kotlin/config/KotlinFacetSettings.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/jps/jps-common/src/org/jetbrains/kotlin/config/KotlinFacetSettings.kt b/jps/jps-common/src/org/jetbrains/kotlin/config/KotlinFacetSettings.kt index 19f449cb599..fbda4ced164 100644 --- a/jps/jps-common/src/org/jetbrains/kotlin/config/KotlinFacetSettings.kt +++ b/jps/jps-common/src/org/jetbrains/kotlin/config/KotlinFacetSettings.kt @@ -50,6 +50,7 @@ sealed class TargetPlatformKind( } } +// TODO: merge with LanguageFeature.State enum class CoroutineSupport( override val description: String, val compilerArgument: String