Skip to content

Commit

Permalink
Deprecate using && and || within at-dot expressions (#26792)
Browse files Browse the repository at this point in the history
Giving us space to allow lowering this to `.&&` and `.||` in the future. Ref #5187.
  • Loading branch information
mbauman authored and JeffBezanson committed Apr 20, 2018
1 parent 9aa32bd commit 23b08c5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions base/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,11 @@ function __dot__(x::Expr)
Meta.isexpr(x.args[1], :call) # function or macro definition
Expr(x.head, x.args[1], dotargs[2])
else
if x.head == :&& || x.head == :||
Base.depwarn("""
using $(x.head) expressions in @. is deprecated; in the future it will
become elementwise. Break the expression into smaller parts instead.""", nothing)
end
head = string(x.head)
if last(head) == '=' && first(head) != '.'
Expr(Symbol('.',head), dotargs...)
Expand Down
3 changes: 2 additions & 1 deletion base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,12 @@ function depwarn(msg, funcsym)
_id=(frame,funcsym),
_group=:depwarn,
caller=caller,
maxlog=1
maxlog=funcsym === nothing ? nothing : 1
)
nothing
end

firstcaller(bt::Vector, ::Nothing) = Ptr{Cvoid}(0), StackTraces.UNKNOWN
firstcaller(bt::Vector, funcsym::Symbol) = firstcaller(bt, (funcsym,))
function firstcaller(bt::Vector, funcsyms)
# Identify the calling line
Expand Down

0 comments on commit 23b08c5

Please sign in to comment.