tree-sitter/tree-sitter-php

Incorrect precedence for error supression operator

Sjord opened this issue · 0 comments

Sjord commented
<?php
@trigger_error("a") && trigger_error("b");

Actual:

@(trigger_error("a") && trigger_error("b"))

(program [0, 0] - [2, 0]
  (php_tag [0, 0] - [0, 5])
  (expression_statement [1, 0] - [1, 42]
    (unary_op_expression [1, 0] - [1, 41]
      (binary_expression [1, 1] - [1, 41]
        left: (function_call_expression [1, 1] - [1, 19]
          function: (name [1, 1] - [1, 14])
          arguments: (arguments [1, 14] - [1, 19]
            (argument [1, 15] - [1, 18]
              (encapsed_string [1, 15] - [1, 18]
                (string [1, 16] - [1, 17])))))
        right: (function_call_expression [1, 23] - [1, 41]
          function: (name [1, 23] - [1, 36])
          arguments: (arguments [1, 36] - [1, 41]
            (argument [1, 37] - [1, 40]
              (encapsed_string [1, 37] - [1, 40]
                (string [1, 38] - [1, 39])))))))))

Expected: (@trigger_error("a")) && trigger_error("b")

(program [0, 0] - [2, 0]
  (php_tag [0, 0] - [0, 5])
  (expression_statement [1, 0] - [1, 42]
    (binary_expression [1, 1] - [1, 41]
      left: (unary_op_expression [1, 0] - [1, 41]
        (function_call_expression [1, 1] - [1, 19]
          function: (name [1, 1] - [1, 14])
          arguments: (arguments [1, 14] - [1, 19]
            (argument [1, 15] - [1, 18]
              (encapsed_string [1, 15] - [1, 18]
                (string [1, 16] - [1, 17])))))
        right: (function_call_expression [1, 23] - [1, 41]
          function: (name [1, 23] - [1, 36])
          arguments: (arguments [1, 36] - [1, 41]
            (argument [1, 37] - [1, 40]
              (encapsed_string [1, 37] - [1, 40]
                (string [1, 38] - [1, 39])))))))))