[kotlin] IDEA-353900 k2: Don't produce <> if there is no params

GitOrigin-RevId: afec1ef8347f39ada748a3f652a362be576dc2c7
This commit is contained in:
Marat Dinmukhametov
2024-09-26 18:00:18 +00:00
committed by intellij-monorepo-bot
parent a2ca3fd2e3
commit 77db7b1b79
@@ -249,11 +249,11 @@ abstract class KotlinUastElementFactory(project: Project) : UastElementFactory {
val methodCallPsiType = KotlinUFunctionCallExpression(analyzableMethodCall, null).getExpressionType()
if (methodCallPsiType == null || !expectedReturnType.isAssignableFrom(GenericsUtil.eliminateWildcards(methodCallPsiType))) {
val typeParams = (expectedReturnType as? PsiClassType)?.parameters?.map { it.getFQname(context) }
val typeParams = (expectedReturnType as? PsiClassType)?.parameters?.mapNotNull { it.getFQname(context) }
if (typeParams == null) return KotlinUFunctionCallExpression(analyzableMethodCall, null)
for (typeParam in typeParams) {
val typeParameter = psiFactory.createTypeArgument(typeParam.orEmpty())
val typeParameter = psiFactory.createTypeArgument(typeParam)
analyzableMethodCall.addTypeArgument(typeParameter)
}
return KotlinUFunctionCallExpression(analyzableMethodCall, null)