<div dir="ltr"><div><div><div><div><div>Hello, <br></div>there is a _no warnings_ when I try to compile the following code:<br><br>-module('1').<br><br>-record(record_1,{arg}).<br>-record(record_2,{}).<br><br>-export([foo/2]).<br>
<br>foo(#record_1{},#record_2{})-><br>    {ok,1};<br>foo(#record_1{arg=1},#record_2{}) -><br>    {ok,2}.<br><br>tthread@mcu:~/rep/vcs/apps/vcs_core/src$ erl<br>Erlang R15B02 (erts-5.9.2) [source] [64-bit] [smp:8:8] [async-threads:0] [hipe] [kernel-poll:false]<br>
<br>Eshell V5.9.2  (abort with ^G)<br>1> c("1.erl").<br>{ok,'1'}<br><br><br></div></div>Otherwise when you try to compile a simpler code, something like this, everything is fine:<br>-module('1').<br>
<br>-record(record_1,{arg}).<br>-record(record_2,{}).<br><br>-export([foo/2]).<br><br>foo(#record_1{},_)-><br>    {ok,1};<br>foo(#record_1{arg=1},#record_2{}) -><br>    {ok,2}.<br><br>tthread@mcu:~/rep/vcs/apps/vcs_core/src$ erl<br>
Erlang R15B02 (erts-5.9.2) [source] [64-bit] [smp:8:8] [async-threads:0] [hipe] [kernel-poll:false]<br><br>Eshell V5.9.2  (abort with ^G)<br>1> c("1.erl").<br>1.erl:17: Warning: this clause cannot match because a previous clause at line 15 always matches<br>
{ok,'1'}<br><br><br></div>There is should be a warning because the second case will never match so far it included in first case. But it doesn't cover by warning message. It can lead to a difficult logical problem. <br>
<br></div>With best Regards, Ilya.<br></div>