Skip to content

Commit

Permalink
Fix build with 4.05
Browse files Browse the repository at this point in the history
Jeremie Dimino authored and whitequark committed Aug 20, 2017
1 parent 3ef3739 commit b6b02c2
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/ppx_deriving.cppo.ml
Original file line number Diff line number Diff line change
@@ -12,6 +12,21 @@ open Parsetree
open Ast_helper
open Ast_convenience

#if OCAML_VERSION >= (4, 05, 0)
module Typ = struct
include Typ

let poly ?(loc= !Ast_helper.default_loc) ?attrs vars ty =
let vars = List.map (fun txt -> { Asttypes.loc; txt }) vars in
Typ.poly ~loc ?attrs vars ty
end

let rm_poly_locs =
List.map (fun x -> x.Asttypes.txt)
#else
let rm_poly_locs x = x
#endif

type deriver = {
name : string ;
core_type : (core_type -> expression) option;
@@ -325,6 +340,7 @@ 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) } ->
let bound = rm_poly_locs bound in
List.filter (fun y -> not (List.mem y bound)) (free_in x)
| { ptyp_desc = Ptyp_variant (rows, _, _) } ->
List.map (

0 comments on commit b6b02c2

Please sign in to comment.