From a10f59354dfa3845ef1b28dc47442417e9ffab07 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Bobot?= <francois.bobot@cea.fr>
Date: Fri, 6 Sep 2024 21:18:12 +0000
Subject: [PATCH] [QED/listmap] Fix change function

---
 src/libraries/qed/listmap.ml | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/libraries/qed/listmap.ml b/src/libraries/qed/listmap.ml
index 0bdaa8c4178..fd25962e316 100644
--- a/src/libraries/qed/listmap.ml
+++ b/src/libraries/qed/listmap.ml
@@ -95,7 +95,10 @@ struct
       | [] -> (match f k v None with None -> l | Some w -> l @ [k,w])
       | ((k',v') as a)::next->
         let c = K.compare k k' in
-        if c < 0 then l
+        if c < 0 then
+          match f k v None with
+          | None -> l
+          | Some w -> append_until a l ((k, w) :: next)
         else if c = 0 then
           match f k v (Some v') with
           | None -> append_until a l next
-- 
GitLab