[erlang-questions] Dialyzer

Kostis Sagonas kostis@REDACTED
Mon May 2 11:23:57 CEST 2011


Carlo Bertoldi wrote:
> Hello list,
>  this is a bad monday, and I'm stuck with this warning from dialyzer:
> 
> The specification for change_interval/2 states that the function might 
> also return [any()] but the inferred return is none()
> 
> The code:
> -spec(change_interval(integer(), [term()]) -> [term()]).
> 
> change_interval(NewInterval, Config) ->
>     NewPause = {pause, NewInterval},
>     NewConfig = lists:keyreplace(pause, 1, Config, NewPause),
>     write_config(NewPause),
>     NewConfig.
> 
> Config is a list of terms, built using file:consult.
> I googled a bit, and I understand that this is a common problem, but it 
> really goes over my head.
> What am I missing?

I do not know what you are missing, but it's pretty obvious that the 
code you've given us is missing quite a lot...  For starters, it does 
not include function write_config/1 so it cannot be compiled. Second, 
you claim that Config is a list of terms built somehow but you do not 
show us that code.

If you want help in finding out what the problem is, please post a 
(preferably minimal) module that shows the symptoms you are 
experiencing.  Also, which dialyzer version is this?

Kostis



More information about the erlang-questions mailing list