mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Track complete types required by a generic. (#4652)
When a generic requires a symbolic type to be complete, add a new `require_complete_type` instruction to the generic eval block. During monomorphization of such an instruction, require that type to be complete.
This commit is contained in:
@@ -143,13 +143,15 @@ static auto BuildInterfaceWitness(
|
||||
// TODO: This is going to try and define all the interfaces for this facet
|
||||
// type, and so once we support impl of a facet type with more than one
|
||||
// interface, it might give the wrong name in the diagnostic.
|
||||
if (!context.TryToDefineType(facet_type_id, [&] {
|
||||
CARBON_DIAGNOSTIC(ImplOfUndefinedInterface, Error,
|
||||
"implementation of undefined interface {0}",
|
||||
SemIR::NameId);
|
||||
return context.emitter().Build(
|
||||
impl.definition_id, ImplOfUndefinedInterface, interface.name_id);
|
||||
})) {
|
||||
if (!context.TryToDefineType(
|
||||
facet_type_id, context.insts().GetLocId(impl.definition_id), [&] {
|
||||
CARBON_DIAGNOSTIC(ImplOfUndefinedInterface, Error,
|
||||
"implementation of undefined interface {0}",
|
||||
SemIR::NameId);
|
||||
return context.emitter().Build(impl.definition_id,
|
||||
ImplOfUndefinedInterface,
|
||||
interface.name_id);
|
||||
})) {
|
||||
return SemIR::ErrorInst::SingletonInstId;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user