aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer/src
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/dialyzer/src
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/dialyzer/src')
-rw-r--r--lib/dialyzer/src/dialyzer_typesig.erl17
1 files changed, 14 insertions, 3 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) ->