-
Notifications
You must be signed in to change notification settings - Fork 84
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
Feature/funargs destructuring #567
Conversation
also, because this transformation is done in a top down pass, we don't have to be recursive or to transform generated `LetPattern`s anymore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Left a few suggestions, and we could also have a bit more tests (for failing patterns and stuff), although since function patterns simply desugar to let patterns, it's maybe a bit redundant.
RichTerm::new( | ||
Term::Fun( | ||
x.clone(), | ||
Term::LetPattern(None, pat, Term::Var(x).into(), t_).into(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are losing quite a few positions here. It can be a problem for error reporting. I guess we can't have a meaningful position for Var(x)
, but maybe the LetPattern
show have the same position as the function body, I imagine this is what we do in the share_normal_form
pass
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure. because, exept for the actual body of the function, for a multiparams function, the pos is same as the main function. So should we not preferably put the rt.pos
than the t_.pos
?
fix comments typo and nickel syntax cleaning Co-authored-by: Yann Hamdaoui <yann.hamdaoui@gmail.com>
also add a todo to remember to check if the herited position is the good one.
Implement destructuring for functions arguments as described in the last point of #81: