mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Create LoadedImportRefs for vtable entries with import insts instead of local insts (#5931)
With help from Richard Smith debugging/identifying this. Hmm - looks like maybe the Self type import ref may have the same problem? (or at least it seems to have the same quirk in the semir dump, where the inst id is mentioned in the `import_ref` insts, but is not defined elsewhere, has no name, and says `[no loc]`. I'll look into that separately. (hmm, maybe this is just an unloaded ImportRef, actually)
This commit is contained in:
@@ -2003,18 +2003,20 @@ static auto TryResolveTypedInst(ImportRefResolver& resolver,
|
||||
return ResolveResult::Retry();
|
||||
}
|
||||
|
||||
for (auto& vtable_entry_id : lazy_virtual_functions) {
|
||||
for (auto [import_vtable_entry_inst_id, local_vtable_entry_inst_id] :
|
||||
llvm::zip(virtual_functions, lazy_virtual_functions)) {
|
||||
// Use LoadedImportRef for imported symbolic constant vtable entries so they
|
||||
// can carry attached constants necessary for applying specifics to these
|
||||
// constants when they are used.
|
||||
auto local_attached_constant_id =
|
||||
resolver.local_constant_values().Get(vtable_entry_id);
|
||||
resolver.local_constant_values().GetAttached(
|
||||
local_vtable_entry_inst_id);
|
||||
if (local_attached_constant_id.is_symbolic()) {
|
||||
vtable_entry_id = AddLoadedImportRef(
|
||||
local_vtable_entry_inst_id = AddLoadedImportRef(
|
||||
resolver,
|
||||
GetSingletonType(resolver.local_context(),
|
||||
SemIR::SpecificFunctionType::TypeInstId),
|
||||
vtable_entry_id, local_attached_constant_id);
|
||||
import_vtable_entry_inst_id, local_attached_constant_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user