[FIR] Implement NO_RECEIVER_ALLOWED

This commit is contained in:
Ivan Kochurkin
2021-06-29 16:20:57 +03:00
parent 45a384bb77
commit 263e40e753
11 changed files with 52 additions and 21 deletions
@@ -321,6 +321,12 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
token,
)
}
add(FirErrors.NO_RECEIVER_ALLOWED) { firDiagnostic ->
NoReceiverAllowedImpl(
firDiagnostic as FirPsiDiagnostic,
token,
)
}
add(FirErrors.SUPER_IS_NOT_AN_EXPRESSION) { firDiagnostic ->
SuperIsNotAnExpressionImpl(
firDiagnostic as FirPsiDiagnostic,
@@ -253,6 +253,10 @@ sealed class KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
override val diagnosticClass get() = IllegalSelector::class
}
abstract class NoReceiverAllowed : KtFirDiagnostic<PsiElement>() {
override val diagnosticClass get() = NoReceiverAllowed::class
}
abstract class SuperIsNotAnExpression : KtFirDiagnostic<PsiElement>() {
override val diagnosticClass get() = SuperIsNotAnExpression::class
}
@@ -374,6 +374,13 @@ internal class IllegalSelectorImpl(
override val firDiagnostic: FirPsiDiagnostic by weakRef(firDiagnostic)
}
internal class NoReceiverAllowedImpl(
firDiagnostic: FirPsiDiagnostic,
override val token: ValidityToken,
) : KtFirDiagnostic.NoReceiverAllowed(), KtAbstractFirDiagnostic<PsiElement> {
override val firDiagnostic: FirPsiDiagnostic by weakRef(firDiagnostic)
}
internal class SuperIsNotAnExpressionImpl(
firDiagnostic: FirPsiDiagnostic,
override val token: ValidityToken,