[erlang-questions] dialyzer is driving me nuts

Fred Hebert <>
Tue Oct 18 20:02:04 CEST 2011


On Tue, Oct 18, 2011 at 1:57 PM, Joel Reymont <> wrote:

> Let's just say I've been going batshit crazy since last week, managing to
> fix a single file to Dialyzer's liking.
>
> Consider the following https://gist.github.com/5744c70b2a6f918ddb56
>
> The first message can be summarized as
>
> barrier_start.erl:50: The specification for barrier_start:barrier_start/3
> states that the function might also return {'stop',#game{},tuple()} but the
> inferred return is {'continue',#game{{},_} | {'skip',#game{},_}
>
> but what about this clause in my code? Does Dialyzer think it will never be
> triggered? Why?
>
> barrier_start(Game = #game{}, Ctx, {'EXIT', Barrier, _})
>  when is_pid(Barrier),
>       Barrier =:= Game#game.barrier ->
>    gamelib:notify_start_game(Game),
>    {stop, Game, Ctx};
>


I think for that one the problem is that it infers it can find 'skip' but
your type doesn't have it in there. You won't easily be able to add that
clause without overloading contracts though. This is a wild guess.


>
> The second message is a beauty!
>
> barrier_start.erl:74: The call
> gamelib:join(Game::#game{},Event::#pm_event{pm_message::#pm_join{}},1) does
> not have a term of type #game{} (with opaque subterms) as 1st argument
>

I believe this means you'd be breaking the contract of gamelib:join/2 if it
doesn't accept #game{} as a tuple in its own type spec, or that the #game{}
it accepts doesn't have similar opaque terms inside of it. I haven't tried
to fix it and see though.


>
> What in the world does it mean?
>
> Help!!!
>
> --------------------------------------------------------------------------
> - for hire: mac osx device driver ninja, kernel extensions and usb drivers
> ---------------------+------------+---------------------------------------
> http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont
> ---------------------+------------+---------------------------------------
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20111018/b14c9812/attachment.html>


More information about the erlang-questions mailing list