@@ -1582,19 +1582,23 @@ end
1582
1582
end
1583
1583
end
1584
1584
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
1589
1593
S = IndexStyle (A)
1590
- ninds = length (i )
1594
+ ninds = length (inds )
1591
1595
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 ... ))
1593
1597
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 ... )... )
1595
1599
else
1596
1600
try
1597
- A[i ... ]
1601
+ A[inds ... ]
1598
1602
true
1599
1603
catch e
1600
1604
if isa (e, BoundsError) || isa (e, UndefRefError)
0 commit comments