Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions base/tuple.jl
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,9 @@ nextind(@nospecialize(t::Tuple), i::Integer) = Int(i)+1

function keys(t::Tuple, t2::Tuple...)
@inline
OneTo(_maxlength(t, t2...))
end
_maxlength(t::Tuple) = length(t)
function _maxlength(t::Tuple, t2::Tuple, t3::Tuple...)
@inline
max(length(t), _maxlength(t2, t3...))
lent = length(t)
all(x->length(x) == lent, t2) || throw_eachindex_mismatch_indices(IndexLinear(), t, t2...)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This results in a confusing error message. PR: #58811

Base.OneTo(lent)
end

# this allows partial evaluation of bounded sequences of next() calls on tuples,
Expand Down
2 changes: 1 addition & 1 deletion test/tuple.jl
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ end
@test iterate(t, y3[2]) === nothing

@test eachindex((2,5,"foo")) === Base.OneTo(3)
@test eachindex((2,5,"foo"), (1,2,5,7)) === Base.OneTo(4)
@test_throws DimensionMismatch eachindex((2,5,"foo"), (1,2,5,7))

@test Core.Compiler.is_nothrow(Base.infer_effects(iterate, (Tuple{Int,Int,Int}, Int)))
end
Expand Down