Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare for 5.2 AST bump #331

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ppx_deriving_qcheck.opam
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
10 changes: 8 additions & 2 deletions src/ppx_deriving_qcheck/ppx_deriving_qcheck.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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} *)
Expand Down
Loading