aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/dialyzer/src/dialyzer_succ_typings.erl33
1 files changed, 20 insertions, 13 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]).