Handle import refs in TryGetExistingDecl (#7620)

This solves the problem where `interface` imports are incorrectly
diagnosed as duplicate names in impl files.
Follows the implementation logic used in `handle_class.cpp`.

---------

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
This commit is contained in:
Özgür T. Önsoy
2026-08-11 19:29:46 +00:00
committed by GitHub
co-authored by Richard Smith
parent 0f93cbd370
commit 1f22ba91bb
10 changed files with 388 additions and 83 deletions
-3
View File
@@ -78,9 +78,6 @@ static auto BuildInterfaceDecl(Context& context,
auto existing_interface_decl = existing_decl->As<SemIR::InterfaceDecl>();
interface_decl.interface_id = existing_interface_decl.interface_id;
interface_decl.type_id = existing_interface_decl.type_id;
// TODO: If the new declaration is a definition, keep its parameter
// and implicit parameter lists rather than the ones from the
// previous declaration.
auto prev_decl_generic_id =
context.interfaces().Get(interface_decl.interface_id).generic_id;