Open xitology opened 1 month ago
HAMT does not work correctly with keys of type Symbol. Here's a test case:
Symbol
julia> VERSION v"1.10.3" (@v1.10) pkg> st HashArrayMappedTries Status `~/.julia/environments/v1.10/Project.toml` [076d061b] HashArrayMappedTries v0.2.0 julia> using HashArrayMappedTries julia> hamt = HAMT{Symbol, Nothing}(); julia> for sym in [:a, :b, :c, :d, :e, :f]; hamt = insert(hamt, sym, nothing); end julia> hamt[:a] ERROR: KeyError: key :a not found Stacktrace: [1] getindex(trie::HAMT{Symbol, Nothing}, key::Symbol) @ HashArrayMappedTries ~/.julia/packages/HashArrayMappedTries/CozZ8/src/HashArrayMappedTries.jl:182 [2] top-level scope @ REPL[6]:1
This seems to be caused by the code assuming hash(key) == hash(key, UInt(0)), which is not true for Symbols.
hash(key) == hash(key, UInt(0))
I think I fixed this upstream in https://github.com/JuliaLang/julia/commit/9ea29d9b8f41509ea2609ce012cea69dfc4285e8
If you have time I would appreciate a PR that does the same here.
HAMT does not work correctly with keys of type
Symbol
. Here's a test case:This seems to be caused by the code assuming
hash(key) == hash(key, UInt(0))
, which is not true for Symbols.