-
Notifications
You must be signed in to change notification settings - Fork 205
letop-punning for extension nodes #2747
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
letop-punning for extension nodes #2747
Conversation
|
(note I commented in #2746 that I thought the |
|
Hi @EmileTrotignon - I think this is ready for review. The let%ext change is very similar to the code from the previous PR and should be an easy review. A bit trickier is I noticed that letop-punning=always could lead to errors if the right hand side had associated comments. I believe I found a fix (for both this new code and the existing), but I'm less confident in that part and would appreciate any pointers |
|
This looks good. Where is the fix about comments ? |
|
The way I tackled the comment issue is by copying the location of the rhs into the pattern (starting in efb3931). I’m not sure if this is the recommended way or not, but it does appear to work on the added test cases |
Julow
left a comment
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.
Awesome :)
df1653d to
68d651a
Compare
EmileTrotignon
left a comment
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.
Thanks a lot for the contributing documentation, its a very big improvement.
|
Sorry I reviewed the contribution.md changes in the wrong PR |
|
No worries @EmileTrotignon. I've pushed updates to #2748 (stacked PRs still need a better workflow for github -- the diffs quickly diverge without a lot of ugly force pushing) |
68d651a to
18c3a3f
Compare
18c3a3f to
1fe36f0
Compare
Julow
left a comment
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.
Looks perfect :) Let's merge just after #2748
|
This can be merged after a rebase on main |
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1fe36f0 to
425ecc4
Compare
|
Rebased :) |
|
Waiting for CI and merging |
|
CI has passed. Thanks for the hand-holding on this feature! |
|
@WardBrian You're very welcome ! If you are interested in contributing further to ocamlformat, maybe we could have a chat about the project. |
|
Sure @EmileTrotignon! I've been a happy user of ocamlformat for years, and this is the first time I found a gap in my needs for it that prompted me to contribute, but I have some spare cycles to do more here or there |
Follow-on to #2746, this makes it so the letop-punning setting also affects nodes like
let%foo bar = bar in ...The trickiest piece here is that the
ands for these nodes don't have the extension, so I needed to do this at the level ofvalue_bindings, notvalue_bindingThis also fixes an issue with comments when a pun is introduced. As far as I can tell, this was also an issue back in 0.26, when the equivalent of
letop-punning=alwayswas the default behavior.