Skip to content

Commit 5416edb

Browse files
nsajkoadienes
andauthored
fix error message for eachindex(::Vararg{Tuple}) (#58811)
Make the error message in case of mismatch less confusing and consistent with the error message for arrays. While at it, also made other changes of the same line of source code: * use function composition instead of an anonymous closure * expand the one-liner into a multiline `if` --------- Co-authored-by: Andy Dienes <51664769+adienes@users.noreply.github.com>
1 parent 3076a96 commit 5416edb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

base/tuple.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,11 @@ nextind(@nospecialize(t::Tuple), i::Integer) = Int(i)+1
150150
function keys(t::Tuple, t2::Tuple...)
151151
@inline
152152
lent = length(t)
153-
all(x->length(x) == lent, t2) || throw_eachindex_mismatch_indices(IndexLinear(), t, t2...)
153+
if !all(==(lent) length, t2)
154+
let inds = map(only axes, (t, t2...))
155+
throw_eachindex_mismatch_indices("indices", inds...)
156+
end
157+
end
154158
Base.OneTo(lent)
155159
end
156160

0 commit comments

Comments
 (0)