From a228e5e8250160d6b1477c4afc9dfe0a5c46ee04 Mon Sep 17 00:00:00 2001 From: Gabriel Scherer Date: Mon, 30 Oct 2017 07:05:32 +0000 Subject: [PATCH 1/2] add missing cppo_ocamlbuild dependency --- opam | 1 + 1 file changed, 1 insertion(+) diff --git a/opam b/opam index d687f07d..0e5e072e 100644 --- a/opam +++ b/opam @@ -25,6 +25,7 @@ depends: [ "ocamlbuild" {build} "ocamlfind" {build & >= "1.6.0"} "cppo" {build} + "cppo_ocamlbuild" {build} "ppx_tools" {>= "4.02.3"} "result" "ounit" {test} From 9b449ea776f315e3025860c130e6acc81df76b10 Mon Sep 17 00:00:00 2001 From: Gabriel Scherer Date: Mon, 23 Oct 2017 19:10:57 +0200 Subject: [PATCH 2/2] make ppx_deriving 4.1 build under 4.05 --- src/ppx_deriving.cppo.ml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ppx_deriving.cppo.ml b/src/ppx_deriving.cppo.ml index 59374741..bb8bbb6d 100644 --- a/src/ppx_deriving.cppo.ml +++ b/src/ppx_deriving.cppo.ml @@ -327,6 +327,9 @@ let free_vars_in_core_type typ = List.map free_in xs |> List.concat | { ptyp_desc = Ptyp_alias (x, name) } -> [name] @ free_in x | { ptyp_desc = Ptyp_poly (bound, x) } -> +#if OCAML_VERSION >= (4, 05, 0) + let bound = List.map (fun y -> y.txt) bound in +#endif List.filter (fun y -> not (List.mem y bound)) (free_in x) | { ptyp_desc = Ptyp_variant (rows, _, _) } -> List.map ( @@ -419,6 +422,11 @@ let binop_reduce x a b = let strong_type_of_type ty = let free_vars = free_vars_in_core_type ty in +#if OCAML_VERSION >= (4, 05, 0) + (* give the location of the whole type to the introduced variables *) + let loc = { ty.ptyp_loc with loc_ghost = true } in + let free_vars = List.map (fun v -> mkloc v loc) free_vars in +#endif Typ.force_poly @@ Typ.poly free_vars ty type deriver_options =