Skip to content

Commit 78c883a

Browse files
goldfirereccasinliam923
authored
Update merlin for 5.2.0minus-6 (#132)
* Import ocaml sources for oxcaml/oxcaml@4eb95cdd48f * Commit conflicts * Manually update clflags.ml{,i} * Manually fix conflicts * Fix the build * Promote new test output (after checking it all) * Update test to new reality * Update magic numbers * Import ocaml sources for oxcaml/oxcaml@6a83bbad9dd * Commit conflicts * Resolve conflicts * Fix compilation problems * Accept new version numbers in test * Account for new flags * format * Make module paths in jkind match the compiler * Fix formatting * Promote generated files * Import ocaml sources for oxcaml/oxcaml@db3778f932f * Commit conflicts * Resolve conflicts * Revert test * Remove unused declaration * Remove unused module alias in ctype * Bump setup-ocaml version --------- Co-authored-by: Chris Casinghino <[email protected]> Co-authored-by: Liam Stevenson <[email protected]>
1 parent 4336bc1 commit 78c883a

File tree

167 files changed

+17417
-15442
lines changed

Some content is hidden

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

167 files changed

+17417
-15442
lines changed

.github/workflows/flambda-backend.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
ocaml-compiler: ${{ matrix.ocaml-compiler }}
4545

4646
- name: Cache flambda-backend build
47-
uses: actions/cache@v2
47+
uses: actions/cache@v3
4848
id: cache
4949
with:
5050
path: ${{ github.workspace }}/flambda-backend/_install

src/analysis/completion.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ let fold_sumtype_constructors ~env ~init ~f t =
289289
| Type_record_unboxed_product _
290290
| Type_abstract _
291291
| Type_open -> init
292-
| Type_variant (constrs, _) -> List.fold_right constrs ~init ~f
292+
| Type_variant (constrs, _, _) -> List.fold_right constrs ~init ~f
293293
end
294294
| _ -> init
295295

@@ -678,7 +678,7 @@ let branch_complete buffer ?get_doc ?target_type ?kinds ~keywords prefix =
678678
match Types.get_desc t with
679679
| Types.Tconstr (p, _, _) -> (
680680
match (Env.find_type p env).Types.type_kind with
681-
| Types.Type_record (labels, _) -> Declaration (t, labels)
681+
| Types.Type_record (labels, _, _) -> Declaration (t, labels)
682682
| _ -> Maybe)
683683
| _ -> Maybe
684684
with _ -> Maybe
@@ -722,7 +722,7 @@ let branch_complete buffer ?get_doc ?target_type ?kinds ~keywords prefix =
722722
Description labels
723723
with _ -> (
724724
match decl.Types.type_kind with
725-
| Types.Type_record (lbls, _) -> Declaration (ty, lbls)
725+
| Types.Type_record (lbls, _, _) -> Declaration (ty, lbls)
726726
| _ -> Maybe)
727727
end
728728
| _ | (exception _) -> Maybe

src/analysis/construct.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -504,9 +504,9 @@ module Gen = struct
504504
with Not_found -> (
505505
let def = Env.find_type_descrs path env in
506506
match def with
507-
| Type_variant (constrs, _) -> constructor env rtyp path constrs
508-
| Type_record (labels, _) -> record env rtyp path labels Legacy
509-
| Type_record_unboxed_product (labels, _) ->
507+
| Type_variant (constrs, _, _) -> constructor env rtyp path constrs
508+
| Type_record (labels, _, _) -> record env rtyp path labels Legacy
509+
| Type_record_unboxed_product (labels, _, _) ->
510510
record env rtyp path labels Unboxed_product
511511
| Type_abstract _ | Type_open -> [])
512512
end

src/analysis/context.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ let inspect_pattern (type a) ~cursor ~lid (p : a Typedtree.general_pattern) =
9898
match p.pat_desc with
9999
| Tpat_any when Longident.last lid = "_" -> None
100100
| Tpat_var (_, str_loc, _, _) when Longident.last lid = str_loc.txt -> None
101-
| Tpat_alias (_, _, str_loc, _, _) when Longident.last lid = str_loc.txt ->
101+
| Tpat_alias (_, _, str_loc, _, _, _) when Longident.last lid = str_loc.txt ->
102102
(* Assumption: if [Browse.enclosing] stopped on this node and not on the
103103
subpattern, then it must mean that the cursor is on the alias. *)
104104
None

src/analysis/destruct.ml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ let rec gen_patterns ?(recurse = true) env type_expr =
101101
[ Tast_helper.Pat.tuple env type_expr patterns ]
102102
| Tconstr (path, _params, _) -> begin
103103
match Env.find_type_descrs path env with
104-
| Type_record (labels, _) ->
104+
| Type_record (labels, _, _) ->
105105
let lst =
106106
List.map labels ~f:(fun lbl_descr ->
107107
let lidloc = mk_id lbl_descr.lbl_name in
@@ -111,7 +111,7 @@ let rec gen_patterns ?(recurse = true) env type_expr =
111111
(mk_var lbl_descr.lbl_name) ))
112112
in
113113
[ Tast_helper.Pat.record env type_expr lst Asttypes.Closed ]
114-
| Type_variant (constructors, _) ->
114+
| Type_variant (constructors, _, _) ->
115115
let prefix =
116116
let path = Printtyp.shorten_type_path env path in
117117
fun name ->
@@ -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) ->
373-
{ patt with pat_desc = Tpat_alias (f p, x, y, uid, m) }
372+
| Tpat_alias (p, x, y, uid, m, ty) ->
373+
{ patt with pat_desc = Tpat_alias (f p, x, y, uid, 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) ->
412-
{ patt with pat_desc = Tpat_alias (f p, x, y, uid, m) }
411+
| Tpat_alias (p, x, y, uid, m, ty) ->
412+
{ patt with pat_desc = Tpat_alias (f p, x, y, uid, 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) ->
477-
Tpat_alias (qualify_constructors f p, id, loc, uid, m)
476+
| Tpat_alias (p, id, loc, uid, m, ty) ->
477+
Tpat_alias (qualify_constructors f p, id, loc, uid, m, ty)
478478
| Tpat_tuple ps ->
479479
Tpat_tuple
480480
(List.map ps ~f:(fun (lbl, p) -> (lbl, qualify_constructors f p)))
@@ -532,8 +532,9 @@ 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, _, _, _, _) | Tpat_variant (_, Some p, _) | Tpat_lazy p
536-
-> is_sub_patt p ~sub
535+
| Tpat_alias (p, _, _, _, _, _)
536+
| Tpat_variant (_, Some p, _)
537+
| Tpat_lazy p -> is_sub_patt p ~sub
537538
| Tpat_tuple lst ->
538539
List.exists lst ~f:(fun (_lbl, p) -> is_sub_patt ~sub p)
539540
| Tpat_unboxed_tuple lst ->
@@ -615,7 +616,7 @@ module Conv = struct
615616
mkpat (Ppat_var nm)
616617
| Tpat_any | Tpat_var _ -> mkpat Ppat_any
617618
| Tpat_constant c -> mkpat (Ppat_constant (Untypeast.constant c))
618-
| Tpat_alias (p, _, _, _, _) -> loop p
619+
| Tpat_alias (p, _, _, _, _, _) -> loop p
619620
| Tpat_tuple lst ->
620621
let lst = List.map ~f:(fun (lbl, p) -> (lbl, loop p)) lst in
621622
mkpat (Ppat_tuple (lst, Closed))

src/analysis/occurrences.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ let uid_and_loc_of_node env node =
6060
let md = Env.find_module (Pident ident) env in
6161
Some (md.md_uid, mb_name.loc)
6262
| Pattern
63-
{ pat_desc = Tpat_var (_, name, uid, _) | Tpat_alias (_, _, name, uid, _);
63+
{ pat_desc =
64+
Tpat_var (_, name, uid, _) | Tpat_alias (_, _, name, uid, _, _);
6465
_
6566
} -> Some (uid, name.loc)
6667
| Type_declaration { typ_type; typ_name; _ } ->

src/analysis/ptyp_of_type.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,11 @@ and type_declaration id
226226
match type_kind with
227227
| Type_abstract _ -> Parsetree.Ptype_abstract
228228
| Type_open -> Ptype_open
229-
| Type_variant (constrs, _) ->
229+
| Type_variant (constrs, _, _) ->
230230
Ptype_variant (List.map ~f:constructor_declaration constrs)
231-
| Type_record (labels, _repr) ->
231+
| Type_record (labels, _repr, _) ->
232232
Ptype_record (List.map ~f:label_declaration labels)
233-
| Type_record_unboxed_product (labels, _repr) ->
233+
| Type_record_unboxed_product (labels, _repr, _) ->
234234
Ptype_record_unboxed_product (List.map ~f:label_declaration labels)
235235
in
236236
let manifest = Option.map ~f:core_type type_manifest in

src/analysis/typedtree_utils.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ let let_bound_vars bindings =
2727
match value_binding.Typedtree.vb_pat.pat_desc with
2828
| 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 _
@@ -70,6 +70,6 @@ let pat_var_id_and_loc = function
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: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ type ocaml =
2626
parameters : string list;
2727
as_parameter : bool;
2828
as_argument_for : string option;
29-
zero_alloc_check : Zero_alloc_annotations.t;
30-
allow_illegal_crossing : bool
29+
zero_alloc_check : Zero_alloc_annotations.Check.t;
30+
zero_alloc_assert : Zero_alloc_annotations.Assert.t;
31+
infer_with_bounds : bool
3132
}
3233

3334
let dump_warnings st =
@@ -57,7 +58,9 @@ let dump_ocaml x =
5758
("parameters", `List (List.map ~f:Json.string x.parameters));
5859
("as_parameter", `Bool x.as_parameter);
5960
( "zero_alloc_check",
60-
`String (Zero_alloc_annotations.to_string x.zero_alloc_check) )
61+
`String (Zero_alloc_annotations.Check.to_string x.zero_alloc_check) );
62+
( "zero_alloc_assert",
63+
`String (Zero_alloc_annotations.Assert.to_string x.zero_alloc_assert) )
6164
]
6265

6366
(** Some paths can be resolved relative to a current working directory *)
@@ -452,7 +455,6 @@ let ocaml_ignored_flags =
452455
"-drawflambda";
453456
"-drawlambda";
454457
"-dreload";
455-
"-dscheduling";
456458
"-dsel";
457459
"-dsource";
458460
"-dspill";
@@ -652,6 +654,7 @@ let ocaml_ignored_parametrized_flags =
652654
"-o";
653655
"-rounds";
654656
"-runtime-variant";
657+
"-ocamlrunparam";
655658
"-unbox-closures-factor";
656659
"-use-prims";
657660
"-use_runtime";
@@ -828,16 +831,24 @@ let ocaml_flags =
828831
);
829832
( "-zero-alloc-check",
830833
Marg.param "string" (fun zero_alloc_str ocaml ->
831-
match Zero_alloc_annotations.of_string zero_alloc_str with
834+
match Zero_alloc_annotations.Check.of_string zero_alloc_str with
832835
| Some zero_alloc_check -> { ocaml with zero_alloc_check }
833836
| None ->
834837
failwith ("Invalid value for -zero-alloc-check: " ^ zero_alloc_str)),
835838
" Check that annotated functions do not allocate and do not have \
836-
indirect calls. " ^ Zero_alloc_annotations.doc );
837-
( "-allow-illegal-crossing",
838-
Marg.unit (fun ocaml -> { ocaml with allow_illegal_crossing = true }),
839-
"Type declarations will not be checked along the portability or \
840-
contention axes" )
839+
indirect calls. " ^ Zero_alloc_annotations.Check.doc );
840+
( "-zero-alloc-assert",
841+
Marg.param "string" (fun zero_alloc_str ocaml ->
842+
match Zero_alloc_annotations.Assert.of_string zero_alloc_str with
843+
| Some zero_alloc_assert -> { ocaml with zero_alloc_assert }
844+
| None ->
845+
failwith ("Invalid value for -zero-alloc-assert: " ^ zero_alloc_str)),
846+
" Add zero_alloc annotations to all functions. "
847+
^ Zero_alloc_annotations.Assert.doc );
848+
( "-infer-with-bounds",
849+
Marg.unit (fun ocaml -> { ocaml with infer_with_bounds = true }),
850+
"Infer with-bounds on kinds for type declarations. May impact \
851+
performance." )
841852
]
842853

843854
(** {1 Main configuration} *)
@@ -865,8 +876,9 @@ let initial =
865876
parameters = [];
866877
as_parameter = false;
867878
as_argument_for = None;
868-
zero_alloc_check = Zero_alloc_annotations.Check_default;
869-
allow_illegal_crossing = false
879+
zero_alloc_check = Zero_alloc_annotations.Check.Check_default;
880+
zero_alloc_assert = Zero_alloc_annotations.Assert.Assert_default;
881+
infer_with_bounds = false
870882
};
871883
merlin =
872884
{ build_path = [];

src/kernel/mconfig.mli

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ type ocaml =
2424
parameters : string list;
2525
as_parameter : bool;
2626
as_argument_for : string option;
27-
zero_alloc_check : Zero_alloc_annotations.t;
28-
allow_illegal_crossing : bool
27+
zero_alloc_check : Zero_alloc_annotations.Check.t;
28+
zero_alloc_assert : Zero_alloc_annotations.Assert.t;
29+
infer_with_bounds : bool
2930
}
3031

3132
val dump_ocaml : ocaml -> json

0 commit comments

Comments
 (0)