-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iszero(::SVector{0}) broken #778
Labels
Comments
pablosanjose
changed the title
iszero(::SVector{0}) broken by #263
iszero(::SVector{0}) broken
May 1, 2020
Unexpected bugs tend to be breaking changes! Thanks for the report :-) @tkf what do you think? Likely this is related to some refactoring done in #750 which now causes julia> reduce((x,y)->true, SVector{0,Int}(), init=true)
ERROR: BoundsError: attempt to access ()
at index [1]
Stacktrace:
[1] getindex(::Tuple, ::Int64) at ./tuple.jl:24
[2] getindex(::SArray{Tuple{0},Int64,1,0}, ::Int64) at /home/chris/.julia/dev/StaticArrays/src/SVector.jl:37
[3] macro expansion at /home/chris/.julia/dev/StaticArrays/src/mapreduce.jl:129 [inlined]
[4] _mapfoldl(::typeof(identity), ::var"#9#10", ::Colon, ::Bool, ::Size{(0,)}, ::SArray{Tuple{0},Int64,1,0}) at /home/chris/.julia/dev/StaticArrays/src/mapreduce.jl:116
[5] _mapreduce(::Function, ::Function, ::Function, ::Bool, ::Size{(0,)}, ::SArray{Tuple{0},Int64,1,0}) at /home/chris/.julia/dev/StaticArrays/src/mapreduce.jl:113
[6] _reduce(::Function, ::SArray{Tuple{0},Int64,1,0}, ::Function, ::Bool) at /home/chris/.julia/dev/StaticArrays/src/mapreduce.jl:198
[7] reduce(::Function, ::SArray{Tuple{0},Int64,1,0}; dims::Function, init::Bool) at /home/chris/.julia/dev/StaticArrays/src/mapreduce.jl:184
[8] top-level scope at REPL[2]:1 |
Oops, yes, there is a bug in empty array handling. #780 should fix this. |
I'll do a quickfix release 0.12.3 containing this. |
That was quick! Thanks a lot! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Something in v0.12.2 introduced a severe breaking change: it has made
iszero(SVector{0,Int}())
aBoundsError
, whereas before (in v0.12.1) it wastrue
. In my opinion the old behavior made more sense, as indeedzero(SVector{0,Int}) === SVector{0,Int}()
The text was updated successfully, but these errors were encountered: