summaryrefslogtreecommitdiff
path: root/dev-ml/ppx_type_conv/files/oc43.patch
blob: ac3a1dfac57ec3fec486b137dd1c067333777c73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
diff -uNr ppx_type_conv-113.33.00/_oasis ppx_type_conv-113.33.00+4.03/_oasis
--- ppx_type_conv-113.33.00/_oasis	2016-03-09 16:44:55.000000000 +0100
+++ ppx_type_conv-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_type_conv
-Version:          113.33.00
+Version:          113.33.00+4.03
 Synopsis:         Support Library for type-driven code generators
 Authors:          Jane Street Group, LLC <opensource@janestreet.com>
 Copyrights:       (C) 2015-2016 Jane Street Group LLC <opensource@janestreet.com>
diff -uNr ppx_type_conv-113.33.00/opam ppx_type_conv-113.33.00+4.03/opam
--- ppx_type_conv-113.33.00/opam	2016-03-18 12:08:01.000000000 +0100
+++ ppx_type_conv-113.33.00+4.03/opam	2016-03-22 17:51:38.000000000 +0100
@@ -17,4 +17,4 @@
   "ppx_driver"
   "ppx_tools"    {>= "0.99.3"}
 ]
-available: [ ocaml-version >= "4.02.3" ]
+available: [ ocaml-version >= "4.03.0" ]
diff -uNr ppx_type_conv-113.33.00/src/type_conv.ml ppx_type_conv-113.33.00+4.03/src/type_conv.ml
--- ppx_type_conv-113.33.00/src/type_conv.ml	2016-03-09 16:44:55.000000000 +0100
+++ ppx_type_conv-113.33.00+4.03/src/type_conv.ml	2016-03-22 15:13:51.000000000 +0100
@@ -472,9 +472,10 @@
     Ast_pattern.(
       let label =
         map' __ ~f:(fun loc f label ->
-          if label = "" || label.[0] = '?' then
+          match label with
+          | Nolabel | Optional _ ->
             Location.raise_errorf ~loc "non-optional labeled argument expected"
-          else
+          | Labelled label ->
             f label)
       in
       let generator_name () =
@@ -530,16 +531,6 @@
 let get_str_exception_derivers = get_derivers deriving_attr_ec Deriver.Field.str_exception
 let get_sig_exception_derivers = get_derivers deriving_attr_ec Deriver.Field.sig_exception
 
-let get_rec_flag tds =
-  let has_nonrec td =
-    List.exists td.ptype_attributes ~f:(fun (name, _) -> name.txt = "nonrec")
-  in
-  if List.exists tds ~f:has_nonrec then
-    Nonrecursive
-  else
-    Recursive
-;;
-
 (* +-----------------------------------------------------------------+
    | Unused warning stuff                                            |
    +-----------------------------------------------------------------+ *)
@@ -627,17 +618,16 @@
       let item = super#structure_item path item in
       let loc = item.pstr_loc in
       match item.pstr_desc with
-      | Pstr_type tds ->
+      | Pstr_type (rec_flag, tds) ->
         begin match get_str_type_decl_derivers tds with
         | None -> [item]
         | Some (tds, generators) ->
-          let rec_flag = get_rec_flag tds in
           let generated =
             types_used_by_type_conv tds
             @ Generator.apply_all ~rev:true ~loc ~path (rec_flag, tds) generators;
           in
           let tds = List.map tds ~f:(remove generators)#type_declaration in
-          let item = { item with pstr_desc = Pstr_type tds } in
+          let item = { item with pstr_desc = Pstr_type (rec_flag, tds) } in
           item :: disable_unused_warning_str ~loc generated
         end
 
@@ -670,14 +660,13 @@
       let item = super#signature_item path item in
       let loc = item.psig_loc in
       match item.psig_desc with
-      | Psig_type tds ->
+      | Psig_type (rec_flag, tds) ->
         begin match get_sig_type_decl_derivers tds with
         | None -> [item]
         | Some (tds, generators) ->
-          let rec_flag = get_rec_flag tds in
           let generated = Generator.apply_all ~loc ~path (rec_flag, tds) generators in
           let tds = List.map tds ~f:(remove generators)#type_declaration in
-          let item = { item with psig_desc = Psig_type tds } in
+          let item = { item with psig_desc = Psig_type (rec_flag, tds) } in
           item :: disable_unused_warning_sig ~loc generated
         end