JuliaArrays / JuliaArrays/StaticArrays.jl
map SOneTo to arrays? 🤷♀️
Open
Nobody has claimed this yet.
bug
- Dominant language
- Julia
- Stars
- 844
- Forks
- 159
- Avg merge
- 3d 21h
- Merged PRs (30d)
- 3
Description
This causes https://github.com/fonsp/Pluto.jl/issues/458
MWE:
julia> using StaticArrays
julia> s = SA[1,2,3];
julia> i = eachindex(s)
SOneTo(3)
julia> map(i) do k
[]
end
ERROR: setindex!() with non-isbitstype eltype is not supported by StaticArrays. Consider using SizedArray.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] setindex! at /home/fons/.julia/packages/StaticArrays/LJQEe/src/MArray.jl:99 [inlined]
[3] collect_to_with_first!(::MArray{Tuple{3},Array{Any,1},1,3}, ::Array{Any,1}, ::Base.Generator{SOneTo{3},var"#3#4"}, ::Int64) at ./array.jl:709
[4] _collect(::SOneTo{3}, ::Base.Generator{SOneTo{3},var"#3#4"}, ::Base.EltypeUnknown, ::Base.HasShape{1}) at ./array.jl:704
[5] collect_similar(::SOneTo{3}, ::Base.Generator{SOneTo{3},var"#3#4"}) at ./array.jl:628
[6] map(::Function, ::SOneTo{3}) at ./abstractarray.jl:2162
[7] top-level scope at REPL[6]:1
Note that this map is fine:
julia> map(i) do k
2
end
3-element MArray{Tuple{3},Int64,1,3} with indices SOneTo(3):
2
2
2
Julia 1.5.2, StaticArrays v0.12.5
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by rerunning the Julia MWE and reading the collection path in array.jl and abstractarray.jl, along with the StaticArrays behavior shown in src/MArray.jl. Compare the failing map that returns [] with the scalar-returning map; done means the reported non-isbits collection case has defined, tested behavior without regressing the working case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100