Skip to content

Commit

Permalink
fixup! fix: fix stack overflow for methods using symbolic_container
Browse files Browse the repository at this point in the history
… to define a fallback
  • Loading branch information
AayushSabharwal committed Jul 24, 2024
1 parent e4a89f0 commit 40daf4e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/index_provider_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ parameter_index(indp, sym) = parameter_index(symbolic_container(indp), sym)
Check whether the given `sym` is a timeseries parameter in `indp`.
"""
function is_timeseries_parameter(indp, sym)
if hasmethod(symbolic_container, Tuple{typeof(indp)}) && (sc = symbolic_container(indp)) !== indp
if hasmethod(symbolic_container, Tuple{typeof(indp)}) && (sc = symbolic_container(indp)) != indp
is_timeseries_parameter(sc, sym)
else
return false
Expand Down Expand Up @@ -91,7 +91,7 @@ parameter in `indp`. Defaults to returning `nothing`. Respects the
[`symbolic_container`](@ref) fallback for `indp` if present.
"""
function timeseries_parameter_index(indp, sym)
if hasmethod(symbolic_container, Tuple{typeof(indp)}) && (sc = symbolic_container(indp)) !== indp
if hasmethod(symbolic_container, Tuple{typeof(indp)}) && (sc = symbolic_container(indp)) != indp
timeseries_parameter_index(symbolic_container(indp), sym)
else
return nothing
Expand All @@ -111,7 +111,7 @@ By default, this function returns `nothing`, indicating that the index provider
support generating parameter observed functions.
"""
function parameter_observed(indp, sym)
if hasmethod(symbolic_container, Tuple{typeof(indp)}) && (sc = symbolic_container(indp)) !== indp
if hasmethod(symbolic_container, Tuple{typeof(indp)}) && (sc = symbolic_container(indp)) != indp
return parameter_observed(symbolic_container(indp), sym)
else
return nothing
Expand Down Expand Up @@ -143,7 +143,7 @@ variable.
By default, this function returns `Set([ContinuousTimeseries()])`.
"""
function get_all_timeseries_indexes(indp, sym)
if hasmethod(symbolic_container, Tuple{typeof(indp)}) && (sc = symbolic_container(indp)) !== indp
if hasmethod(symbolic_container, Tuple{typeof(indp)}) && (sc = symbolic_container(indp)) != indp
return get_all_timeseries_indexes(symbolic_container(indp), sym)
else
return Set([ContinuousTimeseries()])
Expand Down Expand Up @@ -240,7 +240,7 @@ Return a dictionary mapping symbols in the index provider to their default value
This includes parameter symbols. The dictionary must be mutable.
"""
function default_values(indp)
if hasmethod(symbolic_container, Tuple{typeof(indp)}) && (sc = symbolic_container(indp)) !== indp
if hasmethod(symbolic_container, Tuple{typeof(indp)}) && (sc = symbolic_container(indp)) != indp
default_values(symbolic_container(indp))
else
Dict()
Expand Down

0 comments on commit 40daf4e

Please sign in to comment.