diff options
author | Stavros Aronis <[email protected]> | 2010-12-17 17:34:39 +0200 |
---|---|---|
committer | Niclas Axelsson <[email protected]> | 2010-12-20 15:04:14 +0100 |
commit | 21768de9bb18c968e71494c07375089191087b79 (patch) | |
tree | 85a060420d93458fb27101f32290cfb66cd20952 /lib/dialyzer | |
parent | 059606a330e8e86305699f60de144102560cb57b (diff) | |
download | otp-21768de9bb18c968e71494c07375089191087b79.tar.gz otp-21768de9bb18c968e71494c07375089191087b79.tar.bz2 otp-21768de9bb18c968e71494c07375089191087b79.zip |
Fix bug in the handling of 'or' by Dialyzer
Dialyzer had a minor issue when the arguments of the built-in function
'or' had the fixed value 'false'.
This testcase should return no warnings:
-module(false_false).
-export([false_or/0]).
false_or() ->
false or false.
Diffstat (limited to 'lib/dialyzer')
-rw-r--r-- | lib/dialyzer/src/dialyzer_typesig.erl | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/dialyzer/src/dialyzer_typesig.erl b/lib/dialyzer/src/dialyzer_typesig.erl index f68472d2fc..c45615d670 100644 --- a/lib/dialyzer/src/dialyzer_typesig.erl +++ b/lib/dialyzer/src/dialyzer_typesig.erl @@ -1406,9 +1406,13 @@ get_bif_constr({erlang, 'or', 2}, Dst, [Arg1, Arg2] = Args, _State) -> ArgV1 = mk_fun_var(ArgFun(Arg2), [Arg2, Dst]), ArgV2 = mk_fun_var(ArgFun(Arg1), [Arg1, Dst]), DstV = mk_fun_var(DstFun, Args), - Disj = mk_disj_constraint_list([mk_constraint(Arg1, sub, True), - mk_constraint(Arg2, sub, True), - mk_constraint(Dst, sub, False)]), + F = fun(A) -> + try [mk_constraint(A, sub, True)] + catch throw:error -> [] + end + end, + Constrs = F(Arg1) ++ F(Arg2), + Disj = mk_disj_constraint_list([mk_constraint(Dst, sub, False)|Constrs]), mk_conj_constraint_list([mk_constraint(Dst, sub, DstV), mk_constraint(Arg1, sub, ArgV1), mk_constraint(Arg2, sub, ArgV2), |