Fl4m3Ph03n1x
Dialyzer cannot recognize types from dependencies
Background
I have an umbrella app where I use a dependecy called ETS. This dependency has a type called set_options that I use in some of my specs.
Problem
The code works fine, but dialyzer is complaining. Namely:
lib/web_interface/persistence.ex:11:20:unknown_type
Unknown type: ETS.set_options/0.
________________________________________________________________________________
lib/web_interface/persistence.ex:11:65:unknown_type
Unknown type: ETS.t/0.
Which then cause a ton of cascading errors.
To try and fix this, I added the following to my root mix.exs file (the one from the umbrella app, not the one from the child app):
def project,
do: [
apps_path: "apps",
version: "2.1.7",
start_permanent: Mix.env() == :prod,
deps: deps(),
dialyzer: [
plt_add_deps: :app_direct,
plt_add_apps: [
:ets
],
plt_core_path: "plts",
plt_local_path: "plts"
]
]
And then run:
mix dialyzer --pltmix dialyzer
This did not work and the output was the same.
I then tried adding this to the mix.exs of the child app in question (alongside the previous changes):
def application do
[
mod: {WebInterface.Application, []},
extra_applications: [:logger, :ets]
]
end
Unfortunately, nothing worked and I still get the same dialyzer errors.
Question
How can I fix dialyzer so it recognized types from my dependencies?
Marked As Solved
al2o3cr
Both of these appear to be defined in ETS.KeyValueSet rather than the top-level ETS module:
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









