From 3fcd42972ce68c11e836280457f4275acc755163 Mon Sep 17 00:00:00 2001 From: Michael Abbott <32575566+mcabbott@users.noreply.github.com> Date: Wed, 10 Apr 2024 20:50:43 -0400 Subject: [PATCH] fix a bug in size errors --- base/abstractarray.jl | 2 +- test/abstractarray.jl | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/base/abstractarray.jl b/base/abstractarray.jl index cef81d6925284..82deb9d8bbfff 100644 --- a/base/abstractarray.jl +++ b/base/abstractarray.jl @@ -3017,7 +3017,7 @@ end @inline function _stack_size_check(x, ax1::Tuple) if _iterator_axes(x) != ax1 uax1 = map(UnitRange, ax1) - uaxN = map(UnitRange, axes(x)) + uaxN = map(UnitRange, _iterator_axes(x)) throw(DimensionMismatch( LazyString("stack expects uniform slices, got axes(x) == ", uaxN, " while first had ", uax1))) end diff --git a/test/abstractarray.jl b/test/abstractarray.jl index a0a6ba6b2229a..f49748f1eddb5 100644 --- a/test/abstractarray.jl +++ b/test/abstractarray.jl @@ -1778,6 +1778,9 @@ end @test_throws ArgumentError stack([1:3, 4:6]; dims=3) @test_throws ArgumentError stack(abs2, 1:3; dims=2) + @test stack(["hello", "world"]) isa Matrix{Char} + @test_throws DimensionMismatch stack(["hello", "world!"]) # had a bug in error printing + # Empty @test_throws ArgumentError stack(()) @test_throws ArgumentError stack([])