File tree Expand file tree Collapse file tree 6 files changed +31
-12
lines changed Expand file tree Collapse file tree 6 files changed +31
-12
lines changed Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ and expr_of_typ quoter typ =
84
84
[% expr fun (lazy x ) (lazy y ) -> [% e expr_of_typ typ] x y]
85
85
| _ , { ptyp_desc = Ptyp_constr ({ txt = lid } , args ) } ->
86
86
let equal_fn = Exp. ident (mknoloc (Ppx_deriving. mangle_lid (`Prefix " equal" ) lid)) in
87
- let fwd = app equal_fn (List. map expr_of_typ args) in
87
+ let fwd = app ( Ppx_deriving. quote quoter equal_fn) (List. map expr_of_typ args) in
88
88
(* eta-expansion is necessary for recursive groups *)
89
89
[% expr fun x -> [% e fwd] x]
90
90
| _ -> assert false
Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ and expr_of_typ quoter typ =
90
90
[% expr fun (lazy x ) (lazy y ) -> [% e expr_of_typ typ] x y]
91
91
| _ , { ptyp_desc = Ptyp_constr ({ txt = lid } , args ) } ->
92
92
let compare_fn = Exp. ident (mknoloc (Ppx_deriving. mangle_lid (`Prefix " compare" ) lid)) in
93
- let fwd = app compare_fn (List. map expr_of_typ args) in
93
+ let fwd = app ( Ppx_deriving. quote quoter compare_fn) (List. map expr_of_typ args) in
94
94
(* eta-expansion is necessary for recursive groups *)
95
95
[% expr fun x -> [% e fwd] x]
96
96
| _ -> assert false
Original file line number Diff line number Diff line change @@ -115,17 +115,15 @@ let rec expr_of_typ quoter typ =
115
115
else Format. pp_print_string fmt " <not evaluated>" ]
116
116
| _ , { ptyp_desc = Ptyp_constr ({ txt = lid } , args ) } ->
117
117
let args_pp = List. map (fun typ -> [% expr fun fmt -> [% e expr_of_typ typ]]) args in
118
- begin match attr_polyprinter typ.ptyp_attributes with
119
- | Some printer ->
120
- let printer =
118
+ let printer =
119
+ match attr_polyprinter typ.ptyp_attributes with
120
+ | Some printer ->
121
121
[% expr (let fprintf = Format. fprintf in [% e printer]) [@ ocaml.warning " -26" ]]
122
- in
123
- app (Ppx_deriving. quote quoter printer)
124
- (args_pp @ [[% expr fmt]])
125
- | None ->
126
- app (Exp. ident (mknoloc (Ppx_deriving. mangle_lid (`Prefix " pp" ) lid)))
127
- (args_pp @ [[% expr fmt]])
128
- end
122
+ | None ->
123
+ Exp. ident (mknoloc (Ppx_deriving. mangle_lid (`Prefix " pp" ) lid))
124
+ in
125
+ app (Ppx_deriving. quote quoter printer)
126
+ (args_pp @ [[% expr fmt]])
129
127
| _ -> assert false
130
128
end
131
129
| { ptyp_desc = Ptyp_tuple typs } ->
Original file line number Diff line number Diff line change @@ -109,6 +109,13 @@ let test_poly_app ctxt =
109
109
assert_equal ~printer true (equal_poly_app 1.0 1.0 );
110
110
assert_equal ~printer false (equal_poly_app 1.0 2.0 )
111
111
112
+ module List = struct
113
+ type 'a t = [`Cons of 'a | `Nil ]
114
+ [@@ deriving eq ]
115
+ end
116
+ type 'a std_clash = 'a List .t option
117
+ [@@ deriving eq ]
118
+
112
119
let suite = "Test deriving(eq)" > ::: [
113
120
"test_simple" > :: test_simple ;
114
121
"test_custom" > :: test_custom ;
Original file line number Diff line number Diff line change @@ -123,6 +123,13 @@ let test_poly_app ctxt =
123
123
assert_equal ~printer 0 (compare_poly_app 1.0 1.0 );
124
124
assert_equal ~printer (- 1 ) (compare_poly_app 1.0 2.0 )
125
125
126
+ module List = struct
127
+ type 'a t = [`Cons of 'a | `Nil ]
128
+ [@@ deriving ord ]
129
+ end
130
+ type 'a std_clash = 'a List .t option
131
+ [@@ deriving ord ]
132
+
126
133
module Warnings = struct
127
134
module W4 = struct
128
135
[@@@ ocaml.warning "@4" ]
Original file line number Diff line number Diff line change @@ -164,6 +164,13 @@ and 'a poly_abs = 'a
164
164
let test_poly_app ctxt =
165
165
assert_equal ~printer " 1." (show_poly_app 1.0 )
166
166
167
+ module List = struct
168
+ type 'a t = [`Cons of 'a | `Nil ]
169
+ [@@ deriving show ]
170
+ end
171
+ type 'a std_clash = 'a List .t option
172
+ [@@ deriving show ]
173
+
167
174
let suite = " Test deriving(show)" > ::: [
168
175
" test_alias" > :: test_alias;
169
176
" test_variant" > :: test_variant;
You can’t perform that action at this time.
0 commit comments