[FIR] Simplify FirPropertyFieldDeclarationChecker

This commit is contained in:
Nikolay Lunyak
2021-09-07 20:38:30 +03:00
committed by TeamCityServer
parent 30e52186eb
commit 8b918e12b2
@@ -38,12 +38,12 @@ object FirPropertyFieldTypeChecker : FirPropertyChecker() {
reporter.reportOn(backingField.source, FirErrors.PROPERTY_FIELD_DECLARATION_MISSING_INITIALIZER, context)
}
if (backingField.isSubtypeOf(declaration, typeCheckerContext)) {
checkAsPropertyNotSubtype(declaration, context, reporter)
} else if (declaration.isSubtypeOf(backingField, typeCheckerContext)) {
if (!backingField.isSubtypeOf(declaration, typeCheckerContext)) {
checkAsFieldNotSubtype(declaration, context, reporter)
} else {
checkAsIndependentTypes(declaration, context, reporter)
}
if (!declaration.isSubtypeOf(backingField, typeCheckerContext)) {
checkAsPropertyNotSubtype(declaration, context, reporter)
}
}
@@ -69,13 +69,4 @@ object FirPropertyFieldTypeChecker : FirPropertyChecker() {
reporter.reportOn(property.source, FirErrors.PROPERTY_MUST_HAVE_GETTER, context)
}
}
private fun checkAsIndependentTypes(
property: FirProperty,
context: CheckerContext,
reporter: DiagnosticReporter
) {
checkAsPropertyNotSubtype(property, context, reporter)
checkAsFieldNotSubtype(property, context, reporter)
}
}