Skip to content

eachindex should throw DimensionMismatch for differently sized tuples #47898

@cafaxo

Description

@cafaxo

Currently, we have

julia> eachindex((), (1,))
Base.OneTo(1)

From the documentation of eachindex, I expected a DimensionMismatch instead. Like this:

julia> eachindex(1:0, 1:1)
ERROR: DimensionMismatch: all inputs to eachindex must have the same indices, got Base.OneTo(0) and Base.OneTo(1)

(Previous discussion on slack: https://julialang.slack.com/archives/C6A044SQH/p1671032794309049)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorcorrectness bug ⚠Bugs that are likely to lead to incorrect results in user code without throwinggood first issueIndicates a good issue for first-time contributors to Julia

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions