Skip to content
Merged
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 dune
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(env
(_
(flags -w -9)))
(flags :standard -w -27-9))) ; TODO: Use the full standard flags

(copy_files# src_plugins/compat_macros.cppo)
1 change: 0 additions & 1 deletion src/api/ppx_deriving.cppo.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
open Ppxlib

open Location
open Asttypes
open Ast_helper

Expand Down
1 change: 0 additions & 1 deletion src_plugins/create/ppx_deriving_create.cppo.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
open Ppxlib
open Location
open Asttypes
open Parsetree
open Ast_helper
Expand Down
1 change: 0 additions & 1 deletion src_plugins/enum/ppx_deriving_enum.cppo.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
open Ppxlib
open Location
open Asttypes
open Parsetree
open Ast_helper
Expand Down
5 changes: 2 additions & 3 deletions src_plugins/eq/ppx_deriving_eq.cppo.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
open Ppxlib
open Location
open Asttypes
open Parsetree
open Ast_helper
Expand Down Expand Up @@ -67,7 +66,7 @@ and expr_of_typ quoter typ =
let typ = Ppx_deriving.remove_pervasives ~deriver typ in
let expr_of_typ = expr_of_typ quoter in
match attr_equal typ.ptyp_attributes with
| Some fn -> Ppx_deriving.quote quoter fn
| Some fn -> Ppx_deriving.quote ~quoter fn
| None ->
match typ with
| [%type: _] -> [%expr fun _ _ -> true]
Expand Down Expand Up @@ -113,7 +112,7 @@ and expr_of_typ quoter typ =
[%expr fun (lazy x) (lazy y) -> [%e expr_of_typ typ] x y]
| _, { ptyp_desc = Ptyp_constr ({ txt = lid }, args) } ->
let equal_fn = Exp.ident (mknoloc (Ppx_deriving.mangle_lid (`Prefix "equal") lid)) in
let fwd = app (Ppx_deriving.quote quoter equal_fn) (List.map expr_of_typ args) in
let fwd = app (Ppx_deriving.quote ~quoter equal_fn) (List.map expr_of_typ args) in
(* eta-expansion is necessary for recursive groups *)
[%expr fun x -> [%e fwd] x]
| _ -> assert false
Expand Down
1 change: 0 additions & 1 deletion src_plugins/fold/ppx_deriving_fold.cppo.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
open Ppxlib
open Location
open Asttypes
open Parsetree
open Ast_helper
Expand Down
1 change: 0 additions & 1 deletion src_plugins/iter/ppx_deriving_iter.cppo.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
open Ppxlib
open Location
open Asttypes
open Parsetree
open Ast_helper
Expand Down
1 change: 0 additions & 1 deletion src_plugins/make/ppx_deriving_make.cppo.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
open Ppxlib
open Location
open Asttypes
open Parsetree
open Ast_helper
Expand Down
3 changes: 1 addition & 2 deletions src_plugins/map/ppx_deriving_map.cppo.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
open Ppxlib
open Location
open Asttypes
open Parsetree
open Ast_helper
Expand Down Expand Up @@ -70,7 +69,7 @@ let rec expr_of_typ ?decl typ =
(exp_variant label (Some [%expr [%e expr_of_typ ?decl typ] x]))
| Rinherit({ ptyp_desc = Ptyp_constr (tname, _) } as typ) -> begin
match decl with
| None ->
| None ->
raise_errorf "inheritance of polymorphic variants not supported"
| Some(d) ->
Exp.case [%pat? [%p Pat.type_ tname] as x]
Expand Down
7 changes: 3 additions & 4 deletions src_plugins/ord/ppx_deriving_ord.cppo.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
open Ppxlib
open Longident
open Location
open Asttypes
open Parsetree
open Ast_helper
Expand Down Expand Up @@ -68,7 +67,7 @@ and expr_of_typ quoter typ =
let loc = typ.ptyp_loc in
let expr_of_typ = expr_of_typ quoter in
match attr_compare typ.ptyp_attributes with
| Some fn -> Ppx_deriving.quote quoter fn
| Some fn -> Ppx_deriving.quote ~quoter fn
| None ->
let typ = Ppx_deriving.remove_pervasives ~deriver typ in
match typ with
Expand All @@ -85,7 +84,7 @@ and expr_of_typ quoter typ =
| [%type: Nativeint.t] | [%type: float] | [%type: bool]
| [%type: char] | [%type: string] | [%type: bytes]) ->
let compare_fn = [%expr fun (a:[%t typ]) b -> Ppx_deriving_runtime.compare a b] in
Ppx_deriving.quote quoter compare_fn
Ppx_deriving.quote ~quoter compare_fn
| true, [%type: [%t? typ] ref] ->
[%expr fun a b -> [%e expr_of_typ typ] !a !b]
| true, [%type: [%t? typ] list] ->
Expand Down Expand Up @@ -126,7 +125,7 @@ and expr_of_typ quoter typ =
[%expr fun (lazy x) (lazy y) -> [%e expr_of_typ typ] x y]
| _, { ptyp_desc = Ptyp_constr ({ txt = lid }, args) } ->
let compare_fn = Exp.ident (mknoloc (Ppx_deriving.mangle_lid (`Prefix "compare") lid)) in
let fwd = app (Ppx_deriving.quote quoter compare_fn) (List.map expr_of_typ args) in
let fwd = app (Ppx_deriving.quote ~quoter compare_fn) (List.map expr_of_typ args) in
(* eta-expansion is necessary for recursive groups *)
[%expr fun x -> [%e fwd] x]
| _ -> assert false
Expand Down
5 changes: 2 additions & 3 deletions src_plugins/show/ppx_deriving_show.cppo.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
open Ppxlib
open Location
open Asttypes
open Parsetree
open Ast_helper
Expand Down Expand Up @@ -50,7 +49,7 @@ let pconstrrec name fields = pconstr name [precord ~closed:Closed fields]

let wrap_printer quoter printer =
let loc = !Ast_helper.default_loc in
Ppx_deriving.quote quoter
Ppx_deriving.quote ~quoter
[%expr (let fprintf = Ppx_deriving_runtime.Format.fprintf in [%e printer]) [@ocaml.warning "-26"]]

let pp_type_of_decl ~options ~path type_decl =
Expand Down Expand Up @@ -158,7 +157,7 @@ let rec expr_of_typ quoter typ =
| Some printer -> wrap_printer quoter printer
| None ->
let printer = Exp.ident (mknoloc (Ppx_deriving.mangle_lid (`Prefix "pp") lid)) in
Ppx_deriving.quote quoter printer
Ppx_deriving.quote ~quoter printer
in
app printer (args_pp @ [[%expr fmt]])
| _ -> assert false
Expand Down
1 change: 0 additions & 1 deletion src_test/api/test_api.cppo.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
open Parsetree
open OUnit2

let string_of_tyvar tyvar =
Expand Down
3 changes: 3 additions & 0 deletions src_test/map/test_deriving_map.cppo.ml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ module T : sig
type 'a btreer = Noder of { lft: 'a btree; elt: 'a; rgt: 'a btree } | Leafr
[@@deriving map]

type 'a ty = 'a * int list
[@@deriving map]

type var0 = A0 of int [@@deriving map,show]

type 'a var1 = A1 of 'a [@@deriving map,show]
Expand Down
5 changes: 3 additions & 2 deletions src_test/show/test_deriving_show.cppo.ml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ let test_variant ctxt =
assert_equal ~printer "(Test_deriving_show.Baz \"foo\")" (show_v (Baz "foo"))

type rv = RFoo | RBar of { x: int; y: string } | RBaz of { z: string } [@@deriving show]
let test_variant_record ctxt =
let test_rv_record ctxt =
assert_equal ~printer "Test_deriving_show.RFoo"
(show_rv RFoo);
assert_equal ~printer "Test_deriving_show.RBar {x = 1; y = \"foo\"}"
(show_rv (RBar {x=1; y="foo"}));
assert_equal ~printer "(Test_deriving_show.RBaz {z = \"foo\"}"
assert_equal ~printer "Test_deriving_show.RBaz {z = \"foo\"}"
(show_rv (RBaz {z="foo"}))

type vn = Foo of int option [@@deriving show]
Expand Down Expand Up @@ -248,6 +248,7 @@ let test_paths_printer ctxt =
let suite = "Test deriving(show)" >::: [
"test_alias" >:: test_alias;
"test_variant" >:: test_variant;
"test_rv_record" >:: test_rv_record;
"test_variant_nest" >:: test_variant_nest;
"test_tuple" >:: test_tuple;
"test_poly" >:: test_poly;
Expand Down