aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/dialyzer/src/dialyzer_succ_typings.erl33
-rw-r--r--lib/hipe/cerl/erl_bif_types.erl66
2 files changed, 50 insertions, 49 deletions
diff --git a/lib/dialyzer/src/dialyzer_succ_typings.erl b/lib/dialyzer/src/dialyzer_succ_typings.erl
index b8da57d3f9..dc5a3fed37 100644
--- a/lib/dialyzer/src/dialyzer_succ_typings.erl
+++ b/lib/dialyzer/src/dialyzer_succ_typings.erl
@@ -158,20 +158,27 @@ postprocess_dataflow_warns([], _State, WAcc, Acc) ->
postprocess_dataflow_warns([{?WARN_CONTRACT_RANGE, {CallF, CallL}, Msg}|Rest],
#st{codeserver = Codeserver} = State, WAcc, Acc) ->
{contract_range, [Contract, M, F, A, ArgStrings, CRet]} = Msg,
- {ok, {{ContrF, _ContrL} = FileLine, _C}} =
- dialyzer_codeserver:lookup_mfa_contract({M,F,A}, Codeserver),
- case CallF =:= ContrF of
- true ->
+ case dialyzer_codeserver:lookup_mfa_contract({M,F,A}, Codeserver) of
+ {ok, {{ContrF, _ContrL} = FileLine, _C}} ->
+ case CallF =:= ContrF of
+ true ->
+ NewMsg = {contract_range, [Contract, M, F, ArgStrings, CallL, CRet]},
+ W = {?WARN_CONTRACT_RANGE, FileLine, NewMsg},
+ Filter =
+ fun({?WARN_CONTRACT_TYPES, FL, _}) when FL =:= FileLine -> false;
+ (_) -> true
+ end,
+ FilterWAcc = lists:filter(Filter, WAcc),
+ postprocess_dataflow_warns(Rest, State, FilterWAcc, [W|Acc]);
+ false ->
+ postprocess_dataflow_warns(Rest, State, WAcc, Acc)
+ end;
+ error ->
+ %% The contract is not in a module that is currently under analysis.
+ %% We display the warning in the file/line of the call.
NewMsg = {contract_range, [Contract, M, F, ArgStrings, CallL, CRet]},
- W = {?WARN_CONTRACT_RANGE, FileLine, NewMsg},
- Filter =
- fun({?WARN_CONTRACT_TYPES, FL, _}) when FL =:= FileLine -> false;
- (_) -> true
- end,
- FilterWAcc = lists:filter(Filter, WAcc),
- postprocess_dataflow_warns(Rest, State, FilterWAcc, [W|Acc]);
- false ->
- postprocess_dataflow_warns(Rest, State, WAcc, Acc)
+ W = {?WARN_CONTRACT_RANGE, {CallF, CallL}, NewMsg},
+ postprocess_dataflow_warns(Rest, State, WAcc, [W|Acc])
end;
postprocess_dataflow_warns([W|Rest], State, Wacc, Acc) ->
postprocess_dataflow_warns(Rest, State, Wacc, [W|Acc]).
diff --git a/lib/hipe/cerl/erl_bif_types.erl b/lib/hipe/cerl/erl_bif_types.erl
index c009164f4c..0b47c7b6e1 100644
--- a/lib/hipe/cerl/erl_bif_types.erl
+++ b/lib/hipe/cerl/erl_bif_types.erl
@@ -154,7 +154,7 @@ type(binary, bin_to_list, Arity, Xs) when 1 =< Arity, Arity =< 3 ->
fun(_) -> t_list(t_integer()) end);
type(binary, compile_pattern, 1, Xs) ->
strict(arg_types(binary, compile_pattern, 1), Xs,
- fun(_) -> t_tuple([t_atom(bm),t_binary()]) end);
+ fun(_) -> t_binary_compiled_pattern() end);
type(binary, copy, Arity, Xs) when Arity =:= 1; Arity =:= 2 ->
strict(arg_types(binary, copy, Arity), Xs,
fun(_) -> t_binary() end);
@@ -4469,27 +4469,6 @@ t_endian() ->
t_sup(t_atom('big'), t_atom('little')).
%% =====================================================================
-%% Types for the binary module
-%% =====================================================================
-
-t_binary_part() ->
- t_tuple([t_non_neg_integer(), t_integer()]).
-
-t_binary_canonical_part() ->
- t_tuple([t_non_neg_integer(), t_non_neg_integer()]).
-
-t_binary_pattern() ->
- t_sup([t_binary(),
- t_list(t_binary()),
- t_binary_compiled_pattern()]).
-
-t_binary_compiled_pattern() ->
- t_tuple([t_atom('cp'), t_binary()]).
-
-t_binary_options() ->
- t_list(t_tuple([t_atom('scope'), t_binary_part()])).
-
-%% =====================================================================
%% HTTP types documented in R12B-4
%% =====================================================================
@@ -4544,7 +4523,28 @@ t_HttpFieldAtom() ->
'Keep-Alive', 'Proxy-Connection']).
t_HttpString() ->
- t_sup(t_string(),t_binary()).
+ t_sup(t_string(), t_binary()).
+
+%% =====================================================================
+%% These are used for the built-in functions of 'binary'
+%% =====================================================================
+
+t_binary_part() ->
+ t_tuple([t_non_neg_integer(), t_integer()]).
+
+t_binary_canonical_part() ->
+ t_tuple([t_non_neg_integer(), t_non_neg_integer()]).
+
+t_binary_pattern() ->
+ t_sup([t_binary(),
+ t_list(t_binary()),
+ t_binary_compiled_pattern()]).
+
+t_binary_compiled_pattern() ->
+ t_tuple([t_sup(t_atom('bm'), t_atom('ac')), t_binary()]).
+
+t_binary_options() ->
+ t_list(t_tuple([t_atom('scope'), t_binary_part()])).
%% =====================================================================
%% These are used for the built-in functions of 'code'
@@ -4565,11 +4565,6 @@ t_code_load_error_rsn() -> % also used in erlang:load_module/2
t_atom('on_load'),
t_atom('sticky_directory')]). % only for the 'code' functions
-t_code_loaded_fname_or_status() ->
- t_sup([t_string(), % filename
- t_atom('preloaded'),
- t_atom('cover_compiled')]).
-
%% =====================================================================
%% These are used for the built-in functions of 'erlang'
%% =====================================================================
@@ -4734,7 +4729,6 @@ t_scheduler_bind_type_results() ->
t_atom('thread_no_node_processor_spread'),
t_atom('unbound')]).
-
t_system_monitor_settings() ->
t_sup([t_atom('undefined'),
t_tuple([t_pid(), t_system_monitor_options()])]).
@@ -4814,13 +4808,6 @@ t_ets_info_items() ->
t_atom('type')]).
%% =====================================================================
-%% These are used for the built-in functions of 'prim_file'
-%% =====================================================================
-
-t_prim_file_name() ->
- t_sup(t_unicode_string(), t_binary()).
-
-%% =====================================================================
%% These are used for the built-in functions of 'gen_tcp'
%% =====================================================================
@@ -5014,6 +5001,13 @@ t_re_CapturedData() ->
t_sup([t_tuple([t_integer(), t_integer()]), t_string(), t_binary()]).
%% =====================================================================
+%% These are used for the built-in functions of 'prim_file'
+%% =====================================================================
+
+t_prim_file_name() ->
+ t_sup(t_unicode_string(), t_binary()).
+
+%% =====================================================================
%% These are used for the built-in functions of 'unicode'
%% =====================================================================