On the main branch, to_vec(t::Tuple{}) fails as it attempts to call cumsum on an empty vector of type Union{} (obtained by collecting the empty tuple). It is a bit of a corner case, but it can cause test_rrule to fail when the output has an empty tuple or named tuple.
This PR specialcases empty tuples to fix that.
On main:
julia> using FiniteDifferences
julia> v, reconstruct = FiniteDifferences.to_vec(())
ERROR: MethodError: Base.ArithmeticStyle(::Type{Union{}}) is ambiguous.
On the main branch,
to_vec(t::Tuple{})
fails as it attempts to callcumsum
on an empty vector of typeUnion{}
(obtained by collecting the empty tuple). It is a bit of a corner case, but it can causetest_rrule
to fail when the output has an empty tuple or named tuple.This PR specialcases empty tuples to fix that.
On main:
With this PR: