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

Exhaustive match #50

Merged
merged 1 commit into from
Dec 21, 2023
Merged

Exhaustive match #50

merged 1 commit into from
Dec 21, 2023

Conversation

RunDevelopment
Copy link
Member

@RunDevelopment RunDevelopment commented Dec 21, 2023

This PR makes match expressions exhaustive, meaning that every value of a type has to be matched by a match arm. If an expression is not matched exhaustively, an EvaluationError will be thrown.

This should ensure correctness in chaiNNer's nodes. I noticed that it was quite easy to write match expressions for enums and forget one variant. The only way to find out was to go through all possible enum values in the UI. This just isn't scalable, because we frequently add new variants to enum inputs.

If the old behavior if desired, use a default match _ => never at the end of the match expression.

@RunDevelopment RunDevelopment merged commit 5b4ac69 into main Dec 21, 2023
3 checks passed
@RunDevelopment RunDevelopment deleted the exhaustive-match branch December 21, 2023 22:33
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