Skip to content

Call checkbounds also when using non-scalar indexing#296

Merged
rafaqz merged 2 commits into
JuliaIO:mainfrom
lupemba:checkbounds-for-non-scalar-indexing
May 25, 2026
Merged

Call checkbounds also when using non-scalar indexing#296
rafaqz merged 2 commits into
JuliaIO:mainfrom
lupemba:checkbounds-for-non-scalar-indexing

Conversation

@lupemba
Copy link
Copy Markdown
Contributor

@lupemba lupemba commented May 7, 2026

This will also call checkbounds when using get index with slices, ranges etc. Previous the checkbounds where only called when doing scalar indexing.

I think the missing checkbounds is a bug but there is a risk that some package might have used it as a feature.

@asinghvi17
Copy link
Copy Markdown
Member

Thanks, this looks like an improvement to me! But should this get a @propagate_inbounds and @boundscheck?

@lupemba
Copy link
Copy Markdown
Contributor Author

lupemba commented May 7, 2026

@asinghvi17
Thanks for the feedback. I have added @propagate_inbounds and @boundscheck now. I have also moved the bounds check logic to the Base.getindex method.

Is this use of @propagate_inbounds correct? I have never used these macros before.

@rafaqz rafaqz merged commit 118cf2c into JuliaIO:main May 25, 2026
12 checks passed
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

Successfully merging this pull request may close these issues.

3 participants