From 2e85409d259c4c93c03d0e6a793d7035a3432814 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Henry?= Date: Tue, 19 Feb 2019 16:27:22 +0100 Subject: [PATCH] Stdlib: better debug message in `List.Bounded.insert` --- src/lib_stdlib/tzList.ml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/lib_stdlib/tzList.ml b/src/lib_stdlib/tzList.ml index ff02ce687..725f7a7d1 100644 --- a/src/lib_stdlib/tzList.ml +++ b/src/lib_stdlib/tzList.ml @@ -126,8 +126,13 @@ end = struct if t.size < t.bound then begin t.size <- t.size + 1 ; t.data <- push x t.data - end else if E.compare (List.hd t.data) x < 0 then - t.data <- push x (List.tl t.data) + end else begin + match t.data with + | [] -> assert false + | hd :: tl -> + if E.compare hd x < 0 then + t.data <- push x tl + end let get { data ; _ } = data