<div dir="ltr"><div><div><div class="gmail_signature"><div dir="ltr"><div><div><pre class="" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin-top:0px;margin-bottom:0px;width:748px;color:rgb(51,51,51);line-height:16.7999992370605px"><div class="" id="file-wat_clauses-LC1"><span style="line-height:16.7999992370605px">-module(wat_clauses).</span><br></div><div class="" id="file-wat_clauses-LC3"><span style="line-height:16.7999992370605px">-export([authenticate_nouns/1]).</span><span style="line-height:16.7999992370605px"> </span></div><div class="" id="file-wat_clauses-LC11">authenticate_nouns([{<<"user_auth">>, _}]) -> 'true';
</div><div class="" id="file-wat_clauses-LC12">authenticate_nouns([{<<"user_auth">>, [<<"recovery">>]}]) -> hi;
</div><div class="" id="file-wat_clauses-LC13">authenticate_nouns(_Nouns) -> 'false'.
</div><div class="" id="file-wat_clauses-LC14"> </div></pre></div><div><a href="https://gist.github.com/fenollp/c08e86bdf15b28552824">In this code</a> (or above), the second clause will never match (because of source-order).</div><div>But erlc does not complain about it.</div><div><br></div><div>Ferd on IRC mentioned that the compiler might feel free to reorder clauses.</div><div>But the call <span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:11.8999996185303px;line-height:19.0400009155273px;background-color:rgba(0,0,0,0.0392157)">wat_clauses:authenticate_nouns([{<<"user_auth">>, [<<"recovery">>]}])</span></div><div>returns true instead of hi, so no reordering is done.</div><div><br></div><div>Dialyzer does not complain either.</div><div><br></div><div>Am I right in thinking we should have a warning about a never matching clause?</div><div><br></div><div>-- </div><div>Pierre Fenoll</div></div><div><br></div></div></div></div>
</div></div>