[FIR] Forbid backing fields for delegated properties
This commit is contained in:
committed by
TeamCityServer
parent
e4473ad94c
commit
4e56ba2fa4
+6
@@ -2436,6 +2436,12 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirErrors.BACKING_FIELD_FOR_DELEGATED_PROPERTY) { firDiagnostic ->
|
||||
BackingFieldForDelegatedPropertyImpl(
|
||||
firDiagnostic as FirPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirErrors.PROPERTY_MUST_HAVE_GETTER) { firDiagnostic ->
|
||||
PropertyMustHaveGetterImpl(
|
||||
firDiagnostic as FirPsiDiagnostic,
|
||||
|
||||
+4
@@ -1723,6 +1723,10 @@ sealed class KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
|
||||
override val diagnosticClass get() = LateinitNullableBackingField::class
|
||||
}
|
||||
|
||||
abstract class BackingFieldForDelegatedProperty : KtFirDiagnostic<KtBackingField>() {
|
||||
override val diagnosticClass get() = BackingFieldForDelegatedProperty::class
|
||||
}
|
||||
|
||||
abstract class PropertyMustHaveGetter : KtFirDiagnostic<KtProperty>() {
|
||||
override val diagnosticClass get() = PropertyMustHaveGetter::class
|
||||
}
|
||||
|
||||
+7
@@ -2774,6 +2774,13 @@ internal class LateinitNullableBackingFieldImpl(
|
||||
override val firDiagnostic: FirPsiDiagnostic by weakRef(firDiagnostic)
|
||||
}
|
||||
|
||||
internal class BackingFieldForDelegatedPropertyImpl(
|
||||
firDiagnostic: FirPsiDiagnostic,
|
||||
override val token: ValidityToken,
|
||||
) : KtFirDiagnostic.BackingFieldForDelegatedProperty(), KtAbstractFirDiagnostic<KtBackingField> {
|
||||
override val firDiagnostic: FirPsiDiagnostic by weakRef(firDiagnostic)
|
||||
}
|
||||
|
||||
internal class PropertyMustHaveGetterImpl(
|
||||
firDiagnostic: FirPsiDiagnostic,
|
||||
override val token: ValidityToken,
|
||||
|
||||
Reference in New Issue
Block a user