Skip to content

Commit

Permalink
fix dispatch loop introduced by JuliaLang#19305 (JuliaLang#19357)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevengj authored and fcard committed Feb 28, 2017
1 parent 71fdc22 commit 739f93f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1293,10 +1293,10 @@ julia> hvcat((2,2,2), a,b,c,d,e,f)
If the first argument is a single integer `n`, then all block rows are assumed to have `n`
block columns.
"""
hvcat(rows::Tuple{Vararg{Int}}, xs::AbstractMatrix...) = typed_hvcat(promote_eltype(xs...), rows, xs...)
hvcat{T}(rows::Tuple{Vararg{Int}}, xs::AbstractMatrix{T}...) = typed_hvcat(T, rows, xs...)
hvcat(rows::Tuple{Vararg{Int}}, xs::AbstractVecOrMat...) = typed_hvcat(promote_eltype(xs...), rows, xs...)
hvcat{T}(rows::Tuple{Vararg{Int}}, xs::AbstractVecOrMat{T}...) = typed_hvcat(T, rows, xs...)

function typed_hvcat{T}(::Type{T}, rows::Tuple{Vararg{Int}}, as::AbstractMatrix...)
function typed_hvcat{T}(::Type{T}, rows::Tuple{Vararg{Int}}, as::AbstractVecOrMat...)
nbr = length(rows) # number of block rows

nc = 0
Expand Down
3 changes: 3 additions & 0 deletions test/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -785,3 +785,6 @@ end
@test ndims((1:3)[:,:,1:1,:]) == 4
@test ndims((1:3)[:,:,1:1]) == 3
@test ndims((1:3)[:,:,1:1,:,:,[1]]) == 6

# dispatch loop introduced in #19305
@test [(1:2) zeros(2,2); ones(3,3)] == [[1,2] zeros(2,2); ones(3,3)] == [reshape([1,2],2,1) zeros(2,2); ones(3,3)]

0 comments on commit 739f93f

Please sign in to comment.