[erlang-questions] [Q] dialyzer message: The pattern X can never match the type Y
Wed May 28 21:42:12 CEST 2008
Ladislav Lenart wrote:
> first I'd like to say that dialyzer is a wonderful and
> easy-to-use tool. It has already found several bugs for
> me :-)
> But I don't understand what dialyzer is trying to tell
> me with a warning like:
> The pattern X can never match the type Y.
> The actual code seems fine to me. It is similar to:
> f(Arg) when Arg == foo; Arg == bar; Arg == baz ->
> case Arg of
> foo -> x();
> _ -> y()
> However, dialyzer does not report a warning like:
> The pattern 'foo' can never match the type 'baz'
> for the module above.
> So I'd like to know what does the warning mean.
> Thanks in advance,
> Ladislav Lenart
The most likely reason you get a warning like that, which is hard to
understand is that you have something like this:
f(Arg) when Arg == foo; Arg == bar; Arg == baz ->
case Arg of
foo -> x();
_ -> y()
That is you never actually call f/1 with foo and f/1 is not exported.
> erlang-questions mailing list
More information about the erlang-questions