From 7232a9a4f2923c1d81cb99d464141d47120e382a Mon Sep 17 00:00:00 2001 From: "Steven G. Johnson" Date: Mon, 21 Nov 2016 10:01:52 -0500 Subject: [PATCH] fix dispatch loop introduced by #19305 (#19357) --- base/abstractarray.jl | 6 +++--- test/abstractarray.jl | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/base/abstractarray.jl b/base/abstractarray.jl index eacf18ee5d287..206e99f257a1e 100644 --- a/base/abstractarray.jl +++ b/base/abstractarray.jl @@ -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 diff --git a/test/abstractarray.jl b/test/abstractarray.jl index a86e848e29067..178f2863690ff 100644 --- a/test/abstractarray.jl +++ b/test/abstractarray.jl @@ -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)]