From 23b08c5c5cd3ec85ad6d81b741656ce27a7f2053 Mon Sep 17 00:00:00 2001 From: Matt Bauman Date: Fri, 20 Apr 2018 13:44:27 -0500 Subject: [PATCH] Deprecate using && and || within at-dot expressions (#26792) Giving us space to allow lowering this to `.&&` and `.||` in the future. Ref #5187. --- base/broadcast.jl | 5 +++++ base/deprecated.jl | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/base/broadcast.jl b/base/broadcast.jl index d5e0dca95315c..55dd8313172b0 100644 --- a/base/broadcast.jl +++ b/base/broadcast.jl @@ -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...) diff --git a/base/deprecated.jl b/base/deprecated.jl index 2924b8834a8a4..ec73aa06b4950 100644 --- a/base/deprecated.jl +++ b/base/deprecated.jl @@ -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