Skip to content

Commit 79864a6

Browse files
authored
Merge 5.2.0minus-18 (#180)
* Import ocaml sources for oxcaml/oxcaml@dec889241a6 * Automatic merges * Commit merge conflicts * Fix conflicts * Fix type errors in merlin-specific code * Bump magic numbers * Promote tests * Add ignored flags * Fix formatting
1 parent 8636427 commit 79864a6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+894
-602
lines changed

src/analysis/context.ml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,9 @@ let inspect_pattern (type a) ~cursor ~lid (p : a Typedtree.general_pattern) =
9797
Format.fprintf fmt "current pattern is: %a" (Printtyped.pattern 0) p);
9898
match p.pat_desc with
9999
| Tpat_any when Longident.last lid = "_" -> None
100-
| Tpat_var (_, str_loc, _, _) when Longident.last lid = str_loc.txt -> None
101-
| Tpat_alias (_, _, str_loc, _, _, _) when Longident.last lid = str_loc.txt ->
100+
| Tpat_var (_, str_loc, _, _, _) when Longident.last lid = str_loc.txt -> None
101+
| Tpat_alias (_, _, str_loc, _, _, _, _) when Longident.last lid = str_loc.txt
102+
->
102103
(* Assumption: if [Browse.enclosing] stopped on this node and not on the
103104
subpattern, then it must mean that the cursor is on the alias. *)
104105
None

src/analysis/destruct.ml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ let rec destructible patt =
339339
let open Typedtree in
340340
match patt.pat_desc with
341341
| Tpat_any | Tpat_var _ -> true
342-
| Tpat_alias (p, _, _, _, _, _) -> destructible p
342+
| Tpat_alias (p, _, _, _, _, _, _) -> destructible p
343343
| _ -> false
344344

