[Pkg-ocaml-maint-commits] [camlp5] 02/03: Fix bug on optional types

Mehdi Dogguy mehdi at moszumanska.debian.org
Mon Jan 25 21:22:13 UTC 2016


This is an automated email from the git hooks/post-receive script.

mehdi pushed a commit to branch master
in repository camlp5.

commit e5e039dc3e6c1e211b38e3077c5bebe2277bb850
Author: Mehdi Dogguy <mehdi at debian.org>
Date:   Mon Jan 25 21:56:46 2016 +0100

    Fix bug on optional types
---
 debian/changelog                                   |   1 +
 .../patches/0002-fixed-bug-on-optional-types.patch | 100 +++++++++++++++++++++
 debian/patches/series                              |   1 +
 3 files changed, 102 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 1a676e1..a7e6cba 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,7 @@ camlp5 (6.14-2) UNRELEASED; urgency=medium
 
   * Team upload.
   * Fix bug on methods wrongly interpreted as vals (Closes: #802264)
+  * Fix bug on optional types, patch picked from upstream's git repository.
 
  -- Mehdi Dogguy <mehdi at debian.org>  Wed, 20 Jan 2016 19:59:02 +0100
 
diff --git a/debian/patches/0002-fixed-bug-on-optional-types.patch b/debian/patches/0002-fixed-bug-on-optional-types.patch
new file mode 100644
index 0000000..0533365
--- /dev/null
+++ b/debian/patches/0002-fixed-bug-on-optional-types.patch
@@ -0,0 +1,100 @@
+From: Mehdi Dogguy <mehdi at debian.org>
+Date: Mon, 25 Jan 2016 21:52:09 +0100
+Subject: fixed bug on optional types
+
+See https://scm.gforge.inria.fr/anonscm/gitweb?p=camlp5/camlp5.git;a=commit;h=bdb6420a699595cb2bce27063ad4dd421b3f312c
+---
+ lib/versdep.ml                  | 13 +++++++++++++
+ ocaml_src/lib/versdep/4.02.3.ml | 11 ++++++++++-
+ ocaml_src/lib/versdep/4.02.4.ml | 11 ++++++++++-
+ 3 files changed, 33 insertions(+), 2 deletions(-)
+
+diff --git a/lib/versdep.ml b/lib/versdep.ml
+index 0cd2233..7a1cf4b 100644
+--- a/lib/versdep.ml
++++ b/lib/versdep.ml
+@@ -94,6 +94,18 @@ value list_map_check f l =
+     | [] -> Some (List.rev rev_l) ]
+ ;
+ 
++IFDEF OCAML_VERSION > OCAML_2_04 AND OCAML_VERSION < OCAML_4_03_0 THEN
++  value mkopt t lab =
++    if lab = "" then t
++    else if lab.[0] = '?' then
++      {ptyp_desc =
++         Ptyp_constr (mknoloc (Ldot (Lident "*predef*") "option")) [t];
++       ptyp_loc = loc_none;
++       ptyp_attributes = []}
++    else t
++  ;
++END;
++
+ value ocaml_value_description vn t p =
+   IFDEF OCAML_VERSION < OCAML_4_00 THEN {pval_type = t; pval_prim = p}
+   ELSIFDEF OCAML_VERSION < OCAML_4_02_0 THEN
+@@ -367,6 +379,7 @@ value ocaml_ptype_variant ctl priv =
+ 
+ value ocaml_ptyp_arrow lab t1 t2 =
+   IFDEF OCAML_VERSION <= OCAML_2_04 THEN Ptyp_arrow t1 t2
++  ELSIFDEF OCAML_VERSION < OCAML_4_03_0 THEN Ptyp_arrow lab (mkopt t1 lab) t2
+   ELSE Ptyp_arrow lab t1 t2 END
+ ;
+ 
+diff --git a/ocaml_src/lib/versdep/4.02.3.ml b/ocaml_src/lib/versdep/4.02.3.ml
+index 54bfd10..9f027e7 100644
+--- a/ocaml_src/lib/versdep/4.02.3.ml
++++ b/ocaml_src/lib/versdep/4.02.3.ml
+@@ -62,6 +62,15 @@ let list_map_check f l =
+   loop [] l
+ ;;
+ 
++let mkopt t lab =
++  if lab = "" then t
++  else if lab.[0] = '?' then
++    {ptyp_desc =
++      Ptyp_constr (mknoloc (Ldot (Lident "*predef*", "option")), [t]);
++     ptyp_loc = loc_none; ptyp_attributes = []}
++  else t
++;;
++
+ let ocaml_value_description vn t p =
+   {pval_type = t; pval_prim = p; pval_loc = t.ptyp_loc;
+    pval_name = mkloc t.ptyp_loc vn; pval_attributes = []}
+@@ -168,7 +177,7 @@ let ocaml_ptype_variant ctl priv =
+   with Exit -> None
+ ;;
+ 
+-let ocaml_ptyp_arrow lab t1 t2 = Ptyp_arrow (lab, t1, t2);;
++let ocaml_ptyp_arrow lab t1 t2 = Ptyp_arrow (lab, mkopt t1 lab, t2);;
+ 
+ let ocaml_ptyp_class li tl ll = Ptyp_class (mknoloc li, tl);;
+ 
+diff --git a/ocaml_src/lib/versdep/4.02.4.ml b/ocaml_src/lib/versdep/4.02.4.ml
+index 54bfd10..9f027e7 100644
+--- a/ocaml_src/lib/versdep/4.02.4.ml
++++ b/ocaml_src/lib/versdep/4.02.4.ml
+@@ -62,6 +62,15 @@ let list_map_check f l =
+   loop [] l
+ ;;
+ 
++let mkopt t lab =
++  if lab = "" then t
++  else if lab.[0] = '?' then
++    {ptyp_desc =
++      Ptyp_constr (mknoloc (Ldot (Lident "*predef*", "option")), [t]);
++     ptyp_loc = loc_none; ptyp_attributes = []}
++  else t
++;;
++
+ let ocaml_value_description vn t p =
+   {pval_type = t; pval_prim = p; pval_loc = t.ptyp_loc;
+    pval_name = mkloc t.ptyp_loc vn; pval_attributes = []}
+@@ -168,7 +177,7 @@ let ocaml_ptype_variant ctl priv =
+   with Exit -> None
+ ;;
+ 
+-let ocaml_ptyp_arrow lab t1 t2 = Ptyp_arrow (lab, t1, t2);;
++let ocaml_ptyp_arrow lab t1 t2 = Ptyp_arrow (lab, mkopt t1 lab, t2);;
+ 
+ let ocaml_ptyp_class li tl ll = Ptyp_class (mknoloc li, tl);;
+ 
diff --git a/debian/patches/series b/debian/patches/series
index f38e374..82a6222 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 0001-fix-for-methods-wrongly-interpreted-as-vals.patch
+0002-fixed-bug-on-optional-types.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ocaml-maint/packages/camlp5.git



More information about the Pkg-ocaml-maint-commits mailing list