Skip to content

Commit

Permalink
[parser] fix ?? precedence
Browse files Browse the repository at this point in the history
closes #11144
  • Loading branch information
Simn committed Apr 14, 2023
1 parent 1869ece commit a81ea23
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/syntax/parser.ml
Expand Up @@ -270,8 +270,8 @@ let precedence op =
| OpEq | OpNotEq | OpGt | OpLt | OpGte | OpLte -> 6, left
| OpInterval -> 7, left
| OpBoolAnd -> 8, left
| OpBoolOr -> 9, left
| OpArrow | OpNullCoal -> 10, right
| OpBoolOr | OpNullCoal -> 9, left
| OpArrow -> 10, right
| OpAssign | OpAssignOp _ -> 11, right

let is_higher_than_ternary = function
Expand Down
8 changes: 8 additions & 0 deletions tests/unit/src/unit/issues/Issue11144.hx
@@ -0,0 +1,8 @@
package unit.issues;

class Issue11144 extends Test {
function test() {
t(false ?? false || true); // false
t((false ?? false) || true); // true
}
}

0 comments on commit a81ea23

Please sign in to comment.