Skip to content

Commit

Permalink
Remove specialized IndexStyle method for SubArray (#53726)
Browse files Browse the repository at this point in the history
The fallback method `IndexStyle(::Type{<:AbstractArray})` does the same,
so this is unnecessary.
  • Loading branch information
jishnub authored Mar 14, 2024
1 parent 8287943 commit b507330
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 1 deletion.
1 change: 0 additions & 1 deletion base/subarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,6 @@ function _unsetindex!(V::SubArray{T,N}, i::Vararg{Int,N}) where {T,N}
end

IndexStyle(::Type{<:FastSubArray}) = IndexLinear()
IndexStyle(::Type{<:SubArray}) = IndexCartesian()

# Strides are the distance in memory between adjacent elements in a given dimension
# which we determine from the strides of the parent
Expand Down
1 change: 1 addition & 0 deletions test/subarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ end
A = copy(reshape(1:120, 3, 5, 8))
sA = view(A, 2:2, 1:5, :)
@test @inferred(strides(sA)) == (1, 3, 15)
@test IndexStyle(sA) == IndexStyle(typeof(sA)) == IndexCartesian()
@test parent(sA) == A
@test parentindices(sA) == (2:2, 1:5, Base.Slice(1:8))
@test size(sA) == (1, 5, 8)
Expand Down

0 comments on commit b507330

Please sign in to comment.