Model var as a pattern operator (#4720)

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
This commit is contained in:
Geoff Romer
2025-01-17 17:51:34 +00:00
committed by GitHub
co-authored by Richard Smith
parent 6572da7314
commit 13434f0e8a
510 changed files with 11819 additions and 3352 deletions
+52
View File
@@ -23,6 +23,25 @@ fn RuntimeCall(a: i32, b: i32) -> i32 {
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template]
// CHECK:STDOUT: %Add.type.b1f: type = fn_type @Add.1 [template]
// CHECK:STDOUT: %Add: %Add.type.b1f = struct_value () [template]
// CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [template]
// CHECK:STDOUT: %int_2.ecc: Core.IntLiteral = int_value 2 [template]
// CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [template]
// CHECK:STDOUT: %Convert.type.71e: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template]
// CHECK:STDOUT: %impl_witness.d39: <witness> = impl_witness (imports.%import_ref.a5b), @impl.1(%int_32) [template]
// CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.1(%int_32) [template]
// CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [template]
// CHECK:STDOUT: %Convert.bound.ab5: <bound method> = bound_method %int_1.5b8, %Convert.956 [template]
// CHECK:STDOUT: %Convert.specific_fn.70c: <specific function> = specific_function %Convert.bound.ab5, @Convert.2(%int_32) [template]
// CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [template]
// CHECK:STDOUT: %Convert.bound.ef9: <bound method> = bound_method %int_2.ecc, %Convert.956 [template]
// CHECK:STDOUT: %Convert.specific_fn.787: <specific function> = specific_function %Convert.bound.ef9, @Convert.2(%int_32) [template]
// CHECK:STDOUT: %int_2.ef8: %i32 = int_value 2 [template]
// CHECK:STDOUT: %int_3.822: %i32 = int_value 3 [template]
// CHECK:STDOUT: %impl_witness.023: <witness> = impl_witness (imports.%import_ref.85c), @impl.2(%int_32) [template]
// CHECK:STDOUT: %Convert.type.4ad: type = fn_type @Convert.3, @impl.2(%int_32) [template]
// CHECK:STDOUT: %Convert.960: %Convert.type.4ad = struct_value () [template]
// CHECK:STDOUT: %Convert.bound.2d6: <bound method> = bound_method %int_3.822, %Convert.960 [template]
// CHECK:STDOUT: %Convert.specific_fn.377: <specific function> = specific_function %Convert.bound.2d6, @Convert.3(%int_32) [template]
// CHECK:STDOUT: %int_3.1ba: Core.IntLiteral = int_value 3 [template]
// CHECK:STDOUT: %array_type: type = array_type %int_3.1ba, %i32 [template]
// CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template]
@@ -71,7 +90,40 @@ fn RuntimeCall(a: i32, b: i32) -> i32 {
// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2
// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
// CHECK:STDOUT: }
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %arr.patt: %array_type = binding_pattern arr
// CHECK:STDOUT: %.loc13_1: %array_type = var_pattern %arr.patt
// CHECK:STDOUT: }
// CHECK:STDOUT: %arr.var: ref %array_type = var arr
// CHECK:STDOUT: %.loc13_25: type = splice_block %array_type [template = constants.%array_type] {
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %Add.ref: %Add.type.b1f = name_ref Add, %Add.decl [template = constants.%Add]
// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1.5b8]
// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2.ecc]
// CHECK:STDOUT: %impl.elem0.loc13_20: %Convert.type.1b6 = impl_witness_access constants.%impl_witness.d39, element0 [template = constants.%Convert.956]
// CHECK:STDOUT: %Convert.bound.loc13_20: <bound method> = bound_method %int_1, %impl.elem0.loc13_20 [template = constants.%Convert.bound.ab5]
// CHECK:STDOUT: %Convert.specific_fn.loc13_20: <specific function> = specific_function %Convert.bound.loc13_20, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.70c]
// CHECK:STDOUT: %int.convert_checked.loc13_20: init %i32 = call %Convert.specific_fn.loc13_20(%int_1) [template = constants.%int_1.5d2]
// CHECK:STDOUT: %.loc13_20.1: %i32 = value_of_initializer %int.convert_checked.loc13_20 [template = constants.%int_1.5d2]
// CHECK:STDOUT: %.loc13_20.2: %i32 = converted %int_1, %.loc13_20.1 [template = constants.%int_1.5d2]
// CHECK:STDOUT: %impl.elem0.loc13_23: %Convert.type.1b6 = impl_witness_access constants.%impl_witness.d39, element0 [template = constants.%Convert.956]
// CHECK:STDOUT: %Convert.bound.loc13_23: <bound method> = bound_method %int_2, %impl.elem0.loc13_23 [template = constants.%Convert.bound.ef9]
// CHECK:STDOUT: %Convert.specific_fn.loc13_23: <specific function> = specific_function %Convert.bound.loc13_23, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.787]
// CHECK:STDOUT: %int.convert_checked.loc13_23: init %i32 = call %Convert.specific_fn.loc13_23(%int_2) [template = constants.%int_2.ef8]
// CHECK:STDOUT: %.loc13_23.1: %i32 = value_of_initializer %int.convert_checked.loc13_23 [template = constants.%int_2.ef8]
// CHECK:STDOUT: %.loc13_23.2: %i32 = converted %int_2, %.loc13_23.1 [template = constants.%int_2.ef8]
// CHECK:STDOUT: %int.sadd: init %i32 = call %Add.ref(%.loc13_20.2, %.loc13_23.2) [template = constants.%int_3.822]
// CHECK:STDOUT: %impl.elem0.loc13_24: %Convert.type.71e = impl_witness_access constants.%impl_witness.023, element0 [template = constants.%Convert.960]
// CHECK:STDOUT: %Convert.bound.loc13_24: <bound method> = bound_method %int.sadd, %impl.elem0.loc13_24 [template = constants.%Convert.bound.2d6]
// CHECK:STDOUT: %Convert.specific_fn.loc13_24: <specific function> = specific_function %Convert.bound.loc13_24, @Convert.3(constants.%int_32) [template = constants.%Convert.specific_fn.377]
// CHECK:STDOUT: %.loc13_24.1: %i32 = value_of_initializer %int.sadd [template = constants.%int_3.822]
// CHECK:STDOUT: %.loc13_24.2: %i32 = converted %int.sadd, %.loc13_24.1 [template = constants.%int_3.822]
// CHECK:STDOUT: %int.convert_checked.loc13_24: init Core.IntLiteral = call %Convert.specific_fn.loc13_24(%.loc13_24.2) [template = constants.%int_3.1ba]
// CHECK:STDOUT: %.loc13_24.3: Core.IntLiteral = value_of_initializer %int.convert_checked.loc13_24 [template = constants.%int_3.1ba]
// CHECK:STDOUT: %.loc13_24.4: Core.IntLiteral = converted %int.sadd, %.loc13_24.3 [template = constants.%int_3.1ba]
// CHECK:STDOUT: %array_type: type = array_type %.loc13_24.4, %i32 [template = constants.%array_type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %arr: ref %array_type = bind_name arr, %arr.var
// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] {
// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a
+62
View File
@@ -34,6 +34,30 @@ var arr: [i32; (1 as i32).(I.F)(2)];
// CHECK:STDOUT: %F.type.066: type = fn_type @F.2 [template]
// CHECK:STDOUT: %F.9ec: %F.type.066 = struct_value () [template]
// CHECK:STDOUT: %I.facet: %I.type = facet_value %i32, %impl_witness.da7 [template]
// CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [template]
// CHECK:STDOUT: %Convert.type.99b: type = fn_type @Convert.1, @As(%i32) [template]
// CHECK:STDOUT: %Convert.type.71e: type = fn_type @Convert.2, @ImplicitAs(Core.IntLiteral) [template]
// CHECK:STDOUT: %impl_witness.882: <witness> = impl_witness (imports.%import_ref.78a), @impl.4(%int_32) [template]
// CHECK:STDOUT: %Convert.type.4fd: type = fn_type @Convert.5, @impl.4(%int_32) [template]
// CHECK:STDOUT: %Convert.197: %Convert.type.4fd = struct_value () [template]
// CHECK:STDOUT: %Convert.bound.c1b: <bound method> = bound_method %int_1.5b8, %Convert.197 [template]
// CHECK:STDOUT: %Convert.specific_fn.f9a: <specific function> = specific_function %Convert.bound.c1b, @Convert.5(%int_32) [template]
// CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [template]
// CHECK:STDOUT: %F.bound: <bound method> = bound_method %int_1.5d2, %F.9ec [template]
// CHECK:STDOUT: %int_2.ecc: Core.IntLiteral = int_value 2 [template]
// CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.2, @ImplicitAs(%i32) [template]
// CHECK:STDOUT: %impl_witness.d39: <witness> = impl_witness (imports.%import_ref.a5b), @impl.2(%int_32) [template]
// CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.3, @impl.2(%int_32) [template]
// CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [template]
// CHECK:STDOUT: %Convert.bound.ef9: <bound method> = bound_method %int_2.ecc, %Convert.956 [template]
// CHECK:STDOUT: %Convert.specific_fn.787: <specific function> = specific_function %Convert.bound.ef9, @Convert.3(%int_32) [template]
// CHECK:STDOUT: %int_2.ef8: %i32 = int_value 2 [template]
// CHECK:STDOUT: %int_3.822: %i32 = int_value 3 [template]
// CHECK:STDOUT: %impl_witness.023: <witness> = impl_witness (imports.%import_ref.85c), @impl.3(%int_32) [template]
// CHECK:STDOUT: %Convert.type.4ad: type = fn_type @Convert.4, @impl.3(%int_32) [template]
// CHECK:STDOUT: %Convert.960: %Convert.type.4ad = struct_value () [template]
// CHECK:STDOUT: %Convert.bound.2d6: <bound method> = bound_method %int_3.822, %Convert.960 [template]
// CHECK:STDOUT: %Convert.specific_fn.377: <specific function> = specific_function %Convert.bound.2d6, @Convert.4(%int_32) [template]
// CHECK:STDOUT: %int_3.1ba: Core.IntLiteral = int_value 3 [template]
// CHECK:STDOUT: %array_type: type = array_type %int_3.1ba, %i32 [template]
// CHECK:STDOUT: }
@@ -62,7 +86,45 @@ var arr: [i32; (1 as i32).(I.F)(2)];
// CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%I.type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %impl_witness: <witness> = impl_witness (@impl.1.%F.decl) [template = constants.%impl_witness.da7]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %arr.patt: %array_type = binding_pattern arr
// CHECK:STDOUT: %.loc19_1: %array_type = var_pattern %arr.patt
// CHECK:STDOUT: }
// CHECK:STDOUT: %arr.var: ref %array_type = var arr
// CHECK:STDOUT: %.loc19_35: type = splice_block %array_type [template = constants.%array_type] {
// CHECK:STDOUT: %int_32.loc19_11: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32.loc19_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1.5b8]
// CHECK:STDOUT: %int_32.loc19_22: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %i32.loc19_22: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
// CHECK:STDOUT: %impl.elem0.loc19_19: %Convert.type.99b = impl_witness_access constants.%impl_witness.882, element0 [template = constants.%Convert.197]
// CHECK:STDOUT: %Convert.bound.loc19_19: <bound method> = bound_method %int_1, %impl.elem0.loc19_19 [template = constants.%Convert.bound.c1b]
// CHECK:STDOUT: %Convert.specific_fn.loc19_19: <specific function> = specific_function %Convert.bound.loc19_19, @Convert.5(constants.%int_32) [template = constants.%Convert.specific_fn.f9a]
// CHECK:STDOUT: %int.convert_checked.loc19_19: init %i32 = call %Convert.specific_fn.loc19_19(%int_1) [template = constants.%int_1.5d2]
// CHECK:STDOUT: %.loc19_19.1: %i32 = value_of_initializer %int.convert_checked.loc19_19 [template = constants.%int_1.5d2]
// CHECK:STDOUT: %.loc19_19.2: %i32 = converted %int_1, %.loc19_19.1 [template = constants.%int_1.5d2]
// CHECK:STDOUT: %I.ref: type = name_ref I, %I.decl [template = constants.%I.type]
// CHECK:STDOUT: %F.ref: %F.assoc_type = name_ref F, @I.%assoc0 [template = constants.%assoc0.fa7]
// CHECK:STDOUT: %impl.elem0.loc19_26: %F.type.cf0 = impl_witness_access constants.%impl_witness.da7, element0 [template = constants.%F.9ec]
// CHECK:STDOUT: %F.bound: <bound method> = bound_method %.loc19_19.2, %impl.elem0.loc19_26 [template = constants.%F.bound]
// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2.ecc]
// CHECK:STDOUT: %impl.elem0.loc19_33: %Convert.type.1b6 = impl_witness_access constants.%impl_witness.d39, element0 [template = constants.%Convert.956]
// CHECK:STDOUT: %Convert.bound.loc19_33: <bound method> = bound_method %int_2, %impl.elem0.loc19_33 [template = constants.%Convert.bound.ef9]
// CHECK:STDOUT: %Convert.specific_fn.loc19_33: <specific function> = specific_function %Convert.bound.loc19_33, @Convert.3(constants.%int_32) [template = constants.%Convert.specific_fn.787]
// CHECK:STDOUT: %int.convert_checked.loc19_33: init %i32 = call %Convert.specific_fn.loc19_33(%int_2) [template = constants.%int_2.ef8]
// CHECK:STDOUT: %.loc19_33.1: %i32 = value_of_initializer %int.convert_checked.loc19_33 [template = constants.%int_2.ef8]
// CHECK:STDOUT: %.loc19_33.2: %i32 = converted %int_2, %.loc19_33.1 [template = constants.%int_2.ef8]
// CHECK:STDOUT: %int.sadd: init %i32 = call %F.bound(%.loc19_19.2, %.loc19_33.2) [template = constants.%int_3.822]
// CHECK:STDOUT: %impl.elem0.loc19_34: %Convert.type.71e = impl_witness_access constants.%impl_witness.023, element0 [template = constants.%Convert.960]
// CHECK:STDOUT: %Convert.bound.loc19_34: <bound method> = bound_method %int.sadd, %impl.elem0.loc19_34 [template = constants.%Convert.bound.2d6]
// CHECK:STDOUT: %Convert.specific_fn.loc19_34: <specific function> = specific_function %Convert.bound.loc19_34, @Convert.4(constants.%int_32) [template = constants.%Convert.specific_fn.377]
// CHECK:STDOUT: %.loc19_34.1: %i32 = value_of_initializer %int.sadd [template = constants.%int_3.822]
// CHECK:STDOUT: %.loc19_34.2: %i32 = converted %int.sadd, %.loc19_34.1 [template = constants.%int_3.822]
// CHECK:STDOUT: %int.convert_checked.loc19_34: init Core.IntLiteral = call %Convert.specific_fn.loc19_34(%.loc19_34.2) [template = constants.%int_3.1ba]
// CHECK:STDOUT: %.loc19_34.3: Core.IntLiteral = value_of_initializer %int.convert_checked.loc19_34 [template = constants.%int_3.1ba]
// CHECK:STDOUT: %.loc19_34.4: Core.IntLiteral = converted %int.sadd, %.loc19_34.3 [template = constants.%int_3.1ba]
// CHECK:STDOUT: %array_type: type = array_type %.loc19_34.4, %i32 [template = constants.%array_type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %arr: ref %array_type = bind_name arr, %arr.var
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -131,7 +131,12 @@ fn Int(N: MyIntLiteral) -> type = "int.make_type_signed";
// CHECK:STDOUT: %return.param: ref %MyInt32 = out_param runtime_param2
// CHECK:STDOUT: %return: ref %MyInt32 = return_slot %return.param
// CHECK:STDOUT: }
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %v.patt: %MyInt32 = binding_pattern v
// CHECK:STDOUT: %.loc22: %MyInt32 = var_pattern %v.patt
// CHECK:STDOUT: }
// CHECK:STDOUT: %v.var: ref %MyInt32 = var v
// CHECK:STDOUT: %MyInt32.ref: type = name_ref MyInt32, %MyInt32.decl [template = constants.%MyInt32]
// CHECK:STDOUT: %v: ref %MyInt32 = bind_name v, %v.var
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -612,7 +612,11 @@ var arr: [i32; (1 as i32) + (2 as i32)] = (3, 4, (3 as i32) + (4 as i32));
// CHECK:STDOUT: %impl_witness.d9b: <witness> = impl_witness (imports.%import_ref.73a) [template]
// CHECK:STDOUT: %Convert.type.953: type = fn_type @Convert.3 [template]
// CHECK:STDOUT: %Convert.5bc: %Convert.type.953 = struct_value () [template]
// CHECK:STDOUT: %Convert.bound.b34: <bound method> = bound_method %int_1.5b8, %Convert.5bc [template]
// CHECK:STDOUT: %int_1.f38: %i32.builtin = int_value 1 [template]
// CHECK:STDOUT: %int_2.ecc: Core.IntLiteral = int_value 2 [template]
// CHECK:STDOUT: %Convert.bound.324: <bound method> = bound_method %int_2.ecc, %Convert.5bc [template]
// CHECK:STDOUT: %int_2.5a1: %i32.builtin = int_value 2 [template]
// CHECK:STDOUT: %Op.type.545: type = fn_type @Op.1 [template]
// CHECK:STDOUT: %Self.as_type.da9: type = facet_access_type %Self.a99 [symbolic]
// CHECK:STDOUT: %Op.assoc_type: type = assoc_entity_type %Add.type, %Op.type.545 [template]
@@ -620,9 +624,13 @@ var arr: [i32; (1 as i32) + (2 as i32)] = (3, 4, (3 as i32) + (4 as i32));
// CHECK:STDOUT: %impl_witness.bd0: <witness> = impl_witness (imports.%import_ref.db4) [template]
// CHECK:STDOUT: %Op.type.240: type = fn_type @Op.2 [template]
// CHECK:STDOUT: %Op.0e2: %Op.type.240 = struct_value () [template]
// CHECK:STDOUT: %Op.bound.393: <bound method> = bound_method %int_1.f38, %Op.0e2 [template]
// CHECK:STDOUT: %int_3.a0f: %i32.builtin = int_value 3 [template]
// CHECK:STDOUT: %assoc0.5048c6.2: %Convert.assoc_type.c0e = assoc_entity element0, imports.%import_ref.207961.4 [symbolic]
// CHECK:STDOUT: %impl_witness.8f3: <witness> = impl_witness (imports.%import_ref.4f9) [template]
// CHECK:STDOUT: %Convert.type.0e4: type = fn_type @Convert.4 [template]
// CHECK:STDOUT: %Convert.b32: %Convert.type.0e4 = struct_value () [template]
// CHECK:STDOUT: %Convert.bound.65a: <bound method> = bound_method %int_3.a0f, %Convert.b32 [template]
// CHECK:STDOUT: %int_3.1ba: Core.IntLiteral = int_value 3 [template]
// CHECK:STDOUT: %array_type: type = array_type %int_3.1ba, %i32.builtin [template]
// CHECK:STDOUT: %int_4.0c1: Core.IntLiteral = int_value 4 [template]
@@ -680,7 +688,48 @@ var arr: [i32; (1 as i32) + (2 as i32)] = (3, 4, (3 as i32) + (4 as i32));
// CHECK:STDOUT: .arr = %arr
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %arr.patt: %array_type = binding_pattern arr
// CHECK:STDOUT: %.loc4_1: %array_type = var_pattern %arr.patt
// CHECK:STDOUT: }
// CHECK:STDOUT: %arr.var: ref %array_type = var arr
// CHECK:STDOUT: %.loc4_39: type = splice_block %array_type [template = constants.%array_type] {
// CHECK:STDOUT: %int_32.loc4_11: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %int.make_type_signed.loc4_11: init type = call constants.%Int(%int_32.loc4_11) [template = constants.%i32.builtin]
// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1.5b8]
// CHECK:STDOUT: %int_32.loc4_22: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %int.make_type_signed.loc4_22: init type = call constants.%Int(%int_32.loc4_22) [template = constants.%i32.builtin]
// CHECK:STDOUT: %.loc4_22.1: type = value_of_initializer %int.make_type_signed.loc4_22 [template = constants.%i32.builtin]
// CHECK:STDOUT: %.loc4_22.2: type = converted %int.make_type_signed.loc4_22, %.loc4_22.1 [template = constants.%i32.builtin]
// CHECK:STDOUT: %impl.elem0.loc4_19: %Convert.type.378 = impl_witness_access constants.%impl_witness.d9b, element0 [template = constants.%Convert.5bc]
// CHECK:STDOUT: %Convert.bound.loc4_19: <bound method> = bound_method %int_1, %impl.elem0.loc4_19 [template = constants.%Convert.bound.b34]
// CHECK:STDOUT: %int.convert_checked.loc4_19: init %i32.builtin = call %Convert.bound.loc4_19(%int_1) [template = constants.%int_1.f38]
// CHECK:STDOUT: %.loc4_19.1: %i32.builtin = value_of_initializer %int.convert_checked.loc4_19 [template = constants.%int_1.f38]
// CHECK:STDOUT: %.loc4_19.2: %i32.builtin = converted %int_1, %.loc4_19.1 [template = constants.%int_1.f38]
// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2.ecc]
// CHECK:STDOUT: %int_32.loc4_35: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %int.make_type_signed.loc4_35: init type = call constants.%Int(%int_32.loc4_35) [template = constants.%i32.builtin]
// CHECK:STDOUT: %.loc4_35.1: type = value_of_initializer %int.make_type_signed.loc4_35 [template = constants.%i32.builtin]
// CHECK:STDOUT: %.loc4_35.2: type = converted %int.make_type_signed.loc4_35, %.loc4_35.1 [template = constants.%i32.builtin]
// CHECK:STDOUT: %impl.elem0.loc4_32: %Convert.type.378 = impl_witness_access constants.%impl_witness.d9b, element0 [template = constants.%Convert.5bc]
// CHECK:STDOUT: %Convert.bound.loc4_32: <bound method> = bound_method %int_2, %impl.elem0.loc4_32 [template = constants.%Convert.bound.324]
// CHECK:STDOUT: %int.convert_checked.loc4_32: init %i32.builtin = call %Convert.bound.loc4_32(%int_2) [template = constants.%int_2.5a1]
// CHECK:STDOUT: %.loc4_32.1: %i32.builtin = value_of_initializer %int.convert_checked.loc4_32 [template = constants.%int_2.5a1]
// CHECK:STDOUT: %.loc4_32.2: %i32.builtin = converted %int_2, %.loc4_32.1 [template = constants.%int_2.5a1]
// CHECK:STDOUT: %impl.elem0.loc4_27.1: %Op.type.545 = impl_witness_access constants.%impl_witness.bd0, element0 [template = constants.%Op.0e2]
// CHECK:STDOUT: %Op.bound: <bound method> = bound_method %.loc4_19.2, %impl.elem0.loc4_27.1 [template = constants.%Op.bound.393]
// CHECK:STDOUT: %int.sadd: init %i32.builtin = call %Op.bound(%.loc4_19.2, %.loc4_32.2) [template = constants.%int_3.a0f]
// CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_signed.loc4_11 [template = constants.%i32.builtin]
// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_signed.loc4_11, %.loc4_11.1 [template = constants.%i32.builtin]
// CHECK:STDOUT: %impl.elem0.loc4_27.2: %Convert.type.71e = impl_witness_access constants.%impl_witness.8f3, element0 [template = constants.%Convert.b32]
// CHECK:STDOUT: %Convert.bound.loc4_27: <bound method> = bound_method %int.sadd, %impl.elem0.loc4_27.2 [template = constants.%Convert.bound.65a]
// CHECK:STDOUT: %.loc4_27.1: %i32.builtin = value_of_initializer %int.sadd [template = constants.%int_3.a0f]
// CHECK:STDOUT: %.loc4_27.2: %i32.builtin = converted %int.sadd, %.loc4_27.1 [template = constants.%int_3.a0f]
// CHECK:STDOUT: %int.convert_checked.loc4_27: init Core.IntLiteral = call %Convert.bound.loc4_27(%.loc4_27.2) [template = constants.%int_3.1ba]
// CHECK:STDOUT: %.loc4_27.3: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4_27 [template = constants.%int_3.1ba]
// CHECK:STDOUT: %.loc4_27.4: Core.IntLiteral = converted %int.sadd, %.loc4_27.3 [template = constants.%int_3.1ba]
// CHECK:STDOUT: %array_type: type = array_type %.loc4_27.4, %i32.builtin [template = constants.%array_type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %arr: ref %array_type = bind_name arr, %arr.var
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -832,8 +881,8 @@ var arr: [i32; (1 as i32) + (2 as i32)] = (3, 4, (3 as i32) + (4 as i32));
// CHECK:STDOUT: %.loc4_73.8: ref %i32.builtin = array_index file.%arr.var, %int_2
// CHECK:STDOUT: %.loc4_73.9: init %i32.builtin = initialize_from %int.sadd to %.loc4_73.8 [template = constants.%int_7]
// CHECK:STDOUT: %.loc4_73.10: init %array_type = array_init (%.loc4_73.4, %.loc4_73.7, %.loc4_73.9) to file.%arr.var [template = constants.%array]
// CHECK:STDOUT: %.loc4_74: init %array_type = converted %.loc4_73.1, %.loc4_73.10 [template = constants.%array]
// CHECK:STDOUT: assign file.%arr.var, %.loc4_74
// CHECK:STDOUT: %.loc4_1: init %array_type = converted %.loc4_73.1, %.loc4_73.10 [template = constants.%array]
// CHECK:STDOUT: assign file.%arr.var, %.loc4_1
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -165,7 +165,13 @@ var arr: [i32; Core.AsIntLiteral(Core.TestAdd(Core.AsI32(1), Core.AsI32(2)))] =
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template]
// CHECK:STDOUT: %Int.type: type = fn_type @Int [template]
// CHECK:STDOUT: %Int: %Int.type = struct_value () [template]
// CHECK:STDOUT: %i32.builtin: type = int_type signed, %int_32 [template]
// CHECK:STDOUT: %AsIntLiteral.type: type = fn_type @AsIntLiteral [template]
// CHECK:STDOUT: %AsIntLiteral: %AsIntLiteral.type = struct_value () [template]
// CHECK:STDOUT: %TestAdd.type: type = fn_type @TestAdd [template]
// CHECK:STDOUT: %TestAdd: %TestAdd.type = struct_value () [template]
// CHECK:STDOUT: %AsI32.type: type = fn_type @AsI32 [template]
// CHECK:STDOUT: %AsI32: %AsI32.type = struct_value () [template]
// CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [template]
@@ -188,6 +194,8 @@ var arr: [i32; Core.AsIntLiteral(Core.TestAdd(Core.AsI32(1), Core.AsI32(2)))] =
// CHECK:STDOUT: .AsI32 = %import_ref.614
// CHECK:STDOUT: import Core//core
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.d91: %AsIntLiteral.type = import_ref Core//core, AsIntLiteral, loaded [template = constants.%AsIntLiteral]
// CHECK:STDOUT: %import_ref.a93: %TestAdd.type = import_ref Core//core, TestAdd, loaded [template = constants.%TestAdd]
// CHECK:STDOUT: %import_ref.614: %AsI32.type = import_ref Core//core, AsI32, loaded [template = constants.%AsI32]
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -197,7 +205,40 @@ var arr: [i32; Core.AsIntLiteral(Core.TestAdd(Core.AsI32(1), Core.AsI32(2)))] =
// CHECK:STDOUT: .arr = %arr
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %arr.patt: %array_type = binding_pattern arr
// CHECK:STDOUT: %.loc4_1: %array_type = var_pattern %arr.patt
// CHECK:STDOUT: }
// CHECK:STDOUT: %arr.var: ref %array_type = var arr
// CHECK:STDOUT: %.loc4_77: type = splice_block %array_type [template = constants.%array_type] {
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32]
// CHECK:STDOUT: %int.make_type_signed: init type = call constants.%Int(%int_32) [template = constants.%i32.builtin]
// CHECK:STDOUT: %Core.ref.loc4_16: <namespace> = name_ref Core, imports.%Core [template = imports.%Core]
// CHECK:STDOUT: %AsIntLiteral.ref: %AsIntLiteral.type = name_ref AsIntLiteral, imports.%import_ref.d91 [template = constants.%AsIntLiteral]
// CHECK:STDOUT: %Core.ref.loc4_34: <namespace> = name_ref Core, imports.%Core [template = imports.%Core]
// CHECK:STDOUT: %TestAdd.ref: %TestAdd.type = name_ref TestAdd, imports.%import_ref.a93 [template = constants.%TestAdd]
// CHECK:STDOUT: %Core.ref.loc4_47: <namespace> = name_ref Core, imports.%Core [template = imports.%Core]
// CHECK:STDOUT: %AsI32.ref.loc4_51: %AsI32.type = name_ref AsI32, imports.%import_ref.614 [template = constants.%AsI32]
// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1.5b8]
// CHECK:STDOUT: %int.convert_checked.loc4_59: init %i32.builtin = call %AsI32.ref.loc4_51(%int_1) [template = constants.%int_1.f38]
// CHECK:STDOUT: %Core.ref.loc4_62: <namespace> = name_ref Core, imports.%Core [template = imports.%Core]
// CHECK:STDOUT: %AsI32.ref.loc4_66: %AsI32.type = name_ref AsI32, imports.%import_ref.614 [template = constants.%AsI32]
// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2.ecc]
// CHECK:STDOUT: %int.convert_checked.loc4_74: init %i32.builtin = call %AsI32.ref.loc4_66(%int_2) [template = constants.%int_2.5a1]
// CHECK:STDOUT: %.loc4_59.1: %i32.builtin = value_of_initializer %int.convert_checked.loc4_59 [template = constants.%int_1.f38]
// CHECK:STDOUT: %.loc4_59.2: %i32.builtin = converted %int.convert_checked.loc4_59, %.loc4_59.1 [template = constants.%int_1.f38]
// CHECK:STDOUT: %.loc4_74.1: %i32.builtin = value_of_initializer %int.convert_checked.loc4_74 [template = constants.%int_2.5a1]
// CHECK:STDOUT: %.loc4_74.2: %i32.builtin = converted %int.convert_checked.loc4_74, %.loc4_74.1 [template = constants.%int_2.5a1]
// CHECK:STDOUT: %int.sadd: init %i32.builtin = call %TestAdd.ref(%.loc4_59.2, %.loc4_74.2) [template = constants.%int_3.a0f]
// CHECK:STDOUT: %.loc4_75.1: %i32.builtin = value_of_initializer %int.sadd [template = constants.%int_3.a0f]
// CHECK:STDOUT: %.loc4_75.2: %i32.builtin = converted %int.sadd, %.loc4_75.1 [template = constants.%int_3.a0f]
// CHECK:STDOUT: %int.convert_checked.loc4_76: init Core.IntLiteral = call %AsIntLiteral.ref(%.loc4_75.2) [template = constants.%int_3.1ba]
// CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_signed [template = constants.%i32.builtin]
// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_signed, %.loc4_11.1 [template = constants.%i32.builtin]
// CHECK:STDOUT: %.loc4_76.1: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4_76 [template = constants.%int_3.1ba]
// CHECK:STDOUT: %.loc4_76.2: Core.IntLiteral = converted %int.convert_checked.loc4_76, %.loc4_76.1 [template = constants.%int_3.1ba]
// CHECK:STDOUT: %array_type: type = array_type %.loc4_76.2, %i32.builtin [template = constants.%array_type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %arr: ref %array_type = bind_name arr, %arr.var
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -234,8 +275,8 @@ var arr: [i32; Core.AsIntLiteral(Core.TestAdd(Core.AsI32(1), Core.AsI32(2)))] =
// CHECK:STDOUT: %.loc4_125.6: ref %i32.builtin = array_index file.%arr.var, %int_2.loc4_125
// CHECK:STDOUT: %.loc4_125.7: init %i32.builtin = initialize_from %int.convert_checked.loc4_124 to %.loc4_125.6 [template = constants.%int_3.a0f]
// CHECK:STDOUT: %.loc4_125.8: init %array_type = array_init (%.loc4_125.3, %.loc4_125.5, %.loc4_125.7) to file.%arr.var [template = constants.%array]
// CHECK:STDOUT: %.loc4_126: init %array_type = converted %.loc4_125.1, %.loc4_125.8 [template = constants.%array]
// CHECK:STDOUT: assign file.%arr.var, %.loc4_126
// CHECK:STDOUT: %.loc4_1: init %array_type = converted %.loc4_125.1, %.loc4_125.8 [template = constants.%array]
// CHECK:STDOUT: assign file.%arr.var, %.loc4_1
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT: