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

PragmaticBookshelf
For this new edition of the best-selling Learn to Program, Chris Pine has taken a good thing and made it even better. First, he used the ...
New
bot
Kotlin v1.4.0 has been released. Link: Release Kotlin 1.4.0 · JetBrains/kotlin · GitHub
New
DevotionGeo
I know that -t flag is used along with -i flag for getting an interactive shell. But I cannot digest what the man page for docker run com...
New
First poster: bot
Ruby on Rails v6.1.0 has been released. Link: Release 6.1.0 · rails/rails · GitHub
New
PragmaticBookshelf
This hands-on book will quickly get you building, querying, and comparing graph data models using a robust, concurrent programming langua...
New
Cellane
I’ve been asked by my supervisors at work to finally give everyone in the team presentation about “that Elixir thing you can’t seem to sh...
New
ManningBooks
Rust in Action introduces the Rust programming language by exploring numerous systems programming concepts and techniques. You'll be lear...
New
PragmaticBookshelf
This project based book gets you up to speed on building and deploying Elixir IoT applications using Nerves, as you develop a real-world ...
New
ManningBooks
Kubernetes in Action, Second Edition teaches you to use Kubernetes to deploy container-based distributed applications. You'll start with ...
New
JimmyCarterSon
Hello, I am. very new to Elixir lang I have only been doing it for about 2 weeks. I recently started following this tutorial todo list, ...
New

Other popular topics Top

siddhant3030
I’m thinking of buying a monitor that I can rotate to use as a vertical monitor? Also, I want to know if someone is using it for program...
New
AstonJ
There’s a whole world of custom keycaps out there that I didn’t know existed! Check out all of our Keycaps threads here: https://forum....
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
DevotionGeo
The V Programming Language Simple language for building maintainable programs V is already mentioned couple of times in the forum, but I...
New
PragmaticBookshelf
A Hero’s Journey with Chris Pine @chrispine Chris Pine, author of Learn to Program, Third Edition, discusses his journey to beco...
New
foxtrottwist
A few weeks ago I started using Warp a terminal written in rust. Though in it’s current state of development there are a few caveats (tab...
New
PragmaticBookshelf
Author Spotlight Jamis Buck @jamis This month, we have the pleasure of spotlighting author Jamis Buck, who has written Mazes for Prog...
New
PragmaticBookshelf
Author Spotlight Erin Dees @undees Welcome to our new author spotlight! We had the pleasure of chatting with Erin Dees, co-author of ...
New
PragmaticBookshelf
Author Spotlight: Tammy Coron @Paradox927 Gaming, and writing games in particular, is about passion, vision, experience, and immersio...
New
AstonJ
This is cool! DEEPSEEK-V3 ON M4 MAC: BLAZING FAST INFERENCE ON APPLE SILICON We just witnessed something incredible: the largest open-s...
New