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

Support pattern matching on empty types #5298

Merged
merged 2 commits into from
Aug 23, 2024
Merged

Conversation

sellout
Copy link
Contributor

@sellout sellout commented Aug 23, 2024

Overview

Previously, match and cases expressions needed to have at least one pattern to match on. This allows them to work with zero patterns, which is useful for matching on empty types.

Since EmptyMatch is no longer a failure case, errors that previously said “I expected some patterns after a match / with or cases but I didn't find any,” now say “Pattern match doesn't cover all possible cases”.

Fixes #4731.

Test coverage

There is a new transcript that covers the new cases. The existing error-messages transcript captures the change in error message with empty cases that are applied to non-empty types.

Previously, `match` and `cases` expressions needed to have at least one
pattern to match on. This allows them to work with zero patterns, which
is useful for matching on empty types.

Since `EmptyMatch` is no longer a failure case, errors that previously
said “I expected some patterns after a match / with or cases but I
didn't find any,” now say “Pattern match doesn't cover all possible
cases”.

Fixes unisonweb#4731.
Copy link
Member

@pchiusano pchiusano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! I'll go ahead and merge while Arya's out.

@pchiusano pchiusano merged commit 7178ec2 into unisonweb:trunk Aug 23, 2024
20 checks passed
@sellout sellout deleted the empty-match branch August 23, 2024 23:22
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.

Match with no cases in Void.absurdly
2 participants