Possibility for more helpful error message upon attempt to use assignment operators in an expression. #16136
Labels
error message
This issue points out an error message that is unhelpful and should be improved.
Milestone
Zig Version
0.11.0-dev.3771+128fd7dd0
Steps to Reproduce and Observed Output
In C and C-like languages, assignment operators can be used as parts of expressions. So, it is allowed to have code like this:
and it would output:
So, someone coming to zig might try something similar like:
Since such trickery is not allowed in zig, the compiler gives an error:
Expected Output
Since the compiler correctly points out where the problem is, the current error message is probably good enough, but it could be improved. It would be more helpful if it could say something like:
I'm not sure if it's worth the effort to change this, but I figured I could just point it out in case.
Edit: as per some suggestions, the message could instead look like:
The text was updated successfully, but these errors were encountered: