[FIR] Introduce OPERATOR_CALL_ON_CONSTRUCTOR diagnostic

#KT-59943
This commit is contained in:
Evgeniy.Zhelenskiy
2023-10-20 21:17:01 +02:00
committed by Space Team
parent 649bbcf35f
commit f4d18da6a0
12 changed files with 56 additions and 24 deletions
@@ -1636,6 +1636,13 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
token,
)
}
add(FirErrors.OPERATOR_CALL_ON_CONSTRUCTOR) { firDiagnostic ->
OperatorCallOnConstructorImpl(
firDiagnostic.a,
firDiagnostic as KtPsiDiagnostic,
token,
)
}
add(FirErrors.INFIX_MODIFIER_REQUIRED) { firDiagnostic ->
InfixModifierRequiredImpl(
firSymbolBuilder.functionLikeBuilder.buildFunctionSymbol(firDiagnostic.a),
@@ -1182,6 +1182,11 @@ sealed interface KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
val name: String
}
interface OperatorCallOnConstructor : KtFirDiagnostic<PsiElement> {
override val diagnosticClass get() = OperatorCallOnConstructor::class
val name: String
}
interface InfixModifierRequired : KtFirDiagnostic<PsiElement> {
override val diagnosticClass get() = InfixModifierRequired::class
val functionSymbol: KtFunctionLikeSymbol
@@ -1414,6 +1414,12 @@ internal class OperatorModifierRequiredImpl(
token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<PsiElement>(firDiagnostic, token), KtFirDiagnostic.OperatorModifierRequired
internal class OperatorCallOnConstructorImpl(
override val name: String,
firDiagnostic: KtPsiDiagnostic,
token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<PsiElement>(firDiagnostic, token), KtFirDiagnostic.OperatorCallOnConstructor
internal class InfixModifierRequiredImpl(
override val functionSymbol: KtFunctionLikeSymbol,
firDiagnostic: KtPsiDiagnostic,