Skip to content

Commit 9c083e3

Browse files
committed
feat(vendored-omp): support OCaml 5.6
1 parent e27b903 commit 9c083e3

11 files changed

Lines changed: 1146 additions & 2 deletions

src/vendored-omp/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Convert OCaml parsetrees between different major versions
33

44
This library converts between parsetrees of different OCaml versions.
55

6-
Supported versions are OCaml 4.08 through 4.14 and OCaml 5.0 through 5.5.
6+
Supported versions are OCaml 4.08 through 4.14 and OCaml 5.0 through 5.6.
77
For each version, there is a snapshot of the parsetree and conversion functions
88
to the next and/or previous version.
99

src/vendored-omp/src/ast_56.ml

Lines changed: 231 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,231 @@
1+
module Asttypes = struct
2+
(** Auxiliary AST types used by parsetree and typedtree.
3+
4+
{b Warning:} this module is unstable and part of
5+
{{!Compiler_libs}compiler-libs}.
6+
7+
*)
8+
9+
type constant (*IF_CURRENT = Asttypes.constant *) =
10+
Const_int of int
11+
| Const_char of char
12+
| Const_string of string * Location.t * string option
13+
| Const_float of string
14+
| Const_int32 of int32
15+
| Const_int64 of int64
16+
| Const_nativeint of nativeint
17+
18+
type rec_flag (*IF_CURRENT = Asttypes.rec_flag *) = Nonrecursive | Recursive
19+
20+
type direction_flag (*IF_CURRENT = Asttypes.direction_flag *) = Upto | Downto
21+
22+
(* Order matters, used in polymorphic comparison *)
23+
type private_flag (*IF_CURRENT = Asttypes.private_flag *) = Private | Public
24+
25+
type mutable_flag (*IF_CURRENT = Asttypes.mutable_flag *) = Immutable | Mutable
26+
27+
type atomic_flag (*IF_CURRENT = Asttypes.atomic_flag *) = Nonatomic | Atomic
28+
29+
type virtual_flag (*IF_CURRENT = Asttypes.virtual_flag *) = Virtual | Concrete
30+
31+
type override_flag (*IF_CURRENT = Asttypes.override_flag *) = Override | Fresh
32+
33+
type closed_flag (*IF_CURRENT = Asttypes.closed_flag *) = Closed | Open
34+
35+
type label = string
36+
37+
type arg_label (*IF_CURRENT = Asttypes.arg_label *) =
38+
Nolabel
39+
| Labelled of string (** [label:T -> ...] *)
40+
| Optional of string (** [?label:T -> ...] *)
41+
42+
type 'a loc = 'a Location.loc = {
43+
txt : 'a;
44+
loc : Location.t;
45+
}
46+
47+
type variance (*IF_CURRENT = Asttypes.variance *) =
48+
| Covariant
49+
| Contravariant
50+
| NoVariance
51+
| Bivariant
52+
53+
type injectivity (*IF_CURRENT = Asttypes.injectivity *) =
54+
| Injective
55+
| NoInjectivity
56+
end
57+
58+
module Type_immediacy = struct
59+
type t (*IF_CURRENT = Type_immediacy.t *) =
60+
| Unknown
61+
| Always
62+
| Always_on_64bits
63+
end
64+
65+
module Outcometree = struct
66+
(* Module [Outcometree]: results displayed by the toplevel *)
67+
68+
(* These types represent messages that the toplevel displays as normal
69+
results or errors. The real displaying is customisable using the hooks:
70+
[Toploop.print_out_value]
71+
[Toploop.print_out_type]
72+
[Toploop.print_out_sig_item]
73+
[Toploop.print_out_phrase] *)
74+
75+
(** An [out_name] is a string representation of an identifier which can be
76+
rewritten on the fly to avoid name collisions *)
77+
type out_name (*IF_CURRENT = Outcometree.out_name *) = { mutable printed_name: string }
78+
79+
type out_ident (*IF_CURRENT = Outcometree.out_ident *) =
80+
| Oide_apply of out_ident * out_ident
81+
| Oide_dot of out_ident * string
82+
| Oide_ident of out_name
83+
84+
type out_string (*IF_CURRENT = Outcometree.out_string *) =
85+
| Ostr_string
86+
| Ostr_bytes
87+
88+
type out_attribute (*IF_CURRENT = Outcometree.out_attribute *) =
89+
{ oattr_name: string }
90+
91+
type out_value (*IF_CURRENT = Outcometree.out_value *) =
92+
| Oval_array of out_value list * Asttypes.mutable_flag
93+
| Oval_char of char
94+
| Oval_constr of out_ident * out_value list
95+
| Oval_ellipsis
96+
| Oval_float of float
97+
| Oval_int of int
98+
| Oval_int32 of int32
99+
| Oval_int64 of int64
100+
| Oval_nativeint of nativeint
101+
| Oval_list of out_value list
102+
| Oval_printer of (Caml_format_doc.formatter -> unit)
103+
| Oval_record of (out_ident * out_value) list
104+
| Oval_string of string * int * out_string (* string, size-to-print, kind *)
105+
| Oval_stuff of string
106+
| Oval_tuple of (string option * out_value) list
107+
| Oval_variant of string * out_value option
108+
| Oval_lazy of out_value
109+
| Oval_floatarray of floatarray
110+
111+
type out_type_param (*IF_CURRENT = Outcometree.out_type_param *) = {
112+
ot_non_gen: bool;
113+
ot_name: string;
114+
ot_variance: Asttypes.variance * Asttypes.injectivity
115+
}
116+
117+
type out_type (*IF_CURRENT = Outcometree.out_type *) =
118+
| Otyp_abstract
119+
| Otyp_open
120+
| Otyp_alias of {non_gen:bool; aliased:out_type; alias:string}
121+
| Otyp_arrow of Asttypes.arg_label * out_type * out_type
122+
| Otyp_class of out_ident * out_type list
123+
| Otyp_constr of out_ident * out_type list
124+
| Otyp_manifest of out_type * out_type
125+
| Otyp_object of { fields: (string * out_type) list; row: out_row}
126+
| Otyp_record of out_label list
127+
| Otyp_stuff of string
128+
| Otyp_sum of out_constructor list
129+
| Otyp_tuple of (string option * out_type) list
130+
| Otyp_var of bool * string
131+
| Otyp_variant of out_variant * bool * (string list) option
132+
| Otyp_poly of string list * out_type
133+
| Otyp_module of out_package
134+
| Otyp_attribute of out_type * out_attribute
135+
| Otyp_external of string
136+
| Otyp_functor of Asttypes.arg_label * out_ident * out_package * out_type
137+
138+
and out_row (*IF_CURRENT = Outcometree.out_row *) =
139+
| Orow_closed
140+
| Orow_open_anonymous
141+
| Orow_open of out_type
142+
143+
and out_label (*IF_CURRENT = Outcometree.out_label *) = {
144+
olab_name: string;
145+
olab_mut: Asttypes.mutable_flag;
146+
olab_atomic: Asttypes.atomic_flag;
147+
olab_type: out_type;
148+
}
149+
150+
and out_constructor (*IF_CURRENT = Outcometree.out_constructor *) = {
151+
ocstr_name: string;
152+
ocstr_args: out_type list;
153+
ocstr_return_type: out_type option;
154+
}
155+
156+
and out_package (*IF_CURRENT = Outcometree.out_package *) = {
157+
opack_path: out_ident;
158+
opack_constraints: (string * out_type) list;
159+
}
160+
161+
and out_variant (*IF_CURRENT = Outcometree.out_variant *) =
162+
| Ovar_fields of (string * bool * out_type list) list
163+
| Ovar_typ of out_type
164+
165+
type out_class_type (*IF_CURRENT = Outcometree.out_class_type *) =
166+
| Octy_constr of out_ident * out_type list
167+
| Octy_arrow of Asttypes.arg_label * out_type * out_class_type
168+
| Octy_signature of out_type option * out_class_sig_item list
169+
and out_class_sig_item (*IF_CURRENT = Outcometree.out_class_sig_item *) =
170+
| Ocsg_constraint of out_type * out_type
171+
| Ocsg_method of string * bool * bool * out_type
172+
| Ocsg_value of string * bool * bool * out_type
173+
174+
type out_module_type (*IF_CURRENT = Outcometree.out_module_type *) =
175+
| Omty_abstract
176+
| Omty_functor of (string option * out_module_type) option * out_module_type
177+
| Omty_ident of out_ident
178+
| Omty_signature of out_sig_item list
179+
| Omty_alias of out_ident
180+
and out_sig_item (*IF_CURRENT = Outcometree.out_sig_item *) =
181+
| Osig_class of
182+
bool * string * out_type_param list * out_class_type *
183+
out_rec_status
184+
| Osig_class_type of
185+
bool * string * out_type_param list * out_class_type *
186+
out_rec_status
187+
| Osig_typext of out_extension_constructor * out_ext_status
188+
| Osig_modtype of string * out_module_type
189+
| Osig_module of string * out_module_type * out_rec_status
190+
| Osig_type of out_type_decl * out_rec_status
191+
| Osig_value of out_val_decl
192+
| Osig_ellipsis
193+
and out_type_decl (*IF_CURRENT = Outcometree.out_type_decl *) =
194+
{ otype_name: string;
195+
otype_params: out_type_param list;
196+
otype_type: out_type;
197+
otype_private: Asttypes.private_flag;
198+
otype_immediate: Type_immediacy.t;
199+
otype_unboxed: bool;
200+
otype_constraints: (out_type * out_type) list }
201+
and out_extension_constructor (*IF_CURRENT = Outcometree.out_extension_constructor *) =
202+
{ oext_name: string;
203+
oext_type_name: string;
204+
oext_type_params: out_type_param list;
205+
oext_args: out_type list;
206+
oext_ret_type: out_type option;
207+
oext_private: Asttypes.private_flag }
208+
and out_type_extension (*IF_CURRENT = Outcometree.out_type_extension *) =
209+
{ otyext_name: string;
210+
otyext_params: out_type_param list;
211+
otyext_constructors: out_constructor list;
212+
otyext_private: Asttypes.private_flag }
213+
and out_val_decl (*IF_CURRENT = Outcometree.out_val_decl *) =
214+
{ oval_name: string;
215+
oval_type: out_type;
216+
oval_prims: string list;
217+
oval_attributes: out_attribute list }
218+
and out_rec_status (*IF_CURRENT = Outcometree.out_rec_status *) =
219+
| Orec_not
220+
| Orec_first
221+
| Orec_next
222+
and out_ext_status (*IF_CURRENT = Outcometree.out_ext_status *) =
223+
| Oext_first
224+
| Oext_next
225+
| Oext_exception
226+
227+
type out_phrase (*IF_CURRENT = Outcometree.out_phrase *) =
228+
| Ophr_eval of out_value * out_type
229+
| Ophr_signature of (out_sig_item * out_value option) list
230+
| Ophr_exception of (exn * out_value)
231+
end

src/vendored-omp/src/cinaps_helpers.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ let supported_versions = [
1919
("53", "5.3");
2020
("54", "5.4");
2121
("55", "5.5");
22+
("56", "5.6");
2223
]
2324

2425
let qualified_types = [

src/vendored-omp/src/config/gen.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ let () =
2929
| (5, 3) -> "53"
3030
| (5, 4) -> "54"
3131
| (5, 5) -> "55"
32+
| (5, 6) -> "56"
3233
| _ ->
3334
Printf.eprintf "Unknown OCaml version %s\n" ocaml_version_str;
3435
exit 1);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include Migrate_parsetree_55_56_migrate

0 commit comments

Comments
 (0)