From 4be992496007e5e84676ea1ecaa0e0315789b228 Mon Sep 17 00:00:00 2001 From: "Bowen S. Zhu" Date: Wed, 16 Oct 2024 15:06:14 -0400 Subject: [PATCH] Incorporate symtype in `hash` for `Sym` --- src/types.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/types.jl b/src/types.jl index 711b14e5..b1c2ce2c 100644 --- a/src/types.jl +++ b/src/types.jl @@ -279,10 +279,10 @@ const ADD_SALT = 0xaddaddaddaddadda % UInt const SUB_SALT = 0xaaaaaaaaaaaaaaaa % UInt const DIV_SALT = 0x334b218e73bbba53 % UInt const POW_SALT = 0x2b55b97a6efb080c % UInt -function Base.hash(s::BasicSymbolic, salt::UInt)::UInt +function Base.hash(s::BasicSymbolic{T}, salt::UInt)::UInt where {T} E = exprtype(s) if E === SYM - hash(nameof(s), salt ⊻ SYM_SALT) + hash(T, hash(nameof(s), salt ⊻ SYM_SALT)) elseif E === ADD || E === MUL !iszero(salt) && return hash(hash(s, zero(UInt)), salt) h = s.hash[]