Skip to content

Commit

Permalink
Fix issue with Binding_tree.add_all
Browse files Browse the repository at this point in the history
  • Loading branch information
MartyO256 committed Apr 15, 2023
1 parent 85abef6 commit 03b027a
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/syntax/common/binding_tree.ml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,19 @@ let add qualified_identifier entry ?(subtree = empty) tree =
add_nested namespaces identifier { entry; subtree } tree)

let add_all t1 t2 =
Identifier.Hamt.union (fun _identifier _e1 e2 -> Option.some e2) t1 t2
(*=
It may be more efficient to use the following:
{[
Identifier.Hamt.union (fun _identifier _e1 e2 -> Option.some e2) t1 t2
]}
However, there is a bug in [Identifier.Hamt.union]:
https://github.com/thizanne/ocaml-hamt/issues/41
*)
Identifier.Hamt.fold
(fun identifier entry accumulator ->
Identifier.Hamt.add identifier entry accumulator)
t2 t1

let remove identifier tree =
match Identifier.Hamt.find_opt identifier tree with
Expand Down

0 comments on commit 03b027a

Please sign in to comment.