Skip to content

Commit c51a60e

Browse files
SebastianM-Cclaude
andcommitted
fix: only examine RHS in equation_dependencies
Symbolics@5fe7a2d6 added a `search_variables!` method for `Equation` that searches both LHS and RHS. This broke `equation_dependencies` which relies on finding only RHS dependencies. The original MTK behavior (from 2020, commit 3160770) explicitly only examined `eq.rhs`. This fix restores that behavior by passing `eq.rhs` directly instead of relying on the generic `Equation` method. Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 7120de8 commit c51a60e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/ModelingToolkitBase/src/systems/dependency_graphs.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ function equation_dependencies(
4444
depeqs_to_vars = Vector{Vector}(undef, length(eqs))
4545

4646
for (i, eq) in enumerate(eqs)
47-
get_variables!(deps, eq, variables)
47+
# For Equations, only examine RHS (dependencies, not what's modified).
48+
# For jumps, use the whole object (specialized search_variables! handles it).
49+
target = eq isa Equation ? eq.rhs : eq
50+
get_variables!(deps, target, variables)
4851
depeqs_to_vars[i] = [value(v) for v in deps]
4952
empty!(deps)
5053
end

0 commit comments

Comments
 (0)