[FIR] Support typealiases in FirAssignAnnotationMatchingService

This commit is contained in:
Nikolay Lunyak
2023-01-10 12:23:26 +02:00
committed by Space Team
parent 0c00e79024
commit 6a1c9e9279
4 changed files with 78 additions and 5 deletions
@@ -9,7 +9,7 @@ import org.jetbrains.kotlin.fir.FirSession
import org.jetbrains.kotlin.fir.caches.FirCache
import org.jetbrains.kotlin.fir.caches.firCachesFactory
import org.jetbrains.kotlin.fir.caches.getValue
import org.jetbrains.kotlin.fir.expressions.classId
import org.jetbrains.kotlin.fir.declarations.toAnnotationClassId
import org.jetbrains.kotlin.fir.extensions.FirExtensionSessionComponent
import org.jetbrains.kotlin.fir.extensions.FirExtensionSessionComponent.Factory
import org.jetbrains.kotlin.fir.resolve.fullyExpandedType
@@ -40,10 +40,10 @@ internal class FirAssignAnnotationMatchingService(
}
private fun FirRegularClassSymbol.annotated(): Boolean {
if (this.annotations.any { it.classId in annotationClassIds }) return true
return resolvedSuperTypeRefs.any {
val symbol = it.type.fullyExpandedType(session).toRegularClassSymbol(session) ?: return@any false
symbol.annotations.any { it.classId in annotationClassIds }
if (this.annotations.any { it.toAnnotationClassId(session) in annotationClassIds }) return true
return resolvedSuperTypeRefs.any { superTypeRef ->
val symbol = superTypeRef.type.fullyExpandedType(session).toRegularClassSymbol(session) ?: return@any false
symbol.annotations.any { it.toAnnotationClassId(session) in annotationClassIds }
}
}
}