Switch type literals to use builtin functions. (#3978)

Modifies the core package and literal handling to use factory functions
for standard type literals.

Updates function/builtin/import.carbon to stop depending on the prelude,
since it would list all the impls in the core file. Updates
alias/builtins.carbon to be failing (the type values cannot be aliased).
This commit is contained in:
Jon Ross-Perkins
2024-05-23 16:00:08 +00:00
committed by GitHub
parent 5c8fa6ad5c
commit 55300d1ebb
314 changed files with 12506 additions and 4323 deletions
@@ -12,9 +12,11 @@ fn F(n: i32, a: [i32; n]*);
// CHECK:STDOUT: --- fail_param_in_type.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %F: type = fn_type @F [template]
// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct: F = struct_value () [template]
// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template]
// CHECK:STDOUT: %F: type = fn_type @F [template]
// CHECK:STDOUT: %struct.2: F = struct_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -23,15 +25,23 @@ fn F(n: i32, a: [i32; n]*);
// CHECK:STDOUT: .F = %F.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {
// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1]
// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1]
// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] {
// CHECK:STDOUT: %int.make_type_32.loc10_9: init type = call constants.%struct.1() [template = i32]
// CHECK:STDOUT: %.loc10_9.1: type = value_of_initializer %int.make_type_32.loc10_9 [template = i32]
// CHECK:STDOUT: %.loc10_9.2: type = converted %int.make_type_32.loc10_9, %.loc10_9.1 [template = i32]
// CHECK:STDOUT: %n.loc10_6.1: i32 = param n
// CHECK:STDOUT: @F.%n: i32 = bind_name n, %n.loc10_6.1
// CHECK:STDOUT: %int.make_type_32.loc10_18: init type = call constants.%struct.1() [template = i32]
// CHECK:STDOUT: %n.ref: i32 = name_ref n, @F.%n
// CHECK:STDOUT: %.loc10: type = ptr_type <error> [template = <error>]
// CHECK:STDOUT: %.loc10_25: type = ptr_type <error> [template = <error>]
// CHECK:STDOUT: %a.loc10_14.1: <error> = param a
// CHECK:STDOUT: @F.%a: <error> = bind_name a, %a.loc10_14.1
// CHECK:STDOUT: }
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F(%n: i32, %a: <error>);
// CHECK:STDOUT:
@@ -15,9 +15,11 @@ fn F(n: i32, n: i32);
// CHECK:STDOUT: --- fail_param_redecl.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %F: type = fn_type @F [template]
// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct: F = struct_value () [template]
// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template]
// CHECK:STDOUT: %F: type = fn_type @F [template]
// CHECK:STDOUT: %struct.2: F = struct_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -26,13 +28,23 @@ fn F(n: i32, n: i32);
// CHECK:STDOUT: .F = %F.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {
// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1]
// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1]
// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] {
// CHECK:STDOUT: %int.make_type_32.loc13_9: init type = call constants.%struct.1() [template = i32]
// CHECK:STDOUT: %.loc13_9.1: type = value_of_initializer %int.make_type_32.loc13_9 [template = i32]
// CHECK:STDOUT: %.loc13_9.2: type = converted %int.make_type_32.loc13_9, %.loc13_9.1 [template = i32]
// CHECK:STDOUT: %n.loc13_6.1: i32 = param n
// CHECK:STDOUT: @F.%n.loc13_6: i32 = bind_name n, %n.loc13_6.1
// CHECK:STDOUT: %int.make_type_32.loc13_17: init type = call constants.%struct.1() [template = i32]
// CHECK:STDOUT: %.loc13_17.1: type = value_of_initializer %int.make_type_32.loc13_17 [template = i32]
// CHECK:STDOUT: %.loc13_17.2: type = converted %int.make_type_32.loc13_17, %.loc13_17.1 [template = i32]
// CHECK:STDOUT: %n.loc13_14.1: i32 = param n
// CHECK:STDOUT: @F.%n.loc13_14: i32 = bind_name n, %n.loc13_14.1
// CHECK:STDOUT: }
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F(%n.loc13_6: i32, %n.loc13_14: i32);
// CHECK:STDOUT:
+286 -146
View File
@@ -369,17 +369,19 @@ import library "extern_api";
// CHECK:STDOUT: %A: type = fn_type @A [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct.1: A = struct_value () [template]
// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template]
// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template]
// CHECK:STDOUT: %B: type = fn_type @B [template]
// CHECK:STDOUT: %struct.2: B = struct_value () [template]
// CHECK:STDOUT: %struct.3: B = struct_value () [template]
// CHECK:STDOUT: %.2: type = tuple_type (type) [template]
// CHECK:STDOUT: %.3: type = tuple_type (i32) [template]
// CHECK:STDOUT: %.4: type = struct_type {.c: i32} [template]
// CHECK:STDOUT: %C: type = fn_type @C [template]
// CHECK:STDOUT: %struct.3: C = struct_value () [template]
// CHECK:STDOUT: %struct.4: C = struct_value () [template]
// CHECK:STDOUT: %D: type = fn_type @D [template]
// CHECK:STDOUT: %struct.4: D = struct_value () [template]
// CHECK:STDOUT: %struct.5: D = struct_value () [template]
// CHECK:STDOUT: %E: type = fn_type @E [template]
// CHECK:STDOUT: %struct.5: E = struct_value () [template]
// CHECK:STDOUT: %struct.6: E = struct_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -393,28 +395,46 @@ import library "extern_api";
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.1] {}
// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.2] {
// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2]
// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2]
// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.3] {
// CHECK:STDOUT: %int.make_type_32.loc5_9: init type = call constants.%struct.2() [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
// CHECK:STDOUT: @B.%b: i32 = bind_name b, %b.loc5_6.1
// CHECK:STDOUT: %int.make_type_32.loc5_17: init type = call constants.%struct.2() [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: }
// CHECK:STDOUT: %C.decl: C = fn_decl @C [template = constants.%struct.3] {
// CHECK:STDOUT: %.loc6_14.1: (type,) = tuple_literal (i32)
// CHECK:STDOUT: %.loc6_14.2: type = converted %.loc6_14.1, constants.%.3 [template = constants.%.3]
// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2]
// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2]
// CHECK:STDOUT: %C.decl: C = fn_decl @C [template = constants.%struct.4] {
// CHECK:STDOUT: %int.make_type_32.loc6_10: init type = call constants.%struct.2() [template = i32]
// CHECK:STDOUT: %.loc6_14.1: (type,) = 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: (i32,) = param c
// CHECK:STDOUT: @C.%c: (i32,) = bind_name c, %c.loc6_6.1
// CHECK:STDOUT: %int.make_type_32.loc6_25: init type = call constants.%struct.2() [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 {.c: i32} = var <return slot>
// CHECK:STDOUT: }
// CHECK:STDOUT: %D.decl: D = fn_decl @D [template = constants.%struct.4] {}
// CHECK:STDOUT: %D.decl: D = fn_decl @D [template = constants.%struct.5] {}
// CHECK:STDOUT: %NS: <namespace> = namespace [template] {
// CHECK:STDOUT: .E = %E.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %E.decl: E = fn_decl @E [template = constants.%struct.5] {}
// CHECK:STDOUT: %E.decl: E = fn_decl @E [template = constants.%struct.6] {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @A();
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @B(%b: i32) -> i32;
// CHECK:STDOUT:
// CHECK:STDOUT: fn @C(%c: (i32,)) -> {.c: i32};
@@ -429,17 +449,19 @@ import library "extern_api";
// CHECK:STDOUT: %A: type = fn_type @A [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct.1: A = struct_value () [template]
// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template]
// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template]
// CHECK:STDOUT: %B: type = fn_type @B [template]
// CHECK:STDOUT: %struct.2: B = struct_value () [template]
// CHECK:STDOUT: %struct.3: B = struct_value () [template]
// CHECK:STDOUT: %.2: type = tuple_type (type) [template]
// CHECK:STDOUT: %.3: type = tuple_type (i32) [template]
// CHECK:STDOUT: %.4: type = struct_type {.c: i32} [template]
// CHECK:STDOUT: %C: type = fn_type @C [template]
// CHECK:STDOUT: %struct.3: C = struct_value () [template]
// CHECK:STDOUT: %struct.4: C = struct_value () [template]
// CHECK:STDOUT: %D: type = fn_type @D [template]
// CHECK:STDOUT: %struct.4: D = struct_value () [template]
// CHECK:STDOUT: %struct.5: D = struct_value () [template]
// CHECK:STDOUT: %E: type = fn_type @E [template]
// CHECK:STDOUT: %struct.5: E = struct_value () [template]
// CHECK:STDOUT: %struct.6: E = struct_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -453,28 +475,46 @@ import library "extern_api";
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.1] {}
// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.2] {
// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2]
// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2]
// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.3] {
// CHECK:STDOUT: %int.make_type_32.loc5_16: init type = call constants.%struct.2() [template = i32]
// CHECK:STDOUT: %.loc5_16.1: type = value_of_initializer %int.make_type_32.loc5_16 [template = i32]
// CHECK:STDOUT: %.loc5_16.2: type = converted %int.make_type_32.loc5_16, %.loc5_16.1 [template = i32]
// CHECK:STDOUT: %b.loc5_13.1: i32 = param b
// CHECK:STDOUT: @B.%b: i32 = bind_name b, %b.loc5_13.1
// CHECK:STDOUT: %int.make_type_32.loc5_24: init type = call constants.%struct.2() [template = i32]
// CHECK:STDOUT: %.loc5_24.1: type = value_of_initializer %int.make_type_32.loc5_24 [template = i32]
// CHECK:STDOUT: %.loc5_24.2: type = converted %int.make_type_32.loc5_24, %.loc5_24.1 [template = i32]
// CHECK:STDOUT: @B.%return: ref i32 = var <return slot>
// CHECK:STDOUT: }
// CHECK:STDOUT: %C.decl: C = fn_decl @C [template = constants.%struct.3] {
// CHECK:STDOUT: %.loc6_21.1: (type,) = tuple_literal (i32)
// CHECK:STDOUT: %.loc6_21.2: type = converted %.loc6_21.1, constants.%.3 [template = constants.%.3]
// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2]
// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2]
// CHECK:STDOUT: %C.decl: C = fn_decl @C [template = constants.%struct.4] {
// CHECK:STDOUT: %int.make_type_32.loc6_17: init type = call constants.%struct.2() [template = i32]
// CHECK:STDOUT: %.loc6_21.1: (type,) = tuple_literal (%int.make_type_32.loc6_17)
// CHECK:STDOUT: %.loc6_21.2: type = value_of_initializer %int.make_type_32.loc6_17 [template = i32]
// CHECK:STDOUT: %.loc6_21.3: type = converted %int.make_type_32.loc6_17, %.loc6_21.2 [template = i32]
// CHECK:STDOUT: %.loc6_21.4: type = converted %.loc6_21.1, constants.%.3 [template = constants.%.3]
// CHECK:STDOUT: %c.loc6_13.1: (i32,) = param c
// CHECK:STDOUT: @C.%c: (i32,) = bind_name c, %c.loc6_13.1
// CHECK:STDOUT: %int.make_type_32.loc6_32: init type = call constants.%struct.2() [template = i32]
// CHECK:STDOUT: %.loc6_32.1: type = value_of_initializer %int.make_type_32.loc6_32 [template = i32]
// CHECK:STDOUT: %.loc6_32.2: type = converted %int.make_type_32.loc6_32, %.loc6_32.1 [template = i32]
// CHECK:STDOUT: %.loc6_35: type = struct_type {.c: i32} [template = constants.%.4]
// CHECK:STDOUT: @C.%return: ref {.c: i32} = var <return slot>
// CHECK:STDOUT: }
// CHECK:STDOUT: %D.decl: D = fn_decl @D [template = constants.%struct.4] {}
// CHECK:STDOUT: %D.decl: D = fn_decl @D [template = constants.%struct.5] {}
// CHECK:STDOUT: %NS: <namespace> = namespace [template] {
// CHECK:STDOUT: .E = %E.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %E.decl: E = fn_decl @E [template = constants.%struct.5] {}
// CHECK:STDOUT: %E.decl: E = fn_decl @E [template = constants.%struct.6] {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: extern fn @A();
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
// CHECK:STDOUT: extern fn @B(%b: i32) -> i32;
// CHECK:STDOUT:
// CHECK:STDOUT: extern fn @C(%c: (i32,)) -> {.c: i32};
@@ -489,18 +529,20 @@ import library "extern_api";
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %A: type = fn_type @A [template]
// CHECK:STDOUT: %struct.1: A = struct_value () [template]
// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template]
// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template]
// CHECK:STDOUT: %B: type = fn_type @B [template]
// CHECK:STDOUT: %struct.2: B = struct_value () [template]
// CHECK:STDOUT: %struct.3: B = struct_value () [template]
// CHECK:STDOUT: %.2: i32 = int_literal 1 [template]
// CHECK:STDOUT: %.3: type = struct_type {.c: i32} [template]
// CHECK:STDOUT: %.4: type = tuple_type (i32) [template]
// CHECK:STDOUT: %C: type = fn_type @C [template]
// CHECK:STDOUT: %struct.3: C = struct_value () [template]
// CHECK:STDOUT: %struct.4: C = struct_value () [template]
// CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.2) [template]
// CHECK:STDOUT: %D: type = fn_type @D [template]
// CHECK:STDOUT: %struct.4: D = struct_value () [template]
// CHECK:STDOUT: %struct.5: D = struct_value () [template]
// CHECK:STDOUT: %E: type = fn_type @E [template]
// CHECK:STDOUT: %struct.5: E = struct_value () [template]
// CHECK:STDOUT: %struct.6: E = struct_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -518,22 +560,30 @@ import library "extern_api";
// CHECK:STDOUT: .e = %e
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.1: A = import_ref ir1, inst+2, loaded [template = constants.%struct.1]
// CHECK:STDOUT: %import_ref.2: B = import_ref ir1, inst+9, loaded [template = constants.%struct.2]
// CHECK:STDOUT: %import_ref.3: C = import_ref ir1, inst+23, loaded [template = constants.%struct.3]
// CHECK:STDOUT: %import_ref.4: D = import_ref ir1, inst+26, loaded [template = constants.%struct.4]
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref ir1, inst+29, loaded
// CHECK:STDOUT: %import_ref.2: B = import_ref ir1, inst+21, loaded [template = constants.%struct.3]
// CHECK:STDOUT: %import_ref.3: C = import_ref ir1, inst+43, loaded [template = constants.%struct.4]
// CHECK:STDOUT: %import_ref.4: D = import_ref ir1, inst+46, loaded [template = constants.%struct.5]
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref ir1, 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 = import_ref ir1, inst+30, loaded [template = constants.%struct.5]
// CHECK:STDOUT: %import_ref.6: E = import_ref ir1, inst+50, loaded [template = constants.%struct.6]
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %.loc6_9.1: () = tuple_literal ()
// CHECK:STDOUT: %.loc6_9.2: type = converted %.loc6_9.1, constants.%.1 [template = constants.%.1]
// CHECK:STDOUT: %a.var: ref () = var a
// CHECK:STDOUT: %a: ref () = bind_name a, %a.var
// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.2]
// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct.2() [template = i32]
// CHECK:STDOUT: %.loc7_8.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32]
// CHECK:STDOUT: %.loc7_8.2: type = converted %int.make_type_32.loc7, %.loc7_8.1 [template = i32]
// CHECK:STDOUT: %b.var: ref i32 = var b
// CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var
// CHECK:STDOUT: %.loc8: type = struct_type {.c: i32} [template = constants.%.3]
// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.2]
// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.2() [template = i32]
// CHECK:STDOUT: %.loc8_13.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32]
// CHECK:STDOUT: %.loc8_13.2: type = converted %int.make_type_32.loc8, %.loc8_13.1 [template = i32]
// CHECK:STDOUT: %.loc8_16: type = struct_type {.c: i32} [template = constants.%.3]
// CHECK:STDOUT: %c.var: ref {.c: i32} = var c
// CHECK:STDOUT: %c: ref {.c: i32} = bind_name c, %c.var
// CHECK:STDOUT: %.loc9_9.1: () = tuple_literal ()
@@ -548,6 +598,8 @@ import library "extern_api";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @A();
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @B(%b: i32) -> i32;
// CHECK:STDOUT:
// CHECK:STDOUT: fn @C(%c: (i32,)) -> {.c: i32};
@@ -561,22 +613,22 @@ import library "extern_api";
// CHECK:STDOUT: %A.ref: A = name_ref A, file.%import_ref.1 [template = constants.%struct.1]
// CHECK:STDOUT: %A.call: init () = call %A.ref()
// CHECK:STDOUT: assign file.%a.var, %A.call
// CHECK:STDOUT: %B.ref: B = name_ref B, file.%import_ref.2 [template = constants.%struct.2]
// CHECK:STDOUT: %B.ref: B = name_ref B, file.%import_ref.2 [template = constants.%struct.3]
// CHECK:STDOUT: %.loc7: i32 = int_literal 1 [template = constants.%.2]
// CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc7)
// CHECK:STDOUT: assign file.%b.var, %B.call
// CHECK:STDOUT: %C.ref: C = name_ref C, file.%import_ref.3 [template = constants.%struct.3]
// CHECK:STDOUT: %C.ref: C = name_ref C, file.%import_ref.3 [template = constants.%struct.4]
// CHECK:STDOUT: %.loc8_23: i32 = int_literal 1 [template = constants.%.2]
// CHECK:STDOUT: %.loc8_25: (i32,) = tuple_literal (%.loc8_23)
// CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.loc8_23) [template = constants.%tuple]
// CHECK:STDOUT: %.loc8_21: (i32,) = converted %.loc8_25, %tuple [template = constants.%tuple]
// CHECK:STDOUT: %C.call: init {.c: i32} = call %C.ref(%.loc8_21)
// CHECK:STDOUT: assign file.%c.var, %C.call
// CHECK:STDOUT: %D.ref: D = name_ref D, file.%import_ref.4 [template = constants.%struct.4]
// CHECK:STDOUT: %D.ref: D = name_ref D, file.%import_ref.4 [template = constants.%struct.5]
// CHECK:STDOUT: %D.call: init () = call %D.ref()
// CHECK:STDOUT: assign file.%d.var, %D.call
// CHECK:STDOUT: %NS.ref: <namespace> = name_ref NS, file.%NS [template = file.%NS]
// CHECK:STDOUT: %E.ref: E = name_ref E, file.%import_ref.6 [template = constants.%struct.5]
// CHECK:STDOUT: %E.ref: E = name_ref E, file.%import_ref.6 [template = constants.%struct.6]
// CHECK:STDOUT: %E.call: init () = call %E.ref()
// CHECK:STDOUT: assign file.%e.var, %E.call
// CHECK:STDOUT: return
@@ -588,17 +640,19 @@ import library "extern_api";
// CHECK:STDOUT: %A: type = fn_type @A [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct.1: A = struct_value () [template]
// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template]
// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template]
// CHECK:STDOUT: %B: type = fn_type @B [template]
// CHECK:STDOUT: %struct.2: B = struct_value () [template]
// CHECK:STDOUT: %struct.3: B = struct_value () [template]
// CHECK:STDOUT: %.2: type = tuple_type (type) [template]
// CHECK:STDOUT: %.3: type = tuple_type (i32) [template]
// CHECK:STDOUT: %.4: type = struct_type {.c: i32} [template]
// CHECK:STDOUT: %C: type = fn_type @C [template]
// CHECK:STDOUT: %struct.3: C = struct_value () [template]
// CHECK:STDOUT: %struct.4: C = struct_value () [template]
// CHECK:STDOUT: %D: type = fn_type @D [template]
// CHECK:STDOUT: %struct.4: D = struct_value () [template]
// CHECK:STDOUT: %struct.5: D = struct_value () [template]
// CHECK:STDOUT: %E: type = fn_type @E [template]
// CHECK:STDOUT: %struct.5: E = struct_value () [template]
// CHECK:STDOUT: %struct.6: E = struct_value () [template]
// CHECK:STDOUT: %.5: i32 = int_literal 1 [template]
// CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.5) [template]
// CHECK:STDOUT: }
@@ -618,38 +672,62 @@ import library "extern_api";
// CHECK:STDOUT: .e = %e
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.1: A = import_ref ir1, inst+2, loaded [template = constants.%struct.1]
// CHECK:STDOUT: %import_ref.2: B = import_ref ir1, inst+9, loaded [template = constants.%struct.2]
// CHECK:STDOUT: %import_ref.3: C = import_ref ir1, inst+23, loaded [template = constants.%struct.3]
// CHECK:STDOUT: %import_ref.4: D = import_ref ir1, inst+26, loaded [template = constants.%struct.4]
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref ir1, inst+29, loaded
// CHECK:STDOUT: %import_ref.2: B = import_ref ir1, inst+21, loaded [template = constants.%struct.3]
// CHECK:STDOUT: %import_ref.3: C = import_ref ir1, inst+43, loaded [template = constants.%struct.4]
// CHECK:STDOUT: %import_ref.4: D = import_ref ir1, inst+46, loaded [template = constants.%struct.5]
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref ir1, inst+49, loaded
// CHECK:STDOUT: %NS: <namespace> = namespace %import_ref.5, [template] {
// CHECK:STDOUT: .E = %E.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.6: E = import_ref ir1, inst+30, loaded [template = constants.%struct.5]
// CHECK:STDOUT: %import_ref.6: E = import_ref ir1, inst+50, loaded [template = constants.%struct.6]
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.1] {}
// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.2] {
// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.2]
// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.2]
// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.3] {
// CHECK:STDOUT: %int.make_type_32.loc7_16: init type = call constants.%struct.2() [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
// CHECK:STDOUT: %b.loc7_13.2: i32 = bind_name b, %b.loc7_13.1
// CHECK:STDOUT: %int.make_type_32.loc7_24: init type = call constants.%struct.2() [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: }
// CHECK:STDOUT: %C.decl: C = fn_decl @C [template = constants.%struct.3] {
// CHECK:STDOUT: %.loc8_21.1: (type,) = tuple_literal (i32)
// CHECK:STDOUT: %.loc8_21.2: type = converted %.loc8_21.1, constants.%.3 [template = constants.%.3]
// CHECK:STDOUT: %import_ref.9: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.2]
// CHECK:STDOUT: %import_ref.10: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.2]
// CHECK:STDOUT: %C.decl: C = fn_decl @C [template = constants.%struct.4] {
// CHECK:STDOUT: %int.make_type_32.loc8_17: init type = call constants.%struct.2() [template = i32]
// CHECK:STDOUT: %.loc8_21.1: (type,) = 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: (i32,) = param c
// CHECK:STDOUT: %c.loc8_13.2: (i32,) = bind_name c, %c.loc8_13.1
// CHECK:STDOUT: %int.make_type_32.loc8_32: init type = call constants.%struct.2() [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 {.c: i32} = var <return slot>
// CHECK:STDOUT: }
// CHECK:STDOUT: %D.decl: D = fn_decl @D [template = constants.%struct.4] {}
// CHECK:STDOUT: %E.decl: E = fn_decl @E [template = constants.%struct.5] {}
// CHECK:STDOUT: %D.decl: D = fn_decl @D [template = constants.%struct.5] {}
// CHECK:STDOUT: %E.decl: E = fn_decl @E [template = constants.%struct.6] {}
// CHECK:STDOUT: %.loc12_9.1: () = tuple_literal ()
// CHECK:STDOUT: %.loc12_9.2: type = converted %.loc12_9.1, constants.%.1 [template = constants.%.1]
// CHECK:STDOUT: %a.var: ref () = var a
// CHECK:STDOUT: %a: ref () = bind_name a, %a.var
// CHECK:STDOUT: %import_ref.11: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.2]
// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.2() [template = i32]
// 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: %.loc14: type = struct_type {.c: i32} [template = constants.%.4]
// CHECK:STDOUT: %import_ref.12: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.2]
// CHECK:STDOUT: %int.make_type_32.loc14: init type = call constants.%struct.2() [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 {.c: i32} = var c
// CHECK:STDOUT: %c.loc14: ref {.c: i32} = bind_name c, %c.var
// CHECK:STDOUT: %.loc15_9.1: () = tuple_literal ()
@@ -664,6 +742,8 @@ import library "extern_api";
// CHECK:STDOUT:
// CHECK:STDOUT: extern fn @A();
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
// CHECK:STDOUT: extern fn @B(%b: i32) -> i32;
// CHECK:STDOUT:
// CHECK:STDOUT: extern fn @C(%c: (i32,)) -> {.c: i32};
@@ -677,22 +757,22 @@ import library "extern_api";
// CHECK:STDOUT: %A.ref: A = name_ref A, file.%A.decl [template = constants.%struct.1]
// CHECK:STDOUT: %A.call: init () = call %A.ref()
// CHECK:STDOUT: assign file.%a.var, %A.call
// CHECK:STDOUT: %B.ref: B = name_ref B, file.%B.decl [template = constants.%struct.2]
// CHECK:STDOUT: %B.ref: B = name_ref B, file.%B.decl [template = constants.%struct.3]
// CHECK:STDOUT: %.loc13: i32 = int_literal 1 [template = constants.%.5]
// CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc13)
// CHECK:STDOUT: assign file.%b.var, %B.call
// CHECK:STDOUT: %C.ref: C = name_ref C, file.%C.decl [template = constants.%struct.3]
// CHECK:STDOUT: %C.ref: C = name_ref C, file.%C.decl [template = constants.%struct.4]
// CHECK:STDOUT: %.loc14_23: i32 = int_literal 1 [template = constants.%.5]
// CHECK:STDOUT: %.loc14_25: (i32,) = tuple_literal (%.loc14_23)
// CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.loc14_23) [template = constants.%tuple]
// CHECK:STDOUT: %.loc14_21: (i32,) = converted %.loc14_25, %tuple [template = constants.%tuple]
// CHECK:STDOUT: %C.call: init {.c: i32} = call %C.ref(%.loc14_21)
// CHECK:STDOUT: assign file.%c.var, %C.call
// CHECK:STDOUT: %D.ref: D = name_ref D, file.%D.decl [template = constants.%struct.4]
// CHECK:STDOUT: %D.ref: D = name_ref D, file.%D.decl [template = constants.%struct.5]
// CHECK:STDOUT: %D.call: init () = call %D.ref()
// CHECK:STDOUT: assign file.%d.var, %D.call
// CHECK:STDOUT: %NS.ref: <namespace> = name_ref NS, file.%NS [template = file.%NS]
// CHECK:STDOUT: %E.ref: E = name_ref E, file.%E.decl [template = constants.%struct.5]
// CHECK:STDOUT: %E.ref: E = name_ref E, file.%E.decl [template = constants.%struct.6]
// CHECK:STDOUT: %E.call: init () = call %E.ref()
// CHECK:STDOUT: assign file.%e.var, %E.call
// CHECK:STDOUT: return
@@ -704,17 +784,19 @@ import library "extern_api";
// CHECK:STDOUT: %A: type = fn_type @A [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct.1: A = struct_value () [template]
// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template]
// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template]
// CHECK:STDOUT: %B: type = fn_type @B [template]
// CHECK:STDOUT: %struct.2: B = struct_value () [template]
// CHECK:STDOUT: %struct.3: B = struct_value () [template]
// CHECK:STDOUT: %.2: type = tuple_type (type) [template]
// CHECK:STDOUT: %.3: type = tuple_type (i32) [template]
// CHECK:STDOUT: %.4: type = struct_type {.c: i32} [template]
// CHECK:STDOUT: %C: type = fn_type @C [template]
// CHECK:STDOUT: %struct.3: C = struct_value () [template]
// CHECK:STDOUT: %struct.4: C = struct_value () [template]
// CHECK:STDOUT: %D: type = fn_type @D [template]
// CHECK:STDOUT: %struct.4: D = struct_value () [template]
// CHECK:STDOUT: %struct.5: D = struct_value () [template]
// CHECK:STDOUT: %E: type = fn_type @E [template]
// CHECK:STDOUT: %struct.5: E = struct_value () [template]
// CHECK:STDOUT: %struct.6: E = struct_value () [template]
// CHECK:STDOUT: %.5: i32 = int_literal 1 [template]
// CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.5) [template]
// CHECK:STDOUT: }
@@ -734,38 +816,62 @@ import library "extern_api";
// CHECK:STDOUT: .e = %e
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.1: A = import_ref ir1, inst+2, loaded [template = constants.%struct.1]
// CHECK:STDOUT: %import_ref.2: B = import_ref ir1, inst+9, loaded [template = constants.%struct.2]
// CHECK:STDOUT: %import_ref.3: C = import_ref ir1, inst+23, loaded [template = constants.%struct.3]
// CHECK:STDOUT: %import_ref.4: D = import_ref ir1, inst+26, loaded [template = constants.%struct.4]
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref ir1, inst+29, loaded
// CHECK:STDOUT: %import_ref.2: B = import_ref ir1, inst+21, loaded [template = constants.%struct.3]
// CHECK:STDOUT: %import_ref.3: C = import_ref ir1, inst+43, loaded [template = constants.%struct.4]
// CHECK:STDOUT: %import_ref.4: D = import_ref ir1, inst+46, loaded [template = constants.%struct.5]
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref ir1, inst+49, loaded
// CHECK:STDOUT: %NS: <namespace> = namespace %import_ref.5, [template] {
// CHECK:STDOUT: .E = %E.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.6: E = import_ref ir1, inst+30, loaded [template = constants.%struct.5]
// CHECK:STDOUT: %import_ref.6: E = import_ref ir1, inst+50, loaded [template = constants.%struct.6]
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.1] {}
// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.2] {
// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.2]
// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.2]
// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.3] {
// CHECK:STDOUT: %int.make_type_32.loc7_16: init type = call constants.%struct.2() [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
// CHECK:STDOUT: %b.loc7_13.2: i32 = bind_name b, %b.loc7_13.1
// CHECK:STDOUT: %int.make_type_32.loc7_24: init type = call constants.%struct.2() [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: }
// CHECK:STDOUT: %C.decl: C = fn_decl @C [template = constants.%struct.3] {
// CHECK:STDOUT: %.loc8_21.1: (type,) = tuple_literal (i32)
// CHECK:STDOUT: %.loc8_21.2: type = converted %.loc8_21.1, constants.%.3 [template = constants.%.3]
// CHECK:STDOUT: %import_ref.9: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.2]
// CHECK:STDOUT: %import_ref.10: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.2]
// CHECK:STDOUT: %C.decl: C = fn_decl @C [template = constants.%struct.4] {
// CHECK:STDOUT: %int.make_type_32.loc8_17: init type = call constants.%struct.2() [template = i32]
// CHECK:STDOUT: %.loc8_21.1: (type,) = 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: (i32,) = param c
// CHECK:STDOUT: %c.loc8_13.2: (i32,) = bind_name c, %c.loc8_13.1
// CHECK:STDOUT: %int.make_type_32.loc8_32: init type = call constants.%struct.2() [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 {.c: i32} = var <return slot>
// CHECK:STDOUT: }
// CHECK:STDOUT: %D.decl: D = fn_decl @D [template = constants.%struct.4] {}
// CHECK:STDOUT: %E.decl: E = fn_decl @E [template = constants.%struct.5] {}
// CHECK:STDOUT: %D.decl: D = fn_decl @D [template = constants.%struct.5] {}
// CHECK:STDOUT: %E.decl: E = fn_decl @E [template = constants.%struct.6] {}
// CHECK:STDOUT: %.loc12_9.1: () = tuple_literal ()
// CHECK:STDOUT: %.loc12_9.2: type = converted %.loc12_9.1, constants.%.1 [template = constants.%.1]
// CHECK:STDOUT: %a.var: ref () = var a
// CHECK:STDOUT: %a: ref () = bind_name a, %a.var
// CHECK:STDOUT: %import_ref.11: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.2]
// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.2() [template = i32]
// 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: %.loc14: type = struct_type {.c: i32} [template = constants.%.4]
// CHECK:STDOUT: %import_ref.12: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.2]
// CHECK:STDOUT: %int.make_type_32.loc14: init type = call constants.%struct.2() [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 {.c: i32} = var c
// CHECK:STDOUT: %c.loc14: ref {.c: i32} = bind_name c, %c.var
// CHECK:STDOUT: %.loc15_9.1: () = tuple_literal ()
@@ -780,6 +886,8 @@ import library "extern_api";
// CHECK:STDOUT:
// CHECK:STDOUT: extern fn @A();
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
// CHECK:STDOUT: extern fn @B(%b: i32) -> i32;
// CHECK:STDOUT:
// CHECK:STDOUT: extern fn @C(%c: (i32,)) -> {.c: i32};
@@ -793,22 +901,22 @@ import library "extern_api";
// CHECK:STDOUT: %A.ref: A = name_ref A, file.%A.decl [template = constants.%struct.1]
// CHECK:STDOUT: %A.call: init () = call %A.ref()
// CHECK:STDOUT: assign file.%a.var, %A.call
// CHECK:STDOUT: %B.ref: B = name_ref B, file.%B.decl [template = constants.%struct.2]
// CHECK:STDOUT: %B.ref: B = name_ref B, file.%B.decl [template = constants.%struct.3]
// CHECK:STDOUT: %.loc13: i32 = int_literal 1 [template = constants.%.5]
// CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc13)
// CHECK:STDOUT: assign file.%b.var, %B.call
// CHECK:STDOUT: %C.ref: C = name_ref C, file.%C.decl [template = constants.%struct.3]
// CHECK:STDOUT: %C.ref: C = name_ref C, file.%C.decl [template = constants.%struct.4]
// CHECK:STDOUT: %.loc14_23: i32 = int_literal 1 [template = constants.%.5]
// CHECK:STDOUT: %.loc14_25: (i32,) = tuple_literal (%.loc14_23)
// CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.loc14_23) [template = constants.%tuple]
// CHECK:STDOUT: %.loc14_21: (i32,) = converted %.loc14_25, %tuple [template = constants.%tuple]
// CHECK:STDOUT: %C.call: init {.c: i32} = call %C.ref(%.loc14_21)
// CHECK:STDOUT: assign file.%c.var, %C.call
// CHECK:STDOUT: %D.ref: D = name_ref D, file.%D.decl [template = constants.%struct.4]
// CHECK:STDOUT: %D.ref: D = name_ref D, file.%D.decl [template = constants.%struct.5]
// CHECK:STDOUT: %D.call: init () = call %D.ref()
// CHECK:STDOUT: assign file.%d.var, %D.call
// CHECK:STDOUT: %NS.ref: <namespace> = name_ref NS, file.%NS [template = file.%NS]
// CHECK:STDOUT: %E.ref: E = name_ref E, file.%E.decl [template = constants.%struct.5]
// CHECK:STDOUT: %E.ref: E = name_ref E, file.%E.decl [template = constants.%struct.6]
// CHECK:STDOUT: %E.call: init () = call %E.ref()
// CHECK:STDOUT: assign file.%e.var, %E.call
// CHECK:STDOUT: return
@@ -820,18 +928,20 @@ import library "extern_api";
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %A: type = fn_type @A [template]
// CHECK:STDOUT: %struct.1: A = struct_value () [template]
// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template]
// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template]
// CHECK:STDOUT: %B: type = fn_type @B [template]
// CHECK:STDOUT: %struct.2: B = struct_value () [template]
// CHECK:STDOUT: %struct.3: B = struct_value () [template]
// CHECK:STDOUT: %.2: i32 = int_literal 1 [template]
// CHECK:STDOUT: %.3: type = struct_type {.c: i32} [template]
// CHECK:STDOUT: %.4: type = tuple_type (i32) [template]
// CHECK:STDOUT: %C: type = fn_type @C [template]
// CHECK:STDOUT: %struct.3: C = struct_value () [template]
// CHECK:STDOUT: %struct.4: C = struct_value () [template]
// CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.2) [template]
// CHECK:STDOUT: %D: type = fn_type @D [template]
// CHECK:STDOUT: %struct.4: D = struct_value () [template]
// CHECK:STDOUT: %struct.5: D = struct_value () [template]
// CHECK:STDOUT: %E: type = fn_type @E [template]
// CHECK:STDOUT: %struct.5: E = struct_value () [template]
// CHECK:STDOUT: %struct.6: E = struct_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -849,27 +959,35 @@ import library "extern_api";
// CHECK:STDOUT: .e = %e
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.1: A = import_ref ir1, inst+2, loaded [template = constants.%struct.1]
// CHECK:STDOUT: %import_ref.2: B = import_ref ir1, inst+9, loaded [template = constants.%struct.2]
// CHECK:STDOUT: %import_ref.3: C = import_ref ir1, inst+23, loaded [template = constants.%struct.3]
// CHECK:STDOUT: %import_ref.4: D = import_ref ir1, inst+26, loaded [template = constants.%struct.4]
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref ir1, inst+29, loaded
// CHECK:STDOUT: %import_ref.2: B = import_ref ir1, inst+21, loaded [template = constants.%struct.3]
// CHECK:STDOUT: %import_ref.3: C = import_ref ir1, inst+43, loaded [template = constants.%struct.4]
// CHECK:STDOUT: %import_ref.4: D = import_ref ir1, inst+46, loaded [template = constants.%struct.5]
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref ir1, 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 = import_ref ir1, inst+30, loaded [template = constants.%struct.5]
// CHECK:STDOUT: %import_ref.6: E = import_ref ir1, inst+50, loaded [template = constants.%struct.6]
// CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+2, unloaded
// CHECK:STDOUT: %import_ref.8 = import_ref ir2, inst+9, unloaded
// CHECK:STDOUT: %import_ref.9 = import_ref ir2, inst+23, unloaded
// CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+26, unloaded
// CHECK:STDOUT: %import_ref.11 = import_ref ir2, inst+30, unloaded
// CHECK:STDOUT: %import_ref.8 = import_ref ir2, inst+21, unloaded
// CHECK:STDOUT: %import_ref.9 = import_ref ir2, inst+43, unloaded
// CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+46, unloaded
// CHECK:STDOUT: %import_ref.11 = import_ref ir2, inst+50, unloaded
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %.loc72_9.1: () = tuple_literal ()
// CHECK:STDOUT: %.loc72_9.2: type = converted %.loc72_9.1, constants.%.1 [template = constants.%.1]
// CHECK:STDOUT: %a.var: ref () = var a
// CHECK:STDOUT: %a: ref () = bind_name a, %a.var
// CHECK:STDOUT: %import_ref.12: Int32 = import_ref ir5, inst+3, loaded [template = constants.%struct.2]
// CHECK:STDOUT: %int.make_type_32.loc73: init type = call constants.%struct.2() [template = i32]
// CHECK:STDOUT: %.loc73_8.1: type = value_of_initializer %int.make_type_32.loc73 [template = i32]
// CHECK:STDOUT: %.loc73_8.2: type = converted %int.make_type_32.loc73, %.loc73_8.1 [template = i32]
// CHECK:STDOUT: %b.var: ref i32 = var b
// CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var
// CHECK:STDOUT: %.loc74: type = struct_type {.c: i32} [template = constants.%.3]
// CHECK:STDOUT: %import_ref.13: Int32 = import_ref ir5, inst+3, loaded [template = constants.%struct.2]
// CHECK:STDOUT: %int.make_type_32.loc74: init type = call constants.%struct.2() [template = i32]
// CHECK:STDOUT: %.loc74_13.1: type = value_of_initializer %int.make_type_32.loc74 [template = i32]
// CHECK:STDOUT: %.loc74_13.2: type = converted %int.make_type_32.loc74, %.loc74_13.1 [template = i32]
// CHECK:STDOUT: %.loc74_16: type = struct_type {.c: i32} [template = constants.%.3]
// CHECK:STDOUT: %c.var: ref {.c: i32} = var c
// CHECK:STDOUT: %c: ref {.c: i32} = bind_name c, %c.var
// CHECK:STDOUT: %.loc75_9.1: () = tuple_literal ()
@@ -884,6 +1002,8 @@ import library "extern_api";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @A();
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @B(%b: i32) -> i32;
// CHECK:STDOUT:
// CHECK:STDOUT: fn @C(%c: (i32,)) -> {.c: i32};
@@ -897,22 +1017,22 @@ import library "extern_api";
// CHECK:STDOUT: %A.ref: A = name_ref A, file.%import_ref.1 [template = constants.%struct.1]
// CHECK:STDOUT: %A.call: init () = call %A.ref()
// CHECK:STDOUT: assign file.%a.var, %A.call
// CHECK:STDOUT: %B.ref: B = name_ref B, file.%import_ref.2 [template = constants.%struct.2]
// CHECK:STDOUT: %B.ref: B = name_ref B, file.%import_ref.2 [template = constants.%struct.3]
// CHECK:STDOUT: %.loc73: i32 = int_literal 1 [template = constants.%.2]
// CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc73)
// CHECK:STDOUT: assign file.%b.var, %B.call
// CHECK:STDOUT: %C.ref: C = name_ref C, file.%import_ref.3 [template = constants.%struct.3]
// CHECK:STDOUT: %C.ref: C = name_ref C, file.%import_ref.3 [template = constants.%struct.4]
// CHECK:STDOUT: %.loc74_23: i32 = int_literal 1 [template = constants.%.2]
// CHECK:STDOUT: %.loc74_25: (i32,) = tuple_literal (%.loc74_23)
// CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.loc74_23) [template = constants.%tuple]
// CHECK:STDOUT: %.loc74_21: (i32,) = converted %.loc74_25, %tuple [template = constants.%tuple]
// CHECK:STDOUT: %C.call: init {.c: i32} = call %C.ref(%.loc74_21)
// CHECK:STDOUT: assign file.%c.var, %C.call
// CHECK:STDOUT: %D.ref: D = name_ref D, file.%import_ref.4 [template = constants.%struct.4]
// CHECK:STDOUT: %D.ref: D = name_ref D, file.%import_ref.4 [template = constants.%struct.5]
// CHECK:STDOUT: %D.call: init () = call %D.ref()
// CHECK:STDOUT: assign file.%d.var, %D.call
// CHECK:STDOUT: %NS.ref: <namespace> = name_ref NS, file.%NS [template = file.%NS]
// CHECK:STDOUT: %E.ref: E = name_ref E, file.%import_ref.6 [template = constants.%struct.5]
// CHECK:STDOUT: %E.ref: E = name_ref E, file.%import_ref.6 [template = constants.%struct.6]
// CHECK:STDOUT: %E.call: init () = call %E.ref()
// CHECK:STDOUT: assign file.%e.var, %E.call
// CHECK:STDOUT: return
@@ -924,18 +1044,20 @@ import library "extern_api";
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %A: type = fn_type @A [template]
// CHECK:STDOUT: %struct.1: A = struct_value () [template]
// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template]
// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template]
// CHECK:STDOUT: %B: type = fn_type @B [template]
// CHECK:STDOUT: %struct.2: B = struct_value () [template]
// CHECK:STDOUT: %struct.3: B = struct_value () [template]
// CHECK:STDOUT: %.2: i32 = int_literal 1 [template]
// CHECK:STDOUT: %.3: type = struct_type {.c: i32} [template]
// CHECK:STDOUT: %.4: type = tuple_type (i32) [template]
// CHECK:STDOUT: %C: type = fn_type @C [template]
// CHECK:STDOUT: %struct.3: C = struct_value () [template]
// CHECK:STDOUT: %struct.4: C = struct_value () [template]
// CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.2) [template]
// CHECK:STDOUT: %D: type = fn_type @D [template]
// CHECK:STDOUT: %struct.4: D = struct_value () [template]
// CHECK:STDOUT: %struct.5: D = struct_value () [template]
// CHECK:STDOUT: %E: type = fn_type @E [template]
// CHECK:STDOUT: %struct.5: E = struct_value () [template]
// CHECK:STDOUT: %struct.6: E = struct_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -953,27 +1075,35 @@ import library "extern_api";
// CHECK:STDOUT: .e = %e
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.1: A = import_ref ir1, inst+2, loaded [template = constants.%struct.1]
// CHECK:STDOUT: %import_ref.2: B = import_ref ir1, inst+9, loaded [template = constants.%struct.2]
// CHECK:STDOUT: %import_ref.3: C = import_ref ir1, inst+23, loaded [template = constants.%struct.3]
// CHECK:STDOUT: %import_ref.4: D = import_ref ir1, inst+26, loaded [template = constants.%struct.4]
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref ir1, inst+29, loaded
// CHECK:STDOUT: %import_ref.2: B = import_ref ir1, inst+21, loaded [template = constants.%struct.3]
// CHECK:STDOUT: %import_ref.3: C = import_ref ir1, inst+43, loaded [template = constants.%struct.4]
// CHECK:STDOUT: %import_ref.4: D = import_ref ir1, inst+46, loaded [template = constants.%struct.5]
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref ir1, 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 = import_ref ir1, inst+30, loaded [template = constants.%struct.5]
// CHECK:STDOUT: %import_ref.6: E = import_ref ir1, inst+50, loaded [template = constants.%struct.6]
// CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+2, unloaded
// CHECK:STDOUT: %import_ref.8 = import_ref ir2, inst+9, unloaded
// CHECK:STDOUT: %import_ref.9 = import_ref ir2, inst+23, unloaded
// CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+26, unloaded
// CHECK:STDOUT: %import_ref.11 = import_ref ir2, inst+30, unloaded
// CHECK:STDOUT: %import_ref.8 = import_ref ir2, inst+21, unloaded
// CHECK:STDOUT: %import_ref.9 = import_ref ir2, inst+43, unloaded
// CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+46, unloaded
// CHECK:STDOUT: %import_ref.11 = import_ref ir2, inst+50, unloaded
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %.loc72_9.1: () = tuple_literal ()
// CHECK:STDOUT: %.loc72_9.2: type = converted %.loc72_9.1, constants.%.1 [template = constants.%.1]
// CHECK:STDOUT: %a.var: ref () = var a
// CHECK:STDOUT: %a: ref () = bind_name a, %a.var
// CHECK:STDOUT: %import_ref.12: Int32 = import_ref ir5, inst+3, loaded [template = constants.%struct.2]
// CHECK:STDOUT: %int.make_type_32.loc73: init type = call constants.%struct.2() [template = i32]
// CHECK:STDOUT: %.loc73_8.1: type = value_of_initializer %int.make_type_32.loc73 [template = i32]
// CHECK:STDOUT: %.loc73_8.2: type = converted %int.make_type_32.loc73, %.loc73_8.1 [template = i32]
// CHECK:STDOUT: %b.var: ref i32 = var b
// CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var
// CHECK:STDOUT: %.loc74: type = struct_type {.c: i32} [template = constants.%.3]
// CHECK:STDOUT: %import_ref.13: Int32 = import_ref ir5, inst+3, loaded [template = constants.%struct.2]
// CHECK:STDOUT: %int.make_type_32.loc74: init type = call constants.%struct.2() [template = i32]
// CHECK:STDOUT: %.loc74_13.1: type = value_of_initializer %int.make_type_32.loc74 [template = i32]
// CHECK:STDOUT: %.loc74_13.2: type = converted %int.make_type_32.loc74, %.loc74_13.1 [template = i32]
// CHECK:STDOUT: %.loc74_16: type = struct_type {.c: i32} [template = constants.%.3]
// CHECK:STDOUT: %c.var: ref {.c: i32} = var c
// CHECK:STDOUT: %c: ref {.c: i32} = bind_name c, %c.var
// CHECK:STDOUT: %.loc75_9.1: () = tuple_literal ()
@@ -988,6 +1118,8 @@ import library "extern_api";
// CHECK:STDOUT:
// CHECK:STDOUT: extern fn @A();
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
// CHECK:STDOUT: extern fn @B(%b: i32) -> i32;
// CHECK:STDOUT:
// CHECK:STDOUT: extern fn @C(%c: (i32,)) -> {.c: i32};
@@ -1001,22 +1133,22 @@ import library "extern_api";
// CHECK:STDOUT: %A.ref: A = name_ref A, file.%import_ref.1 [template = constants.%struct.1]
// CHECK:STDOUT: %A.call: init () = call %A.ref()
// CHECK:STDOUT: assign file.%a.var, %A.call
// CHECK:STDOUT: %B.ref: B = name_ref B, file.%import_ref.2 [template = constants.%struct.2]
// CHECK:STDOUT: %B.ref: B = name_ref B, file.%import_ref.2 [template = constants.%struct.3]
// CHECK:STDOUT: %.loc73: i32 = int_literal 1 [template = constants.%.2]
// CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc73)
// CHECK:STDOUT: assign file.%b.var, %B.call
// CHECK:STDOUT: %C.ref: C = name_ref C, file.%import_ref.3 [template = constants.%struct.3]
// CHECK:STDOUT: %C.ref: C = name_ref C, file.%import_ref.3 [template = constants.%struct.4]
// CHECK:STDOUT: %.loc74_23: i32 = int_literal 1 [template = constants.%.2]
// CHECK:STDOUT: %.loc74_25: (i32,) = tuple_literal (%.loc74_23)
// CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.loc74_23) [template = constants.%tuple]
// CHECK:STDOUT: %.loc74_21: (i32,) = converted %.loc74_25, %tuple [template = constants.%tuple]
// CHECK:STDOUT: %C.call: init {.c: i32} = call %C.ref(%.loc74_21)
// CHECK:STDOUT: assign file.%c.var, %C.call
// CHECK:STDOUT: %D.ref: D = name_ref D, file.%import_ref.4 [template = constants.%struct.4]
// CHECK:STDOUT: %D.ref: D = name_ref D, file.%import_ref.4 [template = constants.%struct.5]
// CHECK:STDOUT: %D.call: init () = call %D.ref()
// CHECK:STDOUT: assign file.%d.var, %D.call
// CHECK:STDOUT: %NS.ref: <namespace> = name_ref NS, file.%NS [template = file.%NS]
// CHECK:STDOUT: %E.ref: E = name_ref E, file.%import_ref.6 [template = constants.%struct.5]
// CHECK:STDOUT: %E.ref: E = name_ref E, file.%import_ref.6 [template = constants.%struct.6]
// CHECK:STDOUT: %E.call: init () = call %E.ref()
// CHECK:STDOUT: assign file.%e.var, %E.call
// CHECK:STDOUT: return
@@ -1041,14 +1173,14 @@ import library "extern_api";
// CHECK:STDOUT: .A = %A.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.1: A = import_ref ir1, inst+2, loaded [template = constants.%struct]
// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+9, unloaded
// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+23, unloaded
// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+26, unloaded
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref ir1, inst+29, loaded
// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+21, unloaded
// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+43, unloaded
// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+46, unloaded
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref ir1, 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 ir1, inst+30, unloaded
// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+50, unloaded
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %.loc6_9.1: () = tuple_literal ()
// CHECK:STDOUT: %.loc6_9.2: type = converted %.loc6_9.1, constants.%.1 [template = constants.%.1]
@@ -1073,8 +1205,10 @@ import library "extern_api";
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %A: type = fn_type @A [template]
// CHECK:STDOUT: %struct.1: A = struct_value () [template]
// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template]
// CHECK:STDOUT: %struct.2: Int32 = struct_value () [template]
// CHECK:STDOUT: %.2: type = fn_type @.1 [template]
// CHECK:STDOUT: %struct.2: <invalid> = struct_value () [template]
// CHECK:STDOUT: %struct.3: <invalid> = struct_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -1088,26 +1222,32 @@ import library "extern_api";
// CHECK:STDOUT: .a = %a
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.1: A = import_ref ir1, inst+2, loaded [template = constants.%struct.1]
// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+9, unloaded
// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+23, unloaded
// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+26, unloaded
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref ir1, inst+29, loaded
// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+21, unloaded
// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+43, unloaded
// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+46, unloaded
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref ir1, 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 ir1, inst+30, unloaded
// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+50, unloaded
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %.loc6_9.1: () = tuple_literal ()
// CHECK:STDOUT: %.loc6_9.2: type = converted %.loc6_9.1, constants.%.1 [template = constants.%.1]
// CHECK:STDOUT: %a.var: ref () = var a
// CHECK:STDOUT: %a: ref () = bind_name a, %a.var
// CHECK:STDOUT: %.decl: <invalid> = fn_decl @.1 [template = constants.%struct.2] {
// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir4, inst+3, loaded [template = constants.%struct.2]
// CHECK:STDOUT: %.decl: <invalid> = fn_decl @.1 [template = constants.%struct.3] {
// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32]
// CHECK:STDOUT: %.loc18_11.1: type = value_of_initializer %int.make_type_32 [template = i32]
// CHECK:STDOUT: %.loc18_11.2: type = converted %int.make_type_32, %.loc18_11.1 [template = i32]
// CHECK:STDOUT: @.1.%return: ref i32 = var <return slot>
// CHECK:STDOUT: }
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: extern fn @A();
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @.1() -> i32;
// CHECK:STDOUT:
// CHECK:STDOUT: fn @__global_init() {
@@ -1137,14 +1277,14 @@ import library "extern_api";
// CHECK:STDOUT: .A = %A.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.1: A = import_ref ir1, inst+2, loaded [template = constants.%struct]
// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+9, unloaded
// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+23, unloaded
// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+26, unloaded
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref ir1, inst+29, loaded
// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+21, unloaded
// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+43, unloaded
// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+46, unloaded
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref ir1, 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 ir1, inst+30, unloaded
// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+50, unloaded
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %.loc6_9.1: () = tuple_literal ()
// CHECK:STDOUT: %.loc6_9.2: type = converted %.loc6_9.1, constants.%.1 [template = constants.%.1]
@@ -1175,14 +1315,14 @@ import library "extern_api";
// CHECK:STDOUT: .Core = %Core
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.1 = import_ref ir1, inst+2, unloaded
// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+9, unloaded
// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+23, unloaded
// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+26, unloaded
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref ir1, inst+29, loaded
// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+21, unloaded
// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+43, unloaded
// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+46, unloaded
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref ir1, 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 ir1, inst+30, unloaded
// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+50, unloaded
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -1198,14 +1338,14 @@ import library "extern_api";
// CHECK:STDOUT: .Core = %Core
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.1 = import_ref ir1, inst+2, unloaded
// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+9, unloaded
// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+23, unloaded
// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+26, unloaded
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref ir1, inst+29, loaded
// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+21, unloaded
// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+43, unloaded
// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+46, unloaded
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref ir1, 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 ir1, inst+30, unloaded
// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+50, unloaded
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -1221,19 +1361,19 @@ import library "extern_api";
// CHECK:STDOUT: .Core = %Core
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.1 = import_ref ir1, inst+2, unloaded
// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+9, unloaded
// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+23, unloaded
// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+26, unloaded
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref ir1, inst+29, loaded
// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+21, unloaded
// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+43, unloaded
// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+46, unloaded
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref ir1, 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 ir1, inst+30, unloaded
// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+50, unloaded
// CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+2, unloaded
// CHECK:STDOUT: %import_ref.8 = import_ref ir2, inst+9, unloaded
// CHECK:STDOUT: %import_ref.9 = import_ref ir2, inst+23, unloaded
// CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+26, unloaded
// CHECK:STDOUT: %import_ref.11 = import_ref ir2, inst+30, unloaded
// CHECK:STDOUT: %import_ref.8 = import_ref ir2, inst+21, unloaded
// CHECK:STDOUT: %import_ref.9 = import_ref ir2, inst+43, unloaded
// CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+46, unloaded
// CHECK:STDOUT: %import_ref.11 = import_ref ir2, inst+50, unloaded
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -11,11 +11,13 @@ fn G(a: i32);
// CHECK:STDOUT: --- param_same_name.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %F: type = fn_type @F [template]
// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct.1: F = struct_value () [template]
// CHECK:STDOUT: %struct.1: Int32 = struct_value () [template]
// CHECK:STDOUT: %F: type = fn_type @F [template]
// CHECK:STDOUT: %struct.2: F = struct_value () [template]
// CHECK:STDOUT: %G: type = fn_type @G [template]
// CHECK:STDOUT: %struct.2: G = struct_value () [template]
// CHECK:STDOUT: %struct.3: G = struct_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -25,16 +27,26 @@ fn G(a: i32);
// CHECK:STDOUT: .G = %G.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {
// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1]
// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] {
// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct.1() [template = i32]
// CHECK:STDOUT: %.loc7_9.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32]
// CHECK:STDOUT: %.loc7_9.2: type = converted %int.make_type_32.loc7, %.loc7_9.1 [template = i32]
// CHECK:STDOUT: %a.loc7_6.1: i32 = param a
// CHECK:STDOUT: @F.%a: i32 = bind_name a, %a.loc7_6.1
// CHECK:STDOUT: }
// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] {
// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1]
// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] {
// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32]
// CHECK:STDOUT: %.loc9_9.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32]
// CHECK:STDOUT: %.loc9_9.2: type = converted %int.make_type_32.loc9, %.loc9_9.1 [template = i32]
// CHECK:STDOUT: %a.loc9_6.1: i32 = param a
// CHECK:STDOUT: @G.%a: i32 = bind_name a, %a.loc9_6.1
// CHECK:STDOUT: }
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F(%a: i32);
// CHECK:STDOUT:
// CHECK:STDOUT: fn @G(%a: i32);