diff options
author | Anthony Ramine <[email protected]> | 2013-07-31 10:31:51 +0200 |
---|---|---|
committer | Fredrik Gustafsson <[email protected]> | 2013-08-27 16:15:21 +0200 |
commit | 92460f4035e369be8726c88a72055d0fd6c7cdfe (patch) | |
tree | e6d413e13ba3ddf5b5baf42e1d79105b8dbdc92c /lib/stdlib/test/erl_lint_SUITE.erl | |
parent | 9ce148b1059e4da746a11f1d80a653340216c468 (diff) | |
download | otp-92460f4035e369be8726c88a72055d0fd6c7cdfe.tar.gz otp-92460f4035e369be8726c88a72055d0fd6c7cdfe.tar.bz2 otp-92460f4035e369be8726c88a72055d0fd6c7cdfe.zip |
Fix variable usage tracking in some record errors
When reporting a field redefinition in a record, erl_lint can forget
about some old unused variables.
f() -> X = 1, #r{a=foo,a=bar,a=qux}.
Diffstat (limited to 'lib/stdlib/test/erl_lint_SUITE.erl')
-rw-r--r-- | lib/stdlib/test/erl_lint_SUITE.erl | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/stdlib/test/erl_lint_SUITE.erl b/lib/stdlib/test/erl_lint_SUITE.erl index a1a9839bae..48ddeac478 100644 --- a/lib/stdlib/test/erl_lint_SUITE.erl +++ b/lib/stdlib/test/erl_lint_SUITE.erl @@ -560,7 +560,15 @@ unused_vars_warn_rec(Config) when is_list(Config) -> {warnings,[{2,erl_lint,{unused_var,'X'}}, {3,erl_lint,{unused_var,'X'}}, {5,erl_lint,{unused_var,'X'}}, - {7,erl_lint,{unused_var,'X'}}]}}], + {7,erl_lint,{unused_var,'X'}}]}}, + {rec3, + <<"-record(r, {a}). + t() -> X = 1, #r{a=foo, a=bar, a=qux}. + ">>, + [warn_unused_vars], + {error,[{2,erl_lint,{redefine_field,r,a}}, + {2,erl_lint,{redefine_field,r,a}}], + [{2,erl_lint,{unused_var,'X'}}]}}], ?line [] = run(Config, Ts), ok. |