From 9ce148b1059e4da746a11f1d80a653340216c468 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Mon, 22 Jul 2013 21:41:31 +0200 Subject: Fix unsafe variable tracking in try expressions Variables used in the body of a try expression were marked as unsafe *and* used, which makes no sense as an unsafe variable can't be used. Function vtsubtract/2 is used to forget usage of such unsafe variables. Reported-by: Paul Davis --- lib/stdlib/src/erl_lint.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (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 9284f08b30..708ef44fed 100644 --- a/lib/stdlib/src/erl_lint.erl +++ b/lib/stdlib/src/erl_lint.erl @@ -2108,7 +2108,7 @@ expr({'try',Line,Es,Scs,Ccs,As}, Vt, St0) -> {Evt0,St1} = exprs(Es, Vt, St0), TryLine = {'try',Line}, Uvt = vtunsafe(vtnames(vtnew(Evt0, Vt)), TryLine, []), - Evt1 = vtupdate(Uvt, Evt0), + Evt1 = vtupdate(Uvt, vtsubtract(Evt0, Uvt)), {Sccs,St2} = icrt_clauses(Scs++Ccs, TryLine, vtupdate(Evt1, Vt), St1), Rvt0 = Sccs, Rvt1 = vtupdate(vtunsafe(vtnames(vtnew(Rvt0, Vt)), TryLine, []), Rvt0), -- cgit v1.2.3