@@ -1582,19 +1582,23 @@ end
15821582 end
15831583end
15841584
1585- isassigned (a:: AbstractArray , i:: CartesianIndex ) = isassigned (a, Tuple (i)... )
1586- function isassigned (A:: AbstractArray , i:: Union{Integer, CartesianIndex} ...)
1587- isa (i, Tuple{Vararg{Int}}) || return isassigned (A, CartesianIndex (to_indices (A, i)))
1588- @boundscheck checkbounds (Bool, A, i... ) || return false
1585+ @propagate_inbounds isassigned (A:: AbstractArray , i:: CartesianIndex ) = isassigned (A, Tuple (i)... )
1586+ @propagate_inbounds function isassigned (A:: AbstractArray , i:: Union{Integer, CartesianIndex} ...)
1587+ return isassigned (A, CartesianIndex (to_indices (A, i)))
1588+ end
1589+ @inline function isassigned (A:: AbstractArray , i:: Integer... )
1590+ # convert to valid indices, checking for Bool
1591+ inds = to_indices (A, i)
1592+ @boundscheck checkbounds (Bool, A, inds... ) || return false
15891593 S = IndexStyle (A)
1590- ninds = length (i )
1594+ ninds = length (inds )
15911595 if (isa (S, IndexLinear) && ninds != 1 )
1592- return @inbounds isassigned (A, _to_linear_index (A, i ... ))
1596+ return @inbounds isassigned (A, _to_linear_index (A, inds ... ))
15931597 elseif (! isa (S, IndexLinear) && ninds != ndims (A))
1594- return @inbounds isassigned (A, _to_subscript_indices (A, i ... )... )
1598+ return @inbounds isassigned (A, _to_subscript_indices (A, inds ... )... )
15951599 else
15961600 try
1597- A[i ... ]
1601+ A[inds ... ]
15981602 true
15991603 catch e
16001604 if isa (e, BoundsError) || isa (e, UndefRefError)
0 commit comments