[erlang-bugs] Dialyzer fails to detect unused variables in R16B03

Anthony Ramine n.oxyde@REDACTED
Wed May 21 22:38:26 CEST 2014


$ bin/erlc warning_test.erl
warning_test.erl:6: Warning: variable 'W' is unused

-- 
Anthony Ramine

Le 21 mai 2014 à 22:33, Anthony Ramine <n.oxyde@REDACTED> a écrit :

> I’m currently recompiling Erlang on https://github.com/erlang/otp/pull/296 because I suspect it fixes that bug too.
> 
> Will confirm later.
> 
> -- 
> Anthony Ramine
> 
> Le 21 mai 2014 à 17:25, Shayan Pooya <shayan@REDACTED> a écrit :
> 
>> That is right. Here is a minimal code that emits a warning in R15B03 but not in later versions:
>> 
>> -module(warning_test).
>> -export([start/0]).
>> 
>> start() ->
>>    try case recv() of
>>            {hello, W} -> io:format("hello");
>>            _ -> ok
>>        end
>>        catch K:V ->
>>            io:format("issue: ~p ~p", [K, V])
>>    end.
>> 
>> recv() ->
>>    {hello, world}.
>> 
>> 
>> 
>> On Wed, May 21, 2014 at 10:35 AM, Kostis Sagonas <kostis@REDACTED> wrote:
>> On 05/21/2014 03:33 PM, Shayan Pooya wrote:
>> Hello,
>> 
>> In this piece of code, dialyzer fails to detect unused variable RState:
>> https://github.com/pooya/disco/blob/dialyzer_bug/master/src/disco_worker.erl#L235
>> 
>> (The code should be changed to use _ instead of RState, but I left it
>> like this to report this issue).
>> 
>> Erlang versions prior to R16B03 seem to correctly detect and report this
>> issue:
>> https://travis-ci.org/pooya/disco/builds/25693989
>> 
>> Therefore, this seem to be an issue in dialyzer which is also present in
>> Erlang 17.0
>> 
>> This is bit of a strange report since dialyzer does not really detect unused variables (and never has).  It's the Erlang compiler/linter that does this.
>> 
>> Kostis
>> _______________________________________________
>> erlang-bugs mailing list
>> erlang-bugs@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-bugs
>> 
>> _______________________________________________
>> erlang-bugs mailing list
>> erlang-bugs@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-bugs
> 




More information about the erlang-bugs mailing list