Skip to content

Commit

Permalink
Use typeof
Browse files Browse the repository at this point in the history
  • Loading branch information
ToucheSir authored Nov 13, 2023
1 parent e347246 commit cc8aeee
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/lib.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ accum(x::AbstractArray, ys::AbstractArray...) = accum.(x, ys...)
@generated function accum(x::NamedTuple, y::NamedTuple)
# assumes that y has no keys apart from those also in x
if fieldnames(y) fieldnames(x)
return :(throw(ArgumentError("$y keys must be a subset of $x keys")))
return :(throw(ArgumentError("$(typeof(y)) keys must be a subset of $(typeof(x)) keys")))
end

grad(field) = field in fieldnames(y) ? :(y.$field) : :nothing
Expand Down

0 comments on commit cc8aeee

Please sign in to comment.