<div>Hi again,</div><div><br></div><div><div>The signature (or "success typing" in Dialyzer's terminology) is `my_module:handle_cast(term(),term()) -> {'noreply',term()}` because the second clause:</div>
<div><br></div><div>handle_cast(_Msg, State) -></div><div><div> {noreply, State}.</div></div><br class="Apple-interchange-newline"><div>will accept any terms as _Msg and State and return {noreply, State} in which State again is any term. In Dialyzer's type system, this {noreply, term()} return value will 'absorb' the definitely incorrect {noreply, {bugotak}} as {bugotak} is also a term(). From that point on, Dialyzer can assume that term() might also be #state{} and emit no warnings. This happens because Dialyzer checks the whole range of return values at once and not each particular clause. If all the return values were definitely different than #state{}, then and only then would Dialyzer warn you.</div>
<div><br></div><div>Again, trying to check each particular return value against a given spec might be an interesting extension and we will consider it in the future.</div><div><br></div><div>Stavros</div><br><div class="gmail_quote">
On Fri, Jul 6, 2012 at 11:39 AM, Maxim Treskin <span dir="ltr"><<a href="mailto:zerthurd@gmail.com" target="_blank">zerthurd@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I just really not understand. Function handle_cast returns, and returns incorrect type according to -spec signature, right?<div>Why Dialyzer lose this information? It is sort of missbehaviour i think.</div><div><div><div class="h5">
<div class="gmail_quote"><br></div></div></div><span class="HOEnZb"><font color="#888888">-- <br>Max Treskin<br>
</font></span></div>
</blockquote></div><br></div>