[kotlin] Simplify KtTypeReference.isAnnotatedDeep

^KTIJ-21956

GitOrigin-RevId: cdd4050718adfb4c26473110cf96458ae0b889b7
This commit is contained in:
Alexey Belkov
2022-06-10 19:01:47 +00:00
committed by intellij-monorepo-bot
parent 2951230c7e
commit 7d85424f6a
@@ -425,14 +425,9 @@ fun ClassDescriptor.isRange(): Boolean {
}
fun KtTypeReference.isAnnotatedDeep(): Boolean {
fun List<KtTypeReference>.areAnnotatedDeep(): Boolean {
for (type in this) {
if (type.annotationEntries.isNotEmpty()) return true
if (type.typeArguments().mapNotNull { it.typeReference }.areAnnotatedDeep()) return true
}
return false
}
return listOf(this).areAnnotatedDeep()
if (annotationEntries.isNotEmpty()) return true
if (typeArguments().any { it.typeReference?.isAnnotatedDeep() == true }) return true
return false
}
fun KtTypeReference?.typeArguments(): List<KtTypeProjection> {