Skip to content

Commit 77688cb

Browse files
authored
Merge 5.2.0minus-19 (#185)
* Import ocaml sources for oxcaml/oxcaml@951524cd4f4e * Automatic merges * Add typing/mode_hint.mli * Commit conflicts * Resolve easy conflicts * Fix some type errors * Changes for new shapes * Fixup errors in lexer * Fix typing errors * Fixup syntax_doc * Bump magic numbers * Fix tests * Add ignored flags * Import ocaml sources for oxcaml/oxcaml@c2a3ea6fbd0b * Automatic merges * Disable warning 47 * Use MB.of_int
1 parent 56dbf4e commit 77688cb

File tree

163 files changed

+31320
-24523
lines changed

Some content is hidden

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

163 files changed

+31320
-24523
lines changed

src/analysis/construct.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ module Gen = struct
521521
val_loc = Location.none;
522522
val_attributes = [];
523523
val_zero_alloc = Zero_alloc.default;
524-
val_modalities = Mode.Modality.Value.id;
524+
val_modalities = Mode.Modality.id;
525525
val_uid = Uid.mk ~current_unit:(Env.get_unit_name ())
526526
}
527527
in

src/analysis/index_occurrences.ml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ let iterator ~current_buffer_path ~index ~stamp ~reduce_for_uid =
9191

9292
let items ~index ~stamp (config : Mconfig.t) items =
9393
let module Shape_reduce = Shape_reduce.Make (struct
94-
let fuel = 10
94+
let fuel () = Misc_stdlib.Maybe_bounded.of_int 10
9595

96-
let read_unit_shape ~unit_name =
96+
let read_unit_shape ~diagnostics:_ ~unit_name =
9797
log ~title:"read_unit_shape" "inspecting %s" unit_name;
9898
let read unit_name =
9999
let cms = Format.sprintf "%s.cms" unit_name in
@@ -112,6 +112,12 @@ let items ~index ~stamp (config : Mconfig.t) items =
112112
| None ->
113113
log ~title:"read_unit_shape" "failed to find %s" unit_name;
114114
None
115+
116+
let projection_rules_for_merlin_enabled = true
117+
let fuel_for_compilation_units () : Misc_stdlib.Maybe_bounded.t = Unbounded
118+
let max_shape_reduce_steps_per_variable () : Misc_stdlib.Maybe_bounded.t =
119+
Unbounded
120+
let max_compilation_unit_depth () : Misc_stdlib.Maybe_bounded.t = Unbounded
115121
end) in
116122
let current_buffer_path =
117123
Filename.concat config.query.directory config.query.filename

src/analysis/locate.ml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -880,8 +880,8 @@ let get_linked_uids ~config ~comp_unit decl_uid =
880880
let find_definition_uid ~config ~env ~(decl : Env_lookup.item) path =
881881
let namespace = decl.namespace in
882882
let module Reduce = Shape_reduce.Make (struct
883-
let fuel = 10
884-
let read_unit_shape ~unit_name =
883+
let fuel () = Misc_stdlib.Maybe_bounded.of_int 10
884+
let read_unit_shape ~diagnostics:_ ~unit_name =
885885
log ~title:"read_unit_shape" "inspecting %s" unit_name;
886886
match
887887
load_cmt
@@ -895,6 +895,12 @@ let find_definition_uid ~config ~env ~(decl : Env_lookup.item) path =
895895
| Error () ->
896896
log ~title:"read_unit_shape" "failed to find %s" unit_name;
897897
None
898+
899+
let projection_rules_for_merlin_enabled = true
900+
let fuel_for_compilation_units () : Misc_stdlib.Maybe_bounded.t = Unbounded
901+
let max_shape_reduce_steps_per_variable () : Misc_stdlib.Maybe_bounded.t =
902+
Unbounded
903+
let max_compilation_unit_depth () : Misc_stdlib.Maybe_bounded.t = Unbounded
898904
end) in
899905
let shape = Env.shape_of_path ~namespace env path in
900906
log ~title:"shape_of_path" "initial: %a" Logger.fmt

