From e0bde4a08a5253c90d7e142b07724273908d008d Mon Sep 17 00:00:00 2001 From: Herman Sletmoen Date: Thu, 29 Aug 2024 11:46:55 +0200 Subject: [PATCH] Resolve isequal(Num, ForwardDiff.Dual) ambiguity --- ext/SymbolicsForwardDiffExt.jl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/ext/SymbolicsForwardDiffExt.jl b/ext/SymbolicsForwardDiffExt.jl index 480fc83f5..9882bec12 100644 --- a/ext/SymbolicsForwardDiffExt.jl +++ b/ext/SymbolicsForwardDiffExt.jl @@ -103,6 +103,25 @@ function binary_dual_definition(M, f, Ts) return expr end +##################### +# Generic Functions # +##################### + +# Predicates # +#------------# + +for pred in [:isequal, :(==)] + @eval begin + @define_binary_dual_op( + Base.$(pred), + $(pred)(value(x), value(y)) && $(pred)(partials(x), partials(y)), + $(pred)(value(x), y) && iszero(partials(x)), + $(pred)(x, value(y)) && iszero(partials(y)), + $AMBIGUOUS_TYPES + ) + end +end + ################################### # General Mathematical Operations # ###################################