Improve error message when incorrectly using the ||
operator instead of or
#22200
Labels
error message
This issue points out an error message that is unhelpful and should be improved.
Milestone
Zig Version
0.13.0
Steps to Reproduce and Observed Output
In the following code, I incorrectly used
||
instead ofor
(likely a common beginner mistake).The compiler gives an error about chaining comparison operators, likely because
||
has a higher precedence than comparison operators.Expected Output
Instead, it would be much more helpful to give an error suggesting the
or
keyword instead of the||
operator. This could be detected by using the fact that||
is not defined for anything except for the Error Set Type, meaning that even without the comparison operators, it would not be allowed to compile.The text was updated successfully, but these errors were encountered: