[FIR JS] Support 2 JS diagnostics

The change in `FirDiagnosticsHandler` ensures
`DEBUG_INFO_DYNAMIC` is still reported in
`FirPsiJsOldFrontendDiagnosticsTestGenerated.testConventions`.

Support `SPREAD_OPERATOR_IN_DYNAMIC_CALL` and
`WRONG_OPERATION_WITH_DYNAMIC`
This commit is contained in:
Nikolay Lunyak
2023-04-03 15:12:18 +03:00
committed by Space Team
parent 57568770b4
commit 03e2152957
15 changed files with 181 additions and 23 deletions
@@ -5063,6 +5063,19 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
token,
)
}
add(FirJsErrors.SPREAD_OPERATOR_IN_DYNAMIC_CALL) { firDiagnostic ->
SpreadOperatorInDynamicCallImpl(
firDiagnostic as KtPsiDiagnostic,
token,
)
}
add(FirJsErrors.WRONG_OPERATION_WITH_DYNAMIC) { firDiagnostic ->
WrongOperationWithDynamicImpl(
firDiagnostic.a,
firDiagnostic as KtPsiDiagnostic,
token,
)
}
add(FirSyntaxErrors.SYNTAX) { firDiagnostic ->
SyntaxImpl(
firDiagnostic as KtPsiDiagnostic,
@@ -3523,6 +3523,15 @@ sealed class KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
override val diagnosticClass get() = DelegationByDynamic::class
}
abstract class SpreadOperatorInDynamicCall : KtFirDiagnostic<KtElement>() {
override val diagnosticClass get() = SpreadOperatorInDynamicCall::class
}
abstract class WrongOperationWithDynamic : KtFirDiagnostic<KtElement>() {
override val diagnosticClass get() = WrongOperationWithDynamic::class
abstract val operation: String
}
abstract class Syntax : KtFirDiagnostic<PsiElement>() {
override val diagnosticClass get() = Syntax::class
}
@@ -4262,6 +4262,17 @@ internal class DelegationByDynamicImpl(
override val token: KtLifetimeToken,
) : KtFirDiagnostic.DelegationByDynamic(), KtAbstractFirDiagnostic<KtElement>
internal class SpreadOperatorInDynamicCallImpl(
override val firDiagnostic: KtPsiDiagnostic,
override val token: KtLifetimeToken,
) : KtFirDiagnostic.SpreadOperatorInDynamicCall(), KtAbstractFirDiagnostic<KtElement>
internal class WrongOperationWithDynamicImpl(
override val operation: String,
override val firDiagnostic: KtPsiDiagnostic,
override val token: KtLifetimeToken,
) : KtFirDiagnostic.WrongOperationWithDynamic(), KtAbstractFirDiagnostic<KtElement>
internal class SyntaxImpl(
override val firDiagnostic: KtPsiDiagnostic,
override val token: KtLifetimeToken,