diff --git a/src/rewrite-helpers.jl b/src/rewrite-helpers.jl index 1502070cb..2afc6d4b0 100644 --- a/src/rewrite-helpers.jl +++ b/src/rewrite-helpers.jl @@ -54,8 +54,8 @@ hasnode(Symbolics.is_derivative, X + D(X) + D(X^2)) # returns `true`. function hasnode(r::Function, y::Union{Num, Symbolic}) _hasnode(r, y) end -hasnode(r::Num, y::Union{Num, Symbolic}) = hasnode(unwrap(r), unwrap(y)) -hasnode(r::Symbolic, y::Union{Num, Symbolic}) = hasnode(unwrap(r), unwrap(y)) +hasnode(r::Num, y::Union{Num, Symbolic}) = occursin(unwrap(r), unwrap(y)) +hasnode(r::Symbolic, y::Union{Num, Symbolic}) = occursin(unwrap(r), unwrap(y)) hasnode(r::Union{Num, Symbolic, Function}, y::Number) = false function _hasnode(r, y)