diff options
author | Hans Bolinder <[email protected]> | 2017-09-15 08:18:36 +0200 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2017-09-15 08:18:36 +0200 |
commit | fc681a069869b1d7808ef2ac6cd7cac59009877f (patch) | |
tree | e72fe6259ee469a50f2e2d75f0602c79e5367f34 /lib/dialyzer/src/dialyzer_utils.erl | |
parent | 40ab89f78863b17f8657b8c4575b4a904eb395ae (diff) | |
parent | 96cf13613c53b641cf7e8a45f83fb71809d6b336 (diff) | |
download | otp-fc681a069869b1d7808ef2ac6cd7cac59009877f.tar.gz otp-fc681a069869b1d7808ef2ac6cd7cac59009877f.tar.bz2 otp-fc681a069869b1d7808ef2ac6cd7cac59009877f.zip |
Merge branch 'hasse/dialyzer/check_forms/OTP-14606' into maint
* hasse/dialyzer/check_forms/OTP-14606:
dialyzer: Improve check of unknown types
Diffstat (limited to 'lib/dialyzer/src/dialyzer_utils.erl')
-rw-r--r-- | lib/dialyzer/src/dialyzer_utils.erl | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/dialyzer/src/dialyzer_utils.erl b/lib/dialyzer/src/dialyzer_utils.erl index 511a6d66bf..9b8fbc67eb 100644 --- a/lib/dialyzer/src/dialyzer_utils.erl +++ b/lib/dialyzer/src/dialyzer_utils.erl @@ -326,9 +326,12 @@ process_record_remote_types(CServer) -> {record, Name} -> FieldFun = fun({Arity, Fields}, C4) -> - Site = {record, {Module, Name, Arity}}, + MRA = {Module, Name, Arity}, + Site = {record, MRA}, {Fields1, C7} = lists:mapfoldl(fun({FieldName, Field, _}, C5) -> + check_remote(Field, ExpTypes, + MRA, RecordTable), {FieldT, C6} = erl_types:t_from_form (Field, ExpTypes, Site, @@ -342,18 +345,12 @@ process_record_remote_types(CServer) -> {FieldsList, C3} = lists:mapfoldl(FieldFun, C2, orddict:to_list(Fields)), {{Key, {FileLine, orddict:from_list(FieldsList)}}, C3}; - {type, Name, NArgs} -> + {_TypeOrOpaque, 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} -> + MTA = {Module, Name, NArgs}, + {{_Module, _FileLine, Form, _ArgNames}, _Type} = Value, + check_remote(Form, ExpTypes, MTA, RecordTable), {{Key, Value}, C2} end end, @@ -454,6 +451,9 @@ msg_with_position(Fun, FileLine) -> throw({error, NewMsg}) end. +check_remote(Form, ExpTypes, What, RecordTable) -> + erl_types:t_from_form_check_remote(Form, ExpTypes, What, RecordTable). + -spec merge_types(codeserver(), dialyzer_plt:plt()) -> codeserver(). merge_types(CServer, Plt) -> |