Update for ppxlib 0.36.0 compatibility #45
+27
−17
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Updates landmarks-ppx for compatibility with ppxlib 0.36.0, which changed the internal AST representation to OCaml 5.2.
Breaking Change
Requires ppxlib >= 0.36.0.
This version is not compatible with ppxlib < 0.36.0 due to AST representation change.
Notes
Changes are localized to
ppx/mapper.ml.I did simple rewrites of the
arityfunction (line 177) andwrap_landmark_methodfunction (line 204) to work with the newPexp_functionAST node and preserve landmarks behavior as much as possible.Critical fix: keep
pvb_constraintwhen rebuilding value binding (line 272). This allows the following minimal examples to compile because of their necessary type annotations.And
Testing
I verify that the above examples compile with instrumentation. I also profile a simple
fibprogram usingfunctionto check that output is identical previous releases. I then instrument a small project (about 2000 lines) with several modules, and to my eye, the output is as expected. That small project uses a menhir parser (whose outputted code can be instrumented with landmarks-ppx) and polymorphic recursion with GADTs, for example, so it reasonably covers a few features I might expect to break if this ppx upgrade was buggy.All of the above testing was done with the
--autoflag to ppx annotate all functions.This code (from
README.md) still fails to compile: