-
Notifications
You must be signed in to change notification settings - Fork 98
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 roundtrip check to support 5.1 <-> 5.2 migrations #519
Conversation
f415dee
to
74d3f76
Compare
CC @patricoferris ! |
Definitely seems to fix the diffing in the 5.2 AST branch (https://github.com/ocaml-ppx/ppxlib/pull/514/checks?check_run_id=29662622891 -- the errors now are because of something I need to potentially promote it seems). The |
Yeah I was kind of expecting |
Printing to source code and parsing with the compiler before running the upward migration is expected to fail because on compilers older than 5.2, `fun x y -> z` and `fun x -> fun y -> z` parse to the same AST. We therefore need to first migrate it to the compiler version before printing it. Signed-off-by: Nathan Rebours <[email protected]>
74d3f76
to
1625f9e
Compare
I got those errors when testing on top of the 5.2 bump as well. My guess is that the deriving_inline bits in |
What puzzles me is that there are two sides to the deriving_inline diff in The other side are those weird formatting changes, such as removed spaces before |
I thought this too, but this is actually always been the case! I tested on older versions of the codebase -- the |
Oh and the |
Ah that's the problem, sorry for all the messages, that's what is broken here. The traversal and ocamlformat are fighting each other, so a lint followed by a format undoes the work of the lint. |
We do still have a roundtripping issue though don't we? Can we go ahead and merge this PR? |
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 think we should leave some comment about the logic in this section, but otherwise this is good to go :))
Signed-off-by: Nathan Rebours <[email protected]>
The trunk build is failing for unrelated reason, I'll try and fix it in a separate PR. Merging! |
Printing to source code and parsing with the compiler before running the upward migration is expected to fail because
fun x y -> z
andfun x -> fun y -> z
parse to the same AST on 5.01- but have different representations on OCaml 5.02+.We therefore need to first migrate it to the compiler version before printing it so that it is properly annotated with attributes by the downward migration, allowing the upward one to preserve the original AST.