dialyzer Questions
2
Solved
I have the following code:
@spec test_pass(String.t) :: (:failed | {:ok, map()})
def test_pass(pass) do
db_user = %{password_hash: @hash_for_foo}
with {:ok, ^db_user} <- Comeonin.Argon2.check_...
Cohin asked 4/4, 2018 at 21:45
1
Solved
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 ...
1
Solved
Equivalently, how can I typespec for a "single" UTF8 char?
Within a type definition, I can have generic "any string" or "any utf8 string" with
@type tile :: String.t # matches any string
@type ti...
1
Solved
I created new Mix.Task in /lib/mix/tasks/start.ex for my project
defmodule Mix.Tasks.Start do
use Mix.Task
def run(_), do: IO.puts("Hello, World!")
end
Now, it could be run from console like ...
2
Solved
I'm learning Erlang and trying to use Dialyzer to get maximum type-safety when it's possible. There's a thing that I don't understand: what is the type of non-terminating function and how to denote...
2
Solved
The following Erlang code seems to have an obvious error in its type specification, but dialyzer says that everything is ok. Am I misunderstanding or is this a bug in dialyzer? Running on Erlang 19...
1
Solved
Is it possible to define a type as follows:
defmodule Role do
use Exnumerator, values: ["admin", "regular", "restricted"]
@type t :: "admin" | "regular" | "restricted"
@spec default() :: t
d...
Reger asked 15/11, 2017 at 19:14
1
Solved
I have a behaviour X and a callback function with parameter type:
%{a: any}
Module Y implements behaviour X and the callback function in implementing module Y has parameter type:
%{a: any, b: a...
Protrusile asked 20/9, 2017 at 6:25
1
Dialyzer version 2.9. Erts 7.3. OTP 18.
In the following contrived erlang code:
-module(dialBug).
-export([test/0]).
%-export([f1/1]). % uncomment this line
test() ->
f1(1).
f1(X) when X &g...
2
Solved
-module(test).
-export([f/0, g/0]).
-spec f() -> RESULT when
RESULT :: 0..12 .
-spec g() -> RESULT when
RESULT :: 0..13 .
f () -> 100 .
g () -> 100 .
Running dialyzer (and typer...
1
free_vars_in_dterm({var, V}) -> {var, V}; obviously cannot type check, however, dialyzer says everything is OK.
$ dialyzer *erl
Checking whether the PLT ~/.dialyzer_plt is up-to-date... yes
P...
1
I am using the elixir_talk library. After connecting I want to call a private function once connected to beanstalkd. I just added typespecs and ran Dialyzer (via dialyxir). I get the errors:
my_mo...
1
Solved
I have a project that doesn't have -spec or -type in code, currently dialyzer can find some warnings, most of them are in machine generated codes.
Will adding type specs to code make dialyzer find...
1
Solved
I am trying to figure out how to combine parameterized types and type variables in Elixir type and function specs. As a simple example, let's say I am defining a Stack module:
defmodule Stack do
...
1
Solved
In my progress of learning Elixir, I am playing around with Dialyzer to put types on my functions. In this regard, I've noticed that Dialyzer doesn't seem to check the types for anonymous functions...
1
Solved
When implementing NIFs, Dialyzer gives me
Function crc16/1 has no local return
probably because I do exit in the .erl module (like the official docs recommend):
-module(my_nifs).
-export([crc...
Immolation asked 28/10, 2014 at 15:47
3
I'm learning Elixir, and the tool 'dialyzer' lets you do static analysis - annotate the function definition with the type specification of the parameters it expects and the output it returns. It's ...
2
Solved
I'm using lager to do my logging; it has a parser transform which converts lager:warn/1, etc. functions into lager:trace... functions.
dialyzer doesn't process the parser transform, so it warns wi...
2
Solved
I am reading with interest the online book "learn you some erlang" and trying some exercises to check my understanding.
I made some modification on the fifo example, in the chapter Type S...
2
I've created the snippet below based on this tutorial. The last two lines (feed_squid(FeederRP) and feed_red_panda(FeederSquid)) are obviously violating the defined constraints, yet Dialyzer finds ...
Shelli asked 7/8, 2012 at 18:8
1
© 2022 - 2024 — McMap. All rights reserved.