Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve isequal(Num, ForwardDiff.Dual) ambiguity #1247

Merged
merged 3 commits into from
Aug 29, 2024

Conversation

hersle
Copy link
Contributor

@hersle hersle commented Aug 29, 2024

This is another attempt at fixing SciML/ModelingToolkit.jl#2997 by addressing the actual root cause of the issue, which is described with a minimal example in #1246. Following #1036, I have also copied ForwardDiff's isequal() definition to resolve the type ambiguity.

@codecov-commenter
Copy link

codecov-commenter commented Aug 29, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 30.39%. Comparing base (47cfd60) to head (f0bcc47).
Report is 40 commits behind head on master.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #1247       +/-   ##
===========================================
+ Coverage    8.30%   30.39%   +22.08%     
===========================================
  Files          46       46               
  Lines        4549     4570       +21     
===========================================
+ Hits          378     1389     +1011     
+ Misses       4171     3181      -990     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hersle
Copy link
Contributor Author

hersle commented Aug 29, 2024

The test failures seem unrelated to this.

# https://github.com/JuliaSymbolics/Symbolics.jl/issues/1246
@testset "isequal type ambiguity" begin
@variables x
xfunc(xval) = isequal(x, xval) ? xval : xval
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
xfunc(xval) = isequal(x, xval) ? xval : xval
xfunc(xval) = isequal(x, xval) ? x : xval

I don't quite understand this test? In both cases the derivative is respect to the value, so even if isequal is wrong this would pass. It needs to have a "bad" branch that would be wrong/error

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I agree. I was very focused on simply ensuring it does not crash. I will improve it a bit and add a bad branch.

@hersle
Copy link
Contributor Author

hersle commented Aug 29, 2024

@ChrisRackauckas Do you think this one is a little better?

@ChrisRackauckas ChrisRackauckas merged commit db877fb into JuliaSymbolics:master Aug 29, 2024
7 of 11 checks passed
@ChrisRackauckas
Copy link
Member

@n0rbed @sumiya11 there's a regression on master, do you know what caused that?

@n0rbed
Copy link
Member

n0rbed commented Aug 29, 2024

Will check it out tomorrow morning

@n0rbed
Copy link
Member

n0rbed commented Aug 30, 2024

@ChrisRackauckas This test isnt written well in master. its now fixed in the latest PR im working on. If you can dont merge it yet though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants