summaryrefslogtreecommitdiff
path: root/lib/dialyzer/src/dialyzer_behaviours.erl
diff options
context:
space:
mode:
authorTom Davies <TD5@users.noreply.github.com>2021-12-08 07:48:06 -0800
committerTom Davies <tomdavies@fb.com>2021-12-14 09:55:35 -0800
commitcdfd163ea704410320b3c113780900e9bb59dbe9 (patch)
tree19bca069fb80b2de2708b03615dd0fd83edb7f2c /lib/dialyzer/src/dialyzer_behaviours.erl
parent9b07aedd669c2cb1e12e8a9b4f06210d0892041e (diff)
downloaderlang-cdfd163ea704410320b3c113780900e9bb59dbe9.tar.gz
dialyzer: Track type & behaviour dependencies
Dialyzer now tracks the dependencies between modules induced by type-level information, such as type definitions & specs, as well as behaviour callbacks. Previously, only function calls were considered when computing dependencies. This was incomplete because changes to types and behaviours can also affect the result of a Dialyzer analysis.
Diffstat (limited to 'lib/dialyzer/src/dialyzer_behaviours.erl')
-rw-r--r--lib/dialyzer/src/dialyzer_behaviours.erl8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/dialyzer/src/dialyzer_behaviours.erl b/lib/dialyzer/src/dialyzer_behaviours.erl
index 4be84502a1..2462c2173f 100644
--- a/lib/dialyzer/src/dialyzer_behaviours.erl
+++ b/lib/dialyzer/src/dialyzer_behaviours.erl
@@ -22,7 +22,7 @@
-module(dialyzer_behaviours).
--export([check_callbacks/5]).
+-export([check_callbacks/5, get_behaviours/1]).
-export_type([behaviour/0]).
@@ -39,7 +39,7 @@
-record(state, {plt :: dialyzer_plt:plt(),
codeserver :: dialyzer_codeserver:codeserver(),
filename :: file:filename(),
- behlines :: [{behaviour(), non_neg_integer()}],
+ behlines :: [{behaviour(), file_location()}],
records :: rectab()}).
%%--------------------------------------------------------------------
@@ -64,6 +64,8 @@ check_callbacks(Module, Attrs, Records, Plt, Codeserver) ->
%%--------------------------------------------------------------------
+-spec get_behaviours([{cerl:cerl(), cerl:cerl()}]) -> {[behaviour()], [{behaviour(), term()}]}.
+
get_behaviours(Attrs) ->
BehaviourListsAndLocation =
[{cerl:concrete(L2), hd(cerl:get_ann(L2))} ||
@@ -101,7 +103,7 @@ check_all_callbacks(Module, Behaviour, [Cb|Rest],
CbReturnType = dialyzer_contracts:get_contract_return(Callback),
CbArgTypes = dialyzer_contracts:get_contract_args(Callback),
Acc0 = Acc,
- Acc1 =
+ Acc1 =
case dialyzer_plt:lookup(Plt, CbMFA) of
'none' ->
case lists:member(optional_callback, Xtra) of