What to do about incorrect dialyzer warnings? Specifically it's telling me that I need to include a dependency that I'm already including.

I have the following dialyzer warning in VSCode (via ElixirLS plugin):

RiakPool.Pooler.take_member/0 defined in application :riak_pool is used by the current application but the current application does not directly depend on :riak_pool. To fix this, you must do one of:

  1. If :riak_pool is part of Erlang/Elixir, you must include it under :extra_applications inside \"def application\" in your mix.exs
  2. If :riak_pool is a dependency, make sure it is listed under \"def deps\" in your mix.exs
  3. In case you don't want to add a requirement to :riak_pool, you may optionally skip this warning by adding [xref: [exclude: RiakPool.Pooler]] to your \"def project\" in mix.exs"

but in mix.exs I have:

  defp deps do
      {:riak, "~> 1.1"},
      {:uuid, "~> 1.1"},
      {:riak_pool, path: "../riak_pool"}

and when I do ‘iex -S mix’, the application starts and runs without complaining as expected. So the :riak_pool application is running.

Any help or information as to why I’m getting this warning or how it should be dealt would be greatly appreciated.

Thanks in advance,

1 Like

This warning is not related to dialyzer. It is because of elixir 1.11 boundary checking.

Can you therefore please tell us which version of elixir you are using?

Also which application is compiled when the warning appears? Can you perhaps create an example repository that shows an example?

1 Like
Erlang/OTP 23 [erts-11.2] [source] [64-bit] [smp:20:20] [ds:20:20:10] [async-threads:1] [hipe]

Interactive Elixir (1.11.2) - press Ctrl+C to exit (type h() ENTER for help)

I stayed on Elixir 1.11 and OTP 23 because when I tried 1.12 and OTP 24 there were problems that I wasn’t able to resolve. It’s been long enough now that I don’t remember exactly what they were. Google said that other people were having the same issues and the workarounds were ugly. There have since been some minor updates that have hopefully solved the issues, but I haven’t tried upgrading again.

There were also some deprecated functions being used in one of the libraries I got from Hex that are removed in OTP 24.

I don’t get that warning when compiling, even after mix clean; mix clean --deps; mix compile. The only place I get the warning is in VSCode in the problems windows in a module that I’m using functions defined in the :riak_pool application.

AND… Now that I did the mix clean; mix clean --deps; mix compile, the warning is gone in VSCode.

Sorry for the noise and thank you.


1 Like