[erlang-questions] [Q] dialyzer message: The pattern X can never match the type Y
Ladislav Lenart
lenartlad@REDACTED
Thu May 29 10:03:34 CEST 2008
Per Gustafsson wrote:
> The most likely reason you get a warning like that, which is hard to
> understand is that you have something like this:
>
> -module(mod).
>
> -export([g/0]).
>
> g() ->
> f(bar),...,f(baz).
>
> f(Arg) when Arg == foo; Arg == bar; Arg == baz ->
> case Arg of
> foo -> x();
> _ -> y()
> end.
>
> That is you never actually call f/1 with foo and f/1 is not exported.
Ok, this should be it, except that I think the code is actually
executed. Thanks to your explanation, I finally managed to create
a module that reports the warning. It is based on the real module.
Thank you both for your helpful explanations; I am already looking
forward to more enlightenment to come :-)
Ladislav Lenart
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: dialyzer_test.erl
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080529/21c240e9/attachment.ksh>
More information about the erlang-questions
mailing list