Skip to content

bugs involving IdentityUnitRange #54783

@matthias314

Description

@matthias314

The code in range.jl was presumably written under the assumption that all ranges (or all arrays) are 1-based. With IdentityUnitRange, this is not true anymore, and this leads to problems. I have found the following issues: For

u = 2:4
v = Base.IdentityUnitRange(2:4)
w = 1:9

one gets:

julia> axes(u) == axes(v), u == v     # equal arrays must have equal axes
(false, true)

julia> w[v][2], w[v[2]]     # the documentation defines w[v][i] to be w[v[i]]
(3, 2)

This happens with Julia 1.10.4, 1.11.0-beta2 and master.

EDIT: I've just noticed that while IdentityUnitRange has a docstring, it is not mentioned in the documentation. Maybe it is considered internal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    rangesEverything AbstractRange

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions