aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMagnus Lång <[email protected]>2016-02-28 00:30:09 +0100
committerHans Bolinder <[email protected]>2016-04-28 16:16:09 +0200
commit50054b94fee69fd39af32b4161d005588ed5f22f (patch)
tree65db0f3a56818ec863952820ee757a013e80e213 /lib
parente16ff38bd1f235eefa0fbee87e9ee6dd0fc94e2a (diff)
downloadotp-50054b94fee69fd39af32b4161d005588ed5f22f.tar.gz
otp-50054b94fee69fd39af32b4161d005588ed5f22f.tar.bz2
otp-50054b94fee69fd39af32b4161d005588ed5f22f.zip
dialyzer_typesig: Fix simplification bug
mk_constraint_list/2 was simplifying (C OR TriviallyTrue) to (C), which is obviously wrong.
Diffstat (limited to 'lib')
-rw-r--r--lib/dialyzer/src/dialyzer_typesig.erl17
-rw-r--r--lib/dialyzer/test/map_SUITE_data/results/map_in_guard1
2 files changed, 14 insertions, 4 deletions
diff --git a/lib/dialyzer/src/dialyzer_typesig.erl b/lib/dialyzer/src/dialyzer_typesig.erl
index 810b7c55e9..5b40376352 100644
--- a/lib/dialyzer/src/dialyzer_typesig.erl
+++ b/lib/dialyzer/src/dialyzer_typesig.erl
@@ -3131,13 +3131,24 @@ mk_constraint_ref(Id, Deps) ->
mk_constraint_list(Type, List) ->
List1 = ordsets:from_list(lift_lists(Type, List)),
- List2 = ordsets:filter(fun(X) -> get_deps(X) =/= [] end, List1),
- Deps = calculate_deps(List2),
+ case Type of
+ conj ->
+ List2 = ordsets:filter(fun(X) -> get_deps(X) =/= [] end, List1),
+ mk_constraint_list_cont(Type, List2);
+ disj ->
+ case lists:any(fun(X) -> get_deps(X) =:= [] end, List1) of
+ true -> mk_constraint_list_cont(Type, [mk_constraint_any(eq)]);
+ false -> mk_constraint_list_cont(Type, List1)
+ end
+ end.
+
+mk_constraint_list_cont(Type, List) ->
+ Deps = calculate_deps(List),
case Deps =:= [] of
true -> #constraint_list{type = conj,
list = [mk_constraint_any(eq)],
deps = []};
- false -> #constraint_list{type = Type, list = List2, deps = Deps}
+ false -> #constraint_list{type = Type, list = List, deps = Deps}
end.
lift_lists(Type, List) ->
diff --git a/lib/dialyzer/test/map_SUITE_data/results/map_in_guard b/lib/dialyzer/test/map_SUITE_data/results/map_in_guard
index 8ba8594b0e..1015f76128 100644
--- a/lib/dialyzer/test/map_SUITE_data/results/map_in_guard
+++ b/lib/dialyzer/test/map_SUITE_data/results/map_in_guard
@@ -2,4 +2,3 @@
map_in_guard.erl:10: The call map_in_guard:assoc_update('not_a_map') will never return since it differs in the 1st argument from the success typing arguments: (#{})
map_in_guard.erl:13: The call map_in_guard:assoc_guard_clause('not_a_map') will never return since it differs in the 1st argument from the success typing arguments: (#{})
map_in_guard.erl:20: The call map_in_guard:exact_guard_clause(#{}) will never return since it differs in the 1st argument from the success typing arguments: (#{'a':='q'})
-map_in_guard.erl:35: Function raw_expr/0 has no local return