Description
Not a regression, the bug was here ever since the subfeature was introduced in v1.6 with PR #37367.
julia> a = fill(7)
0-dimensional Array{Int64, 0}:
7
julia> reverse!(a)
ERROR: ArgumentError: reducing with add_sum over an empty collection of element type Union{} is not allowed.
You may be able to prevent this error by supplying an `init` value to the reducer.
Stacktrace:
[1] _empty_reduce_error(f::Any, T::Type)
@ Base ./reduce.jl:320
[2] reduce_empty(::typeof(Base.add_sum), ::Core.TypeofBottom)
@ Base ./reduce.jl:351
[3] reduce_empty(op::Base.BottomRF{typeof(Base.add_sum)}, ::Type{Union{}})
@ Base ./reduce.jl:360
[4] reduce_empty_iter
@ ./reduce.jl:384 [inlined]
[5] reduce_empty_iter
@ ./reduce.jl:383 [inlined]
[6] foldl_impl(op::Base.BottomRF{typeof(Base.add_sum)}, nt::Base._InitialValue, itr::Tuple{})
@ Base ./reduce.jl:49
[7] mapfoldl_impl(f::typeof(identity), op::typeof(Base.add_sum), nt::Base._InitialValue, itr::Tuple{})
@ Base ./reduce.jl:44
[8] mapfoldl(f::Function, op::Function, itr::Tuple{}; init::Base._InitialValue)
@ Base ./reduce.jl:175
[9] mapfoldl
@ ./reduce.jl:175 [inlined]
[10] mapreduce
@ ./reduce.jl:307 [inlined]
[11] sum(f::Function, a::Tuple{})
@ Base ./reduce.jl:535
[12] sum(a::Tuple{}; kw::@Kwargs{})
@ Base ./reduce.jl:564
[13] _reverse!(A::Array{Int64, 0}, dims::Tuple{})
@ Base ./arraymath.jl:77
[14] _reverse!(A::Array{Int64, 0}, ::Colon)
@ Base ./arraymath.jl:71
[15] reverse!(A::Array{Int64, 0}; dims::Function)
@ Base ./arraymath.jl:70
[16] top-level scope
@ REPL[4]:1
julia> reverse(a)
ERROR: ArgumentError: reducing with add_sum over an empty collection of element type Union{} is not allowed.
You may be able to prevent this error by supplying an `init` value to the reducer.
Stacktrace:
[1] _empty_reduce_error(f::Any, T::Type)
@ Base ./reduce.jl:320
[2] reduce_empty(::typeof(Base.add_sum), ::Core.TypeofBottom)
@ Base ./reduce.jl:351
[3] reduce_empty(op::Base.BottomRF{typeof(Base.add_sum)}, ::Type{Union{}})
@ Base ./reduce.jl:360
[4] reduce_empty_iter
@ ./reduce.jl:384 [inlined]
[5] reduce_empty_iter
@ ./reduce.jl:383 [inlined]
[6] foldl_impl(op::Base.BottomRF{typeof(Base.add_sum)}, nt::Base._InitialValue, itr::Tuple{})
@ Base ./reduce.jl:49
[7] mapfoldl_impl(f::typeof(identity), op::typeof(Base.add_sum), nt::Base._InitialValue, itr::Tuple{})
@ Base ./reduce.jl:44
[8] mapfoldl(f::Function, op::Function, itr::Tuple{}; init::Base._InitialValue)
@ Base ./reduce.jl:175
[9] mapfoldl
@ ./reduce.jl:175 [inlined]
[10] mapreduce
@ ./reduce.jl:307 [inlined]
[11] sum(f::Function, a::Tuple{})
@ Base ./reduce.jl:535
[12] sum(a::Tuple{}; kw::@Kwargs{})
@ Base ./reduce.jl:564
[13] _reverse!(A::Array{Int64, 0}, dims::Tuple{})
@ Base ./arraymath.jl:77
[14] _reverse!(A::Array{Int64, 0}, ::Colon)
@ Base ./arraymath.jl:71
[15] reverse!(A::Array{Int64, 0}; dims::Function)
@ Base ./arraymath.jl:70
[16] _reverse(A::Array{Int64, 0}, dims::Function)
@ Base ./arraymath.jl:60
[17] reverse(A::Array{Int64, 0}; dims::Function)
@ Base ./arraymath.jl:59
[18] top-level scope
@ REPL[5]:1