diff options
author | Alexis Ballier <aballier@gentoo.org> | 2016-05-01 20:09:14 +0200 |
---|---|---|
committer | Alexis Ballier <aballier@gentoo.org> | 2016-05-03 11:13:52 +0200 |
commit | bc71c7dce7157facf5fc5335bac1bbf9cc5a9d9b (patch) | |
tree | 80f549c374822e44cc79522b1bfb07588157f560 /dev-ml/ppx_optcomp/files | |
parent | dev-ml/ppx_core: fix build with ocaml 4.03 (diff) | |
download | gentoo-bc71c7dce7157facf5fc5335bac1bbf9cc5a9d9b.tar.gz gentoo-bc71c7dce7157facf5fc5335bac1bbf9cc5a9d9b.tar.bz2 gentoo-bc71c7dce7157facf5fc5335bac1bbf9cc5a9d9b.zip |
dev-ml/ppx_optcomp: fix build with ocaml 4.03
Package-Manager: portage-2.2.28
Signed-off-by: Alexis Ballier <aballier@gentoo.org>
Diffstat (limited to 'dev-ml/ppx_optcomp/files')
-rw-r--r-- | dev-ml/ppx_optcomp/files/oc43.patch | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/dev-ml/ppx_optcomp/files/oc43.patch b/dev-ml/ppx_optcomp/files/oc43.patch new file mode 100644 index 000000000000..6203c077e0c8 --- /dev/null +++ b/dev-ml/ppx_optcomp/files/oc43.patch @@ -0,0 +1,93 @@ +diff -uNr ppx_optcomp-113.33.00/_oasis ppx_optcomp-113.33.00+4.03/_oasis +--- ppx_optcomp-113.33.00/_oasis 2016-03-09 16:44:54.000000000 +0100 ++++ ppx_optcomp-113.33.00+4.03/_oasis 2016-03-22 15:13:51.000000000 +0100 +@@ -1,8 +1,8 @@ + OASISFormat: 0.4 +-OCamlVersion: >= 4.02.3 ++OCamlVersion: >= 4.03.0 + FindlibVersion: >= 1.3.2 + Name: ppx_optcomp +-Version: 113.33.00 ++Version: 113.33.00+4.03 + Synopsis: Optional compilation for OCaml + Authors: Jane Street Group, LLC <opensource@janestreet.com> + Copyrights: (C) 2015-2016 Jane Street Group LLC <opensource@janestreet.com> +diff -uNr ppx_optcomp-113.33.00/opam ppx_optcomp-113.33.00+4.03/opam +--- ppx_optcomp-113.33.00/opam 2016-03-18 12:08:01.000000000 +0100 ++++ ppx_optcomp-113.33.00+4.03/opam 2016-03-22 17:51:37.000000000 +0100 +@@ -15,4 +15,4 @@ + "ppx_core" + "ppx_tools" {>= "0.99.3"} + ] +-available: [ ocaml-version >= "4.02.3" ] ++available: [ ocaml-version >= "4.03.0" ] +diff -uNr ppx_optcomp-113.33.00/src/ppx_optcomp.ml ppx_optcomp-113.33.00+4.03/src/ppx_optcomp.ml +--- ppx_optcomp-113.33.00/src/ppx_optcomp.ml 2016-03-09 16:44:54.000000000 +0100 ++++ ppx_optcomp-113.33.00+4.03/src/ppx_optcomp.ml 2016-03-22 15:13:51.000000000 +0100 +@@ -169,12 +169,19 @@ + Location.raise_errorf ~loc:e.pexp_loc "optcomp: expression not supported" + ;; + ++let parse_int loc x = ++ match int_of_string x with ++ | v -> v ++ | exception _ -> ++ Location.raise_errorf ~loc "optcomp: invalid integer" ++;; ++ + let rec eval env e : Value.t = + let loc = e.pexp_loc in + match e.pexp_desc with +- | Pexp_constant (Const_int x ) -> Int x +- | Pexp_constant (Const_char x ) -> Char x +- | Pexp_constant (Const_string (x, _)) -> String x ++ | Pexp_constant (Pconst_integer (x, None)) -> Int (parse_int loc x) ++ | Pexp_constant (Pconst_char x ) -> Char x ++ | Pexp_constant (Pconst_string (x, _ )) -> String x + + | Pexp_construct ({ txt = Lident "true" ; _ }, None) -> Bool true + | Pexp_construct ({ txt = Lident "false"; _ }, None) -> Bool false +@@ -192,7 +199,7 @@ + + | Pexp_apply ({ pexp_desc = Pexp_ident { txt = Lident s; _ }; _ }, args) -> begin + let args = +- List.map args ~f:(fun (l, x) -> if l <> "" then not_supported e else x) ++ List.map args ~f:(fun (l, x) -> if l <> Asttypes.Nolabel then not_supported e else x) + in + match s, args with + | "=" , [x; y] -> eval_cmp env ( = ) x y +@@ -283,12 +290,13 @@ + | _ -> not_supported e + + and bind env patt value = ++ let loc = patt.ppat_loc in + match patt.ppat_desc, value with + | Ppat_any, _ -> env + +- | Ppat_constant (Const_int x ), Int y when x = y -> env +- | Ppat_constant (Const_char x ), Char y when x = y -> env +- | Ppat_constant (Const_string (x, _)), String y when x = y -> env ++ | Ppat_constant (Pconst_integer (x, None)), Int y when parse_int loc x = y -> env ++ | Ppat_constant (Pconst_char x ), Char y when x = y -> env ++ | Ppat_constant (Pconst_string (x, _ )), String y when x = y -> env + + | Ppat_construct ({ txt = Lident "true" ; _ }, None), Bool true -> env + | Ppat_construct ({ txt = Lident "false"; _ }, None), Bool false -> env +@@ -506,7 +514,7 @@ + | Pexp_construct (x, Some y) -> + let id = var_of_lid x in + Let (ppat_var ~loc:id.loc id, y) +- | Pexp_apply (x, [("", y)]) -> ++ | Pexp_apply (x, [(Nolabel, y)]) -> + let id = var_of_expr x in + Let (ppat_var ~loc:id.loc id, y) + | _ -> +@@ -517,7 +525,7 @@ + | LIDENT "import" -> begin + let e = get_expr () in + match e.pexp_desc with +- | Pexp_constant (Const_string (s, _)) -> Import s ++ | Pexp_constant (Pconst_string (s, _)) -> Import s + | _ -> + Location.raise_errorf ~loc:e.pexp_loc "optcomp: #import expect a string" + end |