-
-
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
Require all tuples in eachindex to have the same length. #48125
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: Jerry Ling <[email protected]>
base/tuple.jl
Outdated
@inline | ||
max(length(t), _maxlength(t2, t3...)) | ||
lent = length(t) | ||
all(==(lent), t2) || throw_eachindex_mismatch_indices((), t, t2...) |
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.
all(==(lent), t2) || throw_eachindex_mismatch_indices((), t, t2...) | |
all(t -> length(t)==lent, t2) || throw_eachindex_mismatch_indices((), t, t2...) |
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.
yeah sorry I was stupid
any updates on this pr? |
basically my first proposed change was bad, so you need to revert to I believe all(t -> length(t)==lent, t2) |
I did not implement the changes you suggested, so I thought it was good to go. |
@oscardssmith did: 6e3e170 so you need to fix that. You can always see the full change this PR current has by heading towards: https://github.com/JuliaLang/julia/pull/48125/files |
This reverts commit 6e3e170.
Okay done. |
base/tuple.jl
Outdated
function keys(t::Tuple, t2::Tuple...) | ||
@inline | ||
OneTo(_maxlength(t, t2...)) | ||
@noinline function throw_eachindex_mismatch_indices(::Tuple{}, inds...) |
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.
what is the purpose of the first ::Tuple{}
parameter?
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.
I think it resolves dispatch:
julia> methods(Base.throw_eachindex_mismatch_indices)
# 2 methods for generic function "throw_eachindex_mismatch_indices" from Base:
[1] throw_eachindex_mismatch_indices(::IndexCartesian, inds...)
@ abstractarray.jl:324
[2] throw_eachindex_mismatch_indices(::IndexLinear, inds...)
@ abstractarray.jl:321
It's not obvious to me that one couldn't use the IndexLinear
dispatch but this seems fine.
base/tuple.jl
Outdated
function keys(t::Tuple, t2::Tuple...) | ||
@inline | ||
OneTo(_maxlength(t, t2...)) | ||
@noinline function throw_eachindex_mismatch_indices(::Tuple{}, inds...) |
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.
I think it resolves dispatch:
julia> methods(Base.throw_eachindex_mismatch_indices)
# 2 methods for generic function "throw_eachindex_mismatch_indices" from Base:
[1] throw_eachindex_mismatch_indices(::IndexCartesian, inds...)
@ abstractarray.jl:324
[2] throw_eachindex_mismatch_indices(::IndexLinear, inds...)
@ abstractarray.jl:321
It's not obvious to me that one couldn't use the IndexLinear
dispatch but this seems fine.
Let's rerun CI here (by closing and reopening) and then it looks good to merge. |
This looks like it worked (I haven't checked very carefully but the failures seem unrelated). If you're re-purposing the |
Done.
So that's why it doesn't fail during build with |
I'm tempted to merge this but a bit concerned about the failures on |
No, I am on linux. :( |
Let's just close and reopen and see if it happens again. |
Apple failed again, perhaps suggesting it's a consequence of this PR. If so, we can't merge this until that's fixed. Can anyone with a mac investigate why? |
Potential fix for #47898