aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib
diff options
context:
space:
mode:
authorKostis Sagonas <[email protected]>2010-03-10 05:40:46 +0000
committerErlang/OTP <[email protected]>2010-03-10 05:40:46 +0000
commit9bd98965f4e3aae2325ba9679929d9bc29751242 (patch)
tree254d354ba7f6779e756d1e16f9758a2f6490f309 /lib/stdlib
parent065a54e7a0be98e8dc9842616b267c0e8fbeb318 (diff)
downloadotp-9bd98965f4e3aae2325ba9679929d9bc29751242.tar.gz
otp-9bd98965f4e3aae2325ba9679929d9bc29751242.tar.bz2
otp-9bd98965f4e3aae2325ba9679929d9bc29751242.zip
Fix a crash when using an undefined record name as a type
Diffstat (limited to 'lib/stdlib')
-rw-r--r--lib/stdlib/src/erl_lint.erl9
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/stdlib/src/erl_lint.erl b/lib/stdlib/src/erl_lint.erl
index 91f7641af7..22f435aff8 100644
--- a/lib/stdlib/src/erl_lint.erl
+++ b/lib/stdlib/src/erl_lint.erl
@@ -1021,11 +1021,8 @@ func_line_error(Type, Fs, St) ->
check_untyped_records(Forms, St0) ->
case is_warn_enabled(untyped_record, St0) of
true ->
- %% One possibility is to use the names of all records
- %% RecNames = dict:fetch_keys(St0#lint.records),
- %% but I think it's better to keep those that are used by the file
- Usage = St0#lint.usage,
- UsedRecNames = sets:to_list(Usage#usage.used_records),
+ %% Use the names of all records *defined* in the module (not used)
+ RecNames = dict:fetch_keys(St0#lint.records),
%% these are the records with field(s) containing type info
TRecNames = [Name ||
{attribute,_,type,{{record,Name},Fields,_}} <- Forms,
@@ -1038,7 +1035,7 @@ check_untyped_records(Forms, St0) ->
[] -> St; % exclude records with no fields
[_|_] -> add_warning(L, {untyped_record, N}, St)
end
- end, St0, UsedRecNames -- TRecNames);
+ end, St0, RecNames -- TRecNames);
false ->
St0
end.