mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
When diagnosing a duplicated name, add the name to the diagnosis (#4902)
In order to have the name available for diagnostics, we now always set `NameId` in `NameContext` and put `poisoning_loc_id` as part of the union with `resolved_inst_id` instead (since we never need both).
This commit is contained in:
@@ -138,7 +138,8 @@ auto GetCanonicalImportIRInst(Context& context, SemIR::InstId inst_id)
|
||||
return GetCanonicalImportIRInst(context, &context.sem_ir(), inst_id);
|
||||
}
|
||||
|
||||
auto VerifySameCanonicalImportIRInst(Context& context, SemIR::InstId prev_id,
|
||||
auto VerifySameCanonicalImportIRInst(Context& context, SemIR::NameId name_id,
|
||||
SemIR::InstId prev_id,
|
||||
SemIR::ImportIRInst prev_import_ir_inst,
|
||||
SemIR::ImportIRId new_ir_id,
|
||||
const SemIR::File* new_import_ir,
|
||||
@@ -151,7 +152,7 @@ auto VerifySameCanonicalImportIRInst(Context& context, SemIR::InstId prev_id,
|
||||
auto conflict_id =
|
||||
AddImportRef(context, {.ir_id = new_ir_id, .inst_id = new_inst_id});
|
||||
// TODO: Pass the imported name location instead of the conflict id.
|
||||
DiagnoseDuplicateName(context, conflict_id, prev_id);
|
||||
DiagnoseDuplicateName(context, name_id, conflict_id, prev_id);
|
||||
}
|
||||
|
||||
// Returns an instruction that has the specified constant value.
|
||||
|
||||
Reference in New Issue
Block a user