Skip to content

Commit 25e5cbf

Browse files
test: update cache tests to handle Const properly
1 parent 28842e6 commit 25e5cbf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

test/cache_macro.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using SymbolicUtils
22
using SymbolicUtils: BasicSymbolic, @cache, associated_cache, set_limit!, get_limit,
3-
clear_cache!, SymbolicKey, metadata, maketerm, get_cache_key
3+
clear_cache!, SymbolicKey, metadata, maketerm, get_cache_key,
4+
unwrap_const
45
using OhMyThreads: tmap
56
using Random
67

@@ -131,7 +132,7 @@ end
131132
end
132133

133134
@cache function f4(x::Union{BasicSymbolic, Number})::Union{BasicSymbolic, Number}
134-
x isa Number && return x
135+
unwrap_const(x) isa Number && return x
135136
if iscall(x)
136137
return maketerm(typeof(x), operation(x), map(f4, arguments(x)), metadata(x))
137138
end

0 commit comments

Comments
 (0)