[Parcelize] Detect redundant TypeParceler when type aliases are used

Make sure redundancies between class and property TypeParceler
annotations are detected when a type alias is used. This requires
checking the expanded type arguments of the annotation, as just
comparing the cone types is not sufficient because the type arguments
are not expanded.

^KT-64979 Fixed
This commit is contained in:
Brian Norman
2024-01-15 10:36:48 -06:00
committed by Space Team
parent 20340f94d4
commit eded51a0f5
3 changed files with 18 additions and 17 deletions
@@ -122,10 +122,6 @@ private val USE_SITE_TARGET_NAME_MAP = mapOf(
private val DEFAULT_USE_SITE_TARGETS: Set<AnnotationUseSiteTarget> =
USE_SITE_TARGET_NAME_MAP.values.fold(setOf<AnnotationUseSiteTarget>()) { a, b -> a + b } - setOf(AnnotationUseSiteTarget.FILE)
fun FirDeclaration.hasAnnotation(type: ConeClassLikeType, session: FirSession): Boolean {
return annotations.hasAnnotation(type, session)
}
fun FirDeclaration.hasAnnotation(classId: ClassId, session: FirSession): Boolean {
return annotations.hasAnnotation(classId, session)
}
@@ -142,10 +138,6 @@ fun FirAnnotationContainer.hasAnnotation(classId: ClassId, session: FirSession):
return annotations.hasAnnotation(classId, session)
}
fun List<FirAnnotation>.hasAnnotation(type: ConeClassLikeType, session: FirSession): Boolean {
return this.any { it.toAnnotationClassLikeType(session) == type }
}
fun List<FirAnnotation>.hasAnnotation(classId: ClassId, session: FirSession): Boolean {
return this.any { it.toAnnotationClassId(session) == classId }
}