Skip to content

Commit 2a25b38

Browse files
committed
Respond to pr feedback
1 parent 37a2bc9 commit 2a25b38

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed

src/analysis/completion.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -591,9 +591,9 @@ let complete_prefix ?get_doc ?target_type ?(kinds = []) ~keywords ~prefix
591591
match (is_label : is_label) with
592592
| No -> []
593593
| Maybe ->
594-
Env.fold_labels Legacy add_label_description prefix_path env []
595-
@ Env.fold_labels Unboxed_product add_label_description prefix_path env
596-
[]
594+
Env.fold_all_labels
595+
{ fold_all_labels_f = (fun _ -> add_label_description) }
596+
prefix_path env []
597597
| Description lbls ->
598598
List.fold_right ~f:add_label_description lbls ~init:[]
599599
| Declaration (ty, decls) ->

src/analysis/env_lookup.ml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,8 @@ let by_longident (nss : Namespace.inferred list) ident env =
137137
raise (Found (path, Label, lbl.lbl_uid, loc))
138138
| `Labels ->
139139
log ~title:"lookup" "lookup in label namespace";
140-
let module Pack = struct
141-
(* This gadt is used to mint the existential type [rep] *)
142-
type t = P : 'rep Types.gen_label_description -> t
143-
end in
144-
let (P (type rep) (lbl : rep Types.gen_label_description)) : Pack.t
145-
=
140+
let (P (type rep) (lbl : rep Types.gen_label_description)) :
141+
Namespace.packed_label_description =
146142
(* Try looking up in boxed namespace, and then fallback to unboxed if that
147143
fails *)
148144
try P (Env.find_label_by_name Legacy ident env)

src/ocaml/typing/env.ml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4980,3 +4980,12 @@ let cleanup_usage_tables ~stamp =
49804980
Stamped_hashtable.backtrack used_constructors_changelog ~stamp;
49814981
Stamped_hashtable.backtrack used_labels_changelog ~stamp;
49824982
Stamped_hashtable.backtrack used_unboxed_labels_changelog ~stamp
4983+
4984+
type 'acc fold_all_labels_f =
4985+
{
4986+
fold_all_labels_f : 'rcd. 'rcd record_form -> 'rcd gen_label_description -> 'acc -> 'acc
4987+
}
4988+
4989+
let fold_all_labels f ident env init =
4990+
let acc_after_legacy = fold_labels Legacy (f.fold_all_labels_f Legacy) ident env init in
4991+
fold_labels Unboxed_product (f.fold_all_labels_f Unboxed_product) ident env acc_after_legacy

src/ocaml/typing/env.mli

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,3 +688,8 @@ val cleanup_usage_tables : stamp:int -> unit
688688
(** This value should be filled in with [Msupport.raise_error]. [Env] cannot use this
689689
function directly because [Msupport] depends on [Env] *)
690690
val msupport_raise_error : (?ignore_unify:bool -> exn -> unit) ref
691+
692+
type 'acc fold_all_labels_f = {
693+
fold_all_labels_f : 'rcd. 'rcd record_form -> 'rcd gen_label_description -> 'acc -> 'acc
694+
}
695+
val fold_all_labels: 'a fold_all_labels_f -> Longident.t option -> t -> 'a -> 'a

0 commit comments

Comments
 (0)