PsiElement (@NotNull PsiReferenceExpression reference, @NotNull PsiRecordComponent component, @NotNull ComponentContext context) { PsiElement expectedCallExpression = reference; if (PsiUtil.skipParenthesizedExprUp(expectedCallExpression.getParent()) instanceof PsiMethodCallExpression methodCallExpression) { expectedCallExpression = methodCallExpression; } PsiElement element = PsiUtil.skipParenthesizedExprUp(expectedCallExpression.getParent()); if (element instanceof PsiVariable variable) { PsiTypeElement variableTypeElement = variable.getTypeElement(); if (variableTypeElement == null) { return expectedCallExpression; } if (!variableTypeElement.isInferredType() && context.options.useVar) { return expectedCallExpression; } PsiType componentType = context.classSubstitutor.substitute(component.getType()); if (PsiTypesUtil.compareTypes(componentType, variable.getType(), false) && variable.getAnnotations().length == 0) { return variable; } } return expectedCallExpression; }