Conversation
|
There are a few missing promotions it seems! |
|
I think we're just waiting for the magic numbers to be bumped in OCaml. |
I thought they were bumped on the development branch now. It also seems the dune version we're using for the trunk CI build does not build. |
NathanReb
left a comment
There was a problem hiding this comment.
Looks great! Thanks for taking the time to work on this.
From the top of your head, do you know which functions in the migration need to be reviewed?
astlib/longident.ml
Outdated
| type t = (*IF_AT_LEAST 504 Ocaml_common.Longident.t = *) | ||
| Lident of string | ||
| | Ldot of t loc * string loc | ||
| | Lapply of t loc * t loc |
There was a problem hiding this comment.
I think we should have a Longident module in ast_504 similar to what we have for Asttypes. That way if the type is further modified, it'll be treated as a regular AST change.
I think we should still have a Longident module in astlib but it should only provide the utility functions on Longidents from the compiler, same as the Parse, or Pprintast modules do for other moving Ast types.
Since Astlib is supposed to provide the stable layer on top of the compiler-libs that's necessary for ppxlib, we should maybe make it provide the exact set of functions we need and nothing more.
What would you think about the following:
- Make Legacy_longident define only the type
- Make
Longidentprovide the functions we use, conditionnally compiled to work with the current compiler - Have a
Longidentmodule inPpxlibthat expose the functions corresponding to our internal AST.
As I write this I wonder if, in fact, we don't need any compiler functions on longidents but simply need the ones for our internal AST. Making a compat layer for functions unnecessary as we can simply have a local copy of the correct version.
|
the magic numbers have been bumped |
|
Thanks for the review @NathanReb -- I think I followed what you were suggesting and applied the changes. To reiterate:
And everything just works. Presumably when we bump the internal AST to 504 we will have to almost invert this in order to migrate from below to 504. |
|
Also, we're waiting on a new version of dune that support 5.4.0 too. |
|
the dune PR has been merged in opam-repository |
This also updates the easier parts of ppxlib to be compatible with 5.4.0. We will need to version the Location module. Signed-off-by: Patrick Ferris <patrick@sirref.org>
Adds support for the OCaml 5.4, mainly versioning the Longident module and handling migrations of tuples with and without labels. Signed-off-by: Patrick Ferris <patrick@sirref.org>
Signed-off-by: Patrick Ferris <patrick@sirref.org>
Signed-off-by: Patrick Ferris <patrick@sirref.org>
Signed-off-by: Patrick Ferris <patrick@sirref.org>
NathanReb
left a comment
There was a problem hiding this comment.
Trunk build's green and the ocaml-ci failures seem out of our control, let's merge!
I'll backport these changes to a separate 0.37.0 branch so we can cut a release with it that's not dependent on the 5.3 AST bump.
CHANGES: ### 5.4 Support - Add initial OCaml 5.4 support (ocaml-ppx/ppxlib#570, @patricoferris, @NathanReb) ### Other Changes - Add `Longident.to/of_compiler` to astlib to simplify maintenance of ppx-es that interacts with other parts of the compiler-libs such as the type checker. (ocaml-ppx/ppxlib#603, @NathanReb) - Fix a bug where some infix operators such as `mod` would be printed as raw identifiers by our `Pprintast`. (ocaml-ppx/ppxlib#601, @NathanReb) - Fix 5.2 -> 5.3 migration of constants. Those used to always have a `none` location which can lead to unhelpful error messages. (ocaml-ppx/ppxlib#569, @NathanReb) - Add a new context-free rule type that replaces AST nodes that have the registered attributes attached to them. (ocaml-ppx/ppxlib#574, @Skepfyr) - Allow users to derive code from module bindings and module declarations (ocaml-ppx/ppxlib#576, @patricoferris) - Expose `Ppxlib.Location.Error.t = Astlib.Location.Error.t` (ocaml-ppx/ppxlib#593, @ceastlund) - Add `@@@ppxlib.inline.end`, deprecate `@@@deriving.end`. (ocaml-ppx/ppxlib#594, @ceastlund) - Clean the AST of any ppxlib migration attributes whenever printing using Pretty_print mode and the use_compiler_pp flag. (ocaml-ppx/ppxlib#598, @patricoferris) - Add custom printer support to `pp_ast` functions via the `?printer` config parameter. (ocaml-ppx/ppxlib#526, @pedrobslisboa)
We now have a dune 3.18.0 with 5.4.0 support (afaict). See the conversation in #566