-
Notifications
You must be signed in to change notification settings - Fork 124
Description
The current implementation of Base.isequal
for BasicSymbolic
objects doesn't take into account potential metadata differences. This can lead to situations where two symbolically equivalent expressions with different metadata are considered equal, which might not be the desired behavior.
Lines 241 to 266 in f9b0ade
function Base.isequal(a::BasicSymbolic{T}, b::BasicSymbolic{S}) where {T,S} | |
a === b && return true | |
E = exprtype(a) | |
E === exprtype(b) || return false | |
T === S || return false | |
return _isequal(a, b, E)::Bool | |
end | |
function _isequal(a, b, E) | |
if E === SYM | |
nameof(a) === nameof(b) | |
elseif E === ADD || E === MUL | |
coeff_isequal(a.coeff, b.coeff) && isequal(a.dict, b.dict) | |
elseif E === DIV | |
isequal(a.num, b.num) && isequal(a.den, b.den) | |
elseif E === POW | |
isequal(a.exp, b.exp) && isequal(a.base, b.base) | |
elseif E === TERM | |
a1 = arguments(a) | |
a2 = arguments(b) | |
isequal(operation(a), operation(b)) && _allarequal(a1, a2) | |
else | |
error_on_type() | |
end | |
end |
Metadata
Metadata
Assignees
Labels
No labels