jeremyjh / dialyxir

Mix tasks to simplify use of Dialyzer in Elixir projects.
Apache License 2.0
1.69k stars 141 forks source link

Is the `@dialyzer` module attribute suggestion for `Phoenix.Presence` in the Wiki still accurate? #459

Closed bmitc closed 2 years ago

bmitc commented 2 years ago

Precheck

Environment

Note: As mentioned above, we are in the process of upgrading versions of Elixir and Erlang/OTP and will then follow-up shortly with dependencies. So we will be upgrading Dialyxir, just not right now.

Current behavior

In the Phoenix Dialyxir Quickstart Wiki entry, it is mentioned that for Phoenix.Presence, we should have:

  @dialyzer [
    {:nowarn_function, 'init': 1},
    {:nowarn_function, 'track': 3},
    {:nowarn_function, 'track': 4},
    {:nowarn_function, 'update': 3},
    {:nowarn_function, 'update': 4},
    ]

After upgrading from Elixir 1.11.4 and Erlang/OTP 23.0.2 to Elixir 1.13.4 and Erlang/OTP 24.3.3, I know receiving a compiler error stating:

** (CompileError) lib/apm_web/channels/presence.ex:1: undefined function init/1 given to @dialyzer :nowarn_function

This compile error was not generated before the upgrade, and I haven't touched any other dependency.

Expected behavior

I am new to Phoenix, and as far as I can tell, init/1 is and was not a callback in the Phoenix.Presence module.

I have two questions:

  1. Does the Wiki article need to be updated to remove init/1? a. If not, where should this function be coming from?
  2. Any thoughts about why the Elixir/Erlang upgrade caused this to go from no compile error to a compile error?

Thank you!

bmitc commented 2 years ago

Tagging @OvermindDL1 since they added the Phoenix.Presence section here and @jeremyjh since they seem to be the primary author of that Wiki page (I suppose redundant give their status as owner of this repository).

jeremyjh commented 2 years ago

I doubt anything on that page is still accurate, I should probably just remove it. Obviously they've changed some internals in presence since it was created.

bmitc commented 2 years ago

Thanks for taking a look @jeremyjh! What was curious to me was that I didn't update Phoenix. I only updated Elixir and Erlang. So maybe some macro shenanigans in Phoenix no longer expose whatever the init/1 function is/was due to a change in Elixir?

I am not overly concerned but was just trying to understand why the version bump on Elixir and Erlang caused this to become a compile error. Getting rid of {:nowarn_function, 'init': 1} got rid of the compiler error.