jeremyjh / dialyxir

Mix tasks to simplify use of Dialyzer in Elixir projects.
Apache License 2.0
1.71k stars 142 forks source link

Function clause when attempting to create plt #70

Closed KallDrexx closed 7 years ago

KallDrexx commented 7 years ago

I'm having the following issue with the latest version and I can't find a good solution anywhere. I am trying to run dialyxir on https://github.com/KallDrexx/elixir-media-libs/tree/c794f29cf3a4f009535936b5ed98223bad9c072a

D:\Code\My Projects\elixir-media-libs                                                                                                       
λ  mix dialyzer                                                                                                                                                                                         
Checking PLT...                                                                                                                                                                                         
[:amf0, :compiler, :earmark, :elixir, :ex_doc, :gen_rtmp_server, :kernel,                                                                                                                               
 :logger, :ranch, :rtmp, :stdlib, :uuid]                                                                                                                                                                
Finding suitable PLTs                                                                                                                                                                                   
Looking up modules in dialyxir_erlang-18.2.1_elixir-1.4.0_deps-umbrella.plt                                                                                                                             
Finding applications for dialyxir_erlang-18.2.1_elixir-1.4.0_deps-umbrella.plt                                                                                                                          
Finding modules for dialyxir_erlang-18.2.1_elixir-1.4.0_deps-umbrella.plt                                                                                                                               
Checking 376 modules in dialyxir_erlang-18.2.1_elixir-1.4.0_deps-umbrella.plt                                                                                                                           
Adding 213 modules to dialyxir_erlang-18.2.1_elixir-1.4.0_deps-umbrella.plt                                                                                                                             

21:04:01.299 [error] Process #PID<0.19137.0> raised an exception                                                                                                                                        
** (FunctionClauseError) no function clause matching in :cerl.map_arg/1                                                                                                                                 
    (compiler) cerl.erl:1608: :cerl.map_arg({:c_literal, [], #MapSet<["address", "article", "aside", "blockquote", "canvas", "dd", "div", "dl", "fieldset", "figcaption", "h1", "h2", "h3", "h4", "h5", 
"h6", "header", "hgroup", "li", "main", "nav", "noscript", "ol", "output", "p", "pre", "section", "table", "tfoot", "ul", "video"]>})                                                                   
    c:/ldisk/daily_build/18_opu_c.2015-12-17_21/otp_src_18/lib/hipe/cerl/cerl_prettypr.erl:614: :cerl_prettypr.lay_map/2                                                                                
    c:/ldisk/daily_build/18_opu_c.2015-12-17_21/otp_src_18/lib/hipe/cerl/cerl_prettypr.erl:413: :cerl_prettypr.lay_ann/2                                                                                
    c:/ldisk/daily_build/18_opu_c.2015-12-17_21/otp_src_18/lib/hipe/cerl/cerl_prettypr.erl:273: :cerl_prettypr.format/2                                                                                 
    dialyzer_dataflow.erl:3350: :dialyzer_dataflow.format_args_1/3                                                                                                                                      
    dialyzer_dataflow.erl:3343: :dialyzer_dataflow.format_args/3                                                                                                                                        
    dialyzer_dataflow.erl:603: :dialyzer_dataflow.get_apply_fail_msg/10                                                                                                                                 
    dialyzer_dataflow.erl:544: :dialyzer_dataflow.handle_apply_or_call/9                                                                                                                                

21:04:01.346 [error] Process #PID<0.19128.0> raised an exception                                                                                                                                        
** (ArgumentError) argument error                                                                                                                                                                       
    (stdlib) :ets.lookup(4505653, {:in, {Inspect.BitString, :inspect_bitstring, 2}})                                                                                                                    
    (stdlib) digraph.erl:225: :digraph.in_neighbours/2                                                                                                                                                  
    dialyzer_callgraph.erl:571: :dialyzer_callgraph.digraph_in_neighbours/2                                                                                                                             
    dialyzer_dataflow.erl:3125: :dialyzer_dataflow.state__add_work_from_fun/2                                                                                                                           
    dialyzer_dataflow.erl:232: :dialyzer_dataflow.analyze_loop/1                                                                                                                                        
    dialyzer_dataflow.erl:174: :dialyzer_dataflow.analyze_module/6                                                                                                                                      
    dialyzer_dataflow.erl:159: :dialyzer_dataflow.get_fun_types/5                                                                                                                                       
    dialyzer_succ_typings.erl:264: :dialyzer_succ_typings.refine_one_module/2                                                                                                                           
