Add check support for struct patterns (#7876)

Implements check and pattern matching support for struct patterns.

This PR implements complete patterns, and leaves `_` field handling for
future work.
This commit is contained in:
oli-ej authored and GitHub committed 2026-10-30 21:03:16 +00:00
1 parent 3ee012b86a
commit c6b54b57e2
23 files changed
+1764 -110

No files matched your search

+5 -1
View File
@@ -65,7 +65,11 @@ auto GetFirstBindingNameFromPatternId(const File& sem_ir, InstId pattern_id)
continue;
}
// TODO: Look through struct patterns.
if (auto struct_patt = inst.TryAs<StructPattern>()) {
auto block = sem_ir.inst_blocks().Get(struct_patt->elements_id);
work_list.append(block.rbegin(), block.rend());
continue;
}
if (auto ref_pattern = inst.TryAs<RefParamPattern>()) {
// TODO: This introduces a name, but we don't model it as a binding.