ocaml-ppx / ppxlib

Base library and tools for ppx rewriters
MIT License
246 stars 98 forks source link

Fix source quotation in OCaml 5.2 #480

Closed NathanReb closed 7 months ago

NathanReb commented 7 months ago

The compiler removed some logic that was reopening the source file based on Location.input_name and instead only rely on Location.input_lexbuf for source quotation.

This PR first adds a test that rely on source quotation. Our test suite failed to catch this bug because all our tests use OCAML_ERROR_STYLE=short. It then changes the way we read source files to stick to what the compiler does in Pparse while preserving our features such read from stdin. We now set the input_lexbuf properly.

NathanReb commented 7 months ago

See https://github.com/ocaml/ocaml/pull/12991 for context!