** (throw) {:dialyzer_error, 'Analysis failed with error:\n{function_clause,\n    [{cerl,map_arg,\n         [{c_literal,[],\n              \#{\'__struct__\' => \'Elixir.MapSet\',\n                map 
=> \#{<<"address">> => true,\n                  <<"article">> => true,\n                  <<"aside">> => true,\n                  <<"blockquote">> => true,\n                  <<"canvas">> => true,\n  
                <<"dd">> => true,\n                  <<"div">> => true,\n                  <<"dl">> => true,\n                  <<"fieldset">> => true,\n                  <<"figcaption">> => true,\n  
                <<"h1">> => true,\n                  <<"h2">> => true,\n                  <<"h3">> => true,\n                  <<"h4">> => true,\n                  <<"h5">> => true,\n                 
 <<"h6">> => true,\n                  <<"header">> => true,\n                  <<"hgroup">> => true,\n                  <<"li">> => true,\n                  <<"main">> => true,\n                  <<"n
av">> => true,\n                  <<"noscript">> => true,\n                  <<"ol">> => true,\n                  <<"output">> => true,\n                  <<"p">> => true,\n                  <<"pre">>
 => true,\n                  <<"section">> => true,\n                  <<"table">> => true,\n                  <<"tfoot">> => true,\n                  <<"ul">> => true,\n                  <<"video">> 
=> true}}}],\n         [{file,"cerl.erl"},{line,1608}]},\n     {cerl_prettypr,lay_map,2,\n         [{file,\n              "c:/ldisk/daily_build/18_opu_c.2015-12-17_21/otp_src_18/lib/hipe/cerl/cerl_pre
21:04:01.346 [error] Process #PID<0.18900.0> raised an exception                                                                                                                                        
ttypr.erl"},\n          {line,614}]},\n     {cerl_prettypr,lay_ann,2,\n         [{file,\n              "c:/ldisk/daily_build/18_opu_c.2015-12-17_21/otp_src_18/lib/hipe/cerl/cerl_prettypr.erl"},\n     
** (ArgumentError) argument error                                                                                                                                                                       
     {line,413}]},\n     {cerl_prettypr,format,2,\n         [{file,\n              "c:/ldisk/daily_build/18_opu_c.2015-12-17_21/otp_src_18/lib/hipe/cerl/cerl_prettypr.erl"},\n          {line,273}]},\n
    (stdlib) :ets.lookup(4505653, {:in, {Logger.Formatter, :prune, 1}})                                                                                                                                 
     {dialyzer_dataflow,format_args_1,3,\n         [{file,"dialyzer_dataflow.erl"},{line,3350}]},\n     {dialyzer_dataflow,format_args,3,\n         [{file,"dialyzer_dataflow.erl"},{line,3343}]},\n    
    (stdlib) digraph.erl:225: :digraph.in_neighbours/2                                                                                                                                                  
 {dialyzer_dataflow,get_apply_fail_msg,10,\n         [{file,"dialyzer_dataflow.erl"},{line,603}]},\n     {dialyzer_dataflow,handle_apply_or_call,9,\n         [{file,"dialyzer_dataflow.erl"},{line,544}
    dialyzer_callgraph.erl:571: :dialyzer_callgraph.digraph_in_neighbours/2                                                                                                                             
]}]}\nLast messages in the log cache:\n  Reading files and computing callgraph... done in 8.45 secs\n  Removing edges... done in 0.16 secs'}                                                            
    dialyzer_dataflow.erl:3125: :dialyzer_dataflow.state__add_work_from_fun/2                                                                                                                           
    dialyzer_cl.erl:704: :dialyzer_cl.cl_error/2                                                                                                                                                        
    dialyzer_dataflow.erl:232: :dialyzer_dataflow.analyze_loop/1                                                                                                                                        
    dialyzer_cl.erl:406: :dialyzer_cl.do_analysis/4                                                                                                                                                     
    dialyzer_dataflow.erl:174: :dialyzer_dataflow.analyze_module/6                                                                                                                                      
    dialyzer.erl:167: :dialyzer.run/1                                                                                                                                                                   
    dialyzer_dataflow.erl:159: :dialyzer_dataflow.get_fun_types/5                                                                                                                                       
    lib/dialyxir/plt.ex:166: Dialyxir.Plt.plt_add/2                                                                                                                                                     
    dialyzer_succ_typings.erl:264: :dialyzer_succ_typings.refine_one_module/2                                                                                                                           
    lib/dialyxir/plt.ex:41: Dialyxir.Plt.check_plt/4                                                                                                                                                    
    (elixir) lib/enum.ex:1755: Enum."-reduce/3-lists^foldl/2-0-"/3                                                                                                                                      
    lib/dialyxir/plt.ex:28: Dialyxir.Plt.check_plts/1                                                                                                                                                   

    lib/mix/tasks/dialyzer.ex:128: Mix.Tasks.Dialyzer.check_plt/0                                                                                                                                       
