Partial Operator Precedence

October 24, 2026

    # Partial Operator Precedence

    Author: Ryan Liptak

As of yesterday, the second oldest open proposal for the Zig language was issue #114: require parentheses sometimes to disambiguate confusing operator precedence, opened February 8, 2016. Ten years later, that proposal has been implemented in the master branch version of Zig thanks to contributor CMDRZero.

This means that some combinations of operators no longer have a defined precedence, and for those that don’t, the compiler will now require parentheses:

const a = x orelse y == z;
test.zig:1:22: error: ambiguous operator precedence with operators ... orelse ... == ...; use parentheses to disambiguate
const a = x orelse y == z;
                     ^~
test.zig:1:13: note: previous ambiguous operator here
const a = x orelse y == z;
            ^~~~~~
test.zig:1:22: note: in zig 0.17.x, this was evaluated as (... orelse ...) == ...