Skip to content

Commit

Permalink
Fix ord unused-type-declaration warning disable pre-OCaml 4.08 (PR #260)
Browse files Browse the repository at this point in the history
Workaround for ocaml/ocaml#1977.
  • Loading branch information
sim642 committed Mar 19, 2022
1 parent 3e43c96 commit b913d33
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src_plugins/ord/ppx_deriving_ord.cppo.ml
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ let str_of_type ~options ~path ({ ptype_loc = loc } as type_decl) =
conflicts with a Stdlib type from Ppx_deriving_runtime (e.g. bool in test).
In that case we must refer to the type being declared, not the one opened by Ppx_deriving_runtime. *)
let helper_type =
Type.mk ~loc ~attrs:[Ppx_deriving.attr_warning [%expr "-unused-type-declaration"]]
Type.mk ~loc
~params:type_decl.ptype_params
~manifest:(Ppx_deriving.core_type_of_type_decl type_decl)
(mkloc "t" loc)
Expand Down Expand Up @@ -258,7 +258,12 @@ let str_of_type ~options ~path ({ ptype_loc = loc } as type_decl) =
let out_var =
pvar (Ppx_deriving.mangle_type_decl (`Prefix "compare") type_decl) in
let comparator_with_helper =
[%expr let module Ppx_deriving_ord_helper = struct [%%i Str.type_ Nonrecursive [helper_type]] end in
[%expr let module Ppx_deriving_ord_helper =
struct
[@@@warning "-unused-type-declaration"]
[%%i Str.type_ Nonrecursive [helper_type]]
end
in
[%e Ppx_deriving.sanitize ~quoter (eta_expand (polymorphize comparator))]]
in
[Vb.mk ~attrs:[Ppx_deriving.attr_warning [%expr "-39"]]
Expand Down

0 comments on commit b913d33

Please sign in to comment.