[erlang-bugs] Dialyzer chokes on remote types in t_contains_opaque()

Erik Søe Sørensen ess@REDACTED
Wed May 7 17:19:53 CEST 2014


Hi all / To whom it may concern -

Using Erlang 17.0, I get Dialyzer errors like the following:

    {function_clause,[{erl_types,t_contains_opaque,
    [{c,remote,[{remote,ssl,sslsocket,[]}],unknown}, ...}

Looking into the source, true enough, t_contains_opaque() does not 
handle the ?remote case.
The same is true of the otp master branch on github at the time of writing.

This is the full output:

    $ dialyzer --version
    Dialyzer version v2.7

    $ erlc +debug_info bar.erl && dialyzer bar.beam
    bar.erl:8: Warning: record state is unused
       Checking whether the PLT /home/erik/.dialyzer_plt is
    up-to-date... yes
       Proceeding with analysis...
    =ERROR REPORT==== 7-May-2014::17:00:09 ===
    Error in process <0.34.0> with exit value:
    {function_clause,[{erl_types,t_contains_opaque,[{c,remote,[{remote,ssl,sslsocket,[]}],unknown},[]],[{file,"erl_types.erl"},{line,486}]},{lists,any,2,[{file,"lists.erl"},{line,1223}]},{erl_types,t_contains_opaque,2,[{file,"erl_typ...



    dialyzer: Analysis failed with error:
    {function_clause,[{erl_types,t_contains_opaque,
    [{c,remote,[{remote,ssl,sslsocket,[]}],unknown},
                                   []],
                                  [{file,"erl_types.erl"},{line,486}]},
                       {lists,any,2,[{file,"lists.erl"},{line,1223}]},
                       {erl_types,t_contains_opaque,2,
                                  [{file,"erl_types.erl"},{line,493}]},
                       {erl_types,subtype_is_equal,2,
                                  [{file,"erl_types.erl"},{line,479}]},
                       {erl_types,get_mod_record,3,
    [{file,"erl_types.erl"},{line,4472}]},
                       {erl_types,get_mod_record,5,
    [{file,"erl_types.erl"},{line,4448}]},
                       {erl_types,record_from_form,5,
    [{file,"erl_types.erl"},{line,4424}]},
                       {erl_types,type_from_form,5,
    [{file,"erl_types.erl"},{line,4372}]}]}
    Last messages in the log cache:
       Reading files and computing callgraph...

where "bar.erl" is the following attempt at creating a minimal example:

    -module(bar).

    -type f(T) :: {ssl:sslsocket(), T}.

    -record(r1, { f1 :: f(_) }).
    -type r1(T) :: #r1{ f1 :: fun((ssl:sslsocket(), T) -> any()) }.

    -record(state, {
               r :: r1(T),
               arg :: T
              }).

The following variation also triggers the bug - this one perhaps makes 
slightly more sense, as the two types for f1 are compatible:

    -module(baz).

    -export_type([f/1]).
    -type f(T) :: fun((erlang:timestamp(), T) -> any()).

    -record(r1, { f1 :: baz:f(_) }).
    -type r1(T) :: #r1{ f1 :: f(T) }.

    -record(state, {
               f1 :: r1(T),
               arg :: T
              }).

(That actually just lead me to a workaround: making both types for f1 
remote, like this:
     -record(r1, { f1 :: baz:f(_) }).
     -type r1(T) :: #r1{ f1 :: baz:f(T) }.
makes the bug not be triggered. Which is nice, because then I can get on 
with my work :-))

Regards,
Erik Søe Sørensen

-- 
Mobile: + 45 26 36 17 55 | Skype: eriksoesorensen | Twitter: @eriksoe
Trifork A/S  |  Margrethepladsen 4  |  DK-8000 Aarhus C | 
www.trifork.com <http://www.trifork.com/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20140507/2696d6e5/attachment.htm>


More information about the erlang-bugs mailing list