Prepare for 5.2 AST bump#276
Conversation
|
Looking at the code it looks OK, but you have reasons to suspect otherwise. What looks wrong to you? That part of the ppx should elide function arguments carrying the trace attribute, as in Anyway, maybe a simpler patch is to just filter the list of arguments the new AST features before doing a rec call? You kind of coalesce List.filter here, IMO. Thanks for the patch. |
873e1c3 to
05e91a7
Compare
Ah okay! I've repushed filtering out the params that have the trace attribute. These seems to build ok (previously it didn't). Not quite sure when you would recurse into the body of the function though. |
|
are there any news on this? |
Note, I couldn't quite work out the right change to make to the trace_ppx -- I think it is something close to this change but it is not quite right. Hopefully you will have more luck, do you use the overlay for testing your changes if you have time.
PR details
This PR is a patch for an upcoming release of ppxlib where the internal AST is bumped from 4.14 to 5.2. Until that is merged and released, there is no reason to merge this PR.
To test these changes, you can use the following opam-based workflow. I've made releases of most of these patches to an opam-repository overlay.
The following describes the most notable changes to the AST.
Note: no update has been made of the
opamfile, butppxlibwill likely need a lower-bound before merging/releasing.Functions
Currently
In the parsetree currently, functions like:
Are represented roughly as
Functions like:
Are represented roughly as
Since 5.2
All of these functions now map to a single AST node
Pexp_function(note, this is the same name as the old cases function). The first argument is a list of parameters meaning:Now looks like:
Pexp_function([x; y; z], _constraint, body)And the
bodyis where we can either have more expressions (Pfunction_body _) or cases (Pfunction_cases _). That means:Has an empty list of parameters:
Local Module Opens for Types
Another feature added in 5.2 was the ability to locally open modules in type definitions.
This has a
Ptyp_open (module_identifier, core_type)AST node. Just like normal module opens this does create some syntactic ambiguity about where things come from inside the parentheses.