-
Notifications
You must be signed in to change notification settings - Fork 22
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 patterns on arrays and opaque types. #878
base: main
Are you sure you want to change the base?
Conversation
2235d6b
to
13cbc18
Compare
13cbc18
to
7ec5516
Compare
@W95Psp Not sure that you got notified but this now ready for review! |
I started to look at this a bit, there are issues with fresh vars I think https://hax-playground.cryspen.com/#fstar/7ec551634b/gist=898efdab8cc9c41469c5f28e72216b6e |
Good catch, I pushed a fix. |
Looks like there are conflicts that need to get resolved. |
@W95Psp @maximebuyse what's the state of this? Please update or close. |
Closes #464 , #804
We add a phase to rewrite array patterns and usize/isize/i128/u128 patterns.
The phase rewrites them with
if let
guards.For integer types the idea is to rewrite:
as
For array/slice patterns, the idea is to rewrite:
as
In the case of slice patterns we also test the length of the slice in the condition:
becomes
In case the subpatterns of an array also need a guard to be rewritten, we rewrite using a pattern matching.
In case there is a disjunctive pattern with guards in the subpatterns, we try to take a boolean disjunction of the guards. When it is not possible we call the phase
hoist_disjunctive_patterns
and separate the arm into one arm for each case of the disjunction.