Here’s my terminal:
mix dialyzer --quiet
lib/my_app_web/channels/room_channel.ex:28:unmatched_return
The expression produces a value of type:
:ok | {:error, _}
but this value is unmatched.
________________________________________________________________________________
done (warnings were emitted)
Halting VM with exit status 2
The code is the default generated handle_in/3
:
# It is also common to receive messages from the client and
# broadcast to everyone in the current topic (room:lobby).
@impl true
def handle_in("shout", payload, socket) do
broadcast(socket, "shout", payload) # <= here
{:noreply, socket}
end
I could do:
_ = broadcast(socket, "shout", payload) # or :ok, or case, etc...
# or .dialyzer_ignore.exs
{"lib/my_app_web/channels/room_channel.ex", :unmatched_return, 28}
I’m not a fan of any of these workarounds. I’m wondering if it is normal to get this warning here (seems like it would be common) or have I messed something up?
Thanks for any feedback