Basic support for generic bindings. (#3555)

This change adds a `BindSymbolicName` instruction for generic bindings,
paralleling the existing `BindName`. A mechanism is also added to allow
both kinds of binding to be accessed uniformly, for convenience in the
case where the two different kinds of binding are treated the same.

Generic bindings of type `type` are allowed to be used as types,
although no operations are provided for such types. For now lowering
treats these types as empty structs, which seems like a reasonable
lowering for non-monomorphized unconstrained types.
This commit is contained in:
Richard Smith
2024-01-05 03:39:45 +00:00
committed by GitHub
parent 0205645e7d
commit a6508fcf05
24 changed files with 321 additions and 33 deletions
+1 -1
View File
@@ -261,7 +261,7 @@ auto HandleFunctionDefinitionStart(Context& context,
context.sem_ir().StringifyType(param.type_id()));
});
if (auto fn_param = param.TryAs<SemIR::BindName>()) {
if (auto fn_param = param.TryAs<SemIR::AnyBindName>()) {
context.AddNameToLookup(
fn_param->parse_node,
context.bind_names().Get(fn_param->bind_name_id).name_id, param_id);