Skip to content

Commit b913d33

Browse files
committed
Fix ord unused-type-declaration warning disable pre-OCaml 4.08 (PR #260)
Workaround for ocaml/ocaml#1977.
1 parent 3e43c96 commit b913d33

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src_plugins/ord/ppx_deriving_ord.cppo.ml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ let str_of_type ~options ~path ({ ptype_loc = loc } as type_decl) =
194194
conflicts with a Stdlib type from Ppx_deriving_runtime (e.g. bool in test).
195195
In that case we must refer to the type being declared, not the one opened by Ppx_deriving_runtime. *)
196196
let helper_type =
197-
Type.mk ~loc ~attrs:[Ppx_deriving.attr_warning [%expr "-unused-type-declaration"]]
197+
Type.mk ~loc
198198
~params:type_decl.ptype_params
199199
~manifest:(Ppx_deriving.core_type_of_type_decl type_decl)
200200
(mkloc "t" loc)
@@ -258,7 +258,12 @@ let str_of_type ~options ~path ({ ptype_loc = loc } as type_decl) =
258258
let out_var =
259259
pvar (Ppx_deriving.mangle_type_decl (`Prefix "compare") type_decl) in
260260
let comparator_with_helper =
261-
[%expr let module Ppx_deriving_ord_helper = struct [%%i Str.type_ Nonrecursive [helper_type]] end in
261+
[%expr let module Ppx_deriving_ord_helper =
262+
struct
263+
[@@@warning "-unused-type-declaration"]
264+
[%%i Str.type_ Nonrecursive [helper_type]]
265+
end
266+
in
262267
[%e Ppx_deriving.sanitize ~quoter (eta_expand (polymorphize comparator))]]
263268
in
264269
[Vb.mk ~attrs:[Ppx_deriving.attr_warning [%expr "-39"]]

0 commit comments

Comments
 (0)