From c6aeed6012e173560253839b8a399c3ba486b1f9 Mon Sep 17 00:00:00 2001 From: Michael Abbott <32575566+mcabbott@users.noreply.github.com> Date: Sat, 4 Dec 2021 18:01:46 -0500 Subject: [PATCH] missing eltype --- base/abstractarray.jl | 2 +- test/abstractarray.jl | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/base/abstractarray.jl b/base/abstractarray.jl index a2ce7b4f95c9b..be546320e833d 100644 --- a/base/abstractarray.jl +++ b/base/abstractarray.jl @@ -2582,7 +2582,7 @@ function _vstack_plus(itr) len = length(val) n = haslength(itr) ? len*length(itr) : nothing - v = similar(val isa Tuple ? (1:0) : val, something(n, len)) + v = similar(val isa Tuple ? (1:0) : val, eltype(val), something(n, len)) copyto!(v, 1, val, firstindex(val), len) w = _stack_rest!(v, 0, n, axe, itr, state) diff --git a/test/abstractarray.jl b/test/abstractarray.jl index ecffe0f9d7312..5409253b258b8 100644 --- a/test/abstractarray.jl +++ b/test/abstractarray.jl @@ -1575,6 +1575,7 @@ end @test stack([(1,2), (3,4)]) == [1 3; 2 4] @test stack(((1,2), (3,4))) == [1 3; 2 4] @test size(stack(Iterators.product(1:3, 1:4))) == (2,3,4) + @test stack([('a', 'b'), ('c', 'd')]) == ['a' 'c'; 'b' 'd'] # Mismatched sizes @test_throws DimensionMismatch stack([1:2, 1:3])