Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect precedence with invocation on conditional access #151

Open
Sjord opened this issue Feb 10, 2021 · 1 comment
Open

Incorrect precedence with invocation on conditional access #151

Sjord opened this issue Feb 10, 2021 · 1 comment

Comments

@Sjord
Copy link
Collaborator

Sjord commented Feb 10, 2021

        var a = new object();
        var b = a?.ToString();

Actual: invocation_expression with a conditional_access_expression.

                (equals_value_clause [9, 14] - [9, 29]
                  (invocation_expression [9, 16] - [9, 29]
                    (conditional_access_expression [9, 16] - [9, 27]
                      (identifier [9, 16] - [9, 17])
                      (member_binding_expression [9, 18] - [9, 27]
                        (identifier [9, 19] - [9, 27])))
                    (argument_list [9, 27] - [9, 29]))))))

Expected: conditional_access_expression with an invocation_expression.

                (equals_value_clause [9, 14] - [9, 29]
                  (conditional_access_expression [9, 16] - [9, 29]
                    (identifier [9, 16] - [9, 17])
                    (invocation_expression [9, 18] - [9, 29]
                      (member_binding_expression [9, 18] - [9, 27]
                        (identifier [9, 19] - [9, 27]))
                      (argument_list [9, 27] - [9, 29])))))))
@Sjord
Copy link
Collaborator Author

Sjord commented Apr 29, 2021

Test case:

=====================================
Precedence between invocation and conditional access
=====================================

var a = b?.ToString();

---

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        (implicit_type)
        (variable_declarator
          (identifier)
          (equals_value_clause
            (conditional_access_expression
              (identifier)
              (invocation_expression
                (member_binding_expression
                  (identifier))
                (argument_list)))))))))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants