diff options
author | Björn Gustavsson <[email protected]> | 2012-08-13 10:09:48 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2012-08-15 10:54:52 +0200 |
commit | 6cdc6b667a8db2b63a4613c63dc4f75a34a5ea7f (patch) | |
tree | 506c68241e387fe5b569f5a1fcad85e416fee317 /lib/stdlib/test/qlc_SUITE.erl | |
parent | ee5fdd50040894b27fd3fe9e767eab3821666e9a (diff) | |
download | otp-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/test/qlc_SUITE.erl')
-rw-r--r-- | lib/stdlib/test/qlc_SUITE.erl | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/stdlib/test/qlc_SUITE.erl b/lib/stdlib/test/qlc_SUITE.erl index 1e74ad7727..192268f90e 100644 --- a/lib/stdlib/test/qlc_SUITE.erl +++ b/lib/stdlib/test/qlc_SUITE.erl @@ -2969,12 +2969,14 @@ lookup1(Config) when is_list(Config) -> [3] = lookup_keys(Q) end, [{1,a},{3,3}])">>, + {cres, <<"A = 3, etsc(fun(E) -> Q = qlc:q([X || X <- ets:table(E), A =:= {erlang,element}(1, X)]), [{3,3}] = qlc:e(Q), [3] = lookup_keys(Q) end, [{1,a},{3,3}])">>, + {warnings,[{3,erl_lint,deprecated_tuple_fun}]}}, <<"etsc(fun(E) -> A = 3, @@ -3439,12 +3441,14 @@ lookup2(Config) when is_list(Config) -> [r] = qlc:e(Q), [r] = lookup_keys(Q) end, [{keypos,1}], [#r{}])">>, + {cres, <<"etsc(fun(E) -> Q = qlc:q([element(1, X) || X <- ets:table(E), {erlang,is_record}(X, r, 2)]), [r] = qlc:e(Q), [r] = lookup_keys(Q) end, [{keypos,1}], [#r{}])">>, + {warnings,[{4,erl_lint,deprecated_tuple_fun}]}}, {cres, <<"etsc(fun(E) -> Q = qlc:q([element(1, X) || X <- ets:table(E), @@ -3465,12 +3469,14 @@ lookup2(Config) when is_list(Config) -> [r] = qlc:e(Q), [r] = lookup_keys(Q) end, [{keypos,1}], [#r{}])">>, + {cres, <<"etsc(fun(E) -> Q = qlc:q([element(1, X) || X <- ets:table(E), {erlang,is_record}(X, r)]), [r] = qlc:e(Q), [r] = lookup_keys(Q) - end, [{keypos,1}], [#r{}])">> + end, [{keypos,1}], [#r{}])">>, + {warnings,[{4,erl_lint,deprecated_tuple_fun}]}} ], ?line run(Config, <<"-record(r, {a}).\n">>, TsR), |