public static boolean checkPrecedence(int precedence, @NotNull GrExpression oldExpr) {
    PsiElement parent = oldExpr.getParent();
    if (parent instanceof GrArgumentList) {
      parent = parent.getParent();
    }
    if (!(parent instanceof GrExpression oldParent)) return false;
    if (oldParent instanceof GrBinaryExpression binaryExpression) {
      GrExpression rightOperand = binaryExpression.getRightOperand();
      return checkPrecedenceForBinaryOps(precedence, binaryExpression.getOperationTokenType(), oldExpr.equals(rightOperand));
    } else {
      return checkPrecedenceForNonBinaryOps(precedence, getPrecedence(oldParent));
    }
  }
public static boolean checkPrecedence(int precedence, @NotNull GrExpression oldExpr)