Represent integer literals as IntLiteral not as i32. (#4532)

When an `IntLiteral` appears as an operand of an `if` expression,
convert it to `i32` for now, so that we don't reject things like `if
cond then 1 else 2` due to having a non-constant value of type
`IntLiteral`.

For tuple indexing expressions such as `(a, b).0`, convert the index to
type `IntLiteral`, not to type `i32`. This isn't strictly necessary to
do in this PR, but avoids the need to provide an `IntLiteral` -> `i32`
implicit conversion for `no_prelude` tests using this syntax.
This commit is contained in:
Richard Smith
2024-11-15 23:24:15 +00:00
committed by GitHub
parent 980ce6b25a
commit bc395eb889
249 changed files with 19281 additions and 6668 deletions
+153 -63
View File
@@ -451,12 +451,19 @@ import library "extern_api";
// CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
// CHECK:STDOUT: %B.type: type = fn_type @B [template]
// CHECK:STDOUT: %B: %B.type = struct_value () [template]
// CHECK:STDOUT: %.1: i32 = int_value 1 [template]
// CHECK:STDOUT: %.2: type = struct_type {.c: i32} [template]
// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1 [template]
// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(i32) [template]
// CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template]
// CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template]
// CHECK:STDOUT: %.25: <witness> = interface_witness (%Convert.15) [template]
// CHECK:STDOUT: %.26: <bound method> = bound_method %.1, %Convert.15 [template]
// CHECK:STDOUT: %.27: i32 = int_value 1 [template]
// CHECK:STDOUT: %.28: type = struct_type {.c: i32} [template]
// CHECK:STDOUT: %C.type: type = fn_type @C [template]
// CHECK:STDOUT: %C: %C.type = struct_value () [template]
// CHECK:STDOUT: %tuple.type: type = tuple_type (i32) [template]
// CHECK:STDOUT: %tuple: %tuple.type = tuple_value (%.1) [template]
// CHECK:STDOUT: %tuple.type.1: type = tuple_type (i32) [template]
// CHECK:STDOUT: %tuple.type.2: type = tuple_type (Core.IntLiteral) [template]
// CHECK:STDOUT: %tuple: %tuple.type.1 = tuple_value (%.27) [template]
// CHECK:STDOUT: %D.type: type = fn_type @D [template]
// CHECK:STDOUT: %D: %D.type = struct_value () [template]
// CHECK:STDOUT: %E.type: type = fn_type @E [template]
@@ -475,6 +482,7 @@ import library "extern_api";
// CHECK:STDOUT: %import_ref.6: %E.type = import_ref Main//api, inst+58, loaded [template = constants.%E]
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
// CHECK:STDOUT: .Int32 = %import_ref.7
// CHECK:STDOUT: .ImplicitAs = %import_ref.8
// CHECK:STDOUT: import Core//prelude
// CHECK:STDOUT: import Core//prelude/...
// CHECK:STDOUT: }
@@ -508,9 +516,9 @@ import library "extern_api";
// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%Int32() [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.%.2]
// CHECK:STDOUT: %c.var: ref %.2 = var c
// CHECK:STDOUT: %c: ref %.2 = bind_name c, %c.var
// CHECK:STDOUT: %.loc8_16: type = struct_type {.c: i32} [template = constants.%.28]
// CHECK:STDOUT: %c.var: ref %.28 = var c
// CHECK:STDOUT: %c: ref %.28 = bind_name c, %c.var
// CHECK:STDOUT: %.loc9_9.1: %empty_tuple.type = tuple_literal ()
// CHECK:STDOUT: %.loc9_9.2: type = converted %.loc9_9.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type]
// CHECK:STDOUT: %d.var: ref %empty_tuple.type = var d
@@ -525,7 +533,7 @@ import library "extern_api";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @B(%b.param_patt: i32) -> i32;
// CHECK:STDOUT:
// CHECK:STDOUT: fn @C(%c.param_patt: %tuple.type) -> %.2;
// CHECK:STDOUT: fn @C(%c.param_patt: %tuple.type.1) -> %.28;
// CHECK:STDOUT:
// CHECK:STDOUT: extern fn @D();
// CHECK:STDOUT:
@@ -537,15 +545,25 @@ import library "extern_api";
// CHECK:STDOUT: %A.call: init %empty_tuple.type = call %A.ref()
// CHECK:STDOUT: assign file.%a.var, %A.call
// CHECK:STDOUT: %B.ref: %B.type = name_ref B, imports.%import_ref.2 [template = constants.%B]
// CHECK:STDOUT: %.loc7: i32 = int_value 1 [template = constants.%.1]
// CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc7)
// CHECK:STDOUT: %.loc7_16.1: Core.IntLiteral = int_value 1 [template = constants.%.1]
// CHECK:STDOUT: %.loc7_16.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15]
// CHECK:STDOUT: %.loc7_16.3: <bound method> = bound_method %.loc7_16.1, %.loc7_16.2 [template = constants.%.26]
// CHECK:STDOUT: %int.convert_checked.loc7: init i32 = call %.loc7_16.3(%.loc7_16.1) [template = constants.%.27]
// CHECK:STDOUT: %.loc7_16.4: i32 = value_of_initializer %int.convert_checked.loc7 [template = constants.%.27]
// CHECK:STDOUT: %.loc7_16.5: i32 = converted %.loc7_16.1, %.loc7_16.4 [template = constants.%.27]
// CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc7_16.5)
// CHECK:STDOUT: assign file.%b.var, %B.call
// CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%import_ref.3 [template = constants.%C]
// CHECK:STDOUT: %.loc8_23: i32 = int_value 1 [template = constants.%.1]
// CHECK:STDOUT: %.loc8_25.1: %tuple.type = tuple_literal (%.loc8_23)
// CHECK:STDOUT: %tuple: %tuple.type = tuple_value (%.loc8_23) [template = constants.%tuple]
// CHECK:STDOUT: %.loc8_25.2: %tuple.type = converted %.loc8_25.1, %tuple [template = constants.%tuple]
// CHECK:STDOUT: %C.call: init %.2 = call %C.ref(%.loc8_25.2)
// CHECK:STDOUT: %.loc8_23: Core.IntLiteral = int_value 1 [template = constants.%.1]
// CHECK:STDOUT: %.loc8_25.1: %tuple.type.2 = tuple_literal (%.loc8_23)
// CHECK:STDOUT: %.loc8_25.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15]
// CHECK:STDOUT: %.loc8_25.3: <bound method> = bound_method %.loc8_23, %.loc8_25.2 [template = constants.%.26]
// CHECK:STDOUT: %int.convert_checked.loc8: init i32 = call %.loc8_25.3(%.loc8_23) [template = constants.%.27]
// CHECK:STDOUT: %.loc8_25.4: i32 = value_of_initializer %int.convert_checked.loc8 [template = constants.%.27]
// CHECK:STDOUT: %.loc8_25.5: i32 = converted %.loc8_23, %.loc8_25.4 [template = constants.%.27]
// CHECK:STDOUT: %tuple: %tuple.type.1 = tuple_value (%.loc8_25.5) [template = constants.%tuple]
// CHECK:STDOUT: %.loc8_25.6: %tuple.type.1 = converted %.loc8_25.1, %tuple [template = constants.%tuple]
// CHECK:STDOUT: %C.call: init %.28 = call %C.ref(%.loc8_25.6)
// CHECK:STDOUT: assign file.%c.var, %C.call
// CHECK:STDOUT: %D.ref: %D.type = name_ref D, imports.%import_ref.4 [template = constants.%D]
// CHECK:STDOUT: %D.call: init %empty_tuple.type = call %D.ref()
@@ -576,8 +594,15 @@ import library "extern_api";
// CHECK:STDOUT: %D: %D.type = struct_value () [template]
// CHECK:STDOUT: %E.type: type = fn_type @E [template]
// CHECK:STDOUT: %E: %E.type = struct_value () [template]
// CHECK:STDOUT: %.2: i32 = int_value 1 [template]
// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.2) [template]
// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 1 [template]
// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(i32) [template]
// CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template]
// CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template]
// CHECK:STDOUT: %.26: <witness> = interface_witness (%Convert.15) [template]
// CHECK:STDOUT: %.27: <bound method> = bound_method %.2, %Convert.15 [template]
// CHECK:STDOUT: %.28: i32 = int_value 1 [template]
// CHECK:STDOUT: %tuple.type.3: type = tuple_type (Core.IntLiteral) [template]
// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.28) [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
@@ -587,6 +612,7 @@ import library "extern_api";
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
// CHECK:STDOUT: .Int32 = %import_ref.7
// CHECK:STDOUT: .ImplicitAs = %import_ref.8
// CHECK:STDOUT: import Core//prelude
// CHECK:STDOUT: import Core//prelude/...
// CHECK:STDOUT: }
@@ -679,15 +705,25 @@ import library "extern_api";
// CHECK:STDOUT: %A.call: init %empty_tuple.type = call %A.ref()
// CHECK:STDOUT: assign file.%a.var, %A.call
// CHECK:STDOUT: %B.ref: %B.type = name_ref B, file.%B.decl [template = constants.%B]
// CHECK:STDOUT: %.loc53: i32 = int_value 1 [template = constants.%.2]
// CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc53)
// CHECK:STDOUT: %.loc53_16.1: Core.IntLiteral = int_value 1 [template = constants.%.2]
// CHECK:STDOUT: %.loc53_16.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15]
// CHECK:STDOUT: %.loc53_16.3: <bound method> = bound_method %.loc53_16.1, %.loc53_16.2 [template = constants.%.27]
// CHECK:STDOUT: %int.convert_checked.loc53: init i32 = call %.loc53_16.3(%.loc53_16.1) [template = constants.%.28]
// CHECK:STDOUT: %.loc53_16.4: i32 = value_of_initializer %int.convert_checked.loc53 [template = constants.%.28]
// CHECK:STDOUT: %.loc53_16.5: i32 = converted %.loc53_16.1, %.loc53_16.4 [template = constants.%.28]
// CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc53_16.5)
// CHECK:STDOUT: assign file.%b.var, %B.call
// CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [template = constants.%C]
// CHECK:STDOUT: %.loc54_23: i32 = int_value 1 [template = constants.%.2]
// CHECK:STDOUT: %.loc54_25.1: %tuple.type.2 = tuple_literal (%.loc54_23)
// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.loc54_23) [template = constants.%tuple]
// CHECK:STDOUT: %.loc54_25.2: %tuple.type.2 = converted %.loc54_25.1, %tuple [template = constants.%tuple]
// CHECK:STDOUT: %C.call: init %.1 = call %C.ref(%.loc54_25.2)
// CHECK:STDOUT: %.loc54_23: Core.IntLiteral = int_value 1 [template = constants.%.2]
// CHECK:STDOUT: %.loc54_25.1: %tuple.type.3 = tuple_literal (%.loc54_23)
// CHECK:STDOUT: %.loc54_25.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15]
// CHECK:STDOUT: %.loc54_25.3: <bound method> = bound_method %.loc54_23, %.loc54_25.2 [template = constants.%.27]
// CHECK:STDOUT: %int.convert_checked.loc54: init i32 = call %.loc54_25.3(%.loc54_23) [template = constants.%.28]
// CHECK:STDOUT: %.loc54_25.4: i32 = value_of_initializer %int.convert_checked.loc54 [template = constants.%.28]
// CHECK:STDOUT: %.loc54_25.5: i32 = converted %.loc54_23, %.loc54_25.4 [template = constants.%.28]
// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.loc54_25.5) [template = constants.%tuple]
// CHECK:STDOUT: %.loc54_25.6: %tuple.type.2 = converted %.loc54_25.1, %tuple [template = constants.%tuple]
// CHECK:STDOUT: %C.call: init %.1 = call %C.ref(%.loc54_25.6)
// CHECK:STDOUT: assign file.%c.var, %C.call
// CHECK:STDOUT: %D.ref: %D.type = name_ref D, file.%D.decl [template = constants.%D]
// CHECK:STDOUT: %D.call: init %empty_tuple.type = call %D.ref()
@@ -718,8 +754,15 @@ import library "extern_api";
// CHECK:STDOUT: %D: %D.type = struct_value () [template]
// CHECK:STDOUT: %E.type: type = fn_type @E [template]
// CHECK:STDOUT: %E: %E.type = struct_value () [template]
// CHECK:STDOUT: %.2: i32 = int_value 1 [template]
// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.2) [template]
// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 1 [template]
// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(i32) [template]
// CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template]
// CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template]
// CHECK:STDOUT: %.26: <witness> = interface_witness (%Convert.15) [template]
// CHECK:STDOUT: %.27: <bound method> = bound_method %.2, %Convert.15 [template]
// CHECK:STDOUT: %.28: i32 = int_value 1 [template]
// CHECK:STDOUT: %tuple.type.3: type = tuple_type (Core.IntLiteral) [template]
// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.28) [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
@@ -729,6 +772,7 @@ import library "extern_api";
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
// CHECK:STDOUT: .Int32 = %import_ref.7
// CHECK:STDOUT: .ImplicitAs = %import_ref.8
// CHECK:STDOUT: import Core//prelude
// CHECK:STDOUT: import Core//prelude/...
// CHECK:STDOUT: }
@@ -821,15 +865,25 @@ import library "extern_api";
// CHECK:STDOUT: %A.call: init %empty_tuple.type = call %A.ref()
// CHECK:STDOUT: assign file.%a.var, %A.call
// CHECK:STDOUT: %B.ref: %B.type = name_ref B, file.%B.decl [template = constants.%B]
// CHECK:STDOUT: %.loc13: i32 = int_value 1 [template = constants.%.2]
// CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc13)
// CHECK:STDOUT: %.loc13_16.1: Core.IntLiteral = int_value 1 [template = constants.%.2]
// CHECK:STDOUT: %.loc13_16.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15]
// CHECK:STDOUT: %.loc13_16.3: <bound method> = bound_method %.loc13_16.1, %.loc13_16.2 [template = constants.%.27]
// CHECK:STDOUT: %int.convert_checked.loc13: init i32 = call %.loc13_16.3(%.loc13_16.1) [template = constants.%.28]
// CHECK:STDOUT: %.loc13_16.4: i32 = value_of_initializer %int.convert_checked.loc13 [template = constants.%.28]
// CHECK:STDOUT: %.loc13_16.5: i32 = converted %.loc13_16.1, %.loc13_16.4 [template = constants.%.28]
// CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc13_16.5)
// CHECK:STDOUT: assign file.%b.var, %B.call
// CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [template = constants.%C]
// CHECK:STDOUT: %.loc14_23: i32 = int_value 1 [template = constants.%.2]
// CHECK:STDOUT: %.loc14_25.1: %tuple.type.2 = tuple_literal (%.loc14_23)
// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.loc14_23) [template = constants.%tuple]
// CHECK:STDOUT: %.loc14_25.2: %tuple.type.2 = converted %.loc14_25.1, %tuple [template = constants.%tuple]
// CHECK:STDOUT: %C.call: init %.1 = call %C.ref(%.loc14_25.2)
// CHECK:STDOUT: %.loc14_23: Core.IntLiteral = int_value 1 [template = constants.%.2]
// CHECK:STDOUT: %.loc14_25.1: %tuple.type.3 = tuple_literal (%.loc14_23)
// CHECK:STDOUT: %.loc14_25.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15]
// CHECK:STDOUT: %.loc14_25.3: <bound method> = bound_method %.loc14_23, %.loc14_25.2 [template = constants.%.27]
// CHECK:STDOUT: %int.convert_checked.loc14: init i32 = call %.loc14_25.3(%.loc14_23) [template = constants.%.28]
// CHECK:STDOUT: %.loc14_25.4: i32 = value_of_initializer %int.convert_checked.loc14 [template = constants.%.28]
// CHECK:STDOUT: %.loc14_25.5: i32 = converted %.loc14_23, %.loc14_25.4 [template = constants.%.28]
// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.loc14_25.5) [template = constants.%tuple]
// CHECK:STDOUT: %.loc14_25.6: %tuple.type.2 = converted %.loc14_25.1, %tuple [template = constants.%tuple]
// CHECK:STDOUT: %C.call: init %.1 = call %C.ref(%.loc14_25.6)
// CHECK:STDOUT: assign file.%c.var, %C.call
// CHECK:STDOUT: %D.ref: %D.type = name_ref D, file.%D.decl [template = constants.%D]
// CHECK:STDOUT: %D.call: init %empty_tuple.type = call %D.ref()
@@ -851,12 +905,19 @@ import library "extern_api";
// CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
// CHECK:STDOUT: %B.type: type = fn_type @B [template]
// CHECK:STDOUT: %B: %B.type = struct_value () [template]
// CHECK:STDOUT: %.1: i32 = int_value 1 [template]
// CHECK:STDOUT: %.2: type = struct_type {.c: i32} [template]
// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1 [template]
// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(i32) [template]
// CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template]
// CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template]
// CHECK:STDOUT: %.25: <witness> = interface_witness (%Convert.15) [template]
// CHECK:STDOUT: %.26: <bound method> = bound_method %.1, %Convert.15 [template]
// CHECK:STDOUT: %.27: i32 = int_value 1 [template]
// CHECK:STDOUT: %.28: type = struct_type {.c: i32} [template]
// CHECK:STDOUT: %C.type: type = fn_type @C [template]
// CHECK:STDOUT: %C: %C.type = struct_value () [template]
// CHECK:STDOUT: %tuple.type: type = tuple_type (i32) [template]
// CHECK:STDOUT: %tuple: %tuple.type = tuple_value (%.1) [template]
// CHECK:STDOUT: %tuple.type.1: type = tuple_type (i32) [template]
// CHECK:STDOUT: %tuple.type.2: type = tuple_type (Core.IntLiteral) [template]
// CHECK:STDOUT: %tuple: %tuple.type.1 = tuple_value (%.27) [template]
// CHECK:STDOUT: %D.type: type = fn_type @D [template]
// CHECK:STDOUT: %D: %D.type = struct_value () [template]
// CHECK:STDOUT: %E.type: type = fn_type @E [template]
@@ -875,6 +936,7 @@ import library "extern_api";
// CHECK:STDOUT: %import_ref.6: %E.type = import_ref Main//api, inst+58, loaded [template = constants.%E]
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
// CHECK:STDOUT: .Int32 = %import_ref.12
// CHECK:STDOUT: .ImplicitAs = %import_ref.13
// CHECK:STDOUT: import Core//prelude
// CHECK:STDOUT: import Core//prelude/...
// CHECK:STDOUT: }
@@ -908,9 +970,9 @@ import library "extern_api";
// CHECK:STDOUT: %int.make_type_32.loc54: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc54_13.1: type = value_of_initializer %int.make_type_32.loc54 [template = i32]
// CHECK:STDOUT: %.loc54_13.2: type = converted %int.make_type_32.loc54, %.loc54_13.1 [template = i32]
// CHECK:STDOUT: %.loc54_16: type = struct_type {.c: i32} [template = constants.%.2]
// CHECK:STDOUT: %c.var: ref %.2 = var c
// CHECK:STDOUT: %c: ref %.2 = bind_name c, %c.var
// CHECK:STDOUT: %.loc54_16: type = struct_type {.c: i32} [template = constants.%.28]
// CHECK:STDOUT: %c.var: ref %.28 = var c
// CHECK:STDOUT: %c: ref %.28 = bind_name c, %c.var
// CHECK:STDOUT: %.loc55_9.1: %empty_tuple.type = tuple_literal ()
// CHECK:STDOUT: %.loc55_9.2: type = converted %.loc55_9.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type]
// CHECK:STDOUT: %d.var: ref %empty_tuple.type = var d
@@ -925,7 +987,7 @@ import library "extern_api";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @B(%b.param_patt: i32) -> i32;
// CHECK:STDOUT:
// CHECK:STDOUT: fn @C(%c.param_patt: %tuple.type) -> %.2;
// CHECK:STDOUT: fn @C(%c.param_patt: %tuple.type.1) -> %.28;
// CHECK:STDOUT:
// CHECK:STDOUT: extern fn @D();
// CHECK:STDOUT:
@@ -937,15 +999,25 @@ import library "extern_api";
// CHECK:STDOUT: %A.call: init %empty_tuple.type = call %A.ref()
// CHECK:STDOUT: assign file.%a.var, %A.call
// CHECK:STDOUT: %B.ref: %B.type = name_ref B, imports.%import_ref.2 [template = constants.%B]
// CHECK:STDOUT: %.loc53: i32 = int_value 1 [template = constants.%.1]
// CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc53)
// CHECK:STDOUT: %.loc53_16.1: Core.IntLiteral = int_value 1 [template = constants.%.1]
// CHECK:STDOUT: %.loc53_16.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15]
// CHECK:STDOUT: %.loc53_16.3: <bound method> = bound_method %.loc53_16.1, %.loc53_16.2 [template = constants.%.26]
// CHECK:STDOUT: %int.convert_checked.loc53: init i32 = call %.loc53_16.3(%.loc53_16.1) [template = constants.%.27]
// CHECK:STDOUT: %.loc53_16.4: i32 = value_of_initializer %int.convert_checked.loc53 [template = constants.%.27]
// CHECK:STDOUT: %.loc53_16.5: i32 = converted %.loc53_16.1, %.loc53_16.4 [template = constants.%.27]
// CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc53_16.5)
// CHECK:STDOUT: assign file.%b.var, %B.call
// CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%import_ref.3 [template = constants.%C]
// CHECK:STDOUT: %.loc54_23: i32 = int_value 1 [template = constants.%.1]
// CHECK:STDOUT: %.loc54_25.1: %tuple.type = tuple_literal (%.loc54_23)
// CHECK:STDOUT: %tuple: %tuple.type = tuple_value (%.loc54_23) [template = constants.%tuple]
// CHECK:STDOUT: %.loc54_25.2: %tuple.type = converted %.loc54_25.1, %tuple [template = constants.%tuple]
// CHECK:STDOUT: %C.call: init %.2 = call %C.ref(%.loc54_25.2)
// CHECK:STDOUT: %.loc54_23: Core.IntLiteral = int_value 1 [template = constants.%.1]
// CHECK:STDOUT: %.loc54_25.1: %tuple.type.2 = tuple_literal (%.loc54_23)
// CHECK:STDOUT: %.loc54_25.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15]
// CHECK:STDOUT: %.loc54_25.3: <bound method> = bound_method %.loc54_23, %.loc54_25.2 [template = constants.%.26]
// CHECK:STDOUT: %int.convert_checked.loc54: init i32 = call %.loc54_25.3(%.loc54_23) [template = constants.%.27]
// CHECK:STDOUT: %.loc54_25.4: i32 = value_of_initializer %int.convert_checked.loc54 [template = constants.%.27]
// CHECK:STDOUT: %.loc54_25.5: i32 = converted %.loc54_23, %.loc54_25.4 [template = constants.%.27]
// CHECK:STDOUT: %tuple: %tuple.type.1 = tuple_value (%.loc54_25.5) [template = constants.%tuple]
// CHECK:STDOUT: %.loc54_25.6: %tuple.type.1 = converted %.loc54_25.1, %tuple [template = constants.%tuple]
// CHECK:STDOUT: %C.call: init %.28 = call %C.ref(%.loc54_25.6)
// CHECK:STDOUT: assign file.%c.var, %C.call
// CHECK:STDOUT: %D.ref: %D.type = name_ref D, imports.%import_ref.4 [template = constants.%D]
// CHECK:STDOUT: %D.call: init %empty_tuple.type = call %D.ref()
@@ -967,12 +1039,19 @@ import library "extern_api";
// CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
// CHECK:STDOUT: %B.type: type = fn_type @B [template]
// CHECK:STDOUT: %B: %B.type = struct_value () [template]
// CHECK:STDOUT: %.1: i32 = int_value 1 [template]
// CHECK:STDOUT: %.2: type = struct_type {.c: i32} [template]
// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1 [template]
// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(i32) [template]
// CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template]
// CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template]
// CHECK:STDOUT: %.25: <witness> = interface_witness (%Convert.15) [template]
// CHECK:STDOUT: %.26: <bound method> = bound_method %.1, %Convert.15 [template]
// CHECK:STDOUT: %.27: i32 = int_value 1 [template]
// CHECK:STDOUT: %.28: type = struct_type {.c: i32} [template]
// CHECK:STDOUT: %C.type: type = fn_type @C [template]
// CHECK:STDOUT: %C: %C.type = struct_value () [template]
// CHECK:STDOUT: %tuple.type: type = tuple_type (i32) [template]
// CHECK:STDOUT: %tuple: %tuple.type = tuple_value (%.1) [template]
// CHECK:STDOUT: %tuple.type.1: type = tuple_type (i32) [template]
// CHECK:STDOUT: %tuple.type.2: type = tuple_type (Core.IntLiteral) [template]
// CHECK:STDOUT: %tuple: %tuple.type.1 = tuple_value (%.27) [template]
// CHECK:STDOUT: %D.type: type = fn_type @D [template]
// CHECK:STDOUT: %D: %D.type = struct_value () [template]
// CHECK:STDOUT: %E.type: type = fn_type @E [template]
@@ -991,6 +1070,7 @@ import library "extern_api";
// CHECK:STDOUT: %import_ref.6: %E.type = import_ref Main//extern_api, inst+58, loaded [template = constants.%E]
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
// CHECK:STDOUT: .Int32 = %import_ref.12
// CHECK:STDOUT: .ImplicitAs = %import_ref.13
// CHECK:STDOUT: import Core//prelude
// CHECK:STDOUT: import Core//prelude/...
// CHECK:STDOUT: }
@@ -1024,9 +1104,9 @@ import library "extern_api";
// CHECK:STDOUT: %int.make_type_32.loc53: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc53_13.1: type = value_of_initializer %int.make_type_32.loc53 [template = i32]
// CHECK:STDOUT: %.loc53_13.2: type = converted %int.make_type_32.loc53, %.loc53_13.1 [template = i32]
// CHECK:STDOUT: %.loc53_16: type = struct_type {.c: i32} [template = constants.%.2]
// CHECK:STDOUT: %c.var: ref %.2 = var c
// CHECK:STDOUT: %c: ref %.2 = bind_name c, %c.var
// CHECK:STDOUT: %.loc53_16: type = struct_type {.c: i32} [template = constants.%.28]
// CHECK:STDOUT: %c.var: ref %.28 = var c
// CHECK:STDOUT: %c: ref %.28 = bind_name c, %c.var
// CHECK:STDOUT: %.loc54_9.1: %empty_tuple.type = tuple_literal ()
// CHECK:STDOUT: %.loc54_9.2: type = converted %.loc54_9.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type]
// CHECK:STDOUT: %d.var: ref %empty_tuple.type = var d
@@ -1041,7 +1121,7 @@ import library "extern_api";
// CHECK:STDOUT:
// CHECK:STDOUT: extern fn @B(%b.param_patt: i32) -> i32;
// CHECK:STDOUT:
// CHECK:STDOUT: extern fn @C(%c.param_patt: %tuple.type) -> %.2;
// CHECK:STDOUT: extern fn @C(%c.param_patt: %tuple.type.1) -> %.28;
// CHECK:STDOUT:
// CHECK:STDOUT: extern fn @D();
// CHECK:STDOUT:
@@ -1053,15 +1133,25 @@ import library "extern_api";
// CHECK:STDOUT: %A.call: init %empty_tuple.type = call %A.ref()
// CHECK:STDOUT: assign file.%a.var, %A.call
// CHECK:STDOUT: %B.ref: %B.type = name_ref B, imports.%import_ref.2 [template = constants.%B]
// CHECK:STDOUT: %.loc52: i32 = int_value 1 [template = constants.%.1]
// CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc52)
// CHECK:STDOUT: %.loc52_16.1: Core.IntLiteral = int_value 1 [template = constants.%.1]
// CHECK:STDOUT: %.loc52_16.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15]
// CHECK:STDOUT: %.loc52_16.3: <bound method> = bound_method %.loc52_16.1, %.loc52_16.2 [template = constants.%.26]
// CHECK:STDOUT: %int.convert_checked.loc52: init i32 = call %.loc52_16.3(%.loc52_16.1) [template = constants.%.27]
// CHECK:STDOUT: %.loc52_16.4: i32 = value_of_initializer %int.convert_checked.loc52 [template = constants.%.27]
// CHECK:STDOUT: %.loc52_16.5: i32 = converted %.loc52_16.1, %.loc52_16.4 [template = constants.%.27]
// CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc52_16.5)
// CHECK:STDOUT: assign file.%b.var, %B.call
// CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%import_ref.3 [template = constants.%C]
// CHECK:STDOUT: %.loc53_23: i32 = int_value 1 [template = constants.%.1]
// CHECK:STDOUT: %.loc53_25.1: %tuple.type = tuple_literal (%.loc53_23)
// CHECK:STDOUT: %tuple: %tuple.type = tuple_value (%.loc53_23) [template = constants.%tuple]
// CHECK:STDOUT: %.loc53_25.2: %tuple.type = converted %.loc53_25.1, %tuple [template = constants.%tuple]
// CHECK:STDOUT: %C.call: init %.2 = call %C.ref(%.loc53_25.2)
// CHECK:STDOUT: %.loc53_23: Core.IntLiteral = int_value 1 [template = constants.%.1]
// CHECK:STDOUT: %.loc53_25.1: %tuple.type.2 = tuple_literal (%.loc53_23)
// CHECK:STDOUT: %.loc53_25.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15]
// CHECK:STDOUT: %.loc53_25.3: <bound method> = bound_method %.loc53_23, %.loc53_25.2 [template = constants.%.26]
// CHECK:STDOUT: %int.convert_checked.loc53: init i32 = call %.loc53_25.3(%.loc53_23) [template = constants.%.27]
// CHECK:STDOUT: %.loc53_25.4: i32 = value_of_initializer %int.convert_checked.loc53 [template = constants.%.27]
// CHECK:STDOUT: %.loc53_25.5: i32 = converted %.loc53_23, %.loc53_25.4 [template = constants.%.27]
// CHECK:STDOUT: %tuple: %tuple.type.1 = tuple_value (%.loc53_25.5) [template = constants.%tuple]
// CHECK:STDOUT: %.loc53_25.6: %tuple.type.1 = converted %.loc53_25.1, %tuple [template = constants.%tuple]
// CHECK:STDOUT: %C.call: init %.28 = call %C.ref(%.loc53_25.6)
// CHECK:STDOUT: assign file.%c.var, %C.call
// CHECK:STDOUT: %D.ref: %D.type = name_ref D, imports.%import_ref.4 [template = constants.%D]
// CHECK:STDOUT: %D.call: init %empty_tuple.type = call %D.ref()