[FIR] Add an interface/abstract checker for the backing field
This commit is contained in:
committed by
TeamCityServer
parent
aefd6c30ad
commit
25124cca3d
+12
@@ -2444,6 +2444,18 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirErrors.EXPLICIT_BACKING_FIELD_IN_INTERFACE) { firDiagnostic ->
|
||||
ExplicitBackingFieldInInterfaceImpl(
|
||||
firDiagnostic as FirPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirErrors.EXPLICIT_BACKING_FIELD_IN_ABSTRACT_PROPERTY) { firDiagnostic ->
|
||||
ExplicitBackingFieldInAbstractPropertyImpl(
|
||||
firDiagnostic as FirPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirErrors.ABSTRACT_PROPERTY_IN_PRIMARY_CONSTRUCTOR_PARAMETERS) { firDiagnostic ->
|
||||
AbstractPropertyInPrimaryConstructorParametersImpl(
|
||||
firDiagnostic as FirPsiDiagnostic,
|
||||
|
||||
+8
@@ -1729,6 +1729,14 @@ sealed class KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
|
||||
abstract val modifier: KtModifierKeywordToken
|
||||
}
|
||||
|
||||
abstract class ExplicitBackingFieldInInterface : KtFirDiagnostic<KtBackingField>() {
|
||||
override val diagnosticClass get() = ExplicitBackingFieldInInterface::class
|
||||
}
|
||||
|
||||
abstract class ExplicitBackingFieldInAbstractProperty : KtFirDiagnostic<KtBackingField>() {
|
||||
override val diagnosticClass get() = ExplicitBackingFieldInAbstractProperty::class
|
||||
}
|
||||
|
||||
abstract class AbstractPropertyInPrimaryConstructorParameters : KtFirDiagnostic<KtModifierListOwner>() {
|
||||
override val diagnosticClass get() = AbstractPropertyInPrimaryConstructorParameters::class
|
||||
}
|
||||
|
||||
+14
@@ -2804,6 +2804,20 @@ internal class InapplicableBackingFieldModifierImpl(
|
||||
override val firDiagnostic: FirPsiDiagnostic by weakRef(firDiagnostic)
|
||||
}
|
||||
|
||||
internal class ExplicitBackingFieldInInterfaceImpl(
|
||||
firDiagnostic: FirPsiDiagnostic,
|
||||
override val token: ValidityToken,
|
||||
) : KtFirDiagnostic.ExplicitBackingFieldInInterface(), KtAbstractFirDiagnostic<KtBackingField> {
|
||||
override val firDiagnostic: FirPsiDiagnostic by weakRef(firDiagnostic)
|
||||
}
|
||||
|
||||
internal class ExplicitBackingFieldInAbstractPropertyImpl(
|
||||
firDiagnostic: FirPsiDiagnostic,
|
||||
override val token: ValidityToken,
|
||||
) : KtFirDiagnostic.ExplicitBackingFieldInAbstractProperty(), KtAbstractFirDiagnostic<KtBackingField> {
|
||||
override val firDiagnostic: FirPsiDiagnostic by weakRef(firDiagnostic)
|
||||
}
|
||||
|
||||
internal class ExpectedDeclarationWithBodyImpl(
|
||||
firDiagnostic: FirPsiDiagnostic,
|
||||
override val token: ValidityToken,
|
||||
|
||||
Reference in New Issue
Block a user