src/analysis/ptyp_of_type.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ and value_description id
163163
{ val_type; val_kind = _; val_loc; val_attributes; val_modalities; _ } =
164164
let type_ = core_type val_type in
165165
let snap = Btype.snapshot () in
166-
let modalities = Mode.Modality.Value.zap_to_id val_modalities in
166+
let modalities = Mode.Modality.zap_to_id val_modalities in
167167
Btype.backtrack snap;
168168
{ Parsetree.pval_name = var_of_id id;
169169
pval_type = type_;

src/analysis/stack_or_heap_enclosing.ml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ let from_nodes ~lsp_compat ~pos ~path =
4343
value binding. However, the LSP hover at this point will describe just the
4444
pattern, so we don't override the location in the [lsp_compat] regime. *)
4545
let loc = if lsp_compat then None else Some vb_loc in
46-
ret ?loc (Alloc_mode alloc_mode.mode)
46+
ret ?loc (Alloc_mode alloc_mode)
4747
| Expression { exp_desc; _ }, _ -> (
4848
match exp_desc with
4949
| Texp_function { alloc_mode; body; _ } -> (
@@ -76,8 +76,8 @@ let from_nodes ~lsp_compat ~pos ~path =
7676
in
7777
match body_loc with
7878
| Some loc when cursor_is_inside loc -> None
79-
| _ -> ret (Alloc_mode alloc_mode.mode))
80-
| Texp_array (_, _, _, alloc_mode) -> ret (Alloc_mode alloc_mode.mode)
79+
| _ -> ret (Alloc_mode alloc_mode))
80+
| Texp_array (_, _, _, alloc_mode) -> ret (Alloc_mode alloc_mode)
8181
| Texp_construct
8282
({ loc; txt = _lident }, { cstr_repr; _ }, args, maybe_alloc_mode)
8383
-> (
@@ -89,7 +89,7 @@ let from_nodes ~lsp_compat ~pos ~path =
8989
if lsp_compat && cursor_is_inside loc then Some loc else None
9090
in
9191
match maybe_alloc_mode with
92-
| Some alloc_mode -> ret ?loc (Alloc_mode alloc_mode.mode)
92+
| Some alloc_mode -> ret ?loc (Alloc_mode alloc_mode)
9393
| None -> (
9494
match args with
9595
| [] -> ret_no_alloc ?loc "constructor without arguments"
@@ -102,18 +102,18 @@ let from_nodes ~lsp_compat ~pos ~path =
102102
| Texp_record { representation; alloc_mode = maybe_alloc_mode; _ } -> (
103103
match (maybe_alloc_mode, representation) with
104104
| _, Record_inlined _ -> None
105-
| Some alloc_mode, _ -> ret_alloc alloc_mode.mode
105+
| Some alloc_mode, _ -> ret_alloc alloc_mode
106106
| None, Record_unboxed -> ret_no_alloc "unboxed record"
107107
| None, (Record_boxed _ | Record_float | Record_ufloat | Record_mixed _)
108108
-> ret Unexpected_no_alloc)
109109
| Texp_field (_, _, _, _, boxed_or_unboxed, _) -> (
110110
match boxed_or_unboxed with
111-
| Boxing (alloc_mode, _) -> ret_alloc alloc_mode.mode
111+
| Boxing (alloc_mode, _) -> ret_alloc alloc_mode
112112
| Non_boxing _ -> None)
113113
| Texp_variant (_, maybe_exp_and_alloc_mode) ->
114114
maybe_exp_and_alloc_mode
115115
|> Option.map ~f:(fun (_, (alloc_mode : Typedtree.alloc_mode)) ->
116-
alloc_mode.mode)
116+
alloc_mode)
117117
|> ret_maybe_alloc "variant without argument"
118118
| _ -> None)
119119
| _ -> None

src/analysis/syntax_doc.ml

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ let get_mod_bound_doc mod_bound =
143143
| Everything
144144
end in
145145
let* parsed =
146-
match Typemode.Axis_pair.of_string mod_bound with
146+
match Typemode.Modifier_axis_pair.of_string mod_bound with
147147
| exception Not_found -> (
148148
match mod_bound with
149149
| "everything" -> Some Everything
@@ -200,24 +200,17 @@ let get_mod_bound_doc mod_bound =
200200
}
201201
: syntax_info)
202202

203-
module Modal_axis_pair = struct
204-
type t = P : 'a Mode.Value.Axis.t * 'a -> t
205-
206-
let of_string s =
207-
match Typemode.Axis_pair.of_string s with
208-
| exception Not_found -> None
209-
| P (Modal axis, mode) -> Some (P (axis, mode))
210-
| P (Nonmodal _, _) -> None
211-
end
212-
213203
let get_mode_doc mode =
214204
let open Option.Infix in
215-
let* (P (axis, mode)) = Modal_axis_pair.of_string mode in
205+
let* (P (axis, mode)) =
206+
match Typemode.Mode_axis_pair.of_string mode with
207+
| exception Not_found -> None
208+
| res -> Some res
209+
in
216210
let* description =
217211
match (axis, mode) with
218212
| Comonadic Areality, Local ->
219213
Some "Values with this mode cannot escape the current region"
220-
| Comonadic Areality, Regional -> None
221214
| Comonadic Areality, Global ->
222215
Some "Values with this mode can escape any region"
223216
| Monadic Contention, Contended ->
@@ -287,7 +280,11 @@ let get_mode_doc mode =
287280

