Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "ChainRulesCore"
uuid = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
version = "0.9.30"
version = "0.9.31"

[deps]
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
Expand Down
2 changes: 1 addition & 1 deletion src/rule_definition_tools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ function _nondiff_rrule_expr(primal_sig_parts, primal_invoke)
)
return esc(quote
# Manually defined kw version to save compiler work. See explanation in rules.jl
function (::Core.kwftype(typeof(rrule)))(kwargs::Any, rrule::typeof(ChainRulesCore.rrule), $(primal_sig_parts...))
function (::Core.kwftype(typeof(ChainRulesCore.rrule)))(kwargs::Any, rrule::typeof(ChainRulesCore.rrule), $(primal_sig_parts...))
return ($(_with_kwargs_expr(primal_invoke)), $pullback_expr)
end
function ChainRulesCore.rrule($(primal_sig_parts...))
Expand Down
21 changes: 21 additions & 0 deletions test/rule_definition_tools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -251,3 +251,24 @@ end


end


module IsolatedModuleForTestingScoping
using Test
# need to make sure macros work in something that hasn't imported all exports
# all that matters is that the following don't error, since they will resolve at
# parse time
using ChainRulesCore: ChainRulesCore

@testset "@non_differentiable" begin
# this is
# https://github.com/JuliaDiff/ChainRulesCore.jl/issues/317
fixed(x) = :abc
ChainRulesCore.@non_differentiable fixed(x)
end

@testset "@scalar_rule" begin
my_id(x) = x
ChainRulesCore.@scalar_rule(my_id(x), 1.0)
end
end