diff --git a/Project.toml b/Project.toml index 306d55c6..92d9a791 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "LazyArrays" uuid = "5078a376-72f3-5289-bfd5-ec5146d43c02" -version = "2.2.3" +version = "2.2.4" [deps] ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a" diff --git a/src/lazyconcat.jl b/src/lazyconcat.jl index feeb4030..fc6188fa 100644 --- a/src/lazyconcat.jl +++ b/src/lazyconcat.jl @@ -129,11 +129,13 @@ reverse(f::Vcat{<:Any,1}) = Vcat((reverse(itr) for itr in reverse(f.args))...) const Hcat{T,I<:Tuple} = ApplyArray{T,2,typeof(hcat),I} Hcat(A...) = ApplyArray(hcat, A...) +Hcat() = Hcat{Any}() Hcat{T}(A...) where T = ApplyArray{T}(hcat, A...) @inline applied_eltype(::typeof(hcat), args...) = promote_type(map(eltype,args)...) @inline applied_ndims(::typeof(hcat), args...) = 2 @inline applied_size(::typeof(hcat), args...) = (size(args[1],1), +(map(a -> size(a,2), args)...)) +@inline applied_size(::typeof(hcat)) = (0,0) @inline hcat_getindex(f, k, j::Integer) = hcat_getindex_recursive(f, (k, j), f.args...) diff --git a/test/concattests.jl b/test/concattests.jl index 4b58f2ee..d2804159 100644 --- a/test/concattests.jl +++ b/test/concattests.jl @@ -647,6 +647,11 @@ import LazyArrays: MemoryLayout, DenseColumnMajor, materialize!, call, paddeddat A = Applied(hvcat, 2, A, B, C, D) @test A[1,2] == M[1,2] end + + @testset "1 arg Vcat/Hcat" begin + @test Array(Hcat()) == Array{Any}(undef,0,0) + @test rowsupport(Hcat(Vcat(Zeros(3,1))),1:2) == colsupport(Vcat(Hcat(Zeros(1,3))),1:2) + end end end # module