From 4f85cdbaed028163634a6384aaf4f3883c5d2dd4 Mon Sep 17 00:00:00 2001 From: "Anastasia.Nekrasova" Date: Wed, 18 Oct 2023 20:57:28 +0300 Subject: [PATCH] [K2] Disappeared COMPONENT_FUNCTION_MISSING ^KT-59941 --- .../declaration/FirDestructuringDeclarationChecker.kt | 8 +++++++- .../typeInferenceFailedOnComponentN.fir.kt | 9 --------- .../typeInferenceFailedOnComponentN.kt | 1 + 3 files changed, 8 insertions(+), 10 deletions(-) delete mode 100644 compiler/testData/diagnostics/tests/inference/reportingImprovements/typeInferenceFailedOnComponentN.fir.kt diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDestructuringDeclarationChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDestructuringDeclarationChecker.kt index e7c8b0eea73..d7b488d5907 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDestructuringDeclarationChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDestructuringDeclarationChecker.kt @@ -154,7 +154,13 @@ object FirDestructuringDeclarationChecker : FirPropertyChecker() { is ConeConstraintSystemHasContradiction -> { val componentType = componentCall.resolvedType if (componentType is ConeErrorType) { - // There will be other errors on this error type. + reporter.reportOn( + source, + FirErrors.COMPONENT_FUNCTION_MISSING, + diagnostic.candidates.first().callInfo.name, + destructuringDeclarationType, + context + ) return } val expectedType = property.returnTypeRef.coneType diff --git a/compiler/testData/diagnostics/tests/inference/reportingImprovements/typeInferenceFailedOnComponentN.fir.kt b/compiler/testData/diagnostics/tests/inference/reportingImprovements/typeInferenceFailedOnComponentN.fir.kt deleted file mode 100644 index 42136d6dd2b..00000000000 --- a/compiler/testData/diagnostics/tests/inference/reportingImprovements/typeInferenceFailedOnComponentN.fir.kt +++ /dev/null @@ -1,9 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE - -class X - -operator fun X.component1(): T = TODO() - -fun test() { - val (y) = X() -} diff --git a/compiler/testData/diagnostics/tests/inference/reportingImprovements/typeInferenceFailedOnComponentN.kt b/compiler/testData/diagnostics/tests/inference/reportingImprovements/typeInferenceFailedOnComponentN.kt index 3b974696335..6df5a7af857 100644 --- a/compiler/testData/diagnostics/tests/inference/reportingImprovements/typeInferenceFailedOnComponentN.kt +++ b/compiler/testData/diagnostics/tests/inference/reportingImprovements/typeInferenceFailedOnComponentN.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE class X