21:04:01.346 [error] Process #PID<0.19053.0> raised an exception                                                                                                                                        

** (ArgumentError) argument error                                                                                                                                                                       
    (stdlib) :ets.lookup(4505653, {:in, {Logger, :reset_metadata, 0}})                                                                                                                                  
    (stdlib) digraph.erl:225: :digraph.in_neighbours/2                                                                                                                                                  
    dialyzer_callgraph.erl:571: :dialyzer_callgraph.digraph_in_neighbours/2                                                                                                                             
    dialyzer_dataflow.erl:3125: :dialyzer_dataflow.state__add_work_from_fun/2                                                                                                                           
    dialyzer_dataflow.erl:232: :dialyzer_dataflow.analyze_loop/1                                                                                                                                        
    dialyzer_dataflow.erl:174: :dialyzer_dataflow.analyze_module/6                                                                                                                                      
    dialyzer_dataflow.erl:159: :dialyzer_dataflow.get_fun_types/5                                                                                                                                       
    dialyzer_succ_typings.erl:264: :dialyzer_succ_typings.refine_one_module/2                                                                                                                           

any ideas?

jeremyjh commented 7 years ago

It works fine for me. Any chance you can try on Erlang 19?

Checking PLT...
[:amf0, :compiler, :earmark, :elixir, :ex_doc, :gen_rtmp_server, :kernel,
 :logger, :ranch, :rtmp, :stdlib, :uuid]
Finding suitable PLTs
Looking up modules in dialyxir_erlang-19.2_elixir-1.4.0_deps-umbrella.plt
Looking up modules in dialyxir_erlang-19.2_elixir-1.4.0.plt
Looking up modules in dialyxir_erlang-19.2.plt
Finding applications for dialyxir_erlang-19.2.plt
Finding modules for dialyxir_erlang-19.2.plt
Creating dialyxir_erlang-19.2.plt
Looking up modules in dialyxir_erlang-19.2.plt
Removing 3 modules from dialyxir_erlang-19.2.plt
Checking 11 modules in dialyxir_erlang-19.2.plt
Adding 149 modules to dialyxir_erlang-19.2.plt
Finding applications for dialyxir_erlang-19.2_elixir-1.4.0.plt
Finding modules for dialyxir_erlang-19.2_elixir-1.4.0.plt
Copying dialyxir_erlang-19.2.plt to dialyxir_erlang-19.2_elixir-1.4.0.plt
Looking up modules in dialyxir_erlang-19.2_elixir-1.4.0.plt
Checking 160 modules in dialyxir_erlang-19.2_elixir-1.4.0.plt
Adding 220 modules to dialyxir_erlang-19.2_elixir-1.4.0.plt
Finding applications for dialyxir_erlang-19.2_elixir-1.4.0_deps-umbrella.plt
Finding modules for dialyxir_erlang-19.2_elixir-1.4.0_deps-umbrella.plt
Copying dialyxir_erlang-19.2_elixir-1.4.0.plt to dialyxir_erlang-19.2_elixir-1.4.0_deps-umbrella.plt
Looking up modules in dialyxir_erlang-19.2_elixir-1.4.0_deps-umbrella.plt
Checking 380 modules in dialyxir_erlang-19.2_elixir-1.4.0_deps-umbrella.plt
Adding 215 modules to dialyxir_erlang-19.2_elixir-1.4.0_deps-umbrella.plt
Starting Dialyzer
dialyzer --no_check_plt --fullpath --plt /home/jeremy/play/elixir/elixir-media-libs/_build/umbrella/dialyxir_erlang-19.2_elixir-1.4.0_deps-umbrella.plt /home/jeremy/play/elixir/elixir-media-libs/_build/umbrella/lib/flv/ebin /home/jeremy/play/elixir/elixir-media-libs/_build/umbrella/lib/rtmp_reader_cli/ebin /home/jeremy/play/elixir/elixir-media-libs/_build/umbrella/lib/simple_rtmp_server/ebin /home/jeremy/play/elixir/elixir-media-libs/_build/umbrella/lib/gen_rtmp_server/ebin /home/jeremy/play/elixir/elixir-media-libs/_build/umbrella/lib/amf3/ebin /home/jeremy/play/elixir/elixir-media-libs/_build/umbrella/lib/rtmp/ebin /home/jeremy/play/elixir/elixir-media-libs/_build/umbrella/lib/amf0/ebin
  Compiling some key modules to native code... done in 0m34.37s
  Proceeding with analysis...
