aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer/src/dialyzer_typesig.erl
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2017-11-28 12:37:42 +0100
committerHans Bolinder <[email protected]>2017-11-28 12:37:42 +0100
commit59ca0ddeb08d6ec433fa50eaa0a7175a09766b83 (patch)
tree2bf6f2d981a75ec23bfa4c459fb0346c2825de06 /lib/dialyzer/src/dialyzer_typesig.erl
parent56eecdc8d0a0ebe7eb6b6d180e1854a72ddf82ac (diff)
parent985f5a1fae38caed84cde8bc09f6f60e91710f20 (diff)
downloadotp-59ca0ddeb08d6ec433fa50eaa0a7175a09766b83.tar.gz
otp-59ca0ddeb08d6ec433fa50eaa0a7175a09766b83.tar.bz2
otp-59ca0ddeb08d6ec433fa50eaa0a7175a09766b83.zip
Merge branch 'hasse/dialyzer/maps_anon_fun/OTP-14743' into maint
* hasse/dialyzer/maps_anon_fun/OTP-14743: dialyzer: Extend the map implementation's handling of ?unit dialyzer: Use string:find() instead of string:str()
Diffstat (limited to 'lib/dialyzer/src/dialyzer_typesig.erl')
-rw-r--r--lib/dialyzer/src/dialyzer_typesig.erl12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/dialyzer/src/dialyzer_typesig.erl b/lib/dialyzer/src/dialyzer_typesig.erl
index c4d8f45447..d03326ec97 100644
--- a/lib/dialyzer/src/dialyzer_typesig.erl
+++ b/lib/dialyzer/src/dialyzer_typesig.erl
@@ -41,7 +41,7 @@
t_is_float/1, t_is_fun/1,
t_is_integer/1, t_non_neg_integer/0,
t_is_list/1, t_is_nil/1, t_is_none/1, t_is_number/1,
- t_is_singleton/1,
+ t_is_singleton/1, t_is_none_or_unit/1,
t_limit/2, t_list/0, t_list/1,
t_list_elements/1, t_nonempty_list/1, t_maybe_improper_list/0,
@@ -528,13 +528,14 @@ traverse(Tree, DefinedVars, State) ->
false -> t_any();
true ->
MT = t_inf(lookup_type(MapVar, Map), t_map()),
- case t_is_none(MT) of
+ case t_is_none_or_unit(MT) of
true -> t_none();
false ->
DisjointFromKeyType =
fun(ShadowKey) ->
- t_is_none(t_inf(lookup_type(ShadowKey, Map),
- KeyType))
+ ST = t_inf(lookup_type(ShadowKey, Map),
+ KeyType),
+ t_is_none_or_unit(ST)
end,
case lists:all(DisjointFromKeyType, ShadowKeys) of
true -> t_map_get(KeyType, MT);
@@ -567,7 +568,8 @@ traverse(Tree, DefinedVars, State) ->
case cerl:is_literal(OpTree) andalso
cerl:concrete(OpTree) =:= exact of
true ->
- case t_is_none(t_inf(ShadowedKeys, KeyType)) of
+ ST = t_inf(ShadowedKeys, KeyType),
+ case t_is_none_or_unit(ST) of
true ->
t_map_put({KeyType, t_any()}, AccType);
false ->