Provide additional information about missing supertypes

Add -X flag to report extra compiler diagnostics which migth break compatibility.
Use the flag to unconditionally check constructors without fear of
prematurely evaluating lazy supertypes.

KT-19234
KT-42404
KT-44583
This commit is contained in:
Pavel Kirpichenkov
2021-02-04 20:46:49 +03:00
parent 4a381d4b83
commit 2a46da906c
17 changed files with 109 additions and 1 deletions
@@ -357,6 +357,13 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
)
var suppressVersionWarnings: Boolean by FreezableVar(false)
@Argument(
value = "-Xextended-compiler-checks",
description = "Enable additional compiler checks that might provide verbose diagnostic information for certain errors.\n" +
"Warning: this mode is not backward-compatible and might cause compilation errors in previously compiled code."
)
var extendedCompilerChecks: Boolean by FreezableVar(false)
open fun configureAnalysisFlags(collector: MessageCollector): MutableMap<AnalysisFlag<*>, Any> {
return HashMap<AnalysisFlag<*>, Any>().apply {
put(AnalysisFlags.skipMetadataVersionCheck, skipMetadataVersionCheck)
@@ -424,6 +431,10 @@ 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