Skip to content

incorrect hash for equal types, with Union instead of lower bound #53109

@vtjnash

Description

@vtjnash

Looks like what happened in #52997 pkgeval is during serialization of Parquet2 there were 2 distinct MethodInstance objects

getindex(WeakRefStrings.StringArray{Union{Base.Missing, 𝒯}, 1} where 𝒯, Int64)
getindex(WeakRefStrings.StringArray{𝒯, 1} where Base.Missing<:𝒯<:Any, Int64)

But during deserialization of it, these got merged into a single object.

Resulting from this bug in hash:

julia> A = Tuple{Int, Val{Union{Base.Missing, 𝒯}} where 𝒯, Int}
Tuple{Int64, Val{Union{Missing, 𝒯}} where 𝒯, Int64}

julia> B = Tuple{Int, Val{𝒯}, Int} where Missing<:𝒯<:Any
Tuple{Int64, Val{𝒯}, Int64} where 𝒯>:Missing

julia> hash(A)
0x77cfa1eef01bca90

julia> hash(B)
0x3e21480671c6d257

julia> A == B
true

Metadata

Metadata

Assignees

Labels

equalityIssues relating to equality relations: ==, ===, isequalhashingtypes and dispatchTypes, subtyping and method dispatch

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions