|
90 | 90 | end |
91 | 91 |
|
92 | 92 | @testset "should not have rrules that need RuleConfig" begin |
93 | | - old_rrule_list = collect(_rule_list(rrule)) |
94 | | - function ChainRulesCore.rrule( |
95 | | - ::RuleConfig{>:Union{HasForwardsMode,HasReverseMode}}, sum, f, xs |
96 | | - ) |
97 | | - return 1.0, x->(x,x,x) # this will not be call so return doesn't matter |
| 93 | + @testset "normal type sigs" begin |
| 94 | + old_rrule_list = collect(_rule_list(rrule)) |
| 95 | + function ChainRulesCore.rrule( |
| 96 | + ::RuleConfig{>:Union{HasForwardsMode,HasReverseMode}}, sum, f, xs |
| 97 | + ) |
| 98 | + return 1.0, x->(x,x,x) # this will not be call so return doesn't matter |
| 99 | + end |
| 100 | + # New rule should not have appeared |
| 101 | + @test collect(_rule_list(rrule)) == old_rrule_list |
| 102 | + end |
| 103 | + @testset "UnionAll type sigs" begin |
| 104 | + old_rrule_list = collect(_rule_list(rrule)) |
| 105 | + function ChainRulesCore.rrule( |
| 106 | + ::RuleConfig{>:Union{HasForwardsMode,HasReverseMode}}, sum, f::F, xs |
| 107 | + ) where F <: Function |
| 108 | + return 1.0, x->(x,x,x) # this will not be call so return doesn't matter |
| 109 | + end |
| 110 | + # New rule should not have appeared |
| 111 | + @test collect(_rule_list(rrule)) == old_rrule_list |
| 112 | + # Above would error if we were not handling UnionAll's right |
98 | 113 | end |
99 | | - # New rule should not have appeared |
100 | | - @test collect(_rule_list(rrule)) == old_rrule_list |
101 | 114 | end |
102 | 115 | end |
103 | 116 | end |
0 commit comments