From 7bc894d0fe04c0ba7e811af70519c0bdabd6dce8 Mon Sep 17 00:00:00 2001 From: Alexey Sedunov Date: Wed, 8 Feb 2017 15:18:33 +0300 Subject: [PATCH] Kotlin Facet: Check contradictory values of "coroutine support" option #KT-16109 Fixed Original commit: 330beebb2c27a9e3aad31d1461fb1cad456bd2ae --- .../org/jetbrains/kotlin/config/KotlinFacetSettings.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 c77ffee8e09..974af76d7c8 100644 --- a/jps/jps-common/src/org/jetbrains/kotlin/config/KotlinFacetSettings.kt +++ b/jps/jps-common/src/org/jetbrains/kotlin/config/KotlinFacetSettings.kt @@ -74,12 +74,14 @@ enum class CoroutineSupport( companion object { val DEFAULT = ENABLED_WITH_WARNING - @JvmStatic fun byCompilerArguments(arguments: CommonCompilerArguments?) = when { - arguments == null -> DEFAULT + @JvmStatic fun byCompilerArguments(arguments: CommonCompilerArguments?) = byCompilerArgumentsOrNull(arguments) ?: DEFAULT + + fun byCompilerArgumentsOrNull(arguments: CommonCompilerArguments?) = when { + arguments == null -> null arguments.coroutinesEnable -> ENABLED arguments.coroutinesWarn -> ENABLED_WITH_WARNING arguments.coroutinesError -> DISABLED - else -> DEFAULT + else -> null } fun byCompilerArgument(argument: String): CoroutineSupport {