Import symbolic vtable entries as attached constants (#5871)

Similar to 26ec78ec00 - vtable entries
can't be unattached symbolic constants, because if they are they can't
be `GetValueInSpecific`d because they lack the context for their
generic/specific.

Importing mostly wants to make/import things as unattached constants -
but `ImportRef` supports attached constants, so use those - but we don't
need the laziness, so use `LoadedImportRef`.
This commit is contained in:
David Blaikie
2025-08-06 18:27:22 +00:00
committed by GitHub
parent 139bdf258e
commit 545354a3b4
3 changed files with 50 additions and 19 deletions
+1
View File
@@ -187,6 +187,7 @@ static auto BuildVtable(Context& context, Parse::ClassDefinitionId node_id,
// TODO: Avoid quadratic search. Perhaps build a map from `NameId` to the
// elements of the top of `vtable_stack`.
for (auto base_vtable_entry_id : base_vtable_inst_block) {
LoadImportRef(context, base_vtable_entry_id);
auto [derived_vtable_entry_id, derived_vtable_entry_const_id, fn_id,
specific_id] =
DecomposeVirtualFunction(context.sem_ir(), base_vtable_entry_id,