[erlang-questions] Dialyzer and numeric range values
zxq9
zxq9@REDACTED
Wed Nov 1 11:47:32 CET 2017
If I give a typespec
-type foo() :: 10..14.
Dialyzer will show me
10 | 11 | 12 | 13 | 14
I can see this is inclusive.
If I give a typespec like
4..65
Dialyzer will show me
1..255
If I give a typespec
3..500
Dialyzer will show me
1..1114111
Which is hugely different than what I want.
Which also winds up meaning that 0..16#ffff, which should be the legal range for ports, winds up being interpreted as type char(), which happens to be 0..16#10ffff which is totally bizarre.
In fact, the docs for inet show me this definition:
ip6_address() =
{0..65535,
0..65535,
0..65535,
0..65535,
0..65535,
0..65535,
0..65535,
0..65535}
( http://erlang.org/doc/man/inet.html )
which I am shown Dialyzer interpreting as
{char(), char(), char(), char(), char(), char(), char(), char()}
and I can see the actual definition of char in the docs is indeed
-type char() :: 0..16#10ffff.
( erlang.org/documentation/doc-5.8/doc/reference_manual/typespec.html )
What is going on here? Is this a new thing with R20's Dialyzer, or have I just never noticed these multi-byte leaps in value range resolution?
-Craig
More information about the erlang-questions
mailing list