We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
ppx_deriving.make
In ex.ml
ex.ml
module Ex = struct type t = {a : int; b: s} [@@deriving make] and s = t list end
With the dune file:
dune
(library (name ex) (modules ex) (preprocess (pps ppx_deriving.make)))
dune build gives
dune build
$ dune build File "ex.ml", line 5, characters 2-16: 5 | and s = t list ^^^^^^^^^^^^^^ Error: make can be derived only for record types
If we put another deriving annotation on s and swap the order the types are declared, the compilation goes thru but the make annotation is ignored:
s
make
module Ex = struct type s = t list [@@deriving show] and t = {a : int; b: s} [@@deriving make] end
Which produces
[@@@ocaml.ppx.context { tool_name = "ppx_driver"; include_dirs = []; load_path = []; open_modules = []; for_package = None; debug = false; use_threads = false; use_vmthreads = false; recursive_types = false; principal = false; transparent_modules = false; unboxed_types = false; unsafe_string = false; cookies = [("library-name", "ex")] }] module Ex = struct type s = t list[@@deriving show] and t = { a: int ; b: s }[@@deriving make] let rec pp_s : Ppx_deriving_runtime.Format.formatter -> s -> Ppx_deriving_runtime.unit = let __0 () = pp in ((let open! ((Ppx_deriving_runtime)[@ocaml.warning "-A"]) in fun fmt -> fun x -> Ppx_deriving_runtime.Format.fprintf fmt "@[<2>["; ignore (List.fold_left (fun sep -> fun x -> if sep then Ppx_deriving_runtime.Format.fprintf fmt ";@ "; ((__0 ()) fmt) x; true) false x); Ppx_deriving_runtime.Format.fprintf fmt "@,]@]") [@ocaml.warning "-A"]) and show_s : s -> Ppx_deriving_runtime.string = fun x -> Ppx_deriving_runtime.Format.asprintf "%a" pp_s x[@@ocaml.warning "-32"] and pp : Ppx_deriving_runtime.Format.formatter -> t -> Ppx_deriving_runtime.unit = let __0 () = pp_s in ((let open! ((Ppx_deriving_runtime)[@ocaml.warning "-A"]) in fun fmt -> fun x -> Ppx_deriving_runtime.Format.fprintf fmt "@[<2>{ "; ((Ppx_deriving_runtime.Format.fprintf fmt "@[%s =@ " "Ex.Ex.a"; (Ppx_deriving_runtime.Format.fprintf fmt "%d") x.a; Ppx_deriving_runtime.Format.fprintf fmt "@]"); Ppx_deriving_runtime.Format.fprintf fmt ";@ "; Ppx_deriving_runtime.Format.fprintf fmt "@[%s =@ " "b"; ((__0 ()) fmt) x.b; Ppx_deriving_runtime.Format.fprintf fmt "@]"); Ppx_deriving_runtime.Format.fprintf fmt "@ }@]") [@ocaml.warning "-A"]) and show : t -> Ppx_deriving_runtime.string = fun x -> Ppx_deriving_runtime.Format.asprintf "%a" pp x[@@ocaml.warning "-32"] end
As per dune describe pp ex.ml.
dune describe pp ex.ml
If the additional deriving annotation is not added, we get the same error.
The text was updated successfully, but these errors were encountered:
Add regression test for ocaml-ppx#272
7dbaf97
Tests behavior when deriving on mutually recursive types ocaml-ppx#272
2fdb5f3
Successfully merging a pull request may close this issue.
In
ex.ml
With the
dune
file:dune build
givesIf we put another deriving annotation on
s
and swap the order the types are declared, the compilation goes thru but themake
annotation is ignored:Which produces
As per
dune describe pp ex.ml
.If the additional deriving annotation is not added, we get the same error.
The text was updated successfully, but these errors were encountered: