mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 19:25:28 -05:00
Assert emptiness on both maps instead of raising custom exception.
https://github.com/c-cube/ocaml-containers/pull/211\#pullrequestreview-107483136
This commit is contained in:
parent
712b12d2f1
commit
89ce86eec0
1 changed files with 4 additions and 3 deletions
|
|
@ -45,9 +45,10 @@ module Make(L : OrderedType)(R : OrderedType) = struct
|
||||||
right = MapR.empty;
|
right = MapR.empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
let is_empty m = match MapL.is_empty m.left, MapR.is_empty m.right with
|
let is_empty m =
|
||||||
| l, r when l = r -> l
|
let res = MapL.is_empty m.left in
|
||||||
| l, r -> raise (Incoherence ("is_empty left: " ^ string_of_bool l ^ ", right: " ^ string_of_bool r))
|
assert (res = MapR.is_empty m.right);
|
||||||
|
res
|
||||||
|
|
||||||
let add a b m = {
|
let add a b m = {
|
||||||
left =
|
left =
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue