From 06d0fd439347d1364078314b187dd388c5800c62 Mon Sep 17 00:00:00 2001 From: Stavros Aronis Date: Wed, 22 Feb 2012 13:04:17 +0100 Subject: Review by Kostis Sagonas and fixes --- lib/dialyzer/src/dialyzer_behaviours.erl | 4 ++-- lib/dialyzer/src/dialyzer_callgraph.erl | 2 +- lib/dialyzer/src/dialyzer_plt.erl | 2 +- lib/dialyzer/src/dialyzer_races.erl | 21 ++++++++++---------- lib/dialyzer/src/dialyzer_typesig.erl | 34 ++++++++++++++++---------------- 5 files changed, 31 insertions(+), 32 deletions(-) (limited to 'lib/dialyzer/src') diff --git a/lib/dialyzer/src/dialyzer_behaviours.erl b/lib/dialyzer/src/dialyzer_behaviours.erl index c6a47603e9..fdaa8b663c 100644 --- a/lib/dialyzer/src/dialyzer_behaviours.erl +++ b/lib/dialyzer/src/dialyzer_behaviours.erl @@ -241,12 +241,12 @@ translatable_behaviours(Tree) -> get_behaviour_apis(Behaviours) -> get_behaviour_apis(Behaviours, []). --spec translate_behaviour_api_call(dialyzer_races:mfa_or_funlbl(), +-spec translate_behaviour_api_call(dialyzer_callgraph:mfa_or_funlbl(), [erl_types:erl_type()], [dialyzer_races:core_vars()], module(), behaviour_api_dict()) -> - {dialyzer_races:mfa_or_funlbl(), + {dialyzer_callgraph:mfa_or_funlbl(), [erl_types:erl_type()], [dialyzer_races:core_vars()]} | 'plain_call'. diff --git a/lib/dialyzer/src/dialyzer_callgraph.erl b/lib/dialyzer/src/dialyzer_callgraph.erl index e3308263e4..4767c02f77 100644 --- a/lib/dialyzer/src/dialyzer_callgraph.erl +++ b/lib/dialyzer/src/dialyzer_callgraph.erl @@ -59,7 +59,7 @@ put_named_tables/2, put_public_tables/2, put_behaviour_api_calls/2, get_behaviour_api_calls/1]). --export_type([callgraph/0]). +-export_type([callgraph/0, mfa_or_funlbl/0]). -include("dialyzer.hrl"). diff --git a/lib/dialyzer/src/dialyzer_plt.erl b/lib/dialyzer/src/dialyzer_plt.erl index 3bb6c6aa87..74892d1668 100644 --- a/lib/dialyzer/src/dialyzer_plt.erl +++ b/lib/dialyzer/src/dialyzer_plt.erl @@ -205,7 +205,7 @@ get_exported_types(#plt{exported_types = ExpTypes}) -> lookup_module(#plt{info = Info}, M) when is_atom(M) -> table_lookup_module(Info, M). --spec all_modules(plt()) -> [module()]. +-spec all_modules(plt()) -> set(). all_modules(#plt{info = Info, contracts = Cs}) -> sets:union(table_all_modules(Info), table_all_modules(Cs)). diff --git a/lib/dialyzer/src/dialyzer_races.erl b/lib/dialyzer/src/dialyzer_races.erl index ee9d5e88a3..b9594f5301 100644 --- a/lib/dialyzer/src/dialyzer_races.erl +++ b/lib/dialyzer/src/dialyzer_races.erl @@ -39,7 +39,7 @@ let_tag_new/2, new/0, put_curr_fun/3, put_fun_args/2, put_race_analysis/2, put_race_list/3]). --export_type([races/0, mfa_or_funlbl/0, core_vars/0]). +-export_type([races/0, core_vars/0]). -include("dialyzer.hrl"). @@ -66,8 +66,6 @@ %%% %%% =========================================================================== --type mfa_or_funlbl() :: label() | mfa(). - -type label_type() :: label() | [label()] | {label()} | ?no_label. -type args() :: [label_type() | [string()]]. -type core_vars() :: cerl:cerl() | ?no_arg | ?bypassed. @@ -94,7 +92,7 @@ guard :: cerl:cerl()}). -record(end_case, {clauses :: [#end_clause{}]}). -record(curr_fun, {status :: 'in' | 'out', - mfa :: mfa_or_funlbl(), + mfa :: dialyzer_callgraph:mfa_or_funlbl(), label :: label(), def_vars :: [core_vars()], arg_types :: [erl_types:erl_type()], @@ -107,8 +105,8 @@ state :: _, %% XXX: recursive file_line :: file_line(), var_map :: dict()}). --record(fun_call, {caller :: mfa_or_funlbl(), - callee :: mfa_or_funlbl(), +-record(fun_call, {caller :: dialyzer_callgraph:mfa_or_funlbl(), + callee :: dialyzer_callgraph:mfa_or_funlbl(), arg_types :: [erl_types:erl_type()], vars :: [core_vars()]}). -record(let_tag, {var :: var_to_map1(), @@ -130,10 +128,10 @@ vars :: [core_vars()], file_line :: file_line(), index :: non_neg_integer(), - fun_mfa :: mfa_or_funlbl(), + fun_mfa :: dialyzer_callgraph:mfa_or_funlbl(), fun_label :: label()}). --record(races, {curr_fun :: mfa_or_funlbl(), +-record(races, {curr_fun :: dialyzer_callgraph:mfa_or_funlbl(), curr_fun_label :: label(), curr_fun_args = 'empty' :: core_args(), new_table = 'no_t' :: table(), @@ -158,7 +156,8 @@ %%% %%% =========================================================================== --spec store_race_call(mfa_or_funlbl(), [erl_types:erl_type()], [core_vars()], +-spec store_race_call(dialyzer_callgraph:mfa_or_funlbl(), + [erl_types:erl_type()], [core_vars()], file_line(), dialyzer_dataflow:state()) -> dialyzer_dataflow:state(). @@ -2405,7 +2404,7 @@ end_case_new(Clauses) -> end_clause_new(Arg, Pats, Guard) -> #end_clause{arg = Arg, pats = Pats, guard = Guard}. --spec get_curr_fun(races()) -> mfa_or_funlbl(). +-spec get_curr_fun(races()) -> dialyzer_callgraph:mfa_or_funlbl(). get_curr_fun(#races{curr_fun = CurrFun}) -> CurrFun. @@ -2444,7 +2443,7 @@ let_tag_new(Var, Arg) -> new() -> #races{}. --spec put_curr_fun(mfa_or_funlbl(), label(), races()) -> +-spec put_curr_fun(dialyzer_callgraph:mfa_or_funlbl(), label(), races()) -> races(). put_curr_fun(CurrFun, CurrFunLabel, Races) -> diff --git a/lib/dialyzer/src/dialyzer_typesig.erl b/lib/dialyzer/src/dialyzer_typesig.erl index 73b98f62ee..04ff8e4941 100644 --- a/lib/dialyzer/src/dialyzer_typesig.erl +++ b/lib/dialyzer/src/dialyzer_typesig.erl @@ -91,23 +91,23 @@ -type typesig_scc() :: [{mfa(), {cerl:c_var(), cerl:c_fun()}, dict()}]. -type typesig_funmap() :: [{type_var(), type_var()}]. %% Orddict --record(state, {callgraph :: dialyzer_callgraph:callgraph(), - cs = [] :: [constr()], - cmap = dict:new() :: dict(), - fun_map = [] :: typesig_funmap(), - fun_arities = dict:new() :: dict(), - in_match = false :: boolean(), - in_guard = false :: boolean(), - module :: module(), - name_map = dict:new() :: dict(), - next_label :: label(), - self_recs :: [label()], - plt :: dialyzer_plt:plt(), - prop_types = dict:new() :: dict(), - records = dict:new() :: dict(), - opaques = [] :: [erl_types:erl_type()], - scc = [] :: [type_var()], - mfas :: [tuple()] +-record(state, {callgraph :: dialyzer_callgraph:callgraph(), + cs = [] :: [constr()], + cmap = dict:new() :: dict(), + fun_map = [] :: typesig_funmap(), + fun_arities = dict:new() :: dict(), + in_match = false :: boolean(), + in_guard = false :: boolean(), + module :: module(), + name_map = dict:new() :: dict(), + next_label :: label(), + self_recs :: [label()], + plt :: dialyzer_plt:plt(), + prop_types = dict:new() :: dict(), + records = dict:new() :: dict(), + opaques = [] :: [erl_types:erl_type()], + scc = [] :: [type_var()], + mfas = [] :: [dialyzer_callgraph:mfa_or_funlbl()] }). %%----------------------------------------------------------------------------- -- cgit v1.2.3