Skip to content

Commit f372c4d

Browse files
refactor: improve type-stability of check_operator_variables
1 parent ad3a834 commit f372c4d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/utils.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -360,11 +360,11 @@ end
360360
Check if all the LHS are unique
361361
"""
362362
function check_operator_variables(eqs, op::T) where {T}
363-
ops = Set()
364-
tmp = Set()
363+
ops = Set{SymbolicT}()
364+
tmp = Set{SymbolicT}()
365365
for eq in eqs
366366
_check_operator_variables(eq, op)
367-
vars!(tmp, eq.lhs)
367+
SU.search_variables!(tmp, eq.lhs; is_atomic = OperatorIsAtomic{Differential}())
368368
if length(tmp) == 1
369369
x = only(tmp)
370370
if op === Differential
@@ -496,16 +496,16 @@ function collect_operator_variables(eq::Equation, args...)
496496
end
497497

498498
"""
499-
collect_operator_variables(eqs::AbstractVector{Equation}, op)
499+
collect_operator_variables(eqs::Vector{Equation}, ::Type{op}) where {op}
500500
501501
Return a `Set` containing all variables that have Operator `op` applied to them.
502502
See also [`collect_differential_variables`](@ref).
503503
"""
504-
function collect_operator_variables(eqs::AbstractVector{Equation}, op)
505-
vars = Set()
506-
diffvars = Set()
504+
function collect_operator_variables(eqs::Vector{Equation}, ::Type{op}) where {op}
505+
vars = Set{SymbolicT}()
506+
diffvars = Set{SymbolicT}()
507507
for eq in eqs
508-
vars!(vars, eq; op = op)
508+
SU.search_variables!(vars, eq; is_atomic = OperatorIsAtomic{op}())
509509
for v in vars
510510
isoperator(v, op) || continue
511511
push!(diffvars, arguments(v)[1])

0 commit comments

Comments
 (0)