Skip to content

Commit 680d148

Browse files
committed
Hash equivalent numbers with different types differently
1 parent f2d7791 commit 680d148

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/types.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,9 @@ consing, allowing for more effective deduplication of symbolically equivalent ex
352352
with different metadata or symtypes.
353353
"""
354354
hash2(s, salt::UInt) = hash(s, salt)
355+
function hash2(n::T, salt::UInt) where {T <: Number}
356+
hash(T, hash(n, salt))
357+
end
355358
hash2(s::BasicSymbolic) = hash2(s, zero(UInt))
356359
function hash2(s::BasicSymbolic{T}, salt::UInt)::UInt where {T}
357360
E = exprtype(s)

0 commit comments

Comments
 (0)