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

Do not consider uninhabited constructors when performing exhaustive match checking #21750

Merged
merged 1 commit into from
Oct 20, 2024

Conversation

Alex1005a
Copy link
Contributor

During exhaustive match checking, you can suppress warnings for cases where a constructor contains a field of type Nothing, because it is impossible to obtain an instance of this constructor. For example, Haskell and Ocaml do not issue a warning if the case of a constructor that has a field with type Void is not covered.

@Alex1005a Alex1005a marked this pull request as draft October 10, 2024 23:01
@Alex1005a Alex1005a force-pushed the bottom-types-coverage-checking branch from b61af65 to d459140 Compare October 11, 2024 20:19
@Alex1005a
Copy link
Contributor Author

I changed two tests because the compiler now correctly warns about the unreachable case.

@Alex1005a Alex1005a marked this pull request as ready for review October 11, 2024 21:17
@Alex1005a Alex1005a requested a review from dwijnand October 20, 2024 13:15
@dwijnand dwijnand merged commit 6e32627 into scala:main Oct 20, 2024
28 checks passed
@Alex1005a Alex1005a deleted the bottom-types-coverage-checking branch October 20, 2024 20:02
@WojciechMazur WojciechMazur added this to the 3.6.3 milestone Dec 9, 2024
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.

3 participants