Skip to content

Conversation

@aalekseyev
Copy link
Contributor

@aalekseyev aalekseyev commented Jul 25, 2019

Do not produce a suprious empty correction when deriving_inline expands into an extension that undergoes further expansion.

Empty corrections arise in particular when deriving_inline can see that the generated AST differs from the one in the source file, but after passing it through the styler it becomes the same.

I tried writing a test, but it doesn't seem to demonstrate the issue.

Apparently behavior is different between the two modes the driver is invoked:
If diff_command = "-" then we just "exit 0" after producing the corrected file (so the AST difference goes undetected).
If diff_command <> "-" then we "exit 1" so a very confusing error is reported (empty diff).

If I just run inline tests with dune, I get the former behavior so it's impossible to observe the improvement. The way we run it in Jane Street, diff_command is not "-" so we can see the difference.

Signed-off-by: Arseniy Alekseyev [email protected]

…ds into an extension that undergoes further expansion

Signed-off-by: Arseniy Alekseyev <[email protected]>
@aalekseyev aalekseyev requested a review from a user July 25, 2019 18:56
@aalekseyev aalekseyev requested a review from xclerc as a code owner July 25, 2019 18:56
Signed-off-by: Arseniy Alekseyev <[email protected]>
@ghost ghost merged commit 37850c4 into ocaml-ppx:master Jul 30, 2019
@ghost
Copy link

ghost commented Jul 30, 2019

Backported to ocaml-ppx/ppx

rgrinberg added a commit to rgrinberg/opam-repository that referenced this pull request Nov 21, 2019
CHANGES:

- Do not produce a suprious empty correction when deriving_inline
  expands into an extension that undergoes further expansion (ocaml-ppx/ppxlib#86,
  @aalekseyev)

- Add `Ppxlib.Quoter`. This module allows to generate hygienic code fragments in
  the spirit of ppx_deriving. (ocaml-ppx/ppxlib#92, @rgrinberg)

- Allow for registering derivers on module type declarations. (ocaml-ppx/ppxlib#94, fix ocaml-ppx/ppxlib#83,
  @rgrinberg)

- Fix parsing long idenitifiers. (ocaml-ppx/ppxlib#98, @NathanReb)
rgrinberg added a commit to rgrinberg/opam-repository that referenced this pull request Nov 28, 2019
CHANGES:

- Do not produce a suprious empty correction when deriving_inline
  expands into an extension that undergoes further expansion (ocaml-ppx/ppxlib#86,
  @aalekseyev)

- Add `Ppxlib.Quoter`. This module allows to generate hygienic code fragments in
  the spirit of ppx_deriving. (ocaml-ppx/ppxlib#92, @rgrinberg)

- Allow for registering derivers on module type declarations. (ocaml-ppx/ppxlib#94, fix ocaml-ppx/ppxlib#83,
  @rgrinberg)

- Fix parsing long idenitifiers. (ocaml-ppx/ppxlib#98, @NathanReb)
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant