[FIR] Make toAnnotationLookupTag() return null for generic annotations
This commit is contained in:
+1
-1
@@ -837,7 +837,7 @@ class FirElementSerializer private constructor(
|
||||
private fun MutableVersionRequirementTable.serializeVersionRequirements(annotations: List<FirAnnotationCall>): List<Int> =
|
||||
annotations
|
||||
.filter {
|
||||
it.toAnnotationClassId().asSingleFqName() == RequireKotlinConstants.FQ_NAME
|
||||
it.toAnnotationClassId()?.asSingleFqName() == RequireKotlinConstants.FQ_NAME
|
||||
}
|
||||
.mapNotNull(::serializeVersionRequirementFromRequireKotlin)
|
||||
.map(::get)
|
||||
|
||||
+6
-5
@@ -26,14 +26,15 @@ private val RETENTION_CLASS_ID = ClassId.fromString("kotlin/annotation/Retention
|
||||
private val TARGET_CLASS_ID = ClassId.fromString("kotlin/annotation/Target")
|
||||
private val JVM_FIELD_CLASS_ID = ClassId.fromString("kotlin/jvm/JvmField")
|
||||
|
||||
private fun FirAnnotationCall.toAnnotationLookupTag(): ConeClassLikeLookupTag =
|
||||
(annotationTypeRef.coneType as ConeClassLikeType).lookupTag
|
||||
private fun FirAnnotationCall.toAnnotationLookupTag(): ConeClassLikeLookupTag? =
|
||||
// this cast fails when we have generic-typed annotations @T
|
||||
(annotationTypeRef.coneType as? ConeClassLikeType)?.lookupTag
|
||||
|
||||
fun FirAnnotationCall.toAnnotationClassId(): ClassId =
|
||||
toAnnotationLookupTag().classId
|
||||
fun FirAnnotationCall.toAnnotationClassId(): ClassId? =
|
||||
toAnnotationLookupTag()?.classId
|
||||
|
||||
private fun FirAnnotationCall.toAnnotationClass(session: FirSession): FirRegularClass? =
|
||||
toAnnotationLookupTag().toSymbol(session)?.fir as? FirRegularClass
|
||||
toAnnotationLookupTag()?.toSymbol(session)?.fir as? FirRegularClass
|
||||
|
||||
// TODO: this is temporary solution, we need something better
|
||||
private val FirExpression.callableNameOfMetaAnnotationArgument: Name?
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ internal fun StringBuilder.renderAnnotations(
|
||||
}
|
||||
|
||||
private fun FirAnnotationCall.isParameterName(): Boolean {
|
||||
return toAnnotationClassId().asSingleFqName() == StandardNames.FqNames.parameterName
|
||||
return toAnnotationClassId()?.asSingleFqName() == StandardNames.FqNames.parameterName
|
||||
}
|
||||
|
||||
private fun renderAnnotation(annotation: FirAnnotationCall, coneTypeIdeRenderer: ConeTypeIdeRenderer, session: FirSession): String {
|
||||
|
||||
Reference in New Issue
Block a user