[Serialization] Don't report errors on properties from supertypes

^KT-53926 Fixed
This commit is contained in:
Dmitriy Novozhilov
2023-08-30 17:10:12 +03:00
committed by Space Team
parent b4bc659008
commit e4a51dfa1b
2 changed files with 4 additions and 2 deletions
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.fir.extensions.FirPredicateBasedProvider
* to create predicate with meta annotations, and [LookupPredicate] allows to use only annotations with predefined
* qualified names
*
* Note that predicates can not be used for matching or looking up for local declarations (local functions, local classes, anonymous objects
* Note that predicates can not be used for matching or looking up local declarations (local functions, local classes, anonymous objects
* and their members). The only exception is matching local classes/anonymous objects with [AbstractPredicate.AnnotatedWith] and
* [AbstractPredicate.MetaAnnotatedWith] by [FirPredicateBasedProvider.matches]
*/
@@ -18,6 +18,7 @@ import org.jetbrains.kotlin.fir.analysis.checkers.isSingleFieldValueClass
import org.jetbrains.kotlin.fir.analysis.checkers.toRegularClassSymbol
import org.jetbrains.kotlin.fir.declarations.*
import org.jetbrains.kotlin.fir.declarations.utils.*
import org.jetbrains.kotlin.fir.dispatchReceiverClassLookupTagOrNull
import org.jetbrains.kotlin.fir.expressions.*
import org.jetbrains.kotlin.fir.moduleData
import org.jetbrains.kotlin.fir.resolve.defaultType
@@ -453,7 +454,8 @@ object FirSerializationPluginClassChecker : FirClassChecker() {
reporter: DiagnosticReporter
) {
for (property in properties) {
// TODO: reporting diagnostics on properties from superclasses looks a bad idea
// Don't report anything on properties from supertypes
if (property.propertySymbol.dispatchReceiverClassLookupTagOrNull() != classSymbol.toLookupTag()) continue
val customSerializerType = property.serializableWith
val serializerSymbol = customSerializerType?.toRegularClassSymbol(session)
val propertySymbol = property.propertySymbol