Skip to content

Commit 11b073e

Browse files
fix: default to ContinuousTimeseries for symbol not in SymbolCache
1 parent 6406219 commit 11b073e

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/symbol_cache.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,14 @@ function timeseries_parameter_index(sc::SymbolCache, sym)
130130
return get(sc.timeseries_parameters, sym, nothing)
131131
end
132132
end
133+
134+
for symT in [Any, Expr, AbstractArray]
135+
@eval function get_all_timeseries_indexes(
136+
::SymbolCache{Nothing, Nothing, Nothing}, ::$symT)
137+
Set([ContinuousTimeseries()])
138+
end
139+
end
140+
133141
function get_all_timeseries_indexes(sc::SymbolCache, sym)
134142
if is_variable(sc, sym) || is_independent_variable(sc, sym)
135143
return Set([ContinuousTimeseries()])

test/symbol_cache_test.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,8 @@ sc2 = copy(sc)
123123
@test sc.variables == sc2.variables
124124
@test sc.parameters == sc2.parameters
125125
@test sc.independent_variables == sc2.independent_variables
126+
127+
sc = SymbolCache()
128+
for sym in [1, :a, :(a + b), "foo", [:a, :b], [:(a + b), :c]]
129+
@test only(get_all_timeseries_indexes(sc, sym)) == ContinuousTimeseries()
130+
end

0 commit comments

Comments
 (0)