[erlang-bugs] Dialyzer bug with binary:compile_pattern/1
Ahmed Omar
spawn.think@REDACTED
Tue May 3 17:38:55 CEST 2011
I don't think this is a bug in dialyzer. binary:compile_patter returns cp()
not binary()
so the warning is correct
On Tue, May 3, 2011 at 5:08 PM, Jay Nelson <jay@REDACTED> wrote:
> The following snippet of code gives a dialyzer error:
>
> NL = list_to_binary(io_lib:nl()),
> LinesPattern = binary:compile_pattern(NL),
> Lines = [Line || Line <- binary:split(Bin, LinesPattern, [global, trim]),
> size(Line) > 0],
>
> 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',{_,_}}])
>
> If the LinesPattern in the list comprehension is changed to NL, then there
> is no error.
>
> It seems the return value of binary:compile_pattern/1 is not compatible
> with the call to binary:split/3.
>
> jay
> _______________________________________________
> erlang-bugs mailing list
> erlang-bugs@REDACTED
> http://erlang.org/mailman/listinfo/erlang-bugs
>
--
Best Regards,
- Ahmed Omar
http://nl.linkedin.com/in/adiaa
Follow me on twitter
@spawn_think <http://twitter.com/#!/spawn_think>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20110503/80e1cf73/attachment.htm>
More information about the erlang-bugs
mailing list