couchdb icon indicating copy to clipboard operation
couchdb copied to clipboard

Dialyzer warnings do not always show up

Open pgj opened this issue 2 years ago • 0 comments

The dialyze target does not always return any Dialyzer warnings, for instance:

make dialyze apps=mango
==> mango (build-plt)
WARN:  ''build-plt'' command does not apply to directory /Users/gaborpali/projects/github/couchdb/rel
WARN:  ''build-plt'' command does not apply to directory /Users/gaborpali/projects/github/couchdb
==> mango (dialyze)
WARN:  'dialyze' command does not apply to directory /Users/gaborpali/projects/github/couchdb/rel
WARN:  'dialyze' command does not apply to directory /Users/gaborpali/projects/github/couchdb

While, at the same time, if Dialyzer is invoked in different way, reasonable findings are reported:

$ dialyzer --build_plt --apps erts kernel stdlib mnesia
  Creating PLT /Users/gaborpali/.dialyzer_plt ...
Unknown functions:
  compile:file/2 (c.erl:385:10)
  compile:forms/2 (escript.erl:204:10)
  compile:noenv_forms/2 (erl_abstract_code.erl:10:9)
  compile:noenv_forms/2 (qlc_pt.erl:444:14)
  compile:output_generated/1 (c.erl:444:10)
  crypto:crypto_one_time/5 (beam_lib.erl:987:11)
  crypto:start/0 (beam_lib.erl:1023:10)
  crypto:strong_rand_bytes/1 (net_kernel.erl:1918:37)
Unknown types:
  compile:option/0 (c.erl:92:19)
  compile:option/0 (erl_expand_records.erl:41:26)
  compile:option/0 (erl_lint.erl:50:47)
  compile:option/0 (qlc.erl:541:32)
  compile:option/0 (qlc_pt.erl:73:32)
 done in 0m21.58s
done (passed successfully)
$ dialyzer `find src -name ebin -depth 2`
  Checking whether the PLT /Users/gaborpali/.dialyzer_plt is up-to-date... yes
  Proceeding with analysis...
[..]
mango_crud.erl:40:9: The pattern
          {'accepted', Results0} can never match the type
          {'aborted', _}
[..]

Maybe that is just Mango, but it is possible that there are similar cases. Investigate the causes and fix make dialyze.

pgj avatar Apr 26 '23 11:04 pgj