Support for initialization of classes with abstract base classes. (#6802)

When initializing `.base` in class initialization, use `partial Base` as
the destination type rather than `Base`. Treat `partial Base` as not
being abstract even when `Base` is.

Allow conversion from a `partial T` initializer to a `T` initializer.
Store the vptr while performing the conversion. Do not store the vptr
when performing a `partial T` initialization, only when performing a
non-partial `T` initialization.
This commit is contained in:
Richard Smith
2026-02-27 01:27:25 +00:00
committed by GitHub
parent be88dfd744
commit 41dd256d56
22 changed files with 717 additions and 233 deletions
+7
View File
@@ -8,6 +8,7 @@
#include "common/vlog.h"
#include "toolchain/base/kind_switch.h"
#include "toolchain/sem_ir/diagnostic_loc_converter.h"
#include "toolchain/sem_ir/expr_info.h"
#include "toolchain/sem_ir/file.h"
#include "toolchain/sem_ir/generic.h"
@@ -293,6 +294,12 @@ auto FunctionContext::InitializeStorage(TypeInFile type, SemIR::InstId dest_id,
}
}
auto FunctionContext::InitializeStorage(SemIR::InstId init_id) -> void {
InitializeStorage(GetTypeIdOfInst(init_id),
SemIR::FindStorageArgForInitializer(sem_ir(), init_id),
init_id);
}
auto FunctionContext::GetTypeIdOfInst(SemIR::InstId inst_id) -> TypeInFile {
auto [file, type_id] = SemIR::GetTypeOfInstInSpecific(
specific_sem_ir(), specific_id(), sem_ir(), inst_id);