[erlang-questions] Dialyzer and List Type
Tue Apr 19 10:06:21 CEST 2016
On 04/19/2016 08:50 AM, PhayTsukiming wrote:
> Then apply dialyzer to this module and dialyzer warns:
> t.erl:8: Invalid type specification for function t:bar/1. The success
> typing is ([integer()]) -> [integer()]
> But if I change the specification of bar to:
> -spec bar([atom()])->[integer()].
> dialyzer will show no warnings. My intention is to make sure the
> argument of bar is the same type of list as the argument of foo.
OK, but then why don't you put the same spec there? Is there any
problem in this case?
> Is this normal? Do I miss or misunderstand something about success
> typing or dialyzer?
Yes, you do. All that dialyzer ever promised is that when it spits a
warning then this warning is correct. (This is the "Dialyzer is never
On the other hand, it never promised to produce warnings in all cases
you may expect it to do so.
More information about the erlang-questions