Skip to content

Commit d931c69

Browse files
committed
fix: compat with older SymbolicUtils
1 parent 937e34d commit d931c69

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "DynamicExpressions"
22
uuid = "a40a106e-89c9-4ca8-8020-a735e8728b6b"
33
authors = ["MilesCranmer <miles.cranmer@gmail.com>"]
4-
version = "0.19.2"
4+
version = "0.19.3"
55

66
[deps]
77
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"

ext/DynamicExpressionsSymbolicUtilsExt.jl

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ import DynamicExpressions: AbstractExpression, get_tree, get_operators
1212
const SYMBOLIC_UTILS_TYPES = Union{<:Number,SymbolicUtils.Symbolic{<:Number}}
1313
const SUPPORTED_OPS = (cos, sin, exp, cot, tan, csc, sec, +, -, *, /)
1414

15+
@static if isdefined(SymbolicUtils, :iscall)
16+
iscall(x) = SymbolicUtils.iscall(x)
17+
else
18+
iscall(x) = SymbolicUtils.istree(x)
19+
end
20+
1521
macro return_on_false(flag, retval)
1622
:(
1723
if !$(esc(flag))
@@ -21,7 +27,7 @@ macro return_on_false(flag, retval)
2127
end
2228

2329
function is_valid(x::SymbolicUtils.Symbolic)
24-
return if SymbolicUtils.iscall(x)
30+
return if iscall(x)
2531
all(is_valid.([SymbolicUtils.operation(x); SymbolicUtils.arguments(x)]))
2632
else
2733
true
@@ -140,7 +146,7 @@ function Base.convert(
140146
variable_names::Union{Array{String,1},Nothing}=nothing,
141147
) where {N<:AbstractExpressionNode}
142148
variable_names = deprecate_varmap(variable_names, nothing, :convert)
143-
if !SymbolicUtils.iscall(expr)
149+
if !iscall(expr)
144150
variable_names === nothing && return constructorof(N)(String(expr.name))
145151
return constructorof(N)(String(expr.name), variable_names)
146152
end
@@ -234,7 +240,7 @@ function multiply_powers(eqn::Number)::Tuple{SYMBOLIC_UTILS_TYPES,Bool}
234240
end
235241

236242
function multiply_powers(eqn::SymbolicUtils.Symbolic)::Tuple{SYMBOLIC_UTILS_TYPES,Bool}
237-
if !SymbolicUtils.iscall(eqn)
243+
if !iscall(eqn)
238244
return eqn, true
239245
end
240246
op = SymbolicUtils.operation(eqn)

0 commit comments

Comments
 (0)