Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breaking change in Base.vect on nightly if the elements have offset axes #273

Closed
jishnub opened this issue Apr 14, 2022 · 1 comment
Closed

Comments

@jishnub
Copy link
Member

jishnub commented Apr 14, 2022

See JuliaLang/julia#44939.

The issue is that, because of more aggressive type promotion for arrays on nightly,

ulia> [ones(2), ones(2:3)]
ERROR: DimensionMismatch: axes must agree, got (Base.OneTo(2),) and (OffsetArrays.IdOffsetRange(values=2:3, indices=2:3),)
Stacktrace:
 [1] (::Base.var"#checkaxs#139")(axd::Tuple{Base.OneTo{Int64}}, axs::Tuple{OffsetArrays.IdOffsetRange{Int64, Base.OneTo{Int64}}})
   @ Base ./abstractarray.jl:1123
 [2] copyto_axcheck!(dest::Vector{Float64}, src::OffsetVector{Float64, Vector{Float64}})
   @ Base ./abstractarray.jl:1125
 [3] Array
   @ ./array.jl:625 [inlined]
 [4] convert
   @ ./array.jl:616 [inlined]
 [5] setindex!
   @ ./array.jl:961 [inlined]
 [6] copyto!(dest::Vector{Vector{Float64}}, src::Tuple{Vector{Float64}, OffsetVector{Float64, Vector{Float64}}})
   @ Base ./abstractarray.jl:909
 [7] vect(::Vector{Float64}, ::Vararg{Any})
   @ Base ./array.jl:147
 [8] top-level scope
   @ REPL[4]:1

whereas, on 1.7 and 1.8.0-beta3,

julia> [ones(2), ones(2:3)]
2-element Vector{AbstractVector{Float64}}:
 [1.0, 1.0]
 [1.0, 1.0]

It was suggested that the fix should go here, by defining appropriate promotion rules.

@jishnub
Copy link
Member Author

jishnub commented Jan 2, 2023

This change has been reverted, so this is fixed now

@jishnub jishnub closed this as completed Jan 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant