Skip to content

Commit 430df6e

Browse files
chethegaKristofferC
authored andcommitted
help type inference for logical indexing (#29633)
(cherry picked from commit aa72f72)
1 parent 6d3120c commit 430df6e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

base/multidimensional.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,10 @@ end
514514
# We're looking for the n-th true element, using iterator r at state i
515515
n = s[1]
516516
n > length(L) && return nothing
517+
#unroll once to help inference, cf issue #29418
518+
idx, i = iterate(tail(s)...)
519+
s = (n+1, s[2], i)
520+
L.mask[idx] && return (idx, s)
517521
while true
518522
idx, i = iterate(tail(s)...)
519523
s = (n+1, s[2], i)

0 commit comments

Comments
 (0)