aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer/src
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2017-05-03 12:48:49 +0200
committerHans Bolinder <[email protected]>2017-06-13 13:40:25 +0200
commit6d3b38a9d80af50b2153536fbb73de134420c406 (patch)
treeb7b965ced74271852b0f86b25080eb006bbf6ad7 /lib/dialyzer/src
parentde84a11b97f9b7d3642169b424e418106e117c68 (diff)
downloadotp-6d3b38a9d80af50b2153536fbb73de134420c406.tar.gz
otp-6d3b38a9d80af50b2153536fbb73de134420c406.tar.bz2
otp-6d3b38a9d80af50b2153536fbb73de134420c406.zip
dialyzer: Warn about unused unknown types
Diffstat (limited to 'lib/dialyzer/src')
-rw-r--r--lib/dialyzer/src/dialyzer_utils.erl19
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/dialyzer/src/dialyzer_utils.erl b/lib/dialyzer/src/dialyzer_utils.erl
index e5941d0ab8..7eaa03ec30 100644
--- a/lib/dialyzer/src/dialyzer_utils.erl
+++ b/lib/dialyzer/src/dialyzer_utils.erl
@@ -340,7 +340,19 @@ process_record_remote_types(CServer) ->
{FieldsList, C3} =
lists:mapfoldl(FieldFun, C2, orddict:to_list(Fields)),
{{Key, {FileLine, orddict:from_list(FieldsList)}}, C3};
- _Other -> {{Key, Value}, C2}
+ {type, Name, NArgs} ->
+ %% Make sure warnings about unknown types are output
+ %% also for types unused by specs.
+ Site = {type, {Module, Name, NArgs}},
+ L = erl_anno:new(0),
+ Args = lists:duplicate(NArgs, {var, L, '_'}),
+ UserType = {user_type, L, Name, Args},
+ {_NewType, C3} =
+ erl_types:t_from_form(UserType, ExpTypes, Site,
+ RecordTable, VarTable, C2),
+ {{Key, Value}, C3};
+ {opaque, _Name, _NArgs} ->
+ {{Key, Value}, C2}
end
end,
Cache = erl_types:cache__new(),
@@ -378,7 +390,10 @@ process_opaque_types(AllModules, CServer, TempExpTypes) ->
erl_types:t_from_form(Form, TempExpTypes, Site,
RecordTable, VarTable, C2),
{{Key, {F, Type}}, C3};
- _Other -> {{Key, Value}, C2}
+ {type, _Name, _NArgs} ->
+ {{Key, Value}, C2};
+ {record, _RecName} ->
+ {{Key, Value}, C2}
end
end,
C0 = erl_types:cache__new(),