Closed RobertDober closed 4 years ago
Still no warning:
defmodule Typestest do
@moduledoc false
@type keys :: :alpha
@spec key(integer()) :: keys()
def key(n)
def key(0), do: :alpha
def key(_), do: :beta
end
I am beginning to believe that I miss something obvious here :face_with_head_bandage:
Ok feeling better now, as the following code
defmodule Typestest do
@moduledoc false
@type keys :: :alpha
@spec key() :: keys()
def key(), do: :beta
end
does indeed trigger
lib/typestest.ex:6:invalid_contract
The @spec for the function does not match the success typing of the function.
Function:
Typestest.key/0
Success typing:
@spec key() :: :beta
Dialyxir does not originate warnings, only calls and reformast ones spit out by Dialyzer for Elixir. Any missing Dialyzer features or incorrect behavior are issues with Erlang core and dialyzer.erl. There are unfortunately illegal problems Dialyzer will still accept. Playing with the Dialyzer flags (-Wunmatched and friends) increases the number of warnings you get.
I see sorry for having bothered you.
No trouble!
Precheck
Environment
Current behavior
Expected behavior
The returned value
[beta: 2]
does not trigger a warning.Trying to shrink the error triggering case.... please stand by