[erlang-questions] dialyzer: the pattern ... can never match the type 100
Kostis Sagonas
kostis@REDACTED
Fri Oct 3 21:42:31 CEST 2008
Joel Reymont wrote:
> Any suggestions on how to fix this?
>
> pot.erl:28: The pattern Pot = {'side_pot', _, _} can never match the
> type 100
How more explicit can the warning be?
It says that you have a function (I am willing to bet that it is not
exported) and the only call to it is with the integer 100. The first
clause below is clearly dead code -- the pattern will never match 100.
%% vvv This is what it's complaining about
new_side_pot(Pot = #side_pot{}) ->
new_side_pot(Pot#side_pot.all_in, Pot#side_pot.members);
new_side_pot(AllInAmt)
when is_number(AllInAmt) ->
new_side_pot(AllInAmt, gb_trees:empty()).
The solution to this one is to comment the clause out or simply remove
it. It's simply not needed in your module.
Kostis
PS. What Niclas wrote as a "solution" is very misleading. AFAIK there
is no difference between Pot = #side_pot{} and #side_pot{} = Pot in
a clause head.
More information about the erlang-questions
mailing list