[FIR] Implement PROTECTED_CONSTRUCTOR_NOT_IN_SUPER_CALL

^KT-59382 Fixed
This commit is contained in:
Nikolay Lunyak
2023-07-07 17:00:51 +03:00
committed by Space Team
parent 00fb927624
commit 4bba93f633
16 changed files with 79 additions and 82 deletions
@@ -724,6 +724,13 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
token,
)
}
add(FirErrors.PROTECTED_CONSTRUCTOR_NOT_IN_SUPER_CALL) { firDiagnostic ->
ProtectedConstructorNotInSuperCallImpl(
firSymbolBuilder.buildSymbol(firDiagnostic.a),
firDiagnostic as KtPsiDiagnostic,
token,
)
}
add(FirErrors.SUPERTYPE_NOT_INITIALIZED) { firDiagnostic ->
SupertypeNotInitializedImpl(
firDiagnostic as KtPsiDiagnostic,
@@ -542,6 +542,11 @@ sealed interface KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
override val diagnosticClass get() = PrimaryConstructorDelegationCallExpected::class
}
interface ProtectedConstructorNotInSuperCall : KtFirDiagnostic<KtExpression> {
override val diagnosticClass get() = ProtectedConstructorNotInSuperCall::class
val symbol: KtSymbol
}
interface SupertypeNotInitialized : KtFirDiagnostic<KtTypeReference> {
override val diagnosticClass get() = SupertypeNotInitialized::class
}
@@ -640,6 +640,12 @@ internal class PrimaryConstructorDelegationCallExpectedImpl(
token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<PsiElement>(firDiagnostic, token), KtFirDiagnostic.PrimaryConstructorDelegationCallExpected
internal class ProtectedConstructorNotInSuperCallImpl(
override val symbol: KtSymbol,
firDiagnostic: KtPsiDiagnostic,
token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<KtExpression>(firDiagnostic, token), KtFirDiagnostic.ProtectedConstructorNotInSuperCall
internal class SupertypeNotInitializedImpl(
firDiagnostic: KtPsiDiagnostic,
token: KtLifetimeToken,