Initial support for binding patterns in SemIR (#4221)

Introduces the `BindingPattern` and `SymbolicBindingPattern` insts, and
a separate stack of pattern blocks that they are emitted into. The
intent is to generate the corresponding pattern-matching insts (like
`BindName`) from them in a separate pass, but that is deferred to future
PRs.

See
[here](https://docs.google.com/document/d/1U_vQH17V893J9aF1LJXUnFYBNSs2MjKl4bJPaWCB2zo/edit?usp=sharing&resourcekey=0-w0xGYZ0An31Kpz-wvzSXwQ)
for the design this is based on, but note that during review we have
chosen to deviate from that design by putting the patterns in separate
blocks, and omitting the "forward references" from a `BindingPattern` to
its corresponding `BindName`. This in turn necessitates having separate
inst kinds for symbolic and non-symbolic binding patterns.

---------

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
Geoff Romer
2024-09-25 19:12:58 +00:00
committed by GitHub
co-authored by Jon Ross-Perkins
parent 87678cc374
commit dc32aa2690
531 changed files with 10270 additions and 8119 deletions
+103 -95
View File
@@ -301,37 +301,41 @@ import library "extern_api";
// CHECK:STDOUT: .NS = %NS
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [template = constants.%A] {}
// CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [template = constants.%A] {} {}
// CHECK:STDOUT: %B.decl: %B.type = fn_decl @B [template = constants.%B] {
// CHECK:STDOUT: %b.patt: i32 = binding_pattern b
// CHECK:STDOUT: } {
// CHECK:STDOUT: %int.make_type_32.loc5_9: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc5_9.1: type = value_of_initializer %int.make_type_32.loc5_9 [template = i32]
// CHECK:STDOUT: %.loc5_9.2: type = converted %int.make_type_32.loc5_9, %.loc5_9.1 [template = i32]
// CHECK:STDOUT: %b.loc5_6.1: i32 = param b, runtime_param0
// CHECK:STDOUT: @B.%b: i32 = bind_name b, %b.loc5_6.1
// CHECK:STDOUT: %b.param: i32 = param b, runtime_param0
// CHECK:STDOUT: %b: i32 = bind_name b, %b.param
// CHECK:STDOUT: %int.make_type_32.loc5_17: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc5_17.1: type = value_of_initializer %int.make_type_32.loc5_17 [template = i32]
// CHECK:STDOUT: %.loc5_17.2: type = converted %int.make_type_32.loc5_17, %.loc5_17.1 [template = i32]
// CHECK:STDOUT: @B.%return: ref i32 = var <return slot>
// CHECK:STDOUT: %return: ref i32 = var <return slot>
// CHECK:STDOUT: }
// CHECK:STDOUT: %C.decl: %C.type = fn_decl @C [template = constants.%C] {
// CHECK:STDOUT: %c.patt: %.3 = binding_pattern c
// CHECK:STDOUT: } {
// CHECK:STDOUT: %int.make_type_32.loc6_10: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc6_14.1: %.2 = tuple_literal (%int.make_type_32.loc6_10)
// CHECK:STDOUT: %.loc6_14.2: type = value_of_initializer %int.make_type_32.loc6_10 [template = i32]
// CHECK:STDOUT: %.loc6_14.3: type = converted %int.make_type_32.loc6_10, %.loc6_14.2 [template = i32]
// CHECK:STDOUT: %.loc6_14.4: type = converted %.loc6_14.1, constants.%.3 [template = constants.%.3]
// CHECK:STDOUT: %c.loc6_6.1: %.3 = param c, runtime_param0
// CHECK:STDOUT: @C.%c: %.3 = bind_name c, %c.loc6_6.1
// CHECK:STDOUT: %c.param: %.3 = param c, runtime_param0
// CHECK:STDOUT: %c: %.3 = bind_name c, %c.param
// CHECK:STDOUT: %int.make_type_32.loc6_25: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc6_25.1: type = value_of_initializer %int.make_type_32.loc6_25 [template = i32]
// CHECK:STDOUT: %.loc6_25.2: type = converted %int.make_type_32.loc6_25, %.loc6_25.1 [template = i32]
// CHECK:STDOUT: %.loc6_28: type = struct_type {.c: i32} [template = constants.%.4]
// CHECK:STDOUT: @C.%return: ref %.4 = var <return slot>
// CHECK:STDOUT: %return: ref %.4 = var <return slot>
// CHECK:STDOUT: }
// CHECK:STDOUT: %D.decl: %D.type = fn_decl @D [template = constants.%D] {}
// CHECK:STDOUT: %D.decl: %D.type = fn_decl @D [template = constants.%D] {} {}
// CHECK:STDOUT: %NS: <namespace> = namespace [template] {
// CHECK:STDOUT: .E = %E.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %E.decl: %E.type = fn_decl @E [template = constants.%E] {}
// CHECK:STDOUT: %E.decl: %E.type = fn_decl @E [template = constants.%E] {} {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @A();
@@ -392,37 +396,41 @@ import library "extern_api";
// CHECK:STDOUT: .NS = %NS
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [template = constants.%A] {}
// CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [template = constants.%A] {} {}
// CHECK:STDOUT: %B.decl: %B.type = fn_decl @B [template = constants.%B] {
// CHECK:STDOUT: %b.patt: i32 = binding_pattern b
// CHECK:STDOUT: } {
// CHECK:STDOUT: %int.make_type_32.loc5_44: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc5_44.1: type = value_of_initializer %int.make_type_32.loc5_44 [template = i32]
// CHECK:STDOUT: %.loc5_44.2: type = converted %int.make_type_32.loc5_44, %.loc5_44.1 [template = i32]
// CHECK:STDOUT: %b.loc5_41.1: i32 = param b, runtime_param0
// CHECK:STDOUT: @B.%b: i32 = bind_name b, %b.loc5_41.1
// CHECK:STDOUT: %b.param: i32 = param b, runtime_param0
// CHECK:STDOUT: %b: i32 = bind_name b, %b.param
// CHECK:STDOUT: %int.make_type_32.loc5_52: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc5_52.1: type = value_of_initializer %int.make_type_32.loc5_52 [template = i32]
// CHECK:STDOUT: %.loc5_52.2: type = converted %int.make_type_32.loc5_52, %.loc5_52.1 [template = i32]
// CHECK:STDOUT: @B.%return: ref i32 = var <return slot>
// CHECK:STDOUT: %return: ref i32 = var <return slot>
// CHECK:STDOUT: }
// CHECK:STDOUT: %C.decl: %C.type = fn_decl @C [template = constants.%C] {
// CHECK:STDOUT: %c.patt: %.3 = binding_pattern c
// CHECK:STDOUT: } {
// CHECK:STDOUT: %int.make_type_32.loc6_45: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc6_49.1: %.2 = tuple_literal (%int.make_type_32.loc6_45)
// CHECK:STDOUT: %.loc6_49.2: type = value_of_initializer %int.make_type_32.loc6_45 [template = i32]
// CHECK:STDOUT: %.loc6_49.3: type = converted %int.make_type_32.loc6_45, %.loc6_49.2 [template = i32]
// CHECK:STDOUT: %.loc6_49.4: type = converted %.loc6_49.1, constants.%.3 [template = constants.%.3]
// CHECK:STDOUT: %c.loc6_41.1: %.3 = param c, runtime_param0
// CHECK:STDOUT: @C.%c: %.3 = bind_name c, %c.loc6_41.1
// CHECK:STDOUT: %c.param: %.3 = param c, runtime_param0
// CHECK:STDOUT: %c: %.3 = bind_name c, %c.param
// CHECK:STDOUT: %int.make_type_32.loc6_60: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc6_60.1: type = value_of_initializer %int.make_type_32.loc6_60 [template = i32]
// CHECK:STDOUT: %.loc6_60.2: type = converted %int.make_type_32.loc6_60, %.loc6_60.1 [template = i32]
// CHECK:STDOUT: %.loc6_63: type = struct_type {.c: i32} [template = constants.%.4]
// CHECK:STDOUT: @C.%return: ref %.4 = var <return slot>
// CHECK:STDOUT: %return: ref %.4 = var <return slot>
// CHECK:STDOUT: }
// CHECK:STDOUT: %D.decl: %D.type = fn_decl @D [template = constants.%D] {}
// CHECK:STDOUT: %D.decl: %D.type = fn_decl @D [template = constants.%D] {} {}
// CHECK:STDOUT: %NS: <namespace> = namespace [template] {
// CHECK:STDOUT: .E = %E.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %E.decl: %E.type = fn_decl @E [template = constants.%E] {}
// CHECK:STDOUT: %E.decl: %E.type = fn_decl @E [template = constants.%E] {} {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: extern fn @A();
@@ -461,14 +469,14 @@ import library "extern_api";
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
// CHECK:STDOUT: %import_ref.1: %A.type = import_ref Main//api, inst+3, loaded [template = constants.%A]
// CHECK:STDOUT: %import_ref.2: %B.type = import_ref Main//api, inst+21, loaded [template = constants.%B]
// CHECK:STDOUT: %import_ref.3: %C.type = import_ref Main//api, inst+41, loaded [template = constants.%C]
// CHECK:STDOUT: %import_ref.4: %D.type = import_ref Main//api, inst+44, loaded [template = constants.%D]
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref Main//api, inst+47, loaded
// CHECK:STDOUT: %import_ref.2: %B.type = import_ref Main//api, inst+22, loaded [template = constants.%B]
// CHECK:STDOUT: %import_ref.3: %C.type = import_ref Main//api, inst+43, loaded [template = constants.%C]
// CHECK:STDOUT: %import_ref.4: %D.type = import_ref Main//api, inst+46, loaded [template = constants.%D]
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref Main//api, inst+49, loaded
// CHECK:STDOUT: %NS: <namespace> = namespace %import_ref.5, [template] {
// CHECK:STDOUT: .E = %import_ref.6
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.6: %E.type = import_ref Main//api, inst+48, loaded [template = constants.%E]
// CHECK:STDOUT: %import_ref.6: %E.type = import_ref Main//api, inst+50, loaded [template = constants.%E]
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
// CHECK:STDOUT: .Int32 = %import_ref.7
// CHECK:STDOUT: import Core//prelude
@@ -587,14 +595,14 @@ import library "extern_api";
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
// CHECK:STDOUT: %import_ref.1: %A.type = import_ref Main//api, inst+3, loaded [template = constants.%A]
// CHECK:STDOUT: %import_ref.2: %B.type = import_ref Main//api, inst+21, loaded [template = constants.%B]
// CHECK:STDOUT: %import_ref.3: %C.type = import_ref Main//api, inst+41, loaded [template = constants.%C]
// CHECK:STDOUT: %import_ref.4: %D.type = import_ref Main//api, inst+44, loaded [template = constants.%D]
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref Main//api, inst+47, loaded
// CHECK:STDOUT: %import_ref.2: %B.type = import_ref Main//api, inst+22, loaded [template = constants.%B]
// CHECK:STDOUT: %import_ref.3: %C.type = import_ref Main//api, inst+43, loaded [template = constants.%C]
// CHECK:STDOUT: %import_ref.4: %D.type = import_ref Main//api, inst+46, loaded [template = constants.%D]
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref Main//api, inst+49, loaded
// CHECK:STDOUT: %NS: <namespace> = namespace %import_ref.5, [template] {
// CHECK:STDOUT: .E = file.%E.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.6: %E.type = import_ref Main//api, inst+48, loaded [template = constants.%E]
// CHECK:STDOUT: %import_ref.6: %E.type = import_ref Main//api, inst+50, loaded [template = constants.%E]
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
// CHECK:STDOUT: .Int32 = %import_ref.7
// CHECK:STDOUT: import Core//prelude
@@ -618,41 +626,41 @@ import library "extern_api";
// CHECK:STDOUT: .NS = imports.%NS
// CHECK:STDOUT: .Core = imports.%Core
// CHECK:STDOUT: .a = %a
// CHECK:STDOUT: .b = %b.loc53
// CHECK:STDOUT: .c = %c.loc54
// CHECK:STDOUT: .b = %b
// CHECK:STDOUT: .c = %c
// CHECK:STDOUT: .d = %d
// CHECK:STDOUT: .e = %e
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: %default.import = import <invalid>
// CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [template = constants.%A] {}
// CHECK:STDOUT: %B.decl: %B.type = fn_decl @B [template = constants.%B] {
// CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [template = constants.%A] {} {}
// CHECK:STDOUT: %B.decl: %B.type = fn_decl @B [template = constants.%B] {} {
// CHECK:STDOUT: %int.make_type_32.loc23_16: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc23_16.1: type = value_of_initializer %int.make_type_32.loc23_16 [template = i32]
// CHECK:STDOUT: %.loc23_16.2: type = converted %int.make_type_32.loc23_16, %.loc23_16.1 [template = i32]
// CHECK:STDOUT: %b.loc23_13.1: i32 = param b, runtime_param0
// CHECK:STDOUT: %b.loc23_13.2: i32 = bind_name b, %b.loc23_13.1
// CHECK:STDOUT: %b.param: i32 = param b, runtime_param0
// CHECK:STDOUT: %b.loc23: i32 = bind_name b, %b.param
// CHECK:STDOUT: %int.make_type_32.loc23_24: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc23_24.1: type = value_of_initializer %int.make_type_32.loc23_24 [template = i32]
// CHECK:STDOUT: %.loc23_24.2: type = converted %int.make_type_32.loc23_24, %.loc23_24.1 [template = i32]
// CHECK:STDOUT: %return.var.loc23: ref i32 = var <return slot>
// CHECK:STDOUT: %return.var: ref i32 = var <return slot>
// CHECK:STDOUT: }
// CHECK:STDOUT: %C.decl: %C.type = fn_decl @C [template = constants.%C] {
// CHECK:STDOUT: %C.decl: %C.type = fn_decl @C [template = constants.%C] {} {
// CHECK:STDOUT: %int.make_type_32.loc32_17: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc32_21.1: %.2 = tuple_literal (%int.make_type_32.loc32_17)
// CHECK:STDOUT: %.loc32_21.2: type = value_of_initializer %int.make_type_32.loc32_17 [template = i32]
// CHECK:STDOUT: %.loc32_21.3: type = converted %int.make_type_32.loc32_17, %.loc32_21.2 [template = i32]
// CHECK:STDOUT: %.loc32_21.4: type = converted %.loc32_21.1, constants.%.3 [template = constants.%.3]
// CHECK:STDOUT: %c.loc32_13.1: %.3 = param c, runtime_param0
// CHECK:STDOUT: %c.loc32_13.2: %.3 = bind_name c, %c.loc32_13.1
// CHECK:STDOUT: %c.param: %.3 = param c, runtime_param0
// CHECK:STDOUT: %c.loc32: %.3 = bind_name c, %c.param
// CHECK:STDOUT: %int.make_type_32.loc32_32: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc32_32.1: type = value_of_initializer %int.make_type_32.loc32_32 [template = i32]
// CHECK:STDOUT: %.loc32_32.2: type = converted %int.make_type_32.loc32_32, %.loc32_32.1 [template = i32]
// CHECK:STDOUT: %.loc32_35: type = struct_type {.c: i32} [template = constants.%.4]
// CHECK:STDOUT: %return.var.loc32: ref %.4 = var <return slot>
// CHECK:STDOUT: %return.var: ref %.4 = var <return slot>
// CHECK:STDOUT: }
// CHECK:STDOUT: %D.decl: %D.type = fn_decl @D [template = constants.%D] {}
// CHECK:STDOUT: %E.decl: %E.type = fn_decl @E [template = constants.%E] {}
// CHECK:STDOUT: %D.decl: %D.type = fn_decl @D [template = constants.%D] {} {}
// CHECK:STDOUT: %E.decl: %E.type = fn_decl @E [template = constants.%E] {} {}
// CHECK:STDOUT: %.loc52_9.1: %.1 = tuple_literal ()
// CHECK:STDOUT: %.loc52_9.2: type = converted %.loc52_9.1, constants.%.1 [template = constants.%.1]
// CHECK:STDOUT: %a.var: ref %.1 = var a
@@ -661,13 +669,13 @@ import library "extern_api";
// CHECK:STDOUT: %.loc53_8.1: type = value_of_initializer %int.make_type_32.loc53 [template = i32]
// CHECK:STDOUT: %.loc53_8.2: type = converted %int.make_type_32.loc53, %.loc53_8.1 [template = i32]
// CHECK:STDOUT: %b.var: ref i32 = var b
// CHECK:STDOUT: %b.loc53: ref i32 = bind_name b, %b.var
// CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var
// CHECK:STDOUT: %int.make_type_32.loc54: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc54_13.1: type = value_of_initializer %int.make_type_32.loc54 [template = i32]
// CHECK:STDOUT: %.loc54_13.2: type = converted %int.make_type_32.loc54, %.loc54_13.1 [template = i32]
// CHECK:STDOUT: %.loc54_16: type = struct_type {.c: i32} [template = constants.%.4]
// CHECK:STDOUT: %c.var: ref %.4 = var c
// CHECK:STDOUT: %c.loc54: ref %.4 = bind_name c, %c.var
// CHECK:STDOUT: %c: ref %.4 = bind_name c, %c.var
// CHECK:STDOUT: %.loc55_9.1: %.1 = tuple_literal ()
// CHECK:STDOUT: %.loc55_9.2: type = converted %.loc55_9.1, constants.%.1 [template = constants.%.1]
// CHECK:STDOUT: %d.var: ref %.1 = var d
@@ -682,9 +690,9 @@ import library "extern_api";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @B(%b: i32) -> i32;
// CHECK:STDOUT: fn @B(%b.1: i32) -> i32;
// CHECK:STDOUT:
// CHECK:STDOUT: fn @C(%c: %.3) -> %.4;
// CHECK:STDOUT: fn @C(%c.1: %.3) -> %.4;
// CHECK:STDOUT:
// CHECK:STDOUT: extern fn @D();
// CHECK:STDOUT:
@@ -741,14 +749,14 @@ import library "extern_api";
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
// CHECK:STDOUT: %import_ref.1: %A.type = import_ref Main//extern_api, inst+3, loaded [template = constants.%A]
// CHECK:STDOUT: %import_ref.2: %B.type = import_ref Main//extern_api, inst+21, loaded [template = constants.%B]
// CHECK:STDOUT: %import_ref.3: %C.type = import_ref Main//extern_api, inst+41, loaded [template = constants.%C]
// CHECK:STDOUT: %import_ref.4: %D.type = import_ref Main//extern_api, inst+44, loaded [template = constants.%D]
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref Main//extern_api, inst+47, loaded
// CHECK:STDOUT: %import_ref.2: %B.type = import_ref Main//extern_api, inst+22, loaded [template = constants.%B]
// CHECK:STDOUT: %import_ref.3: %C.type = import_ref Main//extern_api, inst+43, loaded [template = constants.%C]
// CHECK:STDOUT: %import_ref.4: %D.type = import_ref Main//extern_api, inst+46, loaded [template = constants.%D]
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref Main//extern_api, inst+49, loaded
// CHECK:STDOUT: %NS: <namespace> = namespace %import_ref.5, [template] {
// CHECK:STDOUT: .E = file.%E.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.6: %E.type = import_ref Main//extern_api, inst+48, loaded [template = constants.%E]
// CHECK:STDOUT: %import_ref.6: %E.type = import_ref Main//extern_api, inst+50, loaded [template = constants.%E]
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
// CHECK:STDOUT: .Int32 = %import_ref.7
// CHECK:STDOUT: import Core//prelude
@@ -772,41 +780,41 @@ import library "extern_api";
// CHECK:STDOUT: .NS = imports.%NS
// CHECK:STDOUT: .Core = imports.%Core
// CHECK:STDOUT: .a = %a
// CHECK:STDOUT: .b = %b.loc13
// CHECK:STDOUT: .c = %c.loc14
// CHECK:STDOUT: .b = %b
// CHECK:STDOUT: .c = %c
// CHECK:STDOUT: .d = %d
// CHECK:STDOUT: .e = %e
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: %default.import = import <invalid>
// CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [template = constants.%A] {}
// CHECK:STDOUT: %B.decl: %B.type = fn_decl @B [template = constants.%B] {
// CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [template = constants.%A] {} {}
// CHECK:STDOUT: %B.decl: %B.type = fn_decl @B [template = constants.%B] {} {
// CHECK:STDOUT: %int.make_type_32.loc7_16: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc7_16.1: type = value_of_initializer %int.make_type_32.loc7_16 [template = i32]
// CHECK:STDOUT: %.loc7_16.2: type = converted %int.make_type_32.loc7_16, %.loc7_16.1 [template = i32]
// CHECK:STDOUT: %b.loc7_13.1: i32 = param b, runtime_param0
// CHECK:STDOUT: %b.loc7_13.2: i32 = bind_name b, %b.loc7_13.1
// CHECK:STDOUT: %b.param: i32 = param b, runtime_param0
// CHECK:STDOUT: %b.loc7: i32 = bind_name b, %b.param
// CHECK:STDOUT: %int.make_type_32.loc7_24: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc7_24.1: type = value_of_initializer %int.make_type_32.loc7_24 [template = i32]
// CHECK:STDOUT: %.loc7_24.2: type = converted %int.make_type_32.loc7_24, %.loc7_24.1 [template = i32]
// CHECK:STDOUT: %return.var.loc7: ref i32 = var <return slot>
// CHECK:STDOUT: %return.var: ref i32 = var <return slot>
// CHECK:STDOUT: }
// CHECK:STDOUT: %C.decl: %C.type = fn_decl @C [template = constants.%C] {
// CHECK:STDOUT: %C.decl: %C.type = fn_decl @C [template = constants.%C] {} {
// CHECK:STDOUT: %int.make_type_32.loc8_17: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc8_21.1: %.2 = tuple_literal (%int.make_type_32.loc8_17)
// CHECK:STDOUT: %.loc8_21.2: type = value_of_initializer %int.make_type_32.loc8_17 [template = i32]
// CHECK:STDOUT: %.loc8_21.3: type = converted %int.make_type_32.loc8_17, %.loc8_21.2 [template = i32]
// CHECK:STDOUT: %.loc8_21.4: type = converted %.loc8_21.1, constants.%.3 [template = constants.%.3]
// CHECK:STDOUT: %c.loc8_13.1: %.3 = param c, runtime_param0
// CHECK:STDOUT: %c.loc8_13.2: %.3 = bind_name c, %c.loc8_13.1
// CHECK:STDOUT: %c.param: %.3 = param c, runtime_param0
// CHECK:STDOUT: %c.loc8: %.3 = bind_name c, %c.param
// CHECK:STDOUT: %int.make_type_32.loc8_32: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc8_32.1: type = value_of_initializer %int.make_type_32.loc8_32 [template = i32]
// CHECK:STDOUT: %.loc8_32.2: type = converted %int.make_type_32.loc8_32, %.loc8_32.1 [template = i32]
// CHECK:STDOUT: %.loc8_35: type = struct_type {.c: i32} [template = constants.%.4]
// CHECK:STDOUT: %return.var.loc8: ref %.4 = var <return slot>
// CHECK:STDOUT: %return.var: ref %.4 = var <return slot>
// CHECK:STDOUT: }
// CHECK:STDOUT: %D.decl: %D.type = fn_decl @D [template = constants.%D] {}
// CHECK:STDOUT: %E.decl: %E.type = fn_decl @E [template = constants.%E] {}
// CHECK:STDOUT: %D.decl: %D.type = fn_decl @D [template = constants.%D] {} {}
// CHECK:STDOUT: %E.decl: %E.type = fn_decl @E [template = constants.%E] {} {}
// CHECK:STDOUT: %.loc12_9.1: %.1 = tuple_literal ()
// CHECK:STDOUT: %.loc12_9.2: type = converted %.loc12_9.1, constants.%.1 [template = constants.%.1]
// CHECK:STDOUT: %a.var: ref %.1 = var a
@@ -815,13 +823,13 @@ import library "extern_api";
// CHECK:STDOUT: %.loc13_8.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32]
// CHECK:STDOUT: %.loc13_8.2: type = converted %int.make_type_32.loc13, %.loc13_8.1 [template = i32]
// CHECK:STDOUT: %b.var: ref i32 = var b
// CHECK:STDOUT: %b.loc13: ref i32 = bind_name b, %b.var
// CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var
// CHECK:STDOUT: %int.make_type_32.loc14: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc14_13.1: type = value_of_initializer %int.make_type_32.loc14 [template = i32]
// CHECK:STDOUT: %.loc14_13.2: type = converted %int.make_type_32.loc14, %.loc14_13.1 [template = i32]
// CHECK:STDOUT: %.loc14_16: type = struct_type {.c: i32} [template = constants.%.4]
// CHECK:STDOUT: %c.var: ref %.4 = var c
// CHECK:STDOUT: %c.loc14: ref %.4 = bind_name c, %c.var
// CHECK:STDOUT: %c: ref %.4 = bind_name c, %c.var
// CHECK:STDOUT: %.loc15_9.1: %.1 = tuple_literal ()
// CHECK:STDOUT: %.loc15_9.2: type = converted %.loc15_9.1, constants.%.1 [template = constants.%.1]
// CHECK:STDOUT: %d.var: ref %.1 = var d
@@ -836,9 +844,9 @@ import library "extern_api";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
// CHECK:STDOUT: extern fn @B(%b: i32) -> i32;
// CHECK:STDOUT: extern fn @B(%b.1: i32) -> i32;
// CHECK:STDOUT:
// CHECK:STDOUT: extern fn @C(%c: %.3) -> %.4;
// CHECK:STDOUT: extern fn @C(%c.1: %.3) -> %.4;
// CHECK:STDOUT:
// CHECK:STDOUT: extern fn @D();
// CHECK:STDOUT:
@@ -894,19 +902,19 @@ import library "extern_api";
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
// CHECK:STDOUT: %import_ref.1: %A.type = import_ref Main//api, inst+3, loaded [template = constants.%A]
// CHECK:STDOUT: %import_ref.2: %B.type = import_ref Main//api, inst+21, loaded [template = constants.%B]
// CHECK:STDOUT: %import_ref.3: %C.type = import_ref Main//api, inst+41, loaded [template = constants.%C]
// CHECK:STDOUT: %import_ref.4: %D.type = import_ref Main//api, inst+44, loaded [template = constants.%D]
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref Main//api, inst+47, loaded
// CHECK:STDOUT: %import_ref.2: %B.type = import_ref Main//api, inst+22, loaded [template = constants.%B]
// CHECK:STDOUT: %import_ref.3: %C.type = import_ref Main//api, inst+43, loaded [template = constants.%C]
// CHECK:STDOUT: %import_ref.4: %D.type = import_ref Main//api, inst+46, loaded [template = constants.%D]
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref Main//api, inst+49, loaded
// CHECK:STDOUT: %NS: <namespace> = namespace %import_ref.5, [template] {
// CHECK:STDOUT: .E = %import_ref.6
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.6: %E.type = import_ref Main//api, inst+48, loaded [template = constants.%E]
// CHECK:STDOUT: %import_ref.6: %E.type = import_ref Main//api, inst+50, loaded [template = constants.%E]
// CHECK:STDOUT: %import_ref.7 = import_ref Main//extern_api, inst+3, unloaded
// CHECK:STDOUT: %import_ref.8 = import_ref Main//extern_api, inst+21, unloaded
// CHECK:STDOUT: %import_ref.9 = import_ref Main//extern_api, inst+41, unloaded
// CHECK:STDOUT: %import_ref.10 = import_ref Main//extern_api, inst+44, unloaded
// CHECK:STDOUT: %import_ref.11 = import_ref Main//extern_api, inst+48, unloaded
// CHECK:STDOUT: %import_ref.8 = import_ref Main//extern_api, inst+22, unloaded
// CHECK:STDOUT: %import_ref.9 = import_ref Main//extern_api, inst+43, unloaded
// CHECK:STDOUT: %import_ref.10 = import_ref Main//extern_api, inst+46, unloaded
// CHECK:STDOUT: %import_ref.11 = import_ref Main//extern_api, inst+50, unloaded
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
// CHECK:STDOUT: .Int32 = %import_ref.12
// CHECK:STDOUT: import Core//prelude
@@ -1024,19 +1032,19 @@ import library "extern_api";
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
// CHECK:STDOUT: %import_ref.1: %A.type = import_ref Main//extern_api, inst+3, loaded [template = constants.%A]
// CHECK:STDOUT: %import_ref.2: %B.type = import_ref Main//extern_api, inst+21, loaded [template = constants.%B]
// CHECK:STDOUT: %import_ref.3: %C.type = import_ref Main//extern_api, inst+41, loaded [template = constants.%C]
// CHECK:STDOUT: %import_ref.4: %D.type = import_ref Main//extern_api, inst+44, loaded [template = constants.%D]
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref Main//extern_api, inst+47, loaded
// CHECK:STDOUT: %import_ref.2: %B.type = import_ref Main//extern_api, inst+22, loaded [template = constants.%B]
// CHECK:STDOUT: %import_ref.3: %C.type = import_ref Main//extern_api, inst+43, loaded [template = constants.%C]
// CHECK:STDOUT: %import_ref.4: %D.type = import_ref Main//extern_api, inst+46, loaded [template = constants.%D]
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref Main//extern_api, inst+49, loaded
// CHECK:STDOUT: %NS: <namespace> = namespace %import_ref.5, [template] {
// CHECK:STDOUT: .E = %import_ref.6
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.6: %E.type = import_ref Main//extern_api, inst+48, loaded [template = constants.%E]
// CHECK:STDOUT: %import_ref.6: %E.type = import_ref Main//extern_api, inst+50, loaded [template = constants.%E]
// CHECK:STDOUT: %import_ref.7 = import_ref Main//api, inst+3, unloaded
// CHECK:STDOUT: %import_ref.8 = import_ref Main//api, inst+21, unloaded
// CHECK:STDOUT: %import_ref.9 = import_ref Main//api, inst+41, unloaded
// CHECK:STDOUT: %import_ref.10 = import_ref Main//api, inst+44, unloaded
// CHECK:STDOUT: %import_ref.11 = import_ref Main//api, inst+48, unloaded
// CHECK:STDOUT: %import_ref.8 = import_ref Main//api, inst+22, unloaded
// CHECK:STDOUT: %import_ref.9 = import_ref Main//api, inst+43, unloaded
// CHECK:STDOUT: %import_ref.10 = import_ref Main//api, inst+46, unloaded
// CHECK:STDOUT: %import_ref.11 = import_ref Main//api, inst+50, unloaded
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
// CHECK:STDOUT: .Int32 = %import_ref.12
// CHECK:STDOUT: import Core//prelude
@@ -1134,14 +1142,14 @@ import library "extern_api";
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
// CHECK:STDOUT: %import_ref.1 = import_ref Main//api, inst+3, unloaded
// CHECK:STDOUT: %import_ref.2 = import_ref Main//api, inst+21, unloaded
// CHECK:STDOUT: %import_ref.3 = import_ref Main//api, inst+41, unloaded
// CHECK:STDOUT: %import_ref.4 = import_ref Main//api, inst+44, unloaded
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref Main//api, inst+47, loaded
// CHECK:STDOUT: %import_ref.2 = import_ref Main//api, inst+22, unloaded
// CHECK:STDOUT: %import_ref.3 = import_ref Main//api, inst+43, unloaded
// CHECK:STDOUT: %import_ref.4 = import_ref Main//api, inst+46, unloaded
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref Main//api, inst+49, loaded
// CHECK:STDOUT: %NS: <namespace> = namespace %import_ref.5, [template] {
// CHECK:STDOUT: .E = %import_ref.6
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.6 = import_ref Main//api, inst+48, unloaded
// CHECK:STDOUT: %import_ref.6 = import_ref Main//api, inst+50, unloaded
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
// CHECK:STDOUT: import Core//prelude
// CHECK:STDOUT: import Core//prelude/operators
@@ -1171,14 +1179,14 @@ import library "extern_api";
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
// CHECK:STDOUT: %import_ref.1 = import_ref Main//extern_api, inst+3, unloaded
// CHECK:STDOUT: %import_ref.2 = import_ref Main//extern_api, inst+21, unloaded
// CHECK:STDOUT: %import_ref.3 = import_ref Main//extern_api, inst+41, unloaded
// CHECK:STDOUT: %import_ref.4 = import_ref Main//extern_api, inst+44, unloaded
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref Main//extern_api, inst+47, loaded
// CHECK:STDOUT: %import_ref.2 = import_ref Main//extern_api, inst+22, unloaded
// CHECK:STDOUT: %import_ref.3 = import_ref Main//extern_api, inst+43, unloaded
// CHECK:STDOUT: %import_ref.4 = import_ref Main//extern_api, inst+46, unloaded
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref Main//extern_api, inst+49, loaded
// CHECK:STDOUT: %NS: <namespace> = namespace %import_ref.5, [template] {
// CHECK:STDOUT: .E = %import_ref.6
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.6 = import_ref Main//extern_api, inst+48, unloaded
// CHECK:STDOUT: %import_ref.6 = import_ref Main//extern_api, inst+50, unloaded
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
// CHECK:STDOUT: import Core//prelude
// CHECK:STDOUT: import Core//prelude/operators