Don't show IR_COMPILED_CLASS error in IJ when it arises in module with backend IR enabled
The problem here is that library resolver uses global project compiler
settings instead of the module ones. That behaviour is caused by more
global problem described in #KT-21246
As a temporary solution we just do not show IR_COMPILED_CLASS error in
IDE if it arises in a module which have -XuseIR or
-Xallow-jvm-ir-dependencies option provided
#KT-36907 fixed
Original commit: 97e320b57f
This commit is contained in:
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.config
|
||||
import com.intellij.openapi.components.ServiceManager
|
||||
import com.intellij.openapi.module.Module
|
||||
import com.intellij.openapi.project.Project
|
||||
import org.jetbrains.kotlin.cli.common.arguments.Argument
|
||||
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
|
||||
import org.jetbrains.kotlin.cli.common.arguments.copyBean
|
||||
import org.jetbrains.kotlin.cli.common.arguments.parseCommandLineArguments
|
||||
@@ -18,6 +19,9 @@ import org.jetbrains.kotlin.platform.compat.toIdePlatform
|
||||
import org.jetbrains.kotlin.platform.isCommon
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||
import org.jetbrains.kotlin.utils.DescriptionAware
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||
import kotlin.reflect.KProperty1
|
||||
import kotlin.reflect.full.findAnnotation
|
||||
|
||||
@Deprecated("Use IdePlatformKind instead.", level = DeprecationLevel.ERROR)
|
||||
sealed class TargetPlatformKind<out Version : TargetPlatformVersion>(
|
||||
@@ -188,6 +192,20 @@ class KotlinFacetSettings {
|
||||
updateMergedArguments()
|
||||
}
|
||||
|
||||
/*
|
||||
This function is needed as some setting values may not be present in compilerArguments
|
||||
but present in additional arguments instead, so we have to check both cases manually
|
||||
*/
|
||||
inline fun <reified A : CommonCompilerArguments> isCompilerSettingPresent(settingReference: KProperty1<A, Boolean>): Boolean {
|
||||
val isEnabledByCompilerArgument = compilerArguments?.safeAs<A>()?.let(settingReference::get)
|
||||
if (isEnabledByCompilerArgument == true) return true
|
||||
val isEnabledByAdditionalSettings = run {
|
||||
val stringArgumentName = settingReference.findAnnotation<Argument>()?.value ?: return@run null
|
||||
compilerSettings?.additionalArguments?.contains(stringArgumentName, ignoreCase = true)
|
||||
}
|
||||
return isEnabledByAdditionalSettings ?: false
|
||||
}
|
||||
|
||||
var languageLevel: LanguageVersion?
|
||||
get() = compilerArguments?.languageVersion?.let { LanguageVersion.fromFullVersionString(it) }
|
||||
set(value) {
|
||||
|
||||
Reference in New Issue
Block a user