Minor: refactor extended compiler checks
Use an analysis flag instead of a stub language feature
This commit is contained in:
+1
-4
@@ -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
|
||||
|
||||
+2
-2
@@ -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())
|
||||
|
||||
@@ -50,4 +50,7 @@ object AnalysisFlags {
|
||||
|
||||
@JvmStatic
|
||||
val libraryToSourceAnalysis by AnalysisFlag.Delegates.Boolean
|
||||
|
||||
@JvmStatic
|
||||
val extendedCompilerChecks by AnalysisFlag.Delegates.Boolean
|
||||
}
|
||||
|
||||
+2
-1
@@ -6,6 +6,7 @@
|
||||
package org.jetbrains.kotlin.resolve.checkers
|
||||
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.config.AnalysisFlags
|
||||
import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.diagnostics.Errors
|
||||
@@ -50,7 +51,7 @@ object MissingDependencySupertypeChecker {
|
||||
context.trace, context.missingSupertypesResolver
|
||||
)
|
||||
|
||||
val eagerChecksAllowed = context.languageVersionSettings.supportsFeature(LanguageFeature.ExtendedCompilerChecks)
|
||||
val eagerChecksAllowed = context.languageVersionSettings.getFlag(AnalysisFlags.extendedCompilerChecks)
|
||||
val unresolvedLazySupertypesByDefault = descriptor is ConstructorDescriptor || descriptor is FakeCallableDescriptorForObject
|
||||
|
||||
if (eagerChecksAllowed || !unresolvedLazySupertypesByDefault && !errorReported) {
|
||||
|
||||
@@ -168,8 +168,6 @@ enum class LanguageFeature(
|
||||
// Looks like we can't enable it until KT-26245 is fixed because otherwise some use cases become broken because of overrides
|
||||
ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated(sinceVersion = null, kind = BUG_FIX),
|
||||
|
||||
ExtendedCompilerChecks(sinceVersion = null),
|
||||
|
||||
// Experimental features
|
||||
|
||||
Coroutines(
|
||||
|
||||
Reference in New Issue
Block a user