[erlang-questions] Some questions about dialyzer

Kostis Sagonas kostis@REDACTED
Thu Dec 22 08:17:26 CET 2011


On 12/21/11 11:30, Alexander Kuleshov wrote:
> Hello,
>
> I run dialyzer for my project. I got:
> test.erl:97: The created fun has no local return
>
> In 97 line i have:
>
> List = lists:filter(fun(X) -> {_, _, SomeBoolFlag} = X,
> SomeBoolFlag == false
> end,
> TestList)
>
> And also i have message like:
>
> test.erl:161: Function test_func/2 will never be called
>
> But i have some test_func calls in my code in current file.
>
> What's wrong?


As others wrote, you do not provide enough information for others to
help you. My guess is that dialyzer has discovered that your TestList
contains data structures other than 3-tuples so it discovers that the
matching will fail.

But let me also comment on your filter function. Do you really want to
write:

    fun(X) -> {_, _, SomeBoolFlag} = X, SomeBoolFlag == false end

instead of:

    fun({_, _, SomeBoolFlag}) -> SomeBoolFlag == false end

which seems (to me at least) more sane?

Kostis




More information about the erlang-questions mailing list