julia icon indicating copy to clipboard operation
julia copied to clipboard

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

Open vtjnash opened this issue 1 year ago • 2 comments

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

vtjnash avatar Jan 29 '24 22:01 vtjnash

Jameson says that the assertion here might have to be uncommented since this case is not so bad and actually fixing this is very hard.

KristofferC avatar Apr 23 '24 15:04 KristofferC

Removing milestone due to https://github.com/JuliaLang/julia/pull/54408

KristofferC avatar May 08 '24 12:05 KristofferC