From 3af2514f827d9977f19460df023a7ff22b6c93b3 Mon Sep 17 00:00:00 2001 From: xvw Date: Mon, 15 Apr 2024 15:12:42 +0200 Subject: [PATCH] Add labeled argument for `Location_aux.included` --- src/analysis/destruct.ml | 2 +- src/ocaml/parsing/location_aux.ml | 2 +- src/ocaml/parsing/location_aux.mli | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/analysis/destruct.ml b/src/analysis/destruct.ml index 00b71ca33..1c8cefdf2 100644 --- a/src/analysis/destruct.ml +++ b/src/analysis/destruct.ml @@ -307,7 +307,7 @@ let rec get_every_pattern loc = function begin match List.find_some ~f:(fun param -> - Location_aux.included_in param.Typedtree.fp_loc loc + Location_aux.included ~into:param.Typedtree.fp_loc loc ) params with | Some pattern -> (* In parameter case *) diff --git a/src/ocaml/parsing/location_aux.ml b/src/ocaml/parsing/location_aux.ml index ef2e8adf2..5a9ec92d8 100644 --- a/src/ocaml/parsing/location_aux.ml +++ b/src/ocaml/parsing/location_aux.ml @@ -46,7 +46,7 @@ let compare_pos pos loc = else 0 -let included_in parent_loc child_loc = +let included ~into:parent_loc child_loc = Lexing.compare_pos child_loc.loc_start parent_loc.loc_start >= 0 && Lexing.compare_pos parent_loc.loc_end child_loc.loc_end >= 0 diff --git a/src/ocaml/parsing/location_aux.mli b/src/ocaml/parsing/location_aux.mli index c4866ec0b..d6164b2cd 100644 --- a/src/ocaml/parsing/location_aux.mli +++ b/src/ocaml/parsing/location_aux.mli @@ -42,9 +42,9 @@ val union : t -> t -> t (** Like location_union, but keep loc_ghost'ness of first argument *) val extend : t -> t -> t -(** [included_in parent child] returns [true] if [child] is included +(** [included ~into:parent child] returns [true] if [child] is included in [parent]. Otherwise returns [false]. *) -val included_in : t -> t -> bool +val included : into:t -> t -> bool (** Filter valid errors, log invalid ones *) val prepare_errors : exn list -> Location.error list