Skip to content

Commit 463e750

Browse files
fixup! fix: fix stack overflow for methods using symbolic_container to define a fallback
1 parent d121b0d commit 463e750

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/index_provider_interface.jl

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ parameter_index(indp, sym) = parameter_index(symbolic_container(indp), sym)
6464
Check whether the given `sym` is a timeseries parameter in `indp`.
6565
"""
6666
function is_timeseries_parameter(indp, sym)
67-
if hasmethod(symbolic_container, Tuple{typeof(indp)}) && (sc = symbolic_container(indp)) != indp
67+
if hasmethod(symbolic_container, Tuple{typeof(indp)}) &&
68+
(sc = symbolic_container(indp)) != indp
6869
is_timeseries_parameter(sc, sym)
6970
else
7071
return false
@@ -96,7 +97,8 @@ parameter in `indp`. Defaults to returning `nothing`. Respects the
9697
[`symbolic_container`](@ref) fallback for `indp` if present.
9798
"""
9899
function timeseries_parameter_index(indp, sym)
99-
if hasmethod(symbolic_container, Tuple{typeof(indp)}) && (sc = symbolic_container(indp)) != indp
100+
if hasmethod(symbolic_container, Tuple{typeof(indp)}) &&
101+
(sc = symbolic_container(indp)) != indp
100102
timeseries_parameter_index(symbolic_container(indp), sym)
101103
else
102104
return nothing
@@ -116,7 +118,8 @@ By default, this function returns `nothing`, indicating that the index provider
116118
support generating parameter observed functions.
117119
"""
118120
function parameter_observed(indp, sym)
119-
if hasmethod(symbolic_container, Tuple{typeof(indp)}) && (sc = symbolic_container(indp)) != indp
121+
if hasmethod(symbolic_container, Tuple{typeof(indp)}) &&
122+
(sc = symbolic_container(indp)) != indp
120123
return parameter_observed(symbolic_container(indp), sym)
121124
else
122125
return nothing
@@ -148,7 +151,8 @@ variable.
148151
By default, this function returns `Set([ContinuousTimeseries()])`.
149152
"""
150153
function get_all_timeseries_indexes(indp, sym)
151-
if hasmethod(symbolic_container, Tuple{typeof(indp)}) && (sc = symbolic_container(indp)) != indp
154+
if hasmethod(symbolic_container, Tuple{typeof(indp)}) &&
155+
(sc = symbolic_container(indp)) != indp
152156
return get_all_timeseries_indexes(symbolic_container(indp), sym)
153157
else
154158
return Set([ContinuousTimeseries()])
@@ -245,7 +249,8 @@ Return a dictionary mapping symbols in the index provider to their default value
245249
This includes parameter symbols. The dictionary must be mutable.
246250
"""
247251
function default_values(indp)
248-
if hasmethod(symbolic_container, Tuple{typeof(indp)}) && (sc = symbolic_container(indp)) != indp
252+
if hasmethod(symbolic_container, Tuple{typeof(indp)}) &&
253+
(sc = symbolic_container(indp)) != indp
249254
default_values(symbolic_container(indp))
250255
else
251256
Dict()

0 commit comments

Comments
 (0)