public static PsiCall copyTopLevelCall(@NotNull PsiCall call) {
    if (call instanceof PsiEnumConstant) {
      PsiFile contextFile = (PsiFile)call.getContainingFile().copy();
      return PsiTreeUtil.findSameElementInCopy(call, contextFile);
    }
    PsiElement expressionForType = call;
    while (true) {
      PsiElement parent = PsiUtil.skipParenthesizedExprUp(expressionForType.getParent());
      if (!(parent instanceof PsiConditionalExpression) ||
          PsiTreeUtil.isAncestor(((PsiConditionalExpression)parent).getCondition(), expressionForType, false)) {
        break;
      }
      expressionForType = parent;
    }
    PsiType type = PsiTypesUtil.getExpectedTypeByParent(expressionForType);
    if (PsiTypesUtil.isDenotableType(type, call)) {
      return (PsiCall)copyWithExpectedType(call, type);
    }
    return (PsiCall)call.copy();
  }
public static PsiCall copyTopLevelCall(@NotNull PsiCall call)