From 6aa28e4aa521d241b0f574be5ec580853000d597 Mon Sep 17 00:00:00 2001 From: Rafael Schouten Date: Sat, 17 Aug 2024 03:49:20 +0200 Subject: [PATCH] fix cat on empty arrays (#768) --- src/array/methods.jl | 1 + test/methods.jl | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/src/array/methods.jl b/src/array/methods.jl index da5ee0e82..b6ce99b14 100644 --- a/src/array/methods.jl +++ b/src/array/methods.jl @@ -422,6 +422,7 @@ function _check_cat_lookups(D, ::Irregular, lookups...) end function _check_cat_lookup_order(D, lookups::Lookup...) + length(lookups) > 1 || return true l1 = first(lookups) length(l1) == 0 && return _check_cat_lookup_order(D, Base.tail(lookups)...) L = basetypeof(l1) diff --git a/test/methods.jl b/test/methods.jl index e91579ccf..e5b6dff1e 100644 --- a/test/methods.jl +++ b/test/methods.jl @@ -545,6 +545,13 @@ end @test c == b @test dims(c) == dims(b) end + + @testset "empty DimArrays" begin + empty = rand(X(Int64[])) + @test cat(empty, empty, dims=X) == empty + empty = rand(X(Int64[]), Y(Int64[])) + @test cat(empty, empty, dims=X) == empty + end end @testset "vcat" begin