[erlang-bugs] binary:compile_pattern/1 spec doesn't match binary:cp() opaque definition

Lukas Larsson lukas@REDACTED
Fri May 4 15:30:43 CEST 2012


Hi,

Which version of Erlang are you running?

The specs of BIFs in the master branch on github (which will be part of 
the R16 release) have been completely rewritten so the issue might be 
fixed there.

Lukas

On 04/05/12 14:09, Hynek Vychodil wrote:
> Hello,
>
> binary:compile_pattern/1 spec makes dialyzer unhappy. This minimal
> module shows it.
>
> -module(binary_compile_dialyzer_issue).
>
> -export([test/0]).
>
> test() ->
>    binary:split(<<>>, binary:compile_pattern(<<>>), []).
>
> Dialyzer output is
>
> $ dialyzer -q binary_compile_dialyzer_issue.erl
>
> binary_compile_dialyzer_issue.erl:5: Function test/0 has no local return
> binary_compile_dialyzer_issue.erl:6: The call
> binary:split(#{}#,{'ac',binary()} | {'bm',binary()},[]) does not have
> a term of type binary() | [binary()] | binary:cp() (with opaque
> subterms) as 2nd argument
>
> If I understand it right
>
> /usr/lib/erlang/lib/hipe-3.9.1/cerl/erl_bif_types.erl:4672
> t_binary_compiled_pattern() ->
>    t_tuple([t_sup(t_atom('bm'), t_atom('ac')), t_binary()]).
>
> should return opaque type. Unfortunately I seems not skilled enough to
> provide patch.
>
> Best regards
>



More information about the erlang-bugs mailing list