diff --git a/doc/langref/ambiguous_precedence_mul_bitand.zig b/doc/langref/ambiguous_precedence_mul_bitand.zig index e44997a93ca1496a8144b19d5045a10fdc8ea64b..66f1f5a1a4535148a5377dc3e335dc9e1d498147 100644 --- a/doc/langref/ambiguous_precedence_mul_bitand.zig +++ b/doc/langref/ambiguous_precedence_mul_bitand.zig @@ -3,10 +3,8 @@ test "ambiguous precedence" { const y: u8 = 2; const z: u8 = 3; - // Its not obvious below if this is multiplication by a masked value - // `(x&y) *% z` - // or a masking of wrapped multiplication - // `x & (y*%z)` + // 1. Could be multiplication by a masked value: (x&y) *% z + // 2. Or masking the result of multiplication: x & (y*%z) _ = x & y *% z; } diff --git a/doc/langref/ambiguous_precedence_orelse_ne.zig b/doc/langref/ambiguous_precedence_orelse_ne.zig index 1bbd662837e71f9941b144bcbb7c353cb945a046..922886e24ba36b0f5e522269cf6eca593137122c 100644 --- a/doc/langref/ambiguous_precedence_orelse_ne.zig +++ b/doc/langref/ambiguous_precedence_orelse_ne.zig @@ -9,12 +9,9 @@ test "ambiguous precedence" { const y: u8 = 0; const z: u8 = 0; - // We might expect the line below to parse something like: - // `makeBool(x) orelse (y != z)` - // but we might elsewhere want something like - // `(nullable(x) orelse y) != w` - // to perform a fallback and then a check, either way its - // not obvious the behavior so we get an error + // Without parentheses the compiler cannot distinguish between two conflicting interpretations: + // 1. Compare on the value which may be recovered: (makeBool(x) orelse y) != z + // 2. Recover to the result of the comparison: makeBool(x) orelse (y != z) _ = makeBool(x) orelse y != z; } diff --git a/doc/langref/ambiguous_precedence_shift_sub.zig b/doc/langref/ambiguous_precedence_shift_sub.zig index 4791e81cd53fde58048bfb783eadf62fee0e4371..b5f7d8a679154bc66af1451224f62fac2f489c91 100644 --- a/doc/langref/ambiguous_precedence_shift_sub.zig +++ b/doc/langref/ambiguous_precedence_shift_sub.zig @@ -2,8 +2,8 @@ test "ambiguous precedence" { const x: u64 = 1; const y: u6 = 63; - // We probably meant `(x << y) - 1` - // But thats not how it would have compiled + // 1. Could mean shift then subtract: (x<