aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2015-02-25 11:44:50 +0100
committerBjörn Gustavsson <[email protected]>2015-02-25 11:44:50 +0100
commit1eaa36a4200f70be7db48de214fce3c3aacee090 (patch)
tree2d7b252fca47ee86241355b108ac537f634fa85d /lib/stdlib
parent54d2eee83c75fc257b9934eb2e4f2069983b4eb2 (diff)
parent250f4c0453f038f9014705eed966d6c9cb186a1a (diff)
downloadotp-1eaa36a4200f70be7db48de214fce3c3aacee090.tar.gz
otp-1eaa36a4200f70be7db48de214fce3c3aacee090.tar.bz2
otp-1eaa36a4200f70be7db48de214fce3c3aacee090.zip
Merge branch 'nox/stdlib/erl_lint-maps/OTP-12515'
* nox/stdlib/erl_lint-maps/OTP-12515: Properly lint map expressions in erl_lint
Diffstat (limited to 'lib/stdlib')
-rw-r--r--lib/stdlib/src/erl_lint.erl4
-rw-r--r--lib/stdlib/test/erl_lint_SUITE.erl8
2 files changed, 9 insertions, 3 deletions
diff --git a/lib/stdlib/src/erl_lint.erl b/lib/stdlib/src/erl_lint.erl
index dabedff0d4..cbe6eeec3c 100644
--- a/lib/stdlib/src/erl_lint.erl
+++ b/lib/stdlib/src/erl_lint.erl
@@ -2291,8 +2291,8 @@ map_fields([{Tag,_,K,V}|Fs], Vt, St, F) when Tag =:= map_field_assoc;
{Pvt,St2} = F([K,V], Vt, St),
{Vts,St3} = map_fields(Fs, Vt, St2, F),
{vtupdate(Pvt, Vts),St3};
-map_fields([], Vt, St, _) ->
- {Vt,St}.
+map_fields([], _, St, _) ->
+ {[],St}.
%% warn_invalid_record(Line, Record, State0) -> State
%% Adds warning if the record is invalid.
diff --git a/lib/stdlib/test/erl_lint_SUITE.erl b/lib/stdlib/test/erl_lint_SUITE.erl
index f8a99f653a..a7c3fd3c2e 100644
--- a/lib/stdlib/test/erl_lint_SUITE.erl
+++ b/lib/stdlib/test/erl_lint_SUITE.erl
@@ -3708,7 +3708,13 @@ maps(Config) ->
">>,
[],
{errors,[{4,erl_lint,illegal_map_construction},
- {6,erl_lint,illegal_map_key}],[]}}],
+ {6,erl_lint,illegal_map_key}],[]}},
+ {unused_vars_with_empty_maps,
+ <<"t(Foo, Bar, Baz) -> {#{},#{}}.">>,
+ [warn_unused_variables],
+ {warnings,[{1,erl_lint,{unused_var,'Bar'}},
+ {1,erl_lint,{unused_var,'Baz'}},
+ {1,erl_lint,{unused_var,'Foo'}}]}}],
[] = run(Config, Ts),
ok.