travis_elixir_plts icon indicating copy to clipboard operation
travis_elixir_plts copied to clipboard

Tried to follow your Blog post - dialyzer analysis failed

Open dylan-chong opened this issue 6 years ago • 5 comments

Hi there,

I wasn't sure where to put this, but i saw your blog post and tried to do the same thing - get dialyser running on travis.

This is my travis.yml file

language: elixir
elixir: '1.5.2'
otp_release: '20.1'

# http://blog.danielberkompas.com/elixir/2015/04/03/run-dialyzer-on-elixir-on-travis.html
before_script:
  # Set download location
  - export PLT_FILENAME=elixir-${TRAVIS_ELIXIR_VERSION}_${TRAVIS_OTP_RELEASE}.plt
  - export PLT_LOCATION=/home/travis/$PLT_FILENAME
  # Download PLT from danielberkompas/travis_elixir_plts on Github
  # Store in $PLT_LOCATION
  - wget -O $PLT_LOCATION https://raw.github.com/danielberkompas/travis_elixir_plts/master/$PLT_FILENAME

script:
  - export PROJECT_NAME=ex_structable
#   - mix test
#   - mix credo
  - dialyzer --no_check_plt --plt $PLT_LOCATION --no_native _build/test/lib/$PROJECT_NAME/ebin

And this is the log output i get from running the dialyser command.

To be honest i have no idea what to do with zero

[0K$ dialyzer --no_check_plt --plt $PLT_LOCATION _build/test/lib/$PROJECT_NAME/ebin
  Proceeding with analysis...
dialyzer: Analysis failed with error:
{undef,
 [{elixir_erl,debug_info,
   [core_v1,'Elixir.ExStructable.Hooks',
    {elixir_v1,
     #{attributes => [],compile_opts => [],definitions => [],
       file =>
        <<"/home/travis/build/dylan-chong/ex_structable/lib/ex_structable/hooks.ex">>,
       line => 1,module => 'Elixir.ExStructable.Hooks',unreachable => []},
     [{attribute,58,callback,
       {{validate_struct,2},
        [{type,61,'fun',
          [{type,61,product,
            [{remote_type,0,[{atom,0,elixir},{atom,0,struct},[]]},
             {ann_type,60,
              [{var,60,options},
               {remote_type,60,
                [{atom,0,'Elixir.ExStructable'},{atom,0,options},[]]}]}]},
           {remote_type,61,
            [{atom,0,'Elixir.ExStructable'},
             {atom,0,validation_result},
             []]}]}]}},
      {attribute,33,callback,
       {{put_into_struct,3},
        [{type,37,'fun',
          [{type,37,product,
            [{ann_type,34,
              [{var,34,args},
               {remote_type,34,
                [{atom,0,'Elixir.ExStructable'},{atom,0,args},[]]}]},
             {remote_type,0,[{atom,0,elixir},{atom,0,struct},[]]},
             {ann_type,36,
              [{var,36,options},
               {remote_type,36,
                [{atom,0,'Elixir.ExStructable'},{atom,0,options},[]]}]}]},
           {remote_type,0,[{atom,0,elixir},{atom,0,struct},[]]}]}]}},
      {attribute,21,callback,
       {{create_struct,2},
        [{type,24,'fun',
          [{type,24,product,
            [{ann_type,22,
              [{var,22,args},
               {remote_type,22,
                [{atom,0,'Elixir.ExStructable'},{atom,0,args},[]]}]},
             {ann_type,23,
              [{var,23,options},
               {remote_type,23,
                [{atom,0,'Elixir.ExStructable'},{atom,0,options},[]]}]}]},
           {remote_type,0,[{atom,0,elixir},{atom,0,struct},[]]}]}]}},
      {attribute,82,callback,
       {{after_put,2},
        [{type,85,'fun',
          [{type,85,product,
            [{ann_type,83,
              [{var,83,validation_result},
               {remote_type,83,
                [{atom,0,'Elixir.ExStructable'},
                 {atom,0,validation_result},
                 []]}]},
             {ann_type,84,
              [{var,84,options},
               {remote_type,84,
                [{atom,0,'Elixir.ExStructable'},{atom,0,options},[]]}]}]},
           {user_type,85,ignored_return_type,[]}]}]}},
      {attribute,70,callback,
       {{after_new,2},
        [{type,73,'fun',
          [{type,73,product,
            [{ann_type,71,
              [{var,71,validation_result},
               {remote_type,71,
                [{atom,0,'Elixir.ExStructable'},
                 {atom,0,validation_result},
                 []]}]},
             {ann_type,72,
              [{var,72,options},
               {remote_type,72,
                [{atom,0,'Elixir.ExStructable'},{atom,0,options},[]]}]}]},
           {user_type,73,ignored_return_type,[]}]}]}},
      {attribute,12,export_type,[{ignored_return_type,0}]},
      {attribute,12,type,{ignored_return_type,{type,12,any,[]},[]}}]},
    [no_copt,to_core,binary,return_errors,no_inline,strict_record_tests,
     strict_record_updates,dialyzer]],
   []},
  {dialyzer_utils,get_core_from_beam,2,
   [{file,"dialyzer_utils.erl"},{line,116}]},
  {dialyzer_analysis_callgraph,compile_byte,5,
   [{file,"dialyzer_analysis_callgraph.erl"},{line,412}]},
  {dialyzer_worker,loop,2,[{file,"dialyzer_worker.erl"},{line,90}]}]}
Last messages in the log cache:
  Reading files and computing callgraph... 

travis_time:end:0defd2b7:start=1514779052983273356,finish=1514779064487733895,duration=11504460539
[0K
[31;1mThe command "dialyzer --no_check_plt --plt $PLT_LOCATION _build/test/lib/$PROJECT_NAME/ebin" exited with 1.[0m

Done. Your build exited with 1.

dylan-chong avatar Jan 01 '18 04:01 dylan-chong

I seem to be able to replicate this on my own mac using

dialyzer --no_check_plt --plt _build/dev/dialyxir_erlang-20.2.2_elixir-1.5.3_deps-dev.plt _build/test/lib/ex_structable/ebin/

dylan-chong avatar Jan 01 '18 04:01 dylan-chong

It looks to me like it's complaining that the module ExStructable.Hooks isn't defined.

danielberkompas avatar Jan 02 '18 14:01 danielberkompas

Interesting. Why do you say that?

It definitely is defined. I can put a IO.puts inside the module definition and its successfully print out something when running mix test

dylan-chong avatar Jan 03 '18 03:01 dylan-chong

Dialyzer is saying that something is undef, undefined. I'm not sure exactly what it is. The root problem though is in the ExStructable library. I bet if you run dialyzer against the library on its own you will reproduce it.

On Jan 2, 2018, 7:53 PM -0800, Dylan Chong [email protected], wrote:

Interesting. Why do you say that? It definitely is defined. I can put a IO.puts inside the module definition and its successfully print out something when running mix test — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

danielberkompas avatar Jan 03 '18 04:01 danielberkompas

I forgot to mention that if i run mix dialyzer (using dialyxir) it passes.

dylan-chong avatar Jan 03 '18 05:01 dylan-chong