aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer/src
diff options
context:
space:
mode:
authorStavros Aronis <[email protected]>2010-12-17 17:34:39 +0200
committerNiclas Axelsson <[email protected]>2010-12-20 15:04:14 +0100
commit21768de9bb18c968e71494c07375089191087b79 (patch)
tree85a060420d93458fb27101f32290cfb66cd20952 /lib/dialyzer/src
parent059606a330e8e86305699f60de144102560cb57b (diff)
downloadotp-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/src')
-rw-r--r--lib/dialyzer/src/dialyzer_typesig.erl10
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),