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

New
wolf4earth
At work we plan to replace a totally overkill Kafka instance with a combination of SNS and SQS. I don’t want to get into a discussion on ...
New
GermaVinsmoke
Reading Programming Elixir 1.6 book, I’ve completed part 1 of the book. Now I’m thinking of reading Elixir in Action. What do you all sug...
New
Fl4m3Ph03n1x
Background I am trying to encode a structure into json format using the Jason library. However, this is not working as expected. Code L...
New
Fl4m3Ph03n1x
Background I have a personal project that is an elixir desktop application for PC Windows. It works pretty well, but now I want to give i...
New
harwind
In C, how they are different? char str[] = "xyz"; // statement //and char str[4] = "xyz"; // statement The first, i...
/c
New
Fl4m3Ph03n1x
Background I have a module that uses TypedStruct to create structs. This is the code: defmodule Shared.Data.Authorization do @moduledo...
New
harwind
I’m presently working on a backend development project to build a RESTful API using Python and Flask. The Scaler backend developer site h...
New
Fl4m3Ph03n1x
Background I have an umbrella project, where I run mix test from the root. In one of the apps, I am mocking the File module using the Mo...
New
yamuna
Hi everyone, I’m trying to run deepseek-coder:6.7b-instruct-q4_K_M in Docker using Ollama to create an LLM that will be used by CrewAI a...
New

Other popular topics Top

Devtalk
Reading something? Working on something? Planning something? Changing jobs even!? If you’re up for sharing, please let us know what you’...
1017 16965 374
New
Exadra37
Please tell us what is your preferred monitor setup for programming(not gaming) and why you have chosen it. Does your monitor have eye p...
New
foxtrottwist
Here’s our thread for the Keyboardio Atreus. It is a mechanical keyboard based on and a slight update of the original Atreus (Keyboardio ...
New
Margaret
Hello content creators! Happy new year. What tech topics do you think will be the focus of 2021? My vote for one topic is ethics in tech...
New
mafinar
This is going to be a long an frequently posted thread. While talking to a friend of mine who has taken data structure and algorithm cou...
New
AstonJ
If you get Can't find emacs in your PATH when trying to install Doom Emacs on your Mac you… just… need to install Emacs first! :lol: bre...
New
PragmaticBookshelf
Build efficient applications that exploit the unique benefits of a pure functional language, learning from an engineer who uses Haskell t...
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
Help
I am trying to crate a game for the Nintendo switch, I wanted to use Java as I am comfortable with that programming language. Can you use...
New
New

Latest in Questions

View all threads ❯