Hello Folks,
I have an umbrella project that I’m trying to use dialyxir with, but I am getting a lot of “noise” regarding unknown functions and unknown types dealing with Ecto.
This gist contains most (though not all) of the output when I run mix dialyzer
. As you can see, I get errors such as:
Unknown functions:
'Elixir.Ecto.Adapters.Postgres':'in_transaction?'/1
'Elixir.Ecto.Adapters.Postgres':rollback/2
Unknown types:
'Elixir.Ecto.Changset':t/0
I was wondering if I am doing something wrong that is causing all of these warnings. I am running mix dialyzer
from the root of my umbrella app, and only one app has ecto
as a dependency.
P.S.
The root mix.exs
contains the following:
def project do
[apps_path: "apps",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
deps: deps,
dialyzer: [plt_add_deps: :transitive]]
end
Also, all of the dependencies are being built into the root umbrella project’s /deps
folder.
2 Likes
In case this is relevant, I’d also like to add that when I run mix dialyzer
from the umbrella’s root, I get this:
dialyzer --no_check_plt --plt /Users/stevenleiva/.dialyxir_core_19_1.3.3.plt -Wunmatched_returns -Werror_handling -Wrace_conditions -Wunderspecs _build/dev/lib/app_a/ebin _build/dev/lib/app_b/ebin
, where app_a
and app_b
are the two OTP apps I wrote myself.
I tried changing the command to dialyzer --no_check_plt --plt /Users/stevenleiva/.dialyxir_core_19_1.3.3.plt -Wunmatched_returns -Werror_handling -Wrace_conditions -Wunderspecs _build/dev/lib/*/ebin
but that doesn’t seem to be the way to do it.
1 Like
Did you run mix dialyzer.plt
first? It is necessary so it caches a lot of data which the subsequent mix dialyzer
uses. Presumably only needed to be ran once per Erlang / Elixir version.
1 Like
Hi @pdimitar - yes, after updating the root mix.exs
, I ran mix dialyzer.plt
, which ran a command like the below. (I’ve cut out the other libs, to focus on the fact that ecto’s ebin
folder is being included.
Checking PLT for missing apps.
Checking PLT for updated apps.
dialyzer --check_plt --plt /Users/stevenleiva/.dialyxir_core_19_1.3.3.plt -pa _build/dev/lib/ecto/ebin
Checking whether the PLT /Users/stevenleiva/.dialyxir_core_19_1.3.3.plt is up-to-date... yes
done (passed successfully)