Skip to content

Commit ed9fa49

Browse files
committed
Tighten checks when normalizing codepositions
1 parent 7b03bcc commit ed9fa49

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/ecMatching.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ module Position = struct
311311

312312
(* Throws InvalidCPos if failing — allows [0, n] where n is "after last" *)
313313
let check_nm_cpos1 (nm: nm_codepos1) (s: stmt) : unit =
314-
if nm < 0 || nm > List.length s.s_node then raise InvalidCPos
314+
if nm < 0 || nm >= List.length s.s_node then raise InvalidCPos
315315

316316
(* Normalizes code position wrt stmt — input is 0-indexed *)
317317
let normalize_cp_base ?(check = true) (env: EcEnv.env) (cb: cp_base) (s: stmt) : nm_codepos1 =

0 commit comments

Comments
 (0)