Skip to content

Commit 0689b54

Browse files
fix: fix usage of new get_variables in is_bound
1 parent f79523b commit 0689b54

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/inputoutput.jl

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ See also [`bound_inputs`](@ref), [`unbound_inputs`](@ref), [`bound_outputs`](@re
4949
"""
5050
unbound_outputs(sys) = filter(x -> !is_bound(sys, x), outputs(sys))
5151

52+
function _is_atomic_inside_operator(ex::SymbolicT)
53+
SU.default_is_atomic(ex) && Moshi.Match.@match ex begin
54+
BSImpl.Term(; f) && if f isa Operator end => false
55+
_ => true
56+
end
57+
end
58+
5259
"""
5360
is_bound(sys, u)
5461
@@ -75,8 +82,11 @@ function is_bound(sys, u, stack = [])
7582
eqs = equations(sys)
7683
eqs = filter(eq -> has_var(eq, u), eqs) # Only look at equations that contain u
7784
# isout = isoutput(u)
85+
vars = Set{SymbolicT}()
7886
for eq in eqs
79-
vars = [get_variables(eq.rhs); get_variables(eq.lhs)]
87+
empty!(vars)
88+
get_variables!(vars, eq.rhs; is_atomic = _is_atomic_inside_operator)
89+
get_variables!(vars, eq.lhs; is_atomic = _is_atomic_inside_operator)
8090
for var in vars
8191
var === u && continue
8292
if !same_or_inner_namespace(u, var)
@@ -88,7 +98,9 @@ function is_bound(sys, u, stack = [])
8898
oeqs = observed(sys)
8999
oeqs = filter(eq -> has_var(eq, u), oeqs) # Only look at equations that contain u
90100
for eq in oeqs
91-
vars = [get_variables(eq.rhs); get_variables(eq.lhs)]
101+
empty!(vars)
102+
get_variables!(vars, eq.rhs; is_atomic = _is_atomic_inside_operator)
103+
get_variables!(vars, eq.lhs; is_atomic = _is_atomic_inside_operator)
92104
for var in vars
93105
var === u && continue
94106
if !same_or_inner_namespace(u, var)

0 commit comments

Comments
 (0)