-
Notifications
You must be signed in to change notification settings - Fork 0
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
Some keys cannot be found after union
#41
Comments
Thanks for the nice, detailed and reproducible report! Unfortunately there is very few (people.time) allocated to working on hamt at the time, so I'm not sure when we'll be able to fix it. I've been looking briefly at the code but wasn't able to find the obvious mistake. If someone wants to reproduce and propose a patch (that I'll happily accept): all four items on the |
Expected Behavior
If HAMT
m
is built by taking the union of two HAMTsm1
andm2
, then we should be able to find a binding inm
for each key inm1
andm2
.For instance, the following two functions should be equivalent:
Current Behavior
Some entries cannot be found using
Hamt.String.find_opt
orHamt.String.mem
when we useadd_all_by_union
.The bindings are correctly present when using
Hamt.String.bindings
.This suggests that HAMTs obtained using
union
are not necessarily built in the wayfind_opt
expects.Steps to Reproduce
In the following example, we're building the HAMT with bindings
[("tp", ()); ("suc", ()); ("something", ()); ("expCtx", ())]
as the union of the HAMTs with bindings[("tp", ()); ("suc", ())]
and[("something", ()); ("expCtx", ())]
respectively.While
Hamt.String.bindings hamt = [("something", ()); ("suc", ()); ("tp", ()); ("expCtx", ())]
does contain all the bindings, none of the keys can be found withHamt.String.mem
.This prints out:
Environment
OCaml 4.14.1
Hamt revision 2d5e536
The text was updated successfully, but these errors were encountered: