<feed xmlns='http://www.w3.org/2005/Atom'>
<title>otp.git/lib/dialyzer/test/map_SUITE_data/src, branch maint</title>
<subtitle>Mirror of Erlang/OTP repository.
</subtitle>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/'/>
<entry>
<title>dialyzer: Extend the map implementation's handling of ?unit</title>
<updated>2017-11-22T14:07:46+00:00</updated>
<author>
<name>Hans Bolinder</name>
<email>hasse@erlang.org</email>
</author>
<published>2017-11-15T11:57:57+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=985f5a1fae38caed84cde8bc09f6f60e91710f20'/>
<id>985f5a1fae38caed84cde8bc09f6f60e91710f20</id>
<content type='text'>
The Maps implementation handles ?unit in more cases.

Exactly when t_is_none_or_unit() is to be called is not clear to me.
The added cases are about a map type being ?unit, but the key or the
value of an association can also be ?unit, but that is not always
checked.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The Maps implementation handles ?unit in more cases.

Exactly when t_is_none_or_unit() is to be called is not clear to me.
The added cases are about a map type being ?unit, but the key or the
value of an association can also be ?unit, but that is not always
checked.
</pre>
</div>
</content>
</entry>
<entry>
<title>dialyzer: Modify handling of singleton map key types</title>
<updated>2017-09-12T11:32:29+00:00</updated>
<author>
<name>Hans Bolinder</name>
<email>hasse@erlang.org</email>
</author>
<published>2017-09-01T09:44:36+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=3d05725ceb26611ac8c19cc01df715089dc322d5'/>
<id>3d05725ceb26611ac8c19cc01df715089dc322d5</id>
<content type='text'>
The test case loop.erl shows that there is a problem with certain
singleton key types. Here the internal representation toggles between
 #{a | b =&gt; ...} and #{a =&gt; ..., b =&gt; ...}

The choice is to turn #{a | b =&gt; ...} into #{a =&gt; ..., b =&gt; ...} early
(t_from_form()). The aim is to keep as much info as possible (in
pairs). However, including complex singleton keys (tuples, maps) in
this scheme is potentially too costly, and a bit complicated. So one
more choice is made: let atoms and number (and nothing else) be
singleton types, and let complex keys go into the default key.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The test case loop.erl shows that there is a problem with certain
singleton key types. Here the internal representation toggles between
 #{a | b =&gt; ...} and #{a =&gt; ..., b =&gt; ...}

The choice is to turn #{a | b =&gt; ...} into #{a =&gt; ..., b =&gt; ...} early
(t_from_form()). The aim is to keep as much info as possible (in
pairs). However, including complex singleton keys (tuples, maps) in
this scheme is potentially too costly, and a bit complicated. So one
more choice is made: let atoms and number (and nothing else) be
singleton types, and let complex keys go into the default key.
</pre>
</div>
</content>
</entry>
<entry>
<title>Update test cases for erlang:hash/2 removal</title>
<updated>2017-01-25T10:56:29+00:00</updated>
<author>
<name>Björn-Egil Dahlberg</name>
<email>egil@erlang.org</email>
</author>
<published>2016-08-01T12:49:47+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=52097fab56edbbd8c6f8a57ec3b3f33aa60c5bb9'/>
<id>52097fab56edbbd8c6f8a57ec3b3f33aa60c5bb9</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>erl_bif_types: Properly unopaque maps:merge/2 args</title>
<updated>2016-09-07T14:45:21+00:00</updated>
<author>
<name>Magnus Lång</name>
<email>margnus1@telia.com</email>
</author>
<published>2016-09-07T14:45:21+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=5a9cc02690d033a2f3e695d7ac42c2756dbaaf04'/>
<id>5a9cc02690d033a2f3e695d7ac42c2756dbaaf04</id>
<content type='text'>
erl_bif_types:type/5 was calling erl_types:map_pairwise_merge/3 directly
with its (potentially opaque) arguments, causing Dialyzer crashes.

Bug (ERL-249) reported and minimised test case provided by Felipe
Ripoll.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
erl_bif_types:type/5 was calling erl_types:map_pairwise_merge/3 directly
with its (potentially opaque) arguments, causing Dialyzer crashes.

Bug (ERL-249) reported and minimised test case provided by Felipe
Ripoll.
</pre>
</div>
</content>
</entry>
<entry>
<title>erl_types: Normalise X:=none() pairs in t_map/3</title>
<updated>2016-06-28T11:36:11+00:00</updated>
<author>
<name>Magnus Lång</name>
<email>margnus1@telia.com</email>
</author>
<published>2016-06-28T09:23:49+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=a296fc4d7f6f52c78da4596b9b08f39147089d44'/>
<id>a296fc4d7f6f52c78da4596b9b08f39147089d44</id>
<content type='text'>
t_map/3 previously required callers to perform this normalisation, but
as t_from_form/5 would sometimes fail to do so, this requirement is
relaxed.

Bug (ERL-177) reported and shrunk by Luke Imhoff.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
t_map/3 previously required callers to perform this normalisation, but
as t_from_form/5 would sometimes fail to do so, this requirement is
relaxed.

Bug (ERL-177) reported and shrunk by Luke Imhoff.
</pre>
</div>
</content>
</entry>
<entry>
<title>erl_types: Fix t_subtract/2 correctness bug</title>
<updated>2016-04-28T14:16:10+00:00</updated>
<author>
<name>Magnus Lång</name>
<email>margnus1@telia.com</email>
</author>
<published>2016-04-19T13:02:17+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=29253c06dd99717e8424c0418144fd95d232c38d'/>
<id>29253c06dd99717e8424c0418144fd95d232c38d</id>
<content type='text'>
t_subtract/2 would break its postcondition by always returning the
underapproximation none() when given a variable on the right hand side.