288281
let get_modality_doc modality =
289282
let open Option.Infix in
290-
let* (P (axis, _)) = Modal_axis_pair.of_string modality in
283+
let* (P (axis, _)) =
284+
match Typemode.Modality_axis_pair.of_string modality with
285+
| exception Not_found -> None
286+
| res -> Some res
287+
in
291288
let description =
292289
(* CR-someday: Detect the context that the modality is within to make this message
293290
more detailed. Ex: "This field is always stronger than _, even if the record has a

src/kernel/mconfig.ml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,9 @@ let ocaml_ignored_flags =
630630
"-cfg-prologue-validate";
631631
"-no-cfg-prologue-validate";
632632
"-cfg-prologue-shrink-wrap";
633-
"-no-cfg-prologue-shrink-wrap"
633+
"-no-cfg-prologue-shrink-wrap";
634+
"-gdwarf-pedantic";
635+
"-ddwarf-metrics"
634636
]
635637

636638
let ocaml_ignored_parametrized_flags =
@@ -710,7 +712,16 @@ let ocaml_ignored_parametrized_flags =
710712
"-shape-format";
711713
"-gdwarf-compression";
712714
"-gdwarf-fission";
713-
"-cfg-prologue-shrink-wrap-threshold"
715+
"-cfg-prologue-shrink-wrap-threshold";
716+
"-gdwarf-config-shape-reduce-depth";
717+
"-gdwarf-config-shape-eval-depth";
718+
"-gdwarf-config-max-cms-files-per-unit";
719+
"-gdwarf-config-max-cms-files-per-variable";
720+
"-gdwarf-config-max-type-to-shape-depth";
721+
"-gdwarf-config-max-shape-reduce-steps-per-variable";
722+
"-gdwarf-config-max-evaluation-steps-per-variable";
723+
"-gdwarf-config-shape-reduce-fuel";
724+
"-gdwarf-fidelity"
714725
]
715726

716727
let ocaml_warnings_spec ~error =

src/kernel/mtyper.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ type typedtree_items =
4040
| Interface_items of
4141
{ items : (Parsetree.signature_item, Typedtree.signature_item) item list;
4242
psig_modalities : Parsetree.modalities;
43-
sig_modalities : Mode.Modality.Value.Const.t;
43+
sig_modalities : Mode.Modality.Const.t;
4444
sig_sloc : Location.t
4545
}
4646
| Implementation_items of

src/ocaml-index/lib/index.ml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ module Reduce_conf (Loaded_shapes : sig
5050
val shapes : (Compilation_unit.t, Shape.t) Hashtbl.t
5151
end) =
5252
struct
53-
let fuel = 10
53+
let fuel () = Misc_stdlib.Maybe_bounded.of_int 10
5454

5555
let try_load ~unit_name () =
5656
match
@@ -83,9 +83,15 @@ struct
8383
| Some artifact -> Merlin_analysis.Locate.Artifact.impl_shape artifact
8484
end
8585

86-
let read_unit_shape ~unit_name =
86+
let read_unit_shape ~diagnostics:_ ~unit_name =
8787
Log.debug "Read unit shape: %s\n%!" unit_name;
8888
try_load ~unit_name ()
89+
90+
let projection_rules_for_merlin_enabled = true
91+
let fuel_for_compilation_units () : Misc_stdlib.Maybe_bounded.t = Unbounded
92+
let max_shape_reduce_steps_per_variable () : Misc_stdlib.Maybe_bounded.t =
93+
Unbounded
94+
let max_compilation_unit_depth () : Misc_stdlib.Maybe_bounded.t = Unbounded
8995
end
9096

9197
let init_load_path_once ~do_not_use_cmt_loadpath =

src/ocaml/parsing/ast_mapper.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ module C = struct
102102
| Pconst_integer _
103103
| Pconst_unboxed_integer _
104104
| Pconst_char _
105+
| Pconst_untagged_char _
105106
| Pconst_float _
106107
| Pconst_unboxed_float _
107108
-> c

0 commit comments

Comments
 (0)