Skip to content

Commit 9d625d8

Browse files
refactor: fix inference of get_cache_key
1 parent e09d5b4 commit 9d625d8

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/cache.jl

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,20 @@ The key stored in the cache for a particular value. Returns a `SymbolicKey` for
2626
"""
2727
# can't dispatch because `BasicSymbolic` isn't defined here
2828
function get_cache_key(x)
29-
if x isa BasicSymbolic
29+
@nospecialize x
30+
if x isa BasicSymbolic{SymReal}
31+
id = x.id
32+
if id === nothing
33+
return CacheSentinel()
34+
end
35+
return SymbolicKey(id)
36+
elseif x isa BasicSymbolic{SafeReal}
37+
id = x.id
38+
if id === nothing
39+
return CacheSentinel()
40+
end
41+
return SymbolicKey(id)
42+
elseif x isa BasicSymbolic{SafeReal}
3043
id = x.id
3144
if id === nothing
3245
return CacheSentinel()

0 commit comments

Comments
 (0)