Use a correct type for SERIALIZER_TYPE_INCOMPATIBLE diagnostic.

This diagnostic used an incorrect type for rendering (outer class type instead of a property type)
and didn't expand type argument of `KSerializer`.

Also add an additional test case for generic parameters.

#KT-63570 Fixed
This commit is contained in:
Leonid Startsev
2023-11-24 16:16:51 +01:00
committed by Space Team
parent 1260d03561
commit 51e3e9af94
7 changed files with 112 additions and 2 deletions
@@ -564,14 +564,14 @@ object FirSerializationPluginClassChecker : FirClassChecker() {
serializerType: ConeKotlinType,
reporter: DiagnosticReporter
) {
val serializerForType = serializerType.serializerForType(session) ?: return
val serializerForType = serializerType.serializerForType(session)?.fullyExpandedType(session) ?: return
val declarationTypeClassId = declarationType.classId
if (declarationTypeClassId == null || declarationTypeClassId != serializerForType.classId) {
reporter.reportOn(
source ?: containingClassSymbol.serializableOrMetaAnnotationSource,
FirSerializationErrors.SERIALIZER_TYPE_INCOMPATIBLE,
containingClassSymbol.defaultType(),
declarationType,
serializerType,
serializerForType
)