I am close to using a behaviour as a pure interface and I feel dirty...

Kostis Sagonas kostis@REDACTED
Fri Aug 27 14:29:58 CEST 2021


The statement in the manual is indeed a bit confusing, but it clearly 
states that enabling this option affects **the exit status** of the 
dialyzer Unix command.  But dialyzer reports (and always reported) 
unknown functions, as you can see in the example it was mentioned in the 
beginning of this thread:

$ dialyzer f.erl
   Checking whether the PLT /home/kostis/.dialyzer_plt is up-to-date... yes
   Proceeding with analysis...
Unknown functions:
   hjsdfkjsdhfskjfhskhskhfskl:yutyrutyriuyiw/0
  done in 0m1.41s
done (passed successfully)


Note the "passed successfully" exit status (since I did not use 
-Wunknown).  If I use it, I get:


$ dialyzer -Wunknown f.erl
   Checking whether the PLT /home/kostis/.dialyzer_plt is up-to-date... yes
   Proceeding with analysis...
Unknown functions:
   hjsdfkjsdhfskjfhskhskhfskl:yutyrutyriuyiw/0
  done in 0m1.02s
done (warnings were emitted)


I hope this settles it.


But, if anybody from OTP reads this, perhaps the phrase:
  "; the default is not to return these warnings"
should be taken out from the manual.


Kostis


On 8/26/21 11:05 PM, Stanislav Ledenev wrote:
>  >> Apparently the dialyzer cli tool has `-Wunknown` on by default but 
> the api doesn't?
> 
> Quote (https://erlang.org/doc/man/dialyzer.html):
> "
> -Wunknown (***)
> Let warnings about unknown functions and types affect the exit status of 
> the command-line version. The default is to ignore warnings about 
> unknown functions and types when setting the exit status. When using 
> Dialyzer from Erlang, warnings about unknown functions and types are 
> returned; the default is not to return these warnings.
> 
> *** denotes options that turn on warnings rather than turning them off.
> "
> 
> чт, 26 авг. 2021 г. в 19:01, Tristan Sloughter <t@REDACTED 
> <mailto:t@REDACTED>>:
> 
>     __
>     I don't remember details and haven't reread this, but I dug up this
>     old discussion about rebar3 and dialyzer unknown option:
>     https://github.com/erlang/rebar3/issues/1751
> 
>     Apparently the dialyzer cli tool has `-Wunknown` on by default but
>     the api doesn't?
> 
>     On Thu, Aug 26, 2021, at 07:18, Stanislav Ledenev wrote:
>>     >> Surely Dialyzer will tell you that there is an unknown function
>>     in the
>>     >> module that you analyze.
>>
>>     I guess you are talking about the -Wunknown option?
>>     It is ok, but this option is turned off by default.
>>     At the beginning of learning Erlang's tools, in terms of  ease of
>>     use, the xref tool is more convenient (IMHO of course).
>>
>>     Anyway, Erlang has a bunch of really good tools and understanding
>>     them is a matter of time.
>>
>>
>>
> 



More information about the erlang-questions mailing list