From a871fa9a64c950b3f4c0072fd0b33122e0d9d87e Mon Sep 17 00:00:00 2001 From: Nikolay Lunyak Date: Tue, 8 Aug 2023 14:30:56 +0300 Subject: [PATCH] [FIR] Don't ignore too many diagnostics `DelegatingConstructorCall` - because in this case there is either `UNRESOLVED_REFERENCE` or `SYNTAX` already. `ErrorTypeRef` - because in this case there is `SYNTAX` already. Note that there is only 1 test that shows this behavior, and it's LT-specific. It's `FirLightTreeOldFrontendDiagnosticsTestGenerated.testKt847`, and in this test the string template is parsed and processed differently in LT and PSI: - in LT there are 6 nodes: "", "$this", " must be", "$as", "$t", "". - in PSI there 4 notes: "$this", " must be", "$as", "$t". --- .../fir/analysis/diagnostics/coneDiagnosticToFirDiagnostic.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 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 33c259aeeb7..01b2eaf19d2 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 @@ -156,8 +156,8 @@ private fun ConeDiagnostic.toKtDiagnostic( } private val KtFakeSourceElementKind.canBeIgnored: Boolean - get() = this != KtFakeSourceElementKind.ReferenceInAtomicQualifiedAccess - && this != KtFakeSourceElementKind.ImplicitReturnTypeOfLambdaValueParameter + get() = this == KtFakeSourceElementKind.DelegatingConstructorCall + || this == KtFakeSourceElementKind.ErrorTypeRef fun FirBasedSymbol<*>.toInvisibleReferenceDiagnostic(source: KtSourceElement?): KtDiagnostic? = when (val symbol = this) { is FirCallableSymbol<*> -> FirErrors.INVISIBLE_REFERENCE.createOn(source, symbol, symbol.visibility, symbol.callableId.classId)