7575@inline index_size (:: Size , :: Int ) = Size ()
7676@inline index_size (:: Size , a:: StaticArray ) = Size (a)
7777@inline index_size (s:: Size , :: Colon ) = s
78- @inline index_size (s :: Size , a:: SOneTo{n } ) where n = Size (n ,)
78+ @inline index_size (:: Size , a:: AbstractRange{<:Integer } ) = Size (length (a) ,)
7979
8080@inline index_sizes (:: S , inds... ) where {S<: Size } = map (index_size, unpack_size (S), inds)
8181
@@ -92,9 +92,9 @@ linear_index_size(ind_sizes::Type{<:Size}...) = _linear_index_size((), ind_sizes
9292@inline _linear_index_size (t:: Tuple , :: Type{Size{S}} , ind_sizes... ) where {S} = _linear_index_size ((t... , prod (S)), ind_sizes... )
9393
9494_ind (i:: Int , :: Int , :: Type{Int} ) = :(inds[$ i])
95- _ind (i:: Int , j:: Int , :: Type{<:StaticArray} ) = :(inds[$ i][$ j])
9695_ind (i:: Int , j:: Int , :: Type{Colon} ) = j
9796_ind (i:: Int , j:: Int , :: Type{<:SOneTo} ) = j
97+ _ind (i:: Int , j:: Int , :: Type{<:AbstractArray} ) = :(inds[$ i][$ j])
9898
9999# ###############################
100100# # Non-scalar linear indexing ##
215215
216216# getindex
217217
218- @propagate_inbounds function getindex (a:: StaticArray , inds:: Union{Int, StaticArray{<:Tuple, Int}, SOneTo , Colon} ...)
218+ @propagate_inbounds function getindex (a:: StaticArray , inds:: Union{Int, StaticArray{<:Tuple, Int}, AbstractRange , Colon} ...)
219219 _getindex (a, index_sizes (Size (a), inds... ), inds)
220220end
221221
0 commit comments