diff options
author | Björn Gustavsson <[email protected]> | 2018-11-21 05:55:12 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2018-11-21 06:10:16 +0100 |
commit | df0ce3328e4ac64c0bd82fb10a879d4f0732b261 (patch) | |
tree | c94dcb451c6ce1490641a70a5d41fa0b411e804e /lib/stdlib/src/erl_lint.erl | |
parent | c0812d51fbb550d4a53df128e4ec322746f015ca (diff) | |
download | otp-df0ce3328e4ac64c0bd82fb10a879d4f0732b261.tar.gz otp-df0ce3328e4ac64c0bd82fb10a879d4f0732b261.tar.bz2 otp-df0ce3328e4ac64c0bd82fb10a879d4f0732b261.zip |
Fix inadvertently suppressed warning for unused variable
An external fun could inadvertently suppress warnings for
unused variables, such as in this example:
bug() ->
BugVar = foo(),
if true ->
fun m:f/1
end.
There would be no warning that `BugVar` was unused.
The bug was introduced in ff432e262e652, which was the commit
that extended external funs to allow variables.
https://bugs.erlang.org/browse/ERL-762
Diffstat (limited to 'lib/stdlib/src/erl_lint.erl')
-rw-r--r-- | lib/stdlib/src/erl_lint.erl | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/stdlib/src/erl_lint.erl b/lib/stdlib/src/erl_lint.erl index e9ac2fcdff..e0cd68617b 100644 --- a/lib/stdlib/src/erl_lint.erl +++ b/lib/stdlib/src/erl_lint.erl @@ -2262,8 +2262,7 @@ expr({'fun',Line,Body}, Vt, St) -> {[],St}; {function,M,F,A} -> %% New in R15. - {Bvt, St1} = expr_list([M,F,A], Vt, St), - {vtupdate(Bvt, Vt),St1} + expr_list([M,F,A], Vt, St) end; expr({named_fun,_,'_',Cs}, Vt, St) -> fun_clauses(Cs, Vt, St); |