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

Hynek Vychodil vychodil.hynek@REDACTED
Fri May 4 14:09:38 CEST 2012


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

-- 
--Hynek (Pichi) Vychodil

Analyze your data in minutes. Share your insights instantly. Thrill
your boss.  Be a data hero!
Try GoodData now for free: www.gooddata.com



More information about the erlang-bugs mailing list