Mark only included files as potentially unused (#442)

* Mark only included files as potentially unused

* Update CHANGELOG

* Add test
This commit is contained in:
Gaith Hallak
2023-03-21 13:55:18 +03:00
committed by GitHub
parent 311bf49505
commit 99bb3fe1fb
4 changed files with 15 additions and 3 deletions
+8 -3
View File
@@ -3207,9 +3207,14 @@ when_warning(Warn, Do) ->
%% Warnings (Unused includes)
potential_unused_include(Ann, SrcFile) ->
case aeso_syntax:get_ann(file, Ann, no_file) of
no_file -> ok;
File -> ets_insert(warnings, {unused_include, File, SrcFile})
IsIncluded = aeso_syntax:get_ann(include_type, Ann, none) =/= none,
case IsIncluded of
false -> ok;
true ->
case aeso_syntax:get_ann(file, Ann, no_file) of
no_file -> ok;
File -> ets_insert(warnings, {unused_include, File, SrcFile})
end
end.
used_include(Ann) ->