Skip to content

Commit

Permalink
Add morespecific rule for hcat/vcat and Type{Union{}}
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin committed Oct 17, 2023
1 parent 0acca3c commit cfe63d1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2026,6 +2026,7 @@ function hcat(V::Vector{T}...) where T
return [ V[j][i]::T for i=1:length(V[1]), j=1:length(V) ]
end
hcat(A::Vector...) = cat(A...; dims=Val(2)) # more special than SparseArrays's hcat
hcat(::Vector{Union{}}, slurp...) = Matrix{Union{}}(undef, 0, 1)

function vcat(arrays::Vector{T}...) where T
n = 0
Expand All @@ -2043,6 +2044,7 @@ function vcat(arrays::Vector{T}...) where T
return arr
end
vcat(A::Vector...) = cat(A...; dims=Val(1)) # more special than SparseArrays's vcat
vcat(::Vector{Union{}}, slurp...) = Union{}[]

_cat(n::Integer, x::Integer...) = reshape([x...], (ntuple(Returns(1), n-1)..., length(x)))

Expand Down

0 comments on commit cfe63d1

Please sign in to comment.