Forward impl declarations of incomplete facet types (#5219)

Implements some of the changes from proposal #5168.

* The data structure for complete facet types has been repurposed for
identified facet types. Identified facet types are now a concept in the
toolchain, but without named constraint support they are not
substantially different from incomplete facet types.
* Identified facet types keep the list of required specific interfaces
in sorted order, for efficiency improvements in impl lookup. Found
another way to identify the interface to impl (or number of impls if not
1).
* Forward `impl` declarations of identified but incomplete facet types
are allowed unless the facet type has rewrites. An incomplete facet type
with rewrites is already either an error or has more than one interface
and so can't be implemented, so this case can't be exercised very well
yet.
* Forward `impl` declarations of interface without rewrites use a
placeholder inst block for the witness.
* Changed some machinery to use RequireIdentifiedFacetType to access the
interfaces of the facet type so we only need to add support for
expanding named constraints into interfaces in one place.

---------

Co-authored-by: Josh L <josh11b@users.noreply.github.com>
Co-authored-by: Dana Jansens <danakj@orodu.net>
This commit is contained in:
josh11b
2025-04-02 01:46:27 +00:00
committed by GitHub
co-authored by Josh L Dana Jansens
parent 265968b396
commit bc439ad092
32 changed files with 2921 additions and 351 deletions
+3 -3
View File
@@ -147,9 +147,9 @@ LLVM_DUMP_METHOD static auto Dump(const Context& context,
}
LLVM_DUMP_METHOD static auto Dump(
const Context& context, SemIR::CompleteFacetTypeId complete_facet_type_id)
-> std::string {
return SemIR::Dump(context.sem_ir(), complete_facet_type_id);
const Context& context,
SemIR::IdentifiedFacetTypeId identified_facet_type_id) -> std::string {
return SemIR::Dump(context.sem_ir(), identified_facet_type_id);
}
LLVM_DUMP_METHOD static auto Dump(const Context& context,