Fl4m3Ph03n1x

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 --plt
  • mix 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

Fl4m3Ph03n1x

Fl4m3Ph03n1x

Turns out this was an error from my side, namely I was not interpreting the documentation correctly.

The correct types are:

  • ETS.KeyValueSet.set_options()
  • ETS.KeyValueSet.t()
  • ETS.table_identifier()

This was more apparent from reading the source code as posted in this thread:

Popular Backend topics Top

Kurisu
Hello and happy new year! I would like to buy a Ruby On Rails ebook for learning purpose. What would be the ROR equivalent of “Programm...
New
AstonJ
In case anyone else is wondering why Ruby 3 doesn’t show when you do asdf list-all ruby :man_facepalming: do this first: asdf plugin-upd...
New
AstonJ
More cool tech inspired by <span class="hashtag-icon-placeholder"></span>erlang :nerd_face: By combining the fault-tolerance and massiv...
New
Jsdr3398
I really need developers to help create my messaging platform but I’m not sure how much they want etc. I’ve never hired anyone before :s...
New
gagan7995
API 4 Path: /user/following/ Method: GET Description: Returns the list of all names of people whom the user follows Response [ { ...
New
ManningBooks
Effectively reading and understanding existing code is a developer’s superpower. In this book, you’ll master techniques for code profilin...
New
jeya
Dear Geeks I am new to pytest. I am following a youtube channel. I am writing the same code. learning to test login functionality of an...
New
ManningBooks
Spring Security in Action, Second Edition is a revised version of the bestselling original, fully updated for Spring Boot 3 and Oauth2/Op...
New
ManningBooks
Dodge the common mistakes that even senior developers make, take full advantage of static analysis tools, and deliver robust and error-fr...
New
PragmaticBookshelf
Leverage Elixir and the Nx ecosystem to build intelligent applications that solve real-world problems in computer vision, natural languag...
New

Other popular topics Top

malloryerik
Any thoughts on Svelte? Svelte is a radical new approach to building user interfaces. Whereas traditional frameworks like React and Vue...
New
DevotionGeo
I know that these benchmarks might not be the exact picture of real-world scenario, but still I expect a Rust web framework performing a ...
New
AstonJ
I ended up cancelling my Moonlander order as I think it’s just going to be a bit too bulky for me. I think the Planck and the Preonic (o...
New
Exadra37
Oh just spent so much time on this to discover now that RancherOS is in end of life but Rancher is refusing to mark the Github repo as su...
New
PragmaticBookshelf
Learn different ways of writing concurrent code in Elixir and increase your application's performance, without sacrificing scalability or...
New
PragmaticBookshelf
“A Mystical Experience” Hero’s Journey with Paolo Perrotta @nusco Ever wonder how authoring books compares to writing articles?...
New
gagan7995
API 4 Path: /user/following/ Method: GET Description: Returns the list of all names of people whom the user follows Response [ { ...
New
First poster: joeb
The File System Access API with Origin Private File System. WebKit supports new API that makes it possible for web apps to create, open,...
New
New
First poster: bot
Large Language Models like ChatGPT say The Darnedest Things. The Errors They MakeWhy We Need to Document Them, and What We Have Decided ...
New