[erlang-questions] picky dialyzer

Ulf Wiger ulf.wiger@REDACTED
Thu Jan 13 13:34:16 CET 2011


On 13 Jan 2011, at 12:09, Kostis Sagonas wrote:

> Because it is very clever!  :D
> 
> You are looking at the tree and you are missing the forest... You are concentrating at the type definitions you have added, when you should be examining the code you wrote. The code of q_is_empty/1 reads:

Well, I didn't really question that dialyzer had a real complaint, only that the warning became a bit confusing when it obviously used the static type definition as a starting point, but then pruned it, rather than saying - as it actually does on occasion - that it was a derived type it was comparing to.

> Well, if I pull the latest version from this repository, I get many more dialyzer warnings when I analyze this file. For example, dialyzer complains that

*Many* more?

I guess I'll have to try and rebuild the plt, or ask you what special
dialyzer version you're using. :)   I'm using OTP R14B here.

(…with plt rebuilt, no extra warnings surfaced)


> jobs_server.erl:991: The call erlang:spawn_monitor(M::atom(),F::atom(),A::byte()) will never return since it differs in the 3rd argument from the success typing arguments: (atom(),atom(),[any()])
> 
> and it is of course right.
> 
> The problem is that your #producer{} definition is a buggy. It reads:
> 
> -record(producer, {f = {erlang,error,[undefined_producer]} :: mfa() | function()}).
> 
> mfa() is an alias for {atom(),atom(),byte()}.

Ahh, as in {Module, Function, Arity}?

In the System Limits of the Efficiency Guide, it says that you can have 
256 arguments in a function or fun. Since dialyzer is never wrong, I will
assume that the Efficiency Guide is? :)

> You want to write {atom(),atom(),[term()]} instead of mfa() there.

I did add a type mfa() that had exactly that definition, but dialyzer 
complained that mfa() couldn't be redefined. It didn't occur to me that
it could be defined as something other than {Module, Function, Args}.
Now I know.

Thanks for your help.

BR,
Ulf

Ulf Wiger, CTO, Erlang Solutions, Ltd.
http://erlang-solutions.com





More information about the erlang-questions mailing list