Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[0.14] Use raise_without_backtrace in Map, Set #132

Open
wants to merge 1 commit into
base: v0.14
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/map.ml
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ module Tree0 = struct
match t with
| Empty ->
(match f None with
| None -> raise Change_no_op (* equivalent to returning: Empty *)
| None -> Exn.raise_without_backtrace Change_no_op (* equivalent to returning: Empty *)
| Some data -> Leaf (key, data), length + 1)
| Leaf (v, d) ->
let c = compare_key key v in
Expand Down
12 changes: 6 additions & 6 deletions src/set.ml
Original file line number Diff line number Diff line change
Expand Up @@ -252,13 +252,13 @@ module Tree0 = struct
| Leaf v ->
let c = compare_elt x v in
if c = 0
then raise Same
then Exn.raise_without_backtrace Same
else if c < 0
then bal (Leaf x) v Empty
else bal Empty v (Leaf x)
| Node (l, v, r, _, _) ->
let c = compare_elt x v in
if c = 0 then raise Same else if c < 0 then bal (aux l) v r else bal l v (aux r)
if c = 0 then Exn.raise_without_backtrace Same else if c < 0 then bal (aux l) v r else bal l v (aux r)
in
try aux t with
| Same -> t
Expand Down Expand Up @@ -421,8 +421,8 @@ module Tree0 = struct
let remove t x ~compare_elt =
let rec aux t =
match t with
| Empty -> raise Same
| Leaf v -> if compare_elt x v = 0 then Empty else raise Same
| Empty -> Exn.raise_without_backtrace Same
| Leaf v -> if compare_elt x v = 0 then Empty else Exn.raise_without_backtrace Same
| Node (l, v, r, _, _) ->
let c = compare_elt x v in
if c = 0 then merge l r else if c < 0 then bal (aux l) v r else bal l v (aux r)
Expand All @@ -434,8 +434,8 @@ module Tree0 = struct
let remove_index t i ~compare_elt:_ =
let rec aux t i =
match t with
| Empty -> raise Same
| Leaf _ -> if i = 0 then Empty else raise Same
| Empty -> Exn.raise_without_backtrace Same
| Leaf _ -> if i = 0 then Empty else Exn.raise_without_backtrace Same
| Node (l, v, r, _, _) ->
let l_size = length l in
let c = Poly.compare i l_size in
Expand Down