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

109 questions
1
vote
1 answer

Why do type specs in OTP repeat parameter names?

In type specs for the Erlang standard library, there are almost never any types in the spec until the when clause. For example, the spec for lists:member/2 is like this: -spec member(Elem, List) -> boolean() when Elem :: T, List :: [T], …
Max Heiber
  • 14,346
  • 12
  • 59
  • 97
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,547
  • 2
  • 12
  • 30
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
  • 351
  • 5
  • 14
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…
tandathuynh148
  • 190
  • 5
  • 15
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,244
  • 1
  • 21
  • 33
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
  • 172
  • 1
  • 8
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,422
  • 5
  • 29
  • 55
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
  • 8,320
  • 9
  • 51
  • 94
1
vote
1 answer

Can't get opaque types to cause an abstraction violation in dialyzer

Here is a module that defines an opaque type: -module(a). -export([people/0, get_names/1]). -export_type([person/0]). -opaque person() :: {person, first_name()}. -type first_name() :: string(). -spec people() -> People when People ::…
7stud
  • 46,922
  • 14
  • 101
  • 127
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
  • 237
  • 1
  • 2
  • 9
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
  • 9,630
  • 6
  • 54
  • 75
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
  • 3,205
  • 1
  • 29
  • 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
  • 953
  • 7
  • 21
1
vote
1 answer

Erlang dialyzer from werl.exe?

I tried running dialyzer --help from the werl command line and it hung. Am I missing something? Is it only available for the dos shell (I'm on XP SP3)?
pandoragami
  • 5,387
  • 15
  • 68
  • 116
1
vote
1 answer

glpkerl (glpk erlang library) compile error

I am trying to compile the glpkerl library on Ubuntu 11.10, but without success so far. Since I am getting errors all the way, maybe there is something crucial that I am missing: What I tried My installed Erlang version is R14B02 (installed via the…