-
Notifications
You must be signed in to change notification settings - Fork 99
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
trunk-support
supports trunk
#451
Conversation
(it compiles, at least) Signed-off-by: Paul-Elliot <[email protected]>
Signed-off-by: Paul-Elliot <[email protected]>
I was able to use this with trunk and run most of the jsoo test-suite. |
Thanks, @panglesd, for this PR and all your work on trunk support! Would it sound good to you to separate the two changes? I'd merge the support for local open types as is: It's a new syntax feature represented by a new node and your migrations do what expected. The syntactic arity support seems a lot more complex. We'll have trouble, both getting the migrations semantically as right as possible and updating all the PPXs it'll break once we bump the AST. First things first: To get the migrations right, we should add tests. Btw, @hhugo could you point us to the jsoo test that breaks? Once the migrations are isolated and with tests, let's ask the author of the compiler PR @ncik-roberts if they'd be willing to give us a hand, similarly to how Octachron helped with the support of value binding type constraints. By the end of the day, the original author understands the change the best. |
Yes, when you are in that state please let me know. I hope I can be helpful, both with how to proceed with the OCaml 5.2 release and for a good long-term API for ppxlib here. |
I opened this PR quickly, to allow for compilation on trunk of (hopefully most) programs that depend on ppxlib. I did not add test or anything because I just did it quickly and it was not finished. We have made some progress on migrations with @Julow! But the changes are not pushed yet, since it's WIP. About local open types: I think we can do better. This naive migration will get us unable to use ppxlib in conjunction with local open types. We can use an attribute with a carefully crafted payload to remember the local open type, and put it back in the upward migration. About syntactic arity, we are also using attributes to distinguish between I will:
Hopefuly soon! |
Re local open types: IMO, it's not necessary to spend time improving those migrations. With your current migrations, the lack of local open types support will only be there before we bump the AST to 5.2. That will be at the end of the 5.2 RC phase / beginning of 5.2 stable release. Before getting into those release phases, people tend to only test and benchmark |
Pexp_fun and Pexp_function become Pexp_function, which has a list of argument, a type annotation and a body that can possibly be a list of cases. We need to be careful not to rewrite any chain of Pexp_fun into the new node as that would change the semantics of the program after a roundtrip. A synthetic attribute is used to signal whether or not a chain of Pexp_fun or Pexp_function should be considered the same function or not. We do not need such an attribute for type annotations as that is unlikely to cause problem until the next AST bump. Co-authored-by: Paul-Elliot <[email protected]> Co-authored-by: Jules Aguillon <[email protected]> Signed-off-by: Paul-Elliot <[email protected]> Signed-off-by: Jules Aguillon <[email protected]>
The broken tests all live in https://github.com/ocsigen/js_of_ocaml/blob/master/lib/tests/test_fun_call.ml Here is the failure reported by the CI https://github.com/ocsigen/js_of_ocaml/actions/runs/6326376239/job/17179814876?pr=1487 |
ocaml/ocaml#12639 broke support for trunk again |
See #449 (comment). |
9875853
to
5a051d8
Compare
Signed-off-by: Paul-Elliot <[email protected]>
595df2b
to
fe72922
Compare
Signed-off-by: Paul-Elliot <[email protected]>
Signed-off-by: Paul-Elliot <[email protected]>
I cherry picked a commit from @hhugo, and then made the trunk CI be run again (by pinning ocaml-compiler-libs). I planned to merge but the tests failed with some cryptic:
I wanted to investigate the issue but again, got busy on other things. So in the light of #449 (comment), either I have time to investigate today, or I'll merge this evening and let users of the branch fix errors they might encounter (or fix it myself later, but at least this PR is merged). |
After a very quick look:
|
If I remember correctly, there is some alternative toolchain (related to reason) that requires ppxlib to read an AST built with a different version than what ppxlib was built with, so we might want to do something here. I think @pitag-ha explains that here: #409 (comment) In the meantime, let's merge this. |
Thanks for the link! |
This PR is unfinished (locations are wrong, migration is untested, migrations don't roundtrip...), but should hopefully allow users to compile ppxlib against
trunk
.Note that you will need to pin
ocaml-compiler-libs
to[email protected]:art-w/ocaml-compiler-libs.git#ocaml-5.2-trunk
since the dependency is not compatible with 5.02.Ocaml pretty recently added two parsetree changes in its parsetree:
Local open types
I migrated local open in types as we migrate local open in patterns (4.04 -> 4.03): by raising an error. This means that any code using local open in types anywhere will be unable to use ppxlib, until ppxlib bumps its AST to 5.02. This will require a lot of work, since I suspect many PPXes directly pattern-match/create function nodes.
Syntactic arities
For syntactic arities, it seems that there are some problems. Let's collect any issue found when implementing the migrations in this thread (I'll update the list and add more information as we make progress).
For 5.02 -> 5.01:
pexp_loc_stack
.For 5.01 -> 5.02: