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

Only works for matching on enums directly #1

Open
Manishearth opened this issue Feb 4, 2015 · 0 comments
Open

Only works for matching on enums directly #1

Manishearth opened this issue Feb 4, 2015 · 0 comments

Comments

@Manishearth
Copy link
Owner

If I have a struct containing an extensible enum, matching on struct patterns will be ignored on this.

This can be fixed by writing a walker that descends down struct/enum fields to test for extensibility. While this won't fix the fact that an unconstrained type parameter won't be checked, thats fine, since one can't match on these anyway.

After that fix, it can probably be refined to account for wildcards in the right place (eg if we have struct Foo{x : int, y: ExtensibleEnum}, and all patterns for Foo are of the form Foo{x: something, ..}) to avoid false positives. pat_ty might be useful here, since we can then just walk the pats in the match and ensure that none of them are of an extensible type (unless they are a wildcard in a guardless arm)

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

No branches or pull requests

1 participant