Generate parameter pattern-match IR from pattern IR (#4388)

Also propagate the pattern IR along with the pattern-match IR, and use
it where appropriate.

Strictly speaking, some parts of the pattern-match IR are allocated
eagerly, while traversing the pattern's parse tree, but they still
aren't actually emitted until we traverse the associated pattern insts.

---------

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
Geoff Romer
2024-10-16 19:15:29 +00:00
committed by GitHub
co-authored by Jon Ross-Perkins
parent 4a73b36688
commit 9d942f4633
347 changed files with 9148 additions and 5802 deletions
+6 -4
View File
@@ -60,8 +60,9 @@ static auto BuildInterfaceDecl(Context& context,
SemIR::Interface interface_info = {name_context.MakeEntityWithParamsBase(
name, interface_decl_id, /*is_extern=*/false,
SemIR::LibraryNameId::Invalid)};
RequireGenericParamsOnType(context, interface_info.implicit_param_refs_id);
RequireGenericParamsOnType(context, interface_info.param_refs_id);
RequireGenericParamsOnType(context,
interface_info.implicit_param_patterns_id);
RequireGenericParamsOnType(context, interface_info.param_patterns_id);
// Check whether this is a redeclaration.
auto existing_id = context.decl_name_stack().LookupOrAddName(
@@ -74,8 +75,9 @@ static auto BuildInterfaceDecl(Context& context,
if (CheckRedeclParamsMatch(
context,
DeclParams(interface_decl_id, name.first_param_node_id,
name.last_param_node_id, name.implicit_params_id,
name.params_id),
name.last_param_node_id,
name.implicit_param_patterns_id,
name.param_patterns_id),
DeclParams(existing_interface))) {
// TODO: This should be refactored a little, particularly for
// prev_import_ir_id. See similar logic for classes and functions, which