aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src/erl_lint.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2012-08-13 10:09:48 +0200
committerBjörn Gustavsson <[email protected]>2012-08-15 10:54:52 +0200
commit6cdc6b667a8db2b63a4613c63dc4f75a34a5ea7f (patch)
tree506c68241e387fe5b569f5a1fcad85e416fee317 /lib/stdlib/src/erl_lint.erl
parentee5fdd50040894b27fd3fe9e767eab3821666e9a (diff)
downloadotp-6cdc6b667a8db2b63a4613c63dc4f75a34a5ea7f.tar.gz
otp-6cdc6b667a8db2b63a4613c63dc4f75a34a5ea7f.tar.bz2
otp-6cdc6b667a8db2b63a4613c63dc4f75a34a5ea7f.zip
erl_lint: Add a deprecated warning for literal tuple funs
The run-time warning for use of tuple funs will not catch the use of literal tuple funs, such as: if {erlang,'+'}(3,X) =:= 0 -> true; true -> false end. Therefore, add a compile-time warning to give users some warning before they stop working in R16.
Diffstat (limited to 'lib/stdlib/src/erl_lint.erl')
-rw-r--r--lib/stdlib/src/erl_lint.erl5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/stdlib/src/erl_lint.erl b/lib/stdlib/src/erl_lint.erl
index abab81d31f..648ff349a4 100644
--- a/lib/stdlib/src/erl_lint.erl
+++ b/lib/stdlib/src/erl_lint.erl
@@ -248,6 +248,8 @@ format_error({illegal_guard_local_call, {F,A}}) ->
io_lib:format("call to local/imported function ~w/~w is illegal in guard",
[F,A]);
format_error(illegal_guard_expr) -> "illegal guard expression";
+format_error(deprecated_tuple_fun) ->
+ "tuple funs are deprecated and will be removed in R16";
%% --- exports ---
format_error({explicit_export,F,A}) ->
io_lib:format("in this release, the call to ~w/~w must be written "
@@ -1914,7 +1916,8 @@ gexpr({call,Line,{remote,_Lr,{atom,_Lm,erlang},{atom,_Lf,F}},As}, Vt, St0) ->
true -> {Asvt,St1};
false -> {Asvt,add_error(Line, illegal_guard_expr, St1)}
end;
-gexpr({call,L,{tuple,Lt,[{atom,Lm,erlang},{atom,Lf,F}]},As}, Vt, St) ->
+gexpr({call,L,{tuple,Lt,[{atom,Lm,erlang},{atom,Lf,F}]},As}, Vt, St0) ->
+ St = add_warning(L, deprecated_tuple_fun, St0),
gexpr({call,L,{remote,Lt,{atom,Lm,erlang},{atom,Lf,F}},As}, Vt, St);
gexpr({op,Line,Op,A}, Vt, St0) ->
{Avt,St1} = gexpr(A, Vt, St0),