[FIR] Support of type arguments in annotations ^KT-48444 Fixed
This commit is contained in:
+3
-1
@@ -377,7 +377,8 @@ class DeclarationsConverter(
|
||||
CONSTRUCTOR_CALLEE -> constructorCalleePair = convertConstructorInvocation(unescapedAnnotation)
|
||||
}
|
||||
}
|
||||
val name = (constructorCalleePair.first as? FirUserTypeRef)?.qualifier?.last()?.name ?: Name.special("<no-annotation-name>")
|
||||
val qualifier = (constructorCalleePair.first as? FirUserTypeRef)?.qualifier?.last()
|
||||
val name = qualifier?.name ?: Name.special("<no-annotation-name>")
|
||||
return buildAnnotationCall {
|
||||
source = unescapedAnnotation.toFirSourceElement()
|
||||
useSiteTarget = annotationUseSiteTarget ?: defaultAnnotationUseSiteTarget
|
||||
@@ -392,6 +393,7 @@ class DeclarationsConverter(
|
||||
this.name = name
|
||||
}
|
||||
extractArgumentsFrom(constructorCalleePair.second)
|
||||
typeArguments += qualifier?.typeArgumentList?.typeArguments ?: listOf()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1738,9 +1738,7 @@ open class RawFirBuilder(
|
||||
referenceExpression!!.toFirSourceElement(),
|
||||
referenceExpression!!.getReferencedNameAsName(),
|
||||
FirTypeArgumentListImpl(ktQualifier?.typeArgumentList?.toKtPsiSourceElement() ?: source).apply {
|
||||
for (typeArgument in ktQualifier!!.typeArguments) {
|
||||
typeArguments += typeArgument.convert<FirTypeProjection>()
|
||||
}
|
||||
typeArguments.appendTypeArguments(ktQualifier!!.typeArguments)
|
||||
}
|
||||
)
|
||||
qualifier.add(firQualifier)
|
||||
@@ -1809,6 +1807,7 @@ open class RawFirBuilder(
|
||||
source = (annotationEntry.typeReference?.typeElement as? KtUserType)?.referenceExpression?.toFirSourceElement()
|
||||
this.name = name
|
||||
}
|
||||
typeArguments.appendTypeArguments(annotationEntry.typeArguments)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2358,9 +2357,7 @@ open class RawFirBuilder(
|
||||
|
||||
return result.apply {
|
||||
this.explicitReceiver = explicitReceiver
|
||||
for (typeArgument in expression.typeArguments) {
|
||||
typeArguments += typeArgument.convert<FirTypeProjection>()
|
||||
}
|
||||
typeArguments.appendTypeArguments(expression.typeArguments)
|
||||
}.build()
|
||||
}
|
||||
|
||||
@@ -2537,6 +2534,12 @@ open class RawFirBuilder(
|
||||
source = expression.toFirSourceElement()
|
||||
}
|
||||
}
|
||||
|
||||
private fun MutableList<FirTypeProjection>.appendTypeArguments(args: List<KtTypeProjection>) {
|
||||
for (typeArgument in args) {
|
||||
this += typeArgument.convert<FirTypeProjection>()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user