This broke map type parsing, since it relied on t_subtract/2 to tell it
when map keys would shadow each other.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
t_subtract/2 would break its postcondition by always returning the
underapproximation none() when given a variable on the right hand side.

This broke map type parsing, since it relied on t_subtract/2 to tell it
when map keys would shadow each other.
</pre>
</div>
</content>
</entry>
<entry>
<title>erl_types: Fix crash merging maps with opaque keys</title>
<updated>2016-04-28T14:16:10+00:00</updated>
<author>
<name>Magnus Lång</name>
<email>margnus1@telia.com</email>
</author>
<published>2016-04-18T17:19:23+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=d2ba8674603bc4ef210ec91e6f51924f7efe8c2e'/>
<id>d2ba8674603bc4ef210ec91e6f51924f7efe8c2e</id>
<content type='text'>
Opaque keys in maps broke an assumption in
erl_types:mapmerge_otherv/3 (that the infinimum of a singleton type and
some other type would either be none() or that same singleton type),
causing a case_clause crash.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Opaque keys in maps broke an assumption in
erl_types:mapmerge_otherv/3 (that the infinimum of a singleton type and
some other type would either be none() or that same singleton type),
causing a case_clause crash.
</pre>
</div>
</content>
</entry>
<entry>
<title>dialyzer: Fix another pattern literal bug</title>
<updated>2016-04-28T14:16:10+00:00</updated>
<author>
<name>Magnus Lång</name>
<email>margnus1@telia.com</email>
</author>
<published>2016-04-18T17:01:54+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=81234c978d1ff1295d20158ed83b296b1f5b1c9f'/>
<id>81234c978d1ff1295d20158ed83b296b1f5b1c9f</id>
<content type='text'>
dialyzer_typesig:traverse/3 would perform an unsafe optimisation when
given a cons pattern that contained a map and could be folded into a
literal with cerl:fold_literal/1. In this case, when traversing the map
a type variable would be generated, but this variable would be dropped
by the erl_types:t_cons/2 constructor by in turn calling t_sup(),
producing the overapproximation any(). However, in this particular case,
dialyzer_typesig:traverse/3 is not allowed to overapproximate, since its
result is used in an EQ-constraint.

Although erl_types:t_tuple/1 does not overapproximate like t_cons/2,
which makes the bug unlikely to affect tuples too, the fix was
nevertheless applied defensively to the case of tuples as well.

Also, fix a bug where dialyzer_utils:refold_pattern/1 would generate
syntax nodes with two {label, _} attributes.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
dialyzer_typesig:traverse/3 would perform an unsafe optimisation when
given a cons pattern that contained a map and could be folded into a
literal with cerl:fold_literal/1. In this case, when traversing the map
a type variable would be generated, but this variable would be dropped
by the erl_types:t_cons/2 constructor by in turn calling t_sup(),
producing the overapproximation any(). However, in this particular case,
dialyzer_typesig:traverse/3 is not allowed to overapproximate, since its
result is used in an EQ-constraint.

Although erl_types:t_tuple/1 does not overapproximate like t_cons/2,
which makes the bug unlikely to affect tuples too, the fix was
nevertheless applied defensively to the case of tuples as well.

Also, fix a bug where dialyzer_utils:refold_pattern/1 would generate
syntax nodes with two {label, _} attributes.
</pre>
</div>
</content>
</entry>
<entry>
<title>dialyzer_contracts: Consider #{} a violation</title>
<updated>2016-04-28T14:16:10+00:00</updated>
<author>
<name>Magnus Lång</name>
<email>margnus1@telia.com</email>
</author>
<published>2016-03-01T11:51:16+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=67c7fd3c516b08d3d8814debca0db2a295e0c0b8'/>
<id>67c7fd3c516b08d3d8814debca0db2a295e0c0b8</id>
<content type='text'>
This is analogous to the case of nil. Since #{} is a base-case of almost
all map types, contract and success typing sharing #{} does not mean
much, and is often sign of a violation.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is analogous to the case of nil. Since #{} is a base-case of almost
all map types, contract and success typing sharing #{} does not mean
much, and is often sign of a violation.
</pre>
</div>
</content>
</entry>
<entry>
<title>dialyzer: Unfold cerl patterns containing maps</title>
<updated>2016-04-28T14:16:09+00:00</updated>
<author>
<name>Magnus Lång</name>
<email>margnus1@telia.com</email>
</author>
<published>2016-02-27T23:17:48+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=ebd967522612333e52a884181e6132b1ba7e5239'/>
<id>ebd967522612333e52a884181e6132b1ba7e5239</id>
<content type='text'>
Dialyzer relies heavily on the assumption that the type of a literal
that is used as a pattern is the type of any value that can match that
pattern. For maps, that is not true, and it was causing bad analysis
results. A new help function dialyzer_utils:refold_pattern/1 identifies
maps in literal patterns, and unfolds and labels them, allowing them to
be properly analysed.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Dialyzer relies heavily on the assumption that the type of a literal
that is used as a pattern is the type of any value that can match that
pattern. For maps, that is not true, and it was causing bad analysis
results. A new help function dialyzer_utils:refold_pattern/1 identifies
maps in literal patterns, and unfolds and labels them, allowing them to
be properly analysed.
</pre>
</div>
</content>
</entry>
</feed>
