diff --git a/src/vector_of_array.jl b/src/vector_of_array.jl index 3d6ec7c0..2c13a573 100644 --- a/src/vector_of_array.jl +++ b/src/vector_of_array.jl @@ -609,6 +609,7 @@ function Base.check_parent_index_match( nothing end Base.ndims(::AbstractVectorOfArray{T, N}) where {T, N} = N +Base.ndims(::Type{<:AbstractVectorOfArray{T, N}}) where {T, N} = N function Base.checkbounds( ::Type{Bool}, VA::AbstractVectorOfArray{T, N, <:AbstractVector{T}}, diff --git a/test/interface_tests.jl b/test/interface_tests.jl index e8790a09..51b92a30 100644 --- a/test/interface_tests.jl +++ b/test/interface_tests.jl @@ -50,6 +50,10 @@ push!(testda, [-1, -2, -3, -4]) @test testda[:, 9] == [-1, -2, -3, -4] @test testda[:, end] == [-1, -2, -3, -4] +# ndims +@test ndims(testva) == 2 +@test ndims(typeof(testva)) == 2 + # Currently we enforce the general shape, they can just be different lengths, ie we # can't do # Decide if this is desired, or remove this restriction