diff --git a/src/vector_of_array.jl b/src/vector_of_array.jl index cc335297..7c3a1c75 100644 --- a/src/vector_of_array.jl +++ b/src/vector_of_array.jl @@ -304,6 +304,11 @@ Base.@propagate_inbounds function _getindex(A::AbstractVectorOfArray{T, N}, return Adapt.adapt(__parameterless_type(T), reshape(reduce(hcat, vecs), size(A.u[1])..., length(A.u))) end +Base.@propagate_inbounds function _getindex(A::AbstractVectorOfArray{T, N}, + ::NotSymbolic, I::Colon...) where {T <: Number, N} + @assert length(I) == ndims(A.u) + return A.u[I...] +end Base.@propagate_inbounds function _getindex(A::AbstractVectorOfArray{T, N}, ::NotSymbolic, I::AbstractArray{Bool}, diff --git a/test/basic_indexing.jl b/test/basic_indexing.jl index 749f7419..c301dd6f 100644 --- a/test/basic_indexing.jl +++ b/test/basic_indexing.jl @@ -257,3 +257,6 @@ foo!(u_vector) # test efficiency num_allocs = @allocations foo!(u_matrix) @test num_allocs == 0 + +# issue 354 +@test VectorOfArray(ones(1))[:] == ones(1)