Ppx_profiler: New fix for OCaml 5 (another Parsetree appeared)
What
Backporting @mattiasdrp fix for the profiler, using ppx_lib instead of the parsetree directly.
Manually testing the MR
As usual, from your switch with ocaml5, checkout on 74b5abdc2d and try to build the profiler:
dune build src/lib_ppx_profiler. This should result in an error:
Click to expand
File "src/lib_ppx_profiler/rewriter.ml", line 418, characters 63-69:
418 | | None, None -> Error.error loc Error.(Improper_record record)
^^^^^^
Error: This expression has type
"(Ppxlib_ast.Ast.longident_loc * Astlib.Ast_414.Parsetree.expression)
list"
but an expression was expected of type
"(Ppxlib.Ast.longident_loc * Parsetree.expression) list"
Type "Astlib.Ast_414.Parsetree.expression" is not compatible with type
"Parsetree.expression"
File "src/lib_ppx_profiler/error.ml", line 1:
Error: The implementation "src/lib_ppx_profiler/error.pp.ml"
does not match the interface "src/lib_ppx_profiler/error.pp.ml":
Type declarations do not match:
type error =
Invalid_action of string
| Invalid_payload
| Invalid_aggregate of Key.t
| Invalid_custom of Key.t
| Invalid_mark of Key.t
| Invalid_record of Key.t
| Invalid_span of Key.t
| Invalid_stop of Key.t
| Improper_field of
(Longident.t Location.loc *
Astlib.Ast_414.Parsetree.expression)
| Improper_let_binding of Astlib.Ast_414.Parsetree.expression
| Improper_record of
(Ppxlib.Ast.longident_loc *
Astlib.Ast_414.Parsetree.expression)
list
| Malformed_attribute of Astlib.Ast_414.Parsetree.expression
is not included in
type error =
Invalid_action of string
| Invalid_payload
| Invalid_aggregate of Key.t
| Invalid_custom of Key.t
| Invalid_mark of Key.t
| Invalid_record of Key.t
| Invalid_span of Key.t
| Invalid_stop of Key.t
| Improper_field of
(Longident.t Location.loc *
Astlib.Ast_414.Parsetree.expression)
| Improper_let_binding of Astlib.Ast_414.Parsetree.expression
| Improper_record of
(Ppxlib.Ast.longident_loc * Parsetree.expression) list
| Malformed_attribute of Astlib.Ast_414.Parsetree.expression
Constructors do not match:
"Improper_record of
(Ppxlib.Ast.longident_loc * Ppxlib.expression) list"
is not the same as:
"Improper_record of
(Ppxlib.Ast.longident_loc * Parsetree.expression) list"
The type
"(Ppxlib.Ast.longident_loc * Astlib.Ast_414.Parsetree.expression)
list"
is not equal to the type
"(Ppxlib.Ast.longident_loc * Parsetree.expression) list"
Type "Astlib.Ast_414.Parsetree.expression" is not equal to type
"Parsetree.expression"
File "src/lib_ppx_profiler/error.mli", lines 8-20, characters 0-44:
Expected declaration
File "src/lib_ppx_profiler/error.ml", lines 8-20, characters 0-44:
Actual declaration
Cherry-pick the patch and compile again: no more error.
Checklist
-
Document the interface of any function added or modified (see the coding guidelines) -
Document any change to the user interface, including configuration parameters (see node configuration) -
Provide automatic testing (see the testing guide). -
For new features and bug fixes, add an item in the appropriate changelog ( docs/protocols/alpha.rstfor the protocol and the environment,CHANGES.rstat the root of the repository for everything else). -
Select suitable reviewers using the Reviewersfield below. -
Select as Assigneethe next person who should take action on that MR
Edited by Pierrick Couderc