Open phipsgabler opened 2 years ago
I was trying to find a fix for https://github.com/jw3126/Setfield.jl/issues/175, a bug in Setfields's type stability, and took a look at what NoBang is doing; turns out it uses the same code, and suffers from the same issue:
julia> _setindex(rand(2,2), Float64[100, 100], 1, :) 2×2 Matrix{Any}: 100.0 100.0 0.309041 0.986011
The problem is that the typeof(v) is wrong when the RHS is an iterable written to a slice.
typeof(v)
I don't yet know of a better fix. eltype(v) does not generalize beyond number-like types.
eltype(v)
(Is it even right to call this an instability? Probably it's rather a promotion gone wrong, and then stable with a too general type.)
I was trying to find a fix for https://github.com/jw3126/Setfield.jl/issues/175, a bug in Setfields's type stability, and took a look at what NoBang is doing; turns out it uses the same code, and suffers from the same issue:
The problem is that the
typeof(v)
is wrong when the RHS is an iterable written to a slice.I don't yet know of a better fix.
eltype(v)
does not generalize beyond number-like types.