diff --git a/ppx_deriving_qcheck.opam b/ppx_deriving_qcheck.opam index 995ce767..5bbf78e7 100644 --- a/ppx_deriving_qcheck.opam +++ b/ppx_deriving_qcheck.opam @@ -11,7 +11,7 @@ depends: [ "dune" {>= "2.8.0"} "ocaml" {>= "4.08.0"} "qcheck-core" {>= "0.24"} - "ppxlib" {>= "0.22.0"} + "ppxlib" {>= "0.36.0"} "ppx_deriving" {>= "5.2.1"} "odoc" {with-doc} "alcotest" {with-test & >= "1.4.0" } diff --git a/src/ppx_deriving_qcheck/ppx_deriving_qcheck.ml b/src/ppx_deriving_qcheck/ppx_deriving_qcheck.ml index ac9392e3..d1ef4cf6 100644 --- a/src/ppx_deriving_qcheck/ppx_deriving_qcheck.ml +++ b/src/ppx_deriving_qcheck/ppx_deriving_qcheck.ml @@ -57,9 +57,15 @@ let pattern_name pat : string = the actual body using these args. *) let rec args_and_body expr : (string list * expression) = match expr.pexp_desc with - | Pexp_fun (Nolabel, _, pat, expr) -> + | Pexp_function (fargs, _constraint, Pfunction_body expr) -> let (args, body) = args_and_body expr in - (pattern_name pat :: args, body) + let pats = + List.filter_map (function + | { pparam_desc = Pparam_val (Nolabel, _, p); _ } -> Some (pattern_name p) + | _ -> None + ) fargs + in + (pats @ args, body) | _ -> ([], expr) (** {2. Recursive generators} *)