-
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
Expand structure and signature items before applying attribute rules #279
Conversation
d2d5dd4
to
ce0183a
Compare
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.
The check in opam-repository didn't reveal any packages broken by this
ce0183a
to
53adb13
Compare
I updated the internal documentation and the tests description to reflect this change. I think this should be ready for review now. @jeremiedimino @ceastlund, I don't really expect anything to break here but it might be good to test this change inside JS' monorepo. What do you think? |
53adb13
to
330744e
Compare
Signed-off-by: Nathan Rebours <nathan.p.rebours@gmail.com>
330744e
to
eadedc8
Compare
Rebased on top of (formatted!) main and fixed the bug found by @pitag-ha where I forgot to remove a |
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 good also to me. Thanks!
CHANGES: - Add support for OCaml 4.14 (ocaml-ppx/ppxlib#304, @kit-ty-kate) - Expand nodes before applying derivers or other inline attributes based transformation, allowing better interactions between extensions and derivers (ocaml-ppx/ppxlib#279, ocaml-ppx/ppxlib#297, @NathanReb) - Add support for registering ppx_import as a pseudo context-free rule (ocaml-ppx/ppxlib#271, @NathanReb) - Add `input_name` to the `Expansion_context.Extension` and `Expansion_context.Deriver` modules (ocaml-ppx/ppxlib#284, @tatchi) - Improve `gen_symbol` to strip previous unique suffix before adding a new one (ocaml-ppx/ppxlib#285, @ceastlund) - Improve `name_type_params_in_td` to use prefixes `a`, `b`, ... instead of `v_x`. (ocaml-ppx/ppxlib#285, @ceastlund) - Fix a bug in `type_is_recursive` and `really_recursive` where they would consider a type declaration recursive if the type appeared inside an attribute payload (ocaml-ppx/ppxlib#299, @NathanReb)
This PR changes the order in which context-free rules are applied.
It is a follow up to #276 and "fixes" the behaviour observed there. With this PR a node with attributes attached will be first expanded and then the inline attribute rules applied instead of the other way around.
Imagine the following:
Before this PR, the
some_deriver
transformation would be applied first, now it is applied to the result of the expansion of the type declaration, meaning after thesome_ext
transformation was applied.@kit-ty-kate is gracefully testing this on the opam universe to see if it has any serious impact. I don't expect anyone to rely on this behaviour but better be safe than sorry.
Edit: You might want to review this while hiding whitespace diffs as a whole block in
Context_free
has gained one level of identation without any further change.