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

Hynek Vychodil hynek@REDACTED
Fri May 4 17:47:25 CEST 2012


On Fri, May 4, 2012 at 3:30 PM, Lukas Larsson <lukas@REDACTED> wrote:
> 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

Erlang R15B01 (erts-5.9.1)

>
>
> 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
>>
> _______________________________________________
> erlang-bugs mailing list
> erlang-bugs@REDACTED
> http://erlang.org/mailman/listinfo/erlang-bugs



-- 
Hynek Vychodil
Chief Scientists

GoodData
náměstí 28. října 1104/17, 602 00, Brno - Černá Pole
Office:   +420 530 50 7704
E-mail:  hynek@REDACTED
Web:     www.gooddata.com



More information about the erlang-bugs mailing list