I don't think this is a bug in dialyzer. binary:compile_patter returns cp() not binary()<div>so the warning is correct<br><br><div class="gmail_quote">On Tue, May 3, 2011 at 5:08 PM, Jay Nelson <span dir="ltr"><<a href="mailto:jay@duomark.com">jay@duomark.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">The following snippet of code gives a dialyzer error:<br>
<br>
NL = list_to_binary(io_lib:nl()),<br>
LinesPattern = binary:compile_pattern(NL),<br>
Lines = [Line || Line <- binary:split(Bin, LinesPattern, [global, trim]),<br>
size(Line) > 0],<br>
<br>
The call binary:split(Bin::binary(),LinesPattern::{'bm',binary()},['global' | 'trim',...]) will never return since it differs in the 2nd argument from the success typing arguments: (binary(),binary() | [binary()] | {'cp',binary()},['global' | 'trim' | {'scope',{_,_}}])<br>
<br>
If the LinesPattern in the list comprehension is changed to NL, then there is no error.<br>
<br>
It seems the return value of binary:compile_pattern/1 is not compatible with the call to binary:split/3.<br>
<br>
jay<br>
_______________________________________________<br>
erlang-bugs mailing list<br>
<a href="mailto:erlang-bugs@erlang.org">erlang-bugs@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-bugs" target="_blank">http://erlang.org/mailman/listinfo/erlang-bugs</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Best Regards,<br>- Ahmed Omar<div><a href="http://nl.linkedin.com/in/adiaa" target="_blank">http://nl.linkedin.com/in/adiaa</a></div><div>Follow me on twitter</div><div><a href="http://twitter.com/#!/spawn_think" target="_blank">@spawn_think</a></div>
<br>
</div>