[erlang-bugs] Regression? No warning on unused variable in try part of try..catch

Magnus Müller mamuelle@REDACTED
Sun Nov 3 17:33:23 CET 2013


Hello,


R16B02 does not output a warning when a variable within try..catch is
unused. Example:

-module(try_catch).
-export([no_warning/0]).

no_warning() ->
    try X = 1
    catch _:_ -> ok
    end.

$ erlc try_catch.erl 
evnu@REDACTED:~/src/erlang/otp/bugs/R16B02
$ echo $?
0

In R15B03, a warning is written:

$ erlc try_catch.erl 
try_catch.erl:5: Warning: variable 'X' is unused


I tried the above with the `master` branch as well:

$ git log --oneline | head -n1
69a0e01 Merge branch 'maint
$ bin/erl
Erlang R17A (erts-5.11) [source-69a0e01] [64-bit] [smp:4:4]
[async-threads:10] [hipe] [kernel-poll:false]

Eshell V5.11  (abort with ^G)
1> c("../bugs/R16B02/try_catch.erl").
{ok,try_catch}


Magnus



More information about the erlang-bugs mailing list