lib/flv/audio_data.ex:82: The variable _ can never match since previous clauses completely covered the type 0 | 1 | 2 | 3
lib/flv/audio_data.ex:86: The variable _ can never match since previous clauses completely covered the type 0 | 1
lib/flv/audio_data.ex:90: The variable _ can never match since previous clauses completely covered the type 0 | 1
lib/rtmp/protocol/handler.ex:112: The call 'Elixir.Rtmp.Protocol.ChunkIo':serialize(any(),raw_message@1::#{'__struct__':='Elixir.Rtmp.Protocol.RawMessage', 'deserialization_system_time':='nil', 'force_uncompressed':=_, 'message_type_id':=1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 18 | 20, 'payload':=_, 'stream_id':=_, 'timestamp':=_},csid@1::2 | 3 | 6 | 20 | 21) breaks the contract (state(),'Elixir.Rtmp.Protocol.RawMessage':t(),non_neg_integer()) -> {state(),iodata()}
lib/rtmp/protocol/handler.ex:168: The pattern #{'message_type_id':=19, '__struct__':='Elixir.Rtmp.Protocol.RawMessage'} can never match the type #{'__struct__':='Elixir.Rtmp.Protocol.RawMessage', 'deserialization_system_time':='nil', 'force_uncompressed':=_, 'message_type_id':=8 | 9 | 20, 'payload':=_, 'stream_id':=_, 'timestamp':=_}
lib/rtmp/protocol/raw_message.ex:45: Invalid type specification for function 'Elixir.Rtmp.Protocol.RawMessage':pack/1. The success typing is (#{'__struct__':='Elixir.Rtmp.Protocol.DetailedMessage', 'content':=atom() | #{'__struct__':='Elixir.Rtmp.Protocol.Messages.Abort' | 'Elixir.Rtmp.Protocol.Messages.Acknowledgement' | 'Elixir.Rtmp.Protocol.Messages.Amf0Command' | 'Elixir.Rtmp.Protocol.Messages.Amf0Data' | 'Elixir.Rtmp.Protocol.Messages.AudioData' | 'Elixir.Rtmp.Protocol.Messages.SetChunkSize' | 'Elixir.Rtmp.Protocol.Messages.SetPeerBandwidth' | 'Elixir.Rtmp.Protocol.Messages.UserControl' | 'Elixir.Rtmp.Protocol.Messages.VideoData' | 'Elixir.Rtmp.Protocol.Messages.WindowAcknowledgementSize', _=>_}, 'force_uncompressed':=_, 'stream_id':=_, 'timestamp':=_, _=>_}) -> #{'__struct__':='Elixir.Rtmp.Protocol.RawMessage', 'deserialization_system_time':='nil', 'force_uncompressed':=_, 'message_type_id':=1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 18 | 20, 'payload':=_, 'stream_id':=_, 'timestamp':=_}
lib/simple_rtmp_server/worker.ex:253: The call 'Elixir.GenRtmpServer':send_message(pid(),outbound_message@1::#{'__struct__':='Elixir.GenRtmpServer.MetaData', 'details':=_},any()) will never return since it differs in the 2nd argument from the success typing arguments: (pid(),#{'__struct__':='Elixir.GenRtmpServer.AudioVideoData', 'data':=<<>>, 'data_type':='audio' | 'video', 'received_at_timestamp':=pos_integer()},non_neg_integer())
Unknown types:
  'Elixir.Rtmp.ServerSession.StreamMetadata':t/0
 done in 0m2.25s
done (warnings were emitted)
KallDrexx commented 7 years ago

Woops, didn't realize that even though Erlang 19 was installed Elixir wasn't using it. My bad.