[erlang-bugs] Missing compile warning
tom kelly
ttom.kelly@REDACTED
Mon Mar 3 16:37:31 CET 2014
Hi List,
You've probably seen this on the questions mailing list, just re-posting
here to follow the bug reporting guidelines:
-module(no_warn).
-compile(export_all).
-record(my_rec,{field1, field2}).
my_function1(#my_rec{field1 = {tag, _}, field2 = f2}) -> 1;
my_function1(#my_rec{field1 = {tag, 1}, field2 = f2}) -> 2; % line 7
my_function1(_) -> 3.
my_function2(#my_rec{field1 = {tag, _}}) -> 1;
my_function2(#my_rec{field1 = {tag, 1}}) -> 2; % line11
my_function2(_) -> 3.
When compiled on R16B03-1 this gives the output:
no_warn.erl:11: Warning: this clause cannot match because a previous clause
at line 10 always matches
Ie. we are correctly warned about line 11 but not about line 7.
//TTom.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20140303/62d7a653/attachment.htm>
More information about the erlang-bugs
mailing list