Skip to content

Regression in Base.vect if the elements have offset axes #44939

@jishnub

Description

@jishnub

This works on 1.7 and 1.8-beta3:

julia> using OffsetArrays

julia> ri = 2:3;

julia> [Base.IdentityUnitRange(ri), OffsetArray(ri, 2)]
2-element Vector{AbstractVector{Int64}}:
 Base.IdentityUnitRange(2:3)
 2:3 with indices 3:4

but on Version 1.9.0-DEV.353 (2022-04-09):

julia> using OffsetArrays

julia> ri = 2:3;

julia> [Base.IdentityUnitRange(ri), OffsetArray(ri, 2)]
ERROR: DimensionMismatch: axes must agree, got (Base.OneTo(2),) and (OffsetArrays.IdOffsetRange(values=3:4, indices=3:4),)
Stacktrace:
 [1] (::Base.var"#checkaxs#141")(axd::Tuple{Base.OneTo{Int64}}, axs::Tuple{OffsetArrays.IdOffsetRange{Int64, Base.OneTo{Int64}}})
   @ Base ./abstractarray.jl:1123
 [2] copyto_axcheck!
   @ ./abstractarray.jl:1125 [inlined]
 [3] Array
   @ ./array.jl:626 [inlined]
 [4] convert
   @ ./array.jl:617 [inlined]
 [5] setindex!(A::Vector{Vector{Int64}}, x::OffsetVector{Int64, UnitRange{Int64}}, i1::Int64)
   @ Base ./array.jl:966
 [6] copyto!(dest::Vector{Vector{Int64}}, src::Tuple{Base.IdentityUnitRange{UnitRange{Int64}}, OffsetVector{Int64, UnitRange{Int64}}})
   @ Base ./abstractarray.jl:909
 [7] vect(::Base.IdentityUnitRange{UnitRange{Int64}}, ::Vararg{Any})
   @ Base ./array.jl:147
 [8] top-level scope
   @ REPL[3]:1

The destination is chosen as Vector{Vector{Int64}}, which doesn't have offset axes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions