Questions tagged [dialyzer]

Dialyzer is a tool that detects discrepancies in programs written in Erlang.

Dialyzer is a tool that detects discrepancies in programs written in Erlang. These may be:

  1. Function calls that are certain to fail
  2. Clauses that will never match
  3. Errors in the type specifications of records and functions
  4. Violations of the opacity of certain data structures

It does not require any modification in the code under examination (but it can use any type annotations provided) and can efficiently analyze single modules, applications or whole systems. It is part of Erlang/OTP distribution and is actively maintained by its developers.

You can read more here: http://erlang.org/doc/man/dialyzer.html

95 questions
1
vote
1 answer

How can I suppress dialyzer warning on comparison between module variable and local static variable?

Dialyzer blames the code trying to match against module variable: defmodule Main do # -> :demo @env Application.get_env(:myproject, :env) def run do case @env do :production -> 1 _ -> 2 end …
ryochin
  • 47
  • 5
1
vote
1 answer

Why does dialyzer fail on nocatch?

I ran Dialyzer and got the following error: Checking whether the PLT /tmp/.BRANCH.service.deps.plt is up-to-date... {"init terminating in do_boot", {{case_clause, {{nocatch, {dialyzer_error, …
2240
  • 1,368
  • 1
  • 6
  • 18
1
vote
1 answer

Dialyzer does not know :httpc

I am working on Elixir, using Erlang built-in :httpc function to perform a get request. if {:ok, {status, header, body}} = :httpc.request(:get, {img, []}, [], []) do # ... end The functions are working well. Then after running mix dialyzer, it…
Hendri Tobing
  • 308
  • 4
  • 13
1
vote
1 answer

Suspend a Erlang process by using receive after infinity timeout

I'm new to Erlang and I want to suspend in a function. I use receive with infinity timeout, my function looks like: suspend() -> receive after infinity->ok end. When I ran dialyzer tool, it return "Function has no local return". Should I…
1
vote
1 answer

"Dialyzer is usually never wrong", but I can't figure out how my @spec is incorrect

I have some code that is failing dialyzer and I cannot understand why. No matter what I put into the @spec at the top of the function, calls to that function return a puzzling dialyzer error. Here is a simplification of the function. As far as I can…
localshred
  • 2,174
  • 1
  • 18
  • 32
1
vote
1 answer

Correct way to structure Elixir GenServer with listening process

I'm using the elixir-socket library as a way to connect to my backend application to an external websocket. I need this process to be managed (restart if something fails, backoff exponentially if it can't connect etc). Currently, I've created a…
Andre Ogle
  • 162
  • 1
  • 8
1
vote
1 answer

Ignore dialyzer warning for generated code

I am trying to make my library(https://github.com/CrowdHailer/OK) for working with result tuples play nicely with dialyzer. At them moment there is code that raises a nice error if incorrect data input is given. However dialyzer points out that…
Peter Saxton
  • 3,848
  • 5
  • 25
  • 44
1
vote
1 answer

erlang override spec or ignore break contract error with rebar3

I'm running rebar3 on a project with a few 3rd party dependencies, and one of them has an issue with a defined spec. When I moved to rebar3, a new error popped up showing that one of my method calls breaks a contract: riakc_pb_socket:get(my_app,…
Paul
  • 4,092
  • 4
  • 27
  • 49
1
vote
1 answer

Typed list typespec never breaks the contract

If you define a typespec and use a different type of parameter it will display an error similar to: binary() ... breaks the contract ... boolean() For example this typespec: @spec check?(binary) :: boolean But it doesnt seem to work for a typed…
lapinkoira
  • 6,688
  • 7
  • 36
  • 74
1
vote
1 answer

Ecto changesets and Dialyzer errors

I have an umbrella app. I see the value of Dialyzer and I'm trying to get started with it. I've gotten pretty far but I have an issue around Ecto I cannot solve. This is for a small App in the umbrella that handles Authentication. I can trim it all…
Mark Eric
  • 693
  • 1
  • 6
  • 13
1
vote
2 answers

dialyxir mix task to create PLT exits without error or creating table

I am trying to use dialyxir to run dialyzer analysis on my project through the mix tasks it provides. I have added it to my dependencies and compiled as per the README. When I run the mix dialyxir.plt it reports no error and yet exits without…
Peter Saxton
  • 3,848
  • 5
  • 25
  • 44
1
vote
1 answer

Phoenix Dialyzer Changeset Warning

Dialyzer complains about Phoenix models when they are set up in the usual way, i.e. def changeset(model, params \\ :empty) ... the params instruct how the model is to be updated, with :empty as a default to differentiate between a blank form…
user3264325
  • 185
  • 1
  • 6
1
vote
1 answer

Erlang dialyzer on windows

I am on a Windows 10 machine. I installed Elixir through chocolatey; this installs Erlang 18. How do I install dialyzer? Is the console app a unix only thing?
Cristian Garcia
  • 8,732
  • 4
  • 45
  • 67
1
vote
2 answers

ignoring existing dialyzer errors with make and grep

I am trying to get jenkins to run dialyzer on erlang code but I am having a problem. As we are introducing this into an existing project there are a number of existing errors that we don't want to flag, which we have in the file…
Zachary K
  • 2,979
  • 1
  • 26
  • 36
1
vote
1 answer

Running dialyzer on an application: should I add the dependencies to the PLT?

I have an erlang application with sub-applications in apps/ and dependencies in deps/. Running dialyzer on one of the sub-apps, e.g.: $ dialyzer -r apps/app1/src --src works, but lists as "unknown functions" various functions from applications in…
Ivan Uemlianin
  • 903
  • 7
  • 18