Skip to content

Commit 0f7c89f

Browse files
committed
Move or_bool_only, and_bool_only to base/reduce.jl, ref #11774
So these will now give MethodError for non boolean input
1 parent f61ea53 commit 0f7c89f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

base/reduce.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -387,19 +387,21 @@ end
387387
any(itr) = any(identity, itr)
388388
all(itr) = all(identity, itr)
389389

390-
any(f::Any, itr) = any(Predicate(f), itr)
390+
any(f::Any, itr) = any(Predicate(f), itr)
391391
any(f::Predicate, itr) = mapreduce_sc_impl(f, |, itr)
392-
any(f::typeof(identity), itr) =
392+
any(f::typeof(identity), itr) =
393393
eltype(itr) <: Bool ?
394394
mapreduce_sc_impl(f, |, itr) :
395395
reduce(or_bool_only, itr)
396+
or_bool_only(a::Bool, b::Bool) = a | b
396397

397-
all(f::Any, itr) = all(Predicate(f), itr)
398+
all(f::Any, itr) = all(Predicate(f), itr)
398399
all(f::Predicate, itr) = mapreduce_sc_impl(f, &, itr)
399-
all(f::typeof(identity), itr) =
400+
all(f::typeof(identity), itr) =
400401
eltype(itr) <: Bool ?
401402
mapreduce_sc_impl(f, &, itr) :
402403
reduce(and_bool_only, itr)
404+
and_bool_only(a::Bool, b::Bool) = a & b
403405

404406
## in & contains
405407

0 commit comments

Comments
 (0)