Skip to content

Commit 31d4c22

Browse files
authored
Improve dispatch of findall(testf::F, A::AbstractArray) (#46553)
This prevents some invalidations in `mightalias(A::AbstractArray, B::AbstractArray)` in abstractarray.jl when loading Static.jl. Here we specialize on the function instead of using map since `broadcasting` returns a BitArray, `map` returns a Vector{Bool}.
1 parent 305e2fb commit 31d4c22

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

base/array.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2325,7 +2325,7 @@ findall(testf::Function, A) = collect(first(p) for p in pairs(A) if testf(last(p
23252325

23262326
# Broadcasting is much faster for small testf, and computing
23272327
# integer indices from logical index using findall has a negligible cost
2328-
findall(testf::Function, A::AbstractArray) = findall(testf.(A))
2328+
findall(testf::F, A::AbstractArray) where {F<:Function} = findall(testf.(A))
23292329

23302330
"""
23312331
findall(A)

0 commit comments

Comments
 (0)