[erlang-questions] Dialyzer cannot catch gen_server callback return type error

Maxim Treskin zerthurd@REDACTED
Thu Jul 5 11:12:01 CEST 2012


Hello

I got error when gen_server callback returns not a proper process state,
but another erlang term(), and dialyzer not warns me about this.
After specification of Module:handle_cast/2 with

-spec handle_cast(Msg :: term(), State :: #state{}) -> {noreply, NewState
:: #state{}}.

where #state{} is record of process state, it not warns too (it also not
warns about {stop, normal, State} return value).

Code of callback:

handle_cast({message}, _State) ->
    NewState = {bugotak},
    {noreply, NewState};

Is it possible to make that dialyzer can see this mistake? Does it check
types of gen_server callbacks?

-- 
Max Treskin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120705/b5067951/attachment.htm>


More information about the erlang-questions mailing list