diff options
author | Magnus Lång <[email protected]> | 2016-02-27 17:56:22 +0100 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2016-04-28 16:14:24 +0200 |
commit | 252df5612032cfba71285b5886937e88ba176529 (patch) | |
tree | f44ae2d8b8259865111cc47807b18289e096235a /lib/dialyzer/test/small_SUITE_data/src | |
parent | ac2f1c71d5b5169d49a5cd5fd73d28a702a58024 (diff) | |
download | otp-252df5612032cfba71285b5886937e88ba176529.tar.gz otp-252df5612032cfba71285b5886937e88ba176529.tar.bz2 otp-252df5612032cfba71285b5886937e88ba176529.zip |
erl_types: Add a map type representation
The type of a map is represented as a three-tuple {Pairs, DefaultKey,
DefaultValue}. DefaultKey and DefaultValue are types. Pairs is a list of
three-tuples {Key, mandatory | optional, Value}, where Key and Value are
types. All types Key must be singleton, or "known at compile time," as
the EEP put it. Examples:
#{integer()=>list()} {[], integer(), list()}
#{a=>char(), b=>atom()} {[{a, optional, char()},
{b, optional, atom()}],
none(), none()}
map() {[], any(), any()}
A more formal description of the representation and its invariants can
be found in erl_types.erl
Special thanks to Daniel S. McCain (@dsmccain) that co-authored a very
early version of this with me back in April 2014, although only the
singleton type logic remains from that version.
Diffstat (limited to 'lib/dialyzer/test/small_SUITE_data/src')
-rw-r--r-- | lib/dialyzer/test/small_SUITE_data/src/maps1.erl | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/dialyzer/test/small_SUITE_data/src/maps1.erl b/lib/dialyzer/test/small_SUITE_data/src/maps1.erl index bb2f66a498..597358d16a 100644 --- a/lib/dialyzer/test/small_SUITE_data/src/maps1.erl +++ b/lib/dialyzer/test/small_SUITE_data/src/maps1.erl @@ -21,7 +21,7 @@ recv(Packet, Fun, Chan) -> #{id := Can_id, data := Can_data} = P = decode(Packet), Fun(P). --spec decode(<<_:64,_:_*8>>) -> #{id => <<_:11>>,timestamp => char()}. +-spec decode(<<_:64,_:_*8>>) -> #{id => <<_:11>>,timestamp => char(),_ => _}. decode(<<_:12, Len:4, Timestamp:16, 0:3, Id:11/bitstring, 0:18, Data:Len/binary, _/binary>>) -> #{id => Id, data => Data, timestamp => Timestamp}. |