Remove some single-interface restrictions from some uses of facet types (#4508)

Co-authored-by: Josh L <josh11b@users.noreply.github.com>
This commit is contained in:
josh11b
2024-11-12 00:43:45 +00:00
committed by GitHub
co-authored by Josh L
parent 2c1d02d991
commit 4f474fafb5
5 changed files with 33 additions and 48 deletions
+5 -2
View File
@@ -124,11 +124,14 @@ static auto CheckAssociatedFunctionImplementation(
// Builds a witness that the specified impl implements the given interface.
static auto BuildInterfaceWitness(
Context& context, const SemIR::Impl& impl, SemIR::TypeId interface_type_id,
Context& context, const SemIR::Impl& impl, SemIR::TypeId facet_type_id,
SemIR::FacetTypeInfo::ImplsConstraint interface_type,
llvm::SmallVectorImpl<SemIR::InstId>& used_decl_ids) -> SemIR::InstId {
const auto& interface = context.interfaces().Get(interface_type.interface_id);
if (!context.TryToDefineType(interface_type_id, [&] {
// 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);