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 precedences of binary logical operators #218

Open
susliko opened this issue May 23, 2023 · 0 comments
Open

Incorrect precedences of binary logical operators #218

susliko opened this issue May 23, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@susliko
Copy link
Collaborator

susliko commented May 23, 2023

Commit of tree-sitter-scala you tested this on

2d0e6b8

A code sample showing the error

object X {
  a < b && c > d
}

Show the error node

object_definition [0, 0] - [2, 1]
  name: identifier [0, 7] - [0, 8]
  body: template_body [0, 9] - [2, 1]
    infix_expression [1, 2] - [1, 16]
      left: infix_expression [1, 2] - [1, 12]
        left: infix_expression [1, 2] - [1, 7]
          left: identifier [1, 2] - [1, 3]
          operator: operator_identifier [1, 4] - [1, 5]
          right: identifier [1, 6] - [1, 7]
        operator: operator_identifier [1, 8] - [1, 10]
        right: identifier [1, 11] - [1, 12]
      operator: operator_identifier [1, 13] - [1, 14]
      right: identifier [1, 15] - [1, 16]

What do you expect the tree to look like

Logical binary operators (&&, ||) should have lower precedence over (<, >, ==, <=, >=)

object_definition [0, 0] - [2, 1]
  name: identifier [0, 7] - [0, 8]
  body: template_body [0, 9] - [2, 1]
    infix_expression [1, 2] - [1, 16]
      left: infix_expression
        left: identifier
        operator: operator_identifier (<)
        right: identifier
      operator: operator_identifier (&&)
      right: infix_expression
        left; identifier
        operator: operator_identifier (>)
        right: identifier

Where are you experiencing this error?

nvim-treesitter

@susliko susliko added the enhancement New feature or request label Jun 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant