-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Phoenix.Presence.list/1 raising dialyzer warnings #3027
Comments
Since I was debugging this a bit as well; it seems dialyzer believes the correct type should be: @spec list(%Phoenix.Socket{
:topic => %Phoenix.Socket{:topic => %Phoenix.Socket{:topic => map(), _ => _}, _ => _},
_ => _
}) :: no_return() However that seems incredibly broken since that would break the type definition of Phoenix Socket itself. Which started to make me believe it was broken in dialyzer (but its hard to know how it's getting to this definition, or how it is being implied AFAIK). Also if you remove: def list(%Phoenix.Socket{topic: topic}), do: list(topic) from the I also noticed: from pubsub @type presence :: {key :: String.t, meta :: map} however from @type presence :: %{key: String.t, meta: map()} which is fairly different (AFAIK) in terms of types. |
There is another dialyzer warning in the same module:
I think it comes from |
I ran into this also and I believe it is fixed in phoenixframework/phoenix_pubsub#116 which was released yesterday as part of phoenix_pubsub 1.1.1 https://hex.pm/packages/phoenix_pubsub/1.1.1 @whitepaperclip and @AndrewDryga does using phoenix_pubsub 1.1.1 fix this for you? |
This is fixed with the release of Phoenix PubSub 1.1.1 as @axelson has shown, so please update. Thanks! |
@chrismccord @axelson I updated Phoenix PubSub to 1.1.1, and while the original warning is gone, it's been replaced by another:
There's nothing in my defmodule MyAppWeb.Presence do
use Phoenix.Presence,
otp_app: :my_app,
pubsub_server: MyAppWeb.PubSub
end |
(This is on Phoenix 1.3.4 - I haven't checked the 1.4.0 RC yet.) |
Environment
Given the following modules:
The call to
Presence.list/1
causes Dialyzer to raise a warning. It can be suppressed by calling:Phoenix.Presence.list(MyAppWeb.Presence, room)
, but this shouldn't be required.lib/my_app_web/channels/room_channel.ex:68: The call 'Elixir.MyAppWeb.Presence':list(_room@1::<<_:8,_:_*1>>) will never return since it differs in the 1st argument from the success typing arguments: (#{'__struct__':='Elixir.Phoenix.Socket', 'topic':=#{'__struct__':='Elixir.Phoenix.Socket', 'topic':=#{'__struct__':='Elixir.Phoenix.Socket', 'topic':=map(), _=>_}, _=>_}, _=>_})
The text was updated successfully, but these errors were encountered: