@@ -281,19 +281,20 @@ to_index(::MyIndexStyle, axis, arg) = ...
281281```
282282"""
283283@propagate_inbounds to_index (axis, arg) = to_index (IndexStyle (axis), axis, arg)
284- to_index (axis, arg :: CartesianIndices{0} ) = arg
284+
285285# Colons get converted to slices by `indices`
286- to_index (:: IndexStyle , axis, :: Colon ) = indices (axis)
287- @propagate_inbounds function to_index (:: IndexStyle , axis, arg:: Integer )
286+ to_index (:: IndexLinear , axis, arg:: Colon ) = indices (axis)
287+ to_index (:: IndexLinear , axis, arg:: CartesianIndices{0} ) = arg
288+ @propagate_inbounds function to_index (:: IndexLinear , axis, arg:: Integer )
288289 @boundscheck checkbounds (axis, arg)
289290 return Int (arg)
290291end
291- @propagate_inbounds function to_index (:: IndexStyle , axis, arg:: AbstractArray{Bool} )
292+ @propagate_inbounds function to_index (:: IndexLinear , axis, arg:: AbstractArray{Bool} )
292293 @boundscheck checkbounds (axis, arg)
293294 return @inbounds (axis[arg])
294295end
295296@propagate_inbounds function to_index (
296- :: IndexStyle ,
297+ :: IndexLinear ,
297298 axis,
298299 arg:: AbstractArray{I} ,
299300) where {I<: Integer }
303304 return arg
304305end
305306@propagate_inbounds function to_index (
306- :: IndexStyle ,
307+ :: IndexLinear ,
307308 axis,
308309 arg:: AbstractRange{I} ,
309310) where {I<: Integer }
312313 end
313314 return arg
314315end
315- function to_index (S:: IndexStyle , axis, arg:: Any )
316- throw (ArgumentError (" invalid index: IndexStyle $S does not support indices of type $(typeof (arg)) ." ))
316+ function to_index (s, axis, arg)
317+ throw (ArgumentError (" invalid index: IndexStyle $s does not support indices of " *
318+ " type $(typeof (arg)) for axis of type $(typeof (axis)) ." ))
317319end
318320
319321"""
0 commit comments