-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Check bounds for indexing tuples by logical masks #19737
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,8 +15,8 @@ endof(t::Tuple) = length(t) | |
size(t::Tuple, d) = d==1 ? length(t) : throw(ArgumentError("invalid tuple dimension $d")) | ||
getindex(t::Tuple, i::Int) = getfield(t, i) | ||
getindex(t::Tuple, i::Real) = getfield(t, convert(Int, i)) | ||
getindex(t::Tuple, r::AbstractArray) = tuple([t[ri] for ri in r]...) | ||
getindex(t::Tuple, b::AbstractArray{Bool}) = getindex(t,find(b)) | ||
getindex{T}(t::Tuple, r::AbstractArray{T,1}) = tuple([t[ri] for ri in r]...) | ||
getindex(t::Tuple, b::AbstractArray{Bool,1}) = length(b) == length(t) ? getindex(t,find(b)) : throw(BoundsError(t, b)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. apparently it's never been size-checked for as long as this getindex signature has existed 66ae77a, wonder if there was a reason not to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Eh, I'd bet it was just an oversight. Bounds checking back then was less picky and no tests broke with this change. |
||
|
||
## iterating ## | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r::AbstractVector
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not defined at this point in bootstrap.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
be sure to squash on merge then, if the first commit wouldn't build