-
Notifications
You must be signed in to change notification settings - Fork 102
Description
ppx_parser has a pattern that uses Ast_pattern.pexp_function from ppxlib 0.35 and below:
let ppx_parser_pat = Ast_pattern.(single_expr_payload
(alt
(pexp_function __ |> map1 ~f:(fun cases -> (None, cases)) )
(pexp_match __ __ |> map2 ~f:(fun e cases -> (Some e, cases)) ))
)However, in ppxlib 0.36 and above, the signature has changed and this no longer compiles.
In the migration guide: https://github.com/ocaml-ppx/ppxlib/wiki/Upgrading-to-ppxlib-0.36.0:
Since Pexp_function now represents all functions and not just the special pattern-matching case, pexp_function now builds full functions and not just ones with cases. When upgrading, your easiest path is to replace your calls to pexp_function with calls to pexp_function_cases.
This is for Ast_builder. There is no equivalent Ast_pattern.pexp_function_cases, is this intentional or an oversight?
From the documentation: https://ocaml.org/p/ppxlib/0.37.0/doc/matching-code.html#building-patterns
All constructors from Ast_builder have a "deconstructor" in Ast_pattern with the same name.