[ty] Fix find-references for import aliases (#21736)

This commit is contained in:
Micha Reiser
2025-12-02 14:37:50 +01:00
committed by GitHub
parent 015ab9e576
commit 644096ea8a
4 changed files with 264 additions and 46 deletions

View File

@@ -1478,6 +1478,8 @@ impl<'ast> Visitor<'ast> for SemanticIndexBuilder<'_, 'ast> {
}
let (symbol_name, is_reexported) = if let Some(asname) = &alias.asname {
self.scopes_by_expression
.record_expression(asname, self.current_scope());
(asname.id.clone(), asname.id == alias.name.id)
} else {
(Name::new(alias.name.id.split('.').next().unwrap()), false)
@@ -1651,6 +1653,8 @@ impl<'ast> Visitor<'ast> for SemanticIndexBuilder<'_, 'ast> {
}
let (symbol_name, is_reexported) = if let Some(asname) = &alias.asname {
self.scopes_by_expression
.record_expression(asname, self.current_scope());
// It's re-exported if it's `from ... import x as x`
(&asname.id, asname.id == alias.name.id)
} else {