aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/test/erl_lint_SUITE.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2013-12-13 11:51:25 +0100
committerBjörn Gustavsson <[email protected]>2013-12-13 11:51:25 +0100
commitfa6407f35c12156a9ed2eb25fb131e1ef5c7f0e4 (patch)
tree86f2b4178f0a15e33d300cf648a0b235252b9990 /lib/stdlib/test/erl_lint_SUITE.erl
parentaf17798534de376505498b86525ab8618753ebf7 (diff)
parent4df233adc5a1d5ab54d3c7419a463ae1ef417c12 (diff)
downloadotp-fa6407f35c12156a9ed2eb25fb131e1ef5c7f0e4.tar.gz
otp-fa6407f35c12156a9ed2eb25fb131e1ef5c7f0e4.tar.bz2
otp-fa6407f35c12156a9ed2eb25fb131e1ef5c7f0e4.zip
Merge branch 'nox/eep37/OTP-11537'
* nox/eep37/OTP-11537: Support EEP37 named funs in emacs erlang-mode Document named fun expressions Test named funs Support named funs in the debugger interpreter Update primary bootstrap for named funs in the shell Support named funs in the shell Update primary bootstrap for named funs EEP 37: Funs with names Support non top level letrecs in dialyzer
Diffstat (limited to 'lib/stdlib/test/erl_lint_SUITE.erl')
-rw-r--r--lib/stdlib/test/erl_lint_SUITE.erl60
1 files changed, 57 insertions, 3 deletions
diff --git a/lib/stdlib/test/erl_lint_SUITE.erl b/lib/stdlib/test/erl_lint_SUITE.erl
index 6bf87adf14..a71d7f3018 100644
--- a/lib/stdlib/test/erl_lint_SUITE.erl
+++ b/lib/stdlib/test/erl_lint_SUITE.erl
@@ -575,7 +575,7 @@ unused_vars_warn_rec(Config) when is_list(Config) ->
ok.
unused_vars_warn_fun(doc) ->
- "Warnings for unused variables in records.";
+ "Warnings for unused variables in funs.";
unused_vars_warn_fun(suite) -> [];
unused_vars_warn_fun(Config) when is_list(Config) ->
Ts = [{fun1,
@@ -643,7 +643,60 @@ unused_vars_warn_fun(Config) when is_list(Config) ->
{22,erl_lint,{unused_var,'U'}},
{24,erl_lint,{unused_var,'U'}},
{26,erl_lint,{unused_var,'U'}},
- {26,erl_lint,{shadowed_var,'U','fun'}}]}}
+ {26,erl_lint,{shadowed_var,'U','fun'}}]}},
+ {named_fun,
+ <<"u() ->
+ fun U() -> foo end, % U unused.
+ U; % U unbound.
+ u() ->
+ case foo of
+ true ->
+ U = 2;
+ false ->
+ true
+ end,
+ fun U() -> foo end, % U unused.
+ U; % U unsafe.
+ u() ->
+ case foo of
+ true ->
+ U = 2;
+ false ->
+ U = 3
+ end,
+ fun U() -> foo end, % U shadowed. U unused.
+ U;
+ u() ->
+ case foo of
+ true ->
+ U = 2; % U unused.
+ false ->
+ U = 3 % U unused.
+ end,
+ fun U() -> foo end; % U shadowed. U unused.
+ u() ->
+ fun U(U) -> foo end; % U shadowed. U unused.
+ u() ->
+ fun U(1) -> U; U(U) -> foo end; % U shadowed. U unused.
+ u() ->
+ fun _(N) -> N + 1 end. % Cover handling of '_' name.
+ ">>,
+ [warn_unused_vars],
+ {error,[{3,erl_lint,{unbound_var,'U'}},
+ {12,erl_lint,{unsafe_var,'U',{'case',5}}}],
+ [{2,erl_lint,{unused_var,'U'}},
+ {11,erl_lint,{unused_var,'U'}},
+ {20,erl_lint,{unused_var,'U'}},
+ {20,erl_lint,{shadowed_var,'U','named fun'}},
+ {25,erl_lint,{unused_var,'U'}},
+ {27,erl_lint,{unused_var,'U'}},
+ {29,erl_lint,{unused_var,'U'}},
+ {29,erl_lint,{shadowed_var,'U','named fun'}},
+ {31,erl_lint,{unused_var,'U'}},
+ {31,erl_lint,{unused_var,'U'}},
+ {31,erl_lint,{shadowed_var,'U','fun'}},
+ {33,erl_lint,{unused_var,'U'}},
+ {33,erl_lint,{shadowed_var,'U','fun'}}]}}
],
?line [] = run(Config, Ts),
ok.
@@ -2201,7 +2254,8 @@ otp_5878(Config) when is_list(Config) ->
<<"-record(r1, {t = case foo of _ -> 3 end}).
-record(r2, {a = case foo of A -> A; _ -> 3 end}).
-record(r3, {a = case foo of A -> A end}).
- t() -> {#r1{},#r2{},#r3{}}.
+ -record(r4, {a = fun _AllowedFunName() -> allowed end}).
+ t() -> {#r1{},#r2{},#r3{},#r4{}}.
">>,
[warn_unused_record],
{errors,[{2,erl_lint,{variable_in_record_def,'A'}},