[FIR] Implement ADAPTED_CALLABLE_REFERENCE_AGAINST_REFLECTION_TYPE diagnostic

#KT-59401 Fixed
This commit is contained in:
Kirill Rakhman
2023-11-03 15:27:36 +01:00
committed by Space Team
parent d91000e39c
commit 789f886d3c
18 changed files with 104 additions and 92 deletions
@@ -2597,6 +2597,12 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
token,
)
}
add(FirErrors.ADAPTED_CALLABLE_REFERENCE_AGAINST_REFLECTION_TYPE) { firDiagnostic ->
AdaptedCallableReferenceAgainstReflectionTypeImpl(
firDiagnostic as KtPsiDiagnostic,
token,
)
}
add(FirErrors.CLASS_LITERAL_LHS_NOT_A_CLASS) { firDiagnostic ->
ClassLiteralLhsNotAClassImpl(
firDiagnostic as KtPsiDiagnostic,
@@ -1841,6 +1841,10 @@ sealed interface KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
override val diagnosticClass get() = CallableReferenceToAnnotationConstructor::class
}
interface AdaptedCallableReferenceAgainstReflectionType : KtFirDiagnostic<KtExpression> {
override val diagnosticClass get() = AdaptedCallableReferenceAgainstReflectionType::class
}
interface ClassLiteralLhsNotAClass : KtFirDiagnostic<KtExpression> {
override val diagnosticClass get() = ClassLiteralLhsNotAClass::class
}
@@ -2212,6 +2212,11 @@ internal class CallableReferenceToAnnotationConstructorImpl(
token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<KtExpression>(firDiagnostic, token), KtFirDiagnostic.CallableReferenceToAnnotationConstructor
internal class AdaptedCallableReferenceAgainstReflectionTypeImpl(
firDiagnostic: KtPsiDiagnostic,
token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<KtExpression>(firDiagnostic, token), KtFirDiagnostic.AdaptedCallableReferenceAgainstReflectionType
internal class ClassLiteralLhsNotAClassImpl(
firDiagnostic: KtPsiDiagnostic,
token: KtLifetimeToken,