Skip to content

Call checkbounds also when using non-scalar indexing#296

Open
lupemba wants to merge 2 commits into
JuliaIO:mainfrom
lupemba:checkbounds-for-non-scalar-indexing
Open

Call checkbounds also when using non-scalar indexing#296
lupemba wants to merge 2 commits into
JuliaIO:mainfrom
lupemba:checkbounds-for-non-scalar-indexing

Conversation

@lupemba
Copy link
Copy Markdown

@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
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.

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.

2 participants