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

fix(compiler): Allow proper disambiguation of enum variants #2068

Merged
merged 1 commit into from Mar 14, 2024

Conversation

ospencer
Copy link
Member

When multiple variants with the same name are in scope and one is used in a pattern match, the compiler would warn that the user should disambiguate, but when doing so for variants you'd get a type error. This resolves that issue.

@ospencer ospencer self-assigned this Mar 13, 2024
Copy link
Member

@spotandjake spotandjake left a comment

Choose a reason for hiding this comment

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

I love the look of this change, I assume that the compiler is using the newest occurance of the type? Could we add a third test with explit typing to make sure it is choosing the right one?

Otherwise looks great.

@ospencer
Copy link
Member Author

I assume that the compiler is using the newest occurance of the type? Could we add a third test with explit typing to make sure it is choosing the right one?

I'm not sure what you mean. There's an annotation on the pattern for each test that forces the compiler to use the version annotated. Without the annotation it would guess.

Copy link
Member

@spotandjake spotandjake left a comment

Choose a reason for hiding this comment

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

ah ok, looks great than

@ospencer ospencer added this pull request to the merge queue Mar 13, 2024
Merged via the queue into main with commit f3007b4 Mar 14, 2024
12 checks passed
@ospencer ospencer deleted the oscar/enum-disambiguation branch March 14, 2024 00:13
@github-actions github-actions bot mentioned this pull request Mar 14, 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.

None yet

3 participants