Skip to content

Commit c060f73

Browse files
committed
properly fixed views of zero-dimensional arrays
1 parent e0bb770 commit c060f73

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/indexing.jl

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -378,9 +378,6 @@ Base.unsafe_view(A::AbstractArray, i1::StaticIndexing, indices::StaticIndexing..
378378
# Additionally, in some cases the SubArray constructor may be called directly
379379
# instead of unsafe_view so we need this method too (Base._maybe_reindex
380380
# is a good example)
381-
Base.SubArray(A::AbstractArray, indices::NTuple{<:Any,StaticIndexing}) = Base.SubArray(A, map(unwrap, indices))
382-
# this method is defined to prevent infinite recursion when viewing a
383-
# zero-dimensional array (see issue #705)
384-
function Base.SubArray(A::AbstractArray, indices::Tuple{})
385-
return invoke(Base.SubArray, Tuple{AbstractArray, Tuple}, A, indices)
386-
end
381+
# the tuple indices has to have at least one element to prevent infinite
382+
# recursion when viewing a zero-dimensional array (see issue #705)
383+
Base.SubArray(A::AbstractArray, indices::Tuple{StaticIndexing, Vararg{StaticIndexing}}) = Base.SubArray(A, map(unwrap, indices))

0 commit comments

Comments
 (0)