Hi, I've been working with an Elixir project for a couple of months now. And decided to clean up the house by using Dialyzer (Dialyxir).
By doing so I found this error which I'm failing to understand:
improper_list_constr
List construction (cons) will produce an improper list, because its second argument is map().
The code in cuestion is this:
Enum.reduce_while(tasks, [], fn %{type: type} = task, changes_so_far ->
execute_task(task, context, changes_so_far)
|> case do
{:ok, intent} ->
{:cont, [%{type: type, intent: intent} | changes_so_far]} # This line has the error
{:error, _} ->
{:halt, {:error, task}}
end
end)
The code runs. And the error dissapears by changing {:cont, [%{type: type, intent: intent} | []]} , so it indeed thinks that changes_do_far is a map(), which shouldn't be the case as the initial value it's []. Has anybody encountered a similar situation? Any help would be greatly appreciated! 😃