mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Start attempting ambiguous import merges. (#3827)
Just connecting this together. Note the diagnostics still need to be cleaned up/improved, although this is correctly handling some cases. This exposed an incorrect parameter passed in DiagnosticEmitter, which is fixed here -- context_fn shouldn't include args. Note this was caught by the CHECK, I'm just expanding on the message since I used the detail to help figure out the bug.
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include "toolchain/check/eval.h"
|
||||
#include "toolchain/check/import_ref.h"
|
||||
#include "toolchain/check/inst_block_stack.h"
|
||||
#include "toolchain/check/merge.h"
|
||||
#include "toolchain/diagnostics/diagnostic_emitter.h"
|
||||
#include "toolchain/lex/tokenized_buffer.h"
|
||||
#include "toolchain/parse/node_ids.h"
|
||||
@@ -337,11 +338,10 @@ static auto LookupInImportIRScopes(Context& context, SemIRLoc loc,
|
||||
continue;
|
||||
}
|
||||
auto import_inst_id = context.AddImportRef(import_ir_id, it->second);
|
||||
TryResolveImportRefUnused(context, import_inst_id);
|
||||
if (result_id.is_valid()) {
|
||||
// TODO: Add generalized merge functionality (merge_decls.h?).
|
||||
context.DiagnoseDuplicateName(import_inst_id, result_id);
|
||||
MergeImportRef(context, import_inst_id, result_id);
|
||||
} else {
|
||||
TryResolveImportRefUnused(context, import_inst_id);
|
||||
result_id = import_inst_id;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user