From 8519053527f232a48cb974302f4b9969eea32b1a Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Wed, 28 Jun 2023 12:21:49 +0300 Subject: [PATCH] K2: Get rid of errorsToIgnore parameter during error reporting The reason is that it's potentially might lead to some errors are actually ignored leading to false-negatively green code, while on the other hand we don't have any evidences (like tests) that not-having the parameter lead to at least some redundant diagnostics. --- .../coneDiagnosticToFirDiagnostic.kt | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/coneDiagnosticToFirDiagnostic.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/coneDiagnosticToFirDiagnostic.kt index 67228f282ad..f4fc1f6dbda 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/coneDiagnosticToFirDiagnostic.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/coneDiagnosticToFirDiagnostic.kt @@ -15,11 +15,7 @@ import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.analysis.checkers.declaration.isLocalMember import org.jetbrains.kotlin.fir.analysis.getChild import org.jetbrains.kotlin.fir.builder.FirSyntaxErrors -import org.jetbrains.kotlin.fir.declarations.utils.isExpect -import org.jetbrains.kotlin.fir.declarations.utils.isInfix -import org.jetbrains.kotlin.fir.declarations.utils.isInner -import org.jetbrains.kotlin.fir.declarations.utils.isOperator -import org.jetbrains.kotlin.fir.declarations.utils.visibility +import org.jetbrains.kotlin.fir.declarations.utils.* import org.jetbrains.kotlin.fir.diagnostics.* import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessExpression import org.jetbrains.kotlin.fir.references.toResolvedCallableSymbol @@ -314,7 +310,6 @@ private fun mapInapplicableCandidateError( source, qualifiedAccessSource, session.typeContext, - mutableSetOf(), diagnostic.candidate ) } @@ -345,7 +340,6 @@ private fun mapSystemHasContradictionError( source: KtSourceElement, qualifiedAccessSource: KtSourceElement?, ): List { - val errorsToIgnore = mutableSetOf() return buildList { for (error in diagnostic.candidate.errors) { addIfNotNull( @@ -353,7 +347,6 @@ private fun mapSystemHasContradictionError( source, qualifiedAccessSource, session.typeContext, - errorsToIgnore, diagnostic.candidate, ) ) @@ -361,7 +354,6 @@ private fun mapSystemHasContradictionError( }.ifEmpty { listOfNotNull( diagnostic.candidate.errors.firstNotNullOfOrNull { - if (it in errorsToIgnore) return@firstNotNullOfOrNull null val message = when (it) { is NewConstraintError -> "NewConstraintError at ${it.position}: ${it.lowerType} , candidate: AbstractCandidate, ): KtDiagnostic? { return when (this) { @@ -427,12 +418,6 @@ private fun ConstraintSystemError.toDiagnostic( ) } - is ExplicitTypeParameterConstraintPosition<*>, - is DelegatedPropertyConstraintPosition<*> -> { - errorsToIgnore.add(this) - return null - } - else -> null } }