Order of glob imports should not affect import shadowing
@@ -380,10 +380,15 @@ impl DefCollector<'_> {
while self.unresolved_imports.len() < n_previous_unresolved {
n_previous_unresolved = self.unresolved_imports.len();
- let imports = std::mem::replace(&mut self.unresolved_imports, Vec::new());
- for mut directive in imports {
+ let mut imports = std::mem::replace(&mut self.unresolved_imports, Vec::new());
+ for mut directive in &mut imports {
directive.status = self.resolve_import(directive.module_id, &directive.import);
+ }
+ let (glob_imports, non_glob_imports): (Vec<_>, Vec<_>) =
+ imports.into_iter().partition(|directive| directive.import.is_glob);
+ let mut record = |imports: Vec<ImportDirective>| {
+ for directive in imports {
match directive.status {
PartialResolvedImport::Indeterminate(_) => {
self.record_resolved_import(&directive);
@@ -400,6 +405,10 @@ impl DefCollector<'_> {
}
}
}
+ };
+
+ record(glob_imports);
+ record(non_glob_imports);
}
}
