Dialyzer returning an error when used with Phoenix Presence

I have code somewhat similar to the following in a function:

MyApp.Presence.list("somechannel") == []

This causes dialyzer to consider the function to have no_local_return on this function as well as all the functions that call this function. Is there some way to handle that so that it doesn’t propagate all the way up the stack?

I realized that I missed the core dialyzer error:

The call:
MyApp.Presence.list(
  _socket :: %Phoenix.Socket{
    :assigns => _,
    :channel_pid => pid(),
    :topic => binary(),
    _ => _
  }
)

will never return since it differs in arguments with
positions 1 from the success typing arguments:

(%Phoenix.Socket{
  :topic => %Phoenix.Socket{:topic => %Phoenix.Socket{:topic => map(), _ => _}, _ => _},
  _ => _
})

But MyApp.Presence.list/1 seems to work fine when passed a binary/string instead of a socket so I’m not sure what the next step would be. Does this indicate a bug in Phoenix?

I haven’t had time to look into this, but we are tracking this issue on the Phoenix side.
https://github.com/phoenixframework/phoenix/issues/3027

If any dialyzer folks out there want to look into this, it would be much appreciated.

1 Like

Ah, thanks. I’ll track it there!

@chrismccord my issue was fixed with https://github.com/phoenixframework/phoenix_pubsub/pull/116 which you just released yesterday as part of phoenix_pubsub 1.1.1 https://hex.pm/packages/phoenix_pubsub/1.1.1 :heart::tada:

1 Like

Great!

2 Likes