Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Erlang dialyzer The created fun has no local return

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)

What's wrong?

Thank you.

like image 302
0xAX Avatar asked Dec 21 '11 08:12

0xAX


1 Answers

It seems dialyzer have found that TestList can contain something other than {_, _, SomeBoolFlag} tuples.

And also you can simplify this code a bit:

List = lists:filter(fun({_, _, Flag}) -> not Flag end, TestList)

or:

List = [Item || Item={_, _, false} <- TestList]
like image 154
hdima Avatar answered Oct 10 '22 00:10

hdima