Skip to content

Conversation

@oxinabox
Copy link
Member

Partner to JuliaDiff/ChainRulesCore.jl#398

This does not help one actually opt out of rules.
It doesn't expost an API for keeping track of that.
(But I think maybe we can exactly copy the one for frule/rrule?)
That can be a follow up PR.
It is less pressing

What it does do is make sure the rules that return nothing are not incuded in the list of rules that get generated.
Which means that opting out will not cause e,g. Nabla to generate a overload that hits a rule that returns nothing.

@codecov-commenter
Copy link

codecov-commenter commented Jul 24, 2021

Codecov Report

Attention: Patch coverage is 60.00000% with 4 lines in your changes missing coverage. Please review.

Project coverage is 90.00%. Comparing base (7033b82) to head (4aaa97f).

Files with missing lines Patch % Lines
src/ruleset_loading.jl 60.00% 4 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (7033b82) and HEAD (4aaa97f). Click for more details.

HEAD has 141 uploads less than BASE
Flag BASE (7033b82) HEAD (4aaa97f)
151 10
Additional details and impacted files
@@            Coverage Diff             @@
##           master       #8      +/-   ##
==========================================
- Coverage   96.29%   90.00%   -6.30%     
==========================================
  Files           2        2              
  Lines          54       60       +6     
==========================================
+ Hits           52       54       +2     
- Misses          2        6       +4     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@oxinabox oxinabox changed the title Don't return opted out rules Don't return opted out rules. CRC 1.0 compat Jul 24, 2021
opted_out = Set(arg_type_tuple(m.sig) for m in _no_rule_list(rule_kind))
return Iterators.filter(methods(rule_kind)) do m
return !_is_fallback(rule_kind, m) && !_requires_config(m)
return !_requires_config(m) && arg_type_tuple(m.sig) opted_out
Copy link
Member

Choose a reason for hiding this comment

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

Does this still exclude fallback rules? is it because _no_rule_list contains the same fallback signature as the rules? Is that not quite fragile?

Copy link
Member Author

Choose a reason for hiding this comment

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

Conceptually CRC should have @opt_out rrule(::Any, :Any...)

It doesn't actually have that code, because that one it has has Keno's kwarg optimisation.
I would not be surprised if we roll the optimisation out for all @opt_out.
If we do it literally will have that opt out.

Copy link
Member

@mzgubic mzgubic Jul 26, 2021

Choose a reason for hiding this comment

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

hmm, so what is the current mechanism to exclude the fallback rule from appearing in this list? (given that we have removed !_is_fallback condition?)

Edit: ah, I see, the no_rrule has this signature in CRC

@oxinabox oxinabox merged commit 557b400 into master Jul 26, 2021
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