Skip to content

Adjust operator precedence

Astrid Lauenstein requested to merge AcqRel/spade:operator-precedence into main

This changes the following things:

  • The precedence of bitwise operators has been increased, so that a & 0xF0 == 0x50 parses as (a & 0xF0) == 0x50 instead of a & (0xF0 == 0x50)
  • The parsing of the dereference operator now respects operator precedence, so that *a + b parses as (*a) + b instead of *(a + b)

Both of these make the precedence consistent with the precedence used by Rust, and I don't think either of them are breaking changes due to the previous behavior failing to type check in all cases I can think of.

I would consider the second case a bug fix, as I doubt it was intentional to have two separate sets of parsing logic handling different (but overlapping) subsets of the prefix operators.

Author checklist

  • New Diagnostics have at least one snapshot test that triggers it
  • Added a line to CHANGELOG.md, if relevant

Merge request reports

Loading