aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Valim <[email protected]>2015-05-27 00:37:31 +0200
committerJosé Valim <[email protected]>2015-05-27 00:42:11 +0200
commitf9af336d89b3ec6b68182311ef4d77d1eabc455f (patch)
tree987df5c45cea291e53f7a4bb1f7112385693db87
parentb5ee5c6749616dd715138ae7720df77a26341316 (diff)
downloadotp-f9af336d89b3ec6b68182311ef4d77d1eabc455f.tar.gz
otp-f9af336d89b3ec6b68182311ef4d77d1eabc455f.tar.bz2
otp-f9af336d89b3ec6b68182311ef4d77d1eabc455f.zip
Annotate used types in erl_lint
This is a follow up to commit b5ee5c6. Similar to function calls, we also need to annotate used types on call site since this information is used later on when showing undefined type errors. Notice we don't need to annotate the type export because it is an attribute and those are always properly annotated.
-rw-r--r--lib/stdlib/src/erl_lint.erl5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/stdlib/src/erl_lint.erl b/lib/stdlib/src/erl_lint.erl
index dcda11827d..d72cd25567 100644
--- a/lib/stdlib/src/erl_lint.erl
+++ b/lib/stdlib/src/erl_lint.erl
@@ -2845,10 +2845,9 @@ check_record_types([{type, _, field_type, [{atom, AL, FName}, Type]}|Left],
check_record_types([], _Name, _DefFields, SeenVars, St, _SeenFields) ->
{SeenVars, St}.
-used_type(TypePair, L, St) ->
- Usage = St#lint.usage,
+used_type(TypePair, L, #lint{usage = Usage, file = File} = St) ->
OldUsed = Usage#usage.used_types,
- UsedTypes = dict:store(TypePair, L, OldUsed),
+ UsedTypes = dict:store(TypePair, erl_anno:set_file(File, L), OldUsed),
St#lint{usage=Usage#usage{used_types=UsedTypes}}.
is_default_type({Name, NumberOfTypeVariables}) ->