Skip to content

Commit c933e3a

Browse files
oscardssmithChrisRackauckas
authored andcommitted
make A[:, end] error for ragged AbstractVectorOfArray when the lengths are not equal
1 parent 647eab7 commit c933e3a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/vector_of_array.jl

+7
Original file line numberDiff line numberDiff line change
@@ -544,3 +544,10 @@ end
544544
end
545545
unpack_args_voa(i, args::Tuple{Any}) = (unpack_voa(args[1], i),)
546546
unpack_args_voa(::Any, args::Tuple{}) = ()
547+
548+
function Base.lastindex(A::AbstractVectorOfArray, i=1)
549+
i == 1 && return length(A)
550+
len1 = lastindex(A[1], i-1)
551+
all(x->isequal(lastindex(x, i-1), len1), A) && return len1
552+
throw(ArgumentError("Can not get lastindex of an AbstractVectorOfArray for dimensions other than 1"))
553+
end

0 commit comments

Comments
 (0)