diff --git a/Project.toml b/Project.toml index b6ef92c851..1e0cea8060 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Mooncake" uuid = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6" authors = ["Will Tebbutt, Hong Ge, and contributors"] -version = "0.4.148" +version = "0.4.149" [deps] ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b" diff --git a/src/tools_for_rules.jl b/src/tools_for_rules.jl index f747121154..820b711365 100644 --- a/src/tools_for_rules.jl +++ b/src/tools_for_rules.jl @@ -282,9 +282,8 @@ function _zero_derivative_impl(ctx, sig, mode) # which does not escape the mode argument. This will work even if the names `Mooncake` # or `Mooncake.Mode` are not available in the scope which calls this macro. is_primitive_ex = quote - const M = $mode function Mooncake.is_primitive( - ::Type{$(esc(ctx))}, ::Type{<:M}, ::Type{<:$(esc(sig))} + ::Type{$(esc(ctx))}, ::Type{<:$mode}, ::Type{<:$(esc(sig))} ) return true end @@ -605,7 +604,9 @@ function _from_chainrules_impl(ctx, sig::Expr, has_kwargs::Bool, mode) kw_sig = where_params === nothing ? kw_sig : Expr(:where, kw_sig, where_params...) # Type M will be available later on, and will be the mode type. kw_is_primitive = quote - function Mooncake.is_primitive(::Type{$(esc(ctx))}, ::Type{<:M}, ::Type{<:$kw_sig}) + function Mooncake.is_primitive( + ::Type{$(esc(ctx))}, ::Type{<:$mode}, ::Type{<:$kw_sig} + ) return true end end @@ -634,9 +635,8 @@ function _from_chainrules_impl(ctx, sig::Expr, has_kwargs::Bool, mode) end return quote - const M = $mode function Mooncake.is_primitive( - ::Type{$(esc(ctx))}, ::Type{<:M}, ::Type{<:($(esc(sig)))} + ::Type{$(esc(ctx))}, ::Type{<:$mode}, ::Type{<:($(esc(sig)))} ) return true end