[erlang-questions] Why does Dialyzer crash on this map?

Ivan Uemlianin ivan@REDACTED
Tue Nov 25 16:13:20 CET 2014


Dear All

Running Dialyzer on the module below crashes Dialyzer with the error 
following:

** module

     -module(ltu).
     -export([get_map/0]).

     -spec get_map() -> map().
     get_map() ->
         #{labels => [one, two],
           number => 27,
           [1,2,3] => wer,        %% ok
           {4,5,6} => sdf,        %% ok
           kvok => #{
                 a => qwe,
                 2 => asd,
                 [1,2,3] => wer,  %% bad
                 {4,5,6} => sdf,  %% bad
                 "abc" => zxc
            }
          }.

** crash

     $ dialyzer ltu.erl
       Checking whether the PLT /home/ivan/.dialyzer_plt is 
up-to-date... yes
       Proceeding with analysis...
     =ERROR REPORT==== 25-Nov-2014::14:52:50 ===
     Error in process <0.45.0> with exit value: 
{{case_clause,map},[{dialyzer_dataflow,find_terminals,1,[{file,"dialyzer_dataflow.erl"},{line,3451}]},{dialyzer_dataflow,find_terminals_list,3,[{file,"dialyzer_dataflow.erl"},{line,3504}]},{dialyzer_dataflow,classify_returns... 



     dialyzer: Analysis failed with error:
     {{case_clause,map},
      [{dialyzer_dataflow,find_terminals,1,
[{file,"dialyzer_dataflow.erl"},{line,3451}]},
       {dialyzer_dataflow,find_terminals_list,3,
[{file,"dialyzer_dataflow.erl"},{line,3504}]},
       {dialyzer_dataflow,classify_returns,1,
[{file,"dialyzer_dataflow.erl"},{line,3443}]},
       {dialyzer_dataflow,'-state__get_warnings/2-fun-0-',7,
[{file,"dialyzer_dataflow.erl"},{line,2908}]},
       {lists,foldl,3,[{file,"lists.erl"},{line,1261}]},
       {dialyzer_dataflow,state__get_warnings,2,
[{file,"dialyzer_dataflow.erl"},{line,2934}]},
       {dialyzer_dataflow,get_warnings,5,
[{file,"dialyzer_dataflow.erl"},{line,142}]},
       {dialyzer_succ_typings,collect_warnings,2,
[{file,"dialyzer_succ_typings.erl"},{line,182}]}]}
     Last messages in the log cache:
       Reading files and computing callgraph... done in 0.07 secs
       Removing edges... done in 0.00 secs

If I comment out the two lines marked "%% bad", Dialyzer can check the 
module.  nb the same key-value pairs that are bad in the nested map 
kvok, are ok in the top-level map.

Is this supposed to happen?  If so, why?

With thanks and best wishes

Ivan


-- 
============================================================
Ivan A. Uemlianin PhD
Llaisdy
Speech Technology Research and Development

                     ivan@REDACTED
                         @llaisdy
                          llaisdy.wordpress.com
               github.com/llaisdy
                      www.linkedin.com/in/ivanuemlianin

                         festina lente
============================================================




More information about the erlang-questions mailing list