Skip to content

Commit

Permalink
make non-Bool any and all deprecation depend on values instead of…
Browse files Browse the repository at this point in the history
… eltype
  • Loading branch information
JeffBezanson committed Mar 13, 2016
1 parent f07485f commit 06c93ce
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -804,17 +804,17 @@ nonboolean_warning(f, op, status) = """
"""


@noinline function nonboolean_any(itr)
depwarn(nonboolean_warning(:any, :|, "deprecated"), :nonboolean_any)
#throw(ArgumentError(nonboolean_warning(:any, :|, "not supported")))
reduce(|, itr)
@noinline function or_bool_only(a, b)
depwarn(nonboolean_warning(:any, :|, "deprecated"), :or_bool_only)
a|b
end
or_bool_only(a::Bool, b::Bool) = a|b

@noinline function nonboolean_all(itr)
depwarn(nonboolean_warning(:all, :&, "deprecated"), :nonboolean_all)
#throw(ArgumentError(nonboolean_warning(:all, :&, "not supported")))
reduce(&, itr)
@noinline function and_bool_only(a, b)
depwarn(nonboolean_warning(:all, :&, "deprecated"), :and_bool_only)
a&b
end
and_bool_only(a::Bool, b::Bool) = a&b

@deprecate iseltype(x,T) eltype(x) <: T

Expand Down
4 changes: 2 additions & 2 deletions base/reduce.jl
Original file line number Diff line number Diff line change
Expand Up @@ -363,14 +363,14 @@ any(f::Predicate, itr) = mapreduce_sc_impl(f, OrFun(), itr)
any(f::IdFun, itr) =
eltype(itr) <: Bool ?
mapreduce_sc_impl(f, OrFun(), itr) :
nonboolean_any(itr)
reduce(or_bool_only, itr)

all(f::Any, itr) = all(Predicate(f), itr)
all(f::Predicate, itr) = mapreduce_sc_impl(f, AndFun(), itr)
all(f::IdFun, itr) =
eltype(itr) <: Bool ?
mapreduce_sc_impl(f, AndFun(), itr) :
nonboolean_all(itr)
reduce(and_bool_only, itr)

## in & contains

Expand Down

0 comments on commit 06c93ce

Please sign in to comment.