Promote FunctionType to a standard instruction. (#3931)

This removes the builtin FunctionType, replacing it with a FunctionType
instruction. The constant for a FunctionDecl is now a StructValue with
type of FunctionType.

Note this means a function declaration produces _both_ a type, and a
value of the type. This has some consequences in terms of circularity,
and makes the importing of function declarations a little more complex.

It'll get particularly peculiar for imports because of the behavior of
the reference, but that's a known issue due to other things such as
`alias`. The impact will hopefully be contained to
ResolvePrevInstForMerge (and ImportRefs).

To note a small formatting change in diagnostics:

```
-  // CHECK:STDERR: fail_member_lookup.carbon:[[@LINE+4]]:3: ERROR: Value of type `<associated <function> in Interface>` is not callable.
+  // CHECK:STDERR: fail_member_lookup.carbon:[[@LINE+4]]:3: ERROR: Value of type `<associated F in Interface>` is not callable.

-  // CHECK:STDERR: fail_todo_facet_lookup.carbon:[[@LINE+4]]:3: ERROR: Value of type `<associated <function> in Interface>` is not callable.
+  // CHECK:STDERR: fail_todo_facet_lookup.carbon:[[@LINE+4]]:3: ERROR: Value of type `<associated F in Interface>` is not callable.
```

---------

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
This commit is contained in:
Jon Ross-Perkins
2024-05-03 15:18:04 +00:00
committed by GitHub
co-authored by Richard Smith
parent e6061f6910
commit 76ed3c73cb
405 changed files with 9799 additions and 6579 deletions
@@ -11,13 +11,19 @@ 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: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct: F = struct_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .Core = %Core
// CHECK:STDOUT: .F = %F
// CHECK:STDOUT: .F = %F.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %F: <function> = fn_decl @F [template] {
// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {
// CHECK:STDOUT: %n.loc10_6.1: i32 = param n
// CHECK:STDOUT: @F.%n: i32 = bind_name n, %n.loc10_6.1
// CHECK:STDOUT: %n.ref: i32 = name_ref n, @F.%n
@@ -14,13 +14,19 @@ 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: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct: F = struct_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .Core = %Core
// CHECK:STDOUT: .F = %F
// CHECK:STDOUT: .F = %F.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %F: <function> = fn_decl @F [template] {
// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {
// 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: %n.loc13_14.1: i32 = param n
+258 -178
View File
@@ -387,40 +387,51 @@ import library "extern_api";
// CHECK:STDOUT: --- api.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %.1: type = tuple_type (type) [template]
// CHECK:STDOUT: %.2: type = tuple_type (i32) [template]
// CHECK:STDOUT: %.3: type = struct_type {.c: i32} [template]
// 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: %B: type = fn_type @B [template]
// CHECK:STDOUT: %struct.2: 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: %D: type = fn_type @D [template]
// CHECK:STDOUT: %struct.4: D = struct_value () [template]
// CHECK:STDOUT: %E: type = fn_type @E [template]
// CHECK:STDOUT: %struct.5: E = struct_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .Core = %Core
// CHECK:STDOUT: .A = %A
// CHECK:STDOUT: .B = %B
// CHECK:STDOUT: .C = %C
// CHECK:STDOUT: .D = %D
// CHECK:STDOUT: .A = %A.decl
// CHECK:STDOUT: .B = %B.decl
// CHECK:STDOUT: .C = %C.decl
// CHECK:STDOUT: .D = %D.decl
// CHECK:STDOUT: .NS = %NS
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %A: <function> = fn_decl @A [template] {}
// CHECK:STDOUT: %B: <function> = fn_decl @B [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: %b.loc5_6.1: i32 = param b
// CHECK:STDOUT: @B.%b: i32 = bind_name b, %b.loc5_6.1
// CHECK:STDOUT: @B.%return: ref i32 = var <return slot>
// CHECK:STDOUT: }
// CHECK:STDOUT: %C: <function> = fn_decl @C [template] {
// 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.%.2 [template = constants.%.2]
// CHECK:STDOUT: %.loc6_14.2: 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: %.loc6_28: type = struct_type {.c: i32} [template = constants.%.3]
// 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: <function> = fn_decl @D [template] {}
// CHECK:STDOUT: %D.decl: D = fn_decl @D [template = constants.%struct.4] {}
// CHECK:STDOUT: %NS: <namespace> = namespace [template] {
// CHECK:STDOUT: .E = %E
// CHECK:STDOUT: .E = %E.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %E: <function> = fn_decl @E [template] {}
// CHECK:STDOUT: %E.decl: E = fn_decl @E [template = constants.%struct.5] {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @A();
@@ -436,40 +447,51 @@ import library "extern_api";
// CHECK:STDOUT: --- extern_api.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %.1: type = tuple_type (type) [template]
// CHECK:STDOUT: %.2: type = tuple_type (i32) [template]
// CHECK:STDOUT: %.3: type = struct_type {.c: i32} [template]
// 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: %B: type = fn_type @B [template]
// CHECK:STDOUT: %struct.2: 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: %D: type = fn_type @D [template]
// CHECK:STDOUT: %struct.4: D = struct_value () [template]
// CHECK:STDOUT: %E: type = fn_type @E [template]
// CHECK:STDOUT: %struct.5: E = struct_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .Core = %Core
// CHECK:STDOUT: .A = %A
// CHECK:STDOUT: .B = %B
// CHECK:STDOUT: .C = %C
// CHECK:STDOUT: .D = %D
// CHECK:STDOUT: .A = %A.decl
// CHECK:STDOUT: .B = %B.decl
// CHECK:STDOUT: .C = %C.decl
// CHECK:STDOUT: .D = %D.decl
// CHECK:STDOUT: .NS = %NS
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %A: <function> = fn_decl @A [template] {}
// CHECK:STDOUT: %B: <function> = fn_decl @B [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: %b.loc5_13.1: i32 = param b
// CHECK:STDOUT: @B.%b: i32 = bind_name b, %b.loc5_13.1
// CHECK:STDOUT: @B.%return: ref i32 = var <return slot>
// CHECK:STDOUT: }
// CHECK:STDOUT: %C: <function> = fn_decl @C [template] {
// 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.%.2 [template = constants.%.2]
// CHECK:STDOUT: %.loc6_21.2: 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: %.loc6_35: type = struct_type {.c: i32} [template = constants.%.3]
// 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: <function> = fn_decl @D [template] {}
// CHECK:STDOUT: %D.decl: D = fn_decl @D [template = constants.%struct.4] {}
// CHECK:STDOUT: %NS: <namespace> = namespace [template] {
// CHECK:STDOUT: .E = %E
// CHECK:STDOUT: .E = %E.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %E: <function> = fn_decl @E [template] {}
// CHECK:STDOUT: %E.decl: E = fn_decl @E [template = constants.%struct.5] {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: extern fn @A();
@@ -486,10 +508,20 @@ import library "extern_api";
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// 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: %B: type = fn_type @B [template]
// CHECK:STDOUT: %struct.2: 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: %tuple: (i32,) = tuple_value (%.2) [template]
// CHECK:STDOUT: %D: type = fn_type @D [template]
// CHECK:STDOUT: %struct.4: D = struct_value () [template]
// CHECK:STDOUT: %E: type = fn_type @E [template]
// CHECK:STDOUT: %struct.5: E = struct_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -506,15 +538,15 @@ import library "extern_api";
// CHECK:STDOUT: .d = %d
// CHECK:STDOUT: .e = %e
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.1: <function> = import_ref ir1, inst+2, loc_15 [template = imports.%A]
// CHECK:STDOUT: %import_ref.2: <function> = import_ref ir1, inst+6, loc_24 [template = imports.%B]
// CHECK:STDOUT: %import_ref.3: <function> = import_ref ir1, inst+18, loc_39 [template = imports.%C]
// CHECK:STDOUT: %import_ref.4: <function> = import_ref ir1, inst+19, loc_53 [template = imports.%D]
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref ir1, inst+20, loaded
// CHECK:STDOUT: %import_ref.1: A = import_ref ir1, inst+2, loc_15 [template = constants.%struct.1]
// CHECK:STDOUT: %import_ref.2: B = import_ref ir1, inst+9, loc_24 [template = constants.%struct.2]
// CHECK:STDOUT: %import_ref.3: C = import_ref ir1, inst+23, loc_39 [template = constants.%struct.3]
// CHECK:STDOUT: %import_ref.4: D = import_ref ir1, inst+26, loc_53 [template = constants.%struct.4]
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref ir1, inst+29, loaded
// CHECK:STDOUT: %NS: <namespace> = namespace %import_ref.5, [template] {
// CHECK:STDOUT: .E = %import_ref.6
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.6: <function> = import_ref ir1, inst+21, loc_65 [template = imports.%E]
// CHECK:STDOUT: %import_ref.6: E = import_ref ir1, inst+30, loc_65 [template = constants.%struct.5]
// 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]
@@ -547,25 +579,25 @@ import library "extern_api";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @__global_init() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %A.ref: <function> = name_ref A, file.%import_ref.1 [template = imports.%A]
// 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: <function> = name_ref B, file.%import_ref.2 [template = imports.%B]
// CHECK:STDOUT: %B.ref: B = name_ref B, file.%import_ref.2 [template = constants.%struct.2]
// 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: <function> = name_ref C, file.%import_ref.3 [template = imports.%C]
// CHECK:STDOUT: %C.ref: C = name_ref C, file.%import_ref.3 [template = constants.%struct.3]
// 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: <function> = name_ref D, file.%import_ref.4 [template = imports.%D]
// CHECK:STDOUT: %D.ref: D = name_ref D, file.%import_ref.4 [template = constants.%struct.4]
// 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: <function> = name_ref E, file.%import_ref.6 [template = imports.%E]
// CHECK:STDOUT: %E.ref: E = name_ref E, file.%import_ref.6 [template = constants.%struct.5]
// CHECK:STDOUT: %E.call: init () = call %E.ref()
// CHECK:STDOUT: assign file.%e.var, %E.call
// CHECK:STDOUT: return
@@ -574,10 +606,20 @@ import library "extern_api";
// CHECK:STDOUT: --- redecl_api.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %.1: type = tuple_type (type) [template]
// CHECK:STDOUT: %.2: type = tuple_type (i32) [template]
// CHECK:STDOUT: %.3: type = struct_type {.c: i32} [template]
// CHECK:STDOUT: %.4: type = tuple_type () [template]
// 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: %B: type = fn_type @B [template]
// CHECK:STDOUT: %struct.2: 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: %D: type = fn_type @D [template]
// CHECK:STDOUT: %struct.4: D = struct_value () [template]
// CHECK:STDOUT: %E: type = fn_type @E [template]
// CHECK:STDOUT: %struct.5: E = struct_value () [template]
// CHECK:STDOUT: %.5: i32 = int_literal 1 [template]
// CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.5) [template]
// CHECK:STDOUT: }
@@ -586,57 +628,57 @@ import library "extern_api";
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .NS = %NS
// CHECK:STDOUT: .Core = %Core
// CHECK:STDOUT: .A = %A
// CHECK:STDOUT: .B = %B
// CHECK:STDOUT: .C = %C
// CHECK:STDOUT: .D = %D
// CHECK:STDOUT: .A = %A.decl
// CHECK:STDOUT: .B = %B.decl
// CHECK:STDOUT: .C = %C.decl
// CHECK:STDOUT: .D = %D.decl
// CHECK:STDOUT: .a = %a
// CHECK:STDOUT: .b = %b.loc13
// CHECK:STDOUT: .c = %c.loc14
// CHECK:STDOUT: .d = %d
// CHECK:STDOUT: .e = %e
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.1: <function> = import_ref ir1, inst+2, loaded [template = imports.%A]
// CHECK:STDOUT: %import_ref.2: <function> = import_ref ir1, inst+6, loaded [template = imports.%B]
// CHECK:STDOUT: %import_ref.3: <function> = import_ref ir1, inst+18, loaded [template = imports.%C]
// CHECK:STDOUT: %import_ref.4: <function> = import_ref ir1, inst+19, loaded [template = imports.%D]
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref ir1, inst+20, loaded
// 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: %NS: <namespace> = namespace %import_ref.5, [template] {
// CHECK:STDOUT: .E = %E
// CHECK:STDOUT: .E = %E.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.6: <function> = import_ref ir1, inst+21, loaded [template = imports.%E]
// CHECK:STDOUT: %import_ref.6: E = import_ref ir1, inst+30, loaded [template = constants.%struct.5]
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %A: <function> = fn_decl @A [template] {}
// CHECK:STDOUT: %B: <function> = fn_decl @B [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: %b.loc7_13.1: i32 = param b
// CHECK:STDOUT: %b.loc7_13.2: i32 = bind_name b, %b.loc7_13.1
// CHECK:STDOUT: %return.var.loc7: ref i32 = var <return slot>
// CHECK:STDOUT: }
// CHECK:STDOUT: %C: <function> = fn_decl @C [template] {
// 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.%.2 [template = constants.%.2]
// CHECK:STDOUT: %.loc8_21.2: 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: %.loc8_35: type = struct_type {.c: i32} [template = constants.%.3]
// 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: <function> = fn_decl @D [template] {}
// CHECK:STDOUT: %E: <function> = fn_decl @E [template] {}
// 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: %.loc12_9.1: () = tuple_literal ()
// CHECK:STDOUT: %.loc12_9.2: type = converted %.loc12_9.1, constants.%.4 [template = constants.%.4]
// 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: %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.%.3]
// CHECK:STDOUT: %.loc14: 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 ()
// CHECK:STDOUT: %.loc15_9.2: type = converted %.loc15_9.1, constants.%.4 [template = constants.%.4]
// CHECK:STDOUT: %.loc15_9.2: type = converted %.loc15_9.1, constants.%.1 [template = constants.%.1]
// CHECK:STDOUT: %d.var: ref () = var d
// CHECK:STDOUT: %d: ref () = bind_name d, %d.var
// CHECK:STDOUT: %.loc16_9.1: () = tuple_literal ()
// CHECK:STDOUT: %.loc16_9.2: type = converted %.loc16_9.1, constants.%.4 [template = constants.%.4]
// CHECK:STDOUT: %.loc16_9.2: type = converted %.loc16_9.1, constants.%.1 [template = constants.%.1]
// CHECK:STDOUT: %e.var: ref () = var e
// CHECK:STDOUT: %e: ref () = bind_name e, %e.var
// CHECK:STDOUT: }
@@ -653,25 +695,25 @@ import library "extern_api";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @__global_init() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %A.ref: <function> = name_ref A, file.%A [template = file.%A]
// 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: <function> = name_ref B, file.%B [template = file.%B]
// CHECK:STDOUT: %B.ref: B = name_ref B, file.%B.decl [template = constants.%struct.2]
// 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: <function> = name_ref C, file.%C [template = file.%C]
// CHECK:STDOUT: %C.ref: C = name_ref C, file.%C.decl [template = constants.%struct.3]
// 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: <function> = name_ref D, file.%D [template = file.%D]
// CHECK:STDOUT: %D.ref: D = name_ref D, file.%D.decl [template = constants.%struct.4]
// 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: <function> = name_ref E, file.%E [template = file.%E]
// CHECK:STDOUT: %E.ref: E = name_ref E, file.%E.decl [template = constants.%struct.5]
// CHECK:STDOUT: %E.call: init () = call %E.ref()
// CHECK:STDOUT: assign file.%e.var, %E.call
// CHECK:STDOUT: return
@@ -680,10 +722,20 @@ import library "extern_api";
// CHECK:STDOUT: --- redecl_extern_api.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %.1: type = tuple_type (type) [template]
// CHECK:STDOUT: %.2: type = tuple_type (i32) [template]
// CHECK:STDOUT: %.3: type = struct_type {.c: i32} [template]
// CHECK:STDOUT: %.4: type = tuple_type () [template]
// 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: %B: type = fn_type @B [template]
// CHECK:STDOUT: %struct.2: 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: %D: type = fn_type @D [template]
// CHECK:STDOUT: %struct.4: D = struct_value () [template]
// CHECK:STDOUT: %E: type = fn_type @E [template]
// CHECK:STDOUT: %struct.5: E = struct_value () [template]
// CHECK:STDOUT: %.5: i32 = int_literal 1 [template]
// CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.5) [template]
// CHECK:STDOUT: }
@@ -692,57 +744,57 @@ import library "extern_api";
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .NS = %NS
// CHECK:STDOUT: .Core = %Core
// CHECK:STDOUT: .A = %A
// CHECK:STDOUT: .B = %B
// CHECK:STDOUT: .C = %C
// CHECK:STDOUT: .D = %D
// CHECK:STDOUT: .A = %A.decl
// CHECK:STDOUT: .B = %B.decl
// CHECK:STDOUT: .C = %C.decl
// CHECK:STDOUT: .D = %D.decl
// CHECK:STDOUT: .a = %a
// CHECK:STDOUT: .b = %b.loc13
// CHECK:STDOUT: .c = %c.loc14
// CHECK:STDOUT: .d = %d
// CHECK:STDOUT: .e = %e
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.1: <function> = import_ref ir1, inst+2, loaded [template = imports.%A]
// CHECK:STDOUT: %import_ref.2: <function> = import_ref ir1, inst+6, loaded [template = imports.%B]
// CHECK:STDOUT: %import_ref.3: <function> = import_ref ir1, inst+18, loaded [template = imports.%C]
// CHECK:STDOUT: %import_ref.4: <function> = import_ref ir1, inst+19, loaded [template = imports.%D]
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref ir1, inst+20, loaded
// 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: %NS: <namespace> = namespace %import_ref.5, [template] {
// CHECK:STDOUT: .E = %E
// CHECK:STDOUT: .E = %E.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.6: <function> = import_ref ir1, inst+21, loaded [template = imports.%E]
// CHECK:STDOUT: %import_ref.6: E = import_ref ir1, inst+30, loaded [template = constants.%struct.5]
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %A: <function> = fn_decl @A [template] {}
// CHECK:STDOUT: %B: <function> = fn_decl @B [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: %b.loc7_13.1: i32 = param b
// CHECK:STDOUT: %b.loc7_13.2: i32 = bind_name b, %b.loc7_13.1
// CHECK:STDOUT: %return.var.loc7: ref i32 = var <return slot>
// CHECK:STDOUT: }
// CHECK:STDOUT: %C: <function> = fn_decl @C [template] {
// 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.%.2 [template = constants.%.2]
// CHECK:STDOUT: %.loc8_21.2: 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: %.loc8_35: type = struct_type {.c: i32} [template = constants.%.3]
// 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: <function> = fn_decl @D [template] {}
// CHECK:STDOUT: %E: <function> = fn_decl @E [template] {}
// 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: %.loc12_9.1: () = tuple_literal ()
// CHECK:STDOUT: %.loc12_9.2: type = converted %.loc12_9.1, constants.%.4 [template = constants.%.4]
// 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: %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.%.3]
// CHECK:STDOUT: %.loc14: 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 ()
// CHECK:STDOUT: %.loc15_9.2: type = converted %.loc15_9.1, constants.%.4 [template = constants.%.4]
// CHECK:STDOUT: %.loc15_9.2: type = converted %.loc15_9.1, constants.%.1 [template = constants.%.1]
// CHECK:STDOUT: %d.var: ref () = var d
// CHECK:STDOUT: %d: ref () = bind_name d, %d.var
// CHECK:STDOUT: %.loc16_9.1: () = tuple_literal ()
// CHECK:STDOUT: %.loc16_9.2: type = converted %.loc16_9.1, constants.%.4 [template = constants.%.4]
// CHECK:STDOUT: %.loc16_9.2: type = converted %.loc16_9.1, constants.%.1 [template = constants.%.1]
// CHECK:STDOUT: %e.var: ref () = var e
// CHECK:STDOUT: %e: ref () = bind_name e, %e.var
// CHECK:STDOUT: }
@@ -759,25 +811,25 @@ import library "extern_api";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @__global_init() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %A.ref: <function> = name_ref A, file.%A [template = file.%A]
// 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: <function> = name_ref B, file.%B [template = file.%B]
// CHECK:STDOUT: %B.ref: B = name_ref B, file.%B.decl [template = constants.%struct.2]
// 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: <function> = name_ref C, file.%C [template = file.%C]
// CHECK:STDOUT: %C.ref: C = name_ref C, file.%C.decl [template = constants.%struct.3]
// 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: <function> = name_ref D, file.%D [template = file.%D]
// CHECK:STDOUT: %D.ref: D = name_ref D, file.%D.decl [template = constants.%struct.4]
// 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: <function> = name_ref E, file.%E [template = file.%E]
// CHECK:STDOUT: %E.ref: E = name_ref E, file.%E.decl [template = constants.%struct.5]
// CHECK:STDOUT: %E.call: init () = call %E.ref()
// CHECK:STDOUT: assign file.%e.var, %E.call
// CHECK:STDOUT: return
@@ -787,10 +839,20 @@ import library "extern_api";
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// 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: %B: type = fn_type @B [template]
// CHECK:STDOUT: %struct.2: 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: %tuple: (i32,) = tuple_value (%.2) [template]
// CHECK:STDOUT: %D: type = fn_type @D [template]
// CHECK:STDOUT: %struct.4: D = struct_value () [template]
// CHECK:STDOUT: %E: type = fn_type @E [template]
// CHECK:STDOUT: %struct.5: E = struct_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -807,20 +869,20 @@ import library "extern_api";
// CHECK:STDOUT: .d = %d
// CHECK:STDOUT: .e = %e
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.1: <function> = import_ref ir1, inst+2, loc_19 [template = imports.%A]
// CHECK:STDOUT: %import_ref.2: <function> = import_ref ir1, inst+6, loc_28 [template = imports.%B]
// CHECK:STDOUT: %import_ref.3: <function> = import_ref ir1, inst+18, loc_43 [template = imports.%C]
// CHECK:STDOUT: %import_ref.4: <function> = import_ref ir1, inst+19, loc_57 [template = imports.%D]
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref ir1, inst+20, loaded
// CHECK:STDOUT: %import_ref.1: A = import_ref ir1, inst+2, loc_19 [template = constants.%struct.1]
// CHECK:STDOUT: %import_ref.2: B = import_ref ir1, inst+9, loc_28 [template = constants.%struct.2]
// CHECK:STDOUT: %import_ref.3: C = import_ref ir1, inst+23, loc_43 [template = constants.%struct.3]
// CHECK:STDOUT: %import_ref.4: D = import_ref ir1, inst+26, loc_57 [template = constants.%struct.4]
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref ir1, inst+29, loaded
// CHECK:STDOUT: %NS: <namespace> = namespace %import_ref.5, [template] {
// CHECK:STDOUT: .E = %import_ref.6
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.6: <function> = import_ref ir1, inst+21, loc_69 [template = imports.%E]
// CHECK:STDOUT: %import_ref.6: E = import_ref ir1, inst+30, loc_69 [template = constants.%struct.5]
// CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+2, unloaded
// CHECK:STDOUT: %import_ref.8 = import_ref ir2, inst+6, unloaded
// CHECK:STDOUT: %import_ref.9 = import_ref ir2, inst+18, unloaded
// CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+19, unloaded
// CHECK:STDOUT: %import_ref.11 = import_ref ir2, inst+21, 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: %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]
@@ -853,25 +915,25 @@ import library "extern_api";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @__global_init() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %A.ref: <function> = name_ref A, file.%import_ref.1 [template = imports.%A]
// 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: <function> = name_ref B, file.%import_ref.2 [template = imports.%B]
// CHECK:STDOUT: %B.ref: B = name_ref B, file.%import_ref.2 [template = constants.%struct.2]
// 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: <function> = name_ref C, file.%import_ref.3 [template = imports.%C]
// CHECK:STDOUT: %C.ref: C = name_ref C, file.%import_ref.3 [template = constants.%struct.3]
// 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: <function> = name_ref D, file.%import_ref.4 [template = imports.%D]
// CHECK:STDOUT: %D.ref: D = name_ref D, file.%import_ref.4 [template = constants.%struct.4]
// 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: <function> = name_ref E, file.%import_ref.6 [template = imports.%E]
// CHECK:STDOUT: %E.ref: E = name_ref E, file.%import_ref.6 [template = constants.%struct.5]
// CHECK:STDOUT: %E.call: init () = call %E.ref()
// CHECK:STDOUT: assign file.%e.var, %E.call
// CHECK:STDOUT: return
@@ -881,10 +943,20 @@ import library "extern_api";
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// 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: %B: type = fn_type @B [template]
// CHECK:STDOUT: %struct.2: 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: %tuple: (i32,) = tuple_value (%.2) [template]
// CHECK:STDOUT: %D: type = fn_type @D [template]
// CHECK:STDOUT: %struct.4: D = struct_value () [template]
// CHECK:STDOUT: %E: type = fn_type @E [template]
// CHECK:STDOUT: %struct.5: E = struct_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -901,20 +973,20 @@ import library "extern_api";
// CHECK:STDOUT: .d = %d
// CHECK:STDOUT: .e = %e
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.1: <function> = import_ref ir1, inst+2, loc_19 [template = imports.%A]
// CHECK:STDOUT: %import_ref.2: <function> = import_ref ir1, inst+6, loc_28 [template = imports.%B]
// CHECK:STDOUT: %import_ref.3: <function> = import_ref ir1, inst+18, loc_43 [template = imports.%C]
// CHECK:STDOUT: %import_ref.4: <function> = import_ref ir1, inst+19, loc_57 [template = imports.%D]
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref ir1, inst+20, loaded
// CHECK:STDOUT: %import_ref.1: A = import_ref ir1, inst+2, loc_19 [template = constants.%struct.1]
// CHECK:STDOUT: %import_ref.2: B = import_ref ir1, inst+9, loc_28 [template = constants.%struct.2]
// CHECK:STDOUT: %import_ref.3: C = import_ref ir1, inst+23, loc_43 [template = constants.%struct.3]
// CHECK:STDOUT: %import_ref.4: D = import_ref ir1, inst+26, loc_57 [template = constants.%struct.4]
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref ir1, inst+29, loaded
// CHECK:STDOUT: %NS: <namespace> = namespace %import_ref.5, [template] {
// CHECK:STDOUT: .E = %import_ref.6
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.6: <function> = import_ref ir1, inst+21, loc_69 [template = imports.%E]
// CHECK:STDOUT: %import_ref.6: E = import_ref ir1, inst+30, loc_69 [template = constants.%struct.5]
// CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+2, unloaded
// CHECK:STDOUT: %import_ref.8 = import_ref ir2, inst+6, unloaded
// CHECK:STDOUT: %import_ref.9 = import_ref ir2, inst+18, unloaded
// CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+19, unloaded
// CHECK:STDOUT: %import_ref.11 = import_ref ir2, inst+21, 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: %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]
@@ -947,25 +1019,25 @@ import library "extern_api";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @__global_init() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %A.ref: <function> = name_ref A, file.%import_ref.1 [template = imports.%A]
// 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: <function> = name_ref B, file.%import_ref.2 [template = imports.%B]
// CHECK:STDOUT: %B.ref: B = name_ref B, file.%import_ref.2 [template = constants.%struct.2]
// 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: <function> = name_ref C, file.%import_ref.3 [template = imports.%C]
// CHECK:STDOUT: %C.ref: C = name_ref C, file.%import_ref.3 [template = constants.%struct.3]
// 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: <function> = name_ref D, file.%import_ref.4 [template = imports.%D]
// CHECK:STDOUT: %D.ref: D = name_ref D, file.%import_ref.4 [template = constants.%struct.4]
// 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: <function> = name_ref E, file.%import_ref.6 [template = imports.%E]
// CHECK:STDOUT: %E.ref: E = name_ref E, file.%import_ref.6 [template = constants.%struct.5]
// CHECK:STDOUT: %E.call: init () = call %E.ref()
// CHECK:STDOUT: assign file.%e.var, %E.call
// CHECK:STDOUT: return
@@ -975,6 +1047,8 @@ import library "extern_api";
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %A: type = fn_type @A [template]
// CHECK:STDOUT: %struct: A = struct_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -985,30 +1059,30 @@ import library "extern_api";
// CHECK:STDOUT: .NS = %NS
// CHECK:STDOUT: .Core = %Core
// CHECK:STDOUT: .a = %a
// CHECK:STDOUT: .A = %A
// CHECK:STDOUT: .A = %A.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.1: <function> = import_ref ir1, inst+2, loc_15 [template = imports.%A]
// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+6, unloaded
// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+18, unloaded
// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+19, unloaded
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref ir1, inst+20, loaded
// CHECK:STDOUT: %import_ref.1: A = import_ref ir1, inst+2, loc_15 [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: %NS: <namespace> = namespace %import_ref.5, [template] {
// CHECK:STDOUT: .E = %import_ref.6
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+21, unloaded
// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+30, 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: %A: <function> = fn_decl @A [template] {}
// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @A();
// CHECK:STDOUT:
// CHECK:STDOUT: fn @__global_init() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %A.ref: <function> = name_ref A, file.%import_ref.1 [template = imports.%A]
// CHECK:STDOUT: %A.ref: A = name_ref A, file.%import_ref.1 [template = constants.%struct]
// CHECK:STDOUT: %A.call: init () = call %A.ref()
// CHECK:STDOUT: assign file.%a.var, %A.call
// CHECK:STDOUT: return
@@ -1018,6 +1092,10 @@ import library "extern_api";
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// 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: %.2: type = fn_type @.1 [template]
// CHECK:STDOUT: %struct.2: <invalid> = struct_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -1030,21 +1108,21 @@ import library "extern_api";
// CHECK:STDOUT: .Core = %Core
// CHECK:STDOUT: .a = %a
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.1: <function> = import_ref ir1, inst+2, loc_15 [template = imports.%A]
// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+6, unloaded
// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+18, unloaded
// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+19, unloaded
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref ir1, inst+20, loaded
// CHECK:STDOUT: %import_ref.1: A = import_ref ir1, inst+2, loc_15 [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: %NS: <namespace> = namespace %import_ref.5, [template] {
// CHECK:STDOUT: .E = %import_ref.6
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+21, unloaded
// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+30, 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: %.loc25: <function> = fn_decl @.1 [template] {
// CHECK:STDOUT: %.decl: <invalid> = fn_decl @.1 [template = constants.%struct.2] {
// CHECK:STDOUT: @.1.%return: ref i32 = var <return slot>
// CHECK:STDOUT: }
// CHECK:STDOUT: }
@@ -1055,7 +1133,7 @@ import library "extern_api";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @__global_init() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %A.ref: <function> = name_ref A, file.%import_ref.1 [template = imports.%A]
// 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: return
@@ -1065,6 +1143,8 @@ import library "extern_api";
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %A: type = fn_type @A [template]
// CHECK:STDOUT: %struct: A = struct_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -1075,30 +1155,30 @@ import library "extern_api";
// CHECK:STDOUT: .NS = %NS
// CHECK:STDOUT: .Core = %Core
// CHECK:STDOUT: .a = %a
// CHECK:STDOUT: .A = %A
// CHECK:STDOUT: .A = %A.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.1: <function> = import_ref ir1, inst+2, loc_15 [template = imports.%A]
// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+6, unloaded
// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+18, unloaded
// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+19, unloaded
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref ir1, inst+20, loaded
// CHECK:STDOUT: %import_ref.1: A = import_ref ir1, inst+2, loc_15 [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: %NS: <namespace> = namespace %import_ref.5, [template] {
// CHECK:STDOUT: .E = %import_ref.6
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+21, unloaded
// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+30, 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: %A: <function> = fn_decl @A [template] {}
// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: extern fn @A();
// CHECK:STDOUT:
// CHECK:STDOUT: fn @__global_init() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %A.ref: <function> = name_ref A, file.%import_ref.1 [template = imports.%A]
// CHECK:STDOUT: %A.ref: A = name_ref A, file.%import_ref.1 [template = constants.%struct]
// CHECK:STDOUT: %A.call: init () = call %A.ref()
// CHECK:STDOUT: assign file.%a.var, %A.call
// CHECK:STDOUT: return
@@ -1116,14 +1196,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+6, unloaded
// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+18, unloaded
// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+19, unloaded
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref ir1, inst+20, loaded
// 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: %NS: <namespace> = namespace %import_ref.5, [template] {
// CHECK:STDOUT: .E = %import_ref.6
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+21, unloaded
// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+30, unloaded
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -1139,14 +1219,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+6, unloaded
// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+18, unloaded
// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+19, unloaded
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref ir1, inst+20, loaded
// 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: %NS: <namespace> = namespace %import_ref.5, [template] {
// CHECK:STDOUT: .E = %import_ref.6
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+21, unloaded
// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+30, unloaded
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -1162,19 +1242,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+6, unloaded
// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+18, unloaded
// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+19, unloaded
// CHECK:STDOUT: %import_ref.5: <namespace> = import_ref ir1, inst+20, loaded
// 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: %NS: <namespace> = namespace %import_ref.5, [template] {
// CHECK:STDOUT: .E = %import_ref.6
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+21, unloaded
// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+30, unloaded
// CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+2, unloaded
// CHECK:STDOUT: %import_ref.8 = import_ref ir2, inst+6, unloaded
// CHECK:STDOUT: %import_ref.9 = import_ref ir2, inst+18, unloaded
// CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+19, unloaded
// CHECK:STDOUT: %import_ref.11 = import_ref ir2, inst+21, 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: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -54,35 +54,53 @@ class C {
// CHECK:STDOUT: --- basic.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %F: type = fn_type @F [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct: F = struct_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .F = %F
// CHECK:STDOUT: .F = %F.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %F: <function> = fn_decl @F [template] {}
// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: extern fn @F();
// CHECK:STDOUT:
// CHECK:STDOUT: --- fail_redecl.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %F: type = fn_type @F [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct: F = struct_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .F = %F.loc4
// CHECK:STDOUT: .F = %F.decl.loc4
// CHECK:STDOUT: }
// CHECK:STDOUT: %F.loc4: <function> = fn_decl @F [template] {}
// CHECK:STDOUT: %F.loc12: <function> = fn_decl @F [template] {}
// CHECK:STDOUT: %F.decl.loc4: F = fn_decl @F [template = constants.%struct] {}
// CHECK:STDOUT: %F.decl.loc12: F = fn_decl @F [template = constants.%struct] {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: extern fn @F();
// CHECK:STDOUT:
// CHECK:STDOUT: --- fail_redecl_extern.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %F: type = fn_type @F [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct: F = struct_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .F = %F.loc12
// CHECK:STDOUT: .F = %F.decl.loc12
// CHECK:STDOUT: }
// CHECK:STDOUT: %F.loc4: <function> = fn_decl @F [template] {}
// CHECK:STDOUT: %F.loc12: <function> = fn_decl @F [template] {}
// CHECK:STDOUT: %F.decl.loc4: F = fn_decl @F [template = constants.%struct] {}
// CHECK:STDOUT: %F.decl.loc12: F = fn_decl @F [template = constants.%struct] {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F();
@@ -91,7 +109,12 @@ class C {
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %C: type = class_type @C [template]
// CHECK:STDOUT: %.1: type = struct_type {} [template]
// CHECK:STDOUT: %F: type = fn_type @F [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct.1: F = struct_value () [template]
// CHECK:STDOUT: %G: type = fn_type @G [template]
// CHECK:STDOUT: %struct.2: G = struct_value () [template]
// CHECK:STDOUT: %.2: type = struct_type {} [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -102,8 +125,8 @@ class C {
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: class @C {
// CHECK:STDOUT: %F: <function> = fn_decl @F [template] {}
// CHECK:STDOUT: %G: <function> = fn_decl @G [template] {
// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {}
// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] {
// CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [template = constants.%C]
// CHECK:STDOUT: %self.loc11_15.1: C = param self
// CHECK:STDOUT: %self.loc11_15.2: C = bind_name self, %self.loc11_15.1
@@ -111,8 +134,8 @@ class C {
// CHECK:STDOUT:
// CHECK:STDOUT: !members:
// CHECK:STDOUT: .Self = constants.%C
// CHECK:STDOUT: .F = %F
// CHECK:STDOUT: .G = %G
// CHECK:STDOUT: .F = %F.decl
// CHECK:STDOUT: .G = %G.decl
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F();
@@ -76,38 +76,49 @@ fn CallFAndGIncomplete() {
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %C: type = class_type @C [template]
// CHECK:STDOUT: %D: type = class_type @D [template]
// CHECK:STDOUT: %.1: type = struct_type {} [template]
// CHECK:STDOUT: %ReturnCUnused: type = fn_type @ReturnCUnused [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct.1: ReturnCUnused = struct_value () [template]
// CHECK:STDOUT: %ReturnCUsed: type = fn_type @ReturnCUsed [template]
// CHECK:STDOUT: %struct.2: ReturnCUsed = struct_value () [template]
// CHECK:STDOUT: %ReturnDUnused: type = fn_type @ReturnDUnused [template]
// CHECK:STDOUT: %struct.3: ReturnDUnused = struct_value () [template]
// CHECK:STDOUT: %ReturnDUsed: type = fn_type @ReturnDUsed [template]
// CHECK:STDOUT: %struct.4: ReturnDUsed = struct_value () [template]
// CHECK:STDOUT: %Call: type = fn_type @Call [template]
// CHECK:STDOUT: %struct.5: Call = struct_value () [template]
// CHECK:STDOUT: %.2: type = struct_type {} [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .C = %C.decl
// CHECK:STDOUT: .D = %D.decl.loc5
// CHECK:STDOUT: .ReturnCUnused = %ReturnCUnused
// CHECK:STDOUT: .ReturnCUsed = %ReturnCUsed
// CHECK:STDOUT: .ReturnDUnused = %ReturnDUnused
// CHECK:STDOUT: .ReturnDUsed = %ReturnDUsed
// CHECK:STDOUT: .Call = %Call
// CHECK:STDOUT: .ReturnCUnused = %ReturnCUnused.decl
// CHECK:STDOUT: .ReturnCUsed = %ReturnCUsed.decl
// CHECK:STDOUT: .ReturnDUnused = %ReturnDUnused.decl
// CHECK:STDOUT: .ReturnDUsed = %ReturnDUsed.decl
// CHECK:STDOUT: .Call = %Call.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {}
// CHECK:STDOUT: %D.decl.loc5: type = class_decl @D [template = constants.%D] {}
// CHECK:STDOUT: %ReturnCUnused: <function> = fn_decl @ReturnCUnused [template] {
// CHECK:STDOUT: %ReturnCUnused.decl: ReturnCUnused = fn_decl @ReturnCUnused [template = constants.%struct.1] {
// CHECK:STDOUT: %C.ref.loc7: type = name_ref C, %C.decl [template = constants.%C]
// CHECK:STDOUT: @ReturnCUnused.%return: ref C = var <return slot>
// CHECK:STDOUT: }
// CHECK:STDOUT: %ReturnCUsed: <function> = fn_decl @ReturnCUsed [template] {
// CHECK:STDOUT: %ReturnCUsed.decl: ReturnCUsed = fn_decl @ReturnCUsed [template = constants.%struct.2] {
// CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C]
// CHECK:STDOUT: @ReturnCUsed.%return: ref C = var <return slot>
// CHECK:STDOUT: }
// CHECK:STDOUT: %ReturnDUnused: <function> = fn_decl @ReturnDUnused [template] {
// CHECK:STDOUT: %ReturnDUnused.decl: ReturnDUnused = fn_decl @ReturnDUnused [template = constants.%struct.3] {
// CHECK:STDOUT: %D.ref.loc9: type = name_ref D, %D.decl.loc5 [template = constants.%D]
// CHECK:STDOUT: @ReturnDUnused.%return: ref D = var <return slot>
// CHECK:STDOUT: }
// CHECK:STDOUT: %ReturnDUsed: <function> = fn_decl @ReturnDUsed [template] {
// CHECK:STDOUT: %ReturnDUsed.decl: ReturnDUsed = fn_decl @ReturnDUsed [template = constants.%struct.4] {
// CHECK:STDOUT: %D.ref.loc10: type = name_ref D, %D.decl.loc5 [template = constants.%D]
// CHECK:STDOUT: @ReturnDUsed.%return: ref D = var <return slot>
// CHECK:STDOUT: }
// CHECK:STDOUT: %Call: <function> = fn_decl @Call [template] {}
// CHECK:STDOUT: %Call.decl: Call = fn_decl @Call [template = constants.%struct.5] {}
// CHECK:STDOUT: %D.decl.loc37: type = class_decl @D [template = constants.%D] {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -128,9 +139,9 @@ fn CallFAndGIncomplete() {
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Call() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %ReturnCUsed.ref: <function> = name_ref ReturnCUsed, file.%ReturnCUsed [template = file.%ReturnCUsed]
// CHECK:STDOUT: %ReturnCUsed.ref: ReturnCUsed = name_ref ReturnCUsed, file.%ReturnCUsed.decl [template = constants.%struct.2]
// CHECK:STDOUT: %ReturnCUsed.call: init <error> = call %ReturnCUsed.ref()
// CHECK:STDOUT: %ReturnDUsed.ref: <function> = name_ref ReturnDUsed, file.%ReturnDUsed [template = file.%ReturnDUsed]
// CHECK:STDOUT: %ReturnDUsed.ref: ReturnDUsed = name_ref ReturnDUsed, file.%ReturnDUsed.decl [template = constants.%struct.4]
// CHECK:STDOUT: %ReturnDUsed.call: init <error> = call %ReturnDUsed.ref()
// CHECK:STDOUT: return
// CHECK:STDOUT: }
@@ -138,11 +149,21 @@ fn CallFAndGIncomplete() {
// CHECK:STDOUT: --- fail_use_imported.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %CallFAndGIncomplete: type = fn_type @CallFAndGIncomplete [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct.1: CallFAndGIncomplete = struct_value () [template]
// CHECK:STDOUT: %C: type = class_type @C [template]
// CHECK:STDOUT: %ReturnCUnused: type = fn_type @ReturnCUnused [template]
// CHECK:STDOUT: %struct.2: ReturnCUnused = struct_value () [template]
// CHECK:STDOUT: %ReturnCUsed: type = fn_type @ReturnCUsed [template]
// CHECK:STDOUT: %struct.3: ReturnCUsed = struct_value () [template]
// CHECK:STDOUT: %D: type = class_type @D [template]
// CHECK:STDOUT: %.1: type = struct_type {} [template]
// CHECK:STDOUT: %.2: type = tuple_type () [template]
// CHECK:STDOUT: %.2: type = struct_type {} [template]
// CHECK:STDOUT: %ReturnDUnused: type = fn_type @ReturnDUnused [template]
// CHECK:STDOUT: %struct.4: ReturnDUnused = struct_value () [template]
// CHECK:STDOUT: %.3: type = ptr_type {} [template]
// CHECK:STDOUT: %ReturnDUsed: type = fn_type @ReturnDUsed [template]
// CHECK:STDOUT: %struct.5: ReturnDUsed = struct_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -154,16 +175,16 @@ fn CallFAndGIncomplete() {
// CHECK:STDOUT: .ReturnDUnused = %import_ref.5
// CHECK:STDOUT: .ReturnDUsed = %import_ref.6
// CHECK:STDOUT: .Call = %import_ref.7
// CHECK:STDOUT: .CallFAndGIncomplete = %CallFAndGIncomplete
// CHECK:STDOUT: .CallFAndGIncomplete = %CallFAndGIncomplete.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.1 = import_ref ir1, inst+1, unloaded
// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+3, unloaded
// CHECK:STDOUT: %import_ref.3: <function> = import_ref ir1, inst+7, loc_14 [template = imports.%ReturnCUnused]
// CHECK:STDOUT: %import_ref.4: <function> = import_ref ir1, inst+10, loc_18 [template = imports.%ReturnCUsed]
// CHECK:STDOUT: %import_ref.5: <function> = import_ref ir1, inst+13, loc_22 [template = imports.%ReturnDUnused]
// CHECK:STDOUT: %import_ref.6: <function> = import_ref ir1, inst+16, loc_26 [template = imports.%ReturnDUsed]
// CHECK:STDOUT: %import_ref.7 = import_ref ir1, inst+17, unloaded
// CHECK:STDOUT: %CallFAndGIncomplete: <function> = fn_decl @CallFAndGIncomplete [template] {}
// CHECK:STDOUT: %import_ref.3: ReturnCUnused = import_ref ir1, inst+7, loc_14 [template = constants.%struct.2]
// CHECK:STDOUT: %import_ref.4: ReturnCUsed = import_ref ir1, inst+13, loc_18 [template = constants.%struct.3]
// CHECK:STDOUT: %import_ref.5: ReturnDUnused = import_ref ir1, inst+18, loc_22 [template = constants.%struct.4]
// CHECK:STDOUT: %import_ref.6: ReturnDUsed = import_ref ir1, inst+23, loc_26 [template = constants.%struct.5]
// CHECK:STDOUT: %import_ref.7 = import_ref ir1, inst+26, unloaded
// CHECK:STDOUT: %CallFAndGIncomplete.decl: CallFAndGIncomplete = fn_decl @CallFAndGIncomplete [template = constants.%struct.1] {}
// CHECK:STDOUT: %import_ref.8 = import_ref ir1, inst+4, unloaded
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -177,16 +198,16 @@ fn CallFAndGIncomplete() {
// CHECK:STDOUT: fn @CallFAndGIncomplete() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {}
// CHECK:STDOUT: %ReturnCUnused.ref: <function> = name_ref ReturnCUnused, file.%import_ref.3 [template = imports.%ReturnCUnused]
// CHECK:STDOUT: %ReturnCUnused.ref: ReturnCUnused = name_ref ReturnCUnused, file.%import_ref.3 [template = constants.%struct.2]
// CHECK:STDOUT: %ReturnCUnused.call: init <error> = call %ReturnCUnused.ref()
// CHECK:STDOUT: %ReturnCUsed.ref: <function> = name_ref ReturnCUsed, file.%import_ref.4 [template = imports.%ReturnCUsed]
// CHECK:STDOUT: %ReturnCUsed.ref: ReturnCUsed = name_ref ReturnCUsed, file.%import_ref.4 [template = constants.%struct.3]
// CHECK:STDOUT: %ReturnCUsed.call: init <error> = call %ReturnCUsed.ref()
// CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {}
// CHECK:STDOUT: %ReturnDUnused.ref: <function> = name_ref ReturnDUnused, file.%import_ref.5 [template = imports.%ReturnDUnused]
// CHECK:STDOUT: %ReturnDUnused.ref: ReturnDUnused = name_ref ReturnDUnused, file.%import_ref.5 [template = constants.%struct.4]
// CHECK:STDOUT: %.loc24_16.1: ref D = temporary_storage
// CHECK:STDOUT: %ReturnDUnused.call: init D = call %ReturnDUnused.ref() to %.loc24_16.1
// CHECK:STDOUT: %.loc24_16.2: ref D = temporary %.loc24_16.1, %ReturnDUnused.call
// CHECK:STDOUT: %ReturnDUsed.ref: <function> = name_ref ReturnDUsed, file.%import_ref.6 [template = imports.%ReturnDUsed]
// CHECK:STDOUT: %ReturnDUsed.ref: ReturnDUsed = name_ref ReturnDUsed, file.%import_ref.6 [template = constants.%struct.5]
// CHECK:STDOUT: %ReturnDUsed.call: init <error> = call %ReturnDUsed.ref()
// CHECK:STDOUT: return
// CHECK:STDOUT: }
@@ -96,23 +96,41 @@ extern private fn ExternOrderAndConflict() {}
// CHECK:STDOUT: --- fail_modifiers.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %WrongOrder: type = fn_type @WrongOrder [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct.1: WrongOrder = struct_value () [template]
// CHECK:STDOUT: %DuplicateVirtual: type = fn_type @DuplicateVirtual [template]
// CHECK:STDOUT: %struct.2: DuplicateVirtual = struct_value () [template]
// CHECK:STDOUT: %TwoAccess: type = fn_type @TwoAccess [template]
// CHECK:STDOUT: %struct.3: TwoAccess = struct_value () [template]
// CHECK:STDOUT: %ModifiersConflict: type = fn_type @ModifiersConflict [template]
// CHECK:STDOUT: %struct.4: ModifiersConflict = struct_value () [template]
// CHECK:STDOUT: %InvalidModifier: type = fn_type @InvalidModifier [template]
// CHECK:STDOUT: %struct.5: InvalidModifier = struct_value () [template]
// CHECK:STDOUT: %ModifiersConflict2: type = fn_type @ModifiersConflict2 [template]
// CHECK:STDOUT: %struct.6: ModifiersConflict2 = struct_value () [template]
// CHECK:STDOUT: %ExternOrderAndConflict: type = fn_type @ExternOrderAndConflict [template]
// CHECK:STDOUT: %struct.7: ExternOrderAndConflict = struct_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .WrongOrder = %WrongOrder
// CHECK:STDOUT: .DuplicateVirtual = %DuplicateVirtual
// CHECK:STDOUT: .TwoAccess = %TwoAccess
// CHECK:STDOUT: .ModifiersConflict = %ModifiersConflict
// CHECK:STDOUT: .InvalidModifier = %InvalidModifier
// CHECK:STDOUT: .ModifiersConflict2 = %ModifiersConflict2
// CHECK:STDOUT: .ExternOrderAndConflict = %ExternOrderAndConflict
// CHECK:STDOUT: .WrongOrder = %WrongOrder.decl
// CHECK:STDOUT: .DuplicateVirtual = %DuplicateVirtual.decl
// CHECK:STDOUT: .TwoAccess = %TwoAccess.decl
// CHECK:STDOUT: .ModifiersConflict = %ModifiersConflict.decl
// CHECK:STDOUT: .InvalidModifier = %InvalidModifier.decl
// CHECK:STDOUT: .ModifiersConflict2 = %ModifiersConflict2.decl
// CHECK:STDOUT: .ExternOrderAndConflict = %ExternOrderAndConflict.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %WrongOrder: <function> = fn_decl @WrongOrder [template] {}
// CHECK:STDOUT: %DuplicateVirtual: <function> = fn_decl @DuplicateVirtual [template] {}
// CHECK:STDOUT: %TwoAccess: <function> = fn_decl @TwoAccess [template] {}
// CHECK:STDOUT: %ModifiersConflict: <function> = fn_decl @ModifiersConflict [template] {}
// CHECK:STDOUT: %InvalidModifier: <function> = fn_decl @InvalidModifier [template] {}
// CHECK:STDOUT: %ModifiersConflict2: <function> = fn_decl @ModifiersConflict2 [template] {}
// CHECK:STDOUT: %ExternOrderAndConflict: <function> = fn_decl @ExternOrderAndConflict [template] {}
// CHECK:STDOUT: %WrongOrder.decl: WrongOrder = fn_decl @WrongOrder [template = constants.%struct.1] {}
// CHECK:STDOUT: %DuplicateVirtual.decl: DuplicateVirtual = fn_decl @DuplicateVirtual [template = constants.%struct.2] {}
// CHECK:STDOUT: %TwoAccess.decl: TwoAccess = fn_decl @TwoAccess [template = constants.%struct.3] {}
// CHECK:STDOUT: %ModifiersConflict.decl: ModifiersConflict = fn_decl @ModifiersConflict [template = constants.%struct.4] {}
// CHECK:STDOUT: %InvalidModifier.decl: InvalidModifier = fn_decl @InvalidModifier [template = constants.%struct.5] {}
// CHECK:STDOUT: %ModifiersConflict2.decl: ModifiersConflict2 = fn_decl @ModifiersConflict2 [template = constants.%struct.6] {}
// CHECK:STDOUT: %ExternOrderAndConflict.decl: ExternOrderAndConflict = fn_decl @ExternOrderAndConflict [template = constants.%struct.7] {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @WrongOrder();
@@ -56,42 +56,54 @@ fn E() {}
// CHECK:STDOUT: --- fail_redecl.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// 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: %B: type = fn_type @B [template]
// CHECK:STDOUT: %struct.2: B = struct_value () [template]
// CHECK:STDOUT: %C: type = fn_type @C [template]
// CHECK:STDOUT: %struct.3: C = struct_value () [template]
// CHECK:STDOUT: %.2: type = fn_type @.1 [template]
// CHECK:STDOUT: %struct.4: <invalid> = struct_value () [template]
// CHECK:STDOUT: %D: type = fn_type @D [template]
// CHECK:STDOUT: %struct.5: D = struct_value () [template]
// CHECK:STDOUT: %E: type = fn_type @E [template]
// CHECK:STDOUT: %struct.6: E = struct_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .A = %A.loc7
// CHECK:STDOUT: .B = %B.loc17
// CHECK:STDOUT: .C = %C
// CHECK:STDOUT: .D = %D.loc37
// CHECK:STDOUT: .E = %E.loc47
// CHECK:STDOUT: .A = %A.decl.loc7
// CHECK:STDOUT: .B = %B.decl.loc17
// CHECK:STDOUT: .C = %C.decl
// CHECK:STDOUT: .D = %D.decl.loc37
// CHECK:STDOUT: .E = %E.decl.loc47
// CHECK:STDOUT: }
// CHECK:STDOUT: %A.loc7: <function> = fn_decl @A [template] {}
// CHECK:STDOUT: %A.loc15: <function> = fn_decl @A [template] {}
// CHECK:STDOUT: %B.loc17: <function> = fn_decl @B [template] {
// CHECK:STDOUT: %A.decl.loc7: A = fn_decl @A [template = constants.%struct.1] {}
// CHECK:STDOUT: %A.decl.loc15: A = fn_decl @A [template = constants.%struct.1] {}
// CHECK:STDOUT: %B.decl.loc17: B = fn_decl @B [template = constants.%struct.2] {
// CHECK:STDOUT: %.loc17_10.1: () = tuple_literal ()
// CHECK:STDOUT: %.loc17_10.2: type = converted %.loc17_10.1, constants.%.1 [template = constants.%.1]
// CHECK:STDOUT: %x.loc17_6.1: () = param x
// CHECK:STDOUT: @B.%x: () = bind_name x, %x.loc17_6.1
// CHECK:STDOUT: }
// CHECK:STDOUT: %B.loc25: <function> = fn_decl @B [template] {
// CHECK:STDOUT: %B.decl.loc25: B = fn_decl @B [template = constants.%struct.2] {
// CHECK:STDOUT: %.loc25_10.1: () = tuple_literal ()
// CHECK:STDOUT: %.loc25_10.2: type = converted %.loc25_10.1, constants.%.1 [template = constants.%.1]
// CHECK:STDOUT: %x.loc25_6.1: () = param x
// CHECK:STDOUT: %x.loc25_6.2: () = bind_name x, %x.loc25_6.1
// CHECK:STDOUT: }
// CHECK:STDOUT: %C: <function> = fn_decl @C [template] {}
// CHECK:STDOUT: %.loc35_12: <function> = fn_decl @.1 [template] {
// CHECK:STDOUT: %C.decl: C = fn_decl @C [template = constants.%struct.3] {}
// CHECK:STDOUT: %.decl: <invalid> = fn_decl @.1 [template = constants.%struct.4] {
// CHECK:STDOUT: %.loc35_10.1: () = tuple_literal ()
// CHECK:STDOUT: %.loc35_10.2: type = converted %.loc35_10.1, constants.%.1 [template = constants.%.1]
// CHECK:STDOUT: %x.loc35_6.1: () = param x
// CHECK:STDOUT: @.1.%x: () = bind_name x, %x.loc35_6.1
// CHECK:STDOUT: }
// CHECK:STDOUT: %D.loc37: <function> = fn_decl @D [template] {}
// CHECK:STDOUT: %D.loc45: <function> = fn_decl @D [template] {}
// CHECK:STDOUT: %E.loc47: <function> = fn_decl @E [template] {}
// CHECK:STDOUT: %E.loc54: <function> = fn_decl @E [template] {}
// CHECK:STDOUT: %D.decl.loc37: D = fn_decl @D [template = constants.%struct.5] {}
// CHECK:STDOUT: %D.decl.loc45: D = fn_decl @D [template = constants.%struct.5] {}
// CHECK:STDOUT: %E.decl.loc47: E = fn_decl @E [template = constants.%struct.6] {}
// CHECK:STDOUT: %E.decl.loc54: E = fn_decl @E [template = constants.%struct.6] {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @A();
@@ -11,11 +11,17 @@ private fn F();
// CHECK:STDOUT: --- fail_todo_modifiers.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %F: type = fn_type @F [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct: F = struct_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .F = %F
// CHECK:STDOUT: .F = %F.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %F: <function> = fn_decl @F [template] {}
// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F();
@@ -61,69 +61,105 @@ extern fn A();
// CHECK:STDOUT: --- basic.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %A: type = fn_type @A [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct: A = struct_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .A = %A
// CHECK:STDOUT: .A = %A.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %A: <function> = fn_decl @A [template] {}
// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @A();
// CHECK:STDOUT:
// CHECK:STDOUT: --- basic.impl.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %A: type = fn_type @A [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct: A = struct_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .A = %A
// CHECK:STDOUT: .A = %A.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref: <function> = import_ref ir0, inst+1, loaded [template = imports.%A]
// CHECK:STDOUT: %A: <function> = fn_decl @A [template] {}
// CHECK:STDOUT: %import_ref: A = import_ref ir0, inst+1, loaded [template = constants.%struct]
// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @A();
// CHECK:STDOUT:
// CHECK:STDOUT: --- extern_api.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %A: type = fn_type @A [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct: A = struct_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .A = %A
// CHECK:STDOUT: .A = %A.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %A: <function> = fn_decl @A [template] {}
// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: extern fn @A();
// CHECK:STDOUT:
// CHECK:STDOUT: --- fail_extern_api.impl.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %A: type = fn_type @A [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct: A = struct_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .A = %A
// CHECK:STDOUT: .A = %A.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref: <function> = import_ref ir0, inst+1, loaded [template = imports.%A]
// CHECK:STDOUT: %A: <function> = fn_decl @A [template] {}
// CHECK:STDOUT: %import_ref: A = import_ref ir0, inst+1, loaded [template = constants.%struct]
// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @A();
// CHECK:STDOUT:
// CHECK:STDOUT: --- extern_impl.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %A: type = fn_type @A [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct: A = struct_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .A = %A
// CHECK:STDOUT: .A = %A.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %A: <function> = fn_decl @A [template] {}
// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @A();
// CHECK:STDOUT:
// CHECK:STDOUT: --- fail_extern_impl.impl.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %A: type = fn_type @A [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct: A = struct_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .A = %A
// CHECK:STDOUT: .A = %A.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref: <function> = import_ref ir0, inst+1, loaded [template = imports.%A]
// CHECK:STDOUT: %A: <function> = fn_decl @A [template] {}
// CHECK:STDOUT: %import_ref: A = import_ref ir0, inst+1, loaded [template = constants.%struct]
// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: extern fn @A();
@@ -11,23 +11,27 @@ fn G() { F(); }
// CHECK:STDOUT: --- simple.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %F: type = fn_type @F [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct.1: F = struct_value () [template]
// CHECK:STDOUT: %G: type = fn_type @G [template]
// CHECK:STDOUT: %struct.2: G = struct_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .F = %F
// CHECK:STDOUT: .G = %G
// CHECK:STDOUT: .F = %F.decl
// CHECK:STDOUT: .G = %G.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %F: <function> = fn_decl @F [template] {}
// CHECK:STDOUT: %G: <function> = fn_decl @G [template] {}
// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {}
// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F();
// CHECK:STDOUT:
// CHECK:STDOUT: fn @G() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %F.ref: <function> = name_ref F, file.%F [template = file.%F]
// CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.1]
// CHECK:STDOUT: %F.call: init () = call %F.ref()
// CHECK:STDOUT: return
// CHECK:STDOUT: }
@@ -10,18 +10,26 @@ 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: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %struct.1: F = struct_value () [template]
// CHECK:STDOUT: %G: type = fn_type @G [template]
// CHECK:STDOUT: %struct.2: G = struct_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .Core = %Core
// CHECK:STDOUT: .F = %F
// CHECK:STDOUT: .G = %G
// CHECK:STDOUT: .F = %F.decl
// CHECK:STDOUT: .G = %G.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %F: <function> = fn_decl @F [template] {
// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {
// 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: <function> = fn_decl @G [template] {
// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] {
// CHECK:STDOUT: %a.loc9_6.1: i32 = param a
// CHECK:STDOUT: @G.%a: i32 = bind_name a, %a.loc9_6.1
// CHECK:STDOUT: }