diff options
author | Hans Bolinder <[email protected]> | 2016-06-08 08:35:10 +0200 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2016-06-08 08:36:41 +0200 |
commit | 6a0d7e9abef8474ae1de739868ecb2245e8aa6a8 (patch) | |
tree | 228b8024decd1622fffb41d7aad99b9d06119ed6 /lib/dialyzer/src | |
parent | a39395d4f99aff99ac57ab40a3191fa13a7371fd (diff) | |
download | otp-6a0d7e9abef8474ae1de739868ecb2245e8aa6a8.tar.gz otp-6a0d7e9abef8474ae1de739868ecb2245e8aa6a8.tar.bz2 otp-6a0d7e9abef8474ae1de739868ecb2245e8aa6a8.zip |
Dialyzer: Fix a bug that caused Dialyzer to go into an infinite loop.
Dialyzer failed to remove all loops among constraints.
Diffstat (limited to 'lib/dialyzer/src')
-rw-r--r-- | lib/dialyzer/src/dialyzer_contracts.erl | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/dialyzer/src/dialyzer_contracts.erl b/lib/dialyzer/src/dialyzer_contracts.erl index d1ffa07706..272ad10e90 100644 --- a/lib/dialyzer/src/dialyzer_contracts.erl +++ b/lib/dialyzer/src/dialyzer_contracts.erl @@ -591,10 +591,13 @@ remove_uses([{Var, Use}|ToRemove], Constrs0) -> remove_uses(_Var, _Use, []) -> []; remove_uses(Var, Use, [Constr|Constrs]) -> {V, Form} = Constr, - case erl_types:t_var_name(V) =:= Var of - true -> [{V, remove_use(Form, Use)}|Constrs]; - false -> [Constr|remove_uses(Var, Use, Constrs)] - end. + NewConstr = case erl_types:t_var_name(V) =:= Var of + true -> + {V, remove_use(Form, Use)}; + false -> + Constr + end, + [NewConstr|remove_uses(Var, Use, Constrs)]. remove_use({var, L, V}, V) -> {var, L, '_'}; remove_use(T, V) when is_tuple(T) -> |