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

Don't substitute in non-symbolic expressions #1245

Closed
wants to merge 1 commit into from

Conversation

hersle
Copy link
Contributor

@hersle hersle commented Aug 28, 2024

Adding this dispatch makes ModelingToolkit#2997 work on my machine.
I don't think it addresses the root cause of that issue, but at least it circumvents whatever triggers the bug.
Anyway, this PR sounds like a safe optimization to me. Let me know what you think.

Copy link
Member

@bowenszhu bowenszhu left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Could you add some tests?

@codecov-commenter
Copy link

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

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.

Project coverage is 30.38%. Comparing base (a120309) to head (7ef8d1f).
Report is 182 commits behind head on master.

Files with missing lines Patch % Lines
src/variable.jl 0.00% 3 Missing ⚠️

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

❗ There is a different number of reports uploaded between BASE (a120309) and HEAD (7ef8d1f). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (a120309) HEAD (7ef8d1f)
2 1
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #1245       +/-   ##
===========================================
- Coverage   76.20%   30.38%   -45.83%     
===========================================
  Files          36       46       +10     
  Lines        3749     4572      +823     
===========================================
- Hits         2857     1389     -1468     
- Misses        892     3183     +2291     

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

@hersle
Copy link
Contributor Author

hersle commented Aug 30, 2024

I'm gonna close this for now, because I think #1247 was a better way of fixing the issue.

Not substituting in non-symbolic expressions would also be breaking. For example, it would change the result of substitute(1, 1 => 2) from being 2 (which I would expect) to becoming 1 (which would surprise me). The same should be true for fast_substitute, for consistency. I feel like it's better to just leave things as they are.

Sorry for the bother :)

@hersle hersle closed this Aug 30, 2024
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.

3 participants