@@ -244,6 +244,15 @@ BlockArrays.blockindex(b::GenericBlockIndex{1}) = b.α[1]
244244function GenericBlockIndex (indcs:: Tuple{Vararg{GenericBlockIndex{1},N}} ) where {N}
245245 GenericBlockIndex (block .(indcs), blockindex .(indcs))
246246end
247+
248+ function Base. checkindex (
249+ :: Type{Bool} , axis:: AbstractBlockedUnitRange , ind:: GenericBlockIndex{1}
250+ )
251+ return checkindex (Bool, axis, block (ind)) &&
252+ checkbounds (Bool, axis[block (ind)], blockindex (ind))
253+ end
254+ Base. to_index (i:: GenericBlockIndex ) = i
255+
247256function print_tuple_elements (io:: IO , @nospecialize (t))
248257 if ! isempty (t)
249258 print (io, t[1 ])
@@ -261,6 +270,13 @@ function Base.show(io::IO, B::GenericBlockIndex)
261270 return nothing
262271end
263272
273+ # https://github.com/JuliaArrays/BlockArrays.jl/blob/v1.6.3/src/views.jl#L31-L32
274+ _maybetail (:: Tuple{} ) = ()
275+ _maybetail (t:: Tuple ) = Base. tail (t)
276+ @inline function Base. to_indices (A, inds, I:: Tuple{GenericBlockIndex{1},Vararg{Any}} )
277+ return (inds[1 ][I[1 ]], to_indices (A, _maybetail (inds), Base. tail (I))... )
278+ end
279+
264280using Base: @propagate_inbounds
265281@propagate_inbounds function Base. getindex (b:: AbstractVector , K:: GenericBlockIndex{1} )
266282 return b[Block (K. I[1 ])][K. α[1 ]]
0 commit comments