diff options
author | Hans Bolinder <[email protected]> | 2017-02-03 08:50:20 +0100 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2017-02-03 08:50:20 +0100 |
commit | cdeca7938c9a2cbad2575065aca3f79e2a16addd (patch) | |
tree | 894fbc13029c8e44173d0510ecbfaf38f2eb94a7 /lib/hipe | |
parent | f10abe57f6d2e0bc0b46bdda8c6456ed0c72a3a9 (diff) | |
parent | 67621f731008ff203d13e03f68edbea55b0d9054 (diff) | |
download | otp-cdeca7938c9a2cbad2575065aca3f79e2a16addd.tar.gz otp-cdeca7938c9a2cbad2575065aca3f79e2a16addd.tar.bz2 otp-cdeca7938c9a2cbad2575065aca3f79e2a16addd.zip |
Merge branch 'maint'
* maint:
dialyzer: Increase time limit for tests
dialyzer: Optimize typesig
dialyzer: Optimize evaluation of complex code
dialyzer: Optimize collection of variables
Conflicts:
lib/dialyzer/src/dialyzer_typesig.erl
Diffstat (limited to 'lib/hipe')
-rw-r--r-- | lib/hipe/cerl/erl_types.erl | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/hipe/cerl/erl_types.erl b/lib/hipe/cerl/erl_types.erl index 91ee104f77..0a1b3c495a 100644 --- a/lib/hipe/cerl/erl_types.erl +++ b/lib/hipe/cerl/erl_types.erl @@ -2235,16 +2235,21 @@ t_has_var_list([]) -> false. -spec t_collect_vars(erl_type()) -> [erl_type()]. t_collect_vars(T) -> - t_collect_vars(T, []). + Vs = t_collect_vars(T, maps:new()), + [V || {V, _} <- maps:to_list(Vs)]. --spec t_collect_vars(erl_type(), [erl_type()]) -> [erl_type()]. +-type ctab() :: #{erl_type() => 'any'}. + +-spec t_collect_vars(erl_type(), ctab()) -> ctab(). t_collect_vars(?var(_) = Var, Acc) -> - ordsets:add_element(Var, Acc); + maps:put(Var, any, Acc); t_collect_vars(?function(Domain, Range), Acc) -> - ordsets:union(t_collect_vars(Domain, Acc), t_collect_vars(Range, [])); + Acc1 = t_collect_vars(Domain, Acc), + t_collect_vars(Range, Acc1); t_collect_vars(?list(Contents, Termination, _), Acc) -> - ordsets:union(t_collect_vars(Contents, Acc), t_collect_vars(Termination, [])); + Acc1 = t_collect_vars(Contents, Acc), + t_collect_vars(Termination, Acc1); t_collect_vars(?product(Types), Acc) -> t_collect_vars_list(Types, Acc); t_collect_vars(?tuple(?any, ?any, ?any), Acc) -> |