Skip to content
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

Type "instability" in _setindex with slices #233

Open
phipsgabler opened this issue Aug 11, 2022 · 1 comment
Open

Type "instability" in _setindex with slices #233

phipsgabler opened this issue Aug 11, 2022 · 1 comment

Comments

@phipsgabler
Copy link

I was trying to find a fix for jw3126/Setfield.jl#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.

I don't yet know of a better fix. eltype(v) does not generalize beyond number-like types.

@phipsgabler
Copy link
Author

(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.)

@phipsgabler phipsgabler changed the title Type instability in _setindex with slices Type "instability" in _setindex with slices Aug 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant