Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusion between builtin undefined and enum variant #242

Open
CoffeeImpliesCode opened this issue Feb 23, 2025 · 0 comments · May be fixed by #254
Open

Confusion between builtin undefined and enum variant #242

CoffeeImpliesCode opened this issue Feb 23, 2025 · 0 comments · May be fixed by #254
Labels
A-linter Area - linter and lint rules C-bug Category - Something isn't working

Comments

@CoffeeImpliesCode
Copy link

Version
main @ 83d016d (after 0.6.3)

Describe the bug
The linter gets confused between the builtin undefined keyword and an enum variant named undefined (which is perfectly legal), wanting me to add a safety comment.

To Reproduce

  • create enum with variant .undefined
  • use zlint
  • receive the following warning:
  ⚠ unsafe-undefined: `undefined` is missing a safety comment
   ╭─[src/main.zig:4:18]
 4 │ const A = enum { undefined, hello };
   ·                  ─────────
   ╰────
  help: Add a `SAFETY: <reason>` before this line explaining why this code is safe.

Expected behavior
there should be no safety lint triggered on the enum A.

Screenshots
see To Reproduce

Additional Context
This is unhelpful, as the API spec I'm working with defines enums with the value undefined, so changing it is not really a preferred option. I currently have ~30 warnings of this sort.

@CoffeeImpliesCode CoffeeImpliesCode added the C-bug Category - Something isn't working label Feb 23, 2025
@DonIsaac DonIsaac added the A-linter Area - linter and lint rules label Feb 24, 2025
@felipeasimos felipeasimos linked a pull request Mar 9, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linter Area - linter and lint rules C-bug Category - Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants