File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -830,7 +830,13 @@ Base.nameof(s::BasicSymbolic) = issym(s) ? s.name : error("Non-Sym BasicSymbolic
830830const ENABLE_HASHCONSING = Ref (true )
831831const AllBasicSymbolics = Union{BasicSymbolic{SymReal}, BasicSymbolic{SafeReal}, BasicSymbolic{TreeReal}}
832832const WCS_LOCK = ReentrantLock ()
833- const WCS = WeakCacheSet {AllBasicSymbolics} ()
833+ const WCS_SYMREAL = WeakCacheSet {BasicSymbolic{SymReal}} ()
834+ const WCS_SAFEREAL = WeakCacheSet {BasicSymbolic{SafeReal}} ()
835+ const WCS_TREEREAL = WeakCacheSet {BasicSymbolic{TreeReal}} ()
836+
837+ @inline wcs_for_vartype (:: Type{SymReal} ) = WCS_SYMREAL
838+ @inline wcs_for_vartype (:: Type{SafeReal} ) = WCS_SAFEREAL
839+ @inline wcs_for_vartype (:: Type{TreeReal} ) = WCS_TREEREAL
834840
835841function generate_id ()
836842 IDType ()
@@ -858,12 +864,12 @@ Custom functions `hash2` and `isequal_with_metadata` are used instead of `Base.h
858864original behavior of those functions.
859865"""
860866
861- function hashcons (s:: BSImpl.Type )
867+ function hashcons (s:: BSImpl.Type{T} ) where {T}
862868 if ! ENABLE_HASHCONSING[]
863869 return s
864870 end
865871 @manually_scope COMPARE_FULL => true begin
866- k = (@lock WCS_LOCK getkey! (WCS , s)):: typeof (s)
872+ k = (@lock WCS_LOCK getkey! (wcs_for_vartype (T) , s)):: typeof (s)
867873 if k. id === nothing
868874 k. id = generate_id ()
869875 end
You can’t perform that action at this time.
0 commit comments