Skip to content
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

ppxlib and ocamlfind: looks like code_path is broken ? #500

Open
chetmurthy opened this issue Jun 11, 2024 · 2 comments
Open

ppxlib and ocamlfind: looks like code_path is broken ? #500

chetmurthy opened this issue Jun 11, 2024 · 2 comments

Comments

@chetmurthy
Copy link

While preparing an OPAM package for release, I found a problem with ppxlib. My package depends on ppx_deriving, and between versions 5.2.1 and 6.0.2, something changed that has affected its behaviour. In short, if you build the ppx_deriving test in https://github.com/ocaml-ppx/ppx_deriving/blob/master/src_test/show/test_deriving_show.cppo.ml

  1. with dune, you will get correct behaviour from the test -- in tests like test_variant ( https://github.com/ocaml-ppx/ppx_deriving/blob/32f7c31ecfcbca6d53f3655a00e8852f4751123e/src_test/show/test_deriving_show.cppo.ml#L45 ) the generated code will produce a string that contains the module-path

  2. with ocamlfind, you will get incorrect behaviour: the generated code will produce a string that DOES NOT contain the module-path. So instead of Test_deriving_show.RFoo you will get RFoo.

I don't know whether building OCaml code using ocamlfind is supported anymore, but if it's supposed to be, then it seems to me that one should be able to use PPX rewriters from ocamlfind, and get the same results that one does when using them from dune.

@chetmurthy
Copy link
Author

I posted about this here: https://discuss.ocaml.org/t/ann-ppx-deriving-6-0-2-and-ppx-deriving-yojson-3-8-0/14750

There is a smaller example (extracted from the above-mentioned unit-test), along with output, that shows the problem.

I hope it's clear that at ppx_deriving.5.2.1, building with ocamlfind produces a test that works correctly, and that at 6.0.2, that same build produces a test that fails, b/c the module-paths inferred from filenames are empty.

@NathanReb
Copy link
Collaborator

Thanks for reporting this! I myself noticed this behaviour while releasing ppx_deriving and ppx_deriving_yojson.

I'll use your repro to add tests and debug this!

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

No branches or pull requests

2 participants