From 11b073e74c64d771a5226af7f3a2429db86d89d3 Mon Sep 17 00:00:00 2001 From: Aayush Sabharwal Date: Thu, 4 Jul 2024 17:39:09 +0530 Subject: [PATCH 1/2] fix: default to `ContinuousTimeseries` for symbol not in `SymbolCache` --- src/symbol_cache.jl | 8 ++++++++ test/symbol_cache_test.jl | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/src/symbol_cache.jl b/src/symbol_cache.jl index 823783f..5451476 100644 --- a/src/symbol_cache.jl +++ b/src/symbol_cache.jl @@ -130,6 +130,14 @@ function timeseries_parameter_index(sc::SymbolCache, sym) return get(sc.timeseries_parameters, sym, nothing) end end + +for symT in [Any, Expr, AbstractArray] + @eval function get_all_timeseries_indexes( + ::SymbolCache{Nothing, Nothing, Nothing}, ::$symT) + Set([ContinuousTimeseries()]) + end +end + function get_all_timeseries_indexes(sc::SymbolCache, sym) if is_variable(sc, sym) || is_independent_variable(sc, sym) return Set([ContinuousTimeseries()]) diff --git a/test/symbol_cache_test.jl b/test/symbol_cache_test.jl index 23320c4..d4581bc 100644 --- a/test/symbol_cache_test.jl +++ b/test/symbol_cache_test.jl @@ -123,3 +123,8 @@ sc2 = copy(sc) @test sc.variables == sc2.variables @test sc.parameters == sc2.parameters @test sc.independent_variables == sc2.independent_variables + +sc = SymbolCache() +for sym in [1, :a, :(a + b), "foo", [:a, :b], [:(a + b), :c]] + @test only(get_all_timeseries_indexes(sc, sym)) == ContinuousTimeseries() +end From 6500eb0c1edb8dc24c620a67242278028ee71c86 Mon Sep 17 00:00:00 2001 From: Aayush Sabharwal Date: Thu, 4 Jul 2024 17:43:44 +0530 Subject: [PATCH 2/2] chore: bump version --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index c72864c..ba506e1 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "SymbolicIndexingInterface" uuid = "2efcf032-c050-4f8e-a9bb-153293bab1f5" authors = ["Aayush Sabharwal and contributors"] -version = "0.3.25" +version = "0.3.26" [deps] Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"