Erlang dialyzer Fun created has no local return

I am launching a dialyzer for my project. I got:

test.erl:97: The created fun has no local return

On line 97, I have:

    List = lists:filter(fun(X) ->
                               {_, _, SomeBoolFlag} = X,
                               SomeBoolFlag == false
                        end,
                TestList)

What's wrong?

Thank.

+5
source share
1 answer

Seems to have dialyzerdiscovered that it TestListmay 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]
+11
source

All Articles