aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer/src/dialyzer_contracts.erl
diff options
context:
space:
mode:
authorMagnus Henoch <[email protected]>2013-03-06 00:35:53 +0000
committerMagnus Henoch <[email protected]>2013-03-06 00:35:53 +0000
commit412ca8f432af37876f8462c47ce91cda08e575d6 (patch)
tree1be07cfceca71756713fcedcf9cc4421957e0a4f /lib/dialyzer/src/dialyzer_contracts.erl
parent05f11890bdfec4bfc3a78e191a87e70a937ffc54 (diff)
downloadotp-412ca8f432af37876f8462c47ce91cda08e575d6.tar.gz
otp-412ca8f432af37876f8462c47ce91cda08e575d6.tar.bz2
otp-412ca8f432af37876f8462c47ce91cda08e575d6.zip
Include module, function and arity in Dialyzer's "overlapping domain" warnings
The function name can give information that the line number doesn't, for example when using a parse transform that creates new functions.
Diffstat (limited to 'lib/dialyzer/src/dialyzer_contracts.erl')
-rw-r--r--lib/dialyzer/src/dialyzer_contracts.erl5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/dialyzer/src/dialyzer_contracts.erl b/lib/dialyzer/src/dialyzer_contracts.erl
index 157c951f77..410be8586e 100644
--- a/lib/dialyzer/src/dialyzer_contracts.erl
+++ b/lib/dialyzer/src/dialyzer_contracts.erl
@@ -520,6 +520,8 @@ get_invalid_contract_warnings_funs([{MFA, {FileLine, Contract}}|Left],
case check_contract(Contract, Sig) of
{error, invalid_contract} ->
[invalid_contract_warning(MFA, FileLine, Sig, RecDict)|Acc];
+ {error, {overlapping_contract, []}} ->
+ [overlapping_contract_warning(MFA, FileLine)|Acc];
{error, {extra_range, ExtraRanges, STRange}} ->
Warn =
case t_from_forms_without_remote(Contract#contract.forms,
@@ -571,6 +573,9 @@ invalid_contract_warning({M, F, A}, FileLine, SuccType, RecDict) ->
SuccTypeStr = dialyzer_utils:format_sig(SuccType, RecDict),
{?WARN_CONTRACT_TYPES, FileLine, {invalid_contract, [M, F, A, SuccTypeStr]}}.
+overlapping_contract_warning({M, F, A}, FileLine) ->
+ {?WARN_CONTRACT_TYPES, FileLine, {overlapping_contract, [M, F, A]}}.
+
extra_range_warning({M, F, A}, FileLine, ExtraRanges, STRange) ->
ERangesStr = erl_types:t_to_string(ExtraRanges),
STRangeStr = erl_types:t_to_string(STRange),