diff options
author | Erlang/OTP <[email protected]> | 2010-06-04 08:37:43 +0000 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2010-06-04 08:37:43 +0000 |
commit | 02a3667376af950bb75523e32d2a974c4939261b (patch) | |
tree | 26cfed89729c549e576035c2d7b3557183a4c20a /lib/dialyzer/src/dialyzer_behaviours.erl | |
parent | 5c1f9b342c3569b37b674b8671fb243782af4aa0 (diff) | |
parent | 169507cb9238ff527d13df0fe945838a2169aa0d (diff) | |
download | otp-02a3667376af950bb75523e32d2a974c4939261b.tar.gz otp-02a3667376af950bb75523e32d2a974c4939261b.tar.bz2 otp-02a3667376af950bb75523e32d2a974c4939261b.zip |
Merge branch 'ks/dialyzer' into dev
* ks/dialyzer:
dialyzer: Build the PLT even if there are unresolved remote types
proplists: Export the type property()
erl_lint: Issue warnings for undefined exported types
Minor fix in a print message
Add handling of unknown types
Add declaration for exported types
Add types and specs; performed some cleanups also
erl_scan: Add declarations for exported types
stdlib: Add declarations for exported types
hipe: Add declarations for exported types
compiler: Add declarations for exported types
syntax_tools: Add declarations for exported types
kernel: Add declaration for exported types
Support -export_type() in dialyzer and erl_types
Add infrastructure for the -export_type() attribute
OTP-8678 ks/dialyzer
Diffstat (limited to 'lib/dialyzer/src/dialyzer_behaviours.erl')
-rw-r--r-- | lib/dialyzer/src/dialyzer_behaviours.erl | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/dialyzer/src/dialyzer_behaviours.erl b/lib/dialyzer/src/dialyzer_behaviours.erl index 4e8dceaa8e..3fae816cfe 100644 --- a/lib/dialyzer/src/dialyzer_behaviours.erl +++ b/lib/dialyzer/src/dialyzer_behaviours.erl @@ -156,9 +156,11 @@ check_all_callbacks(Module, Behaviour, Callbacks, State) -> check_all_callbacks(_Module, _Behaviour, [], _State, Acc) -> Acc; -check_all_callbacks(Module, Behaviour, [{Fun, Arity, Spec}|Rest], State, Acc) -> - Records = dialyzer_codeserver:get_records(State#state.codeserver), - case parse_spec(Spec, Records) of +check_all_callbacks(Module, Behaviour, [{Fun, Arity, Spec}|Rest], + #state{codeserver = CServer} = State, Acc) -> + Records = dialyzer_codeserver:get_records(CServer), + ExpTypes = dialyzer_codeserver:get_exported_types(CServer), + case parse_spec(Spec, ExpTypes, Records) of {ok, Fun, Type} -> RetType = erl_types:t_fun_range(Type), ArgTypes = erl_types:t_fun_args(Type), @@ -172,7 +174,7 @@ check_all_callbacks(Module, Behaviour, [{Fun, Arity}|Rest], State, Acc) -> Warns = {spec_missing, [Behaviour, Fun, Arity]}, check_all_callbacks(Module, Behaviour, Rest, State, [Warns|Acc]). -parse_spec(String, Records) -> +parse_spec(String, ExpTypes, Records) -> case erl_scan:string(String) of {ok, Tokens, _} -> case erl_parse:parse(Tokens) of @@ -181,7 +183,8 @@ parse_spec(String, Records) -> {attribute, _, 'spec', {{Fun, _}, [TypeForm|_Constraint]}} -> MaybeRemoteType = erl_types:t_from_form(TypeForm), try - Type = erl_types:t_solve_remote(MaybeRemoteType, Records), + Type = erl_types:t_solve_remote(MaybeRemoteType, ExpTypes, + Records), {ok, Fun, Type} catch throw:{error,Msg} -> {spec_remote_error, Msg} |