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

Julia 1.7.3: Array creation with repeated semicolons and different types doesn't work #45461

Closed
rashidrafeek opened this issue May 26, 2022 · 3 comments

Comments

@rashidrafeek
Copy link
Contributor

If there are multiple types in the array, repeated semicolon syntax does not seem to work in 1.7.3. For example,

Julia 1.7.3:

julia> [1 2;;; nothing 4]
ERROR: MethodError: no method matching size(::Nothing, ::Int64)
Closest candidates are:
  size(::Union{LinearAlgebra.QR, LinearAlgebra.QRCompactWY, LinearAlgebra.QRPivoted}, ::Integer) at ~/Apps/julia/julia-1.7/share/julia/stdlib/v1.7/LinearAlgebra/src/qr.jl:566
  size(::Union{LinearAlgebra.Cholesky, LinearAlgebra.CholeskyPivoted}, ::Integer) at ~/Apps/julia/julia-1.7/share/julia/stdlib/v1.7/LinearAlgebra/src/cholesky.jl:495
  size(::Union{LinearAlgebra.Hermitian{T, S}, LinearAlgebra.Symmetric{T, S}} where {T, S}, ::Any) at ~/Apps/julia/julia-1.7/share/julia/stdlib/v1.7/LinearAlgebra/src/symmetric.jl:201
  ...
Stacktrace:
 [1] _typed_hvncat_dims(#unused#::Type{Union{Nothing, Int64}}, dims::Tuple{Int64, Int64, Int64}, row_first::Bool, as::Tuple{Int64, Int64, Nothing, Int64})
   @ Base ./abstractarray.jl:2328
 [2] _typed_hvncat(::Type, ::Tuple{Int64, Int64, Int64}, ::Bool, ::Int64, ::Vararg{Any})
   @ Base ./abstractarray.jl:2304
 [3] _hvncat(::Tuple{Int64, Int64, Int64}, ::Bool, ::Int64, ::Vararg{Any})
   @ Base ./abstractarray.jl:2133
 [4] hvncat(::Tuple{Int64, Int64, Int64}, ::Bool, ::Int64, ::Vararg{Any})
   @ Base ./abstractarray.jl:2129
 [5] top-level scope
   @ REPL[21]:1

Julia 1.7.2:

julia> [1 2;;; nothing 4]
1×2×2 Array{Union{Nothing, Int64}, 3}:
[:, :, 1] =
 1  2

[:, :, 2] =
 nothing  4
@rashidrafeek
Copy link
Contributor Author

Seems like backporting #45365 will fix this.

@BioTurboNick
Copy link
Contributor

As a workaround, you can define:

Base.size(x::Nothing, y::Int) = Base.cat_size(x, y)

@rashidrafeek
Copy link
Contributor Author

Closing as there seems to be no plan for a 1.7.4 release.

@rashidrafeek rashidrafeek closed this as not planned Won't fix, can't repro, duplicate, stale Dec 7, 2022
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

No branches or pull requests

2 participants