From df0ce3328e4ac64c0bd82fb10a879d4f0732b261 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Wed, 21 Nov 2018 05:55:12 +0100 Subject: 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 --- lib/stdlib/src/erl_lint.erl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lib/stdlib/src/erl_lint.erl') 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); -- cgit v1.2.3