Skip to content

remove getindex(::ReinterpretArray) #58814

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

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

adienes
Copy link
Member

@adienes adienes commented Jun 25, 2025

fix #58232

o3 helped me understand the existing implementations but code is mine

@giordano giordano added needs tests Unit tests are required for this change arrays [a, r, r, a, y, s] labels Jun 25, 2025
@nsajko nsajko added needs news A NEWS entry is required for this change minor change Marginal behavior change acceptable for a minor release labels Jun 25, 2025
@nsajko
Copy link
Contributor

nsajko commented Jun 25, 2025

This method seems like it may need adjustment, too:

@propagate_inbounds function getindex(a::NonReshapedReinterpretArray{T,0,S}) where {T,S}
if isprimitivetype(T) && isprimitivetype(S)
reinterpret(T, a.parent[])
else
a[firstindex(a)]
end
end

@adienes
Copy link
Member Author

adienes commented Jun 25, 2025

yup. also this currently breaks 0-dimensional reinterpetarrays

@adienes
Copy link
Member Author

adienes commented Jun 26, 2025

@nanosoldier runtests()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrays [a, r, r, a, y, s] minor change Marginal behavior change acceptable for a minor release needs news A NEWS entry is required for this change needs tests Unit tests are required for this change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

getindex too relaxed on reinterpreted array
4 participants