Misleading error message when keyword used as identifier #22401
Labels
error message
This issue points out an error message that is unhelpful and should be improved.
Milestone
Zig Version
0.14.0-dev.2198+e5f5229fd
Steps to Reproduce and Observed Behavior
The compiler produces poor error messages in these situations:
Expected Behavior
I originally encountered this by trying to return
error.test
from a function - I thought the error message was trying to tell me that all error values had to have an uppercase first letter, since the documentation for errors uses uppercase names, and switching toerror.Test
fixed the error. But it's actually becausetest
is a keyword!It would be helpful if the compiler told you that the identifier you're trying to use is a keyword and you need to either rename it or use the
@""
syntax.I'd be happy to make this change if someone from the core team gave me the go ahead.
The text was updated successfully, but these errors were encountered: