Update unused warnings for inline imports

Now that imports can be limited to smaller scopes than the entire module,
unused import warnings need to work like unused def warnings.

This commit moves unused import warnings discovery and reporting from load
to canonicalization where we can track their usage per scope.

This also fixes a longstanding bug where unused exposed names from an import
were not reported if they were only used in a qualified manner.
This commit is contained in:
Agus Zubiaga 2024-01-11 18:09:01 -03:00
parent 08e6b79dca
commit 7b3317dbb6
No known key found for this signature in database
18 changed files with 334 additions and 122 deletions

View file

@ -107,9 +107,8 @@ pub fn can_problem<'b>(
Problem::UnusedModuleImport(module_id, region) => {
doc = alloc.stack([
alloc.concat([
alloc.reflow("Nothing from "),
alloc.module(module_id),
alloc.reflow(" is used in this module."),
alloc.reflow(" is imported but not used."),
]),
alloc.region(lines.convert_region(region)),
alloc.concat([