345345
let is_package ty =
@@ -369,8 +369,8 @@ let rec subst_patt initial ~by patt =
369369
let open Typedtree in
370370
match patt.pat_desc with
371371
| Tpat_any | Tpat_var _ | Tpat_constant _ -> patt
372-
| Tpat_alias (p, x, y, uid, m, ty) ->
373-
{ patt with pat_desc = Tpat_alias (f p, x, y, uid, m, ty) }
372+
| Tpat_alias (p, x, y, uid, s, m, ty) ->
373+
{ patt with pat_desc = Tpat_alias (f p, x, y, uid, s, m, ty) }
374374
| Tpat_tuple lst ->
375375
{ patt with
376376
pat_desc = Tpat_tuple (List.map lst ~f:(fun (lbl, p) -> (lbl, f p)))
@@ -408,8 +408,8 @@ let rec rm_sub patt sub =
408408
let open Typedtree in
409409
match patt.pat_desc with
410410
| Tpat_any | Tpat_var _ | Tpat_constant _ -> patt
411-
| Tpat_alias (p, x, y, uid, m, ty) ->
412-
{ patt with pat_desc = Tpat_alias (f p, x, y, uid, m, ty) }
411+
| Tpat_alias (p, x, y, uid, s, m, ty) ->
412+
{ patt with pat_desc = Tpat_alias (f p, x, y, uid, s, m, ty) }
413413
| Tpat_tuple lst ->
414414
{ patt with
415415
pat_desc = Tpat_tuple (List.map lst ~f:(fun (lbl, p) -> (lbl, f p)))
@@ -473,8 +473,8 @@ let rec qualify_constructors ~unmangling_tables f pat =
473473
in
474474
let pat_desc =
475475
match pat.pat_desc with
476-
| Tpat_alias (p, id, loc, uid, m, ty) ->
477-
Tpat_alias (qualify_constructors f p, id, loc, uid, m, ty)
476+
| Tpat_alias (p, id, loc, uid, s, m, ty) ->
477+
Tpat_alias (qualify_constructors f p, id, loc, uid, s, m, ty)
478478
| Tpat_tuple ps ->
479479
Tpat_tuple
480480
(List.map ps ~f:(fun (lbl, p) -> (lbl, qualify_constructors f p)))
@@ -532,7 +532,7 @@ let find_branch patterns sub =
532532
match patt.pat_desc with
533533
| Tpat_any | Tpat_var _ | Tpat_constant _ | Tpat_variant (_, None, _) ->
534534
false
535-
| Tpat_alias (p, _, _, _, _, _)
535+
| Tpat_alias (p, _, _, _, _, _, _)
536536
| Tpat_variant (_, Some p, _)
537537
| Tpat_lazy p -> is_sub_patt p ~sub
538538
| Tpat_tuple lst ->
@@ -611,12 +611,12 @@ module Conv = struct
611611
in
612612
match pat.pat_desc with
613613
| Tpat_or (pa, pb, _) -> mkpat (Ppat_or (loop pa, loop pb))
614-
| Tpat_var (_, ({ txt = "*extension*"; _ } as nm), _, _) ->
614+
| Tpat_var (_, ({ txt = "*extension*"; _ } as nm), _, _, _) ->
615615
(* PR#7330 *)
616616
mkpat (Ppat_var nm)
617617
| Tpat_any | Tpat_var _ -> mkpat Ppat_any
618618
| Tpat_constant c -> mkpat (Ppat_constant (Untypeast.constant c))
619-
| Tpat_alias (p, _, _, _, _, _) -> loop p
619+
| Tpat_alias (p, _, _, _, _, _, _) -> loop p
620620
| Tpat_tuple lst ->
621621
let lst = List.map ~f:(fun (lbl, p) -> (lbl, loop p)) lst in
622622
mkpat (Ppat_tuple (lst, Closed))

src/analysis/occurrences.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ let uid_and_loc_of_node env node =
121121
Some (md.md_uid, mb_name.loc)
122122
| Pattern
123123
{ pat_desc =
124-
Tpat_var (_, name, uid, _) | Tpat_alias (_, _, name, uid, _, _);
124+
Tpat_var (_, name, uid, _, _) | Tpat_alias (_, _, name, uid, _, _, _);
125125
_
126126
} -> Some (uid, name.loc)
127127
| Type_declaration { typ_type; typ_name; _ } ->

src/analysis/outline.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ open Browse_raw
3636
open Browse_tree
3737

3838
let id_of_patt = function
39-
| { pat_desc = Tpat_var (id, _, _, _); _ } -> Some id
39+
| { pat_desc = Tpat_var (id, _, _, _, _); _ } -> Some id
4040
| _ -> None
4141

4242
let mk ?(children = []) ~location ~deprecated outline_kind outline_type id =

src/analysis/typedtree_utils.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ let let_bound_vars bindings =
2525
List.filter_map
2626
~f:(fun value_binding ->
2727
match value_binding.Typedtree.vb_pat.pat_desc with
28-
| Tpat_var (id, loc, _, _) -> Some (id, loc)
28+
| Tpat_var (id, loc, _, _, _) -> Some (id, loc)
2929
| Typedtree.Tpat_any
30-
| Typedtree.Tpat_alias (_, _, _, _, _, _)
30+
| Typedtree.Tpat_alias (_, _, _, _, _, _, _)
3131
| Typedtree.Tpat_constant _
3232
| Typedtree.Tpat_tuple _
3333
| Typedtree.Tpat_unboxed_tuple _
@@ -66,10 +66,10 @@ let location_of_declaration ~uid =
6666
| Class_type ctd -> Some ctd.ci_id_name
6767

6868
let pat_var_id_and_loc = function
69-
| Typedtree.{ pat_desc = Tpat_var (id, loc, _, _); _ } -> Some (id, loc)
69+
| Typedtree.{ pat_desc = Tpat_var (id, loc, _, _, _); _ } -> Some (id, loc)
7070
| _ -> None
7171

7272
let pat_alias_pat_id_and_loc = function
73-
| Typedtree.{ pat_desc = Tpat_alias (pat, id, loc, _, _, _); _ } ->
73+
| Typedtree.{ pat_desc = Tpat_alias (pat, id, loc, _, _, _, _); _ } ->
7474
Some (pat, id, loc)
7575
| _ -> None

src/kernel/mconfig.ml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,11 @@ let ocaml_ignored_flags =
626626
"-keep-llvmir";
627627
"-llvm-path";
628628
"-ddwarf-types";
629-
"-ocamlcfg"
629+
"-ocamlcfg";
630+
"-cfg-prologue-validate";
631+
"-no-cfg-prologue-validate";
632+
"-cfg-prologue-shrink-wrap";
633+
"-no-cfg-prologue-shrink-wrap"
630634
]
631635

632636
let ocaml_ignored_parametrized_flags =
@@ -705,7 +709,8 @@ let ocaml_ignored_parametrized_flags =
705709
"-save-ir-before";
706710
"-shape-format";
707711
"-gdwarf-compression";
708-
"-gdwarf-fission"
712+
"-gdwarf-fission";
713+
"-cfg-prologue-shrink-wrap-threshold"
709714
]
710715

711716
let ocaml_warnings_spec ~error =

src/ocaml/merlin_specific/browse_raw.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ let of_pattern_desc (type k) (desc : k pattern_desc) =
342342
match desc with
343343
| Tpat_any | Tpat_var _ | Tpat_constant _ | Tpat_variant (_, None, _) ->
344344
id_fold
345-
| Tpat_alias (p, _, _, _, _, _)
345+
| Tpat_alias (p, _, _, _, _, _, _)
346346
| Tpat_variant (_, Some p, _)
347347
| Tpat_lazy p
348348
| Tpat_exception p -> of_pattern p
@@ -806,9 +806,9 @@ let pattern_paths (type k) { Typedtree.pat_desc; pat_extra; _ } =
806806
match (pat_desc : k pattern_desc) with
807807
| Tpat_construct (lid_loc, { Types.cstr_name; cstr_res; _ }, _, _) ->
808808
fake_path lid_loc cstr_res cstr_name
809-
| Tpat_var (id, { Location.loc; txt }, _, _) ->
809+
| Tpat_var (id, { Location.loc; txt }, _, _, _) ->
810810
[ (mkloc (Path.Pident id) loc, Some (Longident.Lident txt)) ]
811-
| Tpat_alias (_, id, loc, _, _, _) ->
811+
| Tpat_alias (_, id, loc, _, _, _, _) ->
812812
[ (reloc (Path.Pident id) loc, Some (Longident.Lident loc.txt)) ]
813813
| _ -> []
814814
in

src/ocaml/merlin_specific/tast_helper.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ module Pat = struct
2121
| None -> str.Asttypes.loc
2222
| Some loc -> loc
2323
in
24+
let sort = Jkind.Sort.new_var () in
2425
let mode = Mode.Value.newvar () in
2526
let pat_desc =
26-
Tpat_var (Ident.create_local str.Asttypes.txt, str, uid, mode)
27+
Tpat_var (Ident.create_local str.Asttypes.txt, str, uid, sort, mode)
2728
in
2829
{ pat_desc;
2930
pat_loc;

src/ocaml/typing/jkind_intf.ml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,16 @@ module type Sort = sig
131131
val for_tuple : t
132132

133133
val for_idx : t
134+
135+
val for_loop_index : t
136+
137+
val for_constructor : t
138+
139+
val for_module_field : t
140+
141+
val for_boxed_variant : t
142+
143+
val for_exception : t
134144
end
135145

136146
module Var : sig

src/ocaml/typing/jkind_types.ml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,16 @@ module Sort = struct
202202
let for_list_element = value
203203

204204
let for_idx = bits64
205+
206+
let for_loop_index = value
207+
208+
let for_constructor = value
209+
210+
let for_module_field = value
211+
212+
let for_boxed_variant = value
213+
214+
let for_exception = value
205215
end
206216

207217
module Var = struct

0 commit comments

Comments
 (0)