Skip to content

Enhance switch on non-exhaustive enums #24381

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Justus2308
Copy link
Contributor

@Justus2308 Justus2308 commented Jul 10, 2025

Closes #19438
Closes #12250

More details in commit messages
The commits are mostly separate but the second one is still based on the first one. If only one gets accepted I am happy to rebase accordingly.

@Justus2308 Justus2308 force-pushed the switch-better-underscore branch from c97a209 to 057d8f6 Compare July 10, 2025 00:20
@Justus2308
Copy link
Contributor Author

I will try to rebase on top of writergate and look into the CI failures until tomorrow.

Mainly affects ZIR representation of switch_block[_ref]
and special prong (detection) logic for switch.
Adds a new SpecialProng tag 'absorbing_under' that allows
specifying additional explicit tags in a '_' prong which
are respected when checking that every value is handled
during semantic analysis but are not transformed into AIR
and instead 'absorbed' by the '_' branch.
… statements

If both are used, 'else' handles named members and '_' handles
unnamed members. In this case the 'else' prong will be unrolled
to an explicit case containing all remaining named values.
@Justus2308 Justus2308 force-pushed the switch-better-underscore branch from 057d8f6 to 34abbdf Compare July 10, 2025 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant