We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The following code is taken from https://learnyousomeerlang.com/dialyzer#typing-functions
-module(cards). -export([kind/1, main/0]). -type suit() :: spades | clubs | hearts | diamonds. -type value() :: 1..10 | j | q | k. -type card() :: {suit(), value()}. -spec kind(card()) -> face | number. kind({_, A}) when A >= 1, A =< 10 -> number; kind(_) -> face. main() -> number = kind({spades, 7}), face = kind({hearts, k}), number = kind({rubies, 4}), face = kind({clubs, q}).
$ erl --version Erlang/OTP 22 [erts-10.4.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe] [dtrace] $ dialyzer --version Dialyzer version v4.0.1 $ dialyzer cards.erl Checking whether the PLT /Users/yuuya_uezato/.dialyzer_plt is up-to-date... yes Proceeding with analysis... cards.erl:12: Function main/0 has no local return cards.erl:15: The call cards:kind ({'rubies', 4}) breaks the contract (card()) -> 'face' | 'number' done in 0m0.17s done (warnings were emitted)
$ erlc +debug_info cards.erl $ ../_build/default/bin/main.exe cards.beam done (passed successfully)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The following code is taken from https://learnyousomeerlang.com/dialyzer#typing-functions
Dialyzer
Fialyzer
The text was updated successfully, but these errors were encountered: