Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Define a method for
hash(::Type, ::UInt)
(JuliaLang#49636)
Currently, `hash(::Type, ::UInt)` uses `objectid`, which can have some odd behavior for types: in particular, subsequent identical type-valued variable definitions can have `objectid`s which differ from the first such definition. This has some bizarre downstream effects when e.g. using types as the values of a `Set` or the keys of a `Dict`. See issue 49620 for examples. There is an internal `type_hash` C function used for caching types but isn't exposed to Julia, as Jameson pointed out in the linked issue. This commit exposes it as `jl_type_hash` which is then used via `ccall` to define a method `hash(::Type, ::UInt)`. This method then fixes JuliaLang#49620. Note, however, that this does not affect the differing `objectid`s for otherwise identical types.
- Loading branch information