no_file:none confusing warning message

Kostis Sagonas kostis@REDACTED
Sun Dec 26 19:07:34 CET 2010


An Erlang/OTP user sent me some code to investigate a warning from the 
compiler that he could not locate (in a 1500 line file). I've minimized 
it to an an appropriate test case and include it here:

%----------------------------------------------------
-module(no_file_none_warning).

-export([test/1]).

test(Bs) ->
     [{B, ok} = {B, foo:bar(B)} || B <- Bs],
     ok.
%-----------------------------------------------------

Compiling it produces:

   % erlc no_file_none_warning.erl
   no_file:none: Warning: a term is constructed, but never used


The warning is confusing for various reasons: first of all it mentions 
neither the file name nor the line it occurs,  but it would have been 
confusing even if it did because one would not know whether it refers to 
the {B, ok} terms or to the result of the list comprehension.

Kostis


More information about the erlang-bugs mailing list