Minor: refactor extended compiler checks

Use an analysis flag instead of a stub language feature
This commit is contained in:
Pavel Kirpichenkov
2021-02-08 15:29:45 +03:00
parent 2a46da906c
commit 75954dd1a4
5 changed files with 8 additions and 9 deletions
@@ -382,6 +382,7 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
CompilerMessageSeverity.ERROR,
"Unknown value for parameter -Xexplicit-api: '$explicitApi'. Value should be one of ${ExplicitApiMode.availableValues()}"
)
put(AnalysisFlags.extendedCompilerChecks, extendedCompilerChecks)
}
}
@@ -431,10 +432,6 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
put(LanguageFeature.InferenceCompatibility, LanguageFeature.State.ENABLED)
}
if (extendedCompilerChecks) {
put(LanguageFeature.ExtendedCompilerChecks, LanguageFeature.State.ENABLED)
}
if (progressiveMode) {
LanguageFeature.values().filter { it.kind.enabledInProgressiveMode }.forEach {
// Don't overwrite other settings: users may want to turn off some particular
@@ -25,8 +25,8 @@ import org.jetbrains.kotlin.analyzer.AnalysisResult
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.*
import org.jetbrains.kotlin.codegen.state.IncompatibleClassTrackerImpl
import org.jetbrains.kotlin.config.AnalysisFlags
import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.config.LanguageVersionSettings
import org.jetbrains.kotlin.config.languageVersionSettings
import org.jetbrains.kotlin.diagnostics.*
@@ -73,7 +73,7 @@ class AnalyzerWithCompilerReport(
.append(", unresolved supertypes: ").append(unresolved!!.joinToString())
.append("\n")
}
if (!languageVersionSettings.supportsFeature(LanguageFeature.ExtendedCompilerChecks)) {
if (!languageVersionSettings.getFlag(AnalysisFlags.extendedCompilerChecks)) {
message.append("Adding -Xextended-compiler-checks argument might provide additional information.\n")
}
messageCollector.report(ERROR, message.toString())