Skip to content

Ban non-exhaustive Zig switch else prongs - #10623

Merged
rtfeldman merged 4 commits into
mainfrom
exhaustive-switch-lint
Aug 5, 2026
Merged

rtfeldman merged 4 commits into
mainfrom
exhaustive-switch-lint

Conversation

@rtfeldman

Copy link
Copy Markdown
Contributor

Adds an AST-based Zig lint that rejects else switch prongs unless the switch contains numeric, string, or character literal cases, where a catch-all represents value-domain behavior rather than an omitted enum tag. Existing enum, error, and OS switches now enumerate their cases or use a discard prong where Zig permits it, so future enum additions fail to compile instead of silently taking an existing default.

@rtfeldman
rtfeldman marked this pull request as ready for review August 5, 2026 03:35
@greptile-apps

greptile-apps Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Too many files changed for review (252 files, 100 file limit).

Bypass the limit by tagging @greptile-apps to review.

@rtfeldman
rtfeldman force-pushed the exhaustive-switch-lint branch from c0b0282 to 72c1a3f Compare August 5, 2026 03:52
@rtfeldman
rtfeldman marked this pull request as draft August 5, 2026 03:52
@rtfeldman
rtfeldman marked this pull request as ready for review August 5, 2026 22:26
@rtfeldman
rtfeldman merged commit 4abac1d into main Aug 5, 2026
20 checks passed
@rtfeldman
rtfeldman deleted the exhaustive-switch-lint branch August 5, 2026 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant