Dialyzer giving warnings with `0` as line number

I’m seeing many warnings from dialyzer with 0 as the line number.

I have the config:

  defp deps do
    [ ...,  {:dialyxir, "~> 1.0", only: [:dev], runtime: false}, ... ]

Here’s the beginning of my output:

% mix dialyzer
Finding suitable PLTs
Checking PLT...
[:argon2_elixir, :asn1, :certifi, :comeonin, :compiler, :connection, :cowboy, :cowboy_telemetry, :cowlib, :crypto, :db_connection, :decimal, :ecto, :ecto_sql, :eex, :elixir, :file_system, :flow, :gen_stage, :gettext, :hackney, :httpoison, :idna, :inets, :jason, :kernel, :libcluster, :logger, :metrics, :mime, :mimerl, :nadia, :nanoid, :oauth2, :oauther, :parse_trans, :phoenix, :phoenix_ecto, :phoenix_html, :phoenix_live_dashboard, :phoenix_live_reload, :phoenix_live_view, :phoenix_pubsub, :plug, :plug_cowboy, :plug_crypto, :postgrex, :public_key, :ranch, :runtime_tools, ...]
PLT is up to date!
No :ignore_warnings opt specified in mix.exs and default does not exist.

Starting Dialyzer
[
  check_plt: false,
  init_plt: '/home/ravi/code/bitserver-elixir/_build/dev/dialyxir_erlang-24.0.2_elixir-1.12.0_deps-dev.plt',
  files: ['/home/ravi/code/bitserver-elixir/_build/dev/lib/app/ebin/Elixir.App.Exchanges.RESTUtils.beam',
   '/home/ravi/code/bitserver-elixir/_build/dev/lib/app/ebin/Elixir.App.Exchanges.Okex.Constants.beam',
   '/home/ravi/code/bitserver-elixir/_build/dev/lib/app/ebin/Elixir.AppWeb.SessionController.beam',
   '/home/ravi/code/bitserver-elixir/_build/dev/lib/app/ebin/Elixir.App.Application.beam',
   '/home/ravi/code/bitserver-elixir/_build/dev/lib/app/ebin/Elixir.AppTest.Tools.Iceberg.beam',
   ...],
  warnings: [:unknown]
]
Total errors: 43, Skipped: 0, Unnecessary Skips: 0
done in 0m2.82s
lib/app_test/patterns/futures_iceberg_order.ex:0:unknown_function
Function ExUnit.Assertions.assert/2 does not exist.
________________________________________________________________________________
...
________________________________________________________________________________                                                                                                                                   
lib/app/application.ex:0:exact_eq                                                                                                                                                                                  
The test :dev == :test can never evaluate to 'true'.                                                                                                                                                               
________________________________________________________________________________                                                                                                                                   
lib/app/application.ex:0:exact_eq                                                                                                                                                                                  
The test :dev == :test can never evaluate to 'true'.                                                                                                                                                               
________________________________________________________________________________                                                                                                                                   
lib/app/exchanges/ftx/ftx_rest.ex:0:exact_eq                                                                                                                                                                       
The test (_, _ -> boolean()) == nil can never evaluate to 'true'.                                                                                                                                                  
________________________________________________________________________________
lib/app_test/patterns/futures_iceberg_order.ex:0:no_return
Function setup_place_order/4 has no local return.
________________________________________________________________________________
lib/app_test/patterns/futures_iceberg_order.ex:0:no_return
Function test_order_placed_and_confirmed/3 has no local return.
________________________________________________________________________________

The dialyzer warnings are cryptic enough for my brain. How can I get line numbers to help identify the probem?

0 as a code line mean that it is in the generated code.

What Erlang version are you on? I think this is fixed on 24.0.3, see dialyzer: Do not expose line number 0 in message locations by uabboli · Pull Request #4893 · erlang/otp · GitHub

1 Like