diff --git a/examples/sieve.carbon b/examples/sieve.carbon index 4a12f95165b58..efe6e7c9a64e2 100644 --- a/examples/sieve.carbon +++ b/examples/sieve.carbon @@ -98,7 +98,7 @@ class Sieve { } fn MarkMultiplesNotPrime[addr self: Self*](p: i32) { - var n: i32 = 2 * p; + var n: i32 = p * 2; while (n < 1000) { self->is_prime[n] = false; n += p; diff --git a/toolchain/check/handle_if_expr.cpp b/toolchain/check/handle_if_expr.cpp index 1e0256299b2d0..524a1c07703eb 100644 --- a/toolchain/check/handle_if_expr.cpp +++ b/toolchain/check/handle_if_expr.cpp @@ -5,6 +5,7 @@ #include "toolchain/check/context.h" #include "toolchain/check/convert.h" #include "toolchain/check/handle.h" +#include "toolchain/sem_ir/builtin_inst_kind.h" namespace Carbon::Check { @@ -30,12 +31,27 @@ auto HandleParseNode(Context& context, Parse::IfExprIfId node_id) -> bool { return true; } +// If the operand is an `IntLiteral`, convert it to a suitably-sized `Int` type. +// TODO: For now we always pick `i32`. +static auto DecayIntLiteralToSizedInt(Context& context, Parse::NodeId node_id, + SemIR::InstId operand_id) + -> SemIR::InstId { + if (context.types().GetInstId(context.insts().Get(operand_id).type_id()) == + SemIR::InstId::BuiltinIntLiteralType) { + operand_id = ConvertToValueOfType( + context, node_id, operand_id, + context.GetBuiltinType(SemIR::BuiltinInstKind::IntType)); + } + return operand_id; +} + auto HandleParseNode(Context& context, Parse::IfExprThenId node_id) -> bool { auto then_value_id = context.node_stack().PopExpr(); auto else_block_id = context.node_stack().Peek(); // Convert the first operand to a value. then_value_id = ConvertToValueExpr(context, then_value_id); + then_value_id = DecayIntLiteralToSizedInt(context, node_id, then_value_id); // Start emitting the `else` block. context.inst_block_stack().Push(else_block_id); diff --git a/toolchain/check/handle_literal.cpp b/toolchain/check/handle_literal.cpp index 09925e5d43c50..eb19cdc80620a 100644 --- a/toolchain/check/handle_literal.cpp +++ b/toolchain/check/handle_literal.cpp @@ -28,37 +28,11 @@ auto HandleParseNode(Context& context, Parse::BoolLiteralTrueId node_id) return true; } -// Forms an IntValue instruction with type `i32` for a given literal integer -// value, which is assumed to be unsigned. -static auto MakeI32Literal(Context& context, Parse::NodeId node_id, - IntId int_id) -> SemIR::InstId { - auto val = context.ints().Get(int_id); - CARBON_CHECK(val.isNonNegative(), - "Unexpected negative literal from the lexer: {0}", val); - - // Make sure the value fits in an `i32`. - if (val.getSignificantBits() > 32) { - CARBON_DIAGNOSTIC(IntLiteralTooLargeForI32, Error, - "integer literal with value {0} does not fit in i32", - llvm::APInt); - context.emitter().Emit(node_id, IntLiteralTooLargeForI32, val); - return SemIR::InstId::BuiltinError; - } - - // We directly reuse the integer ID as it represents the canonical value. - return context.AddInst( - node_id, - {.type_id = context.GetBuiltinType(SemIR::BuiltinInstKind::IntType), - .int_id = int_id}); -} - // Forms an IntValue instruction with type `IntLiteral` for a given literal // integer value, which is assumed to be unsigned. static auto MakeIntLiteral(Context& context, Parse::NodeId node_id, IntId int_id) -> SemIR::InstId { - // TODO: `IntId`s with different bit-widths are considered different values - // here. Decide how we want to canonicalize these. For now this is only used - // by type literals, so we rely on the lexer picking some consistent rule. + // We rely on the lexer having normalized the `int_id` to a canonical width. return context.AddInst( node_id, {.type_id = context.GetBuiltinType( SemIR::BuiltinInstKind::IntLiteralType), @@ -66,9 +40,7 @@ static auto MakeIntLiteral(Context& context, Parse::NodeId node_id, } auto HandleParseNode(Context& context, Parse::IntLiteralId node_id) -> bool { - // Convert the literal to i32. - // TODO: Form an integer literal value and a corresponding type here instead. - auto int_literal_id = MakeI32Literal( + auto int_literal_id = MakeIntLiteral( context, node_id, context.tokens().GetIntLiteral(context.parse_tree().node_token(node_id))); context.node_stack().Push(node_id, int_literal_id); diff --git a/toolchain/check/member_access.cpp b/toolchain/check/member_access.cpp index 580a86d0a18d0..7a5bb6d87320d 100644 --- a/toolchain/check/member_access.cpp +++ b/toolchain/check/member_access.cpp @@ -464,20 +464,29 @@ auto PerformTupleAccess(Context& context, SemIR::LocId loc_id, return SemIR::InstId::BuiltinError; } + auto diag_non_constant_index = [&] { + // TODO: Decide what to do if the index is a symbolic constant. + CARBON_DIAGNOSTIC(TupleIndexNotConstant, Error, + "tuple index must be a constant"); + context.emitter().Emit(loc_id, TupleIndexNotConstant); + return SemIR::InstId::BuiltinError; + }; + // Diagnose a non-constant index prior to conversion to IntLiteral, because + // the conversion will fail if the index is not constant. + if (!context.constant_values().Get(index_inst_id).is_template()) { + return diag_non_constant_index(); + } + SemIR::TypeId element_type_id = SemIR::TypeId::Error; auto index_node_id = context.insts().GetLocId(index_inst_id); index_inst_id = ConvertToValueOfType( context, index_node_id, index_inst_id, - context.GetBuiltinType(SemIR::BuiltinInstKind::IntType)); + context.GetBuiltinType(SemIR::BuiltinInstKind::IntLiteralType)); auto index_const_id = context.constant_values().Get(index_inst_id); if (index_const_id == SemIR::ConstantId::Error) { return SemIR::InstId::BuiltinError; } else if (!index_const_id.is_template()) { - // TODO: Decide what to do if the index is a symbolic constant. - CARBON_DIAGNOSTIC(TupleIndexNotConstant, Error, - "tuple index must be a constant"); - context.emitter().Emit(loc_id, TupleIndexNotConstant); - return SemIR::InstId::BuiltinError; + return diag_non_constant_index(); } auto index_literal = context.insts().GetAs( diff --git a/toolchain/check/testdata/array/array_in_place.carbon b/toolchain/check/testdata/array/array_in_place.carbon index f1a3e805ea5fa..b1e9b6a0d2851 100644 --- a/toolchain/check/testdata/array/array_in_place.carbon +++ b/toolchain/check/testdata/array/array_in_place.carbon @@ -25,23 +25,16 @@ fn G() { // CHECK:STDOUT: %F: %F.type = struct_value () [template] // CHECK:STDOUT: %G.type: type = fn_type @G [template] // CHECK:STDOUT: %G: %G.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 2 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [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: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] -// CHECK:STDOUT: %.27: Core.IntLiteral = int_value 2 [template] -// CHECK:STDOUT: %.28: type = array_type %.27, %tuple.type.2 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.2: type = array_type %.1, %tuple.type.2 [template] // CHECK:STDOUT: %tuple.type.3: type = tuple_type (%tuple.type.2, %tuple.type.2) [template] -// CHECK:STDOUT: %.31: i32 = int_value 0 [template] -// CHECK:STDOUT: %.32: i32 = int_value 1 [template] +// CHECK:STDOUT: %.5: i32 = int_value 0 [template] +// CHECK:STDOUT: %.6: i32 = int_value 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.2 +// CHECK:STDOUT: .Int32 = %import_ref // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -83,7 +76,7 @@ fn G() { // CHECK:STDOUT: %int.make_type_32.loc14_17: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %int.make_type_32.loc14_22: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc14_25.1: %tuple.type.1 = tuple_literal (%int.make_type_32.loc14_12, %int.make_type_32.loc14_17, %int.make_type_32.loc14_22) -// CHECK:STDOUT: %.loc14_28.1: i32 = int_value 2 [template = constants.%.1] +// CHECK:STDOUT: %.loc14_28: Core.IntLiteral = int_value 2 [template = constants.%.1] // CHECK:STDOUT: %.loc14_25.2: type = value_of_initializer %int.make_type_32.loc14_12 [template = i32] // CHECK:STDOUT: %.loc14_25.3: type = converted %int.make_type_32.loc14_12, %.loc14_25.2 [template = i32] // CHECK:STDOUT: %.loc14_25.4: type = value_of_initializer %int.make_type_32.loc14_17 [template = i32] @@ -91,29 +84,24 @@ fn G() { // CHECK:STDOUT: %.loc14_25.6: type = value_of_initializer %int.make_type_32.loc14_22 [template = i32] // CHECK:STDOUT: %.loc14_25.7: type = converted %int.make_type_32.loc14_22, %.loc14_25.6 [template = i32] // CHECK:STDOUT: %.loc14_25.8: type = converted %.loc14_25.1, constants.%tuple.type.2 [template = constants.%tuple.type.2] -// CHECK:STDOUT: %.loc14_28.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc14_28.3: = bound_method %.loc14_28.1, %.loc14_28.2 [template = constants.%.26] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc14_28.3(%.loc14_28.1) [template = constants.%.27] -// CHECK:STDOUT: %.loc14_28.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.27] -// CHECK:STDOUT: %.loc14_28.5: Core.IntLiteral = converted %.loc14_28.1, %.loc14_28.4 [template = constants.%.27] -// CHECK:STDOUT: %.loc14_29: type = array_type %.loc14_28.5, %tuple.type.2 [template = constants.%.28] -// CHECK:STDOUT: %v.var: ref %.28 = var v -// CHECK:STDOUT: %v: ref %.28 = bind_name v, %v.var +// CHECK:STDOUT: %.loc14_29: type = array_type %.loc14_28, %tuple.type.2 [template = constants.%.2] +// CHECK:STDOUT: %v.var: ref %.2 = var v +// CHECK:STDOUT: %v: ref %.2 = bind_name v, %v.var // CHECK:STDOUT: %F.ref.loc14_34: %F.type = name_ref F, file.%F.decl [template = constants.%F] // CHECK:STDOUT: %.loc14_42.3: ref %tuple.type.2 = splice_block %.loc14_42.2 { -// CHECK:STDOUT: %.loc14_42.1: i32 = int_value 0 [template = constants.%.31] +// CHECK:STDOUT: %.loc14_42.1: i32 = int_value 0 [template = constants.%.5] // CHECK:STDOUT: %.loc14_42.2: ref %tuple.type.2 = array_index %v.var, %.loc14_42.1 // CHECK:STDOUT: } // CHECK:STDOUT: %F.call.loc14_35: init %tuple.type.2 = call %F.ref.loc14_34() to %.loc14_42.3 // CHECK:STDOUT: %F.ref.loc14_39: %F.type = name_ref F, file.%F.decl [template = constants.%F] // CHECK:STDOUT: %.loc14_42.6: ref %tuple.type.2 = splice_block %.loc14_42.5 { -// CHECK:STDOUT: %.loc14_42.4: i32 = int_value 1 [template = constants.%.32] +// CHECK:STDOUT: %.loc14_42.4: i32 = int_value 1 [template = constants.%.6] // CHECK:STDOUT: %.loc14_42.5: ref %tuple.type.2 = array_index %v.var, %.loc14_42.4 // CHECK:STDOUT: } // CHECK:STDOUT: %F.call.loc14_40: init %tuple.type.2 = call %F.ref.loc14_39() to %.loc14_42.6 // CHECK:STDOUT: %.loc14_42.7: %tuple.type.3 = tuple_literal (%F.call.loc14_35, %F.call.loc14_40) -// CHECK:STDOUT: %.loc14_42.8: init %.28 = array_init (%F.call.loc14_35, %F.call.loc14_40) to %v.var -// CHECK:STDOUT: %.loc14_43: init %.28 = converted %.loc14_42.7, %.loc14_42.8 +// CHECK:STDOUT: %.loc14_42.8: init %.2 = array_init (%F.call.loc14_35, %F.call.loc14_40) to %v.var +// CHECK:STDOUT: %.loc14_43: init %.2 = converted %.loc14_42.7, %.loc14_42.8 // CHECK:STDOUT: assign %v.var, %.loc14_43 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/array/array_vs_tuple.carbon b/toolchain/check/testdata/array/array_vs_tuple.carbon index 927ce63af197f..77501f3193a2d 100644 --- a/toolchain/check/testdata/array/array_vs_tuple.carbon +++ b/toolchain/check/testdata/array/array_vs_tuple.carbon @@ -21,21 +21,26 @@ fn G() { // CHECK:STDOUT: %G: %G.type = struct_value () [template] // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 3 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.2: type = array_type %.1, i32 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.5: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %tuple.type.1: type = tuple_type (Core.IntLiteral, Core.IntLiteral, Core.IntLiteral) [template] +// CHECK:STDOUT: %.6: i32 = int_value 0 [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: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] -// CHECK:STDOUT: %.27: Core.IntLiteral = int_value 3 [template] -// CHECK:STDOUT: %.28: type = array_type %.27, i32 [template] -// CHECK:STDOUT: %.30: i32 = int_value 1 [template] -// CHECK:STDOUT: %.31: i32 = int_value 2 [template] -// CHECK:STDOUT: %tuple.type.1: type = tuple_type (i32, i32, i32) [template] -// CHECK:STDOUT: %.32: i32 = int_value 0 [template] -// CHECK:STDOUT: %array: %.28 = tuple_value (%.30, %.31, %.1) [template] +// CHECK:STDOUT: %.30: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.31: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.32: i32 = int_value 1 [template] +// CHECK:STDOUT: %.33: = bound_method %.5, %Convert.15 [template] +// CHECK:STDOUT: %.34: i32 = int_value 2 [template] +// CHECK:STDOUT: %.35: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.36: i32 = int_value 3 [template] +// CHECK:STDOUT: %array: %.2 = tuple_value (%.32, %.34, %.36) [template] // CHECK:STDOUT: %tuple.type.2: type = tuple_type (type, type, type) [template] -// CHECK:STDOUT: %tuple: %tuple.type.1 = tuple_value (%.30, %.31, %.1) [template] +// CHECK:STDOUT: %tuple.type.3: type = tuple_type (i32, i32, i32) [template] +// CHECK:STDOUT: %tuple: %tuple.type.3 = tuple_value (%.32, %.34, %.36) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -59,32 +64,39 @@ fn G() { // CHECK:STDOUT: fn @G() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc13_16.1: i32 = int_value 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc13_16: Core.IntLiteral = int_value 3 [template = constants.%.1] // CHECK:STDOUT: %.loc13_11.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] // CHECK:STDOUT: %.loc13_11.2: type = converted %int.make_type_32.loc13, %.loc13_11.1 [template = i32] -// CHECK:STDOUT: %.loc13_16.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc13_16.3: = bound_method %.loc13_16.1, %.loc13_16.2 [template = constants.%.26] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc13_16.3(%.loc13_16.1) [template = constants.%.27] -// CHECK:STDOUT: %.loc13_16.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.27] -// CHECK:STDOUT: %.loc13_16.5: Core.IntLiteral = converted %.loc13_16.1, %.loc13_16.4 [template = constants.%.27] -// CHECK:STDOUT: %.loc13_17: type = array_type %.loc13_16.5, i32 [template = constants.%.28] -// CHECK:STDOUT: %a.var: ref %.28 = var a -// CHECK:STDOUT: %a: ref %.28 = bind_name a, %a.var -// CHECK:STDOUT: %.loc13_22: i32 = int_value 1 [template = constants.%.30] -// CHECK:STDOUT: %.loc13_25: i32 = int_value 2 [template = constants.%.31] -// CHECK:STDOUT: %.loc13_28: i32 = int_value 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc13_17: type = array_type %.loc13_16, i32 [template = constants.%.2] +// CHECK:STDOUT: %a.var: ref %.2 = var a +// CHECK:STDOUT: %a: ref %.2 = bind_name a, %a.var +// CHECK:STDOUT: %.loc13_22: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc13_25: Core.IntLiteral = int_value 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc13_28: Core.IntLiteral = int_value 3 [template = constants.%.1] // CHECK:STDOUT: %.loc13_29.1: %tuple.type.1 = tuple_literal (%.loc13_22, %.loc13_25, %.loc13_28) -// CHECK:STDOUT: %.loc13_29.2: i32 = int_value 0 [template = constants.%.32] -// CHECK:STDOUT: %.loc13_29.3: ref i32 = array_index %a.var, %.loc13_29.2 -// CHECK:STDOUT: %.loc13_29.4: init i32 = initialize_from %.loc13_22 to %.loc13_29.3 [template = constants.%.30] -// CHECK:STDOUT: %.loc13_29.5: i32 = int_value 1 [template = constants.%.30] +// CHECK:STDOUT: %.loc13_29.2: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_29.3: = bound_method %.loc13_22, %.loc13_29.2 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc13_29.1: init i32 = call %.loc13_29.3(%.loc13_22) [template = constants.%.32] +// CHECK:STDOUT: %.loc13_29.4: init i32 = converted %.loc13_22, %int.convert_checked.loc13_29.1 [template = constants.%.32] +// CHECK:STDOUT: %.loc13_29.5: i32 = int_value 0 [template = constants.%.6] // CHECK:STDOUT: %.loc13_29.6: ref i32 = array_index %a.var, %.loc13_29.5 -// CHECK:STDOUT: %.loc13_29.7: init i32 = initialize_from %.loc13_25 to %.loc13_29.6 [template = constants.%.31] -// CHECK:STDOUT: %.loc13_29.8: i32 = int_value 2 [template = constants.%.31] -// CHECK:STDOUT: %.loc13_29.9: ref i32 = array_index %a.var, %.loc13_29.8 -// CHECK:STDOUT: %.loc13_29.10: init i32 = initialize_from %.loc13_28 to %.loc13_29.9 [template = constants.%.1] -// CHECK:STDOUT: %.loc13_29.11: init %.28 = array_init (%.loc13_29.4, %.loc13_29.7, %.loc13_29.10) to %a.var [template = constants.%array] -// CHECK:STDOUT: %.loc13_30: init %.28 = converted %.loc13_29.1, %.loc13_29.11 [template = constants.%array] +// CHECK:STDOUT: %.loc13_29.7: init i32 = initialize_from %.loc13_29.4 to %.loc13_29.6 [template = constants.%.32] +// CHECK:STDOUT: %.loc13_29.8: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_29.9: = bound_method %.loc13_25, %.loc13_29.8 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc13_29.2: init i32 = call %.loc13_29.9(%.loc13_25) [template = constants.%.34] +// CHECK:STDOUT: %.loc13_29.10: init i32 = converted %.loc13_25, %int.convert_checked.loc13_29.2 [template = constants.%.34] +// CHECK:STDOUT: %.loc13_29.11: i32 = int_value 1 [template = constants.%.32] +// CHECK:STDOUT: %.loc13_29.12: ref i32 = array_index %a.var, %.loc13_29.11 +// CHECK:STDOUT: %.loc13_29.13: init i32 = initialize_from %.loc13_29.10 to %.loc13_29.12 [template = constants.%.34] +// CHECK:STDOUT: %.loc13_29.14: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_29.15: = bound_method %.loc13_28, %.loc13_29.14 [template = constants.%.35] +// CHECK:STDOUT: %int.convert_checked.loc13_29.3: init i32 = call %.loc13_29.15(%.loc13_28) [template = constants.%.36] +// CHECK:STDOUT: %.loc13_29.16: init i32 = converted %.loc13_28, %int.convert_checked.loc13_29.3 [template = constants.%.36] +// CHECK:STDOUT: %.loc13_29.17: i32 = int_value 2 [template = constants.%.34] +// CHECK:STDOUT: %.loc13_29.18: ref i32 = array_index %a.var, %.loc13_29.17 +// CHECK:STDOUT: %.loc13_29.19: init i32 = initialize_from %.loc13_29.16 to %.loc13_29.18 [template = constants.%.36] +// CHECK:STDOUT: %.loc13_29.20: init %.2 = array_init (%.loc13_29.7, %.loc13_29.13, %.loc13_29.19) to %a.var [template = constants.%array] +// CHECK:STDOUT: %.loc13_30: init %.2 = converted %.loc13_29.1, %.loc13_29.20 [template = constants.%array] // CHECK:STDOUT: assign %a.var, %.loc13_30 // CHECK:STDOUT: %int.make_type_32.loc14_11: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %int.make_type_32.loc14_16: init type = call constants.%Int32() [template = i32] @@ -96,21 +108,33 @@ fn G() { // CHECK:STDOUT: %.loc14_24.5: type = converted %int.make_type_32.loc14_16, %.loc14_24.4 [template = i32] // CHECK:STDOUT: %.loc14_24.6: type = value_of_initializer %int.make_type_32.loc14_21 [template = i32] // CHECK:STDOUT: %.loc14_24.7: type = converted %int.make_type_32.loc14_21, %.loc14_24.6 [template = i32] -// CHECK:STDOUT: %.loc14_24.8: type = converted %.loc14_24.1, constants.%tuple.type.1 [template = constants.%tuple.type.1] -// CHECK:STDOUT: %b.var: ref %tuple.type.1 = var b -// CHECK:STDOUT: %b: ref %tuple.type.1 = bind_name b, %b.var -// CHECK:STDOUT: %.loc14_29: i32 = int_value 1 [template = constants.%.30] -// CHECK:STDOUT: %.loc14_32: i32 = int_value 2 [template = constants.%.31] -// CHECK:STDOUT: %.loc14_35: i32 = int_value 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc14_24.8: type = converted %.loc14_24.1, constants.%tuple.type.3 [template = constants.%tuple.type.3] +// CHECK:STDOUT: %b.var: ref %tuple.type.3 = var b +// CHECK:STDOUT: %b: ref %tuple.type.3 = bind_name b, %b.var +// CHECK:STDOUT: %.loc14_29: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc14_32: Core.IntLiteral = int_value 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc14_35: Core.IntLiteral = int_value 3 [template = constants.%.1] // CHECK:STDOUT: %.loc14_36.1: %tuple.type.1 = tuple_literal (%.loc14_29, %.loc14_32, %.loc14_35) -// CHECK:STDOUT: %.loc14_36.2: ref i32 = tuple_access %b.var, element0 -// CHECK:STDOUT: %.loc14_36.3: init i32 = initialize_from %.loc14_29 to %.loc14_36.2 [template = constants.%.30] -// CHECK:STDOUT: %.loc14_36.4: ref i32 = tuple_access %b.var, element1 -// CHECK:STDOUT: %.loc14_36.5: init i32 = initialize_from %.loc14_32 to %.loc14_36.4 [template = constants.%.31] -// CHECK:STDOUT: %.loc14_36.6: ref i32 = tuple_access %b.var, element2 -// CHECK:STDOUT: %.loc14_36.7: init i32 = initialize_from %.loc14_35 to %.loc14_36.6 [template = constants.%.1] -// CHECK:STDOUT: %.loc14_36.8: init %tuple.type.1 = tuple_init (%.loc14_36.3, %.loc14_36.5, %.loc14_36.7) to %b.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc14_37: init %tuple.type.1 = converted %.loc14_36.1, %.loc14_36.8 [template = constants.%tuple] +// CHECK:STDOUT: %.loc14_36.2: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc14_36.3: = bound_method %.loc14_29, %.loc14_36.2 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc14_36.1: init i32 = call %.loc14_36.3(%.loc14_29) [template = constants.%.32] +// CHECK:STDOUT: %.loc14_36.4: init i32 = converted %.loc14_29, %int.convert_checked.loc14_36.1 [template = constants.%.32] +// CHECK:STDOUT: %.loc14_36.5: ref i32 = tuple_access %b.var, element0 +// CHECK:STDOUT: %.loc14_36.6: init i32 = initialize_from %.loc14_36.4 to %.loc14_36.5 [template = constants.%.32] +// CHECK:STDOUT: %.loc14_36.7: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc14_36.8: = bound_method %.loc14_32, %.loc14_36.7 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc14_36.2: init i32 = call %.loc14_36.8(%.loc14_32) [template = constants.%.34] +// CHECK:STDOUT: %.loc14_36.9: init i32 = converted %.loc14_32, %int.convert_checked.loc14_36.2 [template = constants.%.34] +// CHECK:STDOUT: %.loc14_36.10: ref i32 = tuple_access %b.var, element1 +// CHECK:STDOUT: %.loc14_36.11: init i32 = initialize_from %.loc14_36.9 to %.loc14_36.10 [template = constants.%.34] +// CHECK:STDOUT: %.loc14_36.12: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc14_36.13: = bound_method %.loc14_35, %.loc14_36.12 [template = constants.%.35] +// CHECK:STDOUT: %int.convert_checked.loc14_36.3: init i32 = call %.loc14_36.13(%.loc14_35) [template = constants.%.36] +// CHECK:STDOUT: %.loc14_36.14: init i32 = converted %.loc14_35, %int.convert_checked.loc14_36.3 [template = constants.%.36] +// CHECK:STDOUT: %.loc14_36.15: ref i32 = tuple_access %b.var, element2 +// CHECK:STDOUT: %.loc14_36.16: init i32 = initialize_from %.loc14_36.14 to %.loc14_36.15 [template = constants.%.36] +// CHECK:STDOUT: %.loc14_36.17: init %tuple.type.3 = tuple_init (%.loc14_36.6, %.loc14_36.11, %.loc14_36.16) to %b.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc14_37: init %tuple.type.3 = converted %.loc14_36.1, %.loc14_36.17 [template = constants.%tuple] // CHECK:STDOUT: assign %b.var, %.loc14_37 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/array/assign_return_value.carbon b/toolchain/check/testdata/array/assign_return_value.carbon index ef3d0da8e364a..e32f1f6db904f 100644 --- a/toolchain/check/testdata/array/assign_return_value.carbon +++ b/toolchain/check/testdata/array/assign_return_value.carbon @@ -23,16 +23,17 @@ fn Run() { // CHECK:STDOUT: %tuple.type.2: type = tuple_type (i32) [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] -// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.1) [template] -// CHECK:STDOUT: %Run.type: type = fn_type @Run [template] -// CHECK:STDOUT: %Run: %Run.type = struct_value () [template] -// CHECK:STDOUT: %.2: i32 = int_value 1 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %tuple.type.3: type = tuple_type (Core.IntLiteral) [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: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.27: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.25: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 0 [template] +// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.27) [template] +// CHECK:STDOUT: %Run.type: type = fn_type @Run [template] +// CHECK:STDOUT: %Run: %Run.type = struct_value () [template] // CHECK:STDOUT: %.28: Core.IntLiteral = int_value 1 [template] // CHECK:STDOUT: %.29: type = array_type %.28, i32 [template] // CHECK:STDOUT: } @@ -70,25 +71,25 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> %tuple.type.2 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_28: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: %.loc11_30: %tuple.type.2 = tuple_literal (%.loc11_28) -// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.loc11_28) [template = constants.%tuple] -// CHECK:STDOUT: %.loc11_31: %tuple.type.2 = converted %.loc11_30, %tuple [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_28: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_30.1: %tuple.type.3 = tuple_literal (%.loc11_28) +// CHECK:STDOUT: %.loc11_30.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_30.3: = bound_method %.loc11_28, %.loc11_30.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc11_30.3(%.loc11_28) [template = constants.%.27] +// CHECK:STDOUT: %.loc11_30.4: i32 = value_of_initializer %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc11_30.5: i32 = converted %.loc11_28, %.loc11_30.4 [template = constants.%.27] +// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.loc11_30.5) [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_31: %tuple.type.2 = converted %.loc11_30.1, %tuple [template = constants.%tuple] // CHECK:STDOUT: return %.loc11_31 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc14_16.1: i32 = int_value 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc14_16: Core.IntLiteral = int_value 1 [template = constants.%.28] // CHECK:STDOUT: %.loc14_11.1: type = value_of_initializer %int.make_type_32 [template = i32] // CHECK:STDOUT: %.loc14_11.2: type = converted %int.make_type_32, %.loc14_11.1 [template = i32] -// CHECK:STDOUT: %.loc14_16.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc14_16.3: = bound_method %.loc14_16.1, %.loc14_16.2 [template = constants.%.27] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc14_16.3(%.loc14_16.1) [template = constants.%.28] -// CHECK:STDOUT: %.loc14_16.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.28] -// CHECK:STDOUT: %.loc14_16.5: Core.IntLiteral = converted %.loc14_16.1, %.loc14_16.4 [template = constants.%.28] -// CHECK:STDOUT: %.loc14_17: type = array_type %.loc14_16.5, i32 [template = constants.%.29] +// CHECK:STDOUT: %.loc14_17: type = array_type %.loc14_16, i32 [template = constants.%.29] // CHECK:STDOUT: %t.var: ref %.29 = var t // CHECK:STDOUT: %t: ref %.29 = bind_name t, %t.var // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [template = constants.%F] @@ -97,7 +98,7 @@ fn Run() { // CHECK:STDOUT: %.loc14_22.2: ref %tuple.type.2 = temporary %.loc14_22.1, %F.call // CHECK:STDOUT: %.loc14_22.3: ref i32 = tuple_access %.loc14_22.2, element0 // CHECK:STDOUT: %.loc14_22.4: i32 = bind_value %.loc14_22.3 -// CHECK:STDOUT: %.loc14_22.5: i32 = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc14_22.5: i32 = int_value 0 [template = constants.%.27] // CHECK:STDOUT: %.loc14_22.6: ref i32 = array_index %t.var, %.loc14_22.5 // CHECK:STDOUT: %.loc14_22.7: init i32 = initialize_from %.loc14_22.4 to %.loc14_22.6 // CHECK:STDOUT: %.loc14_22.8: init %.29 = array_init (%.loc14_22.7) to %t.var diff --git a/toolchain/check/testdata/array/assign_var.carbon b/toolchain/check/testdata/array/assign_var.carbon index 8907bdb69362d..19ca5eed9a6d7 100644 --- a/toolchain/check/testdata/array/assign_var.carbon +++ b/toolchain/check/testdata/array/assign_var.carbon @@ -18,18 +18,23 @@ var b: [i32; 3] = a; // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %tuple.type.1: type = tuple_type (type, type, type) [template] // CHECK:STDOUT: %tuple.type.2: type = tuple_type (i32, i32, i32) [template] -// CHECK:STDOUT: %.2: i32 = int_value 1 [template] -// CHECK:STDOUT: %.3: i32 = int_value 2 [template] -// CHECK:STDOUT: %.4: i32 = int_value 3 [template] -// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.2, %.3, %.4) [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %tuple.type.3: type = tuple_type (Core.IntLiteral, Core.IntLiteral, Core.IntLiteral) [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: %.28: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.29: = bound_method %.4, %Convert.15 [template] -// CHECK:STDOUT: %.30: Core.IntLiteral = int_value 3 [template] -// CHECK:STDOUT: %.31: type = array_type %.30, i32 [template] -// CHECK:STDOUT: %.33: i32 = int_value 0 [template] +// CHECK:STDOUT: %.29: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 1 [template] +// CHECK:STDOUT: %.31: = bound_method %.3, %Convert.15 [template] +// CHECK:STDOUT: %.32: i32 = int_value 2 [template] +// CHECK:STDOUT: %.33: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.34: i32 = int_value 3 [template] +// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.30, %.32, %.34) [template] +// CHECK:STDOUT: %.35: type = array_type %.4, i32 [template] +// CHECK:STDOUT: %.37: i32 = int_value 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -62,52 +67,59 @@ var b: [i32; 3] = a; // CHECK:STDOUT: %a.var: ref %tuple.type.2 = var a // CHECK:STDOUT: %a: ref %tuple.type.2 = bind_name a, %a.var // CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc12_14.1: i32 = int_value 3 [template = constants.%.4] +// CHECK:STDOUT: %.loc12_14: Core.IntLiteral = int_value 3 [template = constants.%.4] // CHECK:STDOUT: %.loc12_9.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] // CHECK:STDOUT: %.loc12_9.2: type = converted %int.make_type_32.loc12, %.loc12_9.1 [template = i32] -// CHECK:STDOUT: %.loc12_14.2: %Convert.type.2 = interface_witness_access constants.%.28, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc12_14.3: = bound_method %.loc12_14.1, %.loc12_14.2 [template = constants.%.29] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc12_14.3(%.loc12_14.1) [template = constants.%.30] -// CHECK:STDOUT: %.loc12_14.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.30] -// CHECK:STDOUT: %.loc12_14.5: Core.IntLiteral = converted %.loc12_14.1, %.loc12_14.4 [template = constants.%.30] -// CHECK:STDOUT: %.loc12_15: type = array_type %.loc12_14.5, i32 [template = constants.%.31] -// CHECK:STDOUT: %b.var: ref %.31 = var b -// CHECK:STDOUT: %b: ref %.31 = bind_name b, %b.var +// CHECK:STDOUT: %.loc12_15: type = array_type %.loc12_14, i32 [template = constants.%.35] +// CHECK:STDOUT: %b.var: ref %.35 = var b +// CHECK:STDOUT: %b: ref %.35 = bind_name b, %b.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_27: i32 = int_value 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_30: i32 = int_value 2 [template = constants.%.3] -// CHECK:STDOUT: %.loc11_33: i32 = int_value 3 [template = constants.%.4] -// CHECK:STDOUT: %.loc11_34.1: %tuple.type.2 = tuple_literal (%.loc11_27, %.loc11_30, %.loc11_33) -// CHECK:STDOUT: %.loc11_34.2: ref i32 = tuple_access file.%a.var, element0 -// CHECK:STDOUT: %.loc11_34.3: init i32 = initialize_from %.loc11_27 to %.loc11_34.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_34.4: ref i32 = tuple_access file.%a.var, element1 -// CHECK:STDOUT: %.loc11_34.5: init i32 = initialize_from %.loc11_30 to %.loc11_34.4 [template = constants.%.3] -// CHECK:STDOUT: %.loc11_34.6: ref i32 = tuple_access file.%a.var, element2 -// CHECK:STDOUT: %.loc11_34.7: init i32 = initialize_from %.loc11_33 to %.loc11_34.6 [template = constants.%.4] -// CHECK:STDOUT: %.loc11_34.8: init %tuple.type.2 = tuple_init (%.loc11_34.3, %.loc11_34.5, %.loc11_34.7) to file.%a.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc11_35: init %tuple.type.2 = converted %.loc11_34.1, %.loc11_34.8 [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_27: Core.IntLiteral = int_value 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_30: Core.IntLiteral = int_value 2 [template = constants.%.3] +// CHECK:STDOUT: %.loc11_33: Core.IntLiteral = int_value 3 [template = constants.%.4] +// CHECK:STDOUT: %.loc11_34.1: %tuple.type.3 = tuple_literal (%.loc11_27, %.loc11_30, %.loc11_33) +// CHECK:STDOUT: %.loc11_34.2: %Convert.type.2 = interface_witness_access constants.%.28, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_34.3: = bound_method %.loc11_27, %.loc11_34.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc11_34.1: init i32 = call %.loc11_34.3(%.loc11_27) [template = constants.%.30] +// CHECK:STDOUT: %.loc11_34.4: init i32 = converted %.loc11_27, %int.convert_checked.loc11_34.1 [template = constants.%.30] +// CHECK:STDOUT: %.loc11_34.5: ref i32 = tuple_access file.%a.var, element0 +// CHECK:STDOUT: %.loc11_34.6: init i32 = initialize_from %.loc11_34.4 to %.loc11_34.5 [template = constants.%.30] +// CHECK:STDOUT: %.loc11_34.7: %Convert.type.2 = interface_witness_access constants.%.28, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_34.8: = bound_method %.loc11_30, %.loc11_34.7 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc11_34.2: init i32 = call %.loc11_34.8(%.loc11_30) [template = constants.%.32] +// CHECK:STDOUT: %.loc11_34.9: init i32 = converted %.loc11_30, %int.convert_checked.loc11_34.2 [template = constants.%.32] +// CHECK:STDOUT: %.loc11_34.10: ref i32 = tuple_access file.%a.var, element1 +// CHECK:STDOUT: %.loc11_34.11: init i32 = initialize_from %.loc11_34.9 to %.loc11_34.10 [template = constants.%.32] +// CHECK:STDOUT: %.loc11_34.12: %Convert.type.2 = interface_witness_access constants.%.28, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_34.13: = bound_method %.loc11_33, %.loc11_34.12 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc11_34.3: init i32 = call %.loc11_34.13(%.loc11_33) [template = constants.%.34] +// CHECK:STDOUT: %.loc11_34.14: init i32 = converted %.loc11_33, %int.convert_checked.loc11_34.3 [template = constants.%.34] +// CHECK:STDOUT: %.loc11_34.15: ref i32 = tuple_access file.%a.var, element2 +// CHECK:STDOUT: %.loc11_34.16: init i32 = initialize_from %.loc11_34.14 to %.loc11_34.15 [template = constants.%.34] +// CHECK:STDOUT: %.loc11_34.17: init %tuple.type.2 = tuple_init (%.loc11_34.6, %.loc11_34.11, %.loc11_34.16) to file.%a.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_35: init %tuple.type.2 = converted %.loc11_34.1, %.loc11_34.17 [template = constants.%tuple] // CHECK:STDOUT: assign file.%a.var, %.loc11_35 // CHECK:STDOUT: %a.ref: ref %tuple.type.2 = name_ref a, file.%a // CHECK:STDOUT: %.loc12_19.1: ref i32 = tuple_access %a.ref, element0 // CHECK:STDOUT: %.loc12_19.2: i32 = bind_value %.loc12_19.1 -// CHECK:STDOUT: %.loc12_19.3: i32 = int_value 0 [template = constants.%.33] +// CHECK:STDOUT: %.loc12_19.3: i32 = int_value 0 [template = constants.%.37] // CHECK:STDOUT: %.loc12_19.4: ref i32 = array_index file.%b.var, %.loc12_19.3 // CHECK:STDOUT: %.loc12_19.5: init i32 = initialize_from %.loc12_19.2 to %.loc12_19.4 // CHECK:STDOUT: %.loc12_19.6: ref i32 = tuple_access %a.ref, element1 // CHECK:STDOUT: %.loc12_19.7: i32 = bind_value %.loc12_19.6 -// CHECK:STDOUT: %.loc12_19.8: i32 = int_value 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc12_19.8: i32 = int_value 1 [template = constants.%.30] // CHECK:STDOUT: %.loc12_19.9: ref i32 = array_index file.%b.var, %.loc12_19.8 // CHECK:STDOUT: %.loc12_19.10: init i32 = initialize_from %.loc12_19.7 to %.loc12_19.9 // CHECK:STDOUT: %.loc12_19.11: ref i32 = tuple_access %a.ref, element2 // CHECK:STDOUT: %.loc12_19.12: i32 = bind_value %.loc12_19.11 -// CHECK:STDOUT: %.loc12_19.13: i32 = int_value 2 [template = constants.%.3] +// CHECK:STDOUT: %.loc12_19.13: i32 = int_value 2 [template = constants.%.32] // CHECK:STDOUT: %.loc12_19.14: ref i32 = array_index file.%b.var, %.loc12_19.13 // CHECK:STDOUT: %.loc12_19.15: init i32 = initialize_from %.loc12_19.12 to %.loc12_19.14 -// CHECK:STDOUT: %.loc12_19.16: init %.31 = array_init (%.loc12_19.5, %.loc12_19.10, %.loc12_19.15) to file.%b.var -// CHECK:STDOUT: %.loc12_20: init %.31 = converted %a.ref, %.loc12_19.16 +// CHECK:STDOUT: %.loc12_19.16: init %.35 = array_init (%.loc12_19.5, %.loc12_19.10, %.loc12_19.15) to file.%b.var +// CHECK:STDOUT: %.loc12_20: init %.35 = converted %a.ref, %.loc12_19.16 // CHECK:STDOUT: assign file.%b.var, %.loc12_20 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/array/base.carbon b/toolchain/check/testdata/array/base.carbon index e4314a29fff56..a21780a187132 100644 --- a/toolchain/check/testdata/array/base.carbon +++ b/toolchain/check/testdata/array/base.carbon @@ -18,37 +18,34 @@ var c: [(); 5] = ((), (), (), (), (),); // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.2: type = array_type %.1, i32 [template] +// CHECK:STDOUT: %tuple.type.1: type = tuple_type (Core.IntLiteral) [template] +// CHECK:STDOUT: %.4: i32 = int_value 0 [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: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] -// CHECK:STDOUT: %.27: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %.28: type = array_type %.27, i32 [template] -// CHECK:STDOUT: %tuple.type.1: type = tuple_type (i32) [template] -// CHECK:STDOUT: %.30: i32 = int_value 0 [template] -// CHECK:STDOUT: %array.1: %.28 = tuple_value (%.1) [template] +// CHECK:STDOUT: %.28: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.29: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 1 [template] +// CHECK:STDOUT: %array.1: %.2 = tuple_value (%.30) [template] // CHECK:STDOUT: %.31: Core.IntLiteral = int_value 64 [template] // CHECK:STDOUT: %Float.type: type = fn_type @Float [template] // CHECK:STDOUT: %Float: %Float.type = struct_value () [template] -// CHECK:STDOUT: %.32: i32 = int_value 2 [template] -// CHECK:STDOUT: %.33: = bound_method %.32, %Convert.15 [template] -// CHECK:STDOUT: %.34: Core.IntLiteral = int_value 2 [template] -// CHECK:STDOUT: %.35: type = array_type %.34, f64 [template] -// CHECK:STDOUT: %.37: f64 = float_literal 11.100000000000001 [template] -// CHECK:STDOUT: %.38: f64 = float_literal 2.2000000000000002 [template] +// CHECK:STDOUT: %.32: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.33: type = array_type %.32, f64 [template] +// CHECK:STDOUT: %.35: f64 = float_literal 11.100000000000001 [template] +// CHECK:STDOUT: %.36: f64 = float_literal 2.2000000000000002 [template] // CHECK:STDOUT: %tuple.type.2: type = tuple_type (f64, f64) [template] -// CHECK:STDOUT: %array.2: %.35 = tuple_value (%.37, %.38) [template] -// CHECK:STDOUT: %.39: i32 = int_value 5 [template] -// CHECK:STDOUT: %.40: = bound_method %.39, %Convert.15 [template] -// CHECK:STDOUT: %.41: Core.IntLiteral = int_value 5 [template] -// CHECK:STDOUT: %.42: type = array_type %.41, %empty_tuple.type [template] +// CHECK:STDOUT: %array.2: %.33 = tuple_value (%.35, %.36) [template] +// CHECK:STDOUT: %.37: Core.IntLiteral = int_value 5 [template] +// CHECK:STDOUT: %.38: type = array_type %.37, %empty_tuple.type [template] // CHECK:STDOUT: %tuple.type.3: type = tuple_type (%empty_tuple.type, %empty_tuple.type, %empty_tuple.type, %empty_tuple.type, %empty_tuple.type) [template] // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [template] -// CHECK:STDOUT: %.44: i32 = int_value 3 [template] -// CHECK:STDOUT: %.45: i32 = int_value 4 [template] -// CHECK:STDOUT: %array.3: %.42 = tuple_value (%empty_tuple, %empty_tuple, %empty_tuple, %empty_tuple, %empty_tuple) [template] +// CHECK:STDOUT: %.40: i32 = int_value 2 [template] +// CHECK:STDOUT: %.41: i32 = int_value 3 [template] +// CHECK:STDOUT: %.42: i32 = int_value 4 [template] +// CHECK:STDOUT: %array.3: %.38 = tuple_value (%empty_tuple, %empty_tuple, %empty_tuple, %empty_tuple, %empty_tuple) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -70,64 +67,53 @@ var c: [(); 5] = ((), (), (), (), (),); // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc11_14.1: i32 = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_14: Core.IntLiteral = int_value 1 [template = constants.%.1] // CHECK:STDOUT: %.loc11_9.1: type = value_of_initializer %int.make_type_32 [template = i32] // CHECK:STDOUT: %.loc11_9.2: type = converted %int.make_type_32, %.loc11_9.1 [template = i32] -// CHECK:STDOUT: %.loc11_14.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc11_14.3: = bound_method %.loc11_14.1, %.loc11_14.2 [template = constants.%.26] -// CHECK:STDOUT: %int.convert_checked.loc11: init Core.IntLiteral = call %.loc11_14.3(%.loc11_14.1) [template = constants.%.27] -// CHECK:STDOUT: %.loc11_14.4: Core.IntLiteral = value_of_initializer %int.convert_checked.loc11 [template = constants.%.27] -// CHECK:STDOUT: %.loc11_14.5: Core.IntLiteral = converted %.loc11_14.1, %.loc11_14.4 [template = constants.%.27] -// CHECK:STDOUT: %.loc11_15: type = array_type %.loc11_14.5, i32 [template = constants.%.28] -// CHECK:STDOUT: %a.var: ref %.28 = var a -// CHECK:STDOUT: %a: ref %.28 = bind_name a, %a.var +// CHECK:STDOUT: %.loc11_15: type = array_type %.loc11_14, i32 [template = constants.%.2] +// CHECK:STDOUT: %a.var: ref %.2 = var a +// CHECK:STDOUT: %a: ref %.2 = bind_name a, %a.var // CHECK:STDOUT: %.loc12_9.1: Core.IntLiteral = int_value 64 [template = constants.%.31] // CHECK:STDOUT: %float.make_type: init type = call constants.%Float(%.loc12_9.1) [template = f64] -// CHECK:STDOUT: %.loc12_14.1: i32 = int_value 2 [template = constants.%.32] +// CHECK:STDOUT: %.loc12_14: Core.IntLiteral = int_value 2 [template = constants.%.32] // CHECK:STDOUT: %.loc12_9.2: type = value_of_initializer %float.make_type [template = f64] // CHECK:STDOUT: %.loc12_9.3: type = converted %float.make_type, %.loc12_9.2 [template = f64] -// CHECK:STDOUT: %.loc12_14.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc12_14.3: = bound_method %.loc12_14.1, %.loc12_14.2 [template = constants.%.33] -// CHECK:STDOUT: %int.convert_checked.loc12: init Core.IntLiteral = call %.loc12_14.3(%.loc12_14.1) [template = constants.%.34] -// CHECK:STDOUT: %.loc12_14.4: Core.IntLiteral = value_of_initializer %int.convert_checked.loc12 [template = constants.%.34] -// CHECK:STDOUT: %.loc12_14.5: Core.IntLiteral = converted %.loc12_14.1, %.loc12_14.4 [template = constants.%.34] -// CHECK:STDOUT: %.loc12_15: type = array_type %.loc12_14.5, f64 [template = constants.%.35] -// CHECK:STDOUT: %b.var: ref %.35 = var b -// CHECK:STDOUT: %b: ref %.35 = bind_name b, %b.var +// CHECK:STDOUT: %.loc12_15: type = array_type %.loc12_14, f64 [template = constants.%.33] +// CHECK:STDOUT: %b.var: ref %.33 = var b +// CHECK:STDOUT: %b: ref %.33 = bind_name b, %b.var // CHECK:STDOUT: %.loc13_10.1: %empty_tuple.type = tuple_literal () -// CHECK:STDOUT: %.loc13_13.1: i32 = int_value 5 [template = constants.%.39] +// CHECK:STDOUT: %.loc13_13: Core.IntLiteral = int_value 5 [template = constants.%.37] // CHECK:STDOUT: %.loc13_10.2: type = converted %.loc13_10.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc13_13.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc13_13.3: = bound_method %.loc13_13.1, %.loc13_13.2 [template = constants.%.40] -// CHECK:STDOUT: %int.convert_checked.loc13: init Core.IntLiteral = call %.loc13_13.3(%.loc13_13.1) [template = constants.%.41] -// CHECK:STDOUT: %.loc13_13.4: Core.IntLiteral = value_of_initializer %int.convert_checked.loc13 [template = constants.%.41] -// CHECK:STDOUT: %.loc13_13.5: Core.IntLiteral = converted %.loc13_13.1, %.loc13_13.4 [template = constants.%.41] -// CHECK:STDOUT: %.loc13_14: type = array_type %.loc13_13.5, %empty_tuple.type [template = constants.%.42] -// CHECK:STDOUT: %c.var: ref %.42 = var c -// CHECK:STDOUT: %c: ref %.42 = bind_name c, %c.var +// CHECK:STDOUT: %.loc13_14: type = array_type %.loc13_13, %empty_tuple.type [template = constants.%.38] +// CHECK:STDOUT: %c.var: ref %.38 = var c +// CHECK:STDOUT: %c: ref %.38 = bind_name c, %c.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_20: i32 = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_20: Core.IntLiteral = int_value 1 [template = constants.%.1] // CHECK:STDOUT: %.loc11_22.1: %tuple.type.1 = tuple_literal (%.loc11_20) -// CHECK:STDOUT: %.loc11_22.2: i32 = int_value 0 [template = constants.%.30] -// CHECK:STDOUT: %.loc11_22.3: ref i32 = array_index file.%a.var, %.loc11_22.2 -// CHECK:STDOUT: %.loc11_22.4: init i32 = initialize_from %.loc11_20 to %.loc11_22.3 [template = constants.%.1] -// CHECK:STDOUT: %.loc11_22.5: init %.28 = array_init (%.loc11_22.4) to file.%a.var [template = constants.%array.1] -// CHECK:STDOUT: %.loc11_23: init %.28 = converted %.loc11_22.1, %.loc11_22.5 [template = constants.%array.1] +// CHECK:STDOUT: %.loc11_22.2: %Convert.type.2 = interface_witness_access constants.%.28, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_22.3: = bound_method %.loc11_20, %.loc11_22.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc11_22.3(%.loc11_20) [template = constants.%.30] +// CHECK:STDOUT: %.loc11_22.4: init i32 = converted %.loc11_20, %int.convert_checked [template = constants.%.30] +// CHECK:STDOUT: %.loc11_22.5: i32 = int_value 0 [template = constants.%.4] +// CHECK:STDOUT: %.loc11_22.6: ref i32 = array_index file.%a.var, %.loc11_22.5 +// CHECK:STDOUT: %.loc11_22.7: init i32 = initialize_from %.loc11_22.4 to %.loc11_22.6 [template = constants.%.30] +// CHECK:STDOUT: %.loc11_22.8: init %.2 = array_init (%.loc11_22.7) to file.%a.var [template = constants.%array.1] +// CHECK:STDOUT: %.loc11_23: init %.2 = converted %.loc11_22.1, %.loc11_22.8 [template = constants.%array.1] // CHECK:STDOUT: assign file.%a.var, %.loc11_23 -// CHECK:STDOUT: %.loc12_20: f64 = float_literal 11.100000000000001 [template = constants.%.37] -// CHECK:STDOUT: %.loc12_26: f64 = float_literal 2.2000000000000002 [template = constants.%.38] +// CHECK:STDOUT: %.loc12_20: f64 = float_literal 11.100000000000001 [template = constants.%.35] +// CHECK:STDOUT: %.loc12_26: f64 = float_literal 2.2000000000000002 [template = constants.%.36] // CHECK:STDOUT: %.loc12_30.1: %tuple.type.2 = tuple_literal (%.loc12_20, %.loc12_26) -// CHECK:STDOUT: %.loc12_30.2: i32 = int_value 0 [template = constants.%.30] +// CHECK:STDOUT: %.loc12_30.2: i32 = int_value 0 [template = constants.%.4] // CHECK:STDOUT: %.loc12_30.3: ref f64 = array_index file.%b.var, %.loc12_30.2 -// CHECK:STDOUT: %.loc12_30.4: init f64 = initialize_from %.loc12_20 to %.loc12_30.3 [template = constants.%.37] -// CHECK:STDOUT: %.loc12_30.5: i32 = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc12_30.4: init f64 = initialize_from %.loc12_20 to %.loc12_30.3 [template = constants.%.35] +// CHECK:STDOUT: %.loc12_30.5: i32 = int_value 1 [template = constants.%.30] // CHECK:STDOUT: %.loc12_30.6: ref f64 = array_index file.%b.var, %.loc12_30.5 -// CHECK:STDOUT: %.loc12_30.7: init f64 = initialize_from %.loc12_26 to %.loc12_30.6 [template = constants.%.38] -// CHECK:STDOUT: %.loc12_30.8: init %.35 = array_init (%.loc12_30.4, %.loc12_30.7) to file.%b.var [template = constants.%array.2] -// CHECK:STDOUT: %.loc12_31: init %.35 = converted %.loc12_30.1, %.loc12_30.8 [template = constants.%array.2] +// CHECK:STDOUT: %.loc12_30.7: init f64 = initialize_from %.loc12_26 to %.loc12_30.6 [template = constants.%.36] +// CHECK:STDOUT: %.loc12_30.8: init %.33 = array_init (%.loc12_30.4, %.loc12_30.7) to file.%b.var [template = constants.%array.2] +// CHECK:STDOUT: %.loc12_31: init %.33 = converted %.loc12_30.1, %.loc12_30.8 [template = constants.%array.2] // CHECK:STDOUT: assign file.%b.var, %.loc12_31 // CHECK:STDOUT: %.loc13_20.1: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc13_24.1: %empty_tuple.type = tuple_literal () @@ -135,28 +121,28 @@ var c: [(); 5] = ((), (), (), (), (),); // CHECK:STDOUT: %.loc13_32.1: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc13_36.1: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc13_38.1: %tuple.type.3 = tuple_literal (%.loc13_20.1, %.loc13_24.1, %.loc13_28.1, %.loc13_32.1, %.loc13_36.1) -// CHECK:STDOUT: %.loc13_38.2: i32 = int_value 0 [template = constants.%.30] +// CHECK:STDOUT: %.loc13_38.2: i32 = int_value 0 [template = constants.%.4] // CHECK:STDOUT: %.loc13_38.3: ref %empty_tuple.type = array_index file.%c.var, %.loc13_38.2 // CHECK:STDOUT: %.loc13_20.2: init %empty_tuple.type = tuple_init () to %.loc13_38.3 [template = constants.%empty_tuple] // CHECK:STDOUT: %.loc13_38.4: init %empty_tuple.type = converted %.loc13_20.1, %.loc13_20.2 [template = constants.%empty_tuple] -// CHECK:STDOUT: %.loc13_38.5: i32 = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc13_38.5: i32 = int_value 1 [template = constants.%.30] // CHECK:STDOUT: %.loc13_38.6: ref %empty_tuple.type = array_index file.%c.var, %.loc13_38.5 // CHECK:STDOUT: %.loc13_24.2: init %empty_tuple.type = tuple_init () to %.loc13_38.6 [template = constants.%empty_tuple] // CHECK:STDOUT: %.loc13_38.7: init %empty_tuple.type = converted %.loc13_24.1, %.loc13_24.2 [template = constants.%empty_tuple] -// CHECK:STDOUT: %.loc13_38.8: i32 = int_value 2 [template = constants.%.32] +// CHECK:STDOUT: %.loc13_38.8: i32 = int_value 2 [template = constants.%.40] // CHECK:STDOUT: %.loc13_38.9: ref %empty_tuple.type = array_index file.%c.var, %.loc13_38.8 // CHECK:STDOUT: %.loc13_28.2: init %empty_tuple.type = tuple_init () to %.loc13_38.9 [template = constants.%empty_tuple] // CHECK:STDOUT: %.loc13_38.10: init %empty_tuple.type = converted %.loc13_28.1, %.loc13_28.2 [template = constants.%empty_tuple] -// CHECK:STDOUT: %.loc13_38.11: i32 = int_value 3 [template = constants.%.44] +// CHECK:STDOUT: %.loc13_38.11: i32 = int_value 3 [template = constants.%.41] // CHECK:STDOUT: %.loc13_38.12: ref %empty_tuple.type = array_index file.%c.var, %.loc13_38.11 // CHECK:STDOUT: %.loc13_32.2: init %empty_tuple.type = tuple_init () to %.loc13_38.12 [template = constants.%empty_tuple] // CHECK:STDOUT: %.loc13_38.13: init %empty_tuple.type = converted %.loc13_32.1, %.loc13_32.2 [template = constants.%empty_tuple] -// CHECK:STDOUT: %.loc13_38.14: i32 = int_value 4 [template = constants.%.45] +// CHECK:STDOUT: %.loc13_38.14: i32 = int_value 4 [template = constants.%.42] // CHECK:STDOUT: %.loc13_38.15: ref %empty_tuple.type = array_index file.%c.var, %.loc13_38.14 // CHECK:STDOUT: %.loc13_36.2: init %empty_tuple.type = tuple_init () to %.loc13_38.15 [template = constants.%empty_tuple] // CHECK:STDOUT: %.loc13_38.16: init %empty_tuple.type = converted %.loc13_36.1, %.loc13_36.2 [template = constants.%empty_tuple] -// CHECK:STDOUT: %.loc13_38.17: init %.42 = array_init (%.loc13_38.4, %.loc13_38.7, %.loc13_38.10, %.loc13_38.13, %.loc13_38.16) to file.%c.var [template = constants.%array.3] -// CHECK:STDOUT: %.loc13_39: init %.42 = converted %.loc13_38.1, %.loc13_38.17 [template = constants.%array.3] +// CHECK:STDOUT: %.loc13_38.17: init %.38 = array_init (%.loc13_38.4, %.loc13_38.7, %.loc13_38.10, %.loc13_38.13, %.loc13_38.16) to file.%c.var [template = constants.%array.3] +// CHECK:STDOUT: %.loc13_39: init %.38 = converted %.loc13_38.1, %.loc13_38.17 [template = constants.%array.3] // CHECK:STDOUT: assign file.%c.var, %.loc13_39 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/array/canonicalize_index.carbon b/toolchain/check/testdata/array/canonicalize_index.carbon index 14dea8f39910d..8feef2b8a96bd 100644 --- a/toolchain/check/testdata/array/canonicalize_index.carbon +++ b/toolchain/check/testdata/array/canonicalize_index.carbon @@ -28,26 +28,35 @@ let c: [i32; ConvertToU32(3)]* = &a; // CHECK:STDOUT: %.2: type = int_type unsigned, %.1 [template] // CHECK:STDOUT: %ConvertToU32.type: type = fn_type @ConvertToU32 [template] // CHECK:STDOUT: %ConvertToU32: %ConvertToU32.type = struct_value () [template] -// CHECK:STDOUT: %.3: i32 = int_value 1 [template] -// CHECK:STDOUT: %.4: i32 = int_value 2 [template] -// CHECK:STDOUT: %.5: i32 = int_value 3 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(i32) [template] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] // CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template] // CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template] -// CHECK:STDOUT: %.29: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.30: = bound_method %.5, %Convert.15 [template] -// CHECK:STDOUT: %.31: Core.IntLiteral = int_value 3 [template] -// CHECK:STDOUT: %.32: type = array_type %.31, i32 [template] -// CHECK:STDOUT: %.33: type = ptr_type %.32 [template] -// CHECK:STDOUT: %tuple.type: type = tuple_type (i32, i32, i32) [template] -// CHECK:STDOUT: %.34: i32 = int_value 0 [template] -// CHECK:STDOUT: %array: %.32 = tuple_value (%.3, %.4, %.5) [template] -// CHECK:STDOUT: %.35: %.2 = int_value 3 [template] -// CHECK:STDOUT: %Convert.type.16: type = fn_type @Convert.5, @impl.6(%.1) [template] +// CHECK:STDOUT: %.28: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.29: = bound_method %.3, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 1 [template] +// CHECK:STDOUT: %.31: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.32: i32 = int_value 2 [template] +// CHECK:STDOUT: %.33: i32 = int_value 3 [template] +// CHECK:STDOUT: %Convert.type.16: type = fn_type @Convert.12 [template] // CHECK:STDOUT: %Convert.16: %Convert.type.16 = struct_value () [template] -// CHECK:STDOUT: %.37: = interface_witness (%Convert.16) [template] -// CHECK:STDOUT: %.38: = bound_method %.35, %Convert.16 [template] -// CHECK:STDOUT: %.39: = specific_function %.38, @Convert.5(%.1) [template] +// CHECK:STDOUT: %.34: = interface_witness (%Convert.16) [template] +// CHECK:STDOUT: %.35: = bound_method %.33, %Convert.16 [template] +// CHECK:STDOUT: %.36: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.37: type = array_type %.36, i32 [template] +// CHECK:STDOUT: %.38: type = ptr_type %.37 [template] +// CHECK:STDOUT: %tuple.type: type = tuple_type (Core.IntLiteral, Core.IntLiteral, Core.IntLiteral) [template] +// CHECK:STDOUT: %.39: i32 = int_value 0 [template] +// CHECK:STDOUT: %.40: = bound_method %.36, %Convert.15 [template] +// CHECK:STDOUT: %array: %.37 = tuple_value (%.30, %.32, %.33) [template] +// CHECK:STDOUT: %.41: %.2 = int_value 3 [template] +// CHECK:STDOUT: %Convert.type.17: type = fn_type @Convert.5, @impl.6(%.1) [template] +// CHECK:STDOUT: %Convert.17: %Convert.type.17 = struct_value () [template] +// CHECK:STDOUT: %.43: = interface_witness (%Convert.17) [template] +// CHECK:STDOUT: %.44: = bound_method %.41, %Convert.17 [template] +// CHECK:STDOUT: %.45: = specific_function %.44, @Convert.5(%.1) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -114,48 +123,58 @@ let c: [i32; ConvertToU32(3)]* = &a; // CHECK:STDOUT: } // CHECK:STDOUT: %int.make_type_32.loc14: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %Add.ref: %Add.type = name_ref Add, %Add.decl [template = constants.%Add] -// CHECK:STDOUT: %.loc14_18: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc14_21: i32 = int_value 2 [template = constants.%.4] -// CHECK:STDOUT: %int.sadd: init i32 = call %Add.ref(%.loc14_18, %.loc14_21) [template = constants.%.5] +// CHECK:STDOUT: %.loc14_18.1: Core.IntLiteral = int_value 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc14_21.1: Core.IntLiteral = int_value 2 [template = constants.%.4] +// CHECK:STDOUT: %.loc14_18.2: %Convert.type.2 = interface_witness_access constants.%.28, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc14_18.3: = bound_method %.loc14_18.1, %.loc14_18.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc14_18: init i32 = call %.loc14_18.3(%.loc14_18.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc14_18.4: i32 = value_of_initializer %int.convert_checked.loc14_18 [template = constants.%.30] +// CHECK:STDOUT: %.loc14_18.5: i32 = converted %.loc14_18.1, %.loc14_18.4 [template = constants.%.30] +// CHECK:STDOUT: %.loc14_21.2: %Convert.type.2 = interface_witness_access constants.%.28, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc14_21.3: = bound_method %.loc14_21.1, %.loc14_21.2 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc14_21: init i32 = call %.loc14_21.3(%.loc14_21.1) [template = constants.%.32] +// CHECK:STDOUT: %.loc14_21.4: i32 = value_of_initializer %int.convert_checked.loc14_21 [template = constants.%.32] +// CHECK:STDOUT: %.loc14_21.5: i32 = converted %.loc14_21.1, %.loc14_21.4 [template = constants.%.32] +// CHECK:STDOUT: %int.sadd: init i32 = call %Add.ref(%.loc14_18.5, %.loc14_21.5) [template = constants.%.33] // CHECK:STDOUT: %.loc14_9.1: type = value_of_initializer %int.make_type_32.loc14 [template = i32] // CHECK:STDOUT: %.loc14_9.2: type = converted %int.make_type_32.loc14, %.loc14_9.1 [template = i32] -// CHECK:STDOUT: %.loc14_17.1: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc14_17.2: = bound_method %int.sadd, %.loc14_17.1 [template = constants.%.30] -// CHECK:STDOUT: %.loc14_17.3: i32 = value_of_initializer %int.sadd [template = constants.%.5] -// CHECK:STDOUT: %.loc14_17.4: i32 = converted %int.sadd, %.loc14_17.3 [template = constants.%.5] -// CHECK:STDOUT: %int.convert_checked.loc14: init Core.IntLiteral = call %.loc14_17.2(%.loc14_17.4) [template = constants.%.31] -// CHECK:STDOUT: %.loc14_17.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc14 [template = constants.%.31] -// CHECK:STDOUT: %.loc14_17.6: Core.IntLiteral = converted %int.sadd, %.loc14_17.5 [template = constants.%.31] -// CHECK:STDOUT: %.loc14_23: type = array_type %.loc14_17.6, i32 [template = constants.%.32] -// CHECK:STDOUT: %a.var: ref %.32 = var a -// CHECK:STDOUT: %a: ref %.32 = bind_name a, %a.var +// CHECK:STDOUT: %.loc14_17.1: %Convert.type.5 = interface_witness_access constants.%.34, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %.loc14_17.2: = bound_method %int.sadd, %.loc14_17.1 [template = constants.%.35] +// CHECK:STDOUT: %.loc14_17.3: i32 = value_of_initializer %int.sadd [template = constants.%.33] +// CHECK:STDOUT: %.loc14_17.4: i32 = converted %int.sadd, %.loc14_17.3 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc14_17: init Core.IntLiteral = call %.loc14_17.2(%.loc14_17.4) [template = constants.%.36] +// CHECK:STDOUT: %.loc14_17.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc14_17 [template = constants.%.36] +// CHECK:STDOUT: %.loc14_17.6: Core.IntLiteral = converted %int.sadd, %.loc14_17.5 [template = constants.%.36] +// CHECK:STDOUT: %.loc14_23: type = array_type %.loc14_17.6, i32 [template = constants.%.37] +// CHECK:STDOUT: %a.var: ref %.37 = var a +// CHECK:STDOUT: %a: ref %.37 = bind_name a, %a.var // CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc15_14.1: i32 = int_value 3 [template = constants.%.5] +// CHECK:STDOUT: %.loc15_14: Core.IntLiteral = int_value 3 [template = constants.%.36] // CHECK:STDOUT: %.loc15_9.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] // CHECK:STDOUT: %.loc15_9.2: type = converted %int.make_type_32.loc15, %.loc15_9.1 [template = i32] -// CHECK:STDOUT: %.loc15_14.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc15_14.3: = bound_method %.loc15_14.1, %.loc15_14.2 [template = constants.%.30] -// CHECK:STDOUT: %int.convert_checked.loc15: init Core.IntLiteral = call %.loc15_14.3(%.loc15_14.1) [template = constants.%.31] -// CHECK:STDOUT: %.loc15_14.4: Core.IntLiteral = value_of_initializer %int.convert_checked.loc15 [template = constants.%.31] -// CHECK:STDOUT: %.loc15_14.5: Core.IntLiteral = converted %.loc15_14.1, %.loc15_14.4 [template = constants.%.31] -// CHECK:STDOUT: %.loc15_15: type = array_type %.loc15_14.5, i32 [template = constants.%.32] -// CHECK:STDOUT: %.loc15_16: type = ptr_type %.32 [template = constants.%.33] +// CHECK:STDOUT: %.loc15_15: type = array_type %.loc15_14, i32 [template = constants.%.37] +// CHECK:STDOUT: %.loc15_16: type = ptr_type %.37 [template = constants.%.38] // CHECK:STDOUT: %int.make_type_32.loc16: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %ConvertToU32.ref: %ConvertToU32.type = name_ref ConvertToU32, %ConvertToU32.decl [template = constants.%ConvertToU32] -// CHECK:STDOUT: %.loc16_27: i32 = int_value 3 [template = constants.%.5] -// CHECK:STDOUT: %int.convert_checked.loc16_26.1: init %.2 = call %ConvertToU32.ref(%.loc16_27) [template = constants.%.35] +// CHECK:STDOUT: %.loc16_27.1: Core.IntLiteral = int_value 3 [template = constants.%.36] +// CHECK:STDOUT: %.loc16_27.2: %Convert.type.2 = interface_witness_access constants.%.28, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc16_27.3: = bound_method %.loc16_27.1, %.loc16_27.2 [template = constants.%.40] +// CHECK:STDOUT: %int.convert_checked.loc16_27: init i32 = call %.loc16_27.3(%.loc16_27.1) [template = constants.%.33] +// CHECK:STDOUT: %.loc16_27.4: i32 = value_of_initializer %int.convert_checked.loc16_27 [template = constants.%.33] +// CHECK:STDOUT: %.loc16_27.5: i32 = converted %.loc16_27.1, %.loc16_27.4 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc16_26.1: init %.2 = call %ConvertToU32.ref(%.loc16_27.5) [template = constants.%.41] // CHECK:STDOUT: %.loc16_9.1: type = value_of_initializer %int.make_type_32.loc16 [template = i32] // CHECK:STDOUT: %.loc16_9.2: type = converted %int.make_type_32.loc16, %.loc16_9.1 [template = i32] -// CHECK:STDOUT: %.loc16_26.1: %Convert.type.2 = interface_witness_access constants.%.37, element0 [template = constants.%Convert.16] -// CHECK:STDOUT: %.loc16_26.2: = bound_method %int.convert_checked.loc16_26.1, %.loc16_26.1 [template = constants.%.38] -// CHECK:STDOUT: %.loc16_26.3: = specific_function %.loc16_26.2, @Convert.5(constants.%.1) [template = constants.%.39] -// CHECK:STDOUT: %.loc16_26.4: %.2 = value_of_initializer %int.convert_checked.loc16_26.1 [template = constants.%.35] -// CHECK:STDOUT: %.loc16_26.5: %.2 = converted %int.convert_checked.loc16_26.1, %.loc16_26.4 [template = constants.%.35] -// CHECK:STDOUT: %int.convert_checked.loc16_26.2: init Core.IntLiteral = call %.loc16_26.3(%.loc16_26.5) [template = constants.%.31] -// CHECK:STDOUT: %.loc16_26.6: Core.IntLiteral = value_of_initializer %int.convert_checked.loc16_26.2 [template = constants.%.31] -// CHECK:STDOUT: %.loc16_26.7: Core.IntLiteral = converted %int.convert_checked.loc16_26.1, %.loc16_26.6 [template = constants.%.31] -// CHECK:STDOUT: %.loc16_29: type = array_type %.loc16_26.7, i32 [template = constants.%.32] -// CHECK:STDOUT: %.loc16_30: type = ptr_type %.32 [template = constants.%.33] +// CHECK:STDOUT: %.loc16_26.1: %Convert.type.5 = interface_witness_access constants.%.43, element0 [template = constants.%Convert.17] +// CHECK:STDOUT: %.loc16_26.2: = bound_method %int.convert_checked.loc16_26.1, %.loc16_26.1 [template = constants.%.44] +// CHECK:STDOUT: %.loc16_26.3: = specific_function %.loc16_26.2, @Convert.5(constants.%.1) [template = constants.%.45] +// CHECK:STDOUT: %.loc16_26.4: %.2 = value_of_initializer %int.convert_checked.loc16_26.1 [template = constants.%.41] +// CHECK:STDOUT: %.loc16_26.5: %.2 = converted %int.convert_checked.loc16_26.1, %.loc16_26.4 [template = constants.%.41] +// CHECK:STDOUT: %int.convert_checked.loc16_26.2: init Core.IntLiteral = call %.loc16_26.3(%.loc16_26.5) [template = constants.%.36] +// CHECK:STDOUT: %.loc16_26.6: Core.IntLiteral = value_of_initializer %int.convert_checked.loc16_26.2 [template = constants.%.36] +// CHECK:STDOUT: %.loc16_26.7: Core.IntLiteral = converted %int.convert_checked.loc16_26.1, %.loc16_26.6 [template = constants.%.36] +// CHECK:STDOUT: %.loc16_29: type = array_type %.loc16_26.7, i32 [template = constants.%.37] +// CHECK:STDOUT: %.loc16_30: type = ptr_type %.37 [template = constants.%.38] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Add(%a.param_patt: i32, %b.param_patt: i32) -> i32 = "int.sadd"; @@ -164,28 +183,40 @@ let c: [i32; ConvertToU32(3)]* = &a; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc14_28: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc14_31: i32 = int_value 2 [template = constants.%.4] -// CHECK:STDOUT: %.loc14_34: i32 = int_value 3 [template = constants.%.5] +// CHECK:STDOUT: %.loc14_28: Core.IntLiteral = int_value 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc14_31: Core.IntLiteral = int_value 2 [template = constants.%.4] +// CHECK:STDOUT: %.loc14_34: Core.IntLiteral = int_value 3 [template = constants.%.36] // CHECK:STDOUT: %.loc14_35.1: %tuple.type = tuple_literal (%.loc14_28, %.loc14_31, %.loc14_34) -// CHECK:STDOUT: %.loc14_35.2: i32 = int_value 0 [template = constants.%.34] -// CHECK:STDOUT: %.loc14_35.3: ref i32 = array_index file.%a.var, %.loc14_35.2 -// CHECK:STDOUT: %.loc14_35.4: init i32 = initialize_from %.loc14_28 to %.loc14_35.3 [template = constants.%.3] -// CHECK:STDOUT: %.loc14_35.5: i32 = int_value 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc14_35.2: %Convert.type.2 = interface_witness_access constants.%.28, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc14_35.3: = bound_method %.loc14_28, %.loc14_35.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc14_35.1: init i32 = call %.loc14_35.3(%.loc14_28) [template = constants.%.30] +// CHECK:STDOUT: %.loc14_35.4: init i32 = converted %.loc14_28, %int.convert_checked.loc14_35.1 [template = constants.%.30] +// CHECK:STDOUT: %.loc14_35.5: i32 = int_value 0 [template = constants.%.39] // CHECK:STDOUT: %.loc14_35.6: ref i32 = array_index file.%a.var, %.loc14_35.5 -// CHECK:STDOUT: %.loc14_35.7: init i32 = initialize_from %.loc14_31 to %.loc14_35.6 [template = constants.%.4] -// CHECK:STDOUT: %.loc14_35.8: i32 = int_value 2 [template = constants.%.4] -// CHECK:STDOUT: %.loc14_35.9: ref i32 = array_index file.%a.var, %.loc14_35.8 -// CHECK:STDOUT: %.loc14_35.10: init i32 = initialize_from %.loc14_34 to %.loc14_35.9 [template = constants.%.5] -// CHECK:STDOUT: %.loc14_35.11: init %.32 = array_init (%.loc14_35.4, %.loc14_35.7, %.loc14_35.10) to file.%a.var [template = constants.%array] -// CHECK:STDOUT: %.loc14_36: init %.32 = converted %.loc14_35.1, %.loc14_35.11 [template = constants.%array] +// CHECK:STDOUT: %.loc14_35.7: init i32 = initialize_from %.loc14_35.4 to %.loc14_35.6 [template = constants.%.30] +// CHECK:STDOUT: %.loc14_35.8: %Convert.type.2 = interface_witness_access constants.%.28, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc14_35.9: = bound_method %.loc14_31, %.loc14_35.8 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc14_35.2: init i32 = call %.loc14_35.9(%.loc14_31) [template = constants.%.32] +// CHECK:STDOUT: %.loc14_35.10: init i32 = converted %.loc14_31, %int.convert_checked.loc14_35.2 [template = constants.%.32] +// CHECK:STDOUT: %.loc14_35.11: i32 = int_value 1 [template = constants.%.30] +// CHECK:STDOUT: %.loc14_35.12: ref i32 = array_index file.%a.var, %.loc14_35.11 +// CHECK:STDOUT: %.loc14_35.13: init i32 = initialize_from %.loc14_35.10 to %.loc14_35.12 [template = constants.%.32] +// CHECK:STDOUT: %.loc14_35.14: %Convert.type.2 = interface_witness_access constants.%.28, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc14_35.15: = bound_method %.loc14_34, %.loc14_35.14 [template = constants.%.40] +// CHECK:STDOUT: %int.convert_checked.loc14_35.3: init i32 = call %.loc14_35.15(%.loc14_34) [template = constants.%.33] +// CHECK:STDOUT: %.loc14_35.16: init i32 = converted %.loc14_34, %int.convert_checked.loc14_35.3 [template = constants.%.33] +// CHECK:STDOUT: %.loc14_35.17: i32 = int_value 2 [template = constants.%.32] +// CHECK:STDOUT: %.loc14_35.18: ref i32 = array_index file.%a.var, %.loc14_35.17 +// CHECK:STDOUT: %.loc14_35.19: init i32 = initialize_from %.loc14_35.16 to %.loc14_35.18 [template = constants.%.33] +// CHECK:STDOUT: %.loc14_35.20: init %.37 = array_init (%.loc14_35.7, %.loc14_35.13, %.loc14_35.19) to file.%a.var [template = constants.%array] +// CHECK:STDOUT: %.loc14_36: init %.37 = converted %.loc14_35.1, %.loc14_35.20 [template = constants.%array] // CHECK:STDOUT: assign file.%a.var, %.loc14_36 -// CHECK:STDOUT: %a.ref.loc15: ref %.32 = name_ref a, file.%a -// CHECK:STDOUT: %.loc15: %.33 = addr_of %a.ref.loc15 -// CHECK:STDOUT: %b: %.33 = bind_name b, %.loc15 -// CHECK:STDOUT: %a.ref.loc16: ref %.32 = name_ref a, file.%a -// CHECK:STDOUT: %.loc16: %.33 = addr_of %a.ref.loc16 -// CHECK:STDOUT: %c: %.33 = bind_name c, %.loc16 +// CHECK:STDOUT: %a.ref.loc15: ref %.37 = name_ref a, file.%a +// CHECK:STDOUT: %.loc15: %.38 = addr_of %a.ref.loc15 +// CHECK:STDOUT: %b: %.38 = bind_name b, %.loc15 +// CHECK:STDOUT: %a.ref.loc16: ref %.37 = name_ref a, file.%a +// CHECK:STDOUT: %.loc16: %.38 = addr_of %a.ref.loc16 +// CHECK:STDOUT: %c: %.38 = bind_name c, %.loc16 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/array/fail_bound_negative.carbon b/toolchain/check/testdata/array/fail_bound_negative.carbon index 5b7c73edf9da8..32dd37bb4ff1d 100644 --- a/toolchain/check/testdata/array/fail_bound_negative.carbon +++ b/toolchain/check/testdata/array/fail_bound_negative.carbon @@ -22,14 +22,20 @@ var a: [i32; Negate(1)]; // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %Negate.type: type = fn_type @Negate [template] // CHECK:STDOUT: %Negate: %Negate.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %.2: i32 = int_value -1 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [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.5: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [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: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.27: = bound_method %.2, %Convert.15 [template] -// CHECK:STDOUT: %.28: Core.IntLiteral = int_value -1 [template] +// CHECK:STDOUT: %.25: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 1 [template] +// CHECK:STDOUT: %.28: i32 = int_value -1 [template] +// CHECK:STDOUT: %Convert.type.16: type = fn_type @Convert.12 [template] +// CHECK:STDOUT: %Convert.16: %Convert.type.16 = struct_value () [template] +// CHECK:STDOUT: %.29: = interface_witness (%Convert.16) [template] +// CHECK:STDOUT: %.30: = bound_method %.28, %Convert.16 [template] +// CHECK:STDOUT: %.31: Core.IntLiteral = int_value -1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -67,17 +73,22 @@ var a: [i32; Negate(1)]; // CHECK:STDOUT: } // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %Negate.ref: %Negate.type = name_ref Negate, %Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc16_21: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %int.snegate: init i32 = call %Negate.ref(%.loc16_21) [template = constants.%.2] +// CHECK:STDOUT: %.loc16_21.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc16_21.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc16_21.3: = bound_method %.loc16_21.1, %.loc16_21.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc16_21: init i32 = call %.loc16_21.3(%.loc16_21.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc16_21.4: i32 = value_of_initializer %int.convert_checked.loc16_21 [template = constants.%.27] +// CHECK:STDOUT: %.loc16_21.5: i32 = converted %.loc16_21.1, %.loc16_21.4 [template = constants.%.27] +// CHECK:STDOUT: %int.snegate: init i32 = call %Negate.ref(%.loc16_21.5) [template = constants.%.28] // CHECK:STDOUT: %.loc16_9.1: type = value_of_initializer %int.make_type_32 [template = i32] // CHECK:STDOUT: %.loc16_9.2: type = converted %int.make_type_32, %.loc16_9.1 [template = i32] -// CHECK:STDOUT: %.loc16_20.1: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc16_20.2: = bound_method %int.snegate, %.loc16_20.1 [template = constants.%.27] -// CHECK:STDOUT: %.loc16_20.3: i32 = value_of_initializer %int.snegate [template = constants.%.2] -// CHECK:STDOUT: %.loc16_20.4: i32 = converted %int.snegate, %.loc16_20.3 [template = constants.%.2] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc16_20.2(%.loc16_20.4) [template = constants.%.28] -// CHECK:STDOUT: %.loc16_20.5: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.28] -// CHECK:STDOUT: %.loc16_20.6: Core.IntLiteral = converted %int.snegate, %.loc16_20.5 [template = constants.%.28] +// CHECK:STDOUT: %.loc16_20.1: %Convert.type.5 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %.loc16_20.2: = bound_method %int.snegate, %.loc16_20.1 [template = constants.%.30] +// CHECK:STDOUT: %.loc16_20.3: i32 = value_of_initializer %int.snegate [template = constants.%.28] +// CHECK:STDOUT: %.loc16_20.4: i32 = converted %int.snegate, %.loc16_20.3 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked.loc16_20: init Core.IntLiteral = call %.loc16_20.2(%.loc16_20.4) [template = constants.%.31] +// CHECK:STDOUT: %.loc16_20.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc16_20 [template = constants.%.31] +// CHECK:STDOUT: %.loc16_20.6: Core.IntLiteral = converted %int.snegate, %.loc16_20.5 [template = constants.%.31] // CHECK:STDOUT: %.loc16_23: type = array_type %.loc16_20.6, i32 [template = ] // CHECK:STDOUT: %a.var: ref = var a // CHECK:STDOUT: %a: ref = bind_name a, %a.var diff --git a/toolchain/check/testdata/array/fail_bound_overflow.carbon b/toolchain/check/testdata/array/fail_bound_overflow.carbon index 257b21daa7c7a..e599af0acca57 100644 --- a/toolchain/check/testdata/array/fail_bound_overflow.carbon +++ b/toolchain/check/testdata/array/fail_bound_overflow.carbon @@ -8,25 +8,18 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/array/fail_bound_overflow.carbon -// TODO: Once we preserve the full value of integer literals in SemIR, check -// that we reject the array bound being too large. - -// CHECK:STDERR: fail_bound_overflow.carbon:[[@LINE+4]]:14: error: integer literal with value 39999999999999999993 does not fit in i32 [IntLiteralTooLargeForI32] +// CHECK:STDERR: fail_bound_overflow.carbon:[[@LINE+4]]:14: error: array bound of 39999999999999999993 is too large [ArrayBoundTooLarge] // CHECK:STDERR: var a: [i32; 39999999999999999993]; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: var a: [i32; 39999999999999999993]; -// CHECK:STDERR: fail_bound_overflow.carbon:[[@LINE+10]]:9: error: cannot implicitly convert from `i32` to `type` [ImplicitAsConversionFailure] +// CHECK:STDERR: fail_bound_overflow.carbon:[[@LINE+6]]:9: error: cannot implicitly convert from `Core.IntLiteral` to `type` [ImplicitAsConversionFailure] // CHECK:STDERR: var b: [1; 39999999999999999993]; // CHECK:STDERR: ^ -// CHECK:STDERR: fail_bound_overflow.carbon:[[@LINE+7]]:9: note: type `i32` does not implement interface `ImplicitAs(type)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_bound_overflow.carbon:[[@LINE+3]]:9: note: type `Core.IntLiteral` does not implement interface `ImplicitAs(type)` [MissingImplInMemberAccessNote] // CHECK:STDERR: var b: [1; 39999999999999999993]; // CHECK:STDERR: ^ -// CHECK:STDERR: -// CHECK:STDERR: fail_bound_overflow.carbon:[[@LINE+3]]:12: error: integer literal with value 39999999999999999993 does not fit in i32 [IntLiteralTooLargeForI32] -// CHECK:STDERR: var b: [1; 39999999999999999993]; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ var b: [1; 39999999999999999993]; // CHECK:STDOUT: --- fail_bound_overflow.carbon @@ -34,7 +27,8 @@ var b: [1; 39999999999999999993]; // CHECK:STDOUT: constants { // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 39999999999999999993 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -54,14 +48,16 @@ var b: [1; 39999999999999999993]; // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc18_9.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc18_9.2: type = converted %int.make_type_32, %.loc18_9.1 [template = i32] -// CHECK:STDOUT: %.loc18_34: type = array_type , i32 [template = ] +// CHECK:STDOUT: %.loc15_14: Core.IntLiteral = int_value 39999999999999999993 [template = constants.%.1] +// CHECK:STDOUT: %.loc15_9.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc15_9.2: type = converted %int.make_type_32, %.loc15_9.1 [template = i32] +// CHECK:STDOUT: %.loc15_34: type = array_type %.loc15_14, i32 [template = ] // CHECK:STDOUT: %a.var: ref = var a // CHECK:STDOUT: %a: ref = bind_name a, %a.var -// CHECK:STDOUT: %.loc30_9.1: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc30_9.2: type = converted %.loc30_9.1, [template = ] -// CHECK:STDOUT: %.loc30_32: type = array_type , [template = ] +// CHECK:STDOUT: %.loc23_9.1: Core.IntLiteral = int_value 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc23_12: Core.IntLiteral = int_value 39999999999999999993 [template = constants.%.1] +// CHECK:STDOUT: %.loc23_9.2: type = converted %.loc23_9.1, [template = ] +// CHECK:STDOUT: %.loc23_32: type = array_type %.loc23_12, [template = ] // CHECK:STDOUT: %b.var: ref = var b // CHECK:STDOUT: %b: ref = bind_name b, %b.var // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/array/fail_incomplete_element.carbon b/toolchain/check/testdata/array/fail_incomplete_element.carbon index 6f134235f5916..99dcf0d3b8acd 100644 --- a/toolchain/check/testdata/array/fail_incomplete_element.carbon +++ b/toolchain/check/testdata/array/fail_incomplete_element.carbon @@ -24,21 +24,14 @@ var p: Incomplete* = &a[0]; // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Incomplete: type = class_type @Incomplete [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [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: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] -// CHECK:STDOUT: %.27: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %.28: type = array_type %.27, %Incomplete [template] -// CHECK:STDOUT: %.29: type = ptr_type %Incomplete [template] -// CHECK:STDOUT: %.30: i32 = int_value 0 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.2: type = array_type %.1, %Incomplete [template] +// CHECK:STDOUT: %.3: type = ptr_type %Incomplete [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .ImplicitAs = %import_ref.1 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -54,19 +47,14 @@ var p: Incomplete* = &a[0]; // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %Incomplete.decl: type = class_decl @Incomplete [template = constants.%Incomplete] {} {} // CHECK:STDOUT: %Incomplete.ref.loc19: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete] -// CHECK:STDOUT: %.loc19_21.1: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc19_21.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc19_21.3: = bound_method %.loc19_21.1, %.loc19_21.2 [template = constants.%.26] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc19_21.3(%.loc19_21.1) [template = constants.%.27] -// CHECK:STDOUT: %.loc19_21.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.27] -// CHECK:STDOUT: %.loc19_21.5: Core.IntLiteral = converted %.loc19_21.1, %.loc19_21.4 [template = constants.%.27] -// CHECK:STDOUT: %.loc19_22: type = array_type %.loc19_21.5, %Incomplete [template = constants.%.28] +// CHECK:STDOUT: %.loc19_21: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc19_22: type = array_type %.loc19_21, %Incomplete [template = constants.%.2] // CHECK:STDOUT: %a.var: ref = var a // CHECK:STDOUT: %a: ref = bind_name a, %a.var // CHECK:STDOUT: %Incomplete.ref.loc21: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete] -// CHECK:STDOUT: %.loc21: type = ptr_type %Incomplete [template = constants.%.29] -// CHECK:STDOUT: %p.var: ref %.29 = var p -// CHECK:STDOUT: %p: ref %.29 = bind_name p, %p.var +// CHECK:STDOUT: %.loc21: type = ptr_type %Incomplete [template = constants.%.3] +// CHECK:STDOUT: %p.var: ref %.3 = var p +// CHECK:STDOUT: %p: ref %.3 = bind_name p, %p.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Incomplete; @@ -74,7 +62,7 @@ var p: Incomplete* = &a[0]; // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: ref = name_ref a, file.%a -// CHECK:STDOUT: %.loc21_25: i32 = int_value 0 [template = constants.%.30] +// CHECK:STDOUT: %.loc21_25: Core.IntLiteral = int_value 0 [template = constants.%.4] // CHECK:STDOUT: %.loc21_22: = addr_of [template = ] // CHECK:STDOUT: assign file.%p.var, // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/array/fail_invalid_type.carbon b/toolchain/check/testdata/array/fail_invalid_type.carbon index f444163a3b0ca..4903f905f5d29 100644 --- a/toolchain/check/testdata/array/fail_invalid_type.carbon +++ b/toolchain/check/testdata/array/fail_invalid_type.carbon @@ -8,10 +8,10 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/array/fail_invalid_type.carbon -// CHECK:STDERR: fail_invalid_type.carbon:[[@LINE+6]]:9: error: cannot implicitly convert from `i32` to `type` [ImplicitAsConversionFailure] +// CHECK:STDERR: fail_invalid_type.carbon:[[@LINE+6]]:9: error: cannot implicitly convert from `Core.IntLiteral` to `type` [ImplicitAsConversionFailure] // CHECK:STDERR: var a: [1; 1]; // CHECK:STDERR: ^ -// CHECK:STDERR: fail_invalid_type.carbon:[[@LINE+3]]:9: note: type `i32` does not implement interface `ImplicitAs(type)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_invalid_type.carbon:[[@LINE+3]]:9: note: type `Core.IntLiteral` does not implement interface `ImplicitAs(type)` [MissingImplInMemberAccessNote] // CHECK:STDERR: var a: [1; 1]; // CHECK:STDERR: ^ var a: [1; 1]; @@ -19,13 +19,7 @@ var a: [1; 1]; // CHECK:STDOUT: --- fail_invalid_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %Convert.type.6: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] -// CHECK:STDOUT: %Convert.type.16: type = fn_type @Convert.11 [template] -// CHECK:STDOUT: %Convert.16: %Convert.type.16 = struct_value () [template] -// CHECK:STDOUT: %.27: = interface_witness (%Convert.16) [template] -// CHECK:STDOUT: %.28: = bound_method %.1, %Convert.16 [template] -// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -42,15 +36,10 @@ var a: [1; 1]; // CHECK:STDOUT: .a = %a // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %.loc17_9.1: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc17_12.1: i32 = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc17_9.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc17_12: Core.IntLiteral = int_value 1 [template = constants.%.1] // CHECK:STDOUT: %.loc17_9.2: type = converted %.loc17_9.1, [template = ] -// CHECK:STDOUT: %.loc17_12.2: %Convert.type.6 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.16] -// CHECK:STDOUT: %.loc17_12.3: = bound_method %.loc17_12.1, %.loc17_12.2 [template = constants.%.28] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc17_12.3(%.loc17_12.1) [template = constants.%.29] -// CHECK:STDOUT: %.loc17_12.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.29] -// CHECK:STDOUT: %.loc17_12.5: Core.IntLiteral = converted %.loc17_12.1, %.loc17_12.4 [template = constants.%.29] -// CHECK:STDOUT: %.loc17_13: type = array_type %.loc17_12.5, [template = ] +// CHECK:STDOUT: %.loc17_13: type = array_type %.loc17_12, [template = ] // CHECK:STDOUT: %a.var: ref = var a // CHECK:STDOUT: %a: ref = bind_name a, %a.var // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/array/fail_out_of_bound.carbon b/toolchain/check/testdata/array/fail_out_of_bound.carbon index eb84bda7c575e..f02be98191250 100644 --- a/toolchain/check/testdata/array/fail_out_of_bound.carbon +++ b/toolchain/check/testdata/array/fail_out_of_bound.carbon @@ -18,23 +18,16 @@ var a: [i32; 1] = (1, 2, 3); // CHECK:STDOUT: constants { // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [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: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] -// CHECK:STDOUT: %.27: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %.28: type = array_type %.27, i32 [template] -// CHECK:STDOUT: %.30: i32 = int_value 2 [template] -// CHECK:STDOUT: %.31: i32 = int_value 3 [template] -// CHECK:STDOUT: %tuple.type: type = tuple_type (i32, i32, i32) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.2: type = array_type %.1, i32 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.5: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %tuple.type: type = tuple_type (Core.IntLiteral, Core.IntLiteral, Core.IntLiteral) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.2 +// CHECK:STDOUT: .Int32 = %import_ref // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -47,24 +40,19 @@ var a: [i32; 1] = (1, 2, 3); // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc14_14.1: i32 = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc14_14: Core.IntLiteral = int_value 1 [template = constants.%.1] // CHECK:STDOUT: %.loc14_9.1: type = value_of_initializer %int.make_type_32 [template = i32] // CHECK:STDOUT: %.loc14_9.2: type = converted %int.make_type_32, %.loc14_9.1 [template = i32] -// CHECK:STDOUT: %.loc14_14.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc14_14.3: = bound_method %.loc14_14.1, %.loc14_14.2 [template = constants.%.26] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc14_14.3(%.loc14_14.1) [template = constants.%.27] -// CHECK:STDOUT: %.loc14_14.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.27] -// CHECK:STDOUT: %.loc14_14.5: Core.IntLiteral = converted %.loc14_14.1, %.loc14_14.4 [template = constants.%.27] -// CHECK:STDOUT: %.loc14_15: type = array_type %.loc14_14.5, i32 [template = constants.%.28] -// CHECK:STDOUT: %a.var: ref %.28 = var a -// CHECK:STDOUT: %a: ref %.28 = bind_name a, %a.var +// CHECK:STDOUT: %.loc14_15: type = array_type %.loc14_14, i32 [template = constants.%.2] +// CHECK:STDOUT: %a.var: ref %.2 = var a +// CHECK:STDOUT: %a: ref %.2 = bind_name a, %a.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc14_20: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc14_23: i32 = int_value 2 [template = constants.%.30] -// CHECK:STDOUT: %.loc14_26: i32 = int_value 3 [template = constants.%.31] +// CHECK:STDOUT: %.loc14_20: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc14_23: Core.IntLiteral = int_value 2 [template = constants.%.4] +// CHECK:STDOUT: %.loc14_26: Core.IntLiteral = int_value 3 [template = constants.%.5] // CHECK:STDOUT: %.loc14_27: %tuple.type = tuple_literal (%.loc14_20, %.loc14_23, %.loc14_26) // CHECK:STDOUT: assign file.%a.var, // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/array/fail_out_of_bound_non_literal.carbon b/toolchain/check/testdata/array/fail_out_of_bound_non_literal.carbon index fb234e4ce19d4..ca773daf84c31 100644 --- a/toolchain/check/testdata/array/fail_out_of_bound_non_literal.carbon +++ b/toolchain/check/testdata/array/fail_out_of_bound_non_literal.carbon @@ -19,21 +19,25 @@ var b: i32 = a[{.index = 3}.index]; // CHECK:STDOUT: constants { // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 3 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.2: type = array_type %.1, i32 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.5: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %tuple.type: type = tuple_type (Core.IntLiteral, Core.IntLiteral, Core.IntLiteral) [template] +// CHECK:STDOUT: %.6: i32 = int_value 0 [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: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] -// CHECK:STDOUT: %.27: Core.IntLiteral = int_value 3 [template] -// CHECK:STDOUT: %.28: type = array_type %.27, i32 [template] -// CHECK:STDOUT: %.30: i32 = int_value 1 [template] -// CHECK:STDOUT: %.31: i32 = int_value 2 [template] -// CHECK:STDOUT: %tuple.type: type = tuple_type (i32, i32, i32) [template] -// CHECK:STDOUT: %.32: i32 = int_value 0 [template] -// CHECK:STDOUT: %array: %.28 = tuple_value (%.30, %.31, %.1) [template] -// CHECK:STDOUT: %.33: type = struct_type {.index: i32} [template] -// CHECK:STDOUT: %struct: %.33 = struct_value (%.1) [template] +// CHECK:STDOUT: %.30: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.31: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.32: i32 = int_value 1 [template] +// CHECK:STDOUT: %.33: = bound_method %.5, %Convert.15 [template] +// CHECK:STDOUT: %.34: i32 = int_value 2 [template] +// CHECK:STDOUT: %.35: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.36: i32 = int_value 3 [template] +// CHECK:STDOUT: %array: %.2 = tuple_value (%.32, %.34, %.36) [template] +// CHECK:STDOUT: %.37: type = struct_type {.index: Core.IntLiteral} [template] +// CHECK:STDOUT: %struct: %.37 = struct_value (%.1) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -53,17 +57,12 @@ var b: i32 = a[{.index = 3}.index]; // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc11_14.1: i32 = int_value 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_14: Core.IntLiteral = int_value 3 [template = constants.%.1] // CHECK:STDOUT: %.loc11_9.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] // CHECK:STDOUT: %.loc11_9.2: type = converted %int.make_type_32.loc11, %.loc11_9.1 [template = i32] -// CHECK:STDOUT: %.loc11_14.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc11_14.3: = bound_method %.loc11_14.1, %.loc11_14.2 [template = constants.%.26] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc11_14.3(%.loc11_14.1) [template = constants.%.27] -// CHECK:STDOUT: %.loc11_14.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.27] -// CHECK:STDOUT: %.loc11_14.5: Core.IntLiteral = converted %.loc11_14.1, %.loc11_14.4 [template = constants.%.27] -// CHECK:STDOUT: %.loc11_15: type = array_type %.loc11_14.5, i32 [template = constants.%.28] -// CHECK:STDOUT: %a.var: ref %.28 = var a -// CHECK:STDOUT: %a: ref %.28 = bind_name a, %a.var +// CHECK:STDOUT: %.loc11_15: type = array_type %.loc11_14, i32 [template = constants.%.2] +// CHECK:STDOUT: %a.var: ref %.2 = var a +// CHECK:STDOUT: %a: ref %.2 = bind_name a, %a.var // CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc15_8.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] // CHECK:STDOUT: %.loc15_8.2: type = converted %int.make_type_32.loc15, %.loc15_8.1 [template = i32] @@ -73,29 +72,46 @@ var b: i32 = a[{.index = 3}.index]; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_20: i32 = int_value 1 [template = constants.%.30] -// CHECK:STDOUT: %.loc11_23: i32 = int_value 2 [template = constants.%.31] -// CHECK:STDOUT: %.loc11_26: i32 = int_value 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_20: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc11_23: Core.IntLiteral = int_value 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_26: Core.IntLiteral = int_value 3 [template = constants.%.1] // CHECK:STDOUT: %.loc11_27.1: %tuple.type = tuple_literal (%.loc11_20, %.loc11_23, %.loc11_26) -// CHECK:STDOUT: %.loc11_27.2: i32 = int_value 0 [template = constants.%.32] -// CHECK:STDOUT: %.loc11_27.3: ref i32 = array_index file.%a.var, %.loc11_27.2 -// CHECK:STDOUT: %.loc11_27.4: init i32 = initialize_from %.loc11_20 to %.loc11_27.3 [template = constants.%.30] -// CHECK:STDOUT: %.loc11_27.5: i32 = int_value 1 [template = constants.%.30] +// CHECK:STDOUT: %.loc11_27.2: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_27.3: = bound_method %.loc11_20, %.loc11_27.2 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc11_27.1: init i32 = call %.loc11_27.3(%.loc11_20) [template = constants.%.32] +// CHECK:STDOUT: %.loc11_27.4: init i32 = converted %.loc11_20, %int.convert_checked.loc11_27.1 [template = constants.%.32] +// CHECK:STDOUT: %.loc11_27.5: i32 = int_value 0 [template = constants.%.6] // CHECK:STDOUT: %.loc11_27.6: ref i32 = array_index file.%a.var, %.loc11_27.5 -// CHECK:STDOUT: %.loc11_27.7: init i32 = initialize_from %.loc11_23 to %.loc11_27.6 [template = constants.%.31] -// CHECK:STDOUT: %.loc11_27.8: i32 = int_value 2 [template = constants.%.31] -// CHECK:STDOUT: %.loc11_27.9: ref i32 = array_index file.%a.var, %.loc11_27.8 -// CHECK:STDOUT: %.loc11_27.10: init i32 = initialize_from %.loc11_26 to %.loc11_27.9 [template = constants.%.1] -// CHECK:STDOUT: %.loc11_27.11: init %.28 = array_init (%.loc11_27.4, %.loc11_27.7, %.loc11_27.10) to file.%a.var [template = constants.%array] -// CHECK:STDOUT: %.loc11_28: init %.28 = converted %.loc11_27.1, %.loc11_27.11 [template = constants.%array] +// CHECK:STDOUT: %.loc11_27.7: init i32 = initialize_from %.loc11_27.4 to %.loc11_27.6 [template = constants.%.32] +// CHECK:STDOUT: %.loc11_27.8: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_27.9: = bound_method %.loc11_23, %.loc11_27.8 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc11_27.2: init i32 = call %.loc11_27.9(%.loc11_23) [template = constants.%.34] +// CHECK:STDOUT: %.loc11_27.10: init i32 = converted %.loc11_23, %int.convert_checked.loc11_27.2 [template = constants.%.34] +// CHECK:STDOUT: %.loc11_27.11: i32 = int_value 1 [template = constants.%.32] +// CHECK:STDOUT: %.loc11_27.12: ref i32 = array_index file.%a.var, %.loc11_27.11 +// CHECK:STDOUT: %.loc11_27.13: init i32 = initialize_from %.loc11_27.10 to %.loc11_27.12 [template = constants.%.34] +// CHECK:STDOUT: %.loc11_27.14: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_27.15: = bound_method %.loc11_26, %.loc11_27.14 [template = constants.%.35] +// CHECK:STDOUT: %int.convert_checked.loc11_27.3: init i32 = call %.loc11_27.15(%.loc11_26) [template = constants.%.36] +// CHECK:STDOUT: %.loc11_27.16: init i32 = converted %.loc11_26, %int.convert_checked.loc11_27.3 [template = constants.%.36] +// CHECK:STDOUT: %.loc11_27.17: i32 = int_value 2 [template = constants.%.34] +// CHECK:STDOUT: %.loc11_27.18: ref i32 = array_index file.%a.var, %.loc11_27.17 +// CHECK:STDOUT: %.loc11_27.19: init i32 = initialize_from %.loc11_27.16 to %.loc11_27.18 [template = constants.%.36] +// CHECK:STDOUT: %.loc11_27.20: init %.2 = array_init (%.loc11_27.7, %.loc11_27.13, %.loc11_27.19) to file.%a.var [template = constants.%array] +// CHECK:STDOUT: %.loc11_28: init %.2 = converted %.loc11_27.1, %.loc11_27.20 [template = constants.%array] // CHECK:STDOUT: assign file.%a.var, %.loc11_28 -// CHECK:STDOUT: %a.ref: ref %.28 = name_ref a, file.%a -// CHECK:STDOUT: %.loc15_26: i32 = int_value 3 [template = constants.%.1] -// CHECK:STDOUT: %.loc15_27.1: %.33 = struct_literal (%.loc15_26) -// CHECK:STDOUT: %struct: %.33 = struct_value (%.loc15_26) [template = constants.%struct] -// CHECK:STDOUT: %.loc15_27.2: %.33 = converted %.loc15_27.1, %struct [template = constants.%struct] -// CHECK:STDOUT: %.loc15_28: i32 = struct_access %.loc15_27.2, element0 [template = constants.%.1] -// CHECK:STDOUT: %.loc15_34.1: ref i32 = array_index %a.ref, %.loc15_28 [template = ] +// CHECK:STDOUT: %a.ref: ref %.2 = name_ref a, file.%a +// CHECK:STDOUT: %.loc15_26: Core.IntLiteral = int_value 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc15_27.1: %.37 = struct_literal (%.loc15_26) +// CHECK:STDOUT: %struct: %.37 = struct_value (%.loc15_26) [template = constants.%struct] +// CHECK:STDOUT: %.loc15_27.2: %.37 = converted %.loc15_27.1, %struct [template = constants.%struct] +// CHECK:STDOUT: %.loc15_28.1: Core.IntLiteral = struct_access %.loc15_27.2, element0 [template = constants.%.1] +// CHECK:STDOUT: %.loc15_28.2: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc15_28.3: = bound_method %.loc15_28.1, %.loc15_28.2 [template = constants.%.35] +// CHECK:STDOUT: %int.convert_checked.loc15: init i32 = call %.loc15_28.3(%.loc15_28.1) [template = constants.%.36] +// CHECK:STDOUT: %.loc15_28.4: i32 = value_of_initializer %int.convert_checked.loc15 [template = constants.%.36] +// CHECK:STDOUT: %.loc15_28.5: i32 = converted %.loc15_28.1, %.loc15_28.4 [template = constants.%.36] +// CHECK:STDOUT: %.loc15_34.1: ref i32 = array_index %a.ref, %.loc15_28.5 [template = ] // CHECK:STDOUT: %.loc15_34.2: i32 = bind_value %.loc15_34.1 // CHECK:STDOUT: assign file.%b.var, %.loc15_34.2 // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/array/fail_type_mismatch.carbon b/toolchain/check/testdata/array/fail_type_mismatch.carbon index e97a2b939a584..8dbee867df9fa 100644 --- a/toolchain/check/testdata/array/fail_type_mismatch.carbon +++ b/toolchain/check/testdata/array/fail_type_mismatch.carbon @@ -44,23 +44,25 @@ var d: [i32; 3] = t2; // CHECK:STDOUT: constants { // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 3 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.2: type = array_type %.1, i32 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.6: String = string_literal "Hello" [template] +// CHECK:STDOUT: %.7: String = string_literal "World" [template] +// CHECK:STDOUT: %tuple.type.1: type = tuple_type (Core.IntLiteral, String, String) [template] +// CHECK:STDOUT: %.8: i32 = int_value 0 [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: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] -// CHECK:STDOUT: %.27: Core.IntLiteral = int_value 3 [template] -// CHECK:STDOUT: %.28: type = array_type %.27, i32 [template] -// CHECK:STDOUT: %.30: i32 = int_value 1 [template] -// CHECK:STDOUT: %.32: String = string_literal "Hello" [template] -// CHECK:STDOUT: %.33: String = string_literal "World" [template] -// CHECK:STDOUT: %tuple.type.1: type = tuple_type (i32, String, String) [template] -// CHECK:STDOUT: %.34: i32 = int_value 0 [template] +// CHECK:STDOUT: %.32: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.33: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.34: i32 = int_value 1 [template] // CHECK:STDOUT: %tuple.type.2: type = tuple_type (type, type, type) [template] -// CHECK:STDOUT: %.36: i32 = int_value 2 [template] -// CHECK:STDOUT: %tuple.type.4: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %tuple.type.5: type = tuple_type (type, type) [template] +// CHECK:STDOUT: %tuple.type.3: type = tuple_type (i32, String, String) [template] +// CHECK:STDOUT: %.36: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %tuple.type.5: type = tuple_type (Core.IntLiteral, Core.IntLiteral) [template] +// CHECK:STDOUT: %tuple.type.6: type = tuple_type (type, type) [template] +// CHECK:STDOUT: %tuple.type.7: type = tuple_type (i32, i32) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -84,97 +86,81 @@ var d: [i32; 3] = t2; // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %int.make_type_32.loc18: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc18_14.1: i32 = int_value 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc18_14: Core.IntLiteral = int_value 3 [template = constants.%.1] // CHECK:STDOUT: %.loc18_9.1: type = value_of_initializer %int.make_type_32.loc18 [template = i32] // CHECK:STDOUT: %.loc18_9.2: type = converted %int.make_type_32.loc18, %.loc18_9.1 [template = i32] -// CHECK:STDOUT: %.loc18_14.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc18_14.3: = bound_method %.loc18_14.1, %.loc18_14.2 [template = constants.%.26] -// CHECK:STDOUT: %int.convert_checked.loc18: init Core.IntLiteral = call %.loc18_14.3(%.loc18_14.1) [template = constants.%.27] -// CHECK:STDOUT: %.loc18_14.4: Core.IntLiteral = value_of_initializer %int.convert_checked.loc18 [template = constants.%.27] -// CHECK:STDOUT: %.loc18_14.5: Core.IntLiteral = converted %.loc18_14.1, %.loc18_14.4 [template = constants.%.27] -// CHECK:STDOUT: %.loc18_15: type = array_type %.loc18_14.5, i32 [template = constants.%.28] -// CHECK:STDOUT: %a.var: ref %.28 = var a -// CHECK:STDOUT: %a: ref %.28 = bind_name a, %a.var +// CHECK:STDOUT: %.loc18_15: type = array_type %.loc18_14, i32 [template = constants.%.2] +// CHECK:STDOUT: %a.var: ref %.2 = var a +// CHECK:STDOUT: %a: ref %.2 = bind_name a, %a.var // CHECK:STDOUT: %int.make_type_32.loc20: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc20_29.1: %tuple.type.2 = tuple_literal (%int.make_type_32.loc20, String, String) // CHECK:STDOUT: %.loc20_29.2: type = value_of_initializer %int.make_type_32.loc20 [template = i32] // CHECK:STDOUT: %.loc20_29.3: type = converted %int.make_type_32.loc20, %.loc20_29.2 [template = i32] -// CHECK:STDOUT: %.loc20_29.4: type = converted %.loc20_29.1, constants.%tuple.type.1 [template = constants.%tuple.type.1] -// CHECK:STDOUT: %t1.var: ref %tuple.type.1 = var t1 -// CHECK:STDOUT: %t1: ref %tuple.type.1 = bind_name t1, %t1.var +// CHECK:STDOUT: %.loc20_29.4: type = converted %.loc20_29.1, constants.%tuple.type.3 [template = constants.%tuple.type.3] +// CHECK:STDOUT: %t1.var: ref %tuple.type.3 = var t1 +// CHECK:STDOUT: %t1: ref %tuple.type.3 = bind_name t1, %t1.var // CHECK:STDOUT: %int.make_type_32.loc28: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc28_14.1: i32 = int_value 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc28_14: Core.IntLiteral = int_value 3 [template = constants.%.1] // CHECK:STDOUT: %.loc28_9.1: type = value_of_initializer %int.make_type_32.loc28 [template = i32] // CHECK:STDOUT: %.loc28_9.2: type = converted %int.make_type_32.loc28, %.loc28_9.1 [template = i32] -// CHECK:STDOUT: %.loc28_14.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc28_14.3: = bound_method %.loc28_14.1, %.loc28_14.2 [template = constants.%.26] -// CHECK:STDOUT: %int.convert_checked.loc28: init Core.IntLiteral = call %.loc28_14.3(%.loc28_14.1) [template = constants.%.27] -// CHECK:STDOUT: %.loc28_14.4: Core.IntLiteral = value_of_initializer %int.convert_checked.loc28 [template = constants.%.27] -// CHECK:STDOUT: %.loc28_14.5: Core.IntLiteral = converted %.loc28_14.1, %.loc28_14.4 [template = constants.%.27] -// CHECK:STDOUT: %.loc28_15: type = array_type %.loc28_14.5, i32 [template = constants.%.28] -// CHECK:STDOUT: %b.var: ref %.28 = var b -// CHECK:STDOUT: %b: ref %.28 = bind_name b, %b.var +// CHECK:STDOUT: %.loc28_15: type = array_type %.loc28_14, i32 [template = constants.%.2] +// CHECK:STDOUT: %b.var: ref %.2 = var b +// CHECK:STDOUT: %b: ref %.2 = bind_name b, %b.var // CHECK:STDOUT: %int.make_type_32.loc34: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc34_14.1: i32 = int_value 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc34_14: Core.IntLiteral = int_value 3 [template = constants.%.1] // CHECK:STDOUT: %.loc34_9.1: type = value_of_initializer %int.make_type_32.loc34 [template = i32] // CHECK:STDOUT: %.loc34_9.2: type = converted %int.make_type_32.loc34, %.loc34_9.1 [template = i32] -// CHECK:STDOUT: %.loc34_14.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc34_14.3: = bound_method %.loc34_14.1, %.loc34_14.2 [template = constants.%.26] -// CHECK:STDOUT: %int.convert_checked.loc34: init Core.IntLiteral = call %.loc34_14.3(%.loc34_14.1) [template = constants.%.27] -// CHECK:STDOUT: %.loc34_14.4: Core.IntLiteral = value_of_initializer %int.convert_checked.loc34 [template = constants.%.27] -// CHECK:STDOUT: %.loc34_14.5: Core.IntLiteral = converted %.loc34_14.1, %.loc34_14.4 [template = constants.%.27] -// CHECK:STDOUT: %.loc34_15: type = array_type %.loc34_14.5, i32 [template = constants.%.28] -// CHECK:STDOUT: %c.var: ref %.28 = var c -// CHECK:STDOUT: %c: ref %.28 = bind_name c, %c.var +// CHECK:STDOUT: %.loc34_15: type = array_type %.loc34_14, i32 [template = constants.%.2] +// CHECK:STDOUT: %c.var: ref %.2 = var c +// CHECK:STDOUT: %c: ref %.2 = bind_name c, %c.var // CHECK:STDOUT: %int.make_type_32.loc36_10: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %int.make_type_32.loc36_15: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc36_18.1: %tuple.type.5 = tuple_literal (%int.make_type_32.loc36_10, %int.make_type_32.loc36_15) +// CHECK:STDOUT: %.loc36_18.1: %tuple.type.6 = tuple_literal (%int.make_type_32.loc36_10, %int.make_type_32.loc36_15) // CHECK:STDOUT: %.loc36_18.2: type = value_of_initializer %int.make_type_32.loc36_10 [template = i32] // CHECK:STDOUT: %.loc36_18.3: type = converted %int.make_type_32.loc36_10, %.loc36_18.2 [template = i32] // CHECK:STDOUT: %.loc36_18.4: type = value_of_initializer %int.make_type_32.loc36_15 [template = i32] // CHECK:STDOUT: %.loc36_18.5: type = converted %int.make_type_32.loc36_15, %.loc36_18.4 [template = i32] -// CHECK:STDOUT: %.loc36_18.6: type = converted %.loc36_18.1, constants.%tuple.type.4 [template = constants.%tuple.type.4] -// CHECK:STDOUT: %t2.var: ref %tuple.type.4 = var t2 -// CHECK:STDOUT: %t2: ref %tuple.type.4 = bind_name t2, %t2.var +// CHECK:STDOUT: %.loc36_18.6: type = converted %.loc36_18.1, constants.%tuple.type.7 [template = constants.%tuple.type.7] +// CHECK:STDOUT: %t2.var: ref %tuple.type.7 = var t2 +// CHECK:STDOUT: %t2: ref %tuple.type.7 = bind_name t2, %t2.var // CHECK:STDOUT: %int.make_type_32.loc40: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc40_14.1: i32 = int_value 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc40_14: Core.IntLiteral = int_value 3 [template = constants.%.1] // CHECK:STDOUT: %.loc40_9.1: type = value_of_initializer %int.make_type_32.loc40 [template = i32] // CHECK:STDOUT: %.loc40_9.2: type = converted %int.make_type_32.loc40, %.loc40_9.1 [template = i32] -// CHECK:STDOUT: %.loc40_14.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc40_14.3: = bound_method %.loc40_14.1, %.loc40_14.2 [template = constants.%.26] -// CHECK:STDOUT: %int.convert_checked.loc40: init Core.IntLiteral = call %.loc40_14.3(%.loc40_14.1) [template = constants.%.27] -// CHECK:STDOUT: %.loc40_14.4: Core.IntLiteral = value_of_initializer %int.convert_checked.loc40 [template = constants.%.27] -// CHECK:STDOUT: %.loc40_14.5: Core.IntLiteral = converted %.loc40_14.1, %.loc40_14.4 [template = constants.%.27] -// CHECK:STDOUT: %.loc40_15: type = array_type %.loc40_14.5, i32 [template = constants.%.28] -// CHECK:STDOUT: %d.var: ref %.28 = var d -// CHECK:STDOUT: %d: ref %.28 = bind_name d, %d.var +// CHECK:STDOUT: %.loc40_15: type = array_type %.loc40_14, i32 [template = constants.%.2] +// CHECK:STDOUT: %d.var: ref %.2 = var d +// CHECK:STDOUT: %d: ref %.2 = bind_name d, %d.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc18_20: i32 = int_value 1 [template = constants.%.30] -// CHECK:STDOUT: %.loc18_23: String = string_literal "Hello" [template = constants.%.32] -// CHECK:STDOUT: %.loc18_32: String = string_literal "World" [template = constants.%.33] +// CHECK:STDOUT: %.loc18_20: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc18_23: String = string_literal "Hello" [template = constants.%.6] +// CHECK:STDOUT: %.loc18_32: String = string_literal "World" [template = constants.%.7] // CHECK:STDOUT: %.loc18_39.1: %tuple.type.1 = tuple_literal (%.loc18_20, %.loc18_23, %.loc18_32) -// CHECK:STDOUT: %.loc18_39.2: i32 = int_value 0 [template = constants.%.34] -// CHECK:STDOUT: %.loc18_39.3: ref i32 = array_index file.%a.var, %.loc18_39.2 -// CHECK:STDOUT: %.loc18_39.4: init i32 = initialize_from %.loc18_20 to %.loc18_39.3 [template = constants.%.30] -// CHECK:STDOUT: %.loc18_39.5: i32 = converted %.loc18_23, [template = ] +// CHECK:STDOUT: %.loc18_39.2: %Convert.type.2 = interface_witness_access constants.%.32, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc18_39.3: = bound_method %.loc18_20, %.loc18_39.2 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc18_39.3(%.loc18_20) [template = constants.%.34] +// CHECK:STDOUT: %.loc18_39.4: init i32 = converted %.loc18_20, %int.convert_checked [template = constants.%.34] +// CHECK:STDOUT: %.loc18_39.5: i32 = int_value 0 [template = constants.%.8] +// CHECK:STDOUT: %.loc18_39.6: ref i32 = array_index file.%a.var, %.loc18_39.5 +// CHECK:STDOUT: %.loc18_39.7: init i32 = initialize_from %.loc18_39.4 to %.loc18_39.6 [template = constants.%.34] +// CHECK:STDOUT: %.loc18_39.8: i32 = converted %.loc18_23, [template = ] // CHECK:STDOUT: assign file.%a.var, -// CHECK:STDOUT: %t1.ref: ref %tuple.type.1 = name_ref t1, file.%t1 +// CHECK:STDOUT: %t1.ref: ref %tuple.type.3 = name_ref t1, file.%t1 // CHECK:STDOUT: %.loc28_19.1: ref i32 = tuple_access %t1.ref, element0 // CHECK:STDOUT: %.loc28_19.2: i32 = bind_value %.loc28_19.1 -// CHECK:STDOUT: %.loc28_19.3: i32 = int_value 0 [template = constants.%.34] +// CHECK:STDOUT: %.loc28_19.3: i32 = int_value 0 [template = constants.%.8] // CHECK:STDOUT: %.loc28_19.4: ref i32 = array_index file.%b.var, %.loc28_19.3 // CHECK:STDOUT: %.loc28_19.5: init i32 = initialize_from %.loc28_19.2 to %.loc28_19.4 // CHECK:STDOUT: %.loc28_19.6: ref String = tuple_access %t1.ref, element1 // CHECK:STDOUT: %.loc28_19.7: i32 = converted %.loc28_19.6, [template = ] // CHECK:STDOUT: assign file.%b.var, -// CHECK:STDOUT: %.loc34_20: i32 = int_value 1 [template = constants.%.30] -// CHECK:STDOUT: %.loc34_23: i32 = int_value 2 [template = constants.%.36] -// CHECK:STDOUT: %.loc34_24: %tuple.type.4 = tuple_literal (%.loc34_20, %.loc34_23) +// CHECK:STDOUT: %.loc34_20: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc34_23: Core.IntLiteral = int_value 2 [template = constants.%.36] +// CHECK:STDOUT: %.loc34_24: %tuple.type.5 = tuple_literal (%.loc34_20, %.loc34_23) // CHECK:STDOUT: assign file.%c.var, -// CHECK:STDOUT: %t2.ref: ref %tuple.type.4 = name_ref t2, file.%t2 +// CHECK:STDOUT: %t2.ref: ref %tuple.type.7 = name_ref t2, file.%t2 // CHECK:STDOUT: assign file.%d.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/array/function_param.carbon b/toolchain/check/testdata/array/function_param.carbon index bf1c9e4dc01f5..a2630c6f4af34 100644 --- a/toolchain/check/testdata/array/function_param.carbon +++ b/toolchain/check/testdata/array/function_param.carbon @@ -21,23 +21,27 @@ fn G() -> i32 { // CHECK:STDOUT: constants { // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 3 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [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: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] -// CHECK:STDOUT: %.27: Core.IntLiteral = int_value 3 [template] -// CHECK:STDOUT: %.28: type = array_type %.27, i32 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.2: type = array_type %.1, i32 [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] // CHECK:STDOUT: %G.type: type = fn_type @G [template] // CHECK:STDOUT: %G: %G.type = struct_value () [template] -// CHECK:STDOUT: %.30: i32 = int_value 1 [template] -// CHECK:STDOUT: %.31: i32 = int_value 2 [template] -// CHECK:STDOUT: %tuple.type: type = tuple_type (i32, i32, i32) [template] -// CHECK:STDOUT: %.32: i32 = int_value 0 [template] -// CHECK:STDOUT: %array: %.28 = tuple_value (%.30, %.31, %.1) [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.5: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %tuple.type: type = tuple_type (Core.IntLiteral, Core.IntLiteral, Core.IntLiteral) [template] +// CHECK:STDOUT: %.6: i32 = int_value 0 [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: %.30: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.31: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.32: i32 = int_value 1 [template] +// CHECK:STDOUT: %.33: = bound_method %.5, %Convert.15 [template] +// CHECK:STDOUT: %.34: i32 = int_value 2 [template] +// CHECK:STDOUT: %.35: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.36: i32 = int_value 3 [template] +// CHECK:STDOUT: %array: %.2 = tuple_value (%.32, %.34, %.36) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -57,31 +61,26 @@ fn G() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] { -// CHECK:STDOUT: %arr.patt: %.28 = binding_pattern arr -// CHECK:STDOUT: %arr.param_patt: %.28 = value_param_pattern %arr.patt, runtime_param0 +// CHECK:STDOUT: %arr.patt: %.2 = binding_pattern arr +// CHECK:STDOUT: %arr.param_patt: %.2 = value_param_pattern %arr.patt, runtime_param0 // CHECK:STDOUT: %i.patt: i32 = binding_pattern i // CHECK:STDOUT: %i.param_patt: i32 = value_param_pattern %i.patt, runtime_param1 // CHECK:STDOUT: %return.patt: i32 = return_slot_pattern // CHECK:STDOUT: %return.param_patt: i32 = out_param_pattern %return.patt, runtime_param2 // CHECK:STDOUT: } { // CHECK:STDOUT: %int.make_type_32.loc11_12: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc11_17.1: i32 = int_value 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_17: Core.IntLiteral = int_value 3 [template = constants.%.1] // CHECK:STDOUT: %.loc11_12.1: type = value_of_initializer %int.make_type_32.loc11_12 [template = i32] // CHECK:STDOUT: %.loc11_12.2: type = converted %int.make_type_32.loc11_12, %.loc11_12.1 [template = i32] -// CHECK:STDOUT: %.loc11_17.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc11_17.3: = bound_method %.loc11_17.1, %.loc11_17.2 [template = constants.%.26] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc11_17.3(%.loc11_17.1) [template = constants.%.27] -// CHECK:STDOUT: %.loc11_17.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.27] -// CHECK:STDOUT: %.loc11_17.5: Core.IntLiteral = converted %.loc11_17.1, %.loc11_17.4 [template = constants.%.27] -// CHECK:STDOUT: %.loc11_18: type = array_type %.loc11_17.5, i32 [template = constants.%.28] +// CHECK:STDOUT: %.loc11_18: type = array_type %.loc11_17, i32 [template = constants.%.2] // CHECK:STDOUT: %int.make_type_32.loc11_24: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc11_24.1: type = value_of_initializer %int.make_type_32.loc11_24 [template = i32] // CHECK:STDOUT: %.loc11_24.2: type = converted %int.make_type_32.loc11_24, %.loc11_24.1 [template = i32] // CHECK:STDOUT: %int.make_type_32.loc11_32: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc11_32.1: type = value_of_initializer %int.make_type_32.loc11_32 [template = i32] // CHECK:STDOUT: %.loc11_32.2: type = converted %int.make_type_32.loc11_32, %.loc11_32.1 [template = i32] -// CHECK:STDOUT: %arr.param: %.28 = value_param runtime_param0 -// CHECK:STDOUT: %arr: %.28 = bind_name arr, %arr.param +// CHECK:STDOUT: %arr.param: %.2 = value_param runtime_param0 +// CHECK:STDOUT: %arr: %.2 = bind_name arr, %arr.param // CHECK:STDOUT: %i.param: i32 = value_param runtime_param1 // CHECK:STDOUT: %i: i32 = bind_name i, %i.param // CHECK:STDOUT: %return.param: ref i32 = out_param runtime_param2 @@ -99,11 +98,11 @@ fn G() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F(%arr.param_patt: %.28, %i.param_patt: i32) -> i32 { +// CHECK:STDOUT: fn @F(%arr.param_patt: %.2, %i.param_patt: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: %.28 = name_ref arr, %arr +// CHECK:STDOUT: %arr.ref: %.2 = name_ref arr, %arr // CHECK:STDOUT: %i.ref: i32 = name_ref i, %i -// CHECK:STDOUT: %.loc12_15.1: ref %.28 = value_as_ref %arr.ref +// CHECK:STDOUT: %.loc12_15.1: ref %.2 = value_as_ref %arr.ref // CHECK:STDOUT: %.loc12_15.2: ref i32 = array_index %.loc12_15.1, %i.ref // CHECK:STDOUT: %.loc12_15.3: i32 = bind_value %.loc12_15.2 // CHECK:STDOUT: return %.loc12_15.3 @@ -112,26 +111,43 @@ fn G() -> i32 { // CHECK:STDOUT: fn @G() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [template = constants.%F] -// CHECK:STDOUT: %.loc16_13: i32 = int_value 1 [template = constants.%.30] -// CHECK:STDOUT: %.loc16_16: i32 = int_value 2 [template = constants.%.31] -// CHECK:STDOUT: %.loc16_19: i32 = int_value 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc16_13: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc16_16: Core.IntLiteral = int_value 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc16_19: Core.IntLiteral = int_value 3 [template = constants.%.1] // CHECK:STDOUT: %.loc16_20.1: %tuple.type = tuple_literal (%.loc16_13, %.loc16_16, %.loc16_19) -// CHECK:STDOUT: %.loc16_23: i32 = int_value 1 [template = constants.%.30] -// CHECK:STDOUT: %.loc16_20.2: ref %.28 = temporary_storage -// CHECK:STDOUT: %.loc16_20.3: i32 = int_value 0 [template = constants.%.32] -// CHECK:STDOUT: %.loc16_20.4: ref i32 = array_index %.loc16_20.2, %.loc16_20.3 -// CHECK:STDOUT: %.loc16_20.5: init i32 = initialize_from %.loc16_13 to %.loc16_20.4 [template = constants.%.30] -// CHECK:STDOUT: %.loc16_20.6: i32 = int_value 1 [template = constants.%.30] -// CHECK:STDOUT: %.loc16_20.7: ref i32 = array_index %.loc16_20.2, %.loc16_20.6 -// CHECK:STDOUT: %.loc16_20.8: init i32 = initialize_from %.loc16_16 to %.loc16_20.7 [template = constants.%.31] -// CHECK:STDOUT: %.loc16_20.9: i32 = int_value 2 [template = constants.%.31] -// CHECK:STDOUT: %.loc16_20.10: ref i32 = array_index %.loc16_20.2, %.loc16_20.9 -// CHECK:STDOUT: %.loc16_20.11: init i32 = initialize_from %.loc16_19 to %.loc16_20.10 [template = constants.%.1] -// CHECK:STDOUT: %.loc16_20.12: init %.28 = array_init (%.loc16_20.5, %.loc16_20.8, %.loc16_20.11) to %.loc16_20.2 [template = constants.%array] -// CHECK:STDOUT: %.loc16_20.13: init %.28 = converted %.loc16_20.1, %.loc16_20.12 [template = constants.%array] -// CHECK:STDOUT: %.loc16_20.14: ref %.28 = temporary %.loc16_20.2, %.loc16_20.13 -// CHECK:STDOUT: %.loc16_20.15: %.28 = bind_value %.loc16_20.14 -// CHECK:STDOUT: %F.call: init i32 = call %F.ref(%.loc16_20.15, %.loc16_23) +// CHECK:STDOUT: %.loc16_23.1: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc16_20.2: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc16_20.3: = bound_method %.loc16_13, %.loc16_20.2 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc16_20.1: init i32 = call %.loc16_20.3(%.loc16_13) [template = constants.%.32] +// CHECK:STDOUT: %.loc16_20.4: init i32 = converted %.loc16_13, %int.convert_checked.loc16_20.1 [template = constants.%.32] +// CHECK:STDOUT: %.loc16_20.5: ref %.2 = temporary_storage +// CHECK:STDOUT: %.loc16_20.6: i32 = int_value 0 [template = constants.%.6] +// CHECK:STDOUT: %.loc16_20.7: ref i32 = array_index %.loc16_20.5, %.loc16_20.6 +// CHECK:STDOUT: %.loc16_20.8: init i32 = initialize_from %.loc16_20.4 to %.loc16_20.7 [template = constants.%.32] +// CHECK:STDOUT: %.loc16_20.9: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc16_20.10: = bound_method %.loc16_16, %.loc16_20.9 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc16_20.2: init i32 = call %.loc16_20.10(%.loc16_16) [template = constants.%.34] +// CHECK:STDOUT: %.loc16_20.11: init i32 = converted %.loc16_16, %int.convert_checked.loc16_20.2 [template = constants.%.34] +// CHECK:STDOUT: %.loc16_20.12: i32 = int_value 1 [template = constants.%.32] +// CHECK:STDOUT: %.loc16_20.13: ref i32 = array_index %.loc16_20.5, %.loc16_20.12 +// CHECK:STDOUT: %.loc16_20.14: init i32 = initialize_from %.loc16_20.11 to %.loc16_20.13 [template = constants.%.34] +// CHECK:STDOUT: %.loc16_20.15: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc16_20.16: = bound_method %.loc16_19, %.loc16_20.15 [template = constants.%.35] +// CHECK:STDOUT: %int.convert_checked.loc16_20.3: init i32 = call %.loc16_20.16(%.loc16_19) [template = constants.%.36] +// CHECK:STDOUT: %.loc16_20.17: init i32 = converted %.loc16_19, %int.convert_checked.loc16_20.3 [template = constants.%.36] +// CHECK:STDOUT: %.loc16_20.18: i32 = int_value 2 [template = constants.%.34] +// CHECK:STDOUT: %.loc16_20.19: ref i32 = array_index %.loc16_20.5, %.loc16_20.18 +// CHECK:STDOUT: %.loc16_20.20: init i32 = initialize_from %.loc16_20.17 to %.loc16_20.19 [template = constants.%.36] +// CHECK:STDOUT: %.loc16_20.21: init %.2 = array_init (%.loc16_20.8, %.loc16_20.14, %.loc16_20.20) to %.loc16_20.5 [template = constants.%array] +// CHECK:STDOUT: %.loc16_20.22: init %.2 = converted %.loc16_20.1, %.loc16_20.21 [template = constants.%array] +// CHECK:STDOUT: %.loc16_20.23: ref %.2 = temporary %.loc16_20.5, %.loc16_20.22 +// CHECK:STDOUT: %.loc16_20.24: %.2 = bind_value %.loc16_20.23 +// CHECK:STDOUT: %.loc16_23.2: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc16_23.3: = bound_method %.loc16_23.1, %.loc16_23.2 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc16_23: init i32 = call %.loc16_23.3(%.loc16_23.1) [template = constants.%.32] +// CHECK:STDOUT: %.loc16_23.4: i32 = value_of_initializer %int.convert_checked.loc16_23 [template = constants.%.32] +// CHECK:STDOUT: %.loc16_23.5: i32 = converted %.loc16_23.1, %.loc16_23.4 [template = constants.%.32] +// CHECK:STDOUT: %F.call: init i32 = call %F.ref(%.loc16_20.24, %.loc16_23.5) // CHECK:STDOUT: %.loc16_25.1: i32 = value_of_initializer %F.call // CHECK:STDOUT: %.loc16_25.2: i32 = converted %F.call, %.loc16_25.1 // CHECK:STDOUT: return %.loc16_25.2 diff --git a/toolchain/check/testdata/array/generic_empty.carbon b/toolchain/check/testdata/array/generic_empty.carbon index 1c34e75bdc78e..b55f8cc84947d 100644 --- a/toolchain/check/testdata/array/generic_empty.carbon +++ b/toolchain/check/testdata/array/generic_empty.carbon @@ -21,20 +21,13 @@ fn G(T:! type) { // CHECK:STDOUT: %G.type: type = fn_type @G [template] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template] // CHECK:STDOUT: %G: %G.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [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: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] -// CHECK:STDOUT: %.27: Core.IntLiteral = int_value 0 [template] -// CHECK:STDOUT: %.28: type = array_type %.27, %T [symbolic] -// CHECK:STDOUT: %array: %.28 = tuple_value () [symbolic] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %.2: type = array_type %.1, %T [symbolic] +// CHECK:STDOUT: %array: %.2 = tuple_value () [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .ImplicitAs = %import_ref.1 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -60,24 +53,19 @@ fn G(T:! type) { // CHECK:STDOUT: %T.patt.loc11_6.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_6.2 (constants.%T.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %.loc13_17.2: type = array_type constants.%.27, @G.%T.loc11_6.2 (%T) [symbolic = %.loc13_17.2 (constants.%.28)] -// CHECK:STDOUT: %array: @G.%.loc13_17.2 (%.28) = tuple_value () [symbolic = %array (constants.%array)] +// CHECK:STDOUT: %.loc13_17.2: type = array_type constants.%.1, @G.%T.loc11_6.2 (%T) [symbolic = %.loc13_17.2 (constants.%.2)] +// CHECK:STDOUT: %array: @G.%.loc13_17.2 (%.2) = tuple_value () [symbolic = %array (constants.%array)] // CHECK:STDOUT: // CHECK:STDOUT: fn(%T.param_patt: type) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc11_6.1 [symbolic = %T.loc11_6.2 (constants.%T)] -// CHECK:STDOUT: %.loc13_16.1: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: %.loc13_16.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc13_16.3: = bound_method %.loc13_16.1, %.loc13_16.2 [template = constants.%.26] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc13_16.3(%.loc13_16.1) [template = constants.%.27] -// CHECK:STDOUT: %.loc13_16.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.27] -// CHECK:STDOUT: %.loc13_16.5: Core.IntLiteral = converted %.loc13_16.1, %.loc13_16.4 [template = constants.%.27] -// CHECK:STDOUT: %.loc13_17.1: type = array_type %.loc13_16.5, %T [symbolic = %.loc13_17.2 (constants.%.28)] -// CHECK:STDOUT: %arr.var: ref @G.%.loc13_17.2 (%.28) = var arr -// CHECK:STDOUT: %arr: ref @G.%.loc13_17.2 (%.28) = bind_name arr, %arr.var +// CHECK:STDOUT: %.loc13_16: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc13_17.1: type = array_type %.loc13_16, %T [symbolic = %.loc13_17.2 (constants.%.2)] +// CHECK:STDOUT: %arr.var: ref @G.%.loc13_17.2 (%.2) = var arr +// CHECK:STDOUT: %arr: ref @G.%.loc13_17.2 (%.2) = bind_name arr, %arr.var // CHECK:STDOUT: %.loc13_22.1: %empty_tuple.type = tuple_literal () -// CHECK:STDOUT: %.loc13_22.2: init @G.%.loc13_17.2 (%.28) = array_init () to %arr.var [symbolic = %array (constants.%array)] -// CHECK:STDOUT: %.loc13_23: init @G.%.loc13_17.2 (%.28) = converted %.loc13_22.1, %.loc13_22.2 [symbolic = %array (constants.%array)] +// CHECK:STDOUT: %.loc13_22.2: init @G.%.loc13_17.2 (%.2) = array_init () to %arr.var [symbolic = %array (constants.%array)] +// CHECK:STDOUT: %.loc13_23: init @G.%.loc13_17.2 (%.2) = converted %.loc13_22.1, %.loc13_22.2 [symbolic = %array (constants.%array)] // CHECK:STDOUT: assign %arr.var, %.loc13_23 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/array/index_not_literal.carbon b/toolchain/check/testdata/array/index_not_literal.carbon index 8cc1a61ef558f..67bbb4e599983 100644 --- a/toolchain/check/testdata/array/index_not_literal.carbon +++ b/toolchain/check/testdata/array/index_not_literal.carbon @@ -16,21 +16,25 @@ var b: i32 = a[{.index = 2}.index]; // CHECK:STDOUT: constants { // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 3 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.2: type = array_type %.1, i32 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.5: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %tuple.type: type = tuple_type (Core.IntLiteral, Core.IntLiteral, Core.IntLiteral) [template] +// CHECK:STDOUT: %.6: i32 = int_value 0 [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: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] -// CHECK:STDOUT: %.27: Core.IntLiteral = int_value 3 [template] -// CHECK:STDOUT: %.28: type = array_type %.27, i32 [template] -// CHECK:STDOUT: %.30: i32 = int_value 1 [template] -// CHECK:STDOUT: %.31: i32 = int_value 2 [template] -// CHECK:STDOUT: %tuple.type: type = tuple_type (i32, i32, i32) [template] -// CHECK:STDOUT: %.32: i32 = int_value 0 [template] -// CHECK:STDOUT: %array: %.28 = tuple_value (%.30, %.31, %.1) [template] -// CHECK:STDOUT: %.33: type = struct_type {.index: i32} [template] -// CHECK:STDOUT: %struct: %.33 = struct_value (%.31) [template] +// CHECK:STDOUT: %.30: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.31: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.32: i32 = int_value 1 [template] +// CHECK:STDOUT: %.33: = bound_method %.5, %Convert.15 [template] +// CHECK:STDOUT: %.34: i32 = int_value 2 [template] +// CHECK:STDOUT: %.35: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.36: i32 = int_value 3 [template] +// CHECK:STDOUT: %array: %.2 = tuple_value (%.32, %.34, %.36) [template] +// CHECK:STDOUT: %.37: type = struct_type {.index: Core.IntLiteral} [template] +// CHECK:STDOUT: %struct: %.37 = struct_value (%.5) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -50,17 +54,12 @@ var b: i32 = a[{.index = 2}.index]; // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc11_14.1: i32 = int_value 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_14: Core.IntLiteral = int_value 3 [template = constants.%.1] // CHECK:STDOUT: %.loc11_9.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] // CHECK:STDOUT: %.loc11_9.2: type = converted %int.make_type_32.loc11, %.loc11_9.1 [template = i32] -// CHECK:STDOUT: %.loc11_14.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc11_14.3: = bound_method %.loc11_14.1, %.loc11_14.2 [template = constants.%.26] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc11_14.3(%.loc11_14.1) [template = constants.%.27] -// CHECK:STDOUT: %.loc11_14.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.27] -// CHECK:STDOUT: %.loc11_14.5: Core.IntLiteral = converted %.loc11_14.1, %.loc11_14.4 [template = constants.%.27] -// CHECK:STDOUT: %.loc11_15: type = array_type %.loc11_14.5, i32 [template = constants.%.28] -// CHECK:STDOUT: %a.var: ref %.28 = var a -// CHECK:STDOUT: %a: ref %.28 = bind_name a, %a.var +// CHECK:STDOUT: %.loc11_15: type = array_type %.loc11_14, i32 [template = constants.%.2] +// CHECK:STDOUT: %a.var: ref %.2 = var a +// CHECK:STDOUT: %a: ref %.2 = bind_name a, %a.var // CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc12_8.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] // CHECK:STDOUT: %.loc12_8.2: type = converted %int.make_type_32.loc12, %.loc12_8.1 [template = i32] @@ -70,29 +69,46 @@ var b: i32 = a[{.index = 2}.index]; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_20: i32 = int_value 1 [template = constants.%.30] -// CHECK:STDOUT: %.loc11_23: i32 = int_value 2 [template = constants.%.31] -// CHECK:STDOUT: %.loc11_26: i32 = int_value 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_20: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc11_23: Core.IntLiteral = int_value 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_26: Core.IntLiteral = int_value 3 [template = constants.%.1] // CHECK:STDOUT: %.loc11_27.1: %tuple.type = tuple_literal (%.loc11_20, %.loc11_23, %.loc11_26) -// CHECK:STDOUT: %.loc11_27.2: i32 = int_value 0 [template = constants.%.32] -// CHECK:STDOUT: %.loc11_27.3: ref i32 = array_index file.%a.var, %.loc11_27.2 -// CHECK:STDOUT: %.loc11_27.4: init i32 = initialize_from %.loc11_20 to %.loc11_27.3 [template = constants.%.30] -// CHECK:STDOUT: %.loc11_27.5: i32 = int_value 1 [template = constants.%.30] +// CHECK:STDOUT: %.loc11_27.2: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_27.3: = bound_method %.loc11_20, %.loc11_27.2 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc11_27.1: init i32 = call %.loc11_27.3(%.loc11_20) [template = constants.%.32] +// CHECK:STDOUT: %.loc11_27.4: init i32 = converted %.loc11_20, %int.convert_checked.loc11_27.1 [template = constants.%.32] +// CHECK:STDOUT: %.loc11_27.5: i32 = int_value 0 [template = constants.%.6] // CHECK:STDOUT: %.loc11_27.6: ref i32 = array_index file.%a.var, %.loc11_27.5 -// CHECK:STDOUT: %.loc11_27.7: init i32 = initialize_from %.loc11_23 to %.loc11_27.6 [template = constants.%.31] -// CHECK:STDOUT: %.loc11_27.8: i32 = int_value 2 [template = constants.%.31] -// CHECK:STDOUT: %.loc11_27.9: ref i32 = array_index file.%a.var, %.loc11_27.8 -// CHECK:STDOUT: %.loc11_27.10: init i32 = initialize_from %.loc11_26 to %.loc11_27.9 [template = constants.%.1] -// CHECK:STDOUT: %.loc11_27.11: init %.28 = array_init (%.loc11_27.4, %.loc11_27.7, %.loc11_27.10) to file.%a.var [template = constants.%array] -// CHECK:STDOUT: %.loc11_28: init %.28 = converted %.loc11_27.1, %.loc11_27.11 [template = constants.%array] +// CHECK:STDOUT: %.loc11_27.7: init i32 = initialize_from %.loc11_27.4 to %.loc11_27.6 [template = constants.%.32] +// CHECK:STDOUT: %.loc11_27.8: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_27.9: = bound_method %.loc11_23, %.loc11_27.8 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc11_27.2: init i32 = call %.loc11_27.9(%.loc11_23) [template = constants.%.34] +// CHECK:STDOUT: %.loc11_27.10: init i32 = converted %.loc11_23, %int.convert_checked.loc11_27.2 [template = constants.%.34] +// CHECK:STDOUT: %.loc11_27.11: i32 = int_value 1 [template = constants.%.32] +// CHECK:STDOUT: %.loc11_27.12: ref i32 = array_index file.%a.var, %.loc11_27.11 +// CHECK:STDOUT: %.loc11_27.13: init i32 = initialize_from %.loc11_27.10 to %.loc11_27.12 [template = constants.%.34] +// CHECK:STDOUT: %.loc11_27.14: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_27.15: = bound_method %.loc11_26, %.loc11_27.14 [template = constants.%.35] +// CHECK:STDOUT: %int.convert_checked.loc11_27.3: init i32 = call %.loc11_27.15(%.loc11_26) [template = constants.%.36] +// CHECK:STDOUT: %.loc11_27.16: init i32 = converted %.loc11_26, %int.convert_checked.loc11_27.3 [template = constants.%.36] +// CHECK:STDOUT: %.loc11_27.17: i32 = int_value 2 [template = constants.%.34] +// CHECK:STDOUT: %.loc11_27.18: ref i32 = array_index file.%a.var, %.loc11_27.17 +// CHECK:STDOUT: %.loc11_27.19: init i32 = initialize_from %.loc11_27.16 to %.loc11_27.18 [template = constants.%.36] +// CHECK:STDOUT: %.loc11_27.20: init %.2 = array_init (%.loc11_27.7, %.loc11_27.13, %.loc11_27.19) to file.%a.var [template = constants.%array] +// CHECK:STDOUT: %.loc11_28: init %.2 = converted %.loc11_27.1, %.loc11_27.20 [template = constants.%array] // CHECK:STDOUT: assign file.%a.var, %.loc11_28 -// CHECK:STDOUT: %a.ref: ref %.28 = name_ref a, file.%a -// CHECK:STDOUT: %.loc12_26: i32 = int_value 2 [template = constants.%.31] -// CHECK:STDOUT: %.loc12_27.1: %.33 = struct_literal (%.loc12_26) -// CHECK:STDOUT: %struct: %.33 = struct_value (%.loc12_26) [template = constants.%struct] -// CHECK:STDOUT: %.loc12_27.2: %.33 = converted %.loc12_27.1, %struct [template = constants.%struct] -// CHECK:STDOUT: %.loc12_28: i32 = struct_access %.loc12_27.2, element0 [template = constants.%.31] -// CHECK:STDOUT: %.loc12_34.1: ref i32 = array_index %a.ref, %.loc12_28 +// CHECK:STDOUT: %a.ref: ref %.2 = name_ref a, file.%a +// CHECK:STDOUT: %.loc12_26: Core.IntLiteral = int_value 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc12_27.1: %.37 = struct_literal (%.loc12_26) +// CHECK:STDOUT: %struct: %.37 = struct_value (%.loc12_26) [template = constants.%struct] +// CHECK:STDOUT: %.loc12_27.2: %.37 = converted %.loc12_27.1, %struct [template = constants.%struct] +// CHECK:STDOUT: %.loc12_28.1: Core.IntLiteral = struct_access %.loc12_27.2, element0 [template = constants.%.5] +// CHECK:STDOUT: %.loc12_28.2: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_28.3: = bound_method %.loc12_28.1, %.loc12_28.2 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc12: init i32 = call %.loc12_28.3(%.loc12_28.1) [template = constants.%.34] +// CHECK:STDOUT: %.loc12_28.4: i32 = value_of_initializer %int.convert_checked.loc12 [template = constants.%.34] +// CHECK:STDOUT: %.loc12_28.5: i32 = converted %.loc12_28.1, %.loc12_28.4 [template = constants.%.34] +// CHECK:STDOUT: %.loc12_34.1: ref i32 = array_index %a.ref, %.loc12_28.5 // CHECK:STDOUT: %.loc12_34.2: i32 = bind_value %.loc12_34.1 // CHECK:STDOUT: assign file.%b.var, %.loc12_34.2 // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/array/nine_elements.carbon b/toolchain/check/testdata/array/nine_elements.carbon index d7e327605c319..07664c7b20df0 100644 --- a/toolchain/check/testdata/array/nine_elements.carbon +++ b/toolchain/check/testdata/array/nine_elements.carbon @@ -15,25 +15,41 @@ var a: [i32; 9] = (1, 2, 3, 4, 5, 6, 7, 8, 9); // CHECK:STDOUT: constants { // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 9 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 9 [template] +// CHECK:STDOUT: %.2: type = array_type %.1, i32 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.5: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.6: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.7: Core.IntLiteral = int_value 4 [template] +// CHECK:STDOUT: %.8: Core.IntLiteral = int_value 5 [template] +// CHECK:STDOUT: %.9: Core.IntLiteral = int_value 6 [template] +// CHECK:STDOUT: %.10: Core.IntLiteral = int_value 7 [template] +// CHECK:STDOUT: %.11: Core.IntLiteral = int_value 8 [template] +// CHECK:STDOUT: %tuple.type: type = tuple_type (Core.IntLiteral, Core.IntLiteral, Core.IntLiteral, Core.IntLiteral, Core.IntLiteral, Core.IntLiteral, Core.IntLiteral, Core.IntLiteral, Core.IntLiteral) [template] +// CHECK:STDOUT: %.12: i32 = int_value 0 [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: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] -// CHECK:STDOUT: %.27: Core.IntLiteral = int_value 9 [template] -// CHECK:STDOUT: %.28: type = array_type %.27, i32 [template] -// CHECK:STDOUT: %.30: i32 = int_value 1 [template] -// CHECK:STDOUT: %.31: i32 = int_value 2 [template] -// CHECK:STDOUT: %.32: i32 = int_value 3 [template] -// CHECK:STDOUT: %.33: i32 = int_value 4 [template] -// CHECK:STDOUT: %.34: i32 = int_value 5 [template] -// CHECK:STDOUT: %.35: i32 = int_value 6 [template] -// CHECK:STDOUT: %.36: i32 = int_value 7 [template] -// CHECK:STDOUT: %.37: i32 = int_value 8 [template] -// CHECK:STDOUT: %tuple.type: type = tuple_type (i32, i32, i32, i32, i32, i32, i32, i32, i32) [template] -// CHECK:STDOUT: %.38: i32 = int_value 0 [template] -// CHECK:STDOUT: %array: %.28 = tuple_value (%.30, %.31, %.32, %.33, %.34, %.35, %.36, %.37, %.1) [template] +// CHECK:STDOUT: %.36: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.37: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.38: i32 = int_value 1 [template] +// CHECK:STDOUT: %.39: = bound_method %.5, %Convert.15 [template] +// CHECK:STDOUT: %.40: i32 = int_value 2 [template] +// CHECK:STDOUT: %.41: = bound_method %.6, %Convert.15 [template] +// CHECK:STDOUT: %.42: i32 = int_value 3 [template] +// CHECK:STDOUT: %.43: = bound_method %.7, %Convert.15 [template] +// CHECK:STDOUT: %.44: i32 = int_value 4 [template] +// CHECK:STDOUT: %.45: = bound_method %.8, %Convert.15 [template] +// CHECK:STDOUT: %.46: i32 = int_value 5 [template] +// CHECK:STDOUT: %.47: = bound_method %.9, %Convert.15 [template] +// CHECK:STDOUT: %.48: i32 = int_value 6 [template] +// CHECK:STDOUT: %.49: = bound_method %.10, %Convert.15 [template] +// CHECK:STDOUT: %.50: i32 = int_value 7 [template] +// CHECK:STDOUT: %.51: = bound_method %.11, %Convert.15 [template] +// CHECK:STDOUT: %.52: i32 = int_value 8 [template] +// CHECK:STDOUT: %.53: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.54: i32 = int_value 9 [template] +// CHECK:STDOUT: %array: %.2 = tuple_value (%.38, %.40, %.42, %.44, %.46, %.48, %.50, %.52, %.54) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -52,60 +68,91 @@ var a: [i32; 9] = (1, 2, 3, 4, 5, 6, 7, 8, 9); // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc11_14.1: i32 = int_value 9 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_14: Core.IntLiteral = int_value 9 [template = constants.%.1] // CHECK:STDOUT: %.loc11_9.1: type = value_of_initializer %int.make_type_32 [template = i32] // CHECK:STDOUT: %.loc11_9.2: type = converted %int.make_type_32, %.loc11_9.1 [template = i32] -// CHECK:STDOUT: %.loc11_14.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc11_14.3: = bound_method %.loc11_14.1, %.loc11_14.2 [template = constants.%.26] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc11_14.3(%.loc11_14.1) [template = constants.%.27] -// CHECK:STDOUT: %.loc11_14.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.27] -// CHECK:STDOUT: %.loc11_14.5: Core.IntLiteral = converted %.loc11_14.1, %.loc11_14.4 [template = constants.%.27] -// CHECK:STDOUT: %.loc11_15: type = array_type %.loc11_14.5, i32 [template = constants.%.28] -// CHECK:STDOUT: %a.var: ref %.28 = var a -// CHECK:STDOUT: %a: ref %.28 = bind_name a, %a.var +// CHECK:STDOUT: %.loc11_15: type = array_type %.loc11_14, i32 [template = constants.%.2] +// CHECK:STDOUT: %a.var: ref %.2 = var a +// CHECK:STDOUT: %a: ref %.2 = bind_name a, %a.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_20: i32 = int_value 1 [template = constants.%.30] -// CHECK:STDOUT: %.loc11_23: i32 = int_value 2 [template = constants.%.31] -// CHECK:STDOUT: %.loc11_26: i32 = int_value 3 [template = constants.%.32] -// CHECK:STDOUT: %.loc11_29: i32 = int_value 4 [template = constants.%.33] -// CHECK:STDOUT: %.loc11_32: i32 = int_value 5 [template = constants.%.34] -// CHECK:STDOUT: %.loc11_35: i32 = int_value 6 [template = constants.%.35] -// CHECK:STDOUT: %.loc11_38: i32 = int_value 7 [template = constants.%.36] -// CHECK:STDOUT: %.loc11_41: i32 = int_value 8 [template = constants.%.37] -// CHECK:STDOUT: %.loc11_44: i32 = int_value 9 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_20: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc11_23: Core.IntLiteral = int_value 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_26: Core.IntLiteral = int_value 3 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_29: Core.IntLiteral = int_value 4 [template = constants.%.7] +// CHECK:STDOUT: %.loc11_32: Core.IntLiteral = int_value 5 [template = constants.%.8] +// CHECK:STDOUT: %.loc11_35: Core.IntLiteral = int_value 6 [template = constants.%.9] +// CHECK:STDOUT: %.loc11_38: Core.IntLiteral = int_value 7 [template = constants.%.10] +// CHECK:STDOUT: %.loc11_41: Core.IntLiteral = int_value 8 [template = constants.%.11] +// CHECK:STDOUT: %.loc11_44: Core.IntLiteral = int_value 9 [template = constants.%.1] // CHECK:STDOUT: %.loc11_45.1: %tuple.type = tuple_literal (%.loc11_20, %.loc11_23, %.loc11_26, %.loc11_29, %.loc11_32, %.loc11_35, %.loc11_38, %.loc11_41, %.loc11_44) -// CHECK:STDOUT: %.loc11_45.2: i32 = int_value 0 [template = constants.%.38] -// CHECK:STDOUT: %.loc11_45.3: ref i32 = array_index file.%a.var, %.loc11_45.2 -// CHECK:STDOUT: %.loc11_45.4: init i32 = initialize_from %.loc11_20 to %.loc11_45.3 [template = constants.%.30] -// CHECK:STDOUT: %.loc11_45.5: i32 = int_value 1 [template = constants.%.30] +// CHECK:STDOUT: %.loc11_45.2: %Convert.type.2 = interface_witness_access constants.%.36, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_45.3: = bound_method %.loc11_20, %.loc11_45.2 [template = constants.%.37] +// CHECK:STDOUT: %int.convert_checked.loc11_45.1: init i32 = call %.loc11_45.3(%.loc11_20) [template = constants.%.38] +// CHECK:STDOUT: %.loc11_45.4: init i32 = converted %.loc11_20, %int.convert_checked.loc11_45.1 [template = constants.%.38] +// CHECK:STDOUT: %.loc11_45.5: i32 = int_value 0 [template = constants.%.12] // CHECK:STDOUT: %.loc11_45.6: ref i32 = array_index file.%a.var, %.loc11_45.5 -// CHECK:STDOUT: %.loc11_45.7: init i32 = initialize_from %.loc11_23 to %.loc11_45.6 [template = constants.%.31] -// CHECK:STDOUT: %.loc11_45.8: i32 = int_value 2 [template = constants.%.31] -// CHECK:STDOUT: %.loc11_45.9: ref i32 = array_index file.%a.var, %.loc11_45.8 -// CHECK:STDOUT: %.loc11_45.10: init i32 = initialize_from %.loc11_26 to %.loc11_45.9 [template = constants.%.32] -// CHECK:STDOUT: %.loc11_45.11: i32 = int_value 3 [template = constants.%.32] +// CHECK:STDOUT: %.loc11_45.7: init i32 = initialize_from %.loc11_45.4 to %.loc11_45.6 [template = constants.%.38] +// CHECK:STDOUT: %.loc11_45.8: %Convert.type.2 = interface_witness_access constants.%.36, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_45.9: = bound_method %.loc11_23, %.loc11_45.8 [template = constants.%.39] +// CHECK:STDOUT: %int.convert_checked.loc11_45.2: init i32 = call %.loc11_45.9(%.loc11_23) [template = constants.%.40] +// CHECK:STDOUT: %.loc11_45.10: init i32 = converted %.loc11_23, %int.convert_checked.loc11_45.2 [template = constants.%.40] +// CHECK:STDOUT: %.loc11_45.11: i32 = int_value 1 [template = constants.%.38] // CHECK:STDOUT: %.loc11_45.12: ref i32 = array_index file.%a.var, %.loc11_45.11 -// CHECK:STDOUT: %.loc11_45.13: init i32 = initialize_from %.loc11_29 to %.loc11_45.12 [template = constants.%.33] -// CHECK:STDOUT: %.loc11_45.14: i32 = int_value 4 [template = constants.%.33] -// CHECK:STDOUT: %.loc11_45.15: ref i32 = array_index file.%a.var, %.loc11_45.14 -// CHECK:STDOUT: %.loc11_45.16: init i32 = initialize_from %.loc11_32 to %.loc11_45.15 [template = constants.%.34] -// CHECK:STDOUT: %.loc11_45.17: i32 = int_value 5 [template = constants.%.34] +// CHECK:STDOUT: %.loc11_45.13: init i32 = initialize_from %.loc11_45.10 to %.loc11_45.12 [template = constants.%.40] +// CHECK:STDOUT: %.loc11_45.14: %Convert.type.2 = interface_witness_access constants.%.36, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_45.15: = bound_method %.loc11_26, %.loc11_45.14 [template = constants.%.41] +// CHECK:STDOUT: %int.convert_checked.loc11_45.3: init i32 = call %.loc11_45.15(%.loc11_26) [template = constants.%.42] +// CHECK:STDOUT: %.loc11_45.16: init i32 = converted %.loc11_26, %int.convert_checked.loc11_45.3 [template = constants.%.42] +// CHECK:STDOUT: %.loc11_45.17: i32 = int_value 2 [template = constants.%.40] // CHECK:STDOUT: %.loc11_45.18: ref i32 = array_index file.%a.var, %.loc11_45.17 -// CHECK:STDOUT: %.loc11_45.19: init i32 = initialize_from %.loc11_35 to %.loc11_45.18 [template = constants.%.35] -// CHECK:STDOUT: %.loc11_45.20: i32 = int_value 6 [template = constants.%.35] -// CHECK:STDOUT: %.loc11_45.21: ref i32 = array_index file.%a.var, %.loc11_45.20 -// CHECK:STDOUT: %.loc11_45.22: init i32 = initialize_from %.loc11_38 to %.loc11_45.21 [template = constants.%.36] -// CHECK:STDOUT: %.loc11_45.23: i32 = int_value 7 [template = constants.%.36] +// CHECK:STDOUT: %.loc11_45.19: init i32 = initialize_from %.loc11_45.16 to %.loc11_45.18 [template = constants.%.42] +// CHECK:STDOUT: %.loc11_45.20: %Convert.type.2 = interface_witness_access constants.%.36, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_45.21: = bound_method %.loc11_29, %.loc11_45.20 [template = constants.%.43] +// CHECK:STDOUT: %int.convert_checked.loc11_45.4: init i32 = call %.loc11_45.21(%.loc11_29) [template = constants.%.44] +// CHECK:STDOUT: %.loc11_45.22: init i32 = converted %.loc11_29, %int.convert_checked.loc11_45.4 [template = constants.%.44] +// CHECK:STDOUT: %.loc11_45.23: i32 = int_value 3 [template = constants.%.42] // CHECK:STDOUT: %.loc11_45.24: ref i32 = array_index file.%a.var, %.loc11_45.23 -// CHECK:STDOUT: %.loc11_45.25: init i32 = initialize_from %.loc11_41 to %.loc11_45.24 [template = constants.%.37] -// CHECK:STDOUT: %.loc11_45.26: i32 = int_value 8 [template = constants.%.37] -// CHECK:STDOUT: %.loc11_45.27: ref i32 = array_index file.%a.var, %.loc11_45.26 -// CHECK:STDOUT: %.loc11_45.28: init i32 = initialize_from %.loc11_44 to %.loc11_45.27 [template = constants.%.1] -// CHECK:STDOUT: %.loc11_45.29: init %.28 = array_init (%.loc11_45.4, %.loc11_45.7, %.loc11_45.10, %.loc11_45.13, %.loc11_45.16, %.loc11_45.19, %.loc11_45.22, %.loc11_45.25, %.loc11_45.28) to file.%a.var [template = constants.%array] -// CHECK:STDOUT: %.loc11_46: init %.28 = converted %.loc11_45.1, %.loc11_45.29 [template = constants.%array] +// CHECK:STDOUT: %.loc11_45.25: init i32 = initialize_from %.loc11_45.22 to %.loc11_45.24 [template = constants.%.44] +// CHECK:STDOUT: %.loc11_45.26: %Convert.type.2 = interface_witness_access constants.%.36, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_45.27: = bound_method %.loc11_32, %.loc11_45.26 [template = constants.%.45] +// CHECK:STDOUT: %int.convert_checked.loc11_45.5: init i32 = call %.loc11_45.27(%.loc11_32) [template = constants.%.46] +// CHECK:STDOUT: %.loc11_45.28: init i32 = converted %.loc11_32, %int.convert_checked.loc11_45.5 [template = constants.%.46] +// CHECK:STDOUT: %.loc11_45.29: i32 = int_value 4 [template = constants.%.44] +// CHECK:STDOUT: %.loc11_45.30: ref i32 = array_index file.%a.var, %.loc11_45.29 +// CHECK:STDOUT: %.loc11_45.31: init i32 = initialize_from %.loc11_45.28 to %.loc11_45.30 [template = constants.%.46] +// CHECK:STDOUT: %.loc11_45.32: %Convert.type.2 = interface_witness_access constants.%.36, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_45.33: = bound_method %.loc11_35, %.loc11_45.32 [template = constants.%.47] +// CHECK:STDOUT: %int.convert_checked.loc11_45.6: init i32 = call %.loc11_45.33(%.loc11_35) [template = constants.%.48] +// CHECK:STDOUT: %.loc11_45.34: init i32 = converted %.loc11_35, %int.convert_checked.loc11_45.6 [template = constants.%.48] +// CHECK:STDOUT: %.loc11_45.35: i32 = int_value 5 [template = constants.%.46] +// CHECK:STDOUT: %.loc11_45.36: ref i32 = array_index file.%a.var, %.loc11_45.35 +// CHECK:STDOUT: %.loc11_45.37: init i32 = initialize_from %.loc11_45.34 to %.loc11_45.36 [template = constants.%.48] +// CHECK:STDOUT: %.loc11_45.38: %Convert.type.2 = interface_witness_access constants.%.36, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_45.39: = bound_method %.loc11_38, %.loc11_45.38 [template = constants.%.49] +// CHECK:STDOUT: %int.convert_checked.loc11_45.7: init i32 = call %.loc11_45.39(%.loc11_38) [template = constants.%.50] +// CHECK:STDOUT: %.loc11_45.40: init i32 = converted %.loc11_38, %int.convert_checked.loc11_45.7 [template = constants.%.50] +// CHECK:STDOUT: %.loc11_45.41: i32 = int_value 6 [template = constants.%.48] +// CHECK:STDOUT: %.loc11_45.42: ref i32 = array_index file.%a.var, %.loc11_45.41 +// CHECK:STDOUT: %.loc11_45.43: init i32 = initialize_from %.loc11_45.40 to %.loc11_45.42 [template = constants.%.50] +// CHECK:STDOUT: %.loc11_45.44: %Convert.type.2 = interface_witness_access constants.%.36, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_45.45: = bound_method %.loc11_41, %.loc11_45.44 [template = constants.%.51] +// CHECK:STDOUT: %int.convert_checked.loc11_45.8: init i32 = call %.loc11_45.45(%.loc11_41) [template = constants.%.52] +// CHECK:STDOUT: %.loc11_45.46: init i32 = converted %.loc11_41, %int.convert_checked.loc11_45.8 [template = constants.%.52] +// CHECK:STDOUT: %.loc11_45.47: i32 = int_value 7 [template = constants.%.50] +// CHECK:STDOUT: %.loc11_45.48: ref i32 = array_index file.%a.var, %.loc11_45.47 +// CHECK:STDOUT: %.loc11_45.49: init i32 = initialize_from %.loc11_45.46 to %.loc11_45.48 [template = constants.%.52] +// CHECK:STDOUT: %.loc11_45.50: %Convert.type.2 = interface_witness_access constants.%.36, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_45.51: = bound_method %.loc11_44, %.loc11_45.50 [template = constants.%.53] +// CHECK:STDOUT: %int.convert_checked.loc11_45.9: init i32 = call %.loc11_45.51(%.loc11_44) [template = constants.%.54] +// CHECK:STDOUT: %.loc11_45.52: init i32 = converted %.loc11_44, %int.convert_checked.loc11_45.9 [template = constants.%.54] +// CHECK:STDOUT: %.loc11_45.53: i32 = int_value 8 [template = constants.%.52] +// CHECK:STDOUT: %.loc11_45.54: ref i32 = array_index file.%a.var, %.loc11_45.53 +// CHECK:STDOUT: %.loc11_45.55: init i32 = initialize_from %.loc11_45.52 to %.loc11_45.54 [template = constants.%.54] +// CHECK:STDOUT: %.loc11_45.56: init %.2 = array_init (%.loc11_45.7, %.loc11_45.13, %.loc11_45.19, %.loc11_45.25, %.loc11_45.31, %.loc11_45.37, %.loc11_45.43, %.loc11_45.49, %.loc11_45.55) to file.%a.var [template = constants.%array] +// CHECK:STDOUT: %.loc11_46: init %.2 = converted %.loc11_45.1, %.loc11_45.56 [template = constants.%array] // CHECK:STDOUT: assign file.%a.var, %.loc11_46 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/as/adapter_conversion.carbon b/toolchain/check/testdata/as/adapter_conversion.carbon index 3875647242361..58b1849d0ae0e 100644 --- a/toolchain/check/testdata/as/adapter_conversion.carbon +++ b/toolchain/check/testdata/as/adapter_conversion.carbon @@ -97,10 +97,10 @@ class B { // We do not try to implicitly convert from the first operand of `as` to the // adapted type of the second operand. -// CHECK:STDERR: fail_adapt_init_from_struct.carbon:[[@LINE+6]]:12: error: cannot convert from `{.x: i32}` to `B` with `as` [ExplicitAsConversionFailure] +// CHECK:STDERR: fail_adapt_init_from_struct.carbon:[[@LINE+6]]:12: error: cannot convert from `{.x: Core.IntLiteral}` to `B` with `as` [ExplicitAsConversionFailure] // CHECK:STDERR: var b: B = {.x = 1} as B; // CHECK:STDERR: ^~~~~~~~~~~~~ -// CHECK:STDERR: fail_adapt_init_from_struct.carbon:[[@LINE+3]]:12: note: type `{.x: i32}` does not implement interface `As(B)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_adapt_init_from_struct.carbon:[[@LINE+3]]:12: note: type `{.x: Core.IntLiteral}` does not implement interface `As(B)` [MissingImplInMemberAccessNote] // CHECK:STDERR: var b: B = {.x = 1} as B; // CHECK:STDERR: ^~~~~~~~~~~~~ var b: B = {.x = 1} as B; @@ -116,17 +116,27 @@ var b: B = {.x = 1} as B; // CHECK:STDOUT: %Make: %Make.type = struct_value () [template] // CHECK:STDOUT: %.2: type = struct_type {.x: i32, .y: i32} [template] // CHECK:STDOUT: %.3: = complete_type_witness %.2 [template] -// CHECK:STDOUT: %.5: i32 = int_value 1 [template] -// CHECK:STDOUT: %.6: i32 = int_value 2 [template] -// CHECK:STDOUT: %struct: %A = struct_value (%.5, %.6) [template] +// CHECK:STDOUT: %.5: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.6: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.7: type = struct_type {.x: Core.IntLiteral, .y: Core.IntLiteral} [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: %.31: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.32: = bound_method %.5, %Convert.15 [template] +// CHECK:STDOUT: %.33: i32 = int_value 1 [template] +// CHECK:STDOUT: %.34: = bound_method %.6, %Convert.15 [template] +// CHECK:STDOUT: %.35: i32 = int_value 2 [template] +// CHECK:STDOUT: %struct: %A = struct_value (%.33, %.35) [template] // CHECK:STDOUT: %B: type = class_type @B [template] -// CHECK:STDOUT: %.7: = complete_type_witness %A [template] -// CHECK:STDOUT: %.8: type = ptr_type %B [template] +// CHECK:STDOUT: %.36: = complete_type_witness %A [template] +// CHECK:STDOUT: %.37: type = ptr_type %B [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -152,7 +162,7 @@ var b: B = {.x = 1} as B; // CHECK:STDOUT: %A.ref.loc18: type = name_ref A, %A.decl [template = constants.%A] // CHECK:STDOUT: %B.ref.loc21: type = name_ref B, %B.decl [template = constants.%B] // CHECK:STDOUT: %B.ref.loc22: type = name_ref B, %B.decl [template = constants.%B] -// CHECK:STDOUT: %.loc22: type = ptr_type %B [template = constants.%.8] +// CHECK:STDOUT: %.loc22: type = ptr_type %B [template = constants.%.37] // CHECK:STDOUT: %B.ref.loc24: type = name_ref B, %B.decl [template = constants.%B] // CHECK:STDOUT: %b_factory.var: ref %B = var b_factory // CHECK:STDOUT: %b_factory: ref %B = bind_name b_factory, %b_factory.var @@ -187,7 +197,7 @@ var b: B = {.x = 1} as B; // CHECK:STDOUT: class @B { // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A] // CHECK:STDOUT: adapt_decl %A -// CHECK:STDOUT: %.loc15: = complete_type_witness %A [template = constants.%.7] +// CHECK:STDOUT: %.loc15: = complete_type_witness %A [template = constants.%.36] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%B @@ -195,29 +205,45 @@ var b: B = {.x = 1} as B; // CHECK:STDOUT: // CHECK:STDOUT: fn @Make() -> %return: %A { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc9_18: i32 = int_value 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc9_26: i32 = int_value 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc9_27.1: %.2 = struct_literal (%.loc9_18, %.loc9_26) -// CHECK:STDOUT: %.loc9_27.2: ref i32 = class_element_access %return, element0 -// CHECK:STDOUT: %.loc9_27.3: init i32 = initialize_from %.loc9_18 to %.loc9_27.2 [template = constants.%.5] -// CHECK:STDOUT: %.loc9_27.4: ref i32 = class_element_access %return, element1 -// CHECK:STDOUT: %.loc9_27.5: init i32 = initialize_from %.loc9_26 to %.loc9_27.4 [template = constants.%.6] -// CHECK:STDOUT: %.loc9_27.6: init %A = class_init (%.loc9_27.3, %.loc9_27.5), %return [template = constants.%struct] -// CHECK:STDOUT: %.loc9_28: init %A = converted %.loc9_27.1, %.loc9_27.6 [template = constants.%struct] +// CHECK:STDOUT: %.loc9_18: Core.IntLiteral = int_value 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc9_26: Core.IntLiteral = int_value 2 [template = constants.%.6] +// CHECK:STDOUT: %.loc9_27.1: %.7 = struct_literal (%.loc9_18, %.loc9_26) +// CHECK:STDOUT: %.loc9_27.2: %Convert.type.2 = interface_witness_access constants.%.31, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_27.3: = bound_method %.loc9_18, %.loc9_27.2 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc9_27.1: init i32 = call %.loc9_27.3(%.loc9_18) [template = constants.%.33] +// CHECK:STDOUT: %.loc9_27.4: init i32 = converted %.loc9_18, %int.convert_checked.loc9_27.1 [template = constants.%.33] +// CHECK:STDOUT: %.loc9_27.5: ref i32 = class_element_access %return, element0 +// CHECK:STDOUT: %.loc9_27.6: init i32 = initialize_from %.loc9_27.4 to %.loc9_27.5 [template = constants.%.33] +// CHECK:STDOUT: %.loc9_27.7: %Convert.type.2 = interface_witness_access constants.%.31, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_27.8: = bound_method %.loc9_26, %.loc9_27.7 [template = constants.%.34] +// CHECK:STDOUT: %int.convert_checked.loc9_27.2: init i32 = call %.loc9_27.8(%.loc9_26) [template = constants.%.35] +// CHECK:STDOUT: %.loc9_27.9: init i32 = converted %.loc9_26, %int.convert_checked.loc9_27.2 [template = constants.%.35] +// CHECK:STDOUT: %.loc9_27.10: ref i32 = class_element_access %return, element1 +// CHECK:STDOUT: %.loc9_27.11: init i32 = initialize_from %.loc9_27.9 to %.loc9_27.10 [template = constants.%.35] +// CHECK:STDOUT: %.loc9_27.12: init %A = class_init (%.loc9_27.6, %.loc9_27.11), %return [template = constants.%struct] +// CHECK:STDOUT: %.loc9_28: init %A = converted %.loc9_27.1, %.loc9_27.12 [template = constants.%struct] // CHECK:STDOUT: return %.loc9_28 to %return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc17_22: i32 = int_value 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc17_30: i32 = int_value 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc17_31.1: %.2 = struct_literal (%.loc17_22, %.loc17_30) -// CHECK:STDOUT: %.loc17_31.2: ref i32 = class_element_access file.%a_ref.var, element0 -// CHECK:STDOUT: %.loc17_31.3: init i32 = initialize_from %.loc17_22 to %.loc17_31.2 [template = constants.%.5] -// CHECK:STDOUT: %.loc17_31.4: ref i32 = class_element_access file.%a_ref.var, element1 -// CHECK:STDOUT: %.loc17_31.5: init i32 = initialize_from %.loc17_30 to %.loc17_31.4 [template = constants.%.6] -// CHECK:STDOUT: %.loc17_31.6: init %A = class_init (%.loc17_31.3, %.loc17_31.5), file.%a_ref.var [template = constants.%struct] -// CHECK:STDOUT: %.loc17_32: init %A = converted %.loc17_31.1, %.loc17_31.6 [template = constants.%struct] +// CHECK:STDOUT: %.loc17_22: Core.IntLiteral = int_value 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc17_30: Core.IntLiteral = int_value 2 [template = constants.%.6] +// CHECK:STDOUT: %.loc17_31.1: %.7 = struct_literal (%.loc17_22, %.loc17_30) +// CHECK:STDOUT: %.loc17_31.2: %Convert.type.2 = interface_witness_access constants.%.31, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc17_31.3: = bound_method %.loc17_22, %.loc17_31.2 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc17_31.1: init i32 = call %.loc17_31.3(%.loc17_22) [template = constants.%.33] +// CHECK:STDOUT: %.loc17_31.4: init i32 = converted %.loc17_22, %int.convert_checked.loc17_31.1 [template = constants.%.33] +// CHECK:STDOUT: %.loc17_31.5: ref i32 = class_element_access file.%a_ref.var, element0 +// CHECK:STDOUT: %.loc17_31.6: init i32 = initialize_from %.loc17_31.4 to %.loc17_31.5 [template = constants.%.33] +// CHECK:STDOUT: %.loc17_31.7: %Convert.type.2 = interface_witness_access constants.%.31, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc17_31.8: = bound_method %.loc17_30, %.loc17_31.7 [template = constants.%.34] +// CHECK:STDOUT: %int.convert_checked.loc17_31.2: init i32 = call %.loc17_31.8(%.loc17_30) [template = constants.%.35] +// CHECK:STDOUT: %.loc17_31.9: init i32 = converted %.loc17_30, %int.convert_checked.loc17_31.2 [template = constants.%.35] +// CHECK:STDOUT: %.loc17_31.10: ref i32 = class_element_access file.%a_ref.var, element1 +// CHECK:STDOUT: %.loc17_31.11: init i32 = initialize_from %.loc17_31.9 to %.loc17_31.10 [template = constants.%.35] +// CHECK:STDOUT: %.loc17_31.12: init %A = class_init (%.loc17_31.6, %.loc17_31.11), file.%a_ref.var [template = constants.%struct] +// CHECK:STDOUT: %.loc17_32: init %A = converted %.loc17_31.1, %.loc17_31.12 [template = constants.%struct] // CHECK:STDOUT: assign file.%a_ref.var, %.loc17_32 // CHECK:STDOUT: %a_ref.ref.loc18: ref %A = name_ref a_ref, file.%a_ref // CHECK:STDOUT: %.loc18: %A = bind_value %a_ref.ref.loc18 @@ -231,8 +257,8 @@ var b: B = {.x = 1} as B; // CHECK:STDOUT: %B.ref.loc22: type = name_ref B, file.%B.decl [template = constants.%B] // CHECK:STDOUT: %.loc22_25.1: ref %B = as_compatible %a_ref.ref.loc22 // CHECK:STDOUT: %.loc22_25.2: ref %B = converted %a_ref.ref.loc22, %.loc22_25.1 -// CHECK:STDOUT: %.loc22_17: %.8 = addr_of %.loc22_25.2 -// CHECK:STDOUT: %b_ptr: %.8 = bind_name b_ptr, %.loc22_17 +// CHECK:STDOUT: %.loc22_17: %.37 = addr_of %.loc22_25.2 +// CHECK:STDOUT: %b_ptr: %.37 = bind_name b_ptr, %.loc22_17 // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A] // CHECK:STDOUT: %Make.ref: %Make.type = name_ref Make, @A.%Make.decl [template = constants.%Make] // CHECK:STDOUT: %.loc24_5: ref %B = splice_block file.%b_factory.var {} @@ -251,12 +277,19 @@ var b: B = {.x = 1} as B; // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %.1: = complete_type_witness i32 [template] -// CHECK:STDOUT: %.2: i32 = int_value 1 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @As(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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .As = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -290,13 +323,18 @@ var b: B = {.x = 1} as B; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8_13: i32 = int_value 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc8_13: Core.IntLiteral = int_value 1 [template = constants.%.2] // CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc8_18.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] // CHECK:STDOUT: %.loc8_18.2: type = converted %int.make_type_32.loc8, %.loc8_18.1 [template = i32] +// CHECK:STDOUT: %.loc8_15.1: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc8_15.2: = bound_method %.loc8_13, %.loc8_15.1 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc8_15.2(%.loc8_13) [template = constants.%.28] +// CHECK:STDOUT: %.loc8_15.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.28] +// CHECK:STDOUT: %.loc8_15.4: i32 = converted %.loc8_13, %.loc8_15.3 [template = constants.%.28] // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A] -// CHECK:STDOUT: %.loc8_23.1: %A = as_compatible %.loc8_13 [template = constants.%.2] -// CHECK:STDOUT: %.loc8_23.2: %A = converted %.loc8_13, %.loc8_23.1 [template = constants.%.2] +// CHECK:STDOUT: %.loc8_23.1: %A = as_compatible %.loc8_15.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc8_23.2: %A = converted %.loc8_15.4, %.loc8_23.1 [template = constants.%.28] // CHECK:STDOUT: %a: %A = bind_name a, %.loc8_23.2 // CHECK:STDOUT: %a.ref: %A = name_ref a, %a // CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%Int32() [template = i32] @@ -400,14 +438,24 @@ var b: B = {.x = 1} as B; // CHECK:STDOUT: %.3: = complete_type_witness %.2 [template] // CHECK:STDOUT: %B: type = class_type @B [template] // CHECK:STDOUT: %.5: = complete_type_witness %A [template] -// CHECK:STDOUT: %.6: i32 = int_value 1 [template] -// CHECK:STDOUT: %.7: i32 = int_value 2 [template] -// CHECK:STDOUT: %struct: %A = struct_value (%.6, %.7) [template] +// CHECK:STDOUT: %.6: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.7: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.8: type = struct_type {.x: Core.IntLiteral, .y: Core.IntLiteral} [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: %.32: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.33: = bound_method %.6, %Convert.15 [template] +// CHECK:STDOUT: %.34: i32 = int_value 1 [template] +// CHECK:STDOUT: %.35: = bound_method %.7, %Convert.15 [template] +// CHECK:STDOUT: %.36: i32 = int_value 2 [template] +// CHECK:STDOUT: %struct: %A = struct_value (%.34, %.36) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -458,35 +506,51 @@ var b: B = {.x = 1} as B; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc13_25: i32 = int_value 1 [template = constants.%.6] -// CHECK:STDOUT: %.loc13_33: i32 = int_value 2 [template = constants.%.7] -// CHECK:STDOUT: %.loc13_34.1: %.2 = struct_literal (%.loc13_25, %.loc13_33) +// CHECK:STDOUT: %.loc13_25: Core.IntLiteral = int_value 1 [template = constants.%.6] +// CHECK:STDOUT: %.loc13_33: Core.IntLiteral = int_value 2 [template = constants.%.7] +// CHECK:STDOUT: %.loc13_34.1: %.8 = struct_literal (%.loc13_25, %.loc13_33) // CHECK:STDOUT: %A.ref.loc13: type = name_ref A, file.%A.decl [template = constants.%A] -// CHECK:STDOUT: %.loc13_34.2: ref %A = temporary_storage -// CHECK:STDOUT: %.loc13_34.3: ref i32 = class_element_access %.loc13_34.2, element0 -// CHECK:STDOUT: %.loc13_34.4: init i32 = initialize_from %.loc13_25 to %.loc13_34.3 [template = constants.%.6] -// CHECK:STDOUT: %.loc13_34.5: ref i32 = class_element_access %.loc13_34.2, element1 -// CHECK:STDOUT: %.loc13_34.6: init i32 = initialize_from %.loc13_33 to %.loc13_34.5 [template = constants.%.7] -// CHECK:STDOUT: %.loc13_34.7: init %A = class_init (%.loc13_34.4, %.loc13_34.6), %.loc13_34.2 [template = constants.%struct] -// CHECK:STDOUT: %.loc13_34.8: ref %A = temporary %.loc13_34.2, %.loc13_34.7 -// CHECK:STDOUT: %.loc13_36: ref %A = converted %.loc13_34.1, %.loc13_34.8 +// CHECK:STDOUT: %.loc13_34.2: %Convert.type.2 = interface_witness_access constants.%.32, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_34.3: = bound_method %.loc13_25, %.loc13_34.2 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc13_34.1: init i32 = call %.loc13_34.3(%.loc13_25) [template = constants.%.34] +// CHECK:STDOUT: %.loc13_34.4: init i32 = converted %.loc13_25, %int.convert_checked.loc13_34.1 [template = constants.%.34] +// CHECK:STDOUT: %.loc13_34.5: ref %A = temporary_storage +// CHECK:STDOUT: %.loc13_34.6: ref i32 = class_element_access %.loc13_34.5, element0 +// CHECK:STDOUT: %.loc13_34.7: init i32 = initialize_from %.loc13_34.4 to %.loc13_34.6 [template = constants.%.34] +// CHECK:STDOUT: %.loc13_34.8: %Convert.type.2 = interface_witness_access constants.%.32, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_34.9: = bound_method %.loc13_33, %.loc13_34.8 [template = constants.%.35] +// CHECK:STDOUT: %int.convert_checked.loc13_34.2: init i32 = call %.loc13_34.9(%.loc13_33) [template = constants.%.36] +// CHECK:STDOUT: %.loc13_34.10: init i32 = converted %.loc13_33, %int.convert_checked.loc13_34.2 [template = constants.%.36] +// CHECK:STDOUT: %.loc13_34.11: ref i32 = class_element_access %.loc13_34.5, element1 +// CHECK:STDOUT: %.loc13_34.12: init i32 = initialize_from %.loc13_34.10 to %.loc13_34.11 [template = constants.%.36] +// CHECK:STDOUT: %.loc13_34.13: init %A = class_init (%.loc13_34.7, %.loc13_34.12), %.loc13_34.5 [template = constants.%struct] +// CHECK:STDOUT: %.loc13_34.14: ref %A = temporary %.loc13_34.5, %.loc13_34.13 +// CHECK:STDOUT: %.loc13_36: ref %A = converted %.loc13_34.1, %.loc13_34.14 // CHECK:STDOUT: %B.ref.loc13: type = name_ref B, file.%B.decl [template = constants.%B] // CHECK:STDOUT: %.loc13_42.1: ref %B = as_compatible %.loc13_36 // CHECK:STDOUT: %.loc13_42.2: ref %B = converted %.loc13_36, %.loc13_42.1 // CHECK:STDOUT: %.loc13_42.3: %B = bind_value %.loc13_42.2 // CHECK:STDOUT: %b_value: %B = bind_name b_value, %.loc13_42.3 -// CHECK:STDOUT: %.loc24_24: i32 = int_value 1 [template = constants.%.6] -// CHECK:STDOUT: %.loc24_32: i32 = int_value 2 [template = constants.%.7] -// CHECK:STDOUT: %.loc24_33.1: %.2 = struct_literal (%.loc24_24, %.loc24_32) +// CHECK:STDOUT: %.loc24_24: Core.IntLiteral = int_value 1 [template = constants.%.6] +// CHECK:STDOUT: %.loc24_32: Core.IntLiteral = int_value 2 [template = constants.%.7] +// CHECK:STDOUT: %.loc24_33.1: %.8 = struct_literal (%.loc24_24, %.loc24_32) // CHECK:STDOUT: %A.ref.loc24: type = name_ref A, file.%A.decl [template = constants.%A] -// CHECK:STDOUT: %.loc24_33.2: ref %A = temporary_storage -// CHECK:STDOUT: %.loc24_33.3: ref i32 = class_element_access %.loc24_33.2, element0 -// CHECK:STDOUT: %.loc24_33.4: init i32 = initialize_from %.loc24_24 to %.loc24_33.3 [template = constants.%.6] -// CHECK:STDOUT: %.loc24_33.5: ref i32 = class_element_access %.loc24_33.2, element1 -// CHECK:STDOUT: %.loc24_33.6: init i32 = initialize_from %.loc24_32 to %.loc24_33.5 [template = constants.%.7] -// CHECK:STDOUT: %.loc24_33.7: init %A = class_init (%.loc24_33.4, %.loc24_33.6), %.loc24_33.2 [template = constants.%struct] -// CHECK:STDOUT: %.loc24_33.8: ref %A = temporary %.loc24_33.2, %.loc24_33.7 -// CHECK:STDOUT: %.loc24_35: ref %A = converted %.loc24_33.1, %.loc24_33.8 +// CHECK:STDOUT: %.loc24_33.2: %Convert.type.2 = interface_witness_access constants.%.32, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc24_33.3: = bound_method %.loc24_24, %.loc24_33.2 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc24_33.1: init i32 = call %.loc24_33.3(%.loc24_24) [template = constants.%.34] +// CHECK:STDOUT: %.loc24_33.4: init i32 = converted %.loc24_24, %int.convert_checked.loc24_33.1 [template = constants.%.34] +// CHECK:STDOUT: %.loc24_33.5: ref %A = temporary_storage +// CHECK:STDOUT: %.loc24_33.6: ref i32 = class_element_access %.loc24_33.5, element0 +// CHECK:STDOUT: %.loc24_33.7: init i32 = initialize_from %.loc24_33.4 to %.loc24_33.6 [template = constants.%.34] +// CHECK:STDOUT: %.loc24_33.8: %Convert.type.2 = interface_witness_access constants.%.32, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc24_33.9: = bound_method %.loc24_32, %.loc24_33.8 [template = constants.%.35] +// CHECK:STDOUT: %int.convert_checked.loc24_33.2: init i32 = call %.loc24_33.9(%.loc24_32) [template = constants.%.36] +// CHECK:STDOUT: %.loc24_33.10: init i32 = converted %.loc24_32, %int.convert_checked.loc24_33.2 [template = constants.%.36] +// CHECK:STDOUT: %.loc24_33.11: ref i32 = class_element_access %.loc24_33.5, element1 +// CHECK:STDOUT: %.loc24_33.12: init i32 = initialize_from %.loc24_33.10 to %.loc24_33.11 [template = constants.%.36] +// CHECK:STDOUT: %.loc24_33.13: init %A = class_init (%.loc24_33.7, %.loc24_33.12), %.loc24_33.5 [template = constants.%struct] +// CHECK:STDOUT: %.loc24_33.14: ref %A = temporary %.loc24_33.5, %.loc24_33.13 +// CHECK:STDOUT: %.loc24_35: ref %A = converted %.loc24_33.1, %.loc24_33.14 // CHECK:STDOUT: %B.ref.loc24: type = name_ref B, file.%B.decl [template = constants.%B] // CHECK:STDOUT: %.loc24_41.1: ref %B = as_compatible %.loc24_35 // CHECK:STDOUT: %.loc24_41.2: ref %B = converted %.loc24_35, %.loc24_41.1 @@ -506,7 +570,8 @@ var b: B = {.x = 1} as B; // CHECK:STDOUT: %.3: = complete_type_witness %.2 [template] // CHECK:STDOUT: %B: type = class_type @B [template] // CHECK:STDOUT: %.5: = complete_type_witness %A [template] -// CHECK:STDOUT: %.6: i32 = int_value 1 [template] +// CHECK:STDOUT: %.6: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.7: type = struct_type {.x: Core.IntLiteral} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -556,8 +621,8 @@ var b: B = {.x = 1} as B; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc21_18: i32 = int_value 1 [template = constants.%.6] -// CHECK:STDOUT: %.loc21_19: %.2 = struct_literal (%.loc21_18) +// CHECK:STDOUT: %.loc21_18: Core.IntLiteral = int_value 1 [template = constants.%.6] +// CHECK:STDOUT: %.loc21_19: %.7 = struct_literal (%.loc21_18) // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B] // CHECK:STDOUT: %.loc21_21: %B = converted %.loc21_19, [template = ] // CHECK:STDOUT: assign file.%b.var, diff --git a/toolchain/check/testdata/as/basic.carbon b/toolchain/check/testdata/as/basic.carbon index 6b506e36be64b..7aeba674db1a0 100644 --- a/toolchain/check/testdata/as/basic.carbon +++ b/toolchain/check/testdata/as/basic.carbon @@ -19,12 +19,19 @@ fn Main() -> i32 { // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %Main.type: type = fn_type @Main [template] // CHECK:STDOUT: %Main: %Main.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @As(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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .As = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -50,10 +57,15 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc12_10: i32 = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc12_10: Core.IntLiteral = int_value 1 [template = constants.%.1] // CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc12_15.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] // CHECK:STDOUT: %.loc12_15.2: type = converted %int.make_type_32.loc12, %.loc12_15.1 [template = i32] -// CHECK:STDOUT: return %.loc12_10 +// CHECK:STDOUT: %.loc12_12.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_12.2: = bound_method %.loc12_10, %.loc12_12.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc12_12.2(%.loc12_10) [template = constants.%.27] +// CHECK:STDOUT: %.loc12_12.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc12_12.4: i32 = converted %.loc12_10, %.loc12_12.3 [template = constants.%.27] +// CHECK:STDOUT: return %.loc12_12.4 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/as/fail_no_conversion.carbon b/toolchain/check/testdata/as/fail_no_conversion.carbon index 044a7a77703a7..65f6b1441c0e7 100644 --- a/toolchain/check/testdata/as/fail_no_conversion.carbon +++ b/toolchain/check/testdata/as/fail_no_conversion.carbon @@ -8,10 +8,10 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/as/fail_no_conversion.carbon -// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+6]]:21: error: cannot convert from `i32` to `(i32, i32)` with `as` [ExplicitAsConversionFailure] +// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+6]]:21: error: cannot convert from `Core.IntLiteral` to `(i32, i32)` with `as` [ExplicitAsConversionFailure] // CHECK:STDERR: let n: (i32, i32) = 1 as (i32, i32); // CHECK:STDERR: ^~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+3]]:21: note: type `i32` does not implement interface `As((i32, i32))` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+3]]:21: note: type `Core.IntLiteral` does not implement interface `As((i32, i32))` [MissingImplInMemberAccessNote] // CHECK:STDERR: let n: (i32, i32) = 1 as (i32, i32); // CHECK:STDERR: ^~~~~~~~~~~~~~~ let n: (i32, i32) = 1 as (i32, i32); @@ -23,7 +23,7 @@ let n: (i32, i32) = 1 as (i32, i32); // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %tuple.type.1: type = tuple_type (type, type) [template] // CHECK:STDOUT: %tuple.type.2: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.2: i32 = int_value 1 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -53,7 +53,7 @@ let n: (i32, i32) = 1 as (i32, i32); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc17_21: i32 = int_value 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc17_21: Core.IntLiteral = int_value 1 [template = constants.%.2] // CHECK:STDOUT: %int.make_type_32.loc17_27: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %int.make_type_32.loc17_32: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc17_35.1: %tuple.type.1 = tuple_literal (%int.make_type_32.loc17_27, %int.make_type_32.loc17_32) diff --git a/toolchain/check/testdata/as/fail_not_type.carbon b/toolchain/check/testdata/as/fail_not_type.carbon index 7de2d8cdbdc83..23c66da9a7824 100644 --- a/toolchain/check/testdata/as/fail_not_type.carbon +++ b/toolchain/check/testdata/as/fail_not_type.carbon @@ -8,10 +8,10 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/as/fail_not_type.carbon -// CHECK:STDERR: fail_not_type.carbon:[[@LINE+6]]:19: error: cannot implicitly convert from `i32` to `type` [ImplicitAsConversionFailure] +// CHECK:STDERR: fail_not_type.carbon:[[@LINE+6]]:19: error: cannot implicitly convert from `Core.IntLiteral` to `type` [ImplicitAsConversionFailure] // CHECK:STDERR: let n: i32 = 1 as 2; // CHECK:STDERR: ^ -// CHECK:STDERR: fail_not_type.carbon:[[@LINE+3]]:19: note: type `i32` does not implement interface `ImplicitAs(type)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_not_type.carbon:[[@LINE+3]]:19: note: type `Core.IntLiteral` does not implement interface `ImplicitAs(type)` [MissingImplInMemberAccessNote] // CHECK:STDERR: let n: i32 = 1 as 2; // CHECK:STDERR: ^ let n: i32 = 1 as 2; @@ -21,8 +21,8 @@ let n: i32 = 1 as 2; // CHECK:STDOUT: constants { // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %.2: i32 = int_value 2 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -47,8 +47,8 @@ let n: i32 = 1 as 2; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc17_14: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc17_19.1: i32 = int_value 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc17_14: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc17_19.1: Core.IntLiteral = int_value 2 [template = constants.%.2] // CHECK:STDOUT: %.loc17_19.2: type = converted %.loc17_19.1, [template = ] // CHECK:STDOUT: %n: i32 = bind_name n, // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/as/overloaded.carbon b/toolchain/check/testdata/as/overloaded.carbon index d10a94d9b4f74..618bc83980c11 100644 --- a/toolchain/check/testdata/as/overloaded.carbon +++ b/toolchain/check/testdata/as/overloaded.carbon @@ -43,8 +43,13 @@ let n: i32 = ((4 as i32) as X) as i32; // CHECK:STDOUT: %Convert.4: %Convert.type.4 = struct_value () [template] // CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @As(i32) [template] // CHECK:STDOUT: %.12: = interface_witness (%Convert.4) [template] -// CHECK:STDOUT: %.13: i32 = int_value 4 [template] -// CHECK:STDOUT: %.33: = bound_method %.13, %Convert.2 [template] +// CHECK:STDOUT: %.13: Core.IntLiteral = int_value 4 [template] +// CHECK:STDOUT: %Convert.type.18: type = fn_type @Convert.13 [template] +// CHECK:STDOUT: %Convert.18: %Convert.type.18 = struct_value () [template] +// CHECK:STDOUT: %.33: = interface_witness (%Convert.18) [template] +// CHECK:STDOUT: %.34: = bound_method %.13, %Convert.18 [template] +// CHECK:STDOUT: %.35: i32 = int_value 4 [template] +// CHECK:STDOUT: %.36: = bound_method %.35, %Convert.2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -168,16 +173,21 @@ let n: i32 = ((4 as i32) as X) as i32; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc23_16: i32 = int_value 4 [template = constants.%.13] +// CHECK:STDOUT: %.loc23_16: Core.IntLiteral = int_value 4 [template = constants.%.13] // CHECK:STDOUT: %int.make_type_32.loc23_21: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc23_21.1: type = value_of_initializer %int.make_type_32.loc23_21 [template = i32] // CHECK:STDOUT: %.loc23_21.2: type = converted %int.make_type_32.loc23_21, %.loc23_21.1 [template = i32] +// CHECK:STDOUT: %.loc23_18.1: %Convert.type.5 = interface_witness_access constants.%.33, element0 [template = constants.%Convert.18] +// CHECK:STDOUT: %.loc23_18.2: = bound_method %.loc23_16, %.loc23_18.1 [template = constants.%.34] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc23_18.2(%.loc23_16) [template = constants.%.35] +// CHECK:STDOUT: %.loc23_18.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.35] +// CHECK:STDOUT: %.loc23_18.4: i32 = converted %.loc23_16, %.loc23_18.3 [template = constants.%.35] // CHECK:STDOUT: %X.ref: type = name_ref X, file.%X.decl [template = constants.%X] // CHECK:STDOUT: %.loc23_26.1: %Convert.type.3 = interface_witness_access constants.%.8, element0 [template = constants.%Convert.2] -// CHECK:STDOUT: %.loc23_26.2: = bound_method %.loc23_16, %.loc23_26.1 [template = constants.%.33] +// CHECK:STDOUT: %.loc23_26.2: = bound_method %.loc23_18.4, %.loc23_26.1 [template = constants.%.36] // CHECK:STDOUT: %.loc23_26.3: ref %X = temporary_storage -// CHECK:STDOUT: %Convert.call.loc23_26: init %X = call %.loc23_26.2(%.loc23_16) to %.loc23_26.3 -// CHECK:STDOUT: %.loc23_26.4: init %X = converted %.loc23_16, %Convert.call.loc23_26 +// CHECK:STDOUT: %Convert.call.loc23_26: init %X = call %.loc23_26.2(%.loc23_18.4) to %.loc23_26.3 +// CHECK:STDOUT: %.loc23_26.4: init %X = converted %.loc23_18.4, %Convert.call.loc23_26 // CHECK:STDOUT: %int.make_type_32.loc23_35: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc23_35.1: type = value_of_initializer %int.make_type_32.loc23_35 [template = i32] // CHECK:STDOUT: %.loc23_35.2: type = converted %int.make_type_32.loc23_35, %.loc23_35.1 [template = i32] diff --git a/toolchain/check/testdata/basics/builtin_types.carbon b/toolchain/check/testdata/basics/builtin_types.carbon index 9eb8eecea1780..fa04b5f46f2c6 100644 --- a/toolchain/check/testdata/basics/builtin_types.carbon +++ b/toolchain/check/testdata/basics/builtin_types.carbon @@ -18,18 +18,25 @@ var test_type: type = i32; // CHECK:STDOUT: constants { // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] -// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 64 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 0 [template] +// CHECK:STDOUT: %.28: Core.IntLiteral = int_value 64 [template] // CHECK:STDOUT: %Float.type: type = fn_type @Float [template] // CHECK:STDOUT: %Float: %Float.type = struct_value () [template] -// CHECK:STDOUT: %.3: f64 = float_literal 0.10000000000000001 [template] -// CHECK:STDOUT: %.5: String = string_literal "Test" [template] +// CHECK:STDOUT: %.29: f64 = float_literal 0.10000000000000001 [template] +// CHECK:STDOUT: %.31: String = string_literal "Test" [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int32 = %import_ref.1 -// CHECK:STDOUT: .Float = %import_ref.2 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 +// CHECK:STDOUT: .Float = %import_ref.51 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -49,7 +56,7 @@ var test_type: type = i32; // CHECK:STDOUT: %.loc11_15.2: type = converted %int.make_type_32, %.loc11_15.1 [template = i32] // CHECK:STDOUT: %test_i32.var: ref i32 = var test_i32 // CHECK:STDOUT: %test_i32: ref i32 = bind_name test_i32, %test_i32.var -// CHECK:STDOUT: %.loc12_15.1: Core.IntLiteral = int_value 64 [template = constants.%.2] +// CHECK:STDOUT: %.loc12_15.1: Core.IntLiteral = int_value 64 [template = constants.%.28] // CHECK:STDOUT: %float.make_type: init type = call constants.%Float(%.loc12_15.1) [template = f64] // CHECK:STDOUT: %.loc12_15.2: type = value_of_initializer %float.make_type [template = f64] // CHECK:STDOUT: %.loc12_15.3: type = converted %float.make_type, %.loc12_15.2 [template = f64] @@ -61,11 +68,15 @@ var test_type: type = i32; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: assign file.%test_i32.var, %.loc11 -// CHECK:STDOUT: %.loc12: f64 = float_literal 0.10000000000000001 [template = constants.%.3] +// CHECK:STDOUT: %.loc11_21: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_22.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_22.2: = bound_method %.loc11_21, %.loc11_22.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc11_22.2(%.loc11_21) [template = constants.%.27] +// CHECK:STDOUT: %.loc11_22.3: init i32 = converted %.loc11_21, %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: assign file.%test_i32.var, %.loc11_22.3 +// CHECK:STDOUT: %.loc12: f64 = float_literal 0.10000000000000001 [template = constants.%.29] // CHECK:STDOUT: assign file.%test_f64.var, %.loc12 -// CHECK:STDOUT: %.loc13: String = string_literal "Test" [template = constants.%.5] +// CHECK:STDOUT: %.loc13: String = string_literal "Test" [template = constants.%.31] // CHECK:STDOUT: %test_str: String = bind_name test_str, %.loc13 // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: assign file.%test_type.var, %int.make_type_32 diff --git a/toolchain/check/testdata/basics/fail_non_type_as_type.carbon b/toolchain/check/testdata/basics/fail_non_type_as_type.carbon index d5461bceb049f..822ffe0b89818 100644 --- a/toolchain/check/testdata/basics/fail_non_type_as_type.carbon +++ b/toolchain/check/testdata/basics/fail_non_type_as_type.carbon @@ -8,10 +8,10 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/fail_non_type_as_type.carbon -// CHECK:STDERR: fail_non_type_as_type.carbon:[[@LINE+6]]:1: error: cannot implicitly convert from `i32` to `type` [ImplicitAsConversionFailure] +// CHECK:STDERR: fail_non_type_as_type.carbon:[[@LINE+6]]:1: error: cannot implicitly convert from `Core.IntLiteral` to `type` [ImplicitAsConversionFailure] // CHECK:STDERR: var x: type = 42; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_non_type_as_type.carbon:[[@LINE+3]]:1: note: type `i32` does not implement interface `ImplicitAs(type)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_non_type_as_type.carbon:[[@LINE+3]]:1: note: type `Core.IntLiteral` does not implement interface `ImplicitAs(type)` [MissingImplInMemberAccessNote] // CHECK:STDERR: var x: type = 42; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ var x: type = 42; @@ -19,7 +19,7 @@ var x: type = 42; // CHECK:STDOUT: --- fail_non_type_as_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_value 42 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 42 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -42,7 +42,7 @@ var x: type = 42; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc17_15: i32 = int_value 42 [template = constants.%.1] +// CHECK:STDOUT: %.loc17_15: Core.IntLiteral = int_value 42 [template = constants.%.1] // CHECK:STDOUT: %.loc17_17: type = converted %.loc17_15, [template = ] // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/basics/fail_numeric_literal_overflow.carbon b/toolchain/check/testdata/basics/fail_numeric_literal_overflow.carbon index ec8088ed16620..fedd87cdc1356 100644 --- a/toolchain/check/testdata/basics/fail_numeric_literal_overflow.carbon +++ b/toolchain/check/testdata/basics/fail_numeric_literal_overflow.carbon @@ -8,21 +8,21 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/fail_numeric_literal_overflow.carbon -// CHECK:STDERR: fail_numeric_literal_overflow.carbon:[[@LINE+4]]:14: error: integer literal with value 39999999999999999993 does not fit in i32 [IntLiteralTooLargeForI32] +// CHECK:STDERR: fail_numeric_literal_overflow.carbon:[[@LINE+4]]:1: error: integer value 39999999999999999993 too large for type `i32` [IntTooLargeForType] // CHECK:STDERR: let a: i32 = 39999999999999999993; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: let a: i32 = 39999999999999999993; -// CHECK:STDERR: fail_numeric_literal_overflow.carbon:[[@LINE+4]]:14: error: integer literal with value 2147483648 does not fit in i32 [IntLiteralTooLargeForI32] +// CHECK:STDERR: fail_numeric_literal_overflow.carbon:[[@LINE+4]]:1: error: integer value 2147483648 too large for type `i32` [IntTooLargeForType] // CHECK:STDERR: let b: i32 = 2_147_483_648; -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: let b: i32 = 2_147_483_648; -// CHECK:STDERR: fail_numeric_literal_overflow.carbon:[[@LINE+4]]:14: error: integer literal with value 2147483648 does not fit in i32 [IntLiteralTooLargeForI32] +// CHECK:STDERR: fail_numeric_literal_overflow.carbon:[[@LINE+4]]:1: error: integer value 2147483648 too large for type `i32` [IntTooLargeForType] // CHECK:STDERR: let c: i32 = 0x8000_0000; -// CHECK:STDERR: ^~~~~~~~~~~ +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: let c: i32 = 0x8000_0000; @@ -42,7 +42,17 @@ let e: f64 = 5.0e39999999999999999993; // CHECK:STDOUT: constants { // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 64 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 39999999999999999993 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 39999999999999999993 [template] +// CHECK:STDOUT: %.28: Core.IntLiteral = int_value 2147483648 [template] +// CHECK:STDOUT: %.29: = bound_method %.28, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 2147483648 [template] +// CHECK:STDOUT: %.31: Core.IntLiteral = int_value 64 [template] // CHECK:STDOUT: %Float.type: type = fn_type @Float [template] // CHECK:STDOUT: %Float: %Float.type = struct_value () [template] // CHECK:STDOUT: } @@ -50,7 +60,8 @@ let e: f64 = 5.0e39999999999999999993; // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int32 = %import_ref.1 -// CHECK:STDOUT: .Float = %import_ref.2 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 +// CHECK:STDOUT: .Float = %import_ref.51 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -75,11 +86,11 @@ let e: f64 = 5.0e39999999999999999993; // CHECK:STDOUT: %int.make_type_32.loc27: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc27_8.1: type = value_of_initializer %int.make_type_32.loc27 [template = i32] // CHECK:STDOUT: %.loc27_8.2: type = converted %int.make_type_32.loc27, %.loc27_8.1 [template = i32] -// CHECK:STDOUT: %.loc33_8.1: Core.IntLiteral = int_value 64 [template = constants.%.1] +// CHECK:STDOUT: %.loc33_8.1: Core.IntLiteral = int_value 64 [template = constants.%.31] // CHECK:STDOUT: %float.make_type.loc33: init type = call constants.%Float(%.loc33_8.1) [template = f64] // CHECK:STDOUT: %.loc33_8.2: type = value_of_initializer %float.make_type.loc33 [template = f64] // CHECK:STDOUT: %.loc33_8.3: type = converted %float.make_type.loc33, %.loc33_8.2 [template = f64] -// CHECK:STDOUT: %.loc38_8.1: Core.IntLiteral = int_value 64 [template = constants.%.1] +// CHECK:STDOUT: %.loc38_8.1: Core.IntLiteral = int_value 64 [template = constants.%.31] // CHECK:STDOUT: %float.make_type.loc38: init type = call constants.%Float(%.loc38_8.1) [template = f64] // CHECK:STDOUT: %.loc38_8.2: type = value_of_initializer %float.make_type.loc38 [template = f64] // CHECK:STDOUT: %.loc38_8.3: type = converted %float.make_type.loc38, %.loc38_8.2 [template = f64] @@ -87,9 +98,27 @@ let e: f64 = 5.0e39999999999999999993; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %a: i32 = bind_name a, -// CHECK:STDOUT: %b: i32 = bind_name b, -// CHECK:STDOUT: %c: i32 = bind_name c, +// CHECK:STDOUT: %.loc15_14: Core.IntLiteral = int_value 39999999999999999993 [template = constants.%.1] +// CHECK:STDOUT: %.loc15_34.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc15_34.2: = bound_method %.loc15_14, %.loc15_34.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc15: init i32 = call %.loc15_34.2(%.loc15_14) [template = constants.%.27] +// CHECK:STDOUT: %.loc15_34.3: i32 = value_of_initializer %int.convert_checked.loc15 [template = constants.%.27] +// CHECK:STDOUT: %.loc15_34.4: i32 = converted %.loc15_14, %.loc15_34.3 [template = constants.%.27] +// CHECK:STDOUT: %a: i32 = bind_name a, %.loc15_34.4 +// CHECK:STDOUT: %.loc21_14: Core.IntLiteral = int_value 2147483648 [template = constants.%.28] +// CHECK:STDOUT: %.loc21_27.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc21_27.2: = bound_method %.loc21_14, %.loc21_27.1 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc21: init i32 = call %.loc21_27.2(%.loc21_14) [template = constants.%.30] +// CHECK:STDOUT: %.loc21_27.3: i32 = value_of_initializer %int.convert_checked.loc21 [template = constants.%.30] +// CHECK:STDOUT: %.loc21_27.4: i32 = converted %.loc21_14, %.loc21_27.3 [template = constants.%.30] +// CHECK:STDOUT: %b: i32 = bind_name b, %.loc21_27.4 +// CHECK:STDOUT: %.loc27_14: Core.IntLiteral = int_value 2147483648 [template = constants.%.28] +// CHECK:STDOUT: %.loc27_25.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc27_25.2: = bound_method %.loc27_14, %.loc27_25.1 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc27: init i32 = call %.loc27_25.2(%.loc27_14) [template = constants.%.30] +// CHECK:STDOUT: %.loc27_25.3: i32 = value_of_initializer %int.convert_checked.loc27 [template = constants.%.30] +// CHECK:STDOUT: %.loc27_25.4: i32 = converted %.loc27_14, %.loc27_25.3 [template = constants.%.30] +// CHECK:STDOUT: %c: i32 = bind_name c, %.loc27_25.4 // CHECK:STDOUT: %d: f64 = bind_name d, // CHECK:STDOUT: %e: f64 = bind_name e, // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/basics/numeric_literals.carbon b/toolchain/check/testdata/basics/numeric_literals.carbon index 6a4ee616dcec9..231a9e613581b 100644 --- a/toolchain/check/testdata/basics/numeric_literals.carbon +++ b/toolchain/check/testdata/basics/numeric_literals.carbon @@ -36,37 +36,41 @@ fn F() { // CHECK:STDOUT: %F: %F.type = struct_value () [template] // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 6 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 6 [template] +// CHECK:STDOUT: %.2: type = array_type %.1, i32 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 8 [template] +// CHECK:STDOUT: %.5: Core.IntLiteral = int_value 9 [template] +// CHECK:STDOUT: %.6: Core.IntLiteral = int_value 2147483647 [template] +// CHECK:STDOUT: %tuple.type.1: type = tuple_type (Core.IntLiteral, Core.IntLiteral, Core.IntLiteral, Core.IntLiteral, Core.IntLiteral, Core.IntLiteral) [template] +// CHECK:STDOUT: %.7: i32 = int_value 0 [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: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] -// CHECK:STDOUT: %.27: Core.IntLiteral = int_value 6 [template] -// CHECK:STDOUT: %.28: type = array_type %.27, i32 [template] -// CHECK:STDOUT: %.30: i32 = int_value 8 [template] -// CHECK:STDOUT: %.31: i32 = int_value 9 [template] -// CHECK:STDOUT: %.32: i32 = int_value 2147483647 [template] -// CHECK:STDOUT: %tuple.type.1: type = tuple_type (i32, i32, i32, i32, i32, i32) [template] -// CHECK:STDOUT: %.33: i32 = int_value 0 [template] +// CHECK:STDOUT: %.31: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.32: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.33: i32 = int_value 8 [template] // CHECK:STDOUT: %.34: i32 = int_value 1 [template] -// CHECK:STDOUT: %.35: i32 = int_value 2 [template] -// CHECK:STDOUT: %.36: i32 = int_value 3 [template] -// CHECK:STDOUT: %.37: i32 = int_value 4 [template] -// CHECK:STDOUT: %.38: i32 = int_value 5 [template] -// CHECK:STDOUT: %array.1: %.28 = tuple_value (%.30, %.31, %.30, %.30, %.32, %.32) [template] -// CHECK:STDOUT: %.39: Core.IntLiteral = int_value 64 [template] +// CHECK:STDOUT: %.35: = bound_method %.5, %Convert.15 [template] +// CHECK:STDOUT: %.36: i32 = int_value 9 [template] +// CHECK:STDOUT: %.37: i32 = int_value 2 [template] +// CHECK:STDOUT: %.38: i32 = int_value 3 [template] +// CHECK:STDOUT: %.39: i32 = int_value 4 [template] +// CHECK:STDOUT: %.40: = bound_method %.6, %Convert.15 [template] +// CHECK:STDOUT: %.41: i32 = int_value 2147483647 [template] +// CHECK:STDOUT: %.42: i32 = int_value 5 [template] +// CHECK:STDOUT: %array.1: %.2 = tuple_value (%.33, %.36, %.33, %.33, %.41, %.41) [template] +// CHECK:STDOUT: %.43: Core.IntLiteral = int_value 64 [template] // CHECK:STDOUT: %Float.type: type = fn_type @Float [template] // CHECK:STDOUT: %Float: %Float.type = struct_value () [template] -// CHECK:STDOUT: %.40: type = array_type %.27, f64 [template] -// CHECK:STDOUT: %.42: f64 = float_literal 0.90000000000000002 [template] -// CHECK:STDOUT: %.43: f64 = float_literal 8 [template] -// CHECK:STDOUT: %.44: f64 = float_literal 80 [template] -// CHECK:STDOUT: %.45: f64 = float_literal 1.0E+7 [template] -// CHECK:STDOUT: %.46: f64 = float_literal 1.0E+8 [template] -// CHECK:STDOUT: %.47: f64 = float_literal 1.0E-8 [template] +// CHECK:STDOUT: %.44: type = array_type %.1, f64 [template] +// CHECK:STDOUT: %.46: f64 = float_literal 0.90000000000000002 [template] +// CHECK:STDOUT: %.47: f64 = float_literal 8 [template] +// CHECK:STDOUT: %.48: f64 = float_literal 80 [template] +// CHECK:STDOUT: %.49: f64 = float_literal 1.0E+7 [template] +// CHECK:STDOUT: %.50: f64 = float_literal 1.0E+8 [template] +// CHECK:STDOUT: %.51: f64 = float_literal 1.0E-8 [template] // CHECK:STDOUT: %tuple.type.2: type = tuple_type (f64, f64, f64, f64, f64, f64) [template] -// CHECK:STDOUT: %array.2: %.40 = tuple_value (%.42, %.43, %.44, %.45, %.46, %.47) [template] +// CHECK:STDOUT: %array.2: %.44 = tuple_value (%.46, %.47, %.48, %.49, %.50, %.51) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -91,85 +95,99 @@ fn F() { // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc14_19.1: i32 = int_value 6 [template = constants.%.1] +// CHECK:STDOUT: %.loc14_19: Core.IntLiteral = int_value 6 [template = constants.%.1] // CHECK:STDOUT: %.loc14_14.1: type = value_of_initializer %int.make_type_32 [template = i32] // CHECK:STDOUT: %.loc14_14.2: type = converted %int.make_type_32, %.loc14_14.1 [template = i32] -// CHECK:STDOUT: %.loc14_19.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc14_19.3: = bound_method %.loc14_19.1, %.loc14_19.2 [template = constants.%.26] -// CHECK:STDOUT: %int.convert_checked.loc14: init Core.IntLiteral = call %.loc14_19.3(%.loc14_19.1) [template = constants.%.27] -// CHECK:STDOUT: %.loc14_19.4: Core.IntLiteral = value_of_initializer %int.convert_checked.loc14 [template = constants.%.27] -// CHECK:STDOUT: %.loc14_19.5: Core.IntLiteral = converted %.loc14_19.1, %.loc14_19.4 [template = constants.%.27] -// CHECK:STDOUT: %.loc14_20: type = array_type %.loc14_19.5, i32 [template = constants.%.28] -// CHECK:STDOUT: %ints.var: ref %.28 = var ints -// CHECK:STDOUT: %ints: ref %.28 = bind_name ints, %ints.var -// CHECK:STDOUT: %.loc15: i32 = int_value 8 [template = constants.%.30] -// CHECK:STDOUT: %.loc16: i32 = int_value 9 [template = constants.%.31] -// CHECK:STDOUT: %.loc17: i32 = int_value 8 [template = constants.%.30] -// CHECK:STDOUT: %.loc18: i32 = int_value 8 [template = constants.%.30] -// CHECK:STDOUT: %.loc19: i32 = int_value 2147483647 [template = constants.%.32] -// CHECK:STDOUT: %.loc20: i32 = int_value 2147483647 [template = constants.%.32] +// CHECK:STDOUT: %.loc14_20: type = array_type %.loc14_19, i32 [template = constants.%.2] +// CHECK:STDOUT: %ints.var: ref %.2 = var ints +// CHECK:STDOUT: %ints: ref %.2 = bind_name ints, %ints.var +// CHECK:STDOUT: %.loc15: Core.IntLiteral = int_value 8 [template = constants.%.4] +// CHECK:STDOUT: %.loc16: Core.IntLiteral = int_value 9 [template = constants.%.5] +// CHECK:STDOUT: %.loc17: Core.IntLiteral = int_value 8 [template = constants.%.4] +// CHECK:STDOUT: %.loc18: Core.IntLiteral = int_value 8 [template = constants.%.4] +// CHECK:STDOUT: %.loc19: Core.IntLiteral = int_value 2147483647 [template = constants.%.6] +// CHECK:STDOUT: %.loc20: Core.IntLiteral = int_value 2147483647 [template = constants.%.6] // CHECK:STDOUT: %.loc21_3.1: %tuple.type.1 = tuple_literal (%.loc15, %.loc16, %.loc17, %.loc18, %.loc19, %.loc20) -// CHECK:STDOUT: %.loc21_3.2: i32 = int_value 0 [template = constants.%.33] -// CHECK:STDOUT: %.loc21_3.3: ref i32 = array_index %ints.var, %.loc21_3.2 -// CHECK:STDOUT: %.loc21_3.4: init i32 = initialize_from %.loc15 to %.loc21_3.3 [template = constants.%.30] -// CHECK:STDOUT: %.loc21_3.5: i32 = int_value 1 [template = constants.%.34] +// CHECK:STDOUT: %.loc21_3.2: %Convert.type.2 = interface_witness_access constants.%.31, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc21_3.3: = bound_method %.loc15, %.loc21_3.2 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc21_3.1: init i32 = call %.loc21_3.3(%.loc15) [template = constants.%.33] +// CHECK:STDOUT: %.loc21_3.4: init i32 = converted %.loc15, %int.convert_checked.loc21_3.1 [template = constants.%.33] +// CHECK:STDOUT: %.loc21_3.5: i32 = int_value 0 [template = constants.%.7] // CHECK:STDOUT: %.loc21_3.6: ref i32 = array_index %ints.var, %.loc21_3.5 -// CHECK:STDOUT: %.loc21_3.7: init i32 = initialize_from %.loc16 to %.loc21_3.6 [template = constants.%.31] -// CHECK:STDOUT: %.loc21_3.8: i32 = int_value 2 [template = constants.%.35] -// CHECK:STDOUT: %.loc21_3.9: ref i32 = array_index %ints.var, %.loc21_3.8 -// CHECK:STDOUT: %.loc21_3.10: init i32 = initialize_from %.loc17 to %.loc21_3.9 [template = constants.%.30] -// CHECK:STDOUT: %.loc21_3.11: i32 = int_value 3 [template = constants.%.36] +// CHECK:STDOUT: %.loc21_3.7: init i32 = initialize_from %.loc21_3.4 to %.loc21_3.6 [template = constants.%.33] +// CHECK:STDOUT: %.loc21_3.8: %Convert.type.2 = interface_witness_access constants.%.31, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc21_3.9: = bound_method %.loc16, %.loc21_3.8 [template = constants.%.35] +// CHECK:STDOUT: %int.convert_checked.loc21_3.2: init i32 = call %.loc21_3.9(%.loc16) [template = constants.%.36] +// CHECK:STDOUT: %.loc21_3.10: init i32 = converted %.loc16, %int.convert_checked.loc21_3.2 [template = constants.%.36] +// CHECK:STDOUT: %.loc21_3.11: i32 = int_value 1 [template = constants.%.34] // CHECK:STDOUT: %.loc21_3.12: ref i32 = array_index %ints.var, %.loc21_3.11 -// CHECK:STDOUT: %.loc21_3.13: init i32 = initialize_from %.loc18 to %.loc21_3.12 [template = constants.%.30] -// CHECK:STDOUT: %.loc21_3.14: i32 = int_value 4 [template = constants.%.37] -// CHECK:STDOUT: %.loc21_3.15: ref i32 = array_index %ints.var, %.loc21_3.14 -// CHECK:STDOUT: %.loc21_3.16: init i32 = initialize_from %.loc19 to %.loc21_3.15 [template = constants.%.32] -// CHECK:STDOUT: %.loc21_3.17: i32 = int_value 5 [template = constants.%.38] +// CHECK:STDOUT: %.loc21_3.13: init i32 = initialize_from %.loc21_3.10 to %.loc21_3.12 [template = constants.%.36] +// CHECK:STDOUT: %.loc21_3.14: %Convert.type.2 = interface_witness_access constants.%.31, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc21_3.15: = bound_method %.loc17, %.loc21_3.14 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc21_3.3: init i32 = call %.loc21_3.15(%.loc17) [template = constants.%.33] +// CHECK:STDOUT: %.loc21_3.16: init i32 = converted %.loc17, %int.convert_checked.loc21_3.3 [template = constants.%.33] +// CHECK:STDOUT: %.loc21_3.17: i32 = int_value 2 [template = constants.%.37] // CHECK:STDOUT: %.loc21_3.18: ref i32 = array_index %ints.var, %.loc21_3.17 -// CHECK:STDOUT: %.loc21_3.19: init i32 = initialize_from %.loc20 to %.loc21_3.18 [template = constants.%.32] -// CHECK:STDOUT: %.loc21_3.20: init %.28 = array_init (%.loc21_3.4, %.loc21_3.7, %.loc21_3.10, %.loc21_3.13, %.loc21_3.16, %.loc21_3.19) to %ints.var [template = constants.%array.1] -// CHECK:STDOUT: %.loc21_4: init %.28 = converted %.loc21_3.1, %.loc21_3.20 [template = constants.%array.1] +// CHECK:STDOUT: %.loc21_3.19: init i32 = initialize_from %.loc21_3.16 to %.loc21_3.18 [template = constants.%.33] +// CHECK:STDOUT: %.loc21_3.20: %Convert.type.2 = interface_witness_access constants.%.31, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc21_3.21: = bound_method %.loc18, %.loc21_3.20 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc21_3.4: init i32 = call %.loc21_3.21(%.loc18) [template = constants.%.33] +// CHECK:STDOUT: %.loc21_3.22: init i32 = converted %.loc18, %int.convert_checked.loc21_3.4 [template = constants.%.33] +// CHECK:STDOUT: %.loc21_3.23: i32 = int_value 3 [template = constants.%.38] +// CHECK:STDOUT: %.loc21_3.24: ref i32 = array_index %ints.var, %.loc21_3.23 +// CHECK:STDOUT: %.loc21_3.25: init i32 = initialize_from %.loc21_3.22 to %.loc21_3.24 [template = constants.%.33] +// CHECK:STDOUT: %.loc21_3.26: %Convert.type.2 = interface_witness_access constants.%.31, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc21_3.27: = bound_method %.loc19, %.loc21_3.26 [template = constants.%.40] +// CHECK:STDOUT: %int.convert_checked.loc21_3.5: init i32 = call %.loc21_3.27(%.loc19) [template = constants.%.41] +// CHECK:STDOUT: %.loc21_3.28: init i32 = converted %.loc19, %int.convert_checked.loc21_3.5 [template = constants.%.41] +// CHECK:STDOUT: %.loc21_3.29: i32 = int_value 4 [template = constants.%.39] +// CHECK:STDOUT: %.loc21_3.30: ref i32 = array_index %ints.var, %.loc21_3.29 +// CHECK:STDOUT: %.loc21_3.31: init i32 = initialize_from %.loc21_3.28 to %.loc21_3.30 [template = constants.%.41] +// CHECK:STDOUT: %.loc21_3.32: %Convert.type.2 = interface_witness_access constants.%.31, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc21_3.33: = bound_method %.loc20, %.loc21_3.32 [template = constants.%.40] +// CHECK:STDOUT: %int.convert_checked.loc21_3.6: init i32 = call %.loc21_3.33(%.loc20) [template = constants.%.41] +// CHECK:STDOUT: %.loc21_3.34: init i32 = converted %.loc20, %int.convert_checked.loc21_3.6 [template = constants.%.41] +// CHECK:STDOUT: %.loc21_3.35: i32 = int_value 5 [template = constants.%.42] +// CHECK:STDOUT: %.loc21_3.36: ref i32 = array_index %ints.var, %.loc21_3.35 +// CHECK:STDOUT: %.loc21_3.37: init i32 = initialize_from %.loc21_3.34 to %.loc21_3.36 [template = constants.%.41] +// CHECK:STDOUT: %.loc21_3.38: init %.2 = array_init (%.loc21_3.7, %.loc21_3.13, %.loc21_3.19, %.loc21_3.25, %.loc21_3.31, %.loc21_3.37) to %ints.var [template = constants.%array.1] +// CHECK:STDOUT: %.loc21_4: init %.2 = converted %.loc21_3.1, %.loc21_3.38 [template = constants.%array.1] // CHECK:STDOUT: assign %ints.var, %.loc21_4 -// CHECK:STDOUT: %.loc22_16.1: Core.IntLiteral = int_value 64 [template = constants.%.39] +// CHECK:STDOUT: %.loc22_16.1: Core.IntLiteral = int_value 64 [template = constants.%.43] // CHECK:STDOUT: %float.make_type: init type = call constants.%Float(%.loc22_16.1) [template = f64] -// CHECK:STDOUT: %.loc22_21.1: i32 = int_value 6 [template = constants.%.1] +// CHECK:STDOUT: %.loc22_21: Core.IntLiteral = int_value 6 [template = constants.%.1] // CHECK:STDOUT: %.loc22_16.2: type = value_of_initializer %float.make_type [template = f64] // CHECK:STDOUT: %.loc22_16.3: type = converted %float.make_type, %.loc22_16.2 [template = f64] -// CHECK:STDOUT: %.loc22_21.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc22_21.3: = bound_method %.loc22_21.1, %.loc22_21.2 [template = constants.%.26] -// CHECK:STDOUT: %int.convert_checked.loc22: init Core.IntLiteral = call %.loc22_21.3(%.loc22_21.1) [template = constants.%.27] -// CHECK:STDOUT: %.loc22_21.4: Core.IntLiteral = value_of_initializer %int.convert_checked.loc22 [template = constants.%.27] -// CHECK:STDOUT: %.loc22_21.5: Core.IntLiteral = converted %.loc22_21.1, %.loc22_21.4 [template = constants.%.27] -// CHECK:STDOUT: %.loc22_22: type = array_type %.loc22_21.5, f64 [template = constants.%.40] -// CHECK:STDOUT: %floats.var: ref %.40 = var floats -// CHECK:STDOUT: %floats: ref %.40 = bind_name floats, %floats.var -// CHECK:STDOUT: %.loc23: f64 = float_literal 0.90000000000000002 [template = constants.%.42] -// CHECK:STDOUT: %.loc24: f64 = float_literal 8 [template = constants.%.43] -// CHECK:STDOUT: %.loc25: f64 = float_literal 80 [template = constants.%.44] -// CHECK:STDOUT: %.loc26: f64 = float_literal 1.0E+7 [template = constants.%.45] -// CHECK:STDOUT: %.loc27: f64 = float_literal 1.0E+8 [template = constants.%.46] -// CHECK:STDOUT: %.loc28: f64 = float_literal 1.0E-8 [template = constants.%.47] +// CHECK:STDOUT: %.loc22_22: type = array_type %.loc22_21, f64 [template = constants.%.44] +// CHECK:STDOUT: %floats.var: ref %.44 = var floats +// CHECK:STDOUT: %floats: ref %.44 = bind_name floats, %floats.var +// CHECK:STDOUT: %.loc23: f64 = float_literal 0.90000000000000002 [template = constants.%.46] +// CHECK:STDOUT: %.loc24: f64 = float_literal 8 [template = constants.%.47] +// CHECK:STDOUT: %.loc25: f64 = float_literal 80 [template = constants.%.48] +// CHECK:STDOUT: %.loc26: f64 = float_literal 1.0E+7 [template = constants.%.49] +// CHECK:STDOUT: %.loc27: f64 = float_literal 1.0E+8 [template = constants.%.50] +// CHECK:STDOUT: %.loc28: f64 = float_literal 1.0E-8 [template = constants.%.51] // CHECK:STDOUT: %.loc29_3.1: %tuple.type.2 = tuple_literal (%.loc23, %.loc24, %.loc25, %.loc26, %.loc27, %.loc28) -// CHECK:STDOUT: %.loc29_3.2: i32 = int_value 0 [template = constants.%.33] +// CHECK:STDOUT: %.loc29_3.2: i32 = int_value 0 [template = constants.%.7] // CHECK:STDOUT: %.loc29_3.3: ref f64 = array_index %floats.var, %.loc29_3.2 -// CHECK:STDOUT: %.loc29_3.4: init f64 = initialize_from %.loc23 to %.loc29_3.3 [template = constants.%.42] +// CHECK:STDOUT: %.loc29_3.4: init f64 = initialize_from %.loc23 to %.loc29_3.3 [template = constants.%.46] // CHECK:STDOUT: %.loc29_3.5: i32 = int_value 1 [template = constants.%.34] // CHECK:STDOUT: %.loc29_3.6: ref f64 = array_index %floats.var, %.loc29_3.5 -// CHECK:STDOUT: %.loc29_3.7: init f64 = initialize_from %.loc24 to %.loc29_3.6 [template = constants.%.43] -// CHECK:STDOUT: %.loc29_3.8: i32 = int_value 2 [template = constants.%.35] +// CHECK:STDOUT: %.loc29_3.7: init f64 = initialize_from %.loc24 to %.loc29_3.6 [template = constants.%.47] +// CHECK:STDOUT: %.loc29_3.8: i32 = int_value 2 [template = constants.%.37] // CHECK:STDOUT: %.loc29_3.9: ref f64 = array_index %floats.var, %.loc29_3.8 -// CHECK:STDOUT: %.loc29_3.10: init f64 = initialize_from %.loc25 to %.loc29_3.9 [template = constants.%.44] -// CHECK:STDOUT: %.loc29_3.11: i32 = int_value 3 [template = constants.%.36] +// CHECK:STDOUT: %.loc29_3.10: init f64 = initialize_from %.loc25 to %.loc29_3.9 [template = constants.%.48] +// CHECK:STDOUT: %.loc29_3.11: i32 = int_value 3 [template = constants.%.38] // CHECK:STDOUT: %.loc29_3.12: ref f64 = array_index %floats.var, %.loc29_3.11 -// CHECK:STDOUT: %.loc29_3.13: init f64 = initialize_from %.loc26 to %.loc29_3.12 [template = constants.%.45] -// CHECK:STDOUT: %.loc29_3.14: i32 = int_value 4 [template = constants.%.37] +// CHECK:STDOUT: %.loc29_3.13: init f64 = initialize_from %.loc26 to %.loc29_3.12 [template = constants.%.49] +// CHECK:STDOUT: %.loc29_3.14: i32 = int_value 4 [template = constants.%.39] // CHECK:STDOUT: %.loc29_3.15: ref f64 = array_index %floats.var, %.loc29_3.14 -// CHECK:STDOUT: %.loc29_3.16: init f64 = initialize_from %.loc27 to %.loc29_3.15 [template = constants.%.46] -// CHECK:STDOUT: %.loc29_3.17: i32 = int_value 5 [template = constants.%.38] +// CHECK:STDOUT: %.loc29_3.16: init f64 = initialize_from %.loc27 to %.loc29_3.15 [template = constants.%.50] +// CHECK:STDOUT: %.loc29_3.17: i32 = int_value 5 [template = constants.%.42] // CHECK:STDOUT: %.loc29_3.18: ref f64 = array_index %floats.var, %.loc29_3.17 -// CHECK:STDOUT: %.loc29_3.19: init f64 = initialize_from %.loc28 to %.loc29_3.18 [template = constants.%.47] -// CHECK:STDOUT: %.loc29_3.20: init %.40 = array_init (%.loc29_3.4, %.loc29_3.7, %.loc29_3.10, %.loc29_3.13, %.loc29_3.16, %.loc29_3.19) to %floats.var [template = constants.%array.2] -// CHECK:STDOUT: %.loc29_4: init %.40 = converted %.loc29_3.1, %.loc29_3.20 [template = constants.%array.2] +// CHECK:STDOUT: %.loc29_3.19: init f64 = initialize_from %.loc28 to %.loc29_3.18 [template = constants.%.51] +// CHECK:STDOUT: %.loc29_3.20: init %.44 = array_init (%.loc29_3.4, %.loc29_3.7, %.loc29_3.10, %.loc29_3.13, %.loc29_3.16, %.loc29_3.19) to %floats.var [template = constants.%array.2] +// CHECK:STDOUT: %.loc29_4: init %.44 = converted %.loc29_3.1, %.loc29_3.20 [template = constants.%array.2] // CHECK:STDOUT: assign %floats.var, %.loc29_4 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/basics/parens.carbon b/toolchain/check/testdata/basics/parens.carbon index 2f0c587ea23fe..6650a2785cee4 100644 --- a/toolchain/check/testdata/basics/parens.carbon +++ b/toolchain/check/testdata/basics/parens.carbon @@ -16,13 +16,22 @@ var b: i32 = ((2)); // CHECK:STDOUT: constants { // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %.2: i32 = int_value 2 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 1 [template] +// CHECK:STDOUT: %.28: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.29: = bound_method %.28, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -49,10 +58,18 @@ var b: i32 = ((2)); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: assign file.%a.var, %.loc11 -// CHECK:STDOUT: %.loc12: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: assign file.%b.var, %.loc12 +// CHECK:STDOUT: %.loc11_15: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_17.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_17.2: = bound_method %.loc11_15, %.loc11_17.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc11: init i32 = call %.loc11_17.2(%.loc11_15) [template = constants.%.27] +// CHECK:STDOUT: %.loc11_17.3: init i32 = converted %.loc11_15, %int.convert_checked.loc11 [template = constants.%.27] +// CHECK:STDOUT: assign file.%a.var, %.loc11_17.3 +// CHECK:STDOUT: %.loc12_16: Core.IntLiteral = int_value 2 [template = constants.%.28] +// CHECK:STDOUT: %.loc12_19.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_19.2: = bound_method %.loc12_16, %.loc12_19.1 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc12: init i32 = call %.loc12_19.2(%.loc12_16) [template = constants.%.30] +// CHECK:STDOUT: %.loc12_19.3: init i32 = converted %.loc12_16, %int.convert_checked.loc12 [template = constants.%.30] +// CHECK:STDOUT: assign file.%b.var, %.loc12_19.3 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/basics/run_i32.carbon b/toolchain/check/testdata/basics/run_i32.carbon index bb9d40575cebb..20e87caf2fbad 100644 --- a/toolchain/check/testdata/basics/run_i32.carbon +++ b/toolchain/check/testdata/basics/run_i32.carbon @@ -17,12 +17,19 @@ fn Run() -> i32 { return 0; } // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %Run.type: type = fn_type @Run [template] // CHECK:STDOUT: %Run: %Run.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -48,7 +55,12 @@ fn Run() -> i32 { return 0; } // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_26: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: return %.loc11_26 +// CHECK:STDOUT: %.loc11_26: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_27.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_27.2: = bound_method %.loc11_26, %.loc11_27.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc11_27.2(%.loc11_26) [template = constants.%.27] +// CHECK:STDOUT: %.loc11_27.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc11_27.4: i32 = converted %.loc11_26, %.loc11_27.3 [template = constants.%.27] +// CHECK:STDOUT: return %.loc11_27.4 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/float/make_type.carbon b/toolchain/check/testdata/builtins/float/make_type.carbon index 18361779d831d..220ae20a96133 100644 --- a/toolchain/check/testdata/builtins/float/make_type.carbon +++ b/toolchain/check/testdata/builtins/float/make_type.carbon @@ -90,8 +90,14 @@ var dyn: Float(dyn_size); // CHECK:STDOUT: constants { // CHECK:STDOUT: %Float.type: type = fn_type @Float [template] // CHECK:STDOUT: %Float: %Float.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 64 [template] -// CHECK:STDOUT: %.2: f64 = float_literal 0 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 64 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 64 [template] +// CHECK:STDOUT: %.28: f64 = float_literal 0 [template] // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %GetFloat.type: type = fn_type @GetFloat [template] @@ -101,7 +107,8 @@ var dyn: Float(dyn_size); // CHECK:STDOUT: imports { // CHECK:STDOUT: %import_ref.1: %Float.type = import_ref Main//types, inst+22, loaded [template = constants.%Float] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref.2 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 +// CHECK:STDOUT: .Int32 = %import_ref.51 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -117,8 +124,13 @@ var dyn: Float(dyn_size); // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: %Float.ref: %Float.type = name_ref Float, imports.%import_ref.1 [template = constants.%Float] -// CHECK:STDOUT: %.loc6_14: i32 = int_value 64 [template = constants.%.1] -// CHECK:STDOUT: %float.make_type: init type = call %Float.ref(%.loc6_14) [template = f64] +// CHECK:STDOUT: %.loc6_14.1: Core.IntLiteral = int_value 64 [template = constants.%.1] +// CHECK:STDOUT: %.loc6_14.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc6_14.3: = bound_method %.loc6_14.1, %.loc6_14.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc6_14.3(%.loc6_14.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc6_14.4: i32 = value_of_initializer %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc6_14.5: i32 = converted %.loc6_14.1, %.loc6_14.4 [template = constants.%.27] +// CHECK:STDOUT: %float.make_type: init type = call %Float.ref(%.loc6_14.5) [template = f64] // CHECK:STDOUT: %.loc6_16.1: type = value_of_initializer %float.make_type [template = f64] // CHECK:STDOUT: %.loc6_16.2: type = converted %float.make_type, %.loc6_16.1 [template = f64] // CHECK:STDOUT: %f.var: ref f64 = var f @@ -153,7 +165,7 @@ var dyn: Float(dyn_size); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc6: f64 = float_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc6: f64 = float_literal 0 [template = constants.%.28] // CHECK:STDOUT: assign file.%f.var, %.loc6 // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -163,16 +175,25 @@ var dyn: Float(dyn_size); // CHECK:STDOUT: constants { // CHECK:STDOUT: %Float.type: type = fn_type @Float [template] // CHECK:STDOUT: %Float: %Float.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 32 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 32 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 32 [template] // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.2: i32 = int_value 64 [template] +// CHECK:STDOUT: %.28: Core.IntLiteral = int_value 64 [template] +// CHECK:STDOUT: %.29: = bound_method %.28, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 64 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %import_ref.1: %Float.type = import_ref Main//types, inst+22, loaded [template = constants.%Float] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref.2 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 +// CHECK:STDOUT: .Int32 = %import_ref.51 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -189,8 +210,13 @@ var dyn: Float(dyn_size); // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: %Float.ref.loc10: %Float.type = name_ref Float, imports.%import_ref.1 [template = constants.%Float] -// CHECK:STDOUT: %.loc10_26: i32 = int_value 32 [template = constants.%.1] -// CHECK:STDOUT: %float.make_type.loc10: init type = call %Float.ref.loc10(%.loc10_26) [template = ] +// CHECK:STDOUT: %.loc10_26.1: Core.IntLiteral = int_value 32 [template = constants.%.1] +// CHECK:STDOUT: %.loc10_26.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc10_26.3: = bound_method %.loc10_26.1, %.loc10_26.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc10_26.3(%.loc10_26.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc10_26.4: i32 = value_of_initializer %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc10_26.5: i32 = converted %.loc10_26.1, %.loc10_26.4 [template = constants.%.27] +// CHECK:STDOUT: %float.make_type.loc10: init type = call %Float.ref.loc10(%.loc10_26.5) [template = ] // CHECK:STDOUT: %.loc10_28.1: type = value_of_initializer %float.make_type.loc10 [template = ] // CHECK:STDOUT: %.loc10_28.2: type = converted %float.make_type.loc10, %.loc10_28.1 [template = ] // CHECK:STDOUT: %invalid_float.var: ref = var invalid_float @@ -214,8 +240,12 @@ var dyn: Float(dyn_size); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc12: i32 = int_value 64 [template = constants.%.2] -// CHECK:STDOUT: assign file.%dyn_size.var, %.loc12 +// CHECK:STDOUT: %.loc12_21: Core.IntLiteral = int_value 64 [template = constants.%.28] +// CHECK:STDOUT: %.loc12_23.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_23.2: = bound_method %.loc12_21, %.loc12_23.1 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc12_23.2(%.loc12_21) [template = constants.%.30] +// CHECK:STDOUT: %.loc12_23.3: init i32 = converted %.loc12_21, %int.convert_checked [template = constants.%.30] +// CHECK:STDOUT: assign file.%dyn_size.var, %.loc12_23.3 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/and.carbon b/toolchain/check/testdata/builtins/int/and.carbon index ff11a11fac0d1..88193c05d6c25 100644 --- a/toolchain/check/testdata/builtins/int/and.carbon +++ b/toolchain/check/testdata/builtins/int/and.carbon @@ -26,17 +26,25 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %And.type: type = fn_type @And [template] // CHECK:STDOUT: %And: %And.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 12 [template] -// CHECK:STDOUT: %.2: i32 = int_value 10 [template] -// CHECK:STDOUT: %.3: i32 = int_value 8 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 12 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 10 [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(i32) [template] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] // CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template] // CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template] -// CHECK:STDOUT: %.27: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.28: = bound_method %.3, %Convert.15 [template] -// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 8 [template] -// CHECK:STDOUT: %.30: type = array_type %.29, i32 [template] -// CHECK:STDOUT: %.31: type = ptr_type %.30 [template] +// CHECK:STDOUT: %.26: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 12 [template] +// CHECK:STDOUT: %.29: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 10 [template] +// CHECK:STDOUT: %.31: i32 = int_value 8 [template] +// CHECK:STDOUT: %Convert.type.16: type = fn_type @Convert.12 [template] +// CHECK:STDOUT: %Convert.16: %Convert.type.16 = struct_value () [template] +// CHECK:STDOUT: %.32: = interface_witness (%Convert.16) [template] +// CHECK:STDOUT: %.33: = bound_method %.31, %Convert.16 [template] +// CHECK:STDOUT: %.34: Core.IntLiteral = int_value 8 [template] +// CHECK:STDOUT: %.35: type = array_type %.34, i32 [template] +// CHECK:STDOUT: %.36: type = ptr_type %.35 [template] // CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] // CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] // CHECK:STDOUT: } @@ -85,32 +93,37 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %And.ref: %And.type = name_ref And, %And.decl [template = constants.%And] -// CHECK:STDOUT: %.loc4_20: i32 = int_value 12 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_24: i32 = int_value 10 [template = constants.%.2] -// CHECK:STDOUT: %int.and: init i32 = call %And.ref(%.loc4_20, %.loc4_24) [template = constants.%.3] +// CHECK:STDOUT: %.loc4_20.1: Core.IntLiteral = int_value 12 [template = constants.%.1] +// CHECK:STDOUT: %.loc4_24.1: Core.IntLiteral = int_value 10 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_20.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_20.3: = bound_method %.loc4_20.1, %.loc4_20.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc4_20: init i32 = call %.loc4_20.3(%.loc4_20.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc4_20.4: i32 = value_of_initializer %int.convert_checked.loc4_20 [template = constants.%.28] +// CHECK:STDOUT: %.loc4_20.5: i32 = converted %.loc4_20.1, %.loc4_20.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc4_24.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_24.3: = bound_method %.loc4_24.1, %.loc4_24.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc4_24: init i32 = call %.loc4_24.3(%.loc4_24.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc4_24.4: i32 = value_of_initializer %int.convert_checked.loc4_24 [template = constants.%.30] +// CHECK:STDOUT: %.loc4_24.5: i32 = converted %.loc4_24.1, %.loc4_24.4 [template = constants.%.30] +// CHECK:STDOUT: %int.and: init i32 = call %And.ref(%.loc4_20.5, %.loc4_24.5) [template = constants.%.31] // CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] // CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4, %.loc4_11.1 [template = i32] -// CHECK:STDOUT: %.loc4_19.1: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc4_19.2: = bound_method %int.and, %.loc4_19.1 [template = constants.%.28] -// CHECK:STDOUT: %.loc4_19.3: i32 = value_of_initializer %int.and [template = constants.%.3] -// CHECK:STDOUT: %.loc4_19.4: i32 = converted %int.and, %.loc4_19.3 [template = constants.%.3] -// CHECK:STDOUT: %int.convert_checked.loc4: init Core.IntLiteral = call %.loc4_19.2(%.loc4_19.4) [template = constants.%.29] -// CHECK:STDOUT: %.loc4_19.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4 [template = constants.%.29] -// CHECK:STDOUT: %.loc4_19.6: Core.IntLiteral = converted %int.and, %.loc4_19.5 [template = constants.%.29] -// CHECK:STDOUT: %.loc4_27: type = array_type %.loc4_19.6, i32 [template = constants.%.30] -// CHECK:STDOUT: %arr.var: ref %.30 = var arr -// CHECK:STDOUT: %arr: ref %.30 = bind_name arr, %arr.var +// CHECK:STDOUT: %.loc4_19.1: %Convert.type.5 = interface_witness_access constants.%.32, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %.loc4_19.2: = bound_method %int.and, %.loc4_19.1 [template = constants.%.33] +// CHECK:STDOUT: %.loc4_19.3: i32 = value_of_initializer %int.and [template = constants.%.31] +// CHECK:STDOUT: %.loc4_19.4: i32 = converted %int.and, %.loc4_19.3 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc4_19: init Core.IntLiteral = call %.loc4_19.2(%.loc4_19.4) [template = constants.%.34] +// CHECK:STDOUT: %.loc4_19.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4_19 [template = constants.%.34] +// CHECK:STDOUT: %.loc4_19.6: Core.IntLiteral = converted %int.and, %.loc4_19.5 [template = constants.%.34] +// CHECK:STDOUT: %.loc4_27: type = array_type %.loc4_19.6, i32 [template = constants.%.35] +// CHECK:STDOUT: %arr.var: ref %.35 = var arr +// CHECK:STDOUT: %arr: ref %.35 = bind_name arr, %arr.var // CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc5_18.1: i32 = int_value 8 [template = constants.%.3] +// CHECK:STDOUT: %.loc5_18: Core.IntLiteral = int_value 8 [template = constants.%.34] // CHECK:STDOUT: %.loc5_13.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] // CHECK:STDOUT: %.loc5_13.2: type = converted %int.make_type_32.loc5, %.loc5_13.1 [template = i32] -// CHECK:STDOUT: %.loc5_18.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc5_18.3: = bound_method %.loc5_18.1, %.loc5_18.2 [template = constants.%.28] -// CHECK:STDOUT: %int.convert_checked.loc5: init Core.IntLiteral = call %.loc5_18.3(%.loc5_18.1) [template = constants.%.29] -// CHECK:STDOUT: %.loc5_18.4: Core.IntLiteral = value_of_initializer %int.convert_checked.loc5 [template = constants.%.29] -// CHECK:STDOUT: %.loc5_18.5: Core.IntLiteral = converted %.loc5_18.1, %.loc5_18.4 [template = constants.%.29] -// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18.5, i32 [template = constants.%.30] -// CHECK:STDOUT: %.loc5_20: type = ptr_type %.30 [template = constants.%.31] +// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.35] +// CHECK:STDOUT: %.loc5_20: type = ptr_type %.35 [template = constants.%.36] // CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { // CHECK:STDOUT: %a.patt: i32 = binding_pattern a // CHECK:STDOUT: %a.param_patt: i32 = value_param_pattern %a.patt, runtime_param0 @@ -152,9 +165,9 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %.30 = name_ref arr, file.%arr -// CHECK:STDOUT: %.loc5: %.31 = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %.31 = bind_name arr_p, %.loc5 +// CHECK:STDOUT: %arr.ref: ref %.35 = name_ref arr, file.%arr +// CHECK:STDOUT: %.loc5: %.36 = addr_of %arr.ref +// CHECK:STDOUT: %arr_p: %.36 = bind_name arr_p, %.loc5 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/complement.carbon b/toolchain/check/testdata/builtins/int/complement.carbon index d418d9ba61a99..7c10187bab339 100644 --- a/toolchain/check/testdata/builtins/int/complement.carbon +++ b/toolchain/check/testdata/builtins/int/complement.carbon @@ -29,18 +29,26 @@ fn RuntimeCall(a: i32) -> i32 { // CHECK:STDOUT: %Complement: %Complement.type = struct_value () [template] // CHECK:STDOUT: %And.type: type = fn_type @And [template] // CHECK:STDOUT: %And: %And.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1193046 [template] -// CHECK:STDOUT: %.2: i32 = int_value -1193047 [template] -// CHECK:STDOUT: %.3: i32 = int_value 16777215 [template] -// CHECK:STDOUT: %.4: i32 = int_value 15584169 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1193046 [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(i32) [template] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] // CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template] // CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template] -// CHECK:STDOUT: %.28: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.29: = bound_method %.4, %Convert.15 [template] -// CHECK:STDOUT: %.30: Core.IntLiteral = int_value 15584169 [template] -// CHECK:STDOUT: %.31: type = array_type %.30, i32 [template] -// CHECK:STDOUT: %.32: type = ptr_type %.31 [template] +// CHECK:STDOUT: %.25: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 1193046 [template] +// CHECK:STDOUT: %.28: i32 = int_value -1193047 [template] +// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 16777215 [template] +// CHECK:STDOUT: %.30: = bound_method %.29, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 16777215 [template] +// CHECK:STDOUT: %.32: i32 = int_value 15584169 [template] +// CHECK:STDOUT: %Convert.type.16: type = fn_type @Convert.12 [template] +// CHECK:STDOUT: %Convert.16: %Convert.type.16 = struct_value () [template] +// CHECK:STDOUT: %.33: = interface_witness (%Convert.16) [template] +// CHECK:STDOUT: %.34: = bound_method %.32, %Convert.16 [template] +// CHECK:STDOUT: %.35: Core.IntLiteral = int_value 15584169 [template] +// CHECK:STDOUT: %.36: type = array_type %.35, i32 [template] +// CHECK:STDOUT: %.37: type = ptr_type %.36 [template] // CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] // CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] // CHECK:STDOUT: } @@ -108,35 +116,40 @@ fn RuntimeCall(a: i32) -> i32 { // CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %And.ref: %And.type = name_ref And, %And.decl [template = constants.%And] // CHECK:STDOUT: %Complement.ref: %Complement.type = name_ref Complement, %Complement.decl [template = constants.%Complement] -// CHECK:STDOUT: %.loc5_31: i32 = int_value 1193046 [template = constants.%.1] -// CHECK:STDOUT: %int.complement: init i32 = call %Complement.ref(%.loc5_31) [template = constants.%.2] -// CHECK:STDOUT: %.loc5_42: i32 = int_value 16777215 [template = constants.%.3] -// CHECK:STDOUT: %.loc5_30.1: i32 = value_of_initializer %int.complement [template = constants.%.2] -// CHECK:STDOUT: %.loc5_30.2: i32 = converted %int.complement, %.loc5_30.1 [template = constants.%.2] -// CHECK:STDOUT: %int.and: init i32 = call %And.ref(%.loc5_30.2, %.loc5_42) [template = constants.%.4] +// CHECK:STDOUT: %.loc5_31.1: Core.IntLiteral = int_value 1193046 [template = constants.%.1] +// CHECK:STDOUT: %.loc5_31.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc5_31.3: = bound_method %.loc5_31.1, %.loc5_31.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc5_31: init i32 = call %.loc5_31.3(%.loc5_31.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc5_31.4: i32 = value_of_initializer %int.convert_checked.loc5_31 [template = constants.%.27] +// CHECK:STDOUT: %.loc5_31.5: i32 = converted %.loc5_31.1, %.loc5_31.4 [template = constants.%.27] +// CHECK:STDOUT: %int.complement: init i32 = call %Complement.ref(%.loc5_31.5) [template = constants.%.28] +// CHECK:STDOUT: %.loc5_42.1: Core.IntLiteral = int_value 16777215 [template = constants.%.29] +// CHECK:STDOUT: %.loc5_30.1: i32 = value_of_initializer %int.complement [template = constants.%.28] +// CHECK:STDOUT: %.loc5_30.2: i32 = converted %int.complement, %.loc5_30.1 [template = constants.%.28] +// CHECK:STDOUT: %.loc5_42.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc5_42.3: = bound_method %.loc5_42.1, %.loc5_42.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc5_42: init i32 = call %.loc5_42.3(%.loc5_42.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc5_42.4: i32 = value_of_initializer %int.convert_checked.loc5_42 [template = constants.%.31] +// CHECK:STDOUT: %.loc5_42.5: i32 = converted %.loc5_42.1, %.loc5_42.4 [template = constants.%.31] +// CHECK:STDOUT: %int.and: init i32 = call %And.ref(%.loc5_30.2, %.loc5_42.5) [template = constants.%.32] // CHECK:STDOUT: %.loc5_11.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] // CHECK:STDOUT: %.loc5_11.2: type = converted %int.make_type_32.loc5, %.loc5_11.1 [template = i32] -// CHECK:STDOUT: %.loc5_19.1: %Convert.type.2 = interface_witness_access constants.%.28, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc5_19.2: = bound_method %int.and, %.loc5_19.1 [template = constants.%.29] -// CHECK:STDOUT: %.loc5_19.3: i32 = value_of_initializer %int.and [template = constants.%.4] -// CHECK:STDOUT: %.loc5_19.4: i32 = converted %int.and, %.loc5_19.3 [template = constants.%.4] -// CHECK:STDOUT: %int.convert_checked.loc5: init Core.IntLiteral = call %.loc5_19.2(%.loc5_19.4) [template = constants.%.30] -// CHECK:STDOUT: %.loc5_19.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc5 [template = constants.%.30] -// CHECK:STDOUT: %.loc5_19.6: Core.IntLiteral = converted %int.and, %.loc5_19.5 [template = constants.%.30] -// CHECK:STDOUT: %.loc5_51: type = array_type %.loc5_19.6, i32 [template = constants.%.31] -// CHECK:STDOUT: %arr.var: ref %.31 = var arr -// CHECK:STDOUT: %arr: ref %.31 = bind_name arr, %arr.var +// CHECK:STDOUT: %.loc5_19.1: %Convert.type.5 = interface_witness_access constants.%.33, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %.loc5_19.2: = bound_method %int.and, %.loc5_19.1 [template = constants.%.34] +// CHECK:STDOUT: %.loc5_19.3: i32 = value_of_initializer %int.and [template = constants.%.32] +// CHECK:STDOUT: %.loc5_19.4: i32 = converted %int.and, %.loc5_19.3 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc5_19: init Core.IntLiteral = call %.loc5_19.2(%.loc5_19.4) [template = constants.%.35] +// CHECK:STDOUT: %.loc5_19.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc5_19 [template = constants.%.35] +// CHECK:STDOUT: %.loc5_19.6: Core.IntLiteral = converted %int.and, %.loc5_19.5 [template = constants.%.35] +// CHECK:STDOUT: %.loc5_51: type = array_type %.loc5_19.6, i32 [template = constants.%.36] +// CHECK:STDOUT: %arr.var: ref %.36 = var arr +// CHECK:STDOUT: %arr: ref %.36 = bind_name arr, %arr.var // CHECK:STDOUT: %int.make_type_32.loc6: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc6_18.1: i32 = int_value 15584169 [template = constants.%.4] +// CHECK:STDOUT: %.loc6_18: Core.IntLiteral = int_value 15584169 [template = constants.%.35] // CHECK:STDOUT: %.loc6_13.1: type = value_of_initializer %int.make_type_32.loc6 [template = i32] // CHECK:STDOUT: %.loc6_13.2: type = converted %int.make_type_32.loc6, %.loc6_13.1 [template = i32] -// CHECK:STDOUT: %.loc6_18.2: %Convert.type.2 = interface_witness_access constants.%.28, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc6_18.3: = bound_method %.loc6_18.1, %.loc6_18.2 [template = constants.%.29] -// CHECK:STDOUT: %int.convert_checked.loc6: init Core.IntLiteral = call %.loc6_18.3(%.loc6_18.1) [template = constants.%.30] -// CHECK:STDOUT: %.loc6_18.4: Core.IntLiteral = value_of_initializer %int.convert_checked.loc6 [template = constants.%.30] -// CHECK:STDOUT: %.loc6_18.5: Core.IntLiteral = converted %.loc6_18.1, %.loc6_18.4 [template = constants.%.30] -// CHECK:STDOUT: %.loc6_26: type = array_type %.loc6_18.5, i32 [template = constants.%.31] -// CHECK:STDOUT: %.loc6_27: type = ptr_type %.31 [template = constants.%.32] +// CHECK:STDOUT: %.loc6_26: type = array_type %.loc6_18, i32 [template = constants.%.36] +// CHECK:STDOUT: %.loc6_27: type = ptr_type %.36 [template = constants.%.37] // CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { // CHECK:STDOUT: %a.patt: i32 = binding_pattern a // CHECK:STDOUT: %a.param_patt: i32 = value_param_pattern %a.patt, runtime_param0 @@ -172,9 +185,9 @@ fn RuntimeCall(a: i32) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %.31 = name_ref arr, file.%arr -// CHECK:STDOUT: %.loc6: %.32 = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %.32 = bind_name arr_p, %.loc6 +// CHECK:STDOUT: %arr.ref: ref %.36 = name_ref arr, file.%arr +// CHECK:STDOUT: %.loc6: %.37 = addr_of %arr.ref +// CHECK:STDOUT: %arr_p: %.37 = bind_name arr_p, %.loc6 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/convert_checked.carbon b/toolchain/check/testdata/builtins/int/convert_checked.carbon index 2e9007c8a1a4e..d4099c4a795a9 100644 --- a/toolchain/check/testdata/builtins/int/convert_checked.carbon +++ b/toolchain/check/testdata/builtins/int/convert_checked.carbon @@ -785,23 +785,33 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %Int32ToInt32.type: type = fn_type @Int32ToInt32 [template] // CHECK:STDOUT: %Int32ToInt32: %Int32ToInt32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] -// CHECK:STDOUT: %.2: i32 = int_value 2147483647 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 0 [template] +// CHECK:STDOUT: %.28: Core.IntLiteral = int_value 2147483647 [template] +// CHECK:STDOUT: %.29: = bound_method %.28, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 2147483647 [template] // CHECK:STDOUT: %SubI32.type: type = fn_type @SubI32 [template] // CHECK:STDOUT: %SubI32: %SubI32.type = struct_value () [template] // CHECK:STDOUT: %NegateI32.type: type = fn_type @NegateI32 [template] // CHECK:STDOUT: %NegateI32: %NegateI32.type = struct_value () [template] -// CHECK:STDOUT: %.3: i32 = int_value -2147483647 [template] -// CHECK:STDOUT: %.4: i32 = int_value 1 [template] -// CHECK:STDOUT: %.5: i32 = int_value -2147483648 [template] +// CHECK:STDOUT: %.31: i32 = int_value -2147483647 [template] +// CHECK:STDOUT: %.32: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.33: = bound_method %.32, %Convert.15 [template] +// CHECK:STDOUT: %.34: i32 = int_value 1 [template] +// CHECK:STDOUT: %.35: i32 = int_value -2147483648 [template] // CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] // CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] // CHECK:STDOUT: %IntLiteralToIntLiteral.type: type = fn_type @IntLiteralToIntLiteral [template] // CHECK:STDOUT: %IntLiteralToIntLiteral: %IntLiteralToIntLiteral.type = struct_value () [template] // CHECK:STDOUT: %Int32ToIntLiteral.type: type = fn_type @Int32ToIntLiteral [template] // CHECK:STDOUT: %Int32ToIntLiteral: %Int32ToIntLiteral.type = struct_value () [template] -// CHECK:STDOUT: %.6: i32 = int_value -1 [template] -// CHECK:STDOUT: %.7: Core.IntLiteral = int_value -1 [template] +// CHECK:STDOUT: %.36: i32 = int_value -1 [template] +// CHECK:STDOUT: %.37: Core.IntLiteral = int_value -1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -828,6 +838,7 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, inst+427, unloaded // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int32 = %import_ref.22 +// CHECK:STDOUT: .ImplicitAs = %import_ref.23 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -894,45 +905,70 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Int32ToInt32.ref.loc5: %Int32ToInt32.type = name_ref Int32ToInt32, imports.%import_ref.5 [template = constants.%Int32ToInt32] -// CHECK:STDOUT: %.loc5_27: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: %int.convert_checked.loc5: init i32 = call %Int32ToInt32.ref.loc5(%.loc5_27) [template = constants.%.1] -// CHECK:STDOUT: %.loc5_29.1: i32 = value_of_initializer %int.convert_checked.loc5 [template = constants.%.1] -// CHECK:STDOUT: %.loc5_29.2: i32 = converted %int.convert_checked.loc5, %.loc5_29.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc5_27.1: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc5_27.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc5_27.3: = bound_method %.loc5_27.1, %.loc5_27.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc5_27: init i32 = call %.loc5_27.3(%.loc5_27.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc5_27.4: i32 = value_of_initializer %int.convert_checked.loc5_27 [template = constants.%.27] +// CHECK:STDOUT: %.loc5_27.5: i32 = converted %.loc5_27.1, %.loc5_27.4 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc5_26: init i32 = call %Int32ToInt32.ref.loc5(%.loc5_27.5) [template = constants.%.27] +// CHECK:STDOUT: %.loc5_29.1: i32 = value_of_initializer %int.convert_checked.loc5_26 [template = constants.%.27] +// CHECK:STDOUT: %.loc5_29.2: i32 = converted %int.convert_checked.loc5_26, %.loc5_29.1 [template = constants.%.27] // CHECK:STDOUT: %a: i32 = bind_name a, %.loc5_29.2 // CHECK:STDOUT: %Int32ToInt32.ref.loc6: %Int32ToInt32.type = name_ref Int32ToInt32, imports.%import_ref.5 [template = constants.%Int32ToInt32] -// CHECK:STDOUT: %.loc6_27: i32 = int_value 2147483647 [template = constants.%.2] -// CHECK:STDOUT: %int.convert_checked.loc6: init i32 = call %Int32ToInt32.ref.loc6(%.loc6_27) [template = constants.%.2] -// CHECK:STDOUT: %.loc6_39.1: i32 = value_of_initializer %int.convert_checked.loc6 [template = constants.%.2] -// CHECK:STDOUT: %.loc6_39.2: i32 = converted %int.convert_checked.loc6, %.loc6_39.1 [template = constants.%.2] +// CHECK:STDOUT: %.loc6_27.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.28] +// CHECK:STDOUT: %.loc6_27.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc6_27.3: = bound_method %.loc6_27.1, %.loc6_27.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc6_27: init i32 = call %.loc6_27.3(%.loc6_27.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc6_27.4: i32 = value_of_initializer %int.convert_checked.loc6_27 [template = constants.%.30] +// CHECK:STDOUT: %.loc6_27.5: i32 = converted %.loc6_27.1, %.loc6_27.4 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc6_26: init i32 = call %Int32ToInt32.ref.loc6(%.loc6_27.5) [template = constants.%.30] +// CHECK:STDOUT: %.loc6_39.1: i32 = value_of_initializer %int.convert_checked.loc6_26 [template = constants.%.30] +// CHECK:STDOUT: %.loc6_39.2: i32 = converted %int.convert_checked.loc6_26, %.loc6_39.1 [template = constants.%.30] // CHECK:STDOUT: %b: i32 = bind_name b, %.loc6_39.2 // CHECK:STDOUT: %Int32ToInt32.ref.loc7: %Int32ToInt32.type = name_ref Int32ToInt32, imports.%import_ref.5 [template = constants.%Int32ToInt32] // CHECK:STDOUT: %SubI32.ref: %SubI32.type = name_ref SubI32, imports.%import_ref.2 [template = constants.%SubI32] // CHECK:STDOUT: %NegateI32.ref.loc7: %NegateI32.type = name_ref NegateI32, imports.%import_ref.1 [template = constants.%NegateI32] -// CHECK:STDOUT: %.loc7_44: i32 = int_value 2147483647 [template = constants.%.2] -// CHECK:STDOUT: %int.snegate.loc7: init i32 = call %NegateI32.ref.loc7(%.loc7_44) [template = constants.%.3] -// CHECK:STDOUT: %.loc7_58: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc7_43.1: i32 = value_of_initializer %int.snegate.loc7 [template = constants.%.3] -// CHECK:STDOUT: %.loc7_43.2: i32 = converted %int.snegate.loc7, %.loc7_43.1 [template = constants.%.3] -// CHECK:STDOUT: %int.ssub: init i32 = call %SubI32.ref(%.loc7_43.2, %.loc7_58) [template = constants.%.5] -// CHECK:STDOUT: %.loc7_33.1: i32 = value_of_initializer %int.ssub [template = constants.%.5] -// CHECK:STDOUT: %.loc7_33.2: i32 = converted %int.ssub, %.loc7_33.1 [template = constants.%.5] -// CHECK:STDOUT: %int.convert_checked.loc7: init i32 = call %Int32ToInt32.ref.loc7(%.loc7_33.2) [template = constants.%.5] -// CHECK:STDOUT: %.loc7_61.1: i32 = value_of_initializer %int.convert_checked.loc7 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_61.2: i32 = converted %int.convert_checked.loc7, %.loc7_61.1 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_44.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.28] +// CHECK:STDOUT: %.loc7_44.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc7_44.3: = bound_method %.loc7_44.1, %.loc7_44.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc7_44: init i32 = call %.loc7_44.3(%.loc7_44.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc7_44.4: i32 = value_of_initializer %int.convert_checked.loc7_44 [template = constants.%.30] +// CHECK:STDOUT: %.loc7_44.5: i32 = converted %.loc7_44.1, %.loc7_44.4 [template = constants.%.30] +// CHECK:STDOUT: %int.snegate.loc7: init i32 = call %NegateI32.ref.loc7(%.loc7_44.5) [template = constants.%.31] +// CHECK:STDOUT: %.loc7_58.1: Core.IntLiteral = int_value 1 [template = constants.%.32] +// CHECK:STDOUT: %.loc7_43.1: i32 = value_of_initializer %int.snegate.loc7 [template = constants.%.31] +// CHECK:STDOUT: %.loc7_43.2: i32 = converted %int.snegate.loc7, %.loc7_43.1 [template = constants.%.31] +// CHECK:STDOUT: %.loc7_58.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc7_58.3: = bound_method %.loc7_58.1, %.loc7_58.2 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc7_58: init i32 = call %.loc7_58.3(%.loc7_58.1) [template = constants.%.34] +// CHECK:STDOUT: %.loc7_58.4: i32 = value_of_initializer %int.convert_checked.loc7_58 [template = constants.%.34] +// CHECK:STDOUT: %.loc7_58.5: i32 = converted %.loc7_58.1, %.loc7_58.4 [template = constants.%.34] +// CHECK:STDOUT: %int.ssub: init i32 = call %SubI32.ref(%.loc7_43.2, %.loc7_58.5) [template = constants.%.35] +// CHECK:STDOUT: %.loc7_33.1: i32 = value_of_initializer %int.ssub [template = constants.%.35] +// CHECK:STDOUT: %.loc7_33.2: i32 = converted %int.ssub, %.loc7_33.1 [template = constants.%.35] +// CHECK:STDOUT: %int.convert_checked.loc7_26: init i32 = call %Int32ToInt32.ref.loc7(%.loc7_33.2) [template = constants.%.35] +// CHECK:STDOUT: %.loc7_61.1: i32 = value_of_initializer %int.convert_checked.loc7_26 [template = constants.%.35] +// CHECK:STDOUT: %.loc7_61.2: i32 = converted %int.convert_checked.loc7_26, %.loc7_61.1 [template = constants.%.35] // CHECK:STDOUT: %c: i32 = bind_name c, %.loc7_61.2 // CHECK:STDOUT: %IntLiteralToIntLiteral.ref: %IntLiteralToIntLiteral.type = name_ref IntLiteralToIntLiteral, imports.%import_ref.9 [template = constants.%IntLiteralToIntLiteral] // CHECK:STDOUT: %Int32ToIntLiteral.ref: %Int32ToIntLiteral.type = name_ref Int32ToIntLiteral, imports.%import_ref.20 [template = constants.%Int32ToIntLiteral] // CHECK:STDOUT: %NegateI32.ref.loc8: %NegateI32.type = name_ref NegateI32, imports.%import_ref.1 [template = constants.%NegateI32] -// CHECK:STDOUT: %.loc8_74: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %int.snegate.loc8: init i32 = call %NegateI32.ref.loc8(%.loc8_74) [template = constants.%.6] -// CHECK:STDOUT: %.loc8_73.1: i32 = value_of_initializer %int.snegate.loc8 [template = constants.%.6] -// CHECK:STDOUT: %.loc8_73.2: i32 = converted %int.snegate.loc8, %.loc8_73.1 [template = constants.%.6] -// CHECK:STDOUT: %int.convert_checked.loc8_63: init Core.IntLiteral = call %Int32ToIntLiteral.ref(%.loc8_73.2) [template = constants.%.7] -// CHECK:STDOUT: %.loc8_63.1: Core.IntLiteral = value_of_initializer %int.convert_checked.loc8_63 [template = constants.%.7] -// CHECK:STDOUT: %.loc8_63.2: Core.IntLiteral = converted %int.convert_checked.loc8_63, %.loc8_63.1 [template = constants.%.7] -// CHECK:STDOUT: %int.convert_checked.loc8_45: init Core.IntLiteral = call %IntLiteralToIntLiteral.ref(%.loc8_63.2) [template = constants.%.7] -// CHECK:STDOUT: %.loc8_78.1: Core.IntLiteral = value_of_initializer %int.convert_checked.loc8_45 [template = constants.%.7] -// CHECK:STDOUT: %.loc8_78.2: Core.IntLiteral = converted %int.convert_checked.loc8_45, %.loc8_78.1 [template = constants.%.7] +// CHECK:STDOUT: %.loc8_74.1: Core.IntLiteral = int_value 1 [template = constants.%.32] +// CHECK:STDOUT: %.loc8_74.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc8_74.3: = bound_method %.loc8_74.1, %.loc8_74.2 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc8_74: init i32 = call %.loc8_74.3(%.loc8_74.1) [template = constants.%.34] +// CHECK:STDOUT: %.loc8_74.4: i32 = value_of_initializer %int.convert_checked.loc8_74 [template = constants.%.34] +// CHECK:STDOUT: %.loc8_74.5: i32 = converted %.loc8_74.1, %.loc8_74.4 [template = constants.%.34] +// CHECK:STDOUT: %int.snegate.loc8: init i32 = call %NegateI32.ref.loc8(%.loc8_74.5) [template = constants.%.36] +// CHECK:STDOUT: %.loc8_73.1: i32 = value_of_initializer %int.snegate.loc8 [template = constants.%.36] +// CHECK:STDOUT: %.loc8_73.2: i32 = converted %int.snegate.loc8, %.loc8_73.1 [template = constants.%.36] +// CHECK:STDOUT: %int.convert_checked.loc8_63: init Core.IntLiteral = call %Int32ToIntLiteral.ref(%.loc8_73.2) [template = constants.%.37] +// CHECK:STDOUT: %.loc8_63.1: Core.IntLiteral = value_of_initializer %int.convert_checked.loc8_63 [template = constants.%.37] +// CHECK:STDOUT: %.loc8_63.2: Core.IntLiteral = converted %int.convert_checked.loc8_63, %.loc8_63.1 [template = constants.%.37] +// CHECK:STDOUT: %int.convert_checked.loc8_45: init Core.IntLiteral = call %IntLiteralToIntLiteral.ref(%.loc8_63.2) [template = constants.%.37] +// CHECK:STDOUT: %.loc8_78.1: Core.IntLiteral = value_of_initializer %int.convert_checked.loc8_45 [template = constants.%.37] +// CHECK:STDOUT: %.loc8_78.2: Core.IntLiteral = converted %int.convert_checked.loc8_45, %.loc8_78.1 [template = constants.%.37] // CHECK:STDOUT: %d: Core.IntLiteral = bind_name d, %.loc8_78.2 // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -946,8 +982,14 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %.2: type = int_type unsigned, %.1 [template] // CHECK:STDOUT: %Int32ToUint32.type: type = fn_type @Int32ToUint32 [template] // CHECK:STDOUT: %Int32ToUint32: %Int32ToUint32.type = struct_value () [template] -// CHECK:STDOUT: %.3: i32 = int_value 2147483647 [template] -// CHECK:STDOUT: %.4: %.2 = int_value 2147483647 [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 2147483647 [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: %.27: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.28: = bound_method %.3, %Convert.15 [template] +// CHECK:STDOUT: %.29: i32 = int_value 2147483647 [template] +// CHECK:STDOUT: %.30: %.2 = int_value 2147483647 [template] // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %Uint32ToInt32.type: type = fn_type @Uint32ToInt32 [template] @@ -978,7 +1020,8 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, inst+427, unloaded // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .UInt = %import_ref.22 -// CHECK:STDOUT: .Int32 = %import_ref.23 +// CHECK:STDOUT: .ImplicitAs = %import_ref.23 +// CHECK:STDOUT: .Int32 = %import_ref.72 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -1029,20 +1072,30 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Int32ToUint32.ref.loc5: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %.loc5_30: i32 = int_value 2147483647 [template = constants.%.3] -// CHECK:STDOUT: %int.convert_checked.loc5: init %.2 = call %Int32ToUint32.ref.loc5(%.loc5_30) [template = constants.%.4] -// CHECK:STDOUT: %.loc5_42.1: %.2 = value_of_initializer %int.convert_checked.loc5 [template = constants.%.4] -// CHECK:STDOUT: %.loc5_42.2: %.2 = converted %int.convert_checked.loc5, %.loc5_42.1 [template = constants.%.4] +// CHECK:STDOUT: %.loc5_30.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.3] +// CHECK:STDOUT: %.loc5_30.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc5_30.3: = bound_method %.loc5_30.1, %.loc5_30.2 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked.loc5_30: init i32 = call %.loc5_30.3(%.loc5_30.1) [template = constants.%.29] +// CHECK:STDOUT: %.loc5_30.4: i32 = value_of_initializer %int.convert_checked.loc5_30 [template = constants.%.29] +// CHECK:STDOUT: %.loc5_30.5: i32 = converted %.loc5_30.1, %.loc5_30.4 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc5_29: init %.2 = call %Int32ToUint32.ref.loc5(%.loc5_30.5) [template = constants.%.30] +// CHECK:STDOUT: %.loc5_42.1: %.2 = value_of_initializer %int.convert_checked.loc5_29 [template = constants.%.30] +// CHECK:STDOUT: %.loc5_42.2: %.2 = converted %int.convert_checked.loc5_29, %.loc5_42.1 [template = constants.%.30] // CHECK:STDOUT: %max: %.2 = bind_name max, %.loc5_42.2 // CHECK:STDOUT: %Uint32ToInt32.ref: %Uint32ToInt32.type = name_ref Uint32ToInt32, imports.%import_ref.7 [template = constants.%Uint32ToInt32] // CHECK:STDOUT: %Int32ToUint32.ref.loc6: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %.loc6_54: i32 = int_value 2147483647 [template = constants.%.3] -// CHECK:STDOUT: %int.convert_checked.loc6_53: init %.2 = call %Int32ToUint32.ref.loc6(%.loc6_54) [template = constants.%.4] -// CHECK:STDOUT: %.loc6_53.1: %.2 = value_of_initializer %int.convert_checked.loc6_53 [template = constants.%.4] -// CHECK:STDOUT: %.loc6_53.2: %.2 = converted %int.convert_checked.loc6_53, %.loc6_53.1 [template = constants.%.4] -// CHECK:STDOUT: %int.convert_checked.loc6_39: init i32 = call %Uint32ToInt32.ref(%.loc6_53.2) [template = constants.%.3] -// CHECK:STDOUT: %.loc6_67.1: i32 = value_of_initializer %int.convert_checked.loc6_39 [template = constants.%.3] -// CHECK:STDOUT: %.loc6_67.2: i32 = converted %int.convert_checked.loc6_39, %.loc6_67.1 [template = constants.%.3] +// CHECK:STDOUT: %.loc6_54.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.3] +// CHECK:STDOUT: %.loc6_54.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc6_54.3: = bound_method %.loc6_54.1, %.loc6_54.2 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked.loc6_54: init i32 = call %.loc6_54.3(%.loc6_54.1) [template = constants.%.29] +// CHECK:STDOUT: %.loc6_54.4: i32 = value_of_initializer %int.convert_checked.loc6_54 [template = constants.%.29] +// CHECK:STDOUT: %.loc6_54.5: i32 = converted %.loc6_54.1, %.loc6_54.4 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc6_53: init %.2 = call %Int32ToUint32.ref.loc6(%.loc6_54.5) [template = constants.%.30] +// CHECK:STDOUT: %.loc6_53.1: %.2 = value_of_initializer %int.convert_checked.loc6_53 [template = constants.%.30] +// CHECK:STDOUT: %.loc6_53.2: %.2 = converted %int.convert_checked.loc6_53, %.loc6_53.1 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc6_39: init i32 = call %Uint32ToInt32.ref(%.loc6_53.2) [template = constants.%.29] +// CHECK:STDOUT: %.loc6_67.1: i32 = value_of_initializer %int.convert_checked.loc6_39 [template = constants.%.29] +// CHECK:STDOUT: %.loc6_67.2: i32 = converted %int.convert_checked.loc6_39, %.loc6_67.1 [template = constants.%.29] // CHECK:STDOUT: %max_roundtrip: i32 = bind_name max_roundtrip, %.loc6_67.2 // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -1056,44 +1109,53 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %.2: type = int_type unsigned, %.1 [template] // CHECK:STDOUT: %Int32ToUint16.type: type = fn_type @Int32ToUint16 [template] // CHECK:STDOUT: %Int32ToUint16: %Int32ToUint16.type = struct_value () [template] -// CHECK:STDOUT: %.3: i32 = int_value 0 [template] -// CHECK:STDOUT: %.4: %.2 = int_value 0 [template] -// CHECK:STDOUT: %.5: i32 = int_value 65535 [template] -// CHECK:STDOUT: %.6: %.2 = int_value 65535 [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 0 [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: %.27: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.28: = bound_method %.3, %Convert.15 [template] +// CHECK:STDOUT: %.29: i32 = int_value 0 [template] +// CHECK:STDOUT: %.30: %.2 = int_value 0 [template] +// CHECK:STDOUT: %.31: Core.IntLiteral = int_value 65535 [template] +// CHECK:STDOUT: %.32: = bound_method %.31, %Convert.15 [template] +// CHECK:STDOUT: %.33: i32 = int_value 65535 [template] +// CHECK:STDOUT: %.34: %.2 = int_value 65535 [template] // CHECK:STDOUT: %Int.type: type = fn_type @Int [template] // CHECK:STDOUT: %Int: %Int.type = struct_value () [template] -// CHECK:STDOUT: %.7: type = int_type signed, %.1 [template] +// CHECK:STDOUT: %.35: type = int_type signed, %.1 [template] // CHECK:STDOUT: %Int32ToInt16.type: type = fn_type @Int32ToInt16 [template] // CHECK:STDOUT: %Int32ToInt16: %Int32ToInt16.type = struct_value () [template] -// CHECK:STDOUT: %.8: i32 = int_value 32767 [template] -// CHECK:STDOUT: %.9: %.7 = int_value 32767 [template] +// CHECK:STDOUT: %.36: Core.IntLiteral = int_value 32767 [template] +// CHECK:STDOUT: %.37: = bound_method %.36, %Convert.15 [template] +// CHECK:STDOUT: %.38: i32 = int_value 32767 [template] +// CHECK:STDOUT: %.39: %.35 = int_value 32767 [template] // CHECK:STDOUT: %NegateI32.type: type = fn_type @NegateI32 [template] // CHECK:STDOUT: %NegateI32: %NegateI32.type = struct_value () [template] -// CHECK:STDOUT: %.10: i32 = int_value 32768 [template] -// CHECK:STDOUT: %.11: i32 = int_value -32768 [template] -// CHECK:STDOUT: %.12: %.7 = int_value -32768 [template] +// CHECK:STDOUT: %.40: Core.IntLiteral = int_value 32768 [template] +// CHECK:STDOUT: %.41: = bound_method %.40, %Convert.15 [template] +// CHECK:STDOUT: %.42: i32 = int_value 32768 [template] +// CHECK:STDOUT: %.43: i32 = int_value -32768 [template] +// CHECK:STDOUT: %.44: %.35 = int_value -32768 [template] // CHECK:STDOUT: %Uint32ToUint16.type: type = fn_type @Uint32ToUint16 [template] // CHECK:STDOUT: %Uint32ToUint16: %Uint32ToUint16.type = struct_value () [template] -// CHECK:STDOUT: %.13: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %.14: type = int_type unsigned, %.13 [template] +// CHECK:STDOUT: %.45: Core.IntLiteral = int_value 32 [template] +// CHECK:STDOUT: %.46: type = int_type unsigned, %.45 [template] // CHECK:STDOUT: %Int32ToUint32.type: type = fn_type @Int32ToUint32 [template] // CHECK:STDOUT: %Int32ToUint32: %Int32ToUint32.type = struct_value () [template] -// CHECK:STDOUT: %.15: %.14 = int_value 0 [template] -// CHECK:STDOUT: %.16: %.14 = int_value 65535 [template] +// CHECK:STDOUT: %.47: %.46 = int_value 0 [template] +// CHECK:STDOUT: %.48: %.46 = int_value 65535 [template] // CHECK:STDOUT: %Uint32ToInt16.type: type = fn_type @Uint32ToInt16 [template] // CHECK:STDOUT: %Uint32ToInt16: %Uint32ToInt16.type = struct_value () [template] -// CHECK:STDOUT: %.17: %.7 = int_value 0 [template] -// CHECK:STDOUT: %.18: %.14 = int_value 32767 [template] +// CHECK:STDOUT: %.49: %.35 = int_value 0 [template] +// CHECK:STDOUT: %.50: %.46 = int_value 32767 [template] // CHECK:STDOUT: %IntLiteralToInt16.type: type = fn_type @IntLiteralToInt16 [template] // CHECK:STDOUT: %IntLiteralToInt16: %IntLiteralToInt16.type = struct_value () [template] // CHECK:STDOUT: %Int32ToIntLiteral.type: type = fn_type @Int32ToIntLiteral [template] // CHECK:STDOUT: %Int32ToIntLiteral: %Int32ToIntLiteral.type = struct_value () [template] -// CHECK:STDOUT: %.19: Core.IntLiteral = int_value -32768 [template] -// CHECK:STDOUT: %.20: Core.IntLiteral = int_value 32767 [template] +// CHECK:STDOUT: %.51: Core.IntLiteral = int_value -32768 [template] // CHECK:STDOUT: %IntLiteralToUint16.type: type = fn_type @IntLiteralToUint16 [template] // CHECK:STDOUT: %IntLiteralToUint16: %IntLiteralToUint16.type = struct_value () [template] -// CHECK:STDOUT: %.21: Core.IntLiteral = int_value 0 [template] -// CHECK:STDOUT: %.22: Core.IntLiteral = int_value 65535 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -1120,7 +1182,8 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, inst+427, unloaded // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .UInt = %import_ref.22 -// CHECK:STDOUT: .Int = %import_ref.23 +// CHECK:STDOUT: .ImplicitAs = %import_ref.23 +// CHECK:STDOUT: .Int = %import_ref.72 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -1174,13 +1237,13 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %.loc6_8.2: type = value_of_initializer %int.make_type_unsigned.loc6 [template = constants.%.2] // CHECK:STDOUT: %.loc6_8.3: type = converted %int.make_type_unsigned.loc6, %.loc6_8.2 [template = constants.%.2] // CHECK:STDOUT: %.loc8_8.1: Core.IntLiteral = int_value 16 [template = constants.%.1] -// CHECK:STDOUT: %int.make_type_signed.loc8: init type = call constants.%Int(%.loc8_8.1) [template = constants.%.7] -// CHECK:STDOUT: %.loc8_8.2: type = value_of_initializer %int.make_type_signed.loc8 [template = constants.%.7] -// CHECK:STDOUT: %.loc8_8.3: type = converted %int.make_type_signed.loc8, %.loc8_8.2 [template = constants.%.7] +// CHECK:STDOUT: %int.make_type_signed.loc8: init type = call constants.%Int(%.loc8_8.1) [template = constants.%.35] +// CHECK:STDOUT: %.loc8_8.2: type = value_of_initializer %int.make_type_signed.loc8 [template = constants.%.35] +// CHECK:STDOUT: %.loc8_8.3: type = converted %int.make_type_signed.loc8, %.loc8_8.2 [template = constants.%.35] // CHECK:STDOUT: %.loc9_8.1: Core.IntLiteral = int_value 16 [template = constants.%.1] -// CHECK:STDOUT: %int.make_type_signed.loc9: init type = call constants.%Int(%.loc9_8.1) [template = constants.%.7] -// CHECK:STDOUT: %.loc9_8.2: type = value_of_initializer %int.make_type_signed.loc9 [template = constants.%.7] -// CHECK:STDOUT: %.loc9_8.3: type = converted %int.make_type_signed.loc9, %.loc9_8.2 [template = constants.%.7] +// CHECK:STDOUT: %int.make_type_signed.loc9: init type = call constants.%Int(%.loc9_8.1) [template = constants.%.35] +// CHECK:STDOUT: %.loc9_8.2: type = value_of_initializer %int.make_type_signed.loc9 [template = constants.%.35] +// CHECK:STDOUT: %.loc9_8.3: type = converted %int.make_type_signed.loc9, %.loc9_8.2 [template = constants.%.35] // CHECK:STDOUT: %.loc11_8.1: Core.IntLiteral = int_value 16 [template = constants.%.1] // CHECK:STDOUT: %int.make_type_unsigned.loc11: init type = call constants.%UInt(%.loc11_8.1) [template = constants.%.2] // CHECK:STDOUT: %.loc11_8.2: type = value_of_initializer %int.make_type_unsigned.loc11 [template = constants.%.2] @@ -1190,21 +1253,21 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %.loc12_8.2: type = value_of_initializer %int.make_type_unsigned.loc12 [template = constants.%.2] // CHECK:STDOUT: %.loc12_8.3: type = converted %int.make_type_unsigned.loc12, %.loc12_8.2 [template = constants.%.2] // CHECK:STDOUT: %.loc14_8.1: Core.IntLiteral = int_value 16 [template = constants.%.1] -// CHECK:STDOUT: %int.make_type_signed.loc14: init type = call constants.%Int(%.loc14_8.1) [template = constants.%.7] -// CHECK:STDOUT: %.loc14_8.2: type = value_of_initializer %int.make_type_signed.loc14 [template = constants.%.7] -// CHECK:STDOUT: %.loc14_8.3: type = converted %int.make_type_signed.loc14, %.loc14_8.2 [template = constants.%.7] +// CHECK:STDOUT: %int.make_type_signed.loc14: init type = call constants.%Int(%.loc14_8.1) [template = constants.%.35] +// CHECK:STDOUT: %.loc14_8.2: type = value_of_initializer %int.make_type_signed.loc14 [template = constants.%.35] +// CHECK:STDOUT: %.loc14_8.3: type = converted %int.make_type_signed.loc14, %.loc14_8.2 [template = constants.%.35] // CHECK:STDOUT: %.loc15_8.1: Core.IntLiteral = int_value 16 [template = constants.%.1] -// CHECK:STDOUT: %int.make_type_signed.loc15: init type = call constants.%Int(%.loc15_8.1) [template = constants.%.7] -// CHECK:STDOUT: %.loc15_8.2: type = value_of_initializer %int.make_type_signed.loc15 [template = constants.%.7] -// CHECK:STDOUT: %.loc15_8.3: type = converted %int.make_type_signed.loc15, %.loc15_8.2 [template = constants.%.7] +// CHECK:STDOUT: %int.make_type_signed.loc15: init type = call constants.%Int(%.loc15_8.1) [template = constants.%.35] +// CHECK:STDOUT: %.loc15_8.2: type = value_of_initializer %int.make_type_signed.loc15 [template = constants.%.35] +// CHECK:STDOUT: %.loc15_8.3: type = converted %int.make_type_signed.loc15, %.loc15_8.2 [template = constants.%.35] // CHECK:STDOUT: %.loc17_18.1: Core.IntLiteral = int_value 16 [template = constants.%.1] -// CHECK:STDOUT: %int.make_type_signed.loc17: init type = call constants.%Int(%.loc17_18.1) [template = constants.%.7] -// CHECK:STDOUT: %.loc17_18.2: type = value_of_initializer %int.make_type_signed.loc17 [template = constants.%.7] -// CHECK:STDOUT: %.loc17_18.3: type = converted %int.make_type_signed.loc17, %.loc17_18.2 [template = constants.%.7] +// CHECK:STDOUT: %int.make_type_signed.loc17: init type = call constants.%Int(%.loc17_18.1) [template = constants.%.35] +// CHECK:STDOUT: %.loc17_18.2: type = value_of_initializer %int.make_type_signed.loc17 [template = constants.%.35] +// CHECK:STDOUT: %.loc17_18.3: type = converted %int.make_type_signed.loc17, %.loc17_18.2 [template = constants.%.35] // CHECK:STDOUT: %.loc18_18.1: Core.IntLiteral = int_value 16 [template = constants.%.1] -// CHECK:STDOUT: %int.make_type_signed.loc18: init type = call constants.%Int(%.loc18_18.1) [template = constants.%.7] -// CHECK:STDOUT: %.loc18_18.2: type = value_of_initializer %int.make_type_signed.loc18 [template = constants.%.7] -// CHECK:STDOUT: %.loc18_18.3: type = converted %int.make_type_signed.loc18, %.loc18_18.2 [template = constants.%.7] +// CHECK:STDOUT: %int.make_type_signed.loc18: init type = call constants.%Int(%.loc18_18.1) [template = constants.%.35] +// CHECK:STDOUT: %.loc18_18.2: type = value_of_initializer %int.make_type_signed.loc18 [template = constants.%.35] +// CHECK:STDOUT: %.loc18_18.3: type = converted %int.make_type_signed.loc18, %.loc18_18.2 [template = constants.%.35] // CHECK:STDOUT: %.loc20_18.1: Core.IntLiteral = int_value 16 [template = constants.%.1] // CHECK:STDOUT: %int.make_type_unsigned.loc20: init type = call constants.%UInt(%.loc20_18.1) [template = constants.%.2] // CHECK:STDOUT: %.loc20_18.2: type = value_of_initializer %int.make_type_unsigned.loc20 [template = constants.%.2] @@ -1217,17 +1280,17 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32ToUint16(%a.param_patt: i32) -> %.2 = "int.convert_checked"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Int32ToInt16(%a.param_patt: i32) -> %.7 = "int.convert_checked"; +// CHECK:STDOUT: fn @Int32ToInt16(%a.param_patt: i32) -> %.35 = "int.convert_checked"; // CHECK:STDOUT: // CHECK:STDOUT: fn @NegateI32(%a.param_patt: i32) -> i32 = "int.snegate"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Uint32ToUint16(%a.param_patt: %.14) -> %.2 = "int.convert_checked"; +// CHECK:STDOUT: fn @Uint32ToUint16(%a.param_patt: %.46) -> %.2 = "int.convert_checked"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Int32ToUint32(%a.param_patt: i32) -> %.14 = "int.convert_checked"; +// CHECK:STDOUT: fn @Int32ToUint32(%a.param_patt: i32) -> %.46 = "int.convert_checked"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Uint32ToInt16(%a.param_patt: %.14) -> %.7 = "int.convert_checked"; +// CHECK:STDOUT: fn @Uint32ToInt16(%a.param_patt: %.46) -> %.35 = "int.convert_checked"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @IntLiteralToInt16(%a.param_patt: Core.IntLiteral) -> %.7 = "int.convert_checked"; +// CHECK:STDOUT: fn @IntLiteralToInt16(%a.param_patt: Core.IntLiteral) -> %.35 = "int.convert_checked"; // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32ToIntLiteral(%a.param_patt: i32) -> Core.IntLiteral = "int.convert_checked"; // CHECK:STDOUT: @@ -1236,116 +1299,176 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Int32ToUint16.ref.loc5: %Int32ToUint16.type = name_ref Int32ToUint16, imports.%import_ref.11 [template = constants.%Int32ToUint16] -// CHECK:STDOUT: %.loc5_28: i32 = int_value 0 [template = constants.%.3] -// CHECK:STDOUT: %int.convert_checked.loc5: init %.2 = call %Int32ToUint16.ref.loc5(%.loc5_28) [template = constants.%.4] -// CHECK:STDOUT: %.loc5_30.1: %.2 = value_of_initializer %int.convert_checked.loc5 [template = constants.%.4] -// CHECK:STDOUT: %.loc5_30.2: %.2 = converted %int.convert_checked.loc5, %.loc5_30.1 [template = constants.%.4] +// CHECK:STDOUT: %.loc5_28.1: Core.IntLiteral = int_value 0 [template = constants.%.3] +// CHECK:STDOUT: %.loc5_28.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc5_28.3: = bound_method %.loc5_28.1, %.loc5_28.2 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked.loc5_28: init i32 = call %.loc5_28.3(%.loc5_28.1) [template = constants.%.29] +// CHECK:STDOUT: %.loc5_28.4: i32 = value_of_initializer %int.convert_checked.loc5_28 [template = constants.%.29] +// CHECK:STDOUT: %.loc5_28.5: i32 = converted %.loc5_28.1, %.loc5_28.4 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc5_27: init %.2 = call %Int32ToUint16.ref.loc5(%.loc5_28.5) [template = constants.%.30] +// CHECK:STDOUT: %.loc5_30.1: %.2 = value_of_initializer %int.convert_checked.loc5_27 [template = constants.%.30] +// CHECK:STDOUT: %.loc5_30.2: %.2 = converted %int.convert_checked.loc5_27, %.loc5_30.1 [template = constants.%.30] // CHECK:STDOUT: %a: %.2 = bind_name a, %.loc5_30.2 // CHECK:STDOUT: %Int32ToUint16.ref.loc6: %Int32ToUint16.type = name_ref Int32ToUint16, imports.%import_ref.11 [template = constants.%Int32ToUint16] -// CHECK:STDOUT: %.loc6_28: i32 = int_value 65535 [template = constants.%.5] -// CHECK:STDOUT: %int.convert_checked.loc6: init %.2 = call %Int32ToUint16.ref.loc6(%.loc6_28) [template = constants.%.6] -// CHECK:STDOUT: %.loc6_35.1: %.2 = value_of_initializer %int.convert_checked.loc6 [template = constants.%.6] -// CHECK:STDOUT: %.loc6_35.2: %.2 = converted %int.convert_checked.loc6, %.loc6_35.1 [template = constants.%.6] +// CHECK:STDOUT: %.loc6_28.1: Core.IntLiteral = int_value 65535 [template = constants.%.31] +// CHECK:STDOUT: %.loc6_28.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc6_28.3: = bound_method %.loc6_28.1, %.loc6_28.2 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc6_28: init i32 = call %.loc6_28.3(%.loc6_28.1) [template = constants.%.33] +// CHECK:STDOUT: %.loc6_28.4: i32 = value_of_initializer %int.convert_checked.loc6_28 [template = constants.%.33] +// CHECK:STDOUT: %.loc6_28.5: i32 = converted %.loc6_28.1, %.loc6_28.4 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc6_27: init %.2 = call %Int32ToUint16.ref.loc6(%.loc6_28.5) [template = constants.%.34] +// CHECK:STDOUT: %.loc6_35.1: %.2 = value_of_initializer %int.convert_checked.loc6_27 [template = constants.%.34] +// CHECK:STDOUT: %.loc6_35.2: %.2 = converted %int.convert_checked.loc6_27, %.loc6_35.1 [template = constants.%.34] // CHECK:STDOUT: %b: %.2 = bind_name b, %.loc6_35.2 // CHECK:STDOUT: %Int32ToInt16.ref.loc8: %Int32ToInt16.type = name_ref Int32ToInt16, imports.%import_ref.10 [template = constants.%Int32ToInt16] -// CHECK:STDOUT: %.loc8_27: i32 = int_value 32767 [template = constants.%.8] -// CHECK:STDOUT: %int.convert_checked.loc8: init %.7 = call %Int32ToInt16.ref.loc8(%.loc8_27) [template = constants.%.9] -// CHECK:STDOUT: %.loc8_34.1: %.7 = value_of_initializer %int.convert_checked.loc8 [template = constants.%.9] -// CHECK:STDOUT: %.loc8_34.2: %.7 = converted %int.convert_checked.loc8, %.loc8_34.1 [template = constants.%.9] -// CHECK:STDOUT: %c: %.7 = bind_name c, %.loc8_34.2 +// CHECK:STDOUT: %.loc8_27.1: Core.IntLiteral = int_value 32767 [template = constants.%.36] +// CHECK:STDOUT: %.loc8_27.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc8_27.3: = bound_method %.loc8_27.1, %.loc8_27.2 [template = constants.%.37] +// CHECK:STDOUT: %int.convert_checked.loc8_27: init i32 = call %.loc8_27.3(%.loc8_27.1) [template = constants.%.38] +// CHECK:STDOUT: %.loc8_27.4: i32 = value_of_initializer %int.convert_checked.loc8_27 [template = constants.%.38] +// CHECK:STDOUT: %.loc8_27.5: i32 = converted %.loc8_27.1, %.loc8_27.4 [template = constants.%.38] +// CHECK:STDOUT: %int.convert_checked.loc8_26: init %.35 = call %Int32ToInt16.ref.loc8(%.loc8_27.5) [template = constants.%.39] +// CHECK:STDOUT: %.loc8_34.1: %.35 = value_of_initializer %int.convert_checked.loc8_26 [template = constants.%.39] +// CHECK:STDOUT: %.loc8_34.2: %.35 = converted %int.convert_checked.loc8_26, %.loc8_34.1 [template = constants.%.39] +// CHECK:STDOUT: %c: %.35 = bind_name c, %.loc8_34.2 // CHECK:STDOUT: %Int32ToInt16.ref.loc9: %Int32ToInt16.type = name_ref Int32ToInt16, imports.%import_ref.10 [template = constants.%Int32ToInt16] // CHECK:STDOUT: %NegateI32.ref.loc9: %NegateI32.type = name_ref NegateI32, imports.%import_ref.1 [template = constants.%NegateI32] -// CHECK:STDOUT: %.loc9_37: i32 = int_value 32768 [template = constants.%.10] -// CHECK:STDOUT: %int.snegate.loc9: init i32 = call %NegateI32.ref.loc9(%.loc9_37) [template = constants.%.11] -// CHECK:STDOUT: %.loc9_36.1: i32 = value_of_initializer %int.snegate.loc9 [template = constants.%.11] -// CHECK:STDOUT: %.loc9_36.2: i32 = converted %int.snegate.loc9, %.loc9_36.1 [template = constants.%.11] -// CHECK:STDOUT: %int.convert_checked.loc9: init %.7 = call %Int32ToInt16.ref.loc9(%.loc9_36.2) [template = constants.%.12] -// CHECK:STDOUT: %.loc9_45.1: %.7 = value_of_initializer %int.convert_checked.loc9 [template = constants.%.12] -// CHECK:STDOUT: %.loc9_45.2: %.7 = converted %int.convert_checked.loc9, %.loc9_45.1 [template = constants.%.12] -// CHECK:STDOUT: %d: %.7 = bind_name d, %.loc9_45.2 +// CHECK:STDOUT: %.loc9_37.1: Core.IntLiteral = int_value 32768 [template = constants.%.40] +// CHECK:STDOUT: %.loc9_37.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_37.3: = bound_method %.loc9_37.1, %.loc9_37.2 [template = constants.%.41] +// CHECK:STDOUT: %int.convert_checked.loc9_37: init i32 = call %.loc9_37.3(%.loc9_37.1) [template = constants.%.42] +// CHECK:STDOUT: %.loc9_37.4: i32 = value_of_initializer %int.convert_checked.loc9_37 [template = constants.%.42] +// CHECK:STDOUT: %.loc9_37.5: i32 = converted %.loc9_37.1, %.loc9_37.4 [template = constants.%.42] +// CHECK:STDOUT: %int.snegate.loc9: init i32 = call %NegateI32.ref.loc9(%.loc9_37.5) [template = constants.%.43] +// CHECK:STDOUT: %.loc9_36.1: i32 = value_of_initializer %int.snegate.loc9 [template = constants.%.43] +// CHECK:STDOUT: %.loc9_36.2: i32 = converted %int.snegate.loc9, %.loc9_36.1 [template = constants.%.43] +// CHECK:STDOUT: %int.convert_checked.loc9_26: init %.35 = call %Int32ToInt16.ref.loc9(%.loc9_36.2) [template = constants.%.44] +// CHECK:STDOUT: %.loc9_45.1: %.35 = value_of_initializer %int.convert_checked.loc9_26 [template = constants.%.44] +// CHECK:STDOUT: %.loc9_45.2: %.35 = converted %int.convert_checked.loc9_26, %.loc9_45.1 [template = constants.%.44] +// CHECK:STDOUT: %d: %.35 = bind_name d, %.loc9_45.2 // CHECK:STDOUT: %Uint32ToUint16.ref.loc11: %Uint32ToUint16.type = name_ref Uint32ToUint16, imports.%import_ref.13 [template = constants.%Uint32ToUint16] // CHECK:STDOUT: %Int32ToUint32.ref.loc11: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %.loc11_43: i32 = int_value 0 [template = constants.%.3] -// CHECK:STDOUT: %int.convert_checked.loc11_42: init %.14 = call %Int32ToUint32.ref.loc11(%.loc11_43) [template = constants.%.15] -// CHECK:STDOUT: %.loc11_42.1: %.14 = value_of_initializer %int.convert_checked.loc11_42 [template = constants.%.15] -// CHECK:STDOUT: %.loc11_42.2: %.14 = converted %int.convert_checked.loc11_42, %.loc11_42.1 [template = constants.%.15] -// CHECK:STDOUT: %int.convert_checked.loc11_28: init %.2 = call %Uint32ToUint16.ref.loc11(%.loc11_42.2) [template = constants.%.4] -// CHECK:STDOUT: %.loc11_46.1: %.2 = value_of_initializer %int.convert_checked.loc11_28 [template = constants.%.4] -// CHECK:STDOUT: %.loc11_46.2: %.2 = converted %int.convert_checked.loc11_28, %.loc11_46.1 [template = constants.%.4] +// CHECK:STDOUT: %.loc11_43.1: Core.IntLiteral = int_value 0 [template = constants.%.3] +// CHECK:STDOUT: %.loc11_43.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_43.3: = bound_method %.loc11_43.1, %.loc11_43.2 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked.loc11_43: init i32 = call %.loc11_43.3(%.loc11_43.1) [template = constants.%.29] +// CHECK:STDOUT: %.loc11_43.4: i32 = value_of_initializer %int.convert_checked.loc11_43 [template = constants.%.29] +// CHECK:STDOUT: %.loc11_43.5: i32 = converted %.loc11_43.1, %.loc11_43.4 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc11_42: init %.46 = call %Int32ToUint32.ref.loc11(%.loc11_43.5) [template = constants.%.47] +// CHECK:STDOUT: %.loc11_42.1: %.46 = value_of_initializer %int.convert_checked.loc11_42 [template = constants.%.47] +// CHECK:STDOUT: %.loc11_42.2: %.46 = converted %int.convert_checked.loc11_42, %.loc11_42.1 [template = constants.%.47] +// CHECK:STDOUT: %int.convert_checked.loc11_28: init %.2 = call %Uint32ToUint16.ref.loc11(%.loc11_42.2) [template = constants.%.30] +// CHECK:STDOUT: %.loc11_46.1: %.2 = value_of_initializer %int.convert_checked.loc11_28 [template = constants.%.30] +// CHECK:STDOUT: %.loc11_46.2: %.2 = converted %int.convert_checked.loc11_28, %.loc11_46.1 [template = constants.%.30] // CHECK:STDOUT: %e: %.2 = bind_name e, %.loc11_46.2 // CHECK:STDOUT: %Uint32ToUint16.ref.loc12: %Uint32ToUint16.type = name_ref Uint32ToUint16, imports.%import_ref.13 [template = constants.%Uint32ToUint16] // CHECK:STDOUT: %Int32ToUint32.ref.loc12: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %.loc12_43: i32 = int_value 65535 [template = constants.%.5] -// CHECK:STDOUT: %int.convert_checked.loc12_42: init %.14 = call %Int32ToUint32.ref.loc12(%.loc12_43) [template = constants.%.16] -// CHECK:STDOUT: %.loc12_42.1: %.14 = value_of_initializer %int.convert_checked.loc12_42 [template = constants.%.16] -// CHECK:STDOUT: %.loc12_42.2: %.14 = converted %int.convert_checked.loc12_42, %.loc12_42.1 [template = constants.%.16] -// CHECK:STDOUT: %int.convert_checked.loc12_28: init %.2 = call %Uint32ToUint16.ref.loc12(%.loc12_42.2) [template = constants.%.6] -// CHECK:STDOUT: %.loc12_51.1: %.2 = value_of_initializer %int.convert_checked.loc12_28 [template = constants.%.6] -// CHECK:STDOUT: %.loc12_51.2: %.2 = converted %int.convert_checked.loc12_28, %.loc12_51.1 [template = constants.%.6] +// CHECK:STDOUT: %.loc12_43.1: Core.IntLiteral = int_value 65535 [template = constants.%.31] +// CHECK:STDOUT: %.loc12_43.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_43.3: = bound_method %.loc12_43.1, %.loc12_43.2 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc12_43: init i32 = call %.loc12_43.3(%.loc12_43.1) [template = constants.%.33] +// CHECK:STDOUT: %.loc12_43.4: i32 = value_of_initializer %int.convert_checked.loc12_43 [template = constants.%.33] +// CHECK:STDOUT: %.loc12_43.5: i32 = converted %.loc12_43.1, %.loc12_43.4 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc12_42: init %.46 = call %Int32ToUint32.ref.loc12(%.loc12_43.5) [template = constants.%.48] +// CHECK:STDOUT: %.loc12_42.1: %.46 = value_of_initializer %int.convert_checked.loc12_42 [template = constants.%.48] +// CHECK:STDOUT: %.loc12_42.2: %.46 = converted %int.convert_checked.loc12_42, %.loc12_42.1 [template = constants.%.48] +// CHECK:STDOUT: %int.convert_checked.loc12_28: init %.2 = call %Uint32ToUint16.ref.loc12(%.loc12_42.2) [template = constants.%.34] +// CHECK:STDOUT: %.loc12_51.1: %.2 = value_of_initializer %int.convert_checked.loc12_28 [template = constants.%.34] +// CHECK:STDOUT: %.loc12_51.2: %.2 = converted %int.convert_checked.loc12_28, %.loc12_51.1 [template = constants.%.34] // CHECK:STDOUT: %f: %.2 = bind_name f, %.loc12_51.2 // CHECK:STDOUT: %Uint32ToInt16.ref.loc14: %Uint32ToInt16.type = name_ref Uint32ToInt16, imports.%import_ref.12 [template = constants.%Uint32ToInt16] // CHECK:STDOUT: %Int32ToUint32.ref.loc14: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %.loc14_42: i32 = int_value 0 [template = constants.%.3] -// CHECK:STDOUT: %int.convert_checked.loc14_41: init %.14 = call %Int32ToUint32.ref.loc14(%.loc14_42) [template = constants.%.15] -// CHECK:STDOUT: %.loc14_41.1: %.14 = value_of_initializer %int.convert_checked.loc14_41 [template = constants.%.15] -// CHECK:STDOUT: %.loc14_41.2: %.14 = converted %int.convert_checked.loc14_41, %.loc14_41.1 [template = constants.%.15] -// CHECK:STDOUT: %int.convert_checked.loc14_27: init %.7 = call %Uint32ToInt16.ref.loc14(%.loc14_41.2) [template = constants.%.17] -// CHECK:STDOUT: %.loc14_45.1: %.7 = value_of_initializer %int.convert_checked.loc14_27 [template = constants.%.17] -// CHECK:STDOUT: %.loc14_45.2: %.7 = converted %int.convert_checked.loc14_27, %.loc14_45.1 [template = constants.%.17] -// CHECK:STDOUT: %g: %.7 = bind_name g, %.loc14_45.2 +// CHECK:STDOUT: %.loc14_42.1: Core.IntLiteral = int_value 0 [template = constants.%.3] +// CHECK:STDOUT: %.loc14_42.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc14_42.3: = bound_method %.loc14_42.1, %.loc14_42.2 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked.loc14_42: init i32 = call %.loc14_42.3(%.loc14_42.1) [template = constants.%.29] +// CHECK:STDOUT: %.loc14_42.4: i32 = value_of_initializer %int.convert_checked.loc14_42 [template = constants.%.29] +// CHECK:STDOUT: %.loc14_42.5: i32 = converted %.loc14_42.1, %.loc14_42.4 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc14_41: init %.46 = call %Int32ToUint32.ref.loc14(%.loc14_42.5) [template = constants.%.47] +// CHECK:STDOUT: %.loc14_41.1: %.46 = value_of_initializer %int.convert_checked.loc14_41 [template = constants.%.47] +// CHECK:STDOUT: %.loc14_41.2: %.46 = converted %int.convert_checked.loc14_41, %.loc14_41.1 [template = constants.%.47] +// CHECK:STDOUT: %int.convert_checked.loc14_27: init %.35 = call %Uint32ToInt16.ref.loc14(%.loc14_41.2) [template = constants.%.49] +// CHECK:STDOUT: %.loc14_45.1: %.35 = value_of_initializer %int.convert_checked.loc14_27 [template = constants.%.49] +// CHECK:STDOUT: %.loc14_45.2: %.35 = converted %int.convert_checked.loc14_27, %.loc14_45.1 [template = constants.%.49] +// CHECK:STDOUT: %g: %.35 = bind_name g, %.loc14_45.2 // CHECK:STDOUT: %Uint32ToInt16.ref.loc15: %Uint32ToInt16.type = name_ref Uint32ToInt16, imports.%import_ref.12 [template = constants.%Uint32ToInt16] // CHECK:STDOUT: %Int32ToUint32.ref.loc15: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %.loc15_42: i32 = int_value 32767 [template = constants.%.8] -// CHECK:STDOUT: %int.convert_checked.loc15_41: init %.14 = call %Int32ToUint32.ref.loc15(%.loc15_42) [template = constants.%.18] -// CHECK:STDOUT: %.loc15_41.1: %.14 = value_of_initializer %int.convert_checked.loc15_41 [template = constants.%.18] -// CHECK:STDOUT: %.loc15_41.2: %.14 = converted %int.convert_checked.loc15_41, %.loc15_41.1 [template = constants.%.18] -// CHECK:STDOUT: %int.convert_checked.loc15_27: init %.7 = call %Uint32ToInt16.ref.loc15(%.loc15_41.2) [template = constants.%.9] -// CHECK:STDOUT: %.loc15_50.1: %.7 = value_of_initializer %int.convert_checked.loc15_27 [template = constants.%.9] -// CHECK:STDOUT: %.loc15_50.2: %.7 = converted %int.convert_checked.loc15_27, %.loc15_50.1 [template = constants.%.9] -// CHECK:STDOUT: %h: %.7 = bind_name h, %.loc15_50.2 +// CHECK:STDOUT: %.loc15_42.1: Core.IntLiteral = int_value 32767 [template = constants.%.36] +// CHECK:STDOUT: %.loc15_42.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc15_42.3: = bound_method %.loc15_42.1, %.loc15_42.2 [template = constants.%.37] +// CHECK:STDOUT: %int.convert_checked.loc15_42: init i32 = call %.loc15_42.3(%.loc15_42.1) [template = constants.%.38] +// CHECK:STDOUT: %.loc15_42.4: i32 = value_of_initializer %int.convert_checked.loc15_42 [template = constants.%.38] +// CHECK:STDOUT: %.loc15_42.5: i32 = converted %.loc15_42.1, %.loc15_42.4 [template = constants.%.38] +// CHECK:STDOUT: %int.convert_checked.loc15_41: init %.46 = call %Int32ToUint32.ref.loc15(%.loc15_42.5) [template = constants.%.50] +// CHECK:STDOUT: %.loc15_41.1: %.46 = value_of_initializer %int.convert_checked.loc15_41 [template = constants.%.50] +// CHECK:STDOUT: %.loc15_41.2: %.46 = converted %int.convert_checked.loc15_41, %.loc15_41.1 [template = constants.%.50] +// CHECK:STDOUT: %int.convert_checked.loc15_27: init %.35 = call %Uint32ToInt16.ref.loc15(%.loc15_41.2) [template = constants.%.39] +// CHECK:STDOUT: %.loc15_50.1: %.35 = value_of_initializer %int.convert_checked.loc15_27 [template = constants.%.39] +// CHECK:STDOUT: %.loc15_50.2: %.35 = converted %int.convert_checked.loc15_27, %.loc15_50.1 [template = constants.%.39] +// CHECK:STDOUT: %h: %.35 = bind_name h, %.loc15_50.2 // CHECK:STDOUT: %IntLiteralToInt16.ref.loc17: %IntLiteralToInt16.type = name_ref IntLiteralToInt16, imports.%import_ref.14 [template = constants.%IntLiteralToInt16] // CHECK:STDOUT: %Int32ToIntLiteral.ref.loc17: %Int32ToIntLiteral.type = name_ref Int32ToIntLiteral, imports.%import_ref.20 [template = constants.%Int32ToIntLiteral] // CHECK:STDOUT: %NegateI32.ref.loc17: %NegateI32.type = name_ref NegateI32, imports.%import_ref.1 [template = constants.%NegateI32] -// CHECK:STDOUT: %.loc17_70: i32 = int_value 32768 [template = constants.%.10] -// CHECK:STDOUT: %int.snegate.loc17: init i32 = call %NegateI32.ref.loc17(%.loc17_70) [template = constants.%.11] -// CHECK:STDOUT: %.loc17_69.1: i32 = value_of_initializer %int.snegate.loc17 [template = constants.%.11] -// CHECK:STDOUT: %.loc17_69.2: i32 = converted %int.snegate.loc17, %.loc17_69.1 [template = constants.%.11] -// CHECK:STDOUT: %int.convert_checked.loc17_59: init Core.IntLiteral = call %Int32ToIntLiteral.ref.loc17(%.loc17_69.2) [template = constants.%.19] -// CHECK:STDOUT: %.loc17_59.1: Core.IntLiteral = value_of_initializer %int.convert_checked.loc17_59 [template = constants.%.19] -// CHECK:STDOUT: %.loc17_59.2: Core.IntLiteral = converted %int.convert_checked.loc17_59, %.loc17_59.1 [template = constants.%.19] -// CHECK:STDOUT: %int.convert_checked.loc17_41: init %.7 = call %IntLiteralToInt16.ref.loc17(%.loc17_59.2) [template = constants.%.12] -// CHECK:STDOUT: %.loc17_79.1: %.7 = value_of_initializer %int.convert_checked.loc17_41 [template = constants.%.12] -// CHECK:STDOUT: %.loc17_79.2: %.7 = converted %int.convert_checked.loc17_41, %.loc17_79.1 [template = constants.%.12] -// CHECK:STDOUT: %lit_i16_min: %.7 = bind_name lit_i16_min, %.loc17_79.2 +// CHECK:STDOUT: %.loc17_70.1: Core.IntLiteral = int_value 32768 [template = constants.%.40] +// CHECK:STDOUT: %.loc17_70.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc17_70.3: = bound_method %.loc17_70.1, %.loc17_70.2 [template = constants.%.41] +// CHECK:STDOUT: %int.convert_checked.loc17_70: init i32 = call %.loc17_70.3(%.loc17_70.1) [template = constants.%.42] +// CHECK:STDOUT: %.loc17_70.4: i32 = value_of_initializer %int.convert_checked.loc17_70 [template = constants.%.42] +// CHECK:STDOUT: %.loc17_70.5: i32 = converted %.loc17_70.1, %.loc17_70.4 [template = constants.%.42] +// CHECK:STDOUT: %int.snegate.loc17: init i32 = call %NegateI32.ref.loc17(%.loc17_70.5) [template = constants.%.43] +// CHECK:STDOUT: %.loc17_69.1: i32 = value_of_initializer %int.snegate.loc17 [template = constants.%.43] +// CHECK:STDOUT: %.loc17_69.2: i32 = converted %int.snegate.loc17, %.loc17_69.1 [template = constants.%.43] +// CHECK:STDOUT: %int.convert_checked.loc17_59: init Core.IntLiteral = call %Int32ToIntLiteral.ref.loc17(%.loc17_69.2) [template = constants.%.51] +// CHECK:STDOUT: %.loc17_59.1: Core.IntLiteral = value_of_initializer %int.convert_checked.loc17_59 [template = constants.%.51] +// CHECK:STDOUT: %.loc17_59.2: Core.IntLiteral = converted %int.convert_checked.loc17_59, %.loc17_59.1 [template = constants.%.51] +// CHECK:STDOUT: %int.convert_checked.loc17_41: init %.35 = call %IntLiteralToInt16.ref.loc17(%.loc17_59.2) [template = constants.%.44] +// CHECK:STDOUT: %.loc17_79.1: %.35 = value_of_initializer %int.convert_checked.loc17_41 [template = constants.%.44] +// CHECK:STDOUT: %.loc17_79.2: %.35 = converted %int.convert_checked.loc17_41, %.loc17_79.1 [template = constants.%.44] +// CHECK:STDOUT: %lit_i16_min: %.35 = bind_name lit_i16_min, %.loc17_79.2 // CHECK:STDOUT: %IntLiteralToInt16.ref.loc18: %IntLiteralToInt16.type = name_ref IntLiteralToInt16, imports.%import_ref.14 [template = constants.%IntLiteralToInt16] // CHECK:STDOUT: %Int32ToIntLiteral.ref.loc18: %Int32ToIntLiteral.type = name_ref Int32ToIntLiteral, imports.%import_ref.20 [template = constants.%Int32ToIntLiteral] -// CHECK:STDOUT: %.loc18_60: i32 = int_value 32767 [template = constants.%.8] -// CHECK:STDOUT: %int.convert_checked.loc18_59: init Core.IntLiteral = call %Int32ToIntLiteral.ref.loc18(%.loc18_60) [template = constants.%.20] -// CHECK:STDOUT: %.loc18_59.1: Core.IntLiteral = value_of_initializer %int.convert_checked.loc18_59 [template = constants.%.20] -// CHECK:STDOUT: %.loc18_59.2: Core.IntLiteral = converted %int.convert_checked.loc18_59, %.loc18_59.1 [template = constants.%.20] -// CHECK:STDOUT: %int.convert_checked.loc18_41: init %.7 = call %IntLiteralToInt16.ref.loc18(%.loc18_59.2) [template = constants.%.9] -// CHECK:STDOUT: %.loc18_68.1: %.7 = value_of_initializer %int.convert_checked.loc18_41 [template = constants.%.9] -// CHECK:STDOUT: %.loc18_68.2: %.7 = converted %int.convert_checked.loc18_41, %.loc18_68.1 [template = constants.%.9] -// CHECK:STDOUT: %lit_i16_max: %.7 = bind_name lit_i16_max, %.loc18_68.2 +// CHECK:STDOUT: %.loc18_60.1: Core.IntLiteral = int_value 32767 [template = constants.%.36] +// CHECK:STDOUT: %.loc18_60.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc18_60.3: = bound_method %.loc18_60.1, %.loc18_60.2 [template = constants.%.37] +// CHECK:STDOUT: %int.convert_checked.loc18_60: init i32 = call %.loc18_60.3(%.loc18_60.1) [template = constants.%.38] +// CHECK:STDOUT: %.loc18_60.4: i32 = value_of_initializer %int.convert_checked.loc18_60 [template = constants.%.38] +// CHECK:STDOUT: %.loc18_60.5: i32 = converted %.loc18_60.1, %.loc18_60.4 [template = constants.%.38] +// CHECK:STDOUT: %int.convert_checked.loc18_59: init Core.IntLiteral = call %Int32ToIntLiteral.ref.loc18(%.loc18_60.5) [template = constants.%.36] +// CHECK:STDOUT: %.loc18_59.1: Core.IntLiteral = value_of_initializer %int.convert_checked.loc18_59 [template = constants.%.36] +// CHECK:STDOUT: %.loc18_59.2: Core.IntLiteral = converted %int.convert_checked.loc18_59, %.loc18_59.1 [template = constants.%.36] +// CHECK:STDOUT: %int.convert_checked.loc18_41: init %.35 = call %IntLiteralToInt16.ref.loc18(%.loc18_59.2) [template = constants.%.39] +// CHECK:STDOUT: %.loc18_68.1: %.35 = value_of_initializer %int.convert_checked.loc18_41 [template = constants.%.39] +// CHECK:STDOUT: %.loc18_68.2: %.35 = converted %int.convert_checked.loc18_41, %.loc18_68.1 [template = constants.%.39] +// CHECK:STDOUT: %lit_i16_max: %.35 = bind_name lit_i16_max, %.loc18_68.2 // CHECK:STDOUT: %IntLiteralToUint16.ref.loc20: %IntLiteralToUint16.type = name_ref IntLiteralToUint16, imports.%import_ref.15 [template = constants.%IntLiteralToUint16] // CHECK:STDOUT: %Int32ToIntLiteral.ref.loc20: %Int32ToIntLiteral.type = name_ref Int32ToIntLiteral, imports.%import_ref.20 [template = constants.%Int32ToIntLiteral] -// CHECK:STDOUT: %.loc20_61: i32 = int_value 0 [template = constants.%.3] -// CHECK:STDOUT: %int.convert_checked.loc20_60: init Core.IntLiteral = call %Int32ToIntLiteral.ref.loc20(%.loc20_61) [template = constants.%.21] -// CHECK:STDOUT: %.loc20_60.1: Core.IntLiteral = value_of_initializer %int.convert_checked.loc20_60 [template = constants.%.21] -// CHECK:STDOUT: %.loc20_60.2: Core.IntLiteral = converted %int.convert_checked.loc20_60, %.loc20_60.1 [template = constants.%.21] -// CHECK:STDOUT: %int.convert_checked.loc20_42: init %.2 = call %IntLiteralToUint16.ref.loc20(%.loc20_60.2) [template = constants.%.4] -// CHECK:STDOUT: %.loc20_64.1: %.2 = value_of_initializer %int.convert_checked.loc20_42 [template = constants.%.4] -// CHECK:STDOUT: %.loc20_64.2: %.2 = converted %int.convert_checked.loc20_42, %.loc20_64.1 [template = constants.%.4] +// CHECK:STDOUT: %.loc20_61.1: Core.IntLiteral = int_value 0 [template = constants.%.3] +// CHECK:STDOUT: %.loc20_61.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc20_61.3: = bound_method %.loc20_61.1, %.loc20_61.2 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked.loc20_61: init i32 = call %.loc20_61.3(%.loc20_61.1) [template = constants.%.29] +// CHECK:STDOUT: %.loc20_61.4: i32 = value_of_initializer %int.convert_checked.loc20_61 [template = constants.%.29] +// CHECK:STDOUT: %.loc20_61.5: i32 = converted %.loc20_61.1, %.loc20_61.4 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc20_60: init Core.IntLiteral = call %Int32ToIntLiteral.ref.loc20(%.loc20_61.5) [template = constants.%.3] +// CHECK:STDOUT: %.loc20_60.1: Core.IntLiteral = value_of_initializer %int.convert_checked.loc20_60 [template = constants.%.3] +// CHECK:STDOUT: %.loc20_60.2: Core.IntLiteral = converted %int.convert_checked.loc20_60, %.loc20_60.1 [template = constants.%.3] +// CHECK:STDOUT: %int.convert_checked.loc20_42: init %.2 = call %IntLiteralToUint16.ref.loc20(%.loc20_60.2) [template = constants.%.30] +// CHECK:STDOUT: %.loc20_64.1: %.2 = value_of_initializer %int.convert_checked.loc20_42 [template = constants.%.30] +// CHECK:STDOUT: %.loc20_64.2: %.2 = converted %int.convert_checked.loc20_42, %.loc20_64.1 [template = constants.%.30] // CHECK:STDOUT: %lit_u16_min: %.2 = bind_name lit_u16_min, %.loc20_64.2 // CHECK:STDOUT: %IntLiteralToUint16.ref.loc21: %IntLiteralToUint16.type = name_ref IntLiteralToUint16, imports.%import_ref.15 [template = constants.%IntLiteralToUint16] // CHECK:STDOUT: %Int32ToIntLiteral.ref.loc21: %Int32ToIntLiteral.type = name_ref Int32ToIntLiteral, imports.%import_ref.20 [template = constants.%Int32ToIntLiteral] -// CHECK:STDOUT: %.loc21_61: i32 = int_value 65535 [template = constants.%.5] -// CHECK:STDOUT: %int.convert_checked.loc21_60: init Core.IntLiteral = call %Int32ToIntLiteral.ref.loc21(%.loc21_61) [template = constants.%.22] -// CHECK:STDOUT: %.loc21_60.1: Core.IntLiteral = value_of_initializer %int.convert_checked.loc21_60 [template = constants.%.22] -// CHECK:STDOUT: %.loc21_60.2: Core.IntLiteral = converted %int.convert_checked.loc21_60, %.loc21_60.1 [template = constants.%.22] -// CHECK:STDOUT: %int.convert_checked.loc21_42: init %.2 = call %IntLiteralToUint16.ref.loc21(%.loc21_60.2) [template = constants.%.6] -// CHECK:STDOUT: %.loc21_69.1: %.2 = value_of_initializer %int.convert_checked.loc21_42 [template = constants.%.6] -// CHECK:STDOUT: %.loc21_69.2: %.2 = converted %int.convert_checked.loc21_42, %.loc21_69.1 [template = constants.%.6] +// CHECK:STDOUT: %.loc21_61.1: Core.IntLiteral = int_value 65535 [template = constants.%.31] +// CHECK:STDOUT: %.loc21_61.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc21_61.3: = bound_method %.loc21_61.1, %.loc21_61.2 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc21_61: init i32 = call %.loc21_61.3(%.loc21_61.1) [template = constants.%.33] +// CHECK:STDOUT: %.loc21_61.4: i32 = value_of_initializer %int.convert_checked.loc21_61 [template = constants.%.33] +// CHECK:STDOUT: %.loc21_61.5: i32 = converted %.loc21_61.1, %.loc21_61.4 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc21_60: init Core.IntLiteral = call %Int32ToIntLiteral.ref.loc21(%.loc21_61.5) [template = constants.%.31] +// CHECK:STDOUT: %.loc21_60.1: Core.IntLiteral = value_of_initializer %int.convert_checked.loc21_60 [template = constants.%.31] +// CHECK:STDOUT: %.loc21_60.2: Core.IntLiteral = converted %int.convert_checked.loc21_60, %.loc21_60.1 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc21_42: init %.2 = call %IntLiteralToUint16.ref.loc21(%.loc21_60.2) [template = constants.%.34] +// CHECK:STDOUT: %.loc21_69.1: %.2 = value_of_initializer %int.convert_checked.loc21_42 [template = constants.%.34] +// CHECK:STDOUT: %.loc21_69.2: %.2 = converted %int.convert_checked.loc21_42, %.loc21_69.1 [template = constants.%.34] // CHECK:STDOUT: %lit_u16_max: %.2 = bind_name lit_u16_max, %.loc21_69.2 // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -1363,25 +1486,35 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %.4: type = int_type unsigned, %.3 [template] // CHECK:STDOUT: %Int32ToUint32.type: type = fn_type @Int32ToUint32 [template] // CHECK:STDOUT: %Int32ToUint32: %Int32ToUint32.type = struct_value () [template] -// CHECK:STDOUT: %.5: i32 = int_value 0 [template] -// CHECK:STDOUT: %.6: %.4 = int_value 0 [template] -// CHECK:STDOUT: %.7: %.2 = int_value 0 [template] +// CHECK:STDOUT: %.5: Core.IntLiteral = int_value 0 [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: %.29: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.30: = bound_method %.5, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 0 [template] +// CHECK:STDOUT: %.32: %.4 = int_value 0 [template] +// CHECK:STDOUT: %.33: %.2 = int_value 0 [template] // CHECK:STDOUT: %AddU32.type: type = fn_type @AddU32 [template] // CHECK:STDOUT: %AddU32: %AddU32.type = struct_value () [template] -// CHECK:STDOUT: %.8: i32 = int_value 2147483647 [template] -// CHECK:STDOUT: %.9: %.4 = int_value 2147483647 [template] -// CHECK:STDOUT: %.10: %.4 = int_value 4294967294 [template] -// CHECK:STDOUT: %.11: i32 = int_value 1 [template] -// CHECK:STDOUT: %.12: %.4 = int_value 1 [template] -// CHECK:STDOUT: %.13: %.4 = int_value 4294967295 [template] -// CHECK:STDOUT: %.14: %.2 = int_value 4294967295 [template] +// CHECK:STDOUT: %.34: Core.IntLiteral = int_value 2147483647 [template] +// CHECK:STDOUT: %.35: = bound_method %.34, %Convert.15 [template] +// CHECK:STDOUT: %.36: i32 = int_value 2147483647 [template] +// CHECK:STDOUT: %.37: %.4 = int_value 2147483647 [template] +// CHECK:STDOUT: %.38: %.4 = int_value 4294967294 [template] +// CHECK:STDOUT: %.39: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.40: = bound_method %.39, %Convert.15 [template] +// CHECK:STDOUT: %.41: i32 = int_value 1 [template] +// CHECK:STDOUT: %.42: %.4 = int_value 1 [template] +// CHECK:STDOUT: %.43: %.4 = int_value 4294967295 [template] +// CHECK:STDOUT: %.44: %.2 = int_value 4294967295 [template] // CHECK:STDOUT: %Int.type: type = fn_type @Int [template] // CHECK:STDOUT: %Int: %Int.type = struct_value () [template] -// CHECK:STDOUT: %.15: type = int_type signed, %.1 [template] +// CHECK:STDOUT: %.45: type = int_type signed, %.1 [template] // CHECK:STDOUT: %Uint32ToInt64.type: type = fn_type @Uint32ToInt64 [template] // CHECK:STDOUT: %Uint32ToInt64: %Uint32ToInt64.type = struct_value () [template] -// CHECK:STDOUT: %.16: %.15 = int_value 0 [template] -// CHECK:STDOUT: %.17: %.15 = int_value 4294967295 [template] +// CHECK:STDOUT: %.46: %.45 = int_value 0 [template] +// CHECK:STDOUT: %.47: %.45 = int_value 4294967295 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -1408,7 +1541,8 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, inst+427, unloaded // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .UInt = %import_ref.22 -// CHECK:STDOUT: .Int = %import_ref.23 +// CHECK:STDOUT: .ImplicitAs = %import_ref.23 +// CHECK:STDOUT: .Int = %import_ref.72 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -1454,13 +1588,13 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %.loc6_8.2: type = value_of_initializer %int.make_type_unsigned.loc6 [template = constants.%.2] // CHECK:STDOUT: %.loc6_8.3: type = converted %int.make_type_unsigned.loc6, %.loc6_8.2 [template = constants.%.2] // CHECK:STDOUT: %.loc11_8.1: Core.IntLiteral = int_value 64 [template = constants.%.1] -// CHECK:STDOUT: %int.make_type_signed.loc11: init type = call constants.%Int(%.loc11_8.1) [template = constants.%.15] -// CHECK:STDOUT: %.loc11_8.2: type = value_of_initializer %int.make_type_signed.loc11 [template = constants.%.15] -// CHECK:STDOUT: %.loc11_8.3: type = converted %int.make_type_signed.loc11, %.loc11_8.2 [template = constants.%.15] +// CHECK:STDOUT: %int.make_type_signed.loc11: init type = call constants.%Int(%.loc11_8.1) [template = constants.%.45] +// CHECK:STDOUT: %.loc11_8.2: type = value_of_initializer %int.make_type_signed.loc11 [template = constants.%.45] +// CHECK:STDOUT: %.loc11_8.3: type = converted %int.make_type_signed.loc11, %.loc11_8.2 [template = constants.%.45] // CHECK:STDOUT: %.loc12_8.1: Core.IntLiteral = int_value 64 [template = constants.%.1] -// CHECK:STDOUT: %int.make_type_signed.loc12: init type = call constants.%Int(%.loc12_8.1) [template = constants.%.15] -// CHECK:STDOUT: %.loc12_8.2: type = value_of_initializer %int.make_type_signed.loc12 [template = constants.%.15] -// CHECK:STDOUT: %.loc12_8.3: type = converted %int.make_type_signed.loc12, %.loc12_8.2 [template = constants.%.15] +// CHECK:STDOUT: %int.make_type_signed.loc12: init type = call constants.%Int(%.loc12_8.1) [template = constants.%.45] +// CHECK:STDOUT: %.loc12_8.2: type = value_of_initializer %int.make_type_signed.loc12 [template = constants.%.45] +// CHECK:STDOUT: %.loc12_8.3: type = converted %int.make_type_signed.loc12, %.loc12_8.2 [template = constants.%.45] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Uint32ToUint64(%a.param_patt: %.4) -> %.2 = "int.convert_checked"; @@ -1469,86 +1603,126 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: // CHECK:STDOUT: fn @AddU32(%a.param_patt: %.4, %b.param_patt: %.4) -> %.4 = "int.uadd"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Uint32ToInt64(%a.param_patt: %.4) -> %.15 = "int.convert_checked"; +// CHECK:STDOUT: fn @Uint32ToInt64(%a.param_patt: %.4) -> %.45 = "int.convert_checked"; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Uint32ToUint64.ref.loc5: %Uint32ToUint64.type = name_ref Uint32ToUint64, imports.%import_ref.19 [template = constants.%Uint32ToUint64] // CHECK:STDOUT: %Int32ToUint32.ref.loc5: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %.loc5_43: i32 = int_value 0 [template = constants.%.5] -// CHECK:STDOUT: %int.convert_checked.loc5_42: init %.4 = call %Int32ToUint32.ref.loc5(%.loc5_43) [template = constants.%.6] -// CHECK:STDOUT: %.loc5_42.1: %.4 = value_of_initializer %int.convert_checked.loc5_42 [template = constants.%.6] -// CHECK:STDOUT: %.loc5_42.2: %.4 = converted %int.convert_checked.loc5_42, %.loc5_42.1 [template = constants.%.6] -// CHECK:STDOUT: %int.convert_checked.loc5_28: init %.2 = call %Uint32ToUint64.ref.loc5(%.loc5_42.2) [template = constants.%.7] -// CHECK:STDOUT: %.loc5_46.1: %.2 = value_of_initializer %int.convert_checked.loc5_28 [template = constants.%.7] -// CHECK:STDOUT: %.loc5_46.2: %.2 = converted %int.convert_checked.loc5_28, %.loc5_46.1 [template = constants.%.7] +// CHECK:STDOUT: %.loc5_43.1: Core.IntLiteral = int_value 0 [template = constants.%.5] +// CHECK:STDOUT: %.loc5_43.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc5_43.3: = bound_method %.loc5_43.1, %.loc5_43.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc5_43: init i32 = call %.loc5_43.3(%.loc5_43.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc5_43.4: i32 = value_of_initializer %int.convert_checked.loc5_43 [template = constants.%.31] +// CHECK:STDOUT: %.loc5_43.5: i32 = converted %.loc5_43.1, %.loc5_43.4 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc5_42: init %.4 = call %Int32ToUint32.ref.loc5(%.loc5_43.5) [template = constants.%.32] +// CHECK:STDOUT: %.loc5_42.1: %.4 = value_of_initializer %int.convert_checked.loc5_42 [template = constants.%.32] +// CHECK:STDOUT: %.loc5_42.2: %.4 = converted %int.convert_checked.loc5_42, %.loc5_42.1 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc5_28: init %.2 = call %Uint32ToUint64.ref.loc5(%.loc5_42.2) [template = constants.%.33] +// CHECK:STDOUT: %.loc5_46.1: %.2 = value_of_initializer %int.convert_checked.loc5_28 [template = constants.%.33] +// CHECK:STDOUT: %.loc5_46.2: %.2 = converted %int.convert_checked.loc5_28, %.loc5_46.1 [template = constants.%.33] // CHECK:STDOUT: %a: %.2 = bind_name a, %.loc5_46.2 // CHECK:STDOUT: %Uint32ToUint64.ref.loc6: %Uint32ToUint64.type = name_ref Uint32ToUint64, imports.%import_ref.19 [template = constants.%Uint32ToUint64] // CHECK:STDOUT: %AddU32.ref.loc7: %AddU32.type = name_ref AddU32, imports.%import_ref.3 [template = constants.%AddU32] // CHECK:STDOUT: %AddU32.ref.loc8: %AddU32.type = name_ref AddU32, imports.%import_ref.3 [template = constants.%AddU32] // CHECK:STDOUT: %Int32ToUint32.ref.loc8_12: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %.loc8_26: i32 = int_value 2147483647 [template = constants.%.8] -// CHECK:STDOUT: %int.convert_checked.loc8_25: init %.4 = call %Int32ToUint32.ref.loc8_12(%.loc8_26) [template = constants.%.9] +// CHECK:STDOUT: %.loc8_26.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.34] +// CHECK:STDOUT: %.loc8_26.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc8_26.3: = bound_method %.loc8_26.1, %.loc8_26.2 [template = constants.%.35] +// CHECK:STDOUT: %int.convert_checked.loc8_26: init i32 = call %.loc8_26.3(%.loc8_26.1) [template = constants.%.36] +// CHECK:STDOUT: %.loc8_26.4: i32 = value_of_initializer %int.convert_checked.loc8_26 [template = constants.%.36] +// CHECK:STDOUT: %.loc8_26.5: i32 = converted %.loc8_26.1, %.loc8_26.4 [template = constants.%.36] +// CHECK:STDOUT: %int.convert_checked.loc8_25: init %.4 = call %Int32ToUint32.ref.loc8_12(%.loc8_26.5) [template = constants.%.37] // CHECK:STDOUT: %Int32ToUint32.ref.loc8_40: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %.loc8_54: i32 = int_value 2147483647 [template = constants.%.8] -// CHECK:STDOUT: %int.convert_checked.loc8_53: init %.4 = call %Int32ToUint32.ref.loc8_40(%.loc8_54) [template = constants.%.9] -// CHECK:STDOUT: %.loc8_25.1: %.4 = value_of_initializer %int.convert_checked.loc8_25 [template = constants.%.9] -// CHECK:STDOUT: %.loc8_25.2: %.4 = converted %int.convert_checked.loc8_25, %.loc8_25.1 [template = constants.%.9] -// CHECK:STDOUT: %.loc8_53.1: %.4 = value_of_initializer %int.convert_checked.loc8_53 [template = constants.%.9] -// CHECK:STDOUT: %.loc8_53.2: %.4 = converted %int.convert_checked.loc8_53, %.loc8_53.1 [template = constants.%.9] -// CHECK:STDOUT: %int.uadd.loc8: init %.4 = call %AddU32.ref.loc8(%.loc8_25.2, %.loc8_53.2) [template = constants.%.10] +// CHECK:STDOUT: %.loc8_54.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.34] +// CHECK:STDOUT: %.loc8_54.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc8_54.3: = bound_method %.loc8_54.1, %.loc8_54.2 [template = constants.%.35] +// CHECK:STDOUT: %int.convert_checked.loc8_54: init i32 = call %.loc8_54.3(%.loc8_54.1) [template = constants.%.36] +// CHECK:STDOUT: %.loc8_54.4: i32 = value_of_initializer %int.convert_checked.loc8_54 [template = constants.%.36] +// CHECK:STDOUT: %.loc8_54.5: i32 = converted %.loc8_54.1, %.loc8_54.4 [template = constants.%.36] +// CHECK:STDOUT: %int.convert_checked.loc8_53: init %.4 = call %Int32ToUint32.ref.loc8_40(%.loc8_54.5) [template = constants.%.37] +// CHECK:STDOUT: %.loc8_25.1: %.4 = value_of_initializer %int.convert_checked.loc8_25 [template = constants.%.37] +// CHECK:STDOUT: %.loc8_25.2: %.4 = converted %int.convert_checked.loc8_25, %.loc8_25.1 [template = constants.%.37] +// CHECK:STDOUT: %.loc8_53.1: %.4 = value_of_initializer %int.convert_checked.loc8_53 [template = constants.%.37] +// CHECK:STDOUT: %.loc8_53.2: %.4 = converted %int.convert_checked.loc8_53, %.loc8_53.1 [template = constants.%.37] +// CHECK:STDOUT: %int.uadd.loc8: init %.4 = call %AddU32.ref.loc8(%.loc8_25.2, %.loc8_53.2) [template = constants.%.38] // CHECK:STDOUT: %Int32ToUint32.ref.loc9: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %.loc9_19: i32 = int_value 1 [template = constants.%.11] -// CHECK:STDOUT: %int.convert_checked.loc9: init %.4 = call %Int32ToUint32.ref.loc9(%.loc9_19) [template = constants.%.12] -// CHECK:STDOUT: %.loc8_11.1: %.4 = value_of_initializer %int.uadd.loc8 [template = constants.%.10] -// CHECK:STDOUT: %.loc8_11.2: %.4 = converted %int.uadd.loc8, %.loc8_11.1 [template = constants.%.10] -// CHECK:STDOUT: %.loc9_18.1: %.4 = value_of_initializer %int.convert_checked.loc9 [template = constants.%.12] -// CHECK:STDOUT: %.loc9_18.2: %.4 = converted %int.convert_checked.loc9, %.loc9_18.1 [template = constants.%.12] -// CHECK:STDOUT: %int.uadd.loc7: init %.4 = call %AddU32.ref.loc7(%.loc8_11.2, %.loc9_18.2) [template = constants.%.13] -// CHECK:STDOUT: %.loc7_9.1: %.4 = value_of_initializer %int.uadd.loc7 [template = constants.%.13] -// CHECK:STDOUT: %.loc7_9.2: %.4 = converted %int.uadd.loc7, %.loc7_9.1 [template = constants.%.13] -// CHECK:STDOUT: %int.convert_checked.loc6: init %.2 = call %Uint32ToUint64.ref.loc6(%.loc7_9.2) [template = constants.%.14] -// CHECK:STDOUT: %.loc9_23.1: %.2 = value_of_initializer %int.convert_checked.loc6 [template = constants.%.14] -// CHECK:STDOUT: %.loc9_23.2: %.2 = converted %int.convert_checked.loc6, %.loc9_23.1 [template = constants.%.14] +// CHECK:STDOUT: %.loc9_19.1: Core.IntLiteral = int_value 1 [template = constants.%.39] +// CHECK:STDOUT: %.loc9_19.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_19.3: = bound_method %.loc9_19.1, %.loc9_19.2 [template = constants.%.40] +// CHECK:STDOUT: %int.convert_checked.loc9_19: init i32 = call %.loc9_19.3(%.loc9_19.1) [template = constants.%.41] +// CHECK:STDOUT: %.loc9_19.4: i32 = value_of_initializer %int.convert_checked.loc9_19 [template = constants.%.41] +// CHECK:STDOUT: %.loc9_19.5: i32 = converted %.loc9_19.1, %.loc9_19.4 [template = constants.%.41] +// CHECK:STDOUT: %int.convert_checked.loc9_18: init %.4 = call %Int32ToUint32.ref.loc9(%.loc9_19.5) [template = constants.%.42] +// CHECK:STDOUT: %.loc8_11.1: %.4 = value_of_initializer %int.uadd.loc8 [template = constants.%.38] +// CHECK:STDOUT: %.loc8_11.2: %.4 = converted %int.uadd.loc8, %.loc8_11.1 [template = constants.%.38] +// CHECK:STDOUT: %.loc9_18.1: %.4 = value_of_initializer %int.convert_checked.loc9_18 [template = constants.%.42] +// CHECK:STDOUT: %.loc9_18.2: %.4 = converted %int.convert_checked.loc9_18, %.loc9_18.1 [template = constants.%.42] +// CHECK:STDOUT: %int.uadd.loc7: init %.4 = call %AddU32.ref.loc7(%.loc8_11.2, %.loc9_18.2) [template = constants.%.43] +// CHECK:STDOUT: %.loc7_9.1: %.4 = value_of_initializer %int.uadd.loc7 [template = constants.%.43] +// CHECK:STDOUT: %.loc7_9.2: %.4 = converted %int.uadd.loc7, %.loc7_9.1 [template = constants.%.43] +// CHECK:STDOUT: %int.convert_checked.loc6: init %.2 = call %Uint32ToUint64.ref.loc6(%.loc7_9.2) [template = constants.%.44] +// CHECK:STDOUT: %.loc9_23.1: %.2 = value_of_initializer %int.convert_checked.loc6 [template = constants.%.44] +// CHECK:STDOUT: %.loc9_23.2: %.2 = converted %int.convert_checked.loc6, %.loc9_23.1 [template = constants.%.44] // CHECK:STDOUT: %b: %.2 = bind_name b, %.loc9_23.2 // CHECK:STDOUT: %Uint32ToInt64.ref.loc11: %Uint32ToInt64.type = name_ref Uint32ToInt64, imports.%import_ref.18 [template = constants.%Uint32ToInt64] // CHECK:STDOUT: %Int32ToUint32.ref.loc11: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %.loc11_42: i32 = int_value 0 [template = constants.%.5] -// CHECK:STDOUT: %int.convert_checked.loc11_41: init %.4 = call %Int32ToUint32.ref.loc11(%.loc11_42) [template = constants.%.6] -// CHECK:STDOUT: %.loc11_41.1: %.4 = value_of_initializer %int.convert_checked.loc11_41 [template = constants.%.6] -// CHECK:STDOUT: %.loc11_41.2: %.4 = converted %int.convert_checked.loc11_41, %.loc11_41.1 [template = constants.%.6] -// CHECK:STDOUT: %int.convert_checked.loc11_27: init %.15 = call %Uint32ToInt64.ref.loc11(%.loc11_41.2) [template = constants.%.16] -// CHECK:STDOUT: %.loc11_45.1: %.15 = value_of_initializer %int.convert_checked.loc11_27 [template = constants.%.16] -// CHECK:STDOUT: %.loc11_45.2: %.15 = converted %int.convert_checked.loc11_27, %.loc11_45.1 [template = constants.%.16] -// CHECK:STDOUT: %c: %.15 = bind_name c, %.loc11_45.2 +// CHECK:STDOUT: %.loc11_42.1: Core.IntLiteral = int_value 0 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_42.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_42.3: = bound_method %.loc11_42.1, %.loc11_42.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc11_42: init i32 = call %.loc11_42.3(%.loc11_42.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc11_42.4: i32 = value_of_initializer %int.convert_checked.loc11_42 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_42.5: i32 = converted %.loc11_42.1, %.loc11_42.4 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc11_41: init %.4 = call %Int32ToUint32.ref.loc11(%.loc11_42.5) [template = constants.%.32] +// CHECK:STDOUT: %.loc11_41.1: %.4 = value_of_initializer %int.convert_checked.loc11_41 [template = constants.%.32] +// CHECK:STDOUT: %.loc11_41.2: %.4 = converted %int.convert_checked.loc11_41, %.loc11_41.1 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc11_27: init %.45 = call %Uint32ToInt64.ref.loc11(%.loc11_41.2) [template = constants.%.46] +// CHECK:STDOUT: %.loc11_45.1: %.45 = value_of_initializer %int.convert_checked.loc11_27 [template = constants.%.46] +// CHECK:STDOUT: %.loc11_45.2: %.45 = converted %int.convert_checked.loc11_27, %.loc11_45.1 [template = constants.%.46] +// CHECK:STDOUT: %c: %.45 = bind_name c, %.loc11_45.2 // CHECK:STDOUT: %Uint32ToInt64.ref.loc12: %Uint32ToInt64.type = name_ref Uint32ToInt64, imports.%import_ref.18 [template = constants.%Uint32ToInt64] // CHECK:STDOUT: %AddU32.ref.loc13: %AddU32.type = name_ref AddU32, imports.%import_ref.3 [template = constants.%AddU32] // CHECK:STDOUT: %AddU32.ref.loc14: %AddU32.type = name_ref AddU32, imports.%import_ref.3 [template = constants.%AddU32] // CHECK:STDOUT: %Int32ToUint32.ref.loc14_12: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %.loc14_26: i32 = int_value 2147483647 [template = constants.%.8] -// CHECK:STDOUT: %int.convert_checked.loc14_25: init %.4 = call %Int32ToUint32.ref.loc14_12(%.loc14_26) [template = constants.%.9] +// CHECK:STDOUT: %.loc14_26.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.34] +// CHECK:STDOUT: %.loc14_26.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc14_26.3: = bound_method %.loc14_26.1, %.loc14_26.2 [template = constants.%.35] +// CHECK:STDOUT: %int.convert_checked.loc14_26: init i32 = call %.loc14_26.3(%.loc14_26.1) [template = constants.%.36] +// CHECK:STDOUT: %.loc14_26.4: i32 = value_of_initializer %int.convert_checked.loc14_26 [template = constants.%.36] +// CHECK:STDOUT: %.loc14_26.5: i32 = converted %.loc14_26.1, %.loc14_26.4 [template = constants.%.36] +// CHECK:STDOUT: %int.convert_checked.loc14_25: init %.4 = call %Int32ToUint32.ref.loc14_12(%.loc14_26.5) [template = constants.%.37] // CHECK:STDOUT: %Int32ToUint32.ref.loc14_40: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %.loc14_54: i32 = int_value 2147483647 [template = constants.%.8] -// CHECK:STDOUT: %int.convert_checked.loc14_53: init %.4 = call %Int32ToUint32.ref.loc14_40(%.loc14_54) [template = constants.%.9] -// CHECK:STDOUT: %.loc14_25.1: %.4 = value_of_initializer %int.convert_checked.loc14_25 [template = constants.%.9] -// CHECK:STDOUT: %.loc14_25.2: %.4 = converted %int.convert_checked.loc14_25, %.loc14_25.1 [template = constants.%.9] -// CHECK:STDOUT: %.loc14_53.1: %.4 = value_of_initializer %int.convert_checked.loc14_53 [template = constants.%.9] -// CHECK:STDOUT: %.loc14_53.2: %.4 = converted %int.convert_checked.loc14_53, %.loc14_53.1 [template = constants.%.9] -// CHECK:STDOUT: %int.uadd.loc14: init %.4 = call %AddU32.ref.loc14(%.loc14_25.2, %.loc14_53.2) [template = constants.%.10] +// CHECK:STDOUT: %.loc14_54.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.34] +// CHECK:STDOUT: %.loc14_54.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc14_54.3: = bound_method %.loc14_54.1, %.loc14_54.2 [template = constants.%.35] +// CHECK:STDOUT: %int.convert_checked.loc14_54: init i32 = call %.loc14_54.3(%.loc14_54.1) [template = constants.%.36] +// CHECK:STDOUT: %.loc14_54.4: i32 = value_of_initializer %int.convert_checked.loc14_54 [template = constants.%.36] +// CHECK:STDOUT: %.loc14_54.5: i32 = converted %.loc14_54.1, %.loc14_54.4 [template = constants.%.36] +// CHECK:STDOUT: %int.convert_checked.loc14_53: init %.4 = call %Int32ToUint32.ref.loc14_40(%.loc14_54.5) [template = constants.%.37] +// CHECK:STDOUT: %.loc14_25.1: %.4 = value_of_initializer %int.convert_checked.loc14_25 [template = constants.%.37] +// CHECK:STDOUT: %.loc14_25.2: %.4 = converted %int.convert_checked.loc14_25, %.loc14_25.1 [template = constants.%.37] +// CHECK:STDOUT: %.loc14_53.1: %.4 = value_of_initializer %int.convert_checked.loc14_53 [template = constants.%.37] +// CHECK:STDOUT: %.loc14_53.2: %.4 = converted %int.convert_checked.loc14_53, %.loc14_53.1 [template = constants.%.37] +// CHECK:STDOUT: %int.uadd.loc14: init %.4 = call %AddU32.ref.loc14(%.loc14_25.2, %.loc14_53.2) [template = constants.%.38] // CHECK:STDOUT: %Int32ToUint32.ref.loc15: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %.loc15_19: i32 = int_value 1 [template = constants.%.11] -// CHECK:STDOUT: %int.convert_checked.loc15: init %.4 = call %Int32ToUint32.ref.loc15(%.loc15_19) [template = constants.%.12] -// CHECK:STDOUT: %.loc14_11.1: %.4 = value_of_initializer %int.uadd.loc14 [template = constants.%.10] -// CHECK:STDOUT: %.loc14_11.2: %.4 = converted %int.uadd.loc14, %.loc14_11.1 [template = constants.%.10] -// CHECK:STDOUT: %.loc15_18.1: %.4 = value_of_initializer %int.convert_checked.loc15 [template = constants.%.12] -// CHECK:STDOUT: %.loc15_18.2: %.4 = converted %int.convert_checked.loc15, %.loc15_18.1 [template = constants.%.12] -// CHECK:STDOUT: %int.uadd.loc13: init %.4 = call %AddU32.ref.loc13(%.loc14_11.2, %.loc15_18.2) [template = constants.%.13] -// CHECK:STDOUT: %.loc13_9.1: %.4 = value_of_initializer %int.uadd.loc13 [template = constants.%.13] -// CHECK:STDOUT: %.loc13_9.2: %.4 = converted %int.uadd.loc13, %.loc13_9.1 [template = constants.%.13] -// CHECK:STDOUT: %int.convert_checked.loc12: init %.15 = call %Uint32ToInt64.ref.loc12(%.loc13_9.2) [template = constants.%.17] -// CHECK:STDOUT: %.loc15_23.1: %.15 = value_of_initializer %int.convert_checked.loc12 [template = constants.%.17] -// CHECK:STDOUT: %.loc15_23.2: %.15 = converted %int.convert_checked.loc12, %.loc15_23.1 [template = constants.%.17] -// CHECK:STDOUT: %d: %.15 = bind_name d, %.loc15_23.2 +// CHECK:STDOUT: %.loc15_19.1: Core.IntLiteral = int_value 1 [template = constants.%.39] +// CHECK:STDOUT: %.loc15_19.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc15_19.3: = bound_method %.loc15_19.1, %.loc15_19.2 [template = constants.%.40] +// CHECK:STDOUT: %int.convert_checked.loc15_19: init i32 = call %.loc15_19.3(%.loc15_19.1) [template = constants.%.41] +// CHECK:STDOUT: %.loc15_19.4: i32 = value_of_initializer %int.convert_checked.loc15_19 [template = constants.%.41] +// CHECK:STDOUT: %.loc15_19.5: i32 = converted %.loc15_19.1, %.loc15_19.4 [template = constants.%.41] +// CHECK:STDOUT: %int.convert_checked.loc15_18: init %.4 = call %Int32ToUint32.ref.loc15(%.loc15_19.5) [template = constants.%.42] +// CHECK:STDOUT: %.loc14_11.1: %.4 = value_of_initializer %int.uadd.loc14 [template = constants.%.38] +// CHECK:STDOUT: %.loc14_11.2: %.4 = converted %int.uadd.loc14, %.loc14_11.1 [template = constants.%.38] +// CHECK:STDOUT: %.loc15_18.1: %.4 = value_of_initializer %int.convert_checked.loc15_18 [template = constants.%.42] +// CHECK:STDOUT: %.loc15_18.2: %.4 = converted %int.convert_checked.loc15_18, %.loc15_18.1 [template = constants.%.42] +// CHECK:STDOUT: %int.uadd.loc13: init %.4 = call %AddU32.ref.loc13(%.loc14_11.2, %.loc15_18.2) [template = constants.%.43] +// CHECK:STDOUT: %.loc13_9.1: %.4 = value_of_initializer %int.uadd.loc13 [template = constants.%.43] +// CHECK:STDOUT: %.loc13_9.2: %.4 = converted %int.uadd.loc13, %.loc13_9.1 [template = constants.%.43] +// CHECK:STDOUT: %int.convert_checked.loc12: init %.45 = call %Uint32ToInt64.ref.loc12(%.loc13_9.2) [template = constants.%.47] +// CHECK:STDOUT: %.loc15_23.1: %.45 = value_of_initializer %int.convert_checked.loc12 [template = constants.%.47] +// CHECK:STDOUT: %.loc15_23.2: %.45 = converted %int.convert_checked.loc12, %.loc15_23.1 [template = constants.%.47] +// CHECK:STDOUT: %d: %.45 = bind_name d, %.loc15_23.2 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1561,24 +1735,34 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %.2: type = int_type unsigned, %.1 [template] // CHECK:STDOUT: %Int32ToUint64.type: type = fn_type @Int32ToUint64 [template] // CHECK:STDOUT: %Int32ToUint64: %Int32ToUint64.type = struct_value () [template] -// CHECK:STDOUT: %.3: i32 = int_value 0 [template] -// CHECK:STDOUT: %.4: %.2 = int_value 0 [template] -// CHECK:STDOUT: %.5: i32 = int_value 2147483647 [template] -// CHECK:STDOUT: %.6: %.2 = int_value 2147483647 [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 0 [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: %.27: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.28: = bound_method %.3, %Convert.15 [template] +// CHECK:STDOUT: %.29: i32 = int_value 0 [template] +// CHECK:STDOUT: %.30: %.2 = int_value 0 [template] +// CHECK:STDOUT: %.31: Core.IntLiteral = int_value 2147483647 [template] +// CHECK:STDOUT: %.32: = bound_method %.31, %Convert.15 [template] +// CHECK:STDOUT: %.33: i32 = int_value 2147483647 [template] +// CHECK:STDOUT: %.34: %.2 = int_value 2147483647 [template] // CHECK:STDOUT: %Int.type: type = fn_type @Int [template] // CHECK:STDOUT: %Int: %Int.type = struct_value () [template] -// CHECK:STDOUT: %.7: type = int_type signed, %.1 [template] +// CHECK:STDOUT: %.35: type = int_type signed, %.1 [template] // CHECK:STDOUT: %Int32ToInt64.type: type = fn_type @Int32ToInt64 [template] // CHECK:STDOUT: %Int32ToInt64: %Int32ToInt64.type = struct_value () [template] // CHECK:STDOUT: %SubI32.type: type = fn_type @SubI32 [template] // CHECK:STDOUT: %SubI32: %SubI32.type = struct_value () [template] // CHECK:STDOUT: %NegateI32.type: type = fn_type @NegateI32 [template] // CHECK:STDOUT: %NegateI32: %NegateI32.type = struct_value () [template] -// CHECK:STDOUT: %.8: i32 = int_value -2147483647 [template] -// CHECK:STDOUT: %.9: i32 = int_value 1 [template] -// CHECK:STDOUT: %.10: i32 = int_value -2147483648 [template] -// CHECK:STDOUT: %.11: %.7 = int_value -2147483648 [template] -// CHECK:STDOUT: %.12: %.7 = int_value 2147483647 [template] +// CHECK:STDOUT: %.36: i32 = int_value -2147483647 [template] +// CHECK:STDOUT: %.37: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.38: = bound_method %.37, %Convert.15 [template] +// CHECK:STDOUT: %.39: i32 = int_value 1 [template] +// CHECK:STDOUT: %.40: i32 = int_value -2147483648 [template] +// CHECK:STDOUT: %.41: %.35 = int_value -2147483648 [template] +// CHECK:STDOUT: %.42: %.35 = int_value 2147483647 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -1605,7 +1789,8 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, inst+427, unloaded // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .UInt = %import_ref.22 -// CHECK:STDOUT: .Int = %import_ref.23 +// CHECK:STDOUT: .ImplicitAs = %import_ref.23 +// CHECK:STDOUT: .Int = %import_ref.72 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -1651,18 +1836,18 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %.loc6_8.2: type = value_of_initializer %int.make_type_unsigned.loc6 [template = constants.%.2] // CHECK:STDOUT: %.loc6_8.3: type = converted %int.make_type_unsigned.loc6, %.loc6_8.2 [template = constants.%.2] // CHECK:STDOUT: %.loc8_8.1: Core.IntLiteral = int_value 64 [template = constants.%.1] -// CHECK:STDOUT: %int.make_type_signed.loc8: init type = call constants.%Int(%.loc8_8.1) [template = constants.%.7] -// CHECK:STDOUT: %.loc8_8.2: type = value_of_initializer %int.make_type_signed.loc8 [template = constants.%.7] -// CHECK:STDOUT: %.loc8_8.3: type = converted %int.make_type_signed.loc8, %.loc8_8.2 [template = constants.%.7] +// CHECK:STDOUT: %int.make_type_signed.loc8: init type = call constants.%Int(%.loc8_8.1) [template = constants.%.35] +// CHECK:STDOUT: %.loc8_8.2: type = value_of_initializer %int.make_type_signed.loc8 [template = constants.%.35] +// CHECK:STDOUT: %.loc8_8.3: type = converted %int.make_type_signed.loc8, %.loc8_8.2 [template = constants.%.35] // CHECK:STDOUT: %.loc9_8.1: Core.IntLiteral = int_value 64 [template = constants.%.1] -// CHECK:STDOUT: %int.make_type_signed.loc9: init type = call constants.%Int(%.loc9_8.1) [template = constants.%.7] -// CHECK:STDOUT: %.loc9_8.2: type = value_of_initializer %int.make_type_signed.loc9 [template = constants.%.7] -// CHECK:STDOUT: %.loc9_8.3: type = converted %int.make_type_signed.loc9, %.loc9_8.2 [template = constants.%.7] +// CHECK:STDOUT: %int.make_type_signed.loc9: init type = call constants.%Int(%.loc9_8.1) [template = constants.%.35] +// CHECK:STDOUT: %.loc9_8.2: type = value_of_initializer %int.make_type_signed.loc9 [template = constants.%.35] +// CHECK:STDOUT: %.loc9_8.3: type = converted %int.make_type_signed.loc9, %.loc9_8.2 [template = constants.%.35] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32ToUint64(%a.param_patt: i32) -> %.2 = "int.convert_checked"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Int32ToInt64(%a.param_patt: i32) -> %.7 = "int.convert_checked"; +// CHECK:STDOUT: fn @Int32ToInt64(%a.param_patt: i32) -> %.35 = "int.convert_checked"; // CHECK:STDOUT: // CHECK:STDOUT: fn @SubI32(%a.param_patt: i32, %b.param_patt: i32) -> i32 = "int.ssub"; // CHECK:STDOUT: @@ -1671,38 +1856,63 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Int32ToUint64.ref.loc5: %Int32ToUint64.type = name_ref Int32ToUint64, imports.%import_ref.17 [template = constants.%Int32ToUint64] -// CHECK:STDOUT: %.loc5_28: i32 = int_value 0 [template = constants.%.3] -// CHECK:STDOUT: %int.convert_checked.loc5: init %.2 = call %Int32ToUint64.ref.loc5(%.loc5_28) [template = constants.%.4] -// CHECK:STDOUT: %.loc5_30.1: %.2 = value_of_initializer %int.convert_checked.loc5 [template = constants.%.4] -// CHECK:STDOUT: %.loc5_30.2: %.2 = converted %int.convert_checked.loc5, %.loc5_30.1 [template = constants.%.4] +// CHECK:STDOUT: %.loc5_28.1: Core.IntLiteral = int_value 0 [template = constants.%.3] +// CHECK:STDOUT: %.loc5_28.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc5_28.3: = bound_method %.loc5_28.1, %.loc5_28.2 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked.loc5_28: init i32 = call %.loc5_28.3(%.loc5_28.1) [template = constants.%.29] +// CHECK:STDOUT: %.loc5_28.4: i32 = value_of_initializer %int.convert_checked.loc5_28 [template = constants.%.29] +// CHECK:STDOUT: %.loc5_28.5: i32 = converted %.loc5_28.1, %.loc5_28.4 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc5_27: init %.2 = call %Int32ToUint64.ref.loc5(%.loc5_28.5) [template = constants.%.30] +// CHECK:STDOUT: %.loc5_30.1: %.2 = value_of_initializer %int.convert_checked.loc5_27 [template = constants.%.30] +// CHECK:STDOUT: %.loc5_30.2: %.2 = converted %int.convert_checked.loc5_27, %.loc5_30.1 [template = constants.%.30] // CHECK:STDOUT: %a: %.2 = bind_name a, %.loc5_30.2 // CHECK:STDOUT: %Int32ToUint64.ref.loc6: %Int32ToUint64.type = name_ref Int32ToUint64, imports.%import_ref.17 [template = constants.%Int32ToUint64] -// CHECK:STDOUT: %.loc6_28: i32 = int_value 2147483647 [template = constants.%.5] -// CHECK:STDOUT: %int.convert_checked.loc6: init %.2 = call %Int32ToUint64.ref.loc6(%.loc6_28) [template = constants.%.6] -// CHECK:STDOUT: %.loc6_40.1: %.2 = value_of_initializer %int.convert_checked.loc6 [template = constants.%.6] -// CHECK:STDOUT: %.loc6_40.2: %.2 = converted %int.convert_checked.loc6, %.loc6_40.1 [template = constants.%.6] +// CHECK:STDOUT: %.loc6_28.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.31] +// CHECK:STDOUT: %.loc6_28.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc6_28.3: = bound_method %.loc6_28.1, %.loc6_28.2 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc6_28: init i32 = call %.loc6_28.3(%.loc6_28.1) [template = constants.%.33] +// CHECK:STDOUT: %.loc6_28.4: i32 = value_of_initializer %int.convert_checked.loc6_28 [template = constants.%.33] +// CHECK:STDOUT: %.loc6_28.5: i32 = converted %.loc6_28.1, %.loc6_28.4 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc6_27: init %.2 = call %Int32ToUint64.ref.loc6(%.loc6_28.5) [template = constants.%.34] +// CHECK:STDOUT: %.loc6_40.1: %.2 = value_of_initializer %int.convert_checked.loc6_27 [template = constants.%.34] +// CHECK:STDOUT: %.loc6_40.2: %.2 = converted %int.convert_checked.loc6_27, %.loc6_40.1 [template = constants.%.34] // CHECK:STDOUT: %b: %.2 = bind_name b, %.loc6_40.2 // CHECK:STDOUT: %Int32ToInt64.ref.loc8: %Int32ToInt64.type = name_ref Int32ToInt64, imports.%import_ref.16 [template = constants.%Int32ToInt64] // CHECK:STDOUT: %SubI32.ref: %SubI32.type = name_ref SubI32, imports.%import_ref.2 [template = constants.%SubI32] // CHECK:STDOUT: %NegateI32.ref: %NegateI32.type = name_ref NegateI32, imports.%import_ref.1 [template = constants.%NegateI32] -// CHECK:STDOUT: %.loc8_44: i32 = int_value 2147483647 [template = constants.%.5] -// CHECK:STDOUT: %int.snegate: init i32 = call %NegateI32.ref(%.loc8_44) [template = constants.%.8] -// CHECK:STDOUT: %.loc8_58: i32 = int_value 1 [template = constants.%.9] -// CHECK:STDOUT: %.loc8_43.1: i32 = value_of_initializer %int.snegate [template = constants.%.8] -// CHECK:STDOUT: %.loc8_43.2: i32 = converted %int.snegate, %.loc8_43.1 [template = constants.%.8] -// CHECK:STDOUT: %int.ssub: init i32 = call %SubI32.ref(%.loc8_43.2, %.loc8_58) [template = constants.%.10] -// CHECK:STDOUT: %.loc8_33.1: i32 = value_of_initializer %int.ssub [template = constants.%.10] -// CHECK:STDOUT: %.loc8_33.2: i32 = converted %int.ssub, %.loc8_33.1 [template = constants.%.10] -// CHECK:STDOUT: %int.convert_checked.loc8: init %.7 = call %Int32ToInt64.ref.loc8(%.loc8_33.2) [template = constants.%.11] -// CHECK:STDOUT: %.loc8_61.1: %.7 = value_of_initializer %int.convert_checked.loc8 [template = constants.%.11] -// CHECK:STDOUT: %.loc8_61.2: %.7 = converted %int.convert_checked.loc8, %.loc8_61.1 [template = constants.%.11] -// CHECK:STDOUT: %c: %.7 = bind_name c, %.loc8_61.2 +// CHECK:STDOUT: %.loc8_44.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.31] +// CHECK:STDOUT: %.loc8_44.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc8_44.3: = bound_method %.loc8_44.1, %.loc8_44.2 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc8_44: init i32 = call %.loc8_44.3(%.loc8_44.1) [template = constants.%.33] +// CHECK:STDOUT: %.loc8_44.4: i32 = value_of_initializer %int.convert_checked.loc8_44 [template = constants.%.33] +// CHECK:STDOUT: %.loc8_44.5: i32 = converted %.loc8_44.1, %.loc8_44.4 [template = constants.%.33] +// CHECK:STDOUT: %int.snegate: init i32 = call %NegateI32.ref(%.loc8_44.5) [template = constants.%.36] +// CHECK:STDOUT: %.loc8_58.1: Core.IntLiteral = int_value 1 [template = constants.%.37] +// CHECK:STDOUT: %.loc8_43.1: i32 = value_of_initializer %int.snegate [template = constants.%.36] +// CHECK:STDOUT: %.loc8_43.2: i32 = converted %int.snegate, %.loc8_43.1 [template = constants.%.36] +// CHECK:STDOUT: %.loc8_58.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc8_58.3: = bound_method %.loc8_58.1, %.loc8_58.2 [template = constants.%.38] +// CHECK:STDOUT: %int.convert_checked.loc8_58: init i32 = call %.loc8_58.3(%.loc8_58.1) [template = constants.%.39] +// CHECK:STDOUT: %.loc8_58.4: i32 = value_of_initializer %int.convert_checked.loc8_58 [template = constants.%.39] +// CHECK:STDOUT: %.loc8_58.5: i32 = converted %.loc8_58.1, %.loc8_58.4 [template = constants.%.39] +// CHECK:STDOUT: %int.ssub: init i32 = call %SubI32.ref(%.loc8_43.2, %.loc8_58.5) [template = constants.%.40] +// CHECK:STDOUT: %.loc8_33.1: i32 = value_of_initializer %int.ssub [template = constants.%.40] +// CHECK:STDOUT: %.loc8_33.2: i32 = converted %int.ssub, %.loc8_33.1 [template = constants.%.40] +// CHECK:STDOUT: %int.convert_checked.loc8_26: init %.35 = call %Int32ToInt64.ref.loc8(%.loc8_33.2) [template = constants.%.41] +// CHECK:STDOUT: %.loc8_61.1: %.35 = value_of_initializer %int.convert_checked.loc8_26 [template = constants.%.41] +// CHECK:STDOUT: %.loc8_61.2: %.35 = converted %int.convert_checked.loc8_26, %.loc8_61.1 [template = constants.%.41] +// CHECK:STDOUT: %c: %.35 = bind_name c, %.loc8_61.2 // CHECK:STDOUT: %Int32ToInt64.ref.loc9: %Int32ToInt64.type = name_ref Int32ToInt64, imports.%import_ref.16 [template = constants.%Int32ToInt64] -// CHECK:STDOUT: %.loc9_27: i32 = int_value 2147483647 [template = constants.%.5] -// CHECK:STDOUT: %int.convert_checked.loc9: init %.7 = call %Int32ToInt64.ref.loc9(%.loc9_27) [template = constants.%.12] -// CHECK:STDOUT: %.loc9_39.1: %.7 = value_of_initializer %int.convert_checked.loc9 [template = constants.%.12] -// CHECK:STDOUT: %.loc9_39.2: %.7 = converted %int.convert_checked.loc9, %.loc9_39.1 [template = constants.%.12] -// CHECK:STDOUT: %d: %.7 = bind_name d, %.loc9_39.2 +// CHECK:STDOUT: %.loc9_27.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.31] +// CHECK:STDOUT: %.loc9_27.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_27.3: = bound_method %.loc9_27.1, %.loc9_27.2 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc9_27: init i32 = call %.loc9_27.3(%.loc9_27.1) [template = constants.%.33] +// CHECK:STDOUT: %.loc9_27.4: i32 = value_of_initializer %int.convert_checked.loc9_27 [template = constants.%.33] +// CHECK:STDOUT: %.loc9_27.5: i32 = converted %.loc9_27.1, %.loc9_27.4 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc9_26: init %.35 = call %Int32ToInt64.ref.loc9(%.loc9_27.5) [template = constants.%.42] +// CHECK:STDOUT: %.loc9_39.1: %.35 = value_of_initializer %int.convert_checked.loc9_26 [template = constants.%.42] +// CHECK:STDOUT: %.loc9_39.2: %.35 = converted %int.convert_checked.loc9_26, %.loc9_39.1 [template = constants.%.42] +// CHECK:STDOUT: %d: %.35 = bind_name d, %.loc9_39.2 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1719,12 +1929,20 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %AddU32: %AddU32.type = struct_value () [template] // CHECK:STDOUT: %Int32ToUint32.type: type = fn_type @Int32ToUint32 [template] // CHECK:STDOUT: %Int32ToUint32: %Int32ToUint32.type = struct_value () [template] -// CHECK:STDOUT: %.3: i32 = int_value 2147483647 [template] -// CHECK:STDOUT: %.4: %.2 = int_value 2147483647 [template] -// CHECK:STDOUT: %.5: i32 = int_value 1 [template] -// CHECK:STDOUT: %.6: %.2 = int_value 1 [template] -// CHECK:STDOUT: %.7: %.2 = int_value 2147483648 [template] -// CHECK:STDOUT: %.8: i32 = int_value 2147483648 [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 2147483647 [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: %.27: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.28: = bound_method %.3, %Convert.15 [template] +// CHECK:STDOUT: %.29: i32 = int_value 2147483647 [template] +// CHECK:STDOUT: %.30: %.2 = int_value 2147483647 [template] +// CHECK:STDOUT: %.31: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.32: = bound_method %.31, %Convert.15 [template] +// CHECK:STDOUT: %.33: i32 = int_value 1 [template] +// CHECK:STDOUT: %.34: %.2 = int_value 1 [template] +// CHECK:STDOUT: %.35: %.2 = int_value 2147483648 [template] +// CHECK:STDOUT: %.36: i32 = int_value 2147483648 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -1751,6 +1969,7 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, inst+427, unloaded // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int32 = %import_ref.22 +// CHECK:STDOUT: .ImplicitAs = %import_ref.23 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -1800,21 +2019,31 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %Uint32ToInt32.ref: %Uint32ToInt32.type = name_ref Uint32ToInt32, imports.%import_ref.7 [template = constants.%Uint32ToInt32] // CHECK:STDOUT: %AddU32.ref: %AddU32.type = name_ref AddU32, imports.%import_ref.3 [template = constants.%AddU32] // CHECK:STDOUT: %Int32ToUint32.ref.loc11: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %.loc11_26: i32 = int_value 2147483647 [template = constants.%.3] -// CHECK:STDOUT: %int.convert_checked.loc11: init %.2 = call %Int32ToUint32.ref.loc11(%.loc11_26) [template = constants.%.4] +// CHECK:STDOUT: %.loc11_26.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.3] +// CHECK:STDOUT: %.loc11_26.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_26.3: = bound_method %.loc11_26.1, %.loc11_26.2 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked.loc11_26: init i32 = call %.loc11_26.3(%.loc11_26.1) [template = constants.%.29] +// CHECK:STDOUT: %.loc11_26.4: i32 = value_of_initializer %int.convert_checked.loc11_26 [template = constants.%.29] +// CHECK:STDOUT: %.loc11_26.5: i32 = converted %.loc11_26.1, %.loc11_26.4 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc11_25: init %.2 = call %Int32ToUint32.ref.loc11(%.loc11_26.5) [template = constants.%.30] // CHECK:STDOUT: %Int32ToUint32.ref.loc12: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %.loc12_26: i32 = int_value 1 [template = constants.%.5] -// CHECK:STDOUT: %int.convert_checked.loc12: init %.2 = call %Int32ToUint32.ref.loc12(%.loc12_26) [template = constants.%.6] -// CHECK:STDOUT: %.loc11_25.1: %.2 = value_of_initializer %int.convert_checked.loc11 [template = constants.%.4] -// CHECK:STDOUT: %.loc11_25.2: %.2 = converted %int.convert_checked.loc11, %.loc11_25.1 [template = constants.%.4] -// CHECK:STDOUT: %.loc12_25.1: %.2 = value_of_initializer %int.convert_checked.loc12 [template = constants.%.6] -// CHECK:STDOUT: %.loc12_25.2: %.2 = converted %int.convert_checked.loc12, %.loc12_25.1 [template = constants.%.6] -// CHECK:STDOUT: %int.uadd: init %.2 = call %AddU32.ref(%.loc11_25.2, %.loc12_25.2) [template = constants.%.7] -// CHECK:STDOUT: %.loc11_11.1: %.2 = value_of_initializer %int.uadd [template = constants.%.7] -// CHECK:STDOUT: %.loc11_11.2: %.2 = converted %int.uadd, %.loc11_11.1 [template = constants.%.7] -// CHECK:STDOUT: %int.convert_checked.loc10: init i32 = call %Uint32ToInt32.ref(%.loc11_11.2) [template = constants.%.8] -// CHECK:STDOUT: %.loc12_30.1: i32 = value_of_initializer %int.convert_checked.loc10 [template = constants.%.8] -// CHECK:STDOUT: %.loc12_30.2: i32 = converted %int.convert_checked.loc10, %.loc12_30.1 [template = constants.%.8] +// CHECK:STDOUT: %.loc12_26.1: Core.IntLiteral = int_value 1 [template = constants.%.31] +// CHECK:STDOUT: %.loc12_26.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_26.3: = bound_method %.loc12_26.1, %.loc12_26.2 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc12_26: init i32 = call %.loc12_26.3(%.loc12_26.1) [template = constants.%.33] +// CHECK:STDOUT: %.loc12_26.4: i32 = value_of_initializer %int.convert_checked.loc12_26 [template = constants.%.33] +// CHECK:STDOUT: %.loc12_26.5: i32 = converted %.loc12_26.1, %.loc12_26.4 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc12_25: init %.2 = call %Int32ToUint32.ref.loc12(%.loc12_26.5) [template = constants.%.34] +// CHECK:STDOUT: %.loc11_25.1: %.2 = value_of_initializer %int.convert_checked.loc11_25 [template = constants.%.30] +// CHECK:STDOUT: %.loc11_25.2: %.2 = converted %int.convert_checked.loc11_25, %.loc11_25.1 [template = constants.%.30] +// CHECK:STDOUT: %.loc12_25.1: %.2 = value_of_initializer %int.convert_checked.loc12_25 [template = constants.%.34] +// CHECK:STDOUT: %.loc12_25.2: %.2 = converted %int.convert_checked.loc12_25, %.loc12_25.1 [template = constants.%.34] +// CHECK:STDOUT: %int.uadd: init %.2 = call %AddU32.ref(%.loc11_25.2, %.loc12_25.2) [template = constants.%.35] +// CHECK:STDOUT: %.loc11_11.1: %.2 = value_of_initializer %int.uadd [template = constants.%.35] +// CHECK:STDOUT: %.loc11_11.2: %.2 = converted %int.uadd, %.loc11_11.1 [template = constants.%.35] +// CHECK:STDOUT: %int.convert_checked.loc10: init i32 = call %Uint32ToInt32.ref(%.loc11_11.2) [template = constants.%.36] +// CHECK:STDOUT: %.loc12_30.1: i32 = value_of_initializer %int.convert_checked.loc10 [template = constants.%.36] +// CHECK:STDOUT: %.loc12_30.2: i32 = converted %int.convert_checked.loc10, %.loc12_30.1 [template = constants.%.36] // CHECK:STDOUT: %max_plus_one: i32 = bind_name max_plus_one, %.loc12_30.2 // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -1828,8 +2057,14 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %.2: type = int_type signed, %.1 [template] // CHECK:STDOUT: %Int32ToInt16.type: type = fn_type @Int32ToInt16 [template] // CHECK:STDOUT: %Int32ToInt16: %Int32ToInt16.type = struct_value () [template] -// CHECK:STDOUT: %.3: i32 = int_value 32768 [template] -// CHECK:STDOUT: %.4: %.2 = int_value 32768 [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 32768 [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: %.27: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.28: = bound_method %.3, %Convert.15 [template] +// CHECK:STDOUT: %.29: i32 = int_value 32768 [template] +// CHECK:STDOUT: %.30: %.2 = int_value 32768 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -1856,6 +2091,7 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, inst+427, unloaded // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int = %import_ref.22 +// CHECK:STDOUT: .ImplicitAs = %import_ref.23 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -1900,10 +2136,15 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Int32ToInt16.ref: %Int32ToInt16.type = name_ref Int32ToInt16, imports.%import_ref.10 [template = constants.%Int32ToInt16] -// CHECK:STDOUT: %.loc9_38: i32 = int_value 32768 [template = constants.%.3] -// CHECK:STDOUT: %int.convert_checked: init %.2 = call %Int32ToInt16.ref(%.loc9_38) [template = constants.%.4] -// CHECK:STDOUT: %.loc9_45.1: %.2 = value_of_initializer %int.convert_checked [template = constants.%.4] -// CHECK:STDOUT: %.loc9_45.2: %.2 = converted %int.convert_checked, %.loc9_45.1 [template = constants.%.4] +// CHECK:STDOUT: %.loc9_38.1: Core.IntLiteral = int_value 32768 [template = constants.%.3] +// CHECK:STDOUT: %.loc9_38.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_38.3: = bound_method %.loc9_38.1, %.loc9_38.2 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked.loc9_38: init i32 = call %.loc9_38.3(%.loc9_38.1) [template = constants.%.29] +// CHECK:STDOUT: %.loc9_38.4: i32 = value_of_initializer %int.convert_checked.loc9_38 [template = constants.%.29] +// CHECK:STDOUT: %.loc9_38.5: i32 = converted %.loc9_38.1, %.loc9_38.4 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc9_37: init %.2 = call %Int32ToInt16.ref(%.loc9_38.5) [template = constants.%.30] +// CHECK:STDOUT: %.loc9_45.1: %.2 = value_of_initializer %int.convert_checked.loc9_37 [template = constants.%.30] +// CHECK:STDOUT: %.loc9_45.2: %.2 = converted %int.convert_checked.loc9_37, %.loc9_45.1 [template = constants.%.30] // CHECK:STDOUT: %max_plus_one: %.2 = bind_name max_plus_one, %.loc9_45.2 // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -1917,8 +2158,14 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %.2: type = int_type unsigned, %.1 [template] // CHECK:STDOUT: %Int32ToUint16.type: type = fn_type @Int32ToUint16 [template] // CHECK:STDOUT: %Int32ToUint16: %Int32ToUint16.type = struct_value () [template] -// CHECK:STDOUT: %.3: i32 = int_value 65536 [template] -// CHECK:STDOUT: %.4: %.2 = int_value 65536 [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 65536 [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: %.27: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.28: = bound_method %.3, %Convert.15 [template] +// CHECK:STDOUT: %.29: i32 = int_value 65536 [template] +// CHECK:STDOUT: %.30: %.2 = int_value 65536 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -1945,6 +2192,7 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, inst+427, unloaded // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .UInt = %import_ref.22 +// CHECK:STDOUT: .ImplicitAs = %import_ref.23 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -1989,10 +2237,15 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Int32ToUint16.ref: %Int32ToUint16.type = name_ref Int32ToUint16, imports.%import_ref.11 [template = constants.%Int32ToUint16] -// CHECK:STDOUT: %.loc9_39: i32 = int_value 65536 [template = constants.%.3] -// CHECK:STDOUT: %int.convert_checked: init %.2 = call %Int32ToUint16.ref(%.loc9_39) [template = constants.%.4] -// CHECK:STDOUT: %.loc9_48.1: %.2 = value_of_initializer %int.convert_checked [template = constants.%.4] -// CHECK:STDOUT: %.loc9_48.2: %.2 = converted %int.convert_checked, %.loc9_48.1 [template = constants.%.4] +// CHECK:STDOUT: %.loc9_39.1: Core.IntLiteral = int_value 65536 [template = constants.%.3] +// CHECK:STDOUT: %.loc9_39.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_39.3: = bound_method %.loc9_39.1, %.loc9_39.2 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked.loc9_39: init i32 = call %.loc9_39.3(%.loc9_39.1) [template = constants.%.29] +// CHECK:STDOUT: %.loc9_39.4: i32 = value_of_initializer %int.convert_checked.loc9_39 [template = constants.%.29] +// CHECK:STDOUT: %.loc9_39.5: i32 = converted %.loc9_39.1, %.loc9_39.4 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc9_38: init %.2 = call %Int32ToUint16.ref(%.loc9_39.5) [template = constants.%.30] +// CHECK:STDOUT: %.loc9_48.1: %.2 = value_of_initializer %int.convert_checked.loc9_38 [template = constants.%.30] +// CHECK:STDOUT: %.loc9_48.2: %.2 = converted %int.convert_checked.loc9_38, %.loc9_48.1 [template = constants.%.30] // CHECK:STDOUT: %max_plus_one: %.2 = bind_name max_plus_one, %.loc9_48.2 // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -2010,9 +2263,15 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %.4: type = int_type unsigned, %.3 [template] // CHECK:STDOUT: %Int32ToUint32.type: type = fn_type @Int32ToUint32 [template] // CHECK:STDOUT: %Int32ToUint32: %Int32ToUint32.type = struct_value () [template] -// CHECK:STDOUT: %.5: i32 = int_value 32768 [template] -// CHECK:STDOUT: %.6: %.4 = int_value 32768 [template] -// CHECK:STDOUT: %.7: %.2 = int_value 32768 [template] +// CHECK:STDOUT: %.5: Core.IntLiteral = int_value 32768 [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: %.29: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.30: = bound_method %.5, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 32768 [template] +// CHECK:STDOUT: %.32: %.4 = int_value 32768 [template] +// CHECK:STDOUT: %.33: %.2 = int_value 32768 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -2039,6 +2298,7 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, inst+427, unloaded // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int = %import_ref.22 +// CHECK:STDOUT: .ImplicitAs = %import_ref.23 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -2086,13 +2346,18 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Uint32ToInt16.ref: %Uint32ToInt16.type = name_ref Uint32ToInt16, imports.%import_ref.12 [template = constants.%Uint32ToInt16] // CHECK:STDOUT: %Int32ToUint32.ref: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %.loc9_53: i32 = int_value 32768 [template = constants.%.5] -// CHECK:STDOUT: %int.convert_checked.loc9_52: init %.4 = call %Int32ToUint32.ref(%.loc9_53) [template = constants.%.6] -// CHECK:STDOUT: %.loc9_52.1: %.4 = value_of_initializer %int.convert_checked.loc9_52 [template = constants.%.6] -// CHECK:STDOUT: %.loc9_52.2: %.4 = converted %int.convert_checked.loc9_52, %.loc9_52.1 [template = constants.%.6] -// CHECK:STDOUT: %int.convert_checked.loc9_38: init %.2 = call %Uint32ToInt16.ref(%.loc9_52.2) [template = constants.%.7] -// CHECK:STDOUT: %.loc9_61.1: %.2 = value_of_initializer %int.convert_checked.loc9_38 [template = constants.%.7] -// CHECK:STDOUT: %.loc9_61.2: %.2 = converted %int.convert_checked.loc9_38, %.loc9_61.1 [template = constants.%.7] +// CHECK:STDOUT: %.loc9_53.1: Core.IntLiteral = int_value 32768 [template = constants.%.5] +// CHECK:STDOUT: %.loc9_53.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_53.3: = bound_method %.loc9_53.1, %.loc9_53.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc9_53: init i32 = call %.loc9_53.3(%.loc9_53.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc9_53.4: i32 = value_of_initializer %int.convert_checked.loc9_53 [template = constants.%.31] +// CHECK:STDOUT: %.loc9_53.5: i32 = converted %.loc9_53.1, %.loc9_53.4 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc9_52: init %.4 = call %Int32ToUint32.ref(%.loc9_53.5) [template = constants.%.32] +// CHECK:STDOUT: %.loc9_52.1: %.4 = value_of_initializer %int.convert_checked.loc9_52 [template = constants.%.32] +// CHECK:STDOUT: %.loc9_52.2: %.4 = converted %int.convert_checked.loc9_52, %.loc9_52.1 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc9_38: init %.2 = call %Uint32ToInt16.ref(%.loc9_52.2) [template = constants.%.33] +// CHECK:STDOUT: %.loc9_61.1: %.2 = value_of_initializer %int.convert_checked.loc9_38 [template = constants.%.33] +// CHECK:STDOUT: %.loc9_61.2: %.2 = converted %int.convert_checked.loc9_38, %.loc9_61.1 [template = constants.%.33] // CHECK:STDOUT: %max_plus_one: %.2 = bind_name max_plus_one, %.loc9_61.2 // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -2110,9 +2375,15 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %.4: type = int_type unsigned, %.3 [template] // CHECK:STDOUT: %Int32ToUint32.type: type = fn_type @Int32ToUint32 [template] // CHECK:STDOUT: %Int32ToUint32: %Int32ToUint32.type = struct_value () [template] -// CHECK:STDOUT: %.5: i32 = int_value 65536 [template] -// CHECK:STDOUT: %.6: %.4 = int_value 65536 [template] -// CHECK:STDOUT: %.7: %.2 = int_value 65536 [template] +// CHECK:STDOUT: %.5: Core.IntLiteral = int_value 65536 [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: %.29: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.30: = bound_method %.5, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 65536 [template] +// CHECK:STDOUT: %.32: %.4 = int_value 65536 [template] +// CHECK:STDOUT: %.33: %.2 = int_value 65536 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -2139,6 +2410,7 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, inst+427, unloaded // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .UInt = %import_ref.22 +// CHECK:STDOUT: .ImplicitAs = %import_ref.23 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -2186,13 +2458,18 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Uint32ToUint16.ref: %Uint32ToUint16.type = name_ref Uint32ToUint16, imports.%import_ref.13 [template = constants.%Uint32ToUint16] // CHECK:STDOUT: %Int32ToUint32.ref: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %.loc9_54: i32 = int_value 65536 [template = constants.%.5] -// CHECK:STDOUT: %int.convert_checked.loc9_53: init %.4 = call %Int32ToUint32.ref(%.loc9_54) [template = constants.%.6] -// CHECK:STDOUT: %.loc9_53.1: %.4 = value_of_initializer %int.convert_checked.loc9_53 [template = constants.%.6] -// CHECK:STDOUT: %.loc9_53.2: %.4 = converted %int.convert_checked.loc9_53, %.loc9_53.1 [template = constants.%.6] -// CHECK:STDOUT: %int.convert_checked.loc9_39: init %.2 = call %Uint32ToUint16.ref(%.loc9_53.2) [template = constants.%.7] -// CHECK:STDOUT: %.loc9_64.1: %.2 = value_of_initializer %int.convert_checked.loc9_39 [template = constants.%.7] -// CHECK:STDOUT: %.loc9_64.2: %.2 = converted %int.convert_checked.loc9_39, %.loc9_64.1 [template = constants.%.7] +// CHECK:STDOUT: %.loc9_54.1: Core.IntLiteral = int_value 65536 [template = constants.%.5] +// CHECK:STDOUT: %.loc9_54.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_54.3: = bound_method %.loc9_54.1, %.loc9_54.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc9_54: init i32 = call %.loc9_54.3(%.loc9_54.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc9_54.4: i32 = value_of_initializer %int.convert_checked.loc9_54 [template = constants.%.31] +// CHECK:STDOUT: %.loc9_54.5: i32 = converted %.loc9_54.1, %.loc9_54.4 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc9_53: init %.4 = call %Int32ToUint32.ref(%.loc9_54.5) [template = constants.%.32] +// CHECK:STDOUT: %.loc9_53.1: %.4 = value_of_initializer %int.convert_checked.loc9_53 [template = constants.%.32] +// CHECK:STDOUT: %.loc9_53.2: %.4 = converted %int.convert_checked.loc9_53, %.loc9_53.1 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc9_39: init %.2 = call %Uint32ToUint16.ref(%.loc9_53.2) [template = constants.%.33] +// CHECK:STDOUT: %.loc9_64.1: %.2 = value_of_initializer %int.convert_checked.loc9_39 [template = constants.%.33] +// CHECK:STDOUT: %.loc9_64.2: %.2 = converted %int.convert_checked.loc9_39, %.loc9_64.1 [template = constants.%.33] // CHECK:STDOUT: %max_plus_one: %.2 = bind_name max_plus_one, %.loc9_64.2 // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -2208,10 +2485,18 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %Int32ToUint16: %Int32ToUint16.type = struct_value () [template] // CHECK:STDOUT: %SubI32.type: type = fn_type @SubI32 [template] // CHECK:STDOUT: %SubI32: %SubI32.type = struct_value () [template] -// CHECK:STDOUT: %.3: i32 = int_value 0 [template] -// CHECK:STDOUT: %.4: i32 = int_value 1 [template] -// CHECK:STDOUT: %.5: i32 = int_value -1 [template] -// CHECK:STDOUT: %.6: %.2 = int_value 18446744073709551615 [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %.4: 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: %.28: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.29: = bound_method %.3, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 0 [template] +// CHECK:STDOUT: %.31: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.32: i32 = int_value 1 [template] +// CHECK:STDOUT: %.33: i32 = int_value -1 [template] +// CHECK:STDOUT: %.34: %.2 = int_value 18446744073709551615 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -2238,6 +2523,7 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, inst+427, unloaded // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .UInt = %import_ref.22 +// CHECK:STDOUT: .ImplicitAs = %import_ref.23 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -2285,14 +2571,24 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Int32ToUint16.ref: %Int32ToUint16.type = name_ref Int32ToUint16, imports.%import_ref.11 [template = constants.%Int32ToUint16] // CHECK:STDOUT: %SubI32.ref: %SubI32.type = name_ref SubI32, imports.%import_ref.2 [template = constants.%SubI32] -// CHECK:STDOUT: %.loc9_50: i32 = int_value 0 [template = constants.%.3] -// CHECK:STDOUT: %.loc9_53: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %int.ssub: init i32 = call %SubI32.ref(%.loc9_50, %.loc9_53) [template = constants.%.5] -// CHECK:STDOUT: %.loc9_49.1: i32 = value_of_initializer %int.ssub [template = constants.%.5] -// CHECK:STDOUT: %.loc9_49.2: i32 = converted %int.ssub, %.loc9_49.1 [template = constants.%.5] -// CHECK:STDOUT: %int.convert_checked: init %.2 = call %Int32ToUint16.ref(%.loc9_49.2) [template = constants.%.6] -// CHECK:STDOUT: %.loc9_56.1: %.2 = value_of_initializer %int.convert_checked [template = constants.%.6] -// CHECK:STDOUT: %.loc9_56.2: %.2 = converted %int.convert_checked, %.loc9_56.1 [template = constants.%.6] +// CHECK:STDOUT: %.loc9_50.1: Core.IntLiteral = int_value 0 [template = constants.%.3] +// CHECK:STDOUT: %.loc9_53.1: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc9_50.2: %Convert.type.2 = interface_witness_access constants.%.28, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_50.3: = bound_method %.loc9_50.1, %.loc9_50.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc9_50: init i32 = call %.loc9_50.3(%.loc9_50.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc9_50.4: i32 = value_of_initializer %int.convert_checked.loc9_50 [template = constants.%.30] +// CHECK:STDOUT: %.loc9_50.5: i32 = converted %.loc9_50.1, %.loc9_50.4 [template = constants.%.30] +// CHECK:STDOUT: %.loc9_53.2: %Convert.type.2 = interface_witness_access constants.%.28, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_53.3: = bound_method %.loc9_53.1, %.loc9_53.2 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc9_53: init i32 = call %.loc9_53.3(%.loc9_53.1) [template = constants.%.32] +// CHECK:STDOUT: %.loc9_53.4: i32 = value_of_initializer %int.convert_checked.loc9_53 [template = constants.%.32] +// CHECK:STDOUT: %.loc9_53.5: i32 = converted %.loc9_53.1, %.loc9_53.4 [template = constants.%.32] +// CHECK:STDOUT: %int.ssub: init i32 = call %SubI32.ref(%.loc9_50.5, %.loc9_53.5) [template = constants.%.33] +// CHECK:STDOUT: %.loc9_49.1: i32 = value_of_initializer %int.ssub [template = constants.%.33] +// CHECK:STDOUT: %.loc9_49.2: i32 = converted %int.ssub, %.loc9_49.1 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc9_42: init %.2 = call %Int32ToUint16.ref(%.loc9_49.2) [template = constants.%.34] +// CHECK:STDOUT: %.loc9_56.1: %.2 = value_of_initializer %int.convert_checked.loc9_42 [template = constants.%.34] +// CHECK:STDOUT: %.loc9_56.2: %.2 = converted %int.convert_checked.loc9_42, %.loc9_56.1 [template = constants.%.34] // CHECK:STDOUT: %minus_one_to_u16: %.2 = bind_name minus_one_to_u16, %.loc9_56.2 // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -2308,10 +2604,18 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %Int32ToUint32: %Int32ToUint32.type = struct_value () [template] // CHECK:STDOUT: %SubI32.type: type = fn_type @SubI32 [template] // CHECK:STDOUT: %SubI32: %SubI32.type = struct_value () [template] -// CHECK:STDOUT: %.3: i32 = int_value 0 [template] -// CHECK:STDOUT: %.4: i32 = int_value 1 [template] -// CHECK:STDOUT: %.5: i32 = int_value -1 [template] -// CHECK:STDOUT: %.6: %.2 = int_value 18446744073709551615 [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %.4: 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: %.28: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.29: = bound_method %.3, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 0 [template] +// CHECK:STDOUT: %.31: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.32: i32 = int_value 1 [template] +// CHECK:STDOUT: %.33: i32 = int_value -1 [template] +// CHECK:STDOUT: %.34: %.2 = int_value 18446744073709551615 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -2338,6 +2642,7 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, inst+427, unloaded // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .UInt = %import_ref.22 +// CHECK:STDOUT: .ImplicitAs = %import_ref.23 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -2385,14 +2690,24 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Int32ToUint32.ref: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32] // CHECK:STDOUT: %SubI32.ref: %SubI32.type = name_ref SubI32, imports.%import_ref.2 [template = constants.%SubI32] -// CHECK:STDOUT: %.loc9_50: i32 = int_value 0 [template = constants.%.3] -// CHECK:STDOUT: %.loc9_53: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %int.ssub: init i32 = call %SubI32.ref(%.loc9_50, %.loc9_53) [template = constants.%.5] -// CHECK:STDOUT: %.loc9_49.1: i32 = value_of_initializer %int.ssub [template = constants.%.5] -// CHECK:STDOUT: %.loc9_49.2: i32 = converted %int.ssub, %.loc9_49.1 [template = constants.%.5] -// CHECK:STDOUT: %int.convert_checked: init %.2 = call %Int32ToUint32.ref(%.loc9_49.2) [template = constants.%.6] -// CHECK:STDOUT: %.loc9_56.1: %.2 = value_of_initializer %int.convert_checked [template = constants.%.6] -// CHECK:STDOUT: %.loc9_56.2: %.2 = converted %int.convert_checked, %.loc9_56.1 [template = constants.%.6] +// CHECK:STDOUT: %.loc9_50.1: Core.IntLiteral = int_value 0 [template = constants.%.3] +// CHECK:STDOUT: %.loc9_53.1: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc9_50.2: %Convert.type.2 = interface_witness_access constants.%.28, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_50.3: = bound_method %.loc9_50.1, %.loc9_50.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc9_50: init i32 = call %.loc9_50.3(%.loc9_50.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc9_50.4: i32 = value_of_initializer %int.convert_checked.loc9_50 [template = constants.%.30] +// CHECK:STDOUT: %.loc9_50.5: i32 = converted %.loc9_50.1, %.loc9_50.4 [template = constants.%.30] +// CHECK:STDOUT: %.loc9_53.2: %Convert.type.2 = interface_witness_access constants.%.28, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_53.3: = bound_method %.loc9_53.1, %.loc9_53.2 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc9_53: init i32 = call %.loc9_53.3(%.loc9_53.1) [template = constants.%.32] +// CHECK:STDOUT: %.loc9_53.4: i32 = value_of_initializer %int.convert_checked.loc9_53 [template = constants.%.32] +// CHECK:STDOUT: %.loc9_53.5: i32 = converted %.loc9_53.1, %.loc9_53.4 [template = constants.%.32] +// CHECK:STDOUT: %int.ssub: init i32 = call %SubI32.ref(%.loc9_50.5, %.loc9_53.5) [template = constants.%.33] +// CHECK:STDOUT: %.loc9_49.1: i32 = value_of_initializer %int.ssub [template = constants.%.33] +// CHECK:STDOUT: %.loc9_49.2: i32 = converted %int.ssub, %.loc9_49.1 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc9_42: init %.2 = call %Int32ToUint32.ref(%.loc9_49.2) [template = constants.%.34] +// CHECK:STDOUT: %.loc9_56.1: %.2 = value_of_initializer %int.convert_checked.loc9_42 [template = constants.%.34] +// CHECK:STDOUT: %.loc9_56.2: %.2 = converted %int.convert_checked.loc9_42, %.loc9_56.1 [template = constants.%.34] // CHECK:STDOUT: %minus_one_to_u32: %.2 = bind_name minus_one_to_u32, %.loc9_56.2 // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -2408,10 +2723,18 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %Int32ToUint64: %Int32ToUint64.type = struct_value () [template] // CHECK:STDOUT: %SubI32.type: type = fn_type @SubI32 [template] // CHECK:STDOUT: %SubI32: %SubI32.type = struct_value () [template] -// CHECK:STDOUT: %.3: i32 = int_value 0 [template] -// CHECK:STDOUT: %.4: i32 = int_value 1 [template] -// CHECK:STDOUT: %.5: i32 = int_value -1 [template] -// CHECK:STDOUT: %.6: %.2 = int_value 18446744073709551615 [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %.4: 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: %.28: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.29: = bound_method %.3, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 0 [template] +// CHECK:STDOUT: %.31: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.32: i32 = int_value 1 [template] +// CHECK:STDOUT: %.33: i32 = int_value -1 [template] +// CHECK:STDOUT: %.34: %.2 = int_value 18446744073709551615 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -2438,6 +2761,7 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, inst+427, unloaded // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .UInt = %import_ref.22 +// CHECK:STDOUT: .ImplicitAs = %import_ref.23 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -2485,14 +2809,24 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Int32ToUint64.ref: %Int32ToUint64.type = name_ref Int32ToUint64, imports.%import_ref.17 [template = constants.%Int32ToUint64] // CHECK:STDOUT: %SubI32.ref: %SubI32.type = name_ref SubI32, imports.%import_ref.2 [template = constants.%SubI32] -// CHECK:STDOUT: %.loc9_50: i32 = int_value 0 [template = constants.%.3] -// CHECK:STDOUT: %.loc9_53: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %int.ssub: init i32 = call %SubI32.ref(%.loc9_50, %.loc9_53) [template = constants.%.5] -// CHECK:STDOUT: %.loc9_49.1: i32 = value_of_initializer %int.ssub [template = constants.%.5] -// CHECK:STDOUT: %.loc9_49.2: i32 = converted %int.ssub, %.loc9_49.1 [template = constants.%.5] -// CHECK:STDOUT: %int.convert_checked: init %.2 = call %Int32ToUint64.ref(%.loc9_49.2) [template = constants.%.6] -// CHECK:STDOUT: %.loc9_56.1: %.2 = value_of_initializer %int.convert_checked [template = constants.%.6] -// CHECK:STDOUT: %.loc9_56.2: %.2 = converted %int.convert_checked, %.loc9_56.1 [template = constants.%.6] +// CHECK:STDOUT: %.loc9_50.1: Core.IntLiteral = int_value 0 [template = constants.%.3] +// CHECK:STDOUT: %.loc9_53.1: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc9_50.2: %Convert.type.2 = interface_witness_access constants.%.28, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_50.3: = bound_method %.loc9_50.1, %.loc9_50.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc9_50: init i32 = call %.loc9_50.3(%.loc9_50.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc9_50.4: i32 = value_of_initializer %int.convert_checked.loc9_50 [template = constants.%.30] +// CHECK:STDOUT: %.loc9_50.5: i32 = converted %.loc9_50.1, %.loc9_50.4 [template = constants.%.30] +// CHECK:STDOUT: %.loc9_53.2: %Convert.type.2 = interface_witness_access constants.%.28, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_53.3: = bound_method %.loc9_53.1, %.loc9_53.2 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc9_53: init i32 = call %.loc9_53.3(%.loc9_53.1) [template = constants.%.32] +// CHECK:STDOUT: %.loc9_53.4: i32 = value_of_initializer %int.convert_checked.loc9_53 [template = constants.%.32] +// CHECK:STDOUT: %.loc9_53.5: i32 = converted %.loc9_53.1, %.loc9_53.4 [template = constants.%.32] +// CHECK:STDOUT: %int.ssub: init i32 = call %SubI32.ref(%.loc9_50.5, %.loc9_53.5) [template = constants.%.33] +// CHECK:STDOUT: %.loc9_49.1: i32 = value_of_initializer %int.ssub [template = constants.%.33] +// CHECK:STDOUT: %.loc9_49.2: i32 = converted %int.ssub, %.loc9_49.1 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc9_42: init %.2 = call %Int32ToUint64.ref(%.loc9_49.2) [template = constants.%.34] +// CHECK:STDOUT: %.loc9_56.1: %.2 = value_of_initializer %int.convert_checked.loc9_42 [template = constants.%.34] +// CHECK:STDOUT: %.loc9_56.2: %.2 = converted %int.convert_checked.loc9_42, %.loc9_56.1 [template = constants.%.34] // CHECK:STDOUT: %minus_one_to_u64: %.2 = bind_name minus_one_to_u64, %.loc9_56.2 // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -2508,9 +2842,15 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %Int32ToInt16: %Int32ToInt16.type = struct_value () [template] // CHECK:STDOUT: %NegateI32.type: type = fn_type @NegateI32 [template] // CHECK:STDOUT: %NegateI32: %NegateI32.type = struct_value () [template] -// CHECK:STDOUT: %.3: i32 = int_value 32769 [template] -// CHECK:STDOUT: %.4: i32 = int_value -32769 [template] -// CHECK:STDOUT: %.5: %.2 = int_value -32769 [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 32769 [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: %.27: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.28: = bound_method %.3, %Convert.15 [template] +// CHECK:STDOUT: %.29: i32 = int_value 32769 [template] +// CHECK:STDOUT: %.30: i32 = int_value -32769 [template] +// CHECK:STDOUT: %.31: %.2 = int_value -32769 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -2537,6 +2877,7 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, inst+427, unloaded // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int = %import_ref.22 +// CHECK:STDOUT: .ImplicitAs = %import_ref.23 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -2584,13 +2925,18 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Int32ToInt16.ref: %Int32ToInt16.type = name_ref Int32ToInt16, imports.%import_ref.10 [template = constants.%Int32ToInt16] // CHECK:STDOUT: %NegateI32.ref: %NegateI32.type = name_ref NegateI32, imports.%import_ref.1 [template = constants.%NegateI32] -// CHECK:STDOUT: %.loc9_49: i32 = int_value 32769 [template = constants.%.3] -// CHECK:STDOUT: %int.snegate: init i32 = call %NegateI32.ref(%.loc9_49) [template = constants.%.4] -// CHECK:STDOUT: %.loc9_48.1: i32 = value_of_initializer %int.snegate [template = constants.%.4] -// CHECK:STDOUT: %.loc9_48.2: i32 = converted %int.snegate, %.loc9_48.1 [template = constants.%.4] -// CHECK:STDOUT: %int.convert_checked: init %.2 = call %Int32ToInt16.ref(%.loc9_48.2) [template = constants.%.5] -// CHECK:STDOUT: %.loc9_57.1: %.2 = value_of_initializer %int.convert_checked [template = constants.%.5] -// CHECK:STDOUT: %.loc9_57.2: %.2 = converted %int.convert_checked, %.loc9_57.1 [template = constants.%.5] +// CHECK:STDOUT: %.loc9_49.1: Core.IntLiteral = int_value 32769 [template = constants.%.3] +// CHECK:STDOUT: %.loc9_49.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_49.3: = bound_method %.loc9_49.1, %.loc9_49.2 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked.loc9_49: init i32 = call %.loc9_49.3(%.loc9_49.1) [template = constants.%.29] +// CHECK:STDOUT: %.loc9_49.4: i32 = value_of_initializer %int.convert_checked.loc9_49 [template = constants.%.29] +// CHECK:STDOUT: %.loc9_49.5: i32 = converted %.loc9_49.1, %.loc9_49.4 [template = constants.%.29] +// CHECK:STDOUT: %int.snegate: init i32 = call %NegateI32.ref(%.loc9_49.5) [template = constants.%.30] +// CHECK:STDOUT: %.loc9_48.1: i32 = value_of_initializer %int.snegate [template = constants.%.30] +// CHECK:STDOUT: %.loc9_48.2: i32 = converted %int.snegate, %.loc9_48.1 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc9_38: init %.2 = call %Int32ToInt16.ref(%.loc9_48.2) [template = constants.%.31] +// CHECK:STDOUT: %.loc9_57.1: %.2 = value_of_initializer %int.convert_checked.loc9_38 [template = constants.%.31] +// CHECK:STDOUT: %.loc9_57.2: %.2 = converted %int.convert_checked.loc9_38, %.loc9_57.1 [template = constants.%.31] // CHECK:STDOUT: %min_minus_one: %.2 = bind_name min_minus_one, %.loc9_57.2 // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -2600,17 +2946,23 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: constants { // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] -// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 16 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 0 [template] +// CHECK:STDOUT: %.28: Core.IntLiteral = int_value 16 [template] // CHECK:STDOUT: %Int.type: type = fn_type @Int [template] // CHECK:STDOUT: %Int: %Int.type = struct_value () [template] -// CHECK:STDOUT: %.3: type = int_type signed, %.2 [template] +// CHECK:STDOUT: %.29: type = int_type signed, %.28 [template] // CHECK:STDOUT: %Int32ToInt16.type: type = fn_type @Int32ToInt16 [template] // CHECK:STDOUT: %Int32ToInt16: %Int32ToInt16.type = struct_value () [template] // CHECK:STDOUT: %Int32ToInt32.type: type = fn_type @Int32ToInt32 [template] // CHECK:STDOUT: %Int32ToInt32: %Int32ToInt32.type = struct_value () [template] -// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 64 [template] -// CHECK:STDOUT: %.5: type = int_type signed, %.4 [template] +// CHECK:STDOUT: %.30: Core.IntLiteral = int_value 64 [template] +// CHECK:STDOUT: %.31: type = int_type signed, %.30 [template] // CHECK:STDOUT: %Int32ToInt64.type: type = fn_type @Int32ToInt64 [template] // CHECK:STDOUT: %Int32ToInt64: %Int32ToInt64.type = struct_value () [template] // CHECK:STDOUT: } @@ -2639,7 +2991,8 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, inst+427, unloaded // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int32 = %import_ref.22 -// CHECK:STDOUT: .Int = %import_ref.23 +// CHECK:STDOUT: .ImplicitAs = %import_ref.23 +// CHECK:STDOUT: .Int = %import_ref.72 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -2679,35 +3032,40 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc5_19.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] // CHECK:STDOUT: %.loc5_19.2: type = converted %int.make_type_32.loc5, %.loc5_19.1 [template = i32] -// CHECK:STDOUT: %.loc15_34.1: Core.IntLiteral = int_value 16 [template = constants.%.2] -// CHECK:STDOUT: %int.make_type_signed.loc15: init type = call constants.%Int(%.loc15_34.1) [template = constants.%.3] -// CHECK:STDOUT: %.loc15_34.2: type = value_of_initializer %int.make_type_signed.loc15 [template = constants.%.3] -// CHECK:STDOUT: %.loc15_34.3: type = converted %int.make_type_signed.loc15, %.loc15_34.2 [template = constants.%.3] +// CHECK:STDOUT: %.loc15_34.1: Core.IntLiteral = int_value 16 [template = constants.%.28] +// CHECK:STDOUT: %int.make_type_signed.loc15: init type = call constants.%Int(%.loc15_34.1) [template = constants.%.29] +// CHECK:STDOUT: %.loc15_34.2: type = value_of_initializer %int.make_type_signed.loc15 [template = constants.%.29] +// CHECK:STDOUT: %.loc15_34.3: type = converted %int.make_type_signed.loc15, %.loc15_34.2 [template = constants.%.29] // CHECK:STDOUT: %int.make_type_32.loc25: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc25_32.1: type = value_of_initializer %int.make_type_32.loc25 [template = i32] // CHECK:STDOUT: %.loc25_32.2: type = converted %int.make_type_32.loc25, %.loc25_32.1 [template = i32] -// CHECK:STDOUT: %.loc34_33.1: Core.IntLiteral = int_value 64 [template = constants.%.4] -// CHECK:STDOUT: %int.make_type_signed.loc34: init type = call constants.%Int(%.loc34_33.1) [template = constants.%.5] -// CHECK:STDOUT: %.loc34_33.2: type = value_of_initializer %int.make_type_signed.loc34 [template = constants.%.5] -// CHECK:STDOUT: %.loc34_33.3: type = converted %int.make_type_signed.loc34, %.loc34_33.2 [template = constants.%.5] +// CHECK:STDOUT: %.loc34_33.1: Core.IntLiteral = int_value 64 [template = constants.%.30] +// CHECK:STDOUT: %int.make_type_signed.loc34: init type = call constants.%Int(%.loc34_33.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc34_33.2: type = value_of_initializer %int.make_type_signed.loc34 [template = constants.%.31] +// CHECK:STDOUT: %.loc34_33.3: type = converted %int.make_type_signed.loc34, %.loc34_33.2 [template = constants.%.31] // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Int32ToInt16(%a.param_patt: i32) -> %.3 = "int.convert_checked"; +// CHECK:STDOUT: fn @Int32ToInt16(%a.param_patt: i32) -> %.29 = "int.convert_checked"; // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32ToInt32(%a.param_patt: i32) -> i32 = "int.convert_checked"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Int32ToInt64(%a.param_patt: i32) -> %.5 = "int.convert_checked"; +// CHECK:STDOUT: fn @Int32ToInt64(%a.param_patt: i32) -> %.31 = "int.convert_checked"; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc5: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: %not_constant: i32 = bind_name not_constant, %.loc5 +// CHECK:STDOUT: %.loc5_25: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc5_26.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc5_26.2: = bound_method %.loc5_25, %.loc5_26.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc5: init i32 = call %.loc5_26.2(%.loc5_25) [template = constants.%.27] +// CHECK:STDOUT: %.loc5_26.3: i32 = value_of_initializer %int.convert_checked.loc5 [template = constants.%.27] +// CHECK:STDOUT: %.loc5_26.4: i32 = converted %.loc5_25, %.loc5_26.3 [template = constants.%.27] +// CHECK:STDOUT: %not_constant: i32 = bind_name not_constant, %.loc5_26.4 // CHECK:STDOUT: %Int32ToInt16.ref: %Int32ToInt16.type = name_ref Int32ToInt16, imports.%import_ref.10 [template = constants.%Int32ToInt16] // CHECK:STDOUT: %not_constant.ref.loc15: i32 = name_ref not_constant, %not_constant -// CHECK:STDOUT: %int.convert_checked.loc15: init %.3 = call %Int32ToInt16.ref(%not_constant.ref.loc15) -// CHECK:STDOUT: %.loc15_66.1: %.3 = value_of_initializer %int.convert_checked.loc15 -// CHECK:STDOUT: %.loc15_66.2: %.3 = converted %int.convert_checked.loc15, %.loc15_66.1 -// CHECK:STDOUT: %convert_not_constant_narrow: %.3 = bind_name convert_not_constant_narrow, %.loc15_66.2 +// CHECK:STDOUT: %int.convert_checked.loc15: init %.29 = call %Int32ToInt16.ref(%not_constant.ref.loc15) +// CHECK:STDOUT: %.loc15_66.1: %.29 = value_of_initializer %int.convert_checked.loc15 +// CHECK:STDOUT: %.loc15_66.2: %.29 = converted %int.convert_checked.loc15, %.loc15_66.1 +// CHECK:STDOUT: %convert_not_constant_narrow: %.29 = bind_name convert_not_constant_narrow, %.loc15_66.2 // CHECK:STDOUT: %Int32ToInt32.ref: %Int32ToInt32.type = name_ref Int32ToInt32, imports.%import_ref.5 [template = constants.%Int32ToInt32] // CHECK:STDOUT: %not_constant.ref.loc25: i32 = name_ref not_constant, %not_constant // CHECK:STDOUT: %int.convert_checked.loc25: init i32 = call %Int32ToInt32.ref(%not_constant.ref.loc25) @@ -2716,10 +3074,10 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %convert_not_constant_same: i32 = bind_name convert_not_constant_same, %.loc25_64.2 // CHECK:STDOUT: %Int32ToInt64.ref: %Int32ToInt64.type = name_ref Int32ToInt64, imports.%import_ref.16 [template = constants.%Int32ToInt64] // CHECK:STDOUT: %not_constant.ref.loc34: i32 = name_ref not_constant, %not_constant -// CHECK:STDOUT: %int.convert_checked.loc34: init %.5 = call %Int32ToInt64.ref(%not_constant.ref.loc34) -// CHECK:STDOUT: %.loc34_65.1: %.5 = value_of_initializer %int.convert_checked.loc34 -// CHECK:STDOUT: %.loc34_65.2: %.5 = converted %int.convert_checked.loc34, %.loc34_65.1 -// CHECK:STDOUT: %convert_not_constant_widen: %.5 = bind_name convert_not_constant_widen, %.loc34_65.2 +// CHECK:STDOUT: %int.convert_checked.loc34: init %.31 = call %Int32ToInt64.ref(%not_constant.ref.loc34) +// CHECK:STDOUT: %.loc34_65.1: %.31 = value_of_initializer %int.convert_checked.loc34 +// CHECK:STDOUT: %.loc34_65.2: %.31 = converted %int.convert_checked.loc34, %.loc34_65.1 +// CHECK:STDOUT: %convert_not_constant_widen: %.31 = bind_name convert_not_constant_widen, %.loc34_65.2 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/eq.carbon b/toolchain/check/testdata/builtins/int/eq.carbon index 4e03b97c7ade5..d6ce3c09bd9c3 100644 --- a/toolchain/check/testdata/builtins/int/eq.carbon +++ b/toolchain/check/testdata/builtins/int/eq.carbon @@ -48,10 +48,18 @@ fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; // CHECK:STDOUT: %False: type = class_type @False [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %.4: i32 = int_value 1 [template] -// CHECK:STDOUT: %.5: bool = bool_literal true [template] -// CHECK:STDOUT: %.6: i32 = int_value 2 [template] -// CHECK:STDOUT: %.7: bool = bool_literal false [template] +// CHECK:STDOUT: %.4: 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: %.28: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.29: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 1 [template] +// CHECK:STDOUT: %.31: bool = bool_literal true [template] +// CHECK:STDOUT: %.32: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.33: = bound_method %.32, %Convert.15 [template] +// CHECK:STDOUT: %.34: i32 = int_value 2 [template] +// CHECK:STDOUT: %.35: bool = bool_literal false [template] // CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] // CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] // CHECK:STDOUT: } @@ -60,6 +68,7 @@ fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int32 = %import_ref.1 // CHECK:STDOUT: .Bool = %import_ref.2 +// CHECK:STDOUT: .ImplicitAs = %import_ref.3 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -160,11 +169,21 @@ fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; // CHECK:STDOUT: !entry: // CHECK:STDOUT: %true_.ref: %True = name_ref true_, %true_ // CHECK:STDOUT: %Eq.ref.loc8: %Eq.type = name_ref Eq, file.%Eq.decl [template = constants.%Eq] -// CHECK:STDOUT: %.loc8_19: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc8_22: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %int.eq.loc8: init bool = call %Eq.ref.loc8(%.loc8_19, %.loc8_22) [template = constants.%.5] -// CHECK:STDOUT: %.loc8_13.1: bool = value_of_initializer %int.eq.loc8 [template = constants.%.5] -// CHECK:STDOUT: %.loc8_13.2: bool = converted %int.eq.loc8, %.loc8_13.1 [template = constants.%.5] +// CHECK:STDOUT: %.loc8_19.1: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc8_22.1: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc8_19.2: %Convert.type.2 = interface_witness_access constants.%.28, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc8_19.3: = bound_method %.loc8_19.1, %.loc8_19.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc8_19: init i32 = call %.loc8_19.3(%.loc8_19.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc8_19.4: i32 = value_of_initializer %int.convert_checked.loc8_19 [template = constants.%.30] +// CHECK:STDOUT: %.loc8_19.5: i32 = converted %.loc8_19.1, %.loc8_19.4 [template = constants.%.30] +// CHECK:STDOUT: %.loc8_22.2: %Convert.type.2 = interface_witness_access constants.%.28, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc8_22.3: = bound_method %.loc8_22.1, %.loc8_22.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc8_22: init i32 = call %.loc8_22.3(%.loc8_22.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc8_22.4: i32 = value_of_initializer %int.convert_checked.loc8_22 [template = constants.%.30] +// CHECK:STDOUT: %.loc8_22.5: i32 = converted %.loc8_22.1, %.loc8_22.4 [template = constants.%.30] +// CHECK:STDOUT: %int.eq.loc8: init bool = call %Eq.ref.loc8(%.loc8_19.5, %.loc8_22.5) [template = constants.%.31] +// CHECK:STDOUT: %.loc8_13.1: bool = value_of_initializer %int.eq.loc8 [template = constants.%.31] +// CHECK:STDOUT: %.loc8_13.2: bool = converted %int.eq.loc8, %.loc8_13.1 [template = constants.%.31] // CHECK:STDOUT: if %.loc8_13.2 br !if.expr.then.loc8 else br !if.expr.else.loc8 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc8: @@ -179,11 +198,21 @@ fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; // CHECK:STDOUT: %.loc8_13.3: type = block_arg !if.expr.result.loc8 [template = constants.%True] // CHECK:STDOUT: %false_.ref: %False = name_ref false_, %false_ // CHECK:STDOUT: %Eq.ref.loc9: %Eq.type = name_ref Eq, file.%Eq.decl [template = constants.%Eq] -// CHECK:STDOUT: %.loc9_20: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc9_23: i32 = int_value 2 [template = constants.%.6] -// CHECK:STDOUT: %int.eq.loc9: init bool = call %Eq.ref.loc9(%.loc9_20, %.loc9_23) [template = constants.%.7] -// CHECK:STDOUT: %.loc9_14.1: bool = value_of_initializer %int.eq.loc9 [template = constants.%.7] -// CHECK:STDOUT: %.loc9_14.2: bool = converted %int.eq.loc9, %.loc9_14.1 [template = constants.%.7] +// CHECK:STDOUT: %.loc9_20.1: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc9_23.1: Core.IntLiteral = int_value 2 [template = constants.%.32] +// CHECK:STDOUT: %.loc9_20.2: %Convert.type.2 = interface_witness_access constants.%.28, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_20.3: = bound_method %.loc9_20.1, %.loc9_20.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc9_20: init i32 = call %.loc9_20.3(%.loc9_20.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc9_20.4: i32 = value_of_initializer %int.convert_checked.loc9_20 [template = constants.%.30] +// CHECK:STDOUT: %.loc9_20.5: i32 = converted %.loc9_20.1, %.loc9_20.4 [template = constants.%.30] +// CHECK:STDOUT: %.loc9_23.2: %Convert.type.2 = interface_witness_access constants.%.28, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_23.3: = bound_method %.loc9_23.1, %.loc9_23.2 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc9_23: init i32 = call %.loc9_23.3(%.loc9_23.1) [template = constants.%.34] +// CHECK:STDOUT: %.loc9_23.4: i32 = value_of_initializer %int.convert_checked.loc9_23 [template = constants.%.34] +// CHECK:STDOUT: %.loc9_23.5: i32 = converted %.loc9_23.1, %.loc9_23.4 [template = constants.%.34] +// CHECK:STDOUT: %int.eq.loc9: init bool = call %Eq.ref.loc9(%.loc9_20.5, %.loc9_23.5) [template = constants.%.35] +// CHECK:STDOUT: %.loc9_14.1: bool = value_of_initializer %int.eq.loc9 [template = constants.%.35] +// CHECK:STDOUT: %.loc9_14.2: bool = converted %int.eq.loc9, %.loc9_14.1 [template = constants.%.35] // CHECK:STDOUT: if %.loc9_14.2 br !if.expr.then.loc9 else br !if.expr.else.loc9 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc9: diff --git a/toolchain/check/testdata/builtins/int/greater.carbon b/toolchain/check/testdata/builtins/int/greater.carbon index cdbdb170d1d5b..8be06864df8c4 100644 --- a/toolchain/check/testdata/builtins/int/greater.carbon +++ b/toolchain/check/testdata/builtins/int/greater.carbon @@ -45,12 +45,22 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %False: type = class_type @False [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %.4: i32 = int_value 1 [template] -// CHECK:STDOUT: %.5: i32 = int_value 2 [template] -// CHECK:STDOUT: %.6: bool = bool_literal false [template] -// CHECK:STDOUT: %.7: i32 = int_value 0 [template] -// CHECK:STDOUT: %.8: bool = bool_literal true [template] -// CHECK:STDOUT: %.9: i32 = int_value -1 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.5: Core.IntLiteral = int_value 2 [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: %.29: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.30: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 1 [template] +// CHECK:STDOUT: %.32: = bound_method %.5, %Convert.15 [template] +// CHECK:STDOUT: %.33: i32 = int_value 2 [template] +// CHECK:STDOUT: %.34: bool = bool_literal false [template] +// CHECK:STDOUT: %.35: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %.36: = bound_method %.35, %Convert.15 [template] +// CHECK:STDOUT: %.37: i32 = int_value 0 [template] +// CHECK:STDOUT: %.38: bool = bool_literal true [template] +// CHECK:STDOUT: %.39: i32 = int_value -1 [template] // CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] // CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] // CHECK:STDOUT: } @@ -59,6 +69,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int32 = %import_ref.1 // CHECK:STDOUT: .Bool = %import_ref.2 +// CHECK:STDOUT: .ImplicitAs = %import_ref.3 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -179,11 +190,21 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %false_.ref.loc9: %False = name_ref false_, %false_ // CHECK:STDOUT: %Greater.ref.loc9: %Greater.type = name_ref Greater, file.%Greater.decl [template = constants.%Greater] -// CHECK:STDOUT: %.loc9_25: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc9_28: i32 = int_value 2 [template = constants.%.5] -// CHECK:STDOUT: %int.greater.loc9: init bool = call %Greater.ref.loc9(%.loc9_25, %.loc9_28) [template = constants.%.6] -// CHECK:STDOUT: %.loc9_14.1: bool = value_of_initializer %int.greater.loc9 [template = constants.%.6] -// CHECK:STDOUT: %.loc9_14.2: bool = converted %int.greater.loc9, %.loc9_14.1 [template = constants.%.6] +// CHECK:STDOUT: %.loc9_25.1: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc9_28.1: Core.IntLiteral = int_value 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc9_25.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_25.3: = bound_method %.loc9_25.1, %.loc9_25.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc9_25: init i32 = call %.loc9_25.3(%.loc9_25.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc9_25.4: i32 = value_of_initializer %int.convert_checked.loc9_25 [template = constants.%.31] +// CHECK:STDOUT: %.loc9_25.5: i32 = converted %.loc9_25.1, %.loc9_25.4 [template = constants.%.31] +// CHECK:STDOUT: %.loc9_28.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_28.3: = bound_method %.loc9_28.1, %.loc9_28.2 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc9_28: init i32 = call %.loc9_28.3(%.loc9_28.1) [template = constants.%.33] +// CHECK:STDOUT: %.loc9_28.4: i32 = value_of_initializer %int.convert_checked.loc9_28 [template = constants.%.33] +// CHECK:STDOUT: %.loc9_28.5: i32 = converted %.loc9_28.1, %.loc9_28.4 [template = constants.%.33] +// CHECK:STDOUT: %int.greater.loc9: init bool = call %Greater.ref.loc9(%.loc9_25.5, %.loc9_28.5) [template = constants.%.34] +// CHECK:STDOUT: %.loc9_14.1: bool = value_of_initializer %int.greater.loc9 [template = constants.%.34] +// CHECK:STDOUT: %.loc9_14.2: bool = converted %int.greater.loc9, %.loc9_14.1 [template = constants.%.34] // CHECK:STDOUT: if %.loc9_14.2 br !if.expr.then.loc9 else br !if.expr.else.loc9 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc9: @@ -198,11 +219,21 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %.loc9_14.3: type = block_arg !if.expr.result.loc9 [template = constants.%False] // CHECK:STDOUT: %false_.ref.loc10: %False = name_ref false_, %false_ // CHECK:STDOUT: %Greater.ref.loc10: %Greater.type = name_ref Greater, file.%Greater.decl [template = constants.%Greater] -// CHECK:STDOUT: %.loc10_25: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_28: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %int.greater.loc10: init bool = call %Greater.ref.loc10(%.loc10_25, %.loc10_28) [template = constants.%.6] -// CHECK:STDOUT: %.loc10_14.1: bool = value_of_initializer %int.greater.loc10 [template = constants.%.6] -// CHECK:STDOUT: %.loc10_14.2: bool = converted %int.greater.loc10, %.loc10_14.1 [template = constants.%.6] +// CHECK:STDOUT: %.loc10_25.1: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_28.1: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_25.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc10_25.3: = bound_method %.loc10_25.1, %.loc10_25.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc10_25: init i32 = call %.loc10_25.3(%.loc10_25.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc10_25.4: i32 = value_of_initializer %int.convert_checked.loc10_25 [template = constants.%.31] +// CHECK:STDOUT: %.loc10_25.5: i32 = converted %.loc10_25.1, %.loc10_25.4 [template = constants.%.31] +// CHECK:STDOUT: %.loc10_28.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc10_28.3: = bound_method %.loc10_28.1, %.loc10_28.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc10_28: init i32 = call %.loc10_28.3(%.loc10_28.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc10_28.4: i32 = value_of_initializer %int.convert_checked.loc10_28 [template = constants.%.31] +// CHECK:STDOUT: %.loc10_28.5: i32 = converted %.loc10_28.1, %.loc10_28.4 [template = constants.%.31] +// CHECK:STDOUT: %int.greater.loc10: init bool = call %Greater.ref.loc10(%.loc10_25.5, %.loc10_28.5) [template = constants.%.34] +// CHECK:STDOUT: %.loc10_14.1: bool = value_of_initializer %int.greater.loc10 [template = constants.%.34] +// CHECK:STDOUT: %.loc10_14.2: bool = converted %int.greater.loc10, %.loc10_14.1 [template = constants.%.34] // CHECK:STDOUT: if %.loc10_14.2 br !if.expr.then.loc10 else br !if.expr.else.loc10 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc10: @@ -217,11 +248,21 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %.loc10_14.3: type = block_arg !if.expr.result.loc10 [template = constants.%False] // CHECK:STDOUT: %true_.ref.loc11: %True = name_ref true_, %true_ // CHECK:STDOUT: %Greater.ref.loc11: %Greater.type = name_ref Greater, file.%Greater.decl [template = constants.%Greater] -// CHECK:STDOUT: %.loc11_24: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc11_27: i32 = int_value 0 [template = constants.%.7] -// CHECK:STDOUT: %int.greater.loc11: init bool = call %Greater.ref.loc11(%.loc11_24, %.loc11_27) [template = constants.%.8] -// CHECK:STDOUT: %.loc11_13.1: bool = value_of_initializer %int.greater.loc11 [template = constants.%.8] -// CHECK:STDOUT: %.loc11_13.2: bool = converted %int.greater.loc11, %.loc11_13.1 [template = constants.%.8] +// CHECK:STDOUT: %.loc11_24.1: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc11_27.1: Core.IntLiteral = int_value 0 [template = constants.%.35] +// CHECK:STDOUT: %.loc11_24.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_24.3: = bound_method %.loc11_24.1, %.loc11_24.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc11_24: init i32 = call %.loc11_24.3(%.loc11_24.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc11_24.4: i32 = value_of_initializer %int.convert_checked.loc11_24 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_24.5: i32 = converted %.loc11_24.1, %.loc11_24.4 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_27.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_27.3: = bound_method %.loc11_27.1, %.loc11_27.2 [template = constants.%.36] +// CHECK:STDOUT: %int.convert_checked.loc11_27: init i32 = call %.loc11_27.3(%.loc11_27.1) [template = constants.%.37] +// CHECK:STDOUT: %.loc11_27.4: i32 = value_of_initializer %int.convert_checked.loc11_27 [template = constants.%.37] +// CHECK:STDOUT: %.loc11_27.5: i32 = converted %.loc11_27.1, %.loc11_27.4 [template = constants.%.37] +// CHECK:STDOUT: %int.greater.loc11: init bool = call %Greater.ref.loc11(%.loc11_24.5, %.loc11_27.5) [template = constants.%.38] +// CHECK:STDOUT: %.loc11_13.1: bool = value_of_initializer %int.greater.loc11 [template = constants.%.38] +// CHECK:STDOUT: %.loc11_13.2: bool = converted %int.greater.loc11, %.loc11_13.1 [template = constants.%.38] // CHECK:STDOUT: if %.loc11_13.2 br !if.expr.then.loc11 else br !if.expr.else.loc11 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc11: @@ -237,14 +278,24 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %false_.ref.loc12: %False = name_ref false_, %false_ // CHECK:STDOUT: %Greater.ref.loc12: %Greater.type = name_ref Greater, file.%Greater.decl [template = constants.%Greater] // CHECK:STDOUT: %Negate.ref.loc12: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc12_32: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %int.snegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_32) [template = constants.%.9] -// CHECK:STDOUT: %.loc12_36: i32 = int_value 0 [template = constants.%.7] -// CHECK:STDOUT: %.loc12_31.1: i32 = value_of_initializer %int.snegate.loc12 [template = constants.%.9] -// CHECK:STDOUT: %.loc12_31.2: i32 = converted %int.snegate.loc12, %.loc12_31.1 [template = constants.%.9] -// CHECK:STDOUT: %int.greater.loc12: init bool = call %Greater.ref.loc12(%.loc12_31.2, %.loc12_36) [template = constants.%.6] -// CHECK:STDOUT: %.loc12_14.1: bool = value_of_initializer %int.greater.loc12 [template = constants.%.6] -// CHECK:STDOUT: %.loc12_14.2: bool = converted %int.greater.loc12, %.loc12_14.1 [template = constants.%.6] +// CHECK:STDOUT: %.loc12_32.1: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc12_32.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_32.3: = bound_method %.loc12_32.1, %.loc12_32.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc12_32: init i32 = call %.loc12_32.3(%.loc12_32.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc12_32.4: i32 = value_of_initializer %int.convert_checked.loc12_32 [template = constants.%.31] +// CHECK:STDOUT: %.loc12_32.5: i32 = converted %.loc12_32.1, %.loc12_32.4 [template = constants.%.31] +// CHECK:STDOUT: %int.snegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_32.5) [template = constants.%.39] +// CHECK:STDOUT: %.loc12_36.1: Core.IntLiteral = int_value 0 [template = constants.%.35] +// CHECK:STDOUT: %.loc12_31.1: i32 = value_of_initializer %int.snegate.loc12 [template = constants.%.39] +// CHECK:STDOUT: %.loc12_31.2: i32 = converted %int.snegate.loc12, %.loc12_31.1 [template = constants.%.39] +// CHECK:STDOUT: %.loc12_36.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_36.3: = bound_method %.loc12_36.1, %.loc12_36.2 [template = constants.%.36] +// CHECK:STDOUT: %int.convert_checked.loc12_36: init i32 = call %.loc12_36.3(%.loc12_36.1) [template = constants.%.37] +// CHECK:STDOUT: %.loc12_36.4: i32 = value_of_initializer %int.convert_checked.loc12_36 [template = constants.%.37] +// CHECK:STDOUT: %.loc12_36.5: i32 = converted %.loc12_36.1, %.loc12_36.4 [template = constants.%.37] +// CHECK:STDOUT: %int.greater.loc12: init bool = call %Greater.ref.loc12(%.loc12_31.2, %.loc12_36.5) [template = constants.%.34] +// CHECK:STDOUT: %.loc12_14.1: bool = value_of_initializer %int.greater.loc12 [template = constants.%.34] +// CHECK:STDOUT: %.loc12_14.2: bool = converted %int.greater.loc12, %.loc12_14.1 [template = constants.%.34] // CHECK:STDOUT: if %.loc12_14.2 br !if.expr.then.loc12 else br !if.expr.else.loc12 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc12: @@ -259,15 +310,25 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %.loc12_14.3: type = block_arg !if.expr.result.loc12 [template = constants.%False] // CHECK:STDOUT: %true_.ref.loc13: %True = name_ref true_, %true_ // CHECK:STDOUT: %Greater.ref.loc13: %Greater.type = name_ref Greater, file.%Greater.decl [template = constants.%Greater] -// CHECK:STDOUT: %.loc13_24: i32 = int_value 0 [template = constants.%.7] +// CHECK:STDOUT: %.loc13_24.1: Core.IntLiteral = int_value 0 [template = constants.%.35] // CHECK:STDOUT: %Negate.ref.loc13: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc13_34: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %int.snegate.loc13: init i32 = call %Negate.ref.loc13(%.loc13_34) [template = constants.%.9] -// CHECK:STDOUT: %.loc13_33.1: i32 = value_of_initializer %int.snegate.loc13 [template = constants.%.9] -// CHECK:STDOUT: %.loc13_33.2: i32 = converted %int.snegate.loc13, %.loc13_33.1 [template = constants.%.9] -// CHECK:STDOUT: %int.greater.loc13: init bool = call %Greater.ref.loc13(%.loc13_24, %.loc13_33.2) [template = constants.%.8] -// CHECK:STDOUT: %.loc13_13.1: bool = value_of_initializer %int.greater.loc13 [template = constants.%.8] -// CHECK:STDOUT: %.loc13_13.2: bool = converted %int.greater.loc13, %.loc13_13.1 [template = constants.%.8] +// CHECK:STDOUT: %.loc13_34.1: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc13_34.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_34.3: = bound_method %.loc13_34.1, %.loc13_34.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc13_34: init i32 = call %.loc13_34.3(%.loc13_34.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc13_34.4: i32 = value_of_initializer %int.convert_checked.loc13_34 [template = constants.%.31] +// CHECK:STDOUT: %.loc13_34.5: i32 = converted %.loc13_34.1, %.loc13_34.4 [template = constants.%.31] +// CHECK:STDOUT: %int.snegate.loc13: init i32 = call %Negate.ref.loc13(%.loc13_34.5) [template = constants.%.39] +// CHECK:STDOUT: %.loc13_24.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_24.3: = bound_method %.loc13_24.1, %.loc13_24.2 [template = constants.%.36] +// CHECK:STDOUT: %int.convert_checked.loc13_24: init i32 = call %.loc13_24.3(%.loc13_24.1) [template = constants.%.37] +// CHECK:STDOUT: %.loc13_24.4: i32 = value_of_initializer %int.convert_checked.loc13_24 [template = constants.%.37] +// CHECK:STDOUT: %.loc13_24.5: i32 = converted %.loc13_24.1, %.loc13_24.4 [template = constants.%.37] +// CHECK:STDOUT: %.loc13_33.1: i32 = value_of_initializer %int.snegate.loc13 [template = constants.%.39] +// CHECK:STDOUT: %.loc13_33.2: i32 = converted %int.snegate.loc13, %.loc13_33.1 [template = constants.%.39] +// CHECK:STDOUT: %int.greater.loc13: init bool = call %Greater.ref.loc13(%.loc13_24.5, %.loc13_33.2) [template = constants.%.38] +// CHECK:STDOUT: %.loc13_13.1: bool = value_of_initializer %int.greater.loc13 [template = constants.%.38] +// CHECK:STDOUT: %.loc13_13.2: bool = converted %int.greater.loc13, %.loc13_13.1 [template = constants.%.38] // CHECK:STDOUT: if %.loc13_13.2 br !if.expr.then.loc13 else br !if.expr.else.loc13 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc13: diff --git a/toolchain/check/testdata/builtins/int/greater_eq.carbon b/toolchain/check/testdata/builtins/int/greater_eq.carbon index 0afb944262935..c223ac7452244 100644 --- a/toolchain/check/testdata/builtins/int/greater_eq.carbon +++ b/toolchain/check/testdata/builtins/int/greater_eq.carbon @@ -45,12 +45,22 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %False: type = class_type @False [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %.4: i32 = int_value 1 [template] -// CHECK:STDOUT: %.5: i32 = int_value 2 [template] -// CHECK:STDOUT: %.6: bool = bool_literal false [template] -// CHECK:STDOUT: %.7: bool = bool_literal true [template] -// CHECK:STDOUT: %.8: i32 = int_value 0 [template] -// CHECK:STDOUT: %.9: i32 = int_value -1 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.5: Core.IntLiteral = int_value 2 [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: %.29: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.30: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 1 [template] +// CHECK:STDOUT: %.32: = bound_method %.5, %Convert.15 [template] +// CHECK:STDOUT: %.33: i32 = int_value 2 [template] +// CHECK:STDOUT: %.34: bool = bool_literal false [template] +// CHECK:STDOUT: %.35: bool = bool_literal true [template] +// CHECK:STDOUT: %.36: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %.37: = bound_method %.36, %Convert.15 [template] +// CHECK:STDOUT: %.38: i32 = int_value 0 [template] +// CHECK:STDOUT: %.39: i32 = int_value -1 [template] // CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] // CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] // CHECK:STDOUT: } @@ -59,6 +69,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int32 = %import_ref.1 // CHECK:STDOUT: .Bool = %import_ref.2 +// CHECK:STDOUT: .ImplicitAs = %import_ref.3 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -179,11 +190,21 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %false_.ref.loc9: %False = name_ref false_, %false_ // CHECK:STDOUT: %GreaterEq.ref.loc9: %GreaterEq.type = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%GreaterEq] -// CHECK:STDOUT: %.loc9_27: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc9_30: i32 = int_value 2 [template = constants.%.5] -// CHECK:STDOUT: %int.greater_eq.loc9: init bool = call %GreaterEq.ref.loc9(%.loc9_27, %.loc9_30) [template = constants.%.6] -// CHECK:STDOUT: %.loc9_14.1: bool = value_of_initializer %int.greater_eq.loc9 [template = constants.%.6] -// CHECK:STDOUT: %.loc9_14.2: bool = converted %int.greater_eq.loc9, %.loc9_14.1 [template = constants.%.6] +// CHECK:STDOUT: %.loc9_27.1: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc9_30.1: Core.IntLiteral = int_value 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc9_27.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_27.3: = bound_method %.loc9_27.1, %.loc9_27.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc9_27: init i32 = call %.loc9_27.3(%.loc9_27.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc9_27.4: i32 = value_of_initializer %int.convert_checked.loc9_27 [template = constants.%.31] +// CHECK:STDOUT: %.loc9_27.5: i32 = converted %.loc9_27.1, %.loc9_27.4 [template = constants.%.31] +// CHECK:STDOUT: %.loc9_30.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_30.3: = bound_method %.loc9_30.1, %.loc9_30.2 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc9_30: init i32 = call %.loc9_30.3(%.loc9_30.1) [template = constants.%.33] +// CHECK:STDOUT: %.loc9_30.4: i32 = value_of_initializer %int.convert_checked.loc9_30 [template = constants.%.33] +// CHECK:STDOUT: %.loc9_30.5: i32 = converted %.loc9_30.1, %.loc9_30.4 [template = constants.%.33] +// CHECK:STDOUT: %int.greater_eq.loc9: init bool = call %GreaterEq.ref.loc9(%.loc9_27.5, %.loc9_30.5) [template = constants.%.34] +// CHECK:STDOUT: %.loc9_14.1: bool = value_of_initializer %int.greater_eq.loc9 [template = constants.%.34] +// CHECK:STDOUT: %.loc9_14.2: bool = converted %int.greater_eq.loc9, %.loc9_14.1 [template = constants.%.34] // CHECK:STDOUT: if %.loc9_14.2 br !if.expr.then.loc9 else br !if.expr.else.loc9 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc9: @@ -198,11 +219,21 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %.loc9_14.3: type = block_arg !if.expr.result.loc9 [template = constants.%False] // CHECK:STDOUT: %true_.ref.loc10: %True = name_ref true_, %true_ // CHECK:STDOUT: %GreaterEq.ref.loc10: %GreaterEq.type = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%GreaterEq] -// CHECK:STDOUT: %.loc10_26: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_29: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %int.greater_eq.loc10: init bool = call %GreaterEq.ref.loc10(%.loc10_26, %.loc10_29) [template = constants.%.7] -// CHECK:STDOUT: %.loc10_13.1: bool = value_of_initializer %int.greater_eq.loc10 [template = constants.%.7] -// CHECK:STDOUT: %.loc10_13.2: bool = converted %int.greater_eq.loc10, %.loc10_13.1 [template = constants.%.7] +// CHECK:STDOUT: %.loc10_26.1: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_29.1: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_26.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc10_26.3: = bound_method %.loc10_26.1, %.loc10_26.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc10_26: init i32 = call %.loc10_26.3(%.loc10_26.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc10_26.4: i32 = value_of_initializer %int.convert_checked.loc10_26 [template = constants.%.31] +// CHECK:STDOUT: %.loc10_26.5: i32 = converted %.loc10_26.1, %.loc10_26.4 [template = constants.%.31] +// CHECK:STDOUT: %.loc10_29.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc10_29.3: = bound_method %.loc10_29.1, %.loc10_29.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc10_29: init i32 = call %.loc10_29.3(%.loc10_29.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc10_29.4: i32 = value_of_initializer %int.convert_checked.loc10_29 [template = constants.%.31] +// CHECK:STDOUT: %.loc10_29.5: i32 = converted %.loc10_29.1, %.loc10_29.4 [template = constants.%.31] +// CHECK:STDOUT: %int.greater_eq.loc10: init bool = call %GreaterEq.ref.loc10(%.loc10_26.5, %.loc10_29.5) [template = constants.%.35] +// CHECK:STDOUT: %.loc10_13.1: bool = value_of_initializer %int.greater_eq.loc10 [template = constants.%.35] +// CHECK:STDOUT: %.loc10_13.2: bool = converted %int.greater_eq.loc10, %.loc10_13.1 [template = constants.%.35] // CHECK:STDOUT: if %.loc10_13.2 br !if.expr.then.loc10 else br !if.expr.else.loc10 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc10: @@ -217,11 +248,21 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %.loc10_13.3: type = block_arg !if.expr.result.loc10 [template = constants.%True] // CHECK:STDOUT: %true_.ref.loc11: %True = name_ref true_, %true_ // CHECK:STDOUT: %GreaterEq.ref.loc11: %GreaterEq.type = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%GreaterEq] -// CHECK:STDOUT: %.loc11_26: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc11_29: i32 = int_value 0 [template = constants.%.8] -// CHECK:STDOUT: %int.greater_eq.loc11: init bool = call %GreaterEq.ref.loc11(%.loc11_26, %.loc11_29) [template = constants.%.7] -// CHECK:STDOUT: %.loc11_13.1: bool = value_of_initializer %int.greater_eq.loc11 [template = constants.%.7] -// CHECK:STDOUT: %.loc11_13.2: bool = converted %int.greater_eq.loc11, %.loc11_13.1 [template = constants.%.7] +// CHECK:STDOUT: %.loc11_26.1: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc11_29.1: Core.IntLiteral = int_value 0 [template = constants.%.36] +// CHECK:STDOUT: %.loc11_26.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_26.3: = bound_method %.loc11_26.1, %.loc11_26.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc11_26: init i32 = call %.loc11_26.3(%.loc11_26.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc11_26.4: i32 = value_of_initializer %int.convert_checked.loc11_26 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_26.5: i32 = converted %.loc11_26.1, %.loc11_26.4 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_29.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_29.3: = bound_method %.loc11_29.1, %.loc11_29.2 [template = constants.%.37] +// CHECK:STDOUT: %int.convert_checked.loc11_29: init i32 = call %.loc11_29.3(%.loc11_29.1) [template = constants.%.38] +// CHECK:STDOUT: %.loc11_29.4: i32 = value_of_initializer %int.convert_checked.loc11_29 [template = constants.%.38] +// CHECK:STDOUT: %.loc11_29.5: i32 = converted %.loc11_29.1, %.loc11_29.4 [template = constants.%.38] +// CHECK:STDOUT: %int.greater_eq.loc11: init bool = call %GreaterEq.ref.loc11(%.loc11_26.5, %.loc11_29.5) [template = constants.%.35] +// CHECK:STDOUT: %.loc11_13.1: bool = value_of_initializer %int.greater_eq.loc11 [template = constants.%.35] +// CHECK:STDOUT: %.loc11_13.2: bool = converted %int.greater_eq.loc11, %.loc11_13.1 [template = constants.%.35] // CHECK:STDOUT: if %.loc11_13.2 br !if.expr.then.loc11 else br !if.expr.else.loc11 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc11: @@ -237,14 +278,24 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %false_.ref.loc12: %False = name_ref false_, %false_ // CHECK:STDOUT: %GreaterEq.ref.loc12: %GreaterEq.type = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%GreaterEq] // CHECK:STDOUT: %Negate.ref.loc12: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc12_34: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %int.snegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_34) [template = constants.%.9] -// CHECK:STDOUT: %.loc12_38: i32 = int_value 0 [template = constants.%.8] -// CHECK:STDOUT: %.loc12_33.1: i32 = value_of_initializer %int.snegate.loc12 [template = constants.%.9] -// CHECK:STDOUT: %.loc12_33.2: i32 = converted %int.snegate.loc12, %.loc12_33.1 [template = constants.%.9] -// CHECK:STDOUT: %int.greater_eq.loc12: init bool = call %GreaterEq.ref.loc12(%.loc12_33.2, %.loc12_38) [template = constants.%.6] -// CHECK:STDOUT: %.loc12_14.1: bool = value_of_initializer %int.greater_eq.loc12 [template = constants.%.6] -// CHECK:STDOUT: %.loc12_14.2: bool = converted %int.greater_eq.loc12, %.loc12_14.1 [template = constants.%.6] +// CHECK:STDOUT: %.loc12_34.1: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc12_34.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_34.3: = bound_method %.loc12_34.1, %.loc12_34.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc12_34: init i32 = call %.loc12_34.3(%.loc12_34.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc12_34.4: i32 = value_of_initializer %int.convert_checked.loc12_34 [template = constants.%.31] +// CHECK:STDOUT: %.loc12_34.5: i32 = converted %.loc12_34.1, %.loc12_34.4 [template = constants.%.31] +// CHECK:STDOUT: %int.snegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_34.5) [template = constants.%.39] +// CHECK:STDOUT: %.loc12_38.1: Core.IntLiteral = int_value 0 [template = constants.%.36] +// CHECK:STDOUT: %.loc12_33.1: i32 = value_of_initializer %int.snegate.loc12 [template = constants.%.39] +// CHECK:STDOUT: %.loc12_33.2: i32 = converted %int.snegate.loc12, %.loc12_33.1 [template = constants.%.39] +// CHECK:STDOUT: %.loc12_38.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_38.3: = bound_method %.loc12_38.1, %.loc12_38.2 [template = constants.%.37] +// CHECK:STDOUT: %int.convert_checked.loc12_38: init i32 = call %.loc12_38.3(%.loc12_38.1) [template = constants.%.38] +// CHECK:STDOUT: %.loc12_38.4: i32 = value_of_initializer %int.convert_checked.loc12_38 [template = constants.%.38] +// CHECK:STDOUT: %.loc12_38.5: i32 = converted %.loc12_38.1, %.loc12_38.4 [template = constants.%.38] +// CHECK:STDOUT: %int.greater_eq.loc12: init bool = call %GreaterEq.ref.loc12(%.loc12_33.2, %.loc12_38.5) [template = constants.%.34] +// CHECK:STDOUT: %.loc12_14.1: bool = value_of_initializer %int.greater_eq.loc12 [template = constants.%.34] +// CHECK:STDOUT: %.loc12_14.2: bool = converted %int.greater_eq.loc12, %.loc12_14.1 [template = constants.%.34] // CHECK:STDOUT: if %.loc12_14.2 br !if.expr.then.loc12 else br !if.expr.else.loc12 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc12: @@ -259,15 +310,25 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %.loc12_14.3: type = block_arg !if.expr.result.loc12 [template = constants.%False] // CHECK:STDOUT: %true_.ref.loc13: %True = name_ref true_, %true_ // CHECK:STDOUT: %GreaterEq.ref.loc13: %GreaterEq.type = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%GreaterEq] -// CHECK:STDOUT: %.loc13_26: i32 = int_value 0 [template = constants.%.8] +// CHECK:STDOUT: %.loc13_26.1: Core.IntLiteral = int_value 0 [template = constants.%.36] // CHECK:STDOUT: %Negate.ref.loc13: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc13_36: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %int.snegate.loc13: init i32 = call %Negate.ref.loc13(%.loc13_36) [template = constants.%.9] -// CHECK:STDOUT: %.loc13_35.1: i32 = value_of_initializer %int.snegate.loc13 [template = constants.%.9] -// CHECK:STDOUT: %.loc13_35.2: i32 = converted %int.snegate.loc13, %.loc13_35.1 [template = constants.%.9] -// CHECK:STDOUT: %int.greater_eq.loc13: init bool = call %GreaterEq.ref.loc13(%.loc13_26, %.loc13_35.2) [template = constants.%.7] -// CHECK:STDOUT: %.loc13_13.1: bool = value_of_initializer %int.greater_eq.loc13 [template = constants.%.7] -// CHECK:STDOUT: %.loc13_13.2: bool = converted %int.greater_eq.loc13, %.loc13_13.1 [template = constants.%.7] +// CHECK:STDOUT: %.loc13_36.1: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc13_36.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_36.3: = bound_method %.loc13_36.1, %.loc13_36.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc13_36: init i32 = call %.loc13_36.3(%.loc13_36.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc13_36.4: i32 = value_of_initializer %int.convert_checked.loc13_36 [template = constants.%.31] +// CHECK:STDOUT: %.loc13_36.5: i32 = converted %.loc13_36.1, %.loc13_36.4 [template = constants.%.31] +// CHECK:STDOUT: %int.snegate.loc13: init i32 = call %Negate.ref.loc13(%.loc13_36.5) [template = constants.%.39] +// CHECK:STDOUT: %.loc13_26.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_26.3: = bound_method %.loc13_26.1, %.loc13_26.2 [template = constants.%.37] +// CHECK:STDOUT: %int.convert_checked.loc13_26: init i32 = call %.loc13_26.3(%.loc13_26.1) [template = constants.%.38] +// CHECK:STDOUT: %.loc13_26.4: i32 = value_of_initializer %int.convert_checked.loc13_26 [template = constants.%.38] +// CHECK:STDOUT: %.loc13_26.5: i32 = converted %.loc13_26.1, %.loc13_26.4 [template = constants.%.38] +// CHECK:STDOUT: %.loc13_35.1: i32 = value_of_initializer %int.snegate.loc13 [template = constants.%.39] +// CHECK:STDOUT: %.loc13_35.2: i32 = converted %int.snegate.loc13, %.loc13_35.1 [template = constants.%.39] +// CHECK:STDOUT: %int.greater_eq.loc13: init bool = call %GreaterEq.ref.loc13(%.loc13_26.5, %.loc13_35.2) [template = constants.%.35] +// CHECK:STDOUT: %.loc13_13.1: bool = value_of_initializer %int.greater_eq.loc13 [template = constants.%.35] +// CHECK:STDOUT: %.loc13_13.2: bool = converted %int.greater_eq.loc13, %.loc13_13.1 [template = constants.%.35] // CHECK:STDOUT: if %.loc13_13.2 br !if.expr.then.loc13 else br !if.expr.else.loc13 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc13: diff --git a/toolchain/check/testdata/builtins/int/left_shift.carbon b/toolchain/check/testdata/builtins/int/left_shift.carbon index 6e64c34a5baed..a513ac8262621 100644 --- a/toolchain/check/testdata/builtins/int/left_shift.carbon +++ b/toolchain/check/testdata/builtins/int/left_shift.carbon @@ -70,17 +70,25 @@ let negative: i32 = LeftShift(1, Negate(1)); // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %LeftShift.type: type = fn_type @LeftShift [template] // CHECK:STDOUT: %LeftShift: %LeftShift.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 5 [template] -// CHECK:STDOUT: %.2: i32 = int_value 2 [template] -// CHECK:STDOUT: %.3: i32 = int_value 20 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 5 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(i32) [template] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] // CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template] // CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template] -// CHECK:STDOUT: %.27: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.28: = bound_method %.3, %Convert.15 [template] -// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 20 [template] -// CHECK:STDOUT: %.30: type = array_type %.29, i32 [template] -// CHECK:STDOUT: %.31: type = ptr_type %.30 [template] +// CHECK:STDOUT: %.26: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 5 [template] +// CHECK:STDOUT: %.29: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 2 [template] +// CHECK:STDOUT: %.31: i32 = int_value 20 [template] +// CHECK:STDOUT: %Convert.type.16: type = fn_type @Convert.12 [template] +// CHECK:STDOUT: %Convert.16: %Convert.type.16 = struct_value () [template] +// CHECK:STDOUT: %.32: = interface_witness (%Convert.16) [template] +// CHECK:STDOUT: %.33: = bound_method %.31, %Convert.16 [template] +// CHECK:STDOUT: %.34: Core.IntLiteral = int_value 20 [template] +// CHECK:STDOUT: %.35: type = array_type %.34, i32 [template] +// CHECK:STDOUT: %.36: type = ptr_type %.35 [template] // CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] // CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] // CHECK:STDOUT: } @@ -129,32 +137,37 @@ let negative: i32 = LeftShift(1, Negate(1)); // CHECK:STDOUT: } // CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %LeftShift.ref: %LeftShift.type = name_ref LeftShift, %LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %.loc4_26: i32 = int_value 5 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_29: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: %int.left_shift: init i32 = call %LeftShift.ref(%.loc4_26, %.loc4_29) [template = constants.%.3] +// CHECK:STDOUT: %.loc4_26.1: Core.IntLiteral = int_value 5 [template = constants.%.1] +// CHECK:STDOUT: %.loc4_29.1: Core.IntLiteral = int_value 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_26.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_26.3: = bound_method %.loc4_26.1, %.loc4_26.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc4_26: init i32 = call %.loc4_26.3(%.loc4_26.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc4_26.4: i32 = value_of_initializer %int.convert_checked.loc4_26 [template = constants.%.28] +// CHECK:STDOUT: %.loc4_26.5: i32 = converted %.loc4_26.1, %.loc4_26.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc4_29.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_29.3: = bound_method %.loc4_29.1, %.loc4_29.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc4_29: init i32 = call %.loc4_29.3(%.loc4_29.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc4_29.4: i32 = value_of_initializer %int.convert_checked.loc4_29 [template = constants.%.30] +// CHECK:STDOUT: %.loc4_29.5: i32 = converted %.loc4_29.1, %.loc4_29.4 [template = constants.%.30] +// CHECK:STDOUT: %int.left_shift: init i32 = call %LeftShift.ref(%.loc4_26.5, %.loc4_29.5) [template = constants.%.31] // CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] // CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4, %.loc4_11.1 [template = i32] -// CHECK:STDOUT: %.loc4_25.1: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc4_25.2: = bound_method %int.left_shift, %.loc4_25.1 [template = constants.%.28] -// CHECK:STDOUT: %.loc4_25.3: i32 = value_of_initializer %int.left_shift [template = constants.%.3] -// CHECK:STDOUT: %.loc4_25.4: i32 = converted %int.left_shift, %.loc4_25.3 [template = constants.%.3] -// CHECK:STDOUT: %int.convert_checked.loc4: init Core.IntLiteral = call %.loc4_25.2(%.loc4_25.4) [template = constants.%.29] -// CHECK:STDOUT: %.loc4_25.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4 [template = constants.%.29] -// CHECK:STDOUT: %.loc4_25.6: Core.IntLiteral = converted %int.left_shift, %.loc4_25.5 [template = constants.%.29] -// CHECK:STDOUT: %.loc4_31: type = array_type %.loc4_25.6, i32 [template = constants.%.30] -// CHECK:STDOUT: %arr.var: ref %.30 = var arr -// CHECK:STDOUT: %arr: ref %.30 = bind_name arr, %arr.var +// CHECK:STDOUT: %.loc4_25.1: %Convert.type.5 = interface_witness_access constants.%.32, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %.loc4_25.2: = bound_method %int.left_shift, %.loc4_25.1 [template = constants.%.33] +// CHECK:STDOUT: %.loc4_25.3: i32 = value_of_initializer %int.left_shift [template = constants.%.31] +// CHECK:STDOUT: %.loc4_25.4: i32 = converted %int.left_shift, %.loc4_25.3 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc4_25: init Core.IntLiteral = call %.loc4_25.2(%.loc4_25.4) [template = constants.%.34] +// CHECK:STDOUT: %.loc4_25.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4_25 [template = constants.%.34] +// CHECK:STDOUT: %.loc4_25.6: Core.IntLiteral = converted %int.left_shift, %.loc4_25.5 [template = constants.%.34] +// CHECK:STDOUT: %.loc4_31: type = array_type %.loc4_25.6, i32 [template = constants.%.35] +// CHECK:STDOUT: %arr.var: ref %.35 = var arr +// CHECK:STDOUT: %arr: ref %.35 = bind_name arr, %arr.var // CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc5_18.1: i32 = int_value 20 [template = constants.%.3] +// CHECK:STDOUT: %.loc5_18: Core.IntLiteral = int_value 20 [template = constants.%.34] // CHECK:STDOUT: %.loc5_13.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] // CHECK:STDOUT: %.loc5_13.2: type = converted %int.make_type_32.loc5, %.loc5_13.1 [template = i32] -// CHECK:STDOUT: %.loc5_18.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc5_18.3: = bound_method %.loc5_18.1, %.loc5_18.2 [template = constants.%.28] -// CHECK:STDOUT: %int.convert_checked.loc5: init Core.IntLiteral = call %.loc5_18.3(%.loc5_18.1) [template = constants.%.29] -// CHECK:STDOUT: %.loc5_18.4: Core.IntLiteral = value_of_initializer %int.convert_checked.loc5 [template = constants.%.29] -// CHECK:STDOUT: %.loc5_18.5: Core.IntLiteral = converted %.loc5_18.1, %.loc5_18.4 [template = constants.%.29] -// CHECK:STDOUT: %.loc5_20: type = array_type %.loc5_18.5, i32 [template = constants.%.30] -// CHECK:STDOUT: %.loc5_21: type = ptr_type %.30 [template = constants.%.31] +// CHECK:STDOUT: %.loc5_20: type = array_type %.loc5_18, i32 [template = constants.%.35] +// CHECK:STDOUT: %.loc5_21: type = ptr_type %.35 [template = constants.%.36] // CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { // CHECK:STDOUT: %a.patt: i32 = binding_pattern a // CHECK:STDOUT: %a.param_patt: i32 = value_param_pattern %a.patt, runtime_param0 @@ -196,9 +209,9 @@ let negative: i32 = LeftShift(1, Negate(1)); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %.30 = name_ref arr, file.%arr -// CHECK:STDOUT: %.loc5: %.31 = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %.31 = bind_name arr_p, %.loc5 +// CHECK:STDOUT: %arr.ref: ref %.35 = name_ref arr, file.%arr +// CHECK:STDOUT: %.loc5: %.36 = addr_of %arr.ref +// CHECK:STDOUT: %arr_p: %.36 = bind_name arr_p, %.loc5 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -211,19 +224,36 @@ let negative: i32 = LeftShift(1, Negate(1)); // CHECK:STDOUT: %LeftShift: %LeftShift.type = struct_value () [template] // CHECK:STDOUT: %Negate.type: type = fn_type @Negate [template] // CHECK:STDOUT: %Negate: %Negate.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %.2: i32 = int_value 31 [template] -// CHECK:STDOUT: %.3: i32 = int_value -2147483648 [template] -// CHECK:STDOUT: %.4: i32 = int_value 32 [template] -// CHECK:STDOUT: %.5: i32 = int_value 33 [template] -// CHECK:STDOUT: %.6: i32 = int_value 1000 [template] -// CHECK:STDOUT: %.7: i32 = int_value 0 [template] -// CHECK:STDOUT: %.8: i32 = int_value -1 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 31 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 1 [template] +// CHECK:STDOUT: %.29: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 31 [template] +// CHECK:STDOUT: %.31: i32 = int_value -2147483648 [template] +// CHECK:STDOUT: %.32: Core.IntLiteral = int_value 32 [template] +// CHECK:STDOUT: %.33: = bound_method %.32, %Convert.15 [template] +// CHECK:STDOUT: %.34: i32 = int_value 32 [template] +// CHECK:STDOUT: %.35: Core.IntLiteral = int_value 33 [template] +// CHECK:STDOUT: %.36: = bound_method %.35, %Convert.15 [template] +// CHECK:STDOUT: %.37: i32 = int_value 33 [template] +// CHECK:STDOUT: %.38: Core.IntLiteral = int_value 1000 [template] +// CHECK:STDOUT: %.39: = bound_method %.38, %Convert.15 [template] +// CHECK:STDOUT: %.40: i32 = int_value 1000 [template] +// CHECK:STDOUT: %.41: i32 = int_value 0 [template] +// CHECK:STDOUT: %.42: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %.43: = bound_method %.42, %Convert.15 [template] +// CHECK:STDOUT: %.44: i32 = int_value -1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -318,62 +348,142 @@ let negative: i32 = LeftShift(1, Negate(1)); // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %LeftShift.ref.loc8: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %.loc8_29: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc8_32: i32 = int_value 31 [template = constants.%.2] -// CHECK:STDOUT: %int.left_shift.loc8: init i32 = call %LeftShift.ref.loc8(%.loc8_29, %.loc8_32) [template = constants.%.3] -// CHECK:STDOUT: %.loc8_35.1: i32 = value_of_initializer %int.left_shift.loc8 [template = constants.%.3] -// CHECK:STDOUT: %.loc8_35.2: i32 = converted %int.left_shift.loc8, %.loc8_35.1 [template = constants.%.3] +// CHECK:STDOUT: %.loc8_29.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc8_32.1: Core.IntLiteral = int_value 31 [template = constants.%.2] +// CHECK:STDOUT: %.loc8_29.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc8_29.3: = bound_method %.loc8_29.1, %.loc8_29.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc8_29: init i32 = call %.loc8_29.3(%.loc8_29.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc8_29.4: i32 = value_of_initializer %int.convert_checked.loc8_29 [template = constants.%.28] +// CHECK:STDOUT: %.loc8_29.5: i32 = converted %.loc8_29.1, %.loc8_29.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc8_32.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc8_32.3: = bound_method %.loc8_32.1, %.loc8_32.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc8_32: init i32 = call %.loc8_32.3(%.loc8_32.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc8_32.4: i32 = value_of_initializer %int.convert_checked.loc8_32 [template = constants.%.30] +// CHECK:STDOUT: %.loc8_32.5: i32 = converted %.loc8_32.1, %.loc8_32.4 [template = constants.%.30] +// CHECK:STDOUT: %int.left_shift.loc8: init i32 = call %LeftShift.ref.loc8(%.loc8_29.5, %.loc8_32.5) [template = constants.%.31] +// CHECK:STDOUT: %.loc8_35.1: i32 = value_of_initializer %int.left_shift.loc8 [template = constants.%.31] +// CHECK:STDOUT: %.loc8_35.2: i32 = converted %int.left_shift.loc8, %.loc8_35.1 [template = constants.%.31] // CHECK:STDOUT: %size_1: i32 = bind_name size_1, %.loc8_35.2 // CHECK:STDOUT: %LeftShift.ref.loc13: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %.loc13_29: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc13_32: i32 = int_value 32 [template = constants.%.4] -// CHECK:STDOUT: %int.left_shift.loc13: init i32 = call %LeftShift.ref.loc13(%.loc13_29, %.loc13_32) [template = ] +// CHECK:STDOUT: %.loc13_29.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc13_32.1: Core.IntLiteral = int_value 32 [template = constants.%.32] +// CHECK:STDOUT: %.loc13_29.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_29.3: = bound_method %.loc13_29.1, %.loc13_29.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc13_29: init i32 = call %.loc13_29.3(%.loc13_29.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc13_29.4: i32 = value_of_initializer %int.convert_checked.loc13_29 [template = constants.%.28] +// CHECK:STDOUT: %.loc13_29.5: i32 = converted %.loc13_29.1, %.loc13_29.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc13_32.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_32.3: = bound_method %.loc13_32.1, %.loc13_32.2 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc13_32: init i32 = call %.loc13_32.3(%.loc13_32.1) [template = constants.%.34] +// CHECK:STDOUT: %.loc13_32.4: i32 = value_of_initializer %int.convert_checked.loc13_32 [template = constants.%.34] +// CHECK:STDOUT: %.loc13_32.5: i32 = converted %.loc13_32.1, %.loc13_32.4 [template = constants.%.34] +// CHECK:STDOUT: %int.left_shift.loc13: init i32 = call %LeftShift.ref.loc13(%.loc13_29.5, %.loc13_32.5) [template = ] // CHECK:STDOUT: %.loc13_35.1: i32 = value_of_initializer %int.left_shift.loc13 [template = ] // CHECK:STDOUT: %.loc13_35.2: i32 = converted %int.left_shift.loc13, %.loc13_35.1 [template = ] // CHECK:STDOUT: %size_2: i32 = bind_name size_2, %.loc13_35.2 // CHECK:STDOUT: %LeftShift.ref.loc18: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %.loc18_29: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc18_32: i32 = int_value 33 [template = constants.%.5] -// CHECK:STDOUT: %int.left_shift.loc18: init i32 = call %LeftShift.ref.loc18(%.loc18_29, %.loc18_32) [template = ] +// CHECK:STDOUT: %.loc18_29.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc18_32.1: Core.IntLiteral = int_value 33 [template = constants.%.35] +// CHECK:STDOUT: %.loc18_29.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc18_29.3: = bound_method %.loc18_29.1, %.loc18_29.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc18_29: init i32 = call %.loc18_29.3(%.loc18_29.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc18_29.4: i32 = value_of_initializer %int.convert_checked.loc18_29 [template = constants.%.28] +// CHECK:STDOUT: %.loc18_29.5: i32 = converted %.loc18_29.1, %.loc18_29.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc18_32.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc18_32.3: = bound_method %.loc18_32.1, %.loc18_32.2 [template = constants.%.36] +// CHECK:STDOUT: %int.convert_checked.loc18_32: init i32 = call %.loc18_32.3(%.loc18_32.1) [template = constants.%.37] +// CHECK:STDOUT: %.loc18_32.4: i32 = value_of_initializer %int.convert_checked.loc18_32 [template = constants.%.37] +// CHECK:STDOUT: %.loc18_32.5: i32 = converted %.loc18_32.1, %.loc18_32.4 [template = constants.%.37] +// CHECK:STDOUT: %int.left_shift.loc18: init i32 = call %LeftShift.ref.loc18(%.loc18_29.5, %.loc18_32.5) [template = ] // CHECK:STDOUT: %.loc18_35.1: i32 = value_of_initializer %int.left_shift.loc18 [template = ] // CHECK:STDOUT: %.loc18_35.2: i32 = converted %int.left_shift.loc18, %.loc18_35.1 [template = ] // CHECK:STDOUT: %size_3: i32 = bind_name size_3, %.loc18_35.2 // CHECK:STDOUT: %LeftShift.ref.loc21: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %.loc21_33: i32 = int_value 1000 [template = constants.%.6] -// CHECK:STDOUT: %.loc21_39: i32 = int_value 31 [template = constants.%.2] -// CHECK:STDOUT: %int.left_shift.loc21: init i32 = call %LeftShift.ref.loc21(%.loc21_33, %.loc21_39) [template = constants.%.7] -// CHECK:STDOUT: %.loc21_42.1: i32 = value_of_initializer %int.left_shift.loc21 [template = constants.%.7] -// CHECK:STDOUT: %.loc21_42.2: i32 = converted %int.left_shift.loc21, %.loc21_42.1 [template = constants.%.7] +// CHECK:STDOUT: %.loc21_33.1: Core.IntLiteral = int_value 1000 [template = constants.%.38] +// CHECK:STDOUT: %.loc21_39.1: Core.IntLiteral = int_value 31 [template = constants.%.2] +// CHECK:STDOUT: %.loc21_33.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc21_33.3: = bound_method %.loc21_33.1, %.loc21_33.2 [template = constants.%.39] +// CHECK:STDOUT: %int.convert_checked.loc21_33: init i32 = call %.loc21_33.3(%.loc21_33.1) [template = constants.%.40] +// CHECK:STDOUT: %.loc21_33.4: i32 = value_of_initializer %int.convert_checked.loc21_33 [template = constants.%.40] +// CHECK:STDOUT: %.loc21_33.5: i32 = converted %.loc21_33.1, %.loc21_33.4 [template = constants.%.40] +// CHECK:STDOUT: %.loc21_39.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc21_39.3: = bound_method %.loc21_39.1, %.loc21_39.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc21_39: init i32 = call %.loc21_39.3(%.loc21_39.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc21_39.4: i32 = value_of_initializer %int.convert_checked.loc21_39 [template = constants.%.30] +// CHECK:STDOUT: %.loc21_39.5: i32 = converted %.loc21_39.1, %.loc21_39.4 [template = constants.%.30] +// CHECK:STDOUT: %int.left_shift.loc21: init i32 = call %LeftShift.ref.loc21(%.loc21_33.5, %.loc21_39.5) [template = constants.%.41] +// CHECK:STDOUT: %.loc21_42.1: i32 = value_of_initializer %int.left_shift.loc21 [template = constants.%.41] +// CHECK:STDOUT: %.loc21_42.2: i32 = converted %int.left_shift.loc21, %.loc21_42.1 [template = constants.%.41] // CHECK:STDOUT: %overflow_1: i32 = bind_name overflow_1, %.loc21_42.2 // CHECK:STDOUT: %LeftShift.ref.loc26: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %.loc26_33: i32 = int_value 1000 [template = constants.%.6] -// CHECK:STDOUT: %.loc26_39: i32 = int_value 32 [template = constants.%.4] -// CHECK:STDOUT: %int.left_shift.loc26: init i32 = call %LeftShift.ref.loc26(%.loc26_33, %.loc26_39) [template = ] +// CHECK:STDOUT: %.loc26_33.1: Core.IntLiteral = int_value 1000 [template = constants.%.38] +// CHECK:STDOUT: %.loc26_39.1: Core.IntLiteral = int_value 32 [template = constants.%.32] +// CHECK:STDOUT: %.loc26_33.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc26_33.3: = bound_method %.loc26_33.1, %.loc26_33.2 [template = constants.%.39] +// CHECK:STDOUT: %int.convert_checked.loc26_33: init i32 = call %.loc26_33.3(%.loc26_33.1) [template = constants.%.40] +// CHECK:STDOUT: %.loc26_33.4: i32 = value_of_initializer %int.convert_checked.loc26_33 [template = constants.%.40] +// CHECK:STDOUT: %.loc26_33.5: i32 = converted %.loc26_33.1, %.loc26_33.4 [template = constants.%.40] +// CHECK:STDOUT: %.loc26_39.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc26_39.3: = bound_method %.loc26_39.1, %.loc26_39.2 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc26_39: init i32 = call %.loc26_39.3(%.loc26_39.1) [template = constants.%.34] +// CHECK:STDOUT: %.loc26_39.4: i32 = value_of_initializer %int.convert_checked.loc26_39 [template = constants.%.34] +// CHECK:STDOUT: %.loc26_39.5: i32 = converted %.loc26_39.1, %.loc26_39.4 [template = constants.%.34] +// CHECK:STDOUT: %int.left_shift.loc26: init i32 = call %LeftShift.ref.loc26(%.loc26_33.5, %.loc26_39.5) [template = ] // CHECK:STDOUT: %.loc26_42.1: i32 = value_of_initializer %int.left_shift.loc26 [template = ] // CHECK:STDOUT: %.loc26_42.2: i32 = converted %int.left_shift.loc26, %.loc26_42.1 [template = ] // CHECK:STDOUT: %overflow_2: i32 = bind_name overflow_2, %.loc26_42.2 // CHECK:STDOUT: %LeftShift.ref.loc29: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %.loc29_36: i32 = int_value 0 [template = constants.%.7] -// CHECK:STDOUT: %.loc29_39: i32 = int_value 31 [template = constants.%.2] -// CHECK:STDOUT: %int.left_shift.loc29: init i32 = call %LeftShift.ref.loc29(%.loc29_36, %.loc29_39) [template = constants.%.7] -// CHECK:STDOUT: %.loc29_42.1: i32 = value_of_initializer %int.left_shift.loc29 [template = constants.%.7] -// CHECK:STDOUT: %.loc29_42.2: i32 = converted %int.left_shift.loc29, %.loc29_42.1 [template = constants.%.7] +// CHECK:STDOUT: %.loc29_36.1: Core.IntLiteral = int_value 0 [template = constants.%.42] +// CHECK:STDOUT: %.loc29_39.1: Core.IntLiteral = int_value 31 [template = constants.%.2] +// CHECK:STDOUT: %.loc29_36.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc29_36.3: = bound_method %.loc29_36.1, %.loc29_36.2 [template = constants.%.43] +// CHECK:STDOUT: %int.convert_checked.loc29_36: init i32 = call %.loc29_36.3(%.loc29_36.1) [template = constants.%.41] +// CHECK:STDOUT: %.loc29_36.4: i32 = value_of_initializer %int.convert_checked.loc29_36 [template = constants.%.41] +// CHECK:STDOUT: %.loc29_36.5: i32 = converted %.loc29_36.1, %.loc29_36.4 [template = constants.%.41] +// CHECK:STDOUT: %.loc29_39.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc29_39.3: = bound_method %.loc29_39.1, %.loc29_39.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc29_39: init i32 = call %.loc29_39.3(%.loc29_39.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc29_39.4: i32 = value_of_initializer %int.convert_checked.loc29_39 [template = constants.%.30] +// CHECK:STDOUT: %.loc29_39.5: i32 = converted %.loc29_39.1, %.loc29_39.4 [template = constants.%.30] +// CHECK:STDOUT: %int.left_shift.loc29: init i32 = call %LeftShift.ref.loc29(%.loc29_36.5, %.loc29_39.5) [template = constants.%.41] +// CHECK:STDOUT: %.loc29_42.1: i32 = value_of_initializer %int.left_shift.loc29 [template = constants.%.41] +// CHECK:STDOUT: %.loc29_42.2: i32 = converted %int.left_shift.loc29, %.loc29_42.1 [template = constants.%.41] // CHECK:STDOUT: %no_overflow_1: i32 = bind_name no_overflow_1, %.loc29_42.2 // CHECK:STDOUT: %LeftShift.ref.loc34: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %.loc34_36: i32 = int_value 0 [template = constants.%.7] -// CHECK:STDOUT: %.loc34_39: i32 = int_value 32 [template = constants.%.4] -// CHECK:STDOUT: %int.left_shift.loc34: init i32 = call %LeftShift.ref.loc34(%.loc34_36, %.loc34_39) [template = ] +// CHECK:STDOUT: %.loc34_36.1: Core.IntLiteral = int_value 0 [template = constants.%.42] +// CHECK:STDOUT: %.loc34_39.1: Core.IntLiteral = int_value 32 [template = constants.%.32] +// CHECK:STDOUT: %.loc34_36.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc34_36.3: = bound_method %.loc34_36.1, %.loc34_36.2 [template = constants.%.43] +// CHECK:STDOUT: %int.convert_checked.loc34_36: init i32 = call %.loc34_36.3(%.loc34_36.1) [template = constants.%.41] +// CHECK:STDOUT: %.loc34_36.4: i32 = value_of_initializer %int.convert_checked.loc34_36 [template = constants.%.41] +// CHECK:STDOUT: %.loc34_36.5: i32 = converted %.loc34_36.1, %.loc34_36.4 [template = constants.%.41] +// CHECK:STDOUT: %.loc34_39.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc34_39.3: = bound_method %.loc34_39.1, %.loc34_39.2 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc34_39: init i32 = call %.loc34_39.3(%.loc34_39.1) [template = constants.%.34] +// CHECK:STDOUT: %.loc34_39.4: i32 = value_of_initializer %int.convert_checked.loc34_39 [template = constants.%.34] +// CHECK:STDOUT: %.loc34_39.5: i32 = converted %.loc34_39.1, %.loc34_39.4 [template = constants.%.34] +// CHECK:STDOUT: %int.left_shift.loc34: init i32 = call %LeftShift.ref.loc34(%.loc34_36.5, %.loc34_39.5) [template = ] // CHECK:STDOUT: %.loc34_42.1: i32 = value_of_initializer %int.left_shift.loc34 [template = ] // CHECK:STDOUT: %.loc34_42.2: i32 = converted %int.left_shift.loc34, %.loc34_42.1 [template = ] // CHECK:STDOUT: %no_overflow_2: i32 = bind_name no_overflow_2, %.loc34_42.2 // CHECK:STDOUT: %LeftShift.ref.loc40: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %.loc40_31: i32 = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc40_31.1: Core.IntLiteral = int_value 1 [template = constants.%.1] // CHECK:STDOUT: %Negate.ref: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc40_41: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %int.snegate: init i32 = call %Negate.ref(%.loc40_41) [template = constants.%.8] -// CHECK:STDOUT: %.loc40_40.1: i32 = value_of_initializer %int.snegate [template = constants.%.8] -// CHECK:STDOUT: %.loc40_40.2: i32 = converted %int.snegate, %.loc40_40.1 [template = constants.%.8] -// CHECK:STDOUT: %int.left_shift.loc40: init i32 = call %LeftShift.ref.loc40(%.loc40_31, %.loc40_40.2) [template = ] +// CHECK:STDOUT: %.loc40_41.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc40_41.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc40_41.3: = bound_method %.loc40_41.1, %.loc40_41.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc40_41: init i32 = call %.loc40_41.3(%.loc40_41.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc40_41.4: i32 = value_of_initializer %int.convert_checked.loc40_41 [template = constants.%.28] +// CHECK:STDOUT: %.loc40_41.5: i32 = converted %.loc40_41.1, %.loc40_41.4 [template = constants.%.28] +// CHECK:STDOUT: %int.snegate: init i32 = call %Negate.ref(%.loc40_41.5) [template = constants.%.44] +// CHECK:STDOUT: %.loc40_31.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc40_31.3: = bound_method %.loc40_31.1, %.loc40_31.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc40_31: init i32 = call %.loc40_31.3(%.loc40_31.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc40_31.4: i32 = value_of_initializer %int.convert_checked.loc40_31 [template = constants.%.28] +// CHECK:STDOUT: %.loc40_31.5: i32 = converted %.loc40_31.1, %.loc40_31.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc40_40.1: i32 = value_of_initializer %int.snegate [template = constants.%.44] +// CHECK:STDOUT: %.loc40_40.2: i32 = converted %int.snegate, %.loc40_40.1 [template = constants.%.44] +// CHECK:STDOUT: %int.left_shift.loc40: init i32 = call %LeftShift.ref.loc40(%.loc40_31.5, %.loc40_40.2) [template = ] // CHECK:STDOUT: %.loc40_44.1: i32 = value_of_initializer %int.left_shift.loc40 [template = ] // CHECK:STDOUT: %.loc40_44.2: i32 = converted %int.left_shift.loc40, %.loc40_44.1 [template = ] // CHECK:STDOUT: %negative: i32 = bind_name negative, %.loc40_44.2 diff --git a/toolchain/check/testdata/builtins/int/less.carbon b/toolchain/check/testdata/builtins/int/less.carbon index e887d5b2bd9fc..636f1ee2c7983 100644 --- a/toolchain/check/testdata/builtins/int/less.carbon +++ b/toolchain/check/testdata/builtins/int/less.carbon @@ -45,12 +45,22 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %False: type = class_type @False [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %.4: i32 = int_value 1 [template] -// CHECK:STDOUT: %.5: i32 = int_value 2 [template] -// CHECK:STDOUT: %.6: bool = bool_literal true [template] -// CHECK:STDOUT: %.7: bool = bool_literal false [template] -// CHECK:STDOUT: %.8: i32 = int_value 0 [template] -// CHECK:STDOUT: %.9: i32 = int_value -1 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.5: Core.IntLiteral = int_value 2 [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: %.29: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.30: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 1 [template] +// CHECK:STDOUT: %.32: = bound_method %.5, %Convert.15 [template] +// CHECK:STDOUT: %.33: i32 = int_value 2 [template] +// CHECK:STDOUT: %.34: bool = bool_literal true [template] +// CHECK:STDOUT: %.35: bool = bool_literal false [template] +// CHECK:STDOUT: %.36: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %.37: = bound_method %.36, %Convert.15 [template] +// CHECK:STDOUT: %.38: i32 = int_value 0 [template] +// CHECK:STDOUT: %.39: i32 = int_value -1 [template] // CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] // CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] // CHECK:STDOUT: } @@ -59,6 +69,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int32 = %import_ref.1 // CHECK:STDOUT: .Bool = %import_ref.2 +// CHECK:STDOUT: .ImplicitAs = %import_ref.3 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -179,11 +190,21 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %true_.ref.loc9: %True = name_ref true_, %true_ // CHECK:STDOUT: %Less.ref.loc9: %Less.type = name_ref Less, file.%Less.decl [template = constants.%Less] -// CHECK:STDOUT: %.loc9_21: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc9_24: i32 = int_value 2 [template = constants.%.5] -// CHECK:STDOUT: %int.less.loc9: init bool = call %Less.ref.loc9(%.loc9_21, %.loc9_24) [template = constants.%.6] -// CHECK:STDOUT: %.loc9_13.1: bool = value_of_initializer %int.less.loc9 [template = constants.%.6] -// CHECK:STDOUT: %.loc9_13.2: bool = converted %int.less.loc9, %.loc9_13.1 [template = constants.%.6] +// CHECK:STDOUT: %.loc9_21.1: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc9_24.1: Core.IntLiteral = int_value 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc9_21.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_21.3: = bound_method %.loc9_21.1, %.loc9_21.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc9_21: init i32 = call %.loc9_21.3(%.loc9_21.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc9_21.4: i32 = value_of_initializer %int.convert_checked.loc9_21 [template = constants.%.31] +// CHECK:STDOUT: %.loc9_21.5: i32 = converted %.loc9_21.1, %.loc9_21.4 [template = constants.%.31] +// CHECK:STDOUT: %.loc9_24.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_24.3: = bound_method %.loc9_24.1, %.loc9_24.2 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc9_24: init i32 = call %.loc9_24.3(%.loc9_24.1) [template = constants.%.33] +// CHECK:STDOUT: %.loc9_24.4: i32 = value_of_initializer %int.convert_checked.loc9_24 [template = constants.%.33] +// CHECK:STDOUT: %.loc9_24.5: i32 = converted %.loc9_24.1, %.loc9_24.4 [template = constants.%.33] +// CHECK:STDOUT: %int.less.loc9: init bool = call %Less.ref.loc9(%.loc9_21.5, %.loc9_24.5) [template = constants.%.34] +// CHECK:STDOUT: %.loc9_13.1: bool = value_of_initializer %int.less.loc9 [template = constants.%.34] +// CHECK:STDOUT: %.loc9_13.2: bool = converted %int.less.loc9, %.loc9_13.1 [template = constants.%.34] // CHECK:STDOUT: if %.loc9_13.2 br !if.expr.then.loc9 else br !if.expr.else.loc9 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc9: @@ -198,11 +219,21 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %.loc9_13.3: type = block_arg !if.expr.result.loc9 [template = constants.%True] // CHECK:STDOUT: %false_.ref.loc10: %False = name_ref false_, %false_ // CHECK:STDOUT: %Less.ref.loc10: %Less.type = name_ref Less, file.%Less.decl [template = constants.%Less] -// CHECK:STDOUT: %.loc10_22: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_25: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %int.less.loc10: init bool = call %Less.ref.loc10(%.loc10_22, %.loc10_25) [template = constants.%.7] -// CHECK:STDOUT: %.loc10_14.1: bool = value_of_initializer %int.less.loc10 [template = constants.%.7] -// CHECK:STDOUT: %.loc10_14.2: bool = converted %int.less.loc10, %.loc10_14.1 [template = constants.%.7] +// CHECK:STDOUT: %.loc10_22.1: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_25.1: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_22.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc10_22.3: = bound_method %.loc10_22.1, %.loc10_22.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc10_22: init i32 = call %.loc10_22.3(%.loc10_22.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc10_22.4: i32 = value_of_initializer %int.convert_checked.loc10_22 [template = constants.%.31] +// CHECK:STDOUT: %.loc10_22.5: i32 = converted %.loc10_22.1, %.loc10_22.4 [template = constants.%.31] +// CHECK:STDOUT: %.loc10_25.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc10_25.3: = bound_method %.loc10_25.1, %.loc10_25.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc10_25: init i32 = call %.loc10_25.3(%.loc10_25.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc10_25.4: i32 = value_of_initializer %int.convert_checked.loc10_25 [template = constants.%.31] +// CHECK:STDOUT: %.loc10_25.5: i32 = converted %.loc10_25.1, %.loc10_25.4 [template = constants.%.31] +// CHECK:STDOUT: %int.less.loc10: init bool = call %Less.ref.loc10(%.loc10_22.5, %.loc10_25.5) [template = constants.%.35] +// CHECK:STDOUT: %.loc10_14.1: bool = value_of_initializer %int.less.loc10 [template = constants.%.35] +// CHECK:STDOUT: %.loc10_14.2: bool = converted %int.less.loc10, %.loc10_14.1 [template = constants.%.35] // CHECK:STDOUT: if %.loc10_14.2 br !if.expr.then.loc10 else br !if.expr.else.loc10 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc10: @@ -217,11 +248,21 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %.loc10_14.3: type = block_arg !if.expr.result.loc10 [template = constants.%False] // CHECK:STDOUT: %false_.ref.loc11: %False = name_ref false_, %false_ // CHECK:STDOUT: %Less.ref.loc11: %Less.type = name_ref Less, file.%Less.decl [template = constants.%Less] -// CHECK:STDOUT: %.loc11_22: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc11_25: i32 = int_value 0 [template = constants.%.8] -// CHECK:STDOUT: %int.less.loc11: init bool = call %Less.ref.loc11(%.loc11_22, %.loc11_25) [template = constants.%.7] -// CHECK:STDOUT: %.loc11_14.1: bool = value_of_initializer %int.less.loc11 [template = constants.%.7] -// CHECK:STDOUT: %.loc11_14.2: bool = converted %int.less.loc11, %.loc11_14.1 [template = constants.%.7] +// CHECK:STDOUT: %.loc11_22.1: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc11_25.1: Core.IntLiteral = int_value 0 [template = constants.%.36] +// CHECK:STDOUT: %.loc11_22.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_22.3: = bound_method %.loc11_22.1, %.loc11_22.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc11_22: init i32 = call %.loc11_22.3(%.loc11_22.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc11_22.4: i32 = value_of_initializer %int.convert_checked.loc11_22 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_22.5: i32 = converted %.loc11_22.1, %.loc11_22.4 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_25.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_25.3: = bound_method %.loc11_25.1, %.loc11_25.2 [template = constants.%.37] +// CHECK:STDOUT: %int.convert_checked.loc11_25: init i32 = call %.loc11_25.3(%.loc11_25.1) [template = constants.%.38] +// CHECK:STDOUT: %.loc11_25.4: i32 = value_of_initializer %int.convert_checked.loc11_25 [template = constants.%.38] +// CHECK:STDOUT: %.loc11_25.5: i32 = converted %.loc11_25.1, %.loc11_25.4 [template = constants.%.38] +// CHECK:STDOUT: %int.less.loc11: init bool = call %Less.ref.loc11(%.loc11_22.5, %.loc11_25.5) [template = constants.%.35] +// CHECK:STDOUT: %.loc11_14.1: bool = value_of_initializer %int.less.loc11 [template = constants.%.35] +// CHECK:STDOUT: %.loc11_14.2: bool = converted %int.less.loc11, %.loc11_14.1 [template = constants.%.35] // CHECK:STDOUT: if %.loc11_14.2 br !if.expr.then.loc11 else br !if.expr.else.loc11 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc11: @@ -237,14 +278,24 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %true_.ref.loc12: %True = name_ref true_, %true_ // CHECK:STDOUT: %Less.ref.loc12: %Less.type = name_ref Less, file.%Less.decl [template = constants.%Less] // CHECK:STDOUT: %Negate.ref.loc12: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc12_28: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %int.snegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_28) [template = constants.%.9] -// CHECK:STDOUT: %.loc12_32: i32 = int_value 0 [template = constants.%.8] -// CHECK:STDOUT: %.loc12_27.1: i32 = value_of_initializer %int.snegate.loc12 [template = constants.%.9] -// CHECK:STDOUT: %.loc12_27.2: i32 = converted %int.snegate.loc12, %.loc12_27.1 [template = constants.%.9] -// CHECK:STDOUT: %int.less.loc12: init bool = call %Less.ref.loc12(%.loc12_27.2, %.loc12_32) [template = constants.%.6] -// CHECK:STDOUT: %.loc12_13.1: bool = value_of_initializer %int.less.loc12 [template = constants.%.6] -// CHECK:STDOUT: %.loc12_13.2: bool = converted %int.less.loc12, %.loc12_13.1 [template = constants.%.6] +// CHECK:STDOUT: %.loc12_28.1: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc12_28.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_28.3: = bound_method %.loc12_28.1, %.loc12_28.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc12_28: init i32 = call %.loc12_28.3(%.loc12_28.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc12_28.4: i32 = value_of_initializer %int.convert_checked.loc12_28 [template = constants.%.31] +// CHECK:STDOUT: %.loc12_28.5: i32 = converted %.loc12_28.1, %.loc12_28.4 [template = constants.%.31] +// CHECK:STDOUT: %int.snegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_28.5) [template = constants.%.39] +// CHECK:STDOUT: %.loc12_32.1: Core.IntLiteral = int_value 0 [template = constants.%.36] +// CHECK:STDOUT: %.loc12_27.1: i32 = value_of_initializer %int.snegate.loc12 [template = constants.%.39] +// CHECK:STDOUT: %.loc12_27.2: i32 = converted %int.snegate.loc12, %.loc12_27.1 [template = constants.%.39] +// CHECK:STDOUT: %.loc12_32.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_32.3: = bound_method %.loc12_32.1, %.loc12_32.2 [template = constants.%.37] +// CHECK:STDOUT: %int.convert_checked.loc12_32: init i32 = call %.loc12_32.3(%.loc12_32.1) [template = constants.%.38] +// CHECK:STDOUT: %.loc12_32.4: i32 = value_of_initializer %int.convert_checked.loc12_32 [template = constants.%.38] +// CHECK:STDOUT: %.loc12_32.5: i32 = converted %.loc12_32.1, %.loc12_32.4 [template = constants.%.38] +// CHECK:STDOUT: %int.less.loc12: init bool = call %Less.ref.loc12(%.loc12_27.2, %.loc12_32.5) [template = constants.%.34] +// CHECK:STDOUT: %.loc12_13.1: bool = value_of_initializer %int.less.loc12 [template = constants.%.34] +// CHECK:STDOUT: %.loc12_13.2: bool = converted %int.less.loc12, %.loc12_13.1 [template = constants.%.34] // CHECK:STDOUT: if %.loc12_13.2 br !if.expr.then.loc12 else br !if.expr.else.loc12 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc12: @@ -259,15 +310,25 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %.loc12_13.3: type = block_arg !if.expr.result.loc12 [template = constants.%True] // CHECK:STDOUT: %false_.ref.loc13: %False = name_ref false_, %false_ // CHECK:STDOUT: %Less.ref.loc13: %Less.type = name_ref Less, file.%Less.decl [template = constants.%Less] -// CHECK:STDOUT: %.loc13_22: i32 = int_value 0 [template = constants.%.8] +// CHECK:STDOUT: %.loc13_22.1: Core.IntLiteral = int_value 0 [template = constants.%.36] // CHECK:STDOUT: %Negate.ref.loc13: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc13_32: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %int.snegate.loc13: init i32 = call %Negate.ref.loc13(%.loc13_32) [template = constants.%.9] -// CHECK:STDOUT: %.loc13_31.1: i32 = value_of_initializer %int.snegate.loc13 [template = constants.%.9] -// CHECK:STDOUT: %.loc13_31.2: i32 = converted %int.snegate.loc13, %.loc13_31.1 [template = constants.%.9] -// CHECK:STDOUT: %int.less.loc13: init bool = call %Less.ref.loc13(%.loc13_22, %.loc13_31.2) [template = constants.%.7] -// CHECK:STDOUT: %.loc13_14.1: bool = value_of_initializer %int.less.loc13 [template = constants.%.7] -// CHECK:STDOUT: %.loc13_14.2: bool = converted %int.less.loc13, %.loc13_14.1 [template = constants.%.7] +// CHECK:STDOUT: %.loc13_32.1: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc13_32.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_32.3: = bound_method %.loc13_32.1, %.loc13_32.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc13_32: init i32 = call %.loc13_32.3(%.loc13_32.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc13_32.4: i32 = value_of_initializer %int.convert_checked.loc13_32 [template = constants.%.31] +// CHECK:STDOUT: %.loc13_32.5: i32 = converted %.loc13_32.1, %.loc13_32.4 [template = constants.%.31] +// CHECK:STDOUT: %int.snegate.loc13: init i32 = call %Negate.ref.loc13(%.loc13_32.5) [template = constants.%.39] +// CHECK:STDOUT: %.loc13_22.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_22.3: = bound_method %.loc13_22.1, %.loc13_22.2 [template = constants.%.37] +// CHECK:STDOUT: %int.convert_checked.loc13_22: init i32 = call %.loc13_22.3(%.loc13_22.1) [template = constants.%.38] +// CHECK:STDOUT: %.loc13_22.4: i32 = value_of_initializer %int.convert_checked.loc13_22 [template = constants.%.38] +// CHECK:STDOUT: %.loc13_22.5: i32 = converted %.loc13_22.1, %.loc13_22.4 [template = constants.%.38] +// CHECK:STDOUT: %.loc13_31.1: i32 = value_of_initializer %int.snegate.loc13 [template = constants.%.39] +// CHECK:STDOUT: %.loc13_31.2: i32 = converted %int.snegate.loc13, %.loc13_31.1 [template = constants.%.39] +// CHECK:STDOUT: %int.less.loc13: init bool = call %Less.ref.loc13(%.loc13_22.5, %.loc13_31.2) [template = constants.%.35] +// CHECK:STDOUT: %.loc13_14.1: bool = value_of_initializer %int.less.loc13 [template = constants.%.35] +// CHECK:STDOUT: %.loc13_14.2: bool = converted %int.less.loc13, %.loc13_14.1 [template = constants.%.35] // CHECK:STDOUT: if %.loc13_14.2 br !if.expr.then.loc13 else br !if.expr.else.loc13 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc13: diff --git a/toolchain/check/testdata/builtins/int/less_eq.carbon b/toolchain/check/testdata/builtins/int/less_eq.carbon index ffb74c1570a3e..9799b6b54016b 100644 --- a/toolchain/check/testdata/builtins/int/less_eq.carbon +++ b/toolchain/check/testdata/builtins/int/less_eq.carbon @@ -45,12 +45,22 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %False: type = class_type @False [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %.4: i32 = int_value 1 [template] -// CHECK:STDOUT: %.5: i32 = int_value 2 [template] -// CHECK:STDOUT: %.6: bool = bool_literal true [template] -// CHECK:STDOUT: %.7: i32 = int_value 0 [template] -// CHECK:STDOUT: %.8: bool = bool_literal false [template] -// CHECK:STDOUT: %.9: i32 = int_value -1 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.5: Core.IntLiteral = int_value 2 [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: %.29: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.30: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 1 [template] +// CHECK:STDOUT: %.32: = bound_method %.5, %Convert.15 [template] +// CHECK:STDOUT: %.33: i32 = int_value 2 [template] +// CHECK:STDOUT: %.34: bool = bool_literal true [template] +// CHECK:STDOUT: %.35: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %.36: = bound_method %.35, %Convert.15 [template] +// CHECK:STDOUT: %.37: i32 = int_value 0 [template] +// CHECK:STDOUT: %.38: bool = bool_literal false [template] +// CHECK:STDOUT: %.39: i32 = int_value -1 [template] // CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] // CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] // CHECK:STDOUT: } @@ -59,6 +69,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int32 = %import_ref.1 // CHECK:STDOUT: .Bool = %import_ref.2 +// CHECK:STDOUT: .ImplicitAs = %import_ref.3 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -179,11 +190,21 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %true_.ref.loc9: %True = name_ref true_, %true_ // CHECK:STDOUT: %LessEq.ref.loc9: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq] -// CHECK:STDOUT: %.loc9_23: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc9_26: i32 = int_value 2 [template = constants.%.5] -// CHECK:STDOUT: %int.less_eq.loc9: init bool = call %LessEq.ref.loc9(%.loc9_23, %.loc9_26) [template = constants.%.6] -// CHECK:STDOUT: %.loc9_13.1: bool = value_of_initializer %int.less_eq.loc9 [template = constants.%.6] -// CHECK:STDOUT: %.loc9_13.2: bool = converted %int.less_eq.loc9, %.loc9_13.1 [template = constants.%.6] +// CHECK:STDOUT: %.loc9_23.1: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc9_26.1: Core.IntLiteral = int_value 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc9_23.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_23.3: = bound_method %.loc9_23.1, %.loc9_23.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc9_23: init i32 = call %.loc9_23.3(%.loc9_23.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc9_23.4: i32 = value_of_initializer %int.convert_checked.loc9_23 [template = constants.%.31] +// CHECK:STDOUT: %.loc9_23.5: i32 = converted %.loc9_23.1, %.loc9_23.4 [template = constants.%.31] +// CHECK:STDOUT: %.loc9_26.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_26.3: = bound_method %.loc9_26.1, %.loc9_26.2 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc9_26: init i32 = call %.loc9_26.3(%.loc9_26.1) [template = constants.%.33] +// CHECK:STDOUT: %.loc9_26.4: i32 = value_of_initializer %int.convert_checked.loc9_26 [template = constants.%.33] +// CHECK:STDOUT: %.loc9_26.5: i32 = converted %.loc9_26.1, %.loc9_26.4 [template = constants.%.33] +// CHECK:STDOUT: %int.less_eq.loc9: init bool = call %LessEq.ref.loc9(%.loc9_23.5, %.loc9_26.5) [template = constants.%.34] +// CHECK:STDOUT: %.loc9_13.1: bool = value_of_initializer %int.less_eq.loc9 [template = constants.%.34] +// CHECK:STDOUT: %.loc9_13.2: bool = converted %int.less_eq.loc9, %.loc9_13.1 [template = constants.%.34] // CHECK:STDOUT: if %.loc9_13.2 br !if.expr.then.loc9 else br !if.expr.else.loc9 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc9: @@ -198,11 +219,21 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %.loc9_13.3: type = block_arg !if.expr.result.loc9 [template = constants.%True] // CHECK:STDOUT: %true_.ref.loc10: %True = name_ref true_, %true_ // CHECK:STDOUT: %LessEq.ref.loc10: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq] -// CHECK:STDOUT: %.loc10_23: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_26: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %int.less_eq.loc10: init bool = call %LessEq.ref.loc10(%.loc10_23, %.loc10_26) [template = constants.%.6] -// CHECK:STDOUT: %.loc10_13.1: bool = value_of_initializer %int.less_eq.loc10 [template = constants.%.6] -// CHECK:STDOUT: %.loc10_13.2: bool = converted %int.less_eq.loc10, %.loc10_13.1 [template = constants.%.6] +// CHECK:STDOUT: %.loc10_23.1: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_26.1: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_23.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc10_23.3: = bound_method %.loc10_23.1, %.loc10_23.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc10_23: init i32 = call %.loc10_23.3(%.loc10_23.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc10_23.4: i32 = value_of_initializer %int.convert_checked.loc10_23 [template = constants.%.31] +// CHECK:STDOUT: %.loc10_23.5: i32 = converted %.loc10_23.1, %.loc10_23.4 [template = constants.%.31] +// CHECK:STDOUT: %.loc10_26.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc10_26.3: = bound_method %.loc10_26.1, %.loc10_26.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc10_26: init i32 = call %.loc10_26.3(%.loc10_26.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc10_26.4: i32 = value_of_initializer %int.convert_checked.loc10_26 [template = constants.%.31] +// CHECK:STDOUT: %.loc10_26.5: i32 = converted %.loc10_26.1, %.loc10_26.4 [template = constants.%.31] +// CHECK:STDOUT: %int.less_eq.loc10: init bool = call %LessEq.ref.loc10(%.loc10_23.5, %.loc10_26.5) [template = constants.%.34] +// CHECK:STDOUT: %.loc10_13.1: bool = value_of_initializer %int.less_eq.loc10 [template = constants.%.34] +// CHECK:STDOUT: %.loc10_13.2: bool = converted %int.less_eq.loc10, %.loc10_13.1 [template = constants.%.34] // CHECK:STDOUT: if %.loc10_13.2 br !if.expr.then.loc10 else br !if.expr.else.loc10 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc10: @@ -217,11 +248,21 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %.loc10_13.3: type = block_arg !if.expr.result.loc10 [template = constants.%True] // CHECK:STDOUT: %false_.ref.loc11: %False = name_ref false_, %false_ // CHECK:STDOUT: %LessEq.ref.loc11: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq] -// CHECK:STDOUT: %.loc11_24: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc11_27: i32 = int_value 0 [template = constants.%.7] -// CHECK:STDOUT: %int.less_eq.loc11: init bool = call %LessEq.ref.loc11(%.loc11_24, %.loc11_27) [template = constants.%.8] -// CHECK:STDOUT: %.loc11_14.1: bool = value_of_initializer %int.less_eq.loc11 [template = constants.%.8] -// CHECK:STDOUT: %.loc11_14.2: bool = converted %int.less_eq.loc11, %.loc11_14.1 [template = constants.%.8] +// CHECK:STDOUT: %.loc11_24.1: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc11_27.1: Core.IntLiteral = int_value 0 [template = constants.%.35] +// CHECK:STDOUT: %.loc11_24.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_24.3: = bound_method %.loc11_24.1, %.loc11_24.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc11_24: init i32 = call %.loc11_24.3(%.loc11_24.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc11_24.4: i32 = value_of_initializer %int.convert_checked.loc11_24 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_24.5: i32 = converted %.loc11_24.1, %.loc11_24.4 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_27.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_27.3: = bound_method %.loc11_27.1, %.loc11_27.2 [template = constants.%.36] +// CHECK:STDOUT: %int.convert_checked.loc11_27: init i32 = call %.loc11_27.3(%.loc11_27.1) [template = constants.%.37] +// CHECK:STDOUT: %.loc11_27.4: i32 = value_of_initializer %int.convert_checked.loc11_27 [template = constants.%.37] +// CHECK:STDOUT: %.loc11_27.5: i32 = converted %.loc11_27.1, %.loc11_27.4 [template = constants.%.37] +// CHECK:STDOUT: %int.less_eq.loc11: init bool = call %LessEq.ref.loc11(%.loc11_24.5, %.loc11_27.5) [template = constants.%.38] +// CHECK:STDOUT: %.loc11_14.1: bool = value_of_initializer %int.less_eq.loc11 [template = constants.%.38] +// CHECK:STDOUT: %.loc11_14.2: bool = converted %int.less_eq.loc11, %.loc11_14.1 [template = constants.%.38] // CHECK:STDOUT: if %.loc11_14.2 br !if.expr.then.loc11 else br !if.expr.else.loc11 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc11: @@ -237,14 +278,24 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %true_.ref.loc12: %True = name_ref true_, %true_ // CHECK:STDOUT: %LessEq.ref.loc12: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq] // CHECK:STDOUT: %Negate.ref.loc12: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc12_30: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %int.snegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_30) [template = constants.%.9] -// CHECK:STDOUT: %.loc12_34: i32 = int_value 0 [template = constants.%.7] -// CHECK:STDOUT: %.loc12_29.1: i32 = value_of_initializer %int.snegate.loc12 [template = constants.%.9] -// CHECK:STDOUT: %.loc12_29.2: i32 = converted %int.snegate.loc12, %.loc12_29.1 [template = constants.%.9] -// CHECK:STDOUT: %int.less_eq.loc12: init bool = call %LessEq.ref.loc12(%.loc12_29.2, %.loc12_34) [template = constants.%.6] -// CHECK:STDOUT: %.loc12_13.1: bool = value_of_initializer %int.less_eq.loc12 [template = constants.%.6] -// CHECK:STDOUT: %.loc12_13.2: bool = converted %int.less_eq.loc12, %.loc12_13.1 [template = constants.%.6] +// CHECK:STDOUT: %.loc12_30.1: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc12_30.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_30.3: = bound_method %.loc12_30.1, %.loc12_30.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc12_30: init i32 = call %.loc12_30.3(%.loc12_30.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc12_30.4: i32 = value_of_initializer %int.convert_checked.loc12_30 [template = constants.%.31] +// CHECK:STDOUT: %.loc12_30.5: i32 = converted %.loc12_30.1, %.loc12_30.4 [template = constants.%.31] +// CHECK:STDOUT: %int.snegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_30.5) [template = constants.%.39] +// CHECK:STDOUT: %.loc12_34.1: Core.IntLiteral = int_value 0 [template = constants.%.35] +// CHECK:STDOUT: %.loc12_29.1: i32 = value_of_initializer %int.snegate.loc12 [template = constants.%.39] +// CHECK:STDOUT: %.loc12_29.2: i32 = converted %int.snegate.loc12, %.loc12_29.1 [template = constants.%.39] +// CHECK:STDOUT: %.loc12_34.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_34.3: = bound_method %.loc12_34.1, %.loc12_34.2 [template = constants.%.36] +// CHECK:STDOUT: %int.convert_checked.loc12_34: init i32 = call %.loc12_34.3(%.loc12_34.1) [template = constants.%.37] +// CHECK:STDOUT: %.loc12_34.4: i32 = value_of_initializer %int.convert_checked.loc12_34 [template = constants.%.37] +// CHECK:STDOUT: %.loc12_34.5: i32 = converted %.loc12_34.1, %.loc12_34.4 [template = constants.%.37] +// CHECK:STDOUT: %int.less_eq.loc12: init bool = call %LessEq.ref.loc12(%.loc12_29.2, %.loc12_34.5) [template = constants.%.34] +// CHECK:STDOUT: %.loc12_13.1: bool = value_of_initializer %int.less_eq.loc12 [template = constants.%.34] +// CHECK:STDOUT: %.loc12_13.2: bool = converted %int.less_eq.loc12, %.loc12_13.1 [template = constants.%.34] // CHECK:STDOUT: if %.loc12_13.2 br !if.expr.then.loc12 else br !if.expr.else.loc12 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc12: @@ -259,15 +310,25 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %.loc12_13.3: type = block_arg !if.expr.result.loc12 [template = constants.%True] // CHECK:STDOUT: %false_.ref.loc13: %False = name_ref false_, %false_ // CHECK:STDOUT: %LessEq.ref.loc13: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq] -// CHECK:STDOUT: %.loc13_24: i32 = int_value 0 [template = constants.%.7] +// CHECK:STDOUT: %.loc13_24.1: Core.IntLiteral = int_value 0 [template = constants.%.35] // CHECK:STDOUT: %Negate.ref.loc13: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc13_34: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %int.snegate.loc13: init i32 = call %Negate.ref.loc13(%.loc13_34) [template = constants.%.9] -// CHECK:STDOUT: %.loc13_33.1: i32 = value_of_initializer %int.snegate.loc13 [template = constants.%.9] -// CHECK:STDOUT: %.loc13_33.2: i32 = converted %int.snegate.loc13, %.loc13_33.1 [template = constants.%.9] -// CHECK:STDOUT: %int.less_eq.loc13: init bool = call %LessEq.ref.loc13(%.loc13_24, %.loc13_33.2) [template = constants.%.8] -// CHECK:STDOUT: %.loc13_14.1: bool = value_of_initializer %int.less_eq.loc13 [template = constants.%.8] -// CHECK:STDOUT: %.loc13_14.2: bool = converted %int.less_eq.loc13, %.loc13_14.1 [template = constants.%.8] +// CHECK:STDOUT: %.loc13_34.1: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc13_34.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_34.3: = bound_method %.loc13_34.1, %.loc13_34.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc13_34: init i32 = call %.loc13_34.3(%.loc13_34.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc13_34.4: i32 = value_of_initializer %int.convert_checked.loc13_34 [template = constants.%.31] +// CHECK:STDOUT: %.loc13_34.5: i32 = converted %.loc13_34.1, %.loc13_34.4 [template = constants.%.31] +// CHECK:STDOUT: %int.snegate.loc13: init i32 = call %Negate.ref.loc13(%.loc13_34.5) [template = constants.%.39] +// CHECK:STDOUT: %.loc13_24.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_24.3: = bound_method %.loc13_24.1, %.loc13_24.2 [template = constants.%.36] +// CHECK:STDOUT: %int.convert_checked.loc13_24: init i32 = call %.loc13_24.3(%.loc13_24.1) [template = constants.%.37] +// CHECK:STDOUT: %.loc13_24.4: i32 = value_of_initializer %int.convert_checked.loc13_24 [template = constants.%.37] +// CHECK:STDOUT: %.loc13_24.5: i32 = converted %.loc13_24.1, %.loc13_24.4 [template = constants.%.37] +// CHECK:STDOUT: %.loc13_33.1: i32 = value_of_initializer %int.snegate.loc13 [template = constants.%.39] +// CHECK:STDOUT: %.loc13_33.2: i32 = converted %int.snegate.loc13, %.loc13_33.1 [template = constants.%.39] +// CHECK:STDOUT: %int.less_eq.loc13: init bool = call %LessEq.ref.loc13(%.loc13_24.5, %.loc13_33.2) [template = constants.%.38] +// CHECK:STDOUT: %.loc13_14.1: bool = value_of_initializer %int.less_eq.loc13 [template = constants.%.38] +// CHECK:STDOUT: %.loc13_14.2: bool = converted %int.less_eq.loc13, %.loc13_14.1 [template = constants.%.38] // CHECK:STDOUT: if %.loc13_14.2 br !if.expr.then.loc13 else br !if.expr.else.loc13 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc13: diff --git a/toolchain/check/testdata/builtins/int/make_type_32.carbon b/toolchain/check/testdata/builtins/int/make_type_32.carbon index 458ef40bdd281..846a534284a7f 100644 --- a/toolchain/check/testdata/builtins/int/make_type_32.carbon +++ b/toolchain/check/testdata/builtins/int/make_type_32.carbon @@ -58,12 +58,19 @@ var i: Int() = 0; // CHECK:STDOUT: constants { // CHECK:STDOUT: %Int.type: type = fn_type @Int [template] // CHECK:STDOUT: %Int: %Int.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { -// CHECK:STDOUT: %import_ref: %Int.type = import_ref Main//types, inst+7, loaded [template = constants.%Int] +// CHECK:STDOUT: %import_ref.1: %Int.type = import_ref Main//types, inst+7, loaded [template = constants.%Int] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -71,13 +78,13 @@ var i: Int() = 0; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Int = imports.%import_ref +// CHECK:STDOUT: .Int = imports.%import_ref.1 // CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: .i = %i // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: %Int.ref: %Int.type = name_ref Int, imports.%import_ref [template = constants.%Int] +// CHECK:STDOUT: %Int.ref: %Int.type = name_ref Int, imports.%import_ref.1 [template = constants.%Int] // CHECK:STDOUT: %int.make_type_32: init type = call %Int.ref() [template = i32] // CHECK:STDOUT: %.loc6_12.1: type = value_of_initializer %int.make_type_32 [template = i32] // CHECK:STDOUT: %.loc6_12.2: type = converted %int.make_type_32, %.loc6_12.1 [template = i32] @@ -89,8 +96,12 @@ var i: Int() = 0; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc6: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: assign file.%i.var, %.loc6 +// CHECK:STDOUT: %.loc6_16: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc6_17.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc6_17.2: = bound_method %.loc6_16, %.loc6_17.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc6_17.2(%.loc6_16) [template = constants.%.27] +// CHECK:STDOUT: %.loc6_17.3: init i32 = converted %.loc6_16, %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: assign file.%i.var, %.loc6_17.3 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/make_type_signed.carbon b/toolchain/check/testdata/builtins/int/make_type_signed.carbon index e43387d0fa04f..dfb1e01fa577c 100644 --- a/toolchain/check/testdata/builtins/int/make_type_signed.carbon +++ b/toolchain/check/testdata/builtins/int/make_type_signed.carbon @@ -134,19 +134,27 @@ var m: Int(1000000000); // CHECK:STDOUT: constants { // CHECK:STDOUT: %Int.type: type = fn_type @Int [template] // CHECK:STDOUT: %Int: %Int.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 64 [template] -// CHECK:STDOUT: %.2: type = int_type signed, %.1 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 64 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 64 [template] +// CHECK:STDOUT: %.28: type = int_type signed, %.27 [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %.3: i32 = int_value 13 [template] -// CHECK:STDOUT: %.4: type = int_type signed, %.3 [template] +// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 13 [template] +// CHECK:STDOUT: %.30: = bound_method %.29, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 13 [template] +// CHECK:STDOUT: %.32: type = int_type signed, %.31 [template] // CHECK:STDOUT: %G.type: type = fn_type @G [template] // CHECK:STDOUT: %G: %G.type = struct_value () [template] // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %N: i32 = bind_symbolic_name N, 0 [symbolic] -// CHECK:STDOUT: %N.patt: i32 = symbolic_binding_pattern N, 0 [symbolic] -// CHECK:STDOUT: %.5: type = int_type signed, %N [symbolic] +// CHECK:STDOUT: %N.2: i32 = bind_symbolic_name N, 0 [symbolic] +// CHECK:STDOUT: %N.patt.2: i32 = symbolic_binding_pattern N, 0 [symbolic] +// CHECK:STDOUT: %.33: type = int_type signed, %N.2 [symbolic] // CHECK:STDOUT: %Symbolic.type: type = fn_type @Symbolic [template] // CHECK:STDOUT: %Symbolic: %Symbolic.type = struct_value () [template] // CHECK:STDOUT: } @@ -154,7 +162,8 @@ var m: Int(1000000000); // CHECK:STDOUT: imports { // CHECK:STDOUT: %import_ref.1: %Int.type = import_ref Main//types, inst+22, loaded [template = constants.%Int] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref.2 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 +// CHECK:STDOUT: .Int32 = %import_ref.51 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -171,109 +180,129 @@ var m: Int(1000000000); // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] { -// CHECK:STDOUT: %n.patt: %.2 = binding_pattern n -// CHECK:STDOUT: %n.param_patt: %.2 = value_param_pattern %n.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %.2 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %.2 = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: %n.patt: %.28 = binding_pattern n +// CHECK:STDOUT: %n.param_patt: %.28 = value_param_pattern %n.patt, runtime_param0 +// CHECK:STDOUT: %return.patt: %.28 = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: %.28 = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { // CHECK:STDOUT: %Int.ref.loc6_9: %Int.type = name_ref Int, imports.%import_ref.1 [template = constants.%Int] -// CHECK:STDOUT: %.loc6_13: i32 = int_value 64 [template = constants.%.1] -// CHECK:STDOUT: %int.make_type_signed.loc6_12: init type = call %Int.ref.loc6_9(%.loc6_13) [template = constants.%.2] -// CHECK:STDOUT: %.loc6_15.1: type = value_of_initializer %int.make_type_signed.loc6_12 [template = constants.%.2] -// CHECK:STDOUT: %.loc6_15.2: type = converted %int.make_type_signed.loc6_12, %.loc6_15.1 [template = constants.%.2] +// CHECK:STDOUT: %.loc6_13.1: Core.IntLiteral = int_value 64 [template = constants.%.1] +// CHECK:STDOUT: %.loc6_13.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc6_13.3: = bound_method %.loc6_13.1, %.loc6_13.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc6_13: init i32 = call %.loc6_13.3(%.loc6_13.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc6_13.4: i32 = value_of_initializer %int.convert_checked.loc6_13 [template = constants.%.27] +// CHECK:STDOUT: %.loc6_13.5: i32 = converted %.loc6_13.1, %.loc6_13.4 [template = constants.%.27] +// CHECK:STDOUT: %int.make_type_signed.loc6_12: init type = call %Int.ref.loc6_9(%.loc6_13.5) [template = constants.%.28] +// CHECK:STDOUT: %.loc6_15.1: type = value_of_initializer %int.make_type_signed.loc6_12 [template = constants.%.28] +// CHECK:STDOUT: %.loc6_15.2: type = converted %int.make_type_signed.loc6_12, %.loc6_15.1 [template = constants.%.28] // CHECK:STDOUT: %Int.ref.loc6_21: %Int.type = name_ref Int, imports.%import_ref.1 [template = constants.%Int] -// CHECK:STDOUT: %.loc6_25: i32 = int_value 64 [template = constants.%.1] -// CHECK:STDOUT: %int.make_type_signed.loc6_24: init type = call %Int.ref.loc6_21(%.loc6_25) [template = constants.%.2] -// CHECK:STDOUT: %.loc6_27.1: type = value_of_initializer %int.make_type_signed.loc6_24 [template = constants.%.2] -// CHECK:STDOUT: %.loc6_27.2: type = converted %int.make_type_signed.loc6_24, %.loc6_27.1 [template = constants.%.2] -// CHECK:STDOUT: %n.param: %.2 = value_param runtime_param0 -// CHECK:STDOUT: %n: %.2 = bind_name n, %n.param -// CHECK:STDOUT: %return.param: ref %.2 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %.2 = return_slot %return.param +// CHECK:STDOUT: %.loc6_25.1: Core.IntLiteral = int_value 64 [template = constants.%.1] +// CHECK:STDOUT: %.loc6_25.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc6_25.3: = bound_method %.loc6_25.1, %.loc6_25.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc6_25: init i32 = call %.loc6_25.3(%.loc6_25.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc6_25.4: i32 = value_of_initializer %int.convert_checked.loc6_25 [template = constants.%.27] +// CHECK:STDOUT: %.loc6_25.5: i32 = converted %.loc6_25.1, %.loc6_25.4 [template = constants.%.27] +// CHECK:STDOUT: %int.make_type_signed.loc6_24: init type = call %Int.ref.loc6_21(%.loc6_25.5) [template = constants.%.28] +// CHECK:STDOUT: %.loc6_27.1: type = value_of_initializer %int.make_type_signed.loc6_24 [template = constants.%.28] +// CHECK:STDOUT: %.loc6_27.2: type = converted %int.make_type_signed.loc6_24, %.loc6_27.1 [template = constants.%.28] +// CHECK:STDOUT: %n.param: %.28 = value_param runtime_param0 +// CHECK:STDOUT: %n: %.28 = bind_name n, %n.param +// CHECK:STDOUT: %return.param: ref %.28 = out_param runtime_param1 +// CHECK:STDOUT: %return: ref %.28 = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] { -// CHECK:STDOUT: %n.patt: %.4 = binding_pattern n -// CHECK:STDOUT: %n.param_patt: %.4 = value_param_pattern %n.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %.4 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %.4 = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: %n.patt: %.32 = binding_pattern n +// CHECK:STDOUT: %n.param_patt: %.32 = value_param_pattern %n.patt, runtime_param0 +// CHECK:STDOUT: %return.patt: %.32 = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: %.32 = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { // CHECK:STDOUT: %Int.ref.loc10_9: %Int.type = name_ref Int, imports.%import_ref.1 [template = constants.%Int] -// CHECK:STDOUT: %.loc10_13: i32 = int_value 13 [template = constants.%.3] -// CHECK:STDOUT: %int.make_type_signed.loc10_12: init type = call %Int.ref.loc10_9(%.loc10_13) [template = constants.%.4] -// CHECK:STDOUT: %.loc10_15.1: type = value_of_initializer %int.make_type_signed.loc10_12 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_15.2: type = converted %int.make_type_signed.loc10_12, %.loc10_15.1 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_13.1: Core.IntLiteral = int_value 13 [template = constants.%.29] +// CHECK:STDOUT: %.loc10_13.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc10_13.3: = bound_method %.loc10_13.1, %.loc10_13.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc10_13: init i32 = call %.loc10_13.3(%.loc10_13.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc10_13.4: i32 = value_of_initializer %int.convert_checked.loc10_13 [template = constants.%.31] +// CHECK:STDOUT: %.loc10_13.5: i32 = converted %.loc10_13.1, %.loc10_13.4 [template = constants.%.31] +// CHECK:STDOUT: %int.make_type_signed.loc10_12: init type = call %Int.ref.loc10_9(%.loc10_13.5) [template = constants.%.32] +// CHECK:STDOUT: %.loc10_15.1: type = value_of_initializer %int.make_type_signed.loc10_12 [template = constants.%.32] +// CHECK:STDOUT: %.loc10_15.2: type = converted %int.make_type_signed.loc10_12, %.loc10_15.1 [template = constants.%.32] // CHECK:STDOUT: %Int.ref.loc10_21: %Int.type = name_ref Int, imports.%import_ref.1 [template = constants.%Int] -// CHECK:STDOUT: %.loc10_25: i32 = int_value 13 [template = constants.%.3] -// CHECK:STDOUT: %int.make_type_signed.loc10_24: init type = call %Int.ref.loc10_21(%.loc10_25) [template = constants.%.4] -// CHECK:STDOUT: %.loc10_27.1: type = value_of_initializer %int.make_type_signed.loc10_24 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_27.2: type = converted %int.make_type_signed.loc10_24, %.loc10_27.1 [template = constants.%.4] -// CHECK:STDOUT: %n.param: %.4 = value_param runtime_param0 -// CHECK:STDOUT: %n: %.4 = bind_name n, %n.param -// CHECK:STDOUT: %return.param: ref %.4 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %.4 = return_slot %return.param +// CHECK:STDOUT: %.loc10_25.1: Core.IntLiteral = int_value 13 [template = constants.%.29] +// CHECK:STDOUT: %.loc10_25.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc10_25.3: = bound_method %.loc10_25.1, %.loc10_25.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc10_25: init i32 = call %.loc10_25.3(%.loc10_25.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc10_25.4: i32 = value_of_initializer %int.convert_checked.loc10_25 [template = constants.%.31] +// CHECK:STDOUT: %.loc10_25.5: i32 = converted %.loc10_25.1, %.loc10_25.4 [template = constants.%.31] +// CHECK:STDOUT: %int.make_type_signed.loc10_24: init type = call %Int.ref.loc10_21(%.loc10_25.5) [template = constants.%.32] +// CHECK:STDOUT: %.loc10_27.1: type = value_of_initializer %int.make_type_signed.loc10_24 [template = constants.%.32] +// CHECK:STDOUT: %.loc10_27.2: type = converted %int.make_type_signed.loc10_24, %.loc10_27.1 [template = constants.%.32] +// CHECK:STDOUT: %n.param: %.32 = value_param runtime_param0 +// CHECK:STDOUT: %n: %.32 = bind_name n, %n.param +// CHECK:STDOUT: %return.param: ref %.32 = out_param runtime_param1 +// CHECK:STDOUT: %return: ref %.32 = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: %Symbolic.decl: %Symbolic.type = fn_decl @Symbolic [template = constants.%Symbolic] { -// CHECK:STDOUT: %N.patt.loc14_13.1: i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc14_13.2 (constants.%N.patt)] -// CHECK:STDOUT: %N.param_patt: i32 = value_param_pattern %N.patt.loc14_13.1, runtime_param [symbolic = %N.patt.loc14_13.2 (constants.%N.patt)] -// CHECK:STDOUT: %x.patt: @Symbolic.%.loc14_28 (%.5) = binding_pattern x -// CHECK:STDOUT: %x.param_patt: @Symbolic.%.loc14_28 (%.5) = value_param_pattern %x.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: @Symbolic.%.loc14_28 (%.5) = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: @Symbolic.%.loc14_28 (%.5) = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: %N.patt.loc14_13.1: i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc14_13.2 (constants.%N.patt.2)] +// CHECK:STDOUT: %N.param_patt: i32 = value_param_pattern %N.patt.loc14_13.1, runtime_param [symbolic = %N.patt.loc14_13.2 (constants.%N.patt.2)] +// CHECK:STDOUT: %x.patt: @Symbolic.%.loc14_28 (%.33) = binding_pattern x +// CHECK:STDOUT: %x.param_patt: @Symbolic.%.loc14_28 (%.33) = value_param_pattern %x.patt, runtime_param0 +// CHECK:STDOUT: %return.patt: @Symbolic.%.loc14_28 (%.33) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Symbolic.%.loc14_28 (%.33) = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc14_17.1: type = value_of_initializer %int.make_type_32 [template = i32] // CHECK:STDOUT: %.loc14_17.2: type = converted %int.make_type_32, %.loc14_17.1 [template = i32] // CHECK:STDOUT: %Int.ref.loc14_25: %Int.type = name_ref Int, imports.%import_ref.1 [template = constants.%Int] -// CHECK:STDOUT: %N.ref.loc14_29: i32 = name_ref N, %N.loc14_13.1 [symbolic = %N.loc14_13.2 (constants.%N)] -// CHECK:STDOUT: %int.make_type_signed.loc14_28: init type = call %Int.ref.loc14_25(%N.ref.loc14_29) [symbolic = %.loc14_28 (constants.%.5)] -// CHECK:STDOUT: %.loc14_30.1: type = value_of_initializer %int.make_type_signed.loc14_28 [symbolic = %.loc14_28 (constants.%.5)] -// CHECK:STDOUT: %.loc14_30.2: type = converted %int.make_type_signed.loc14_28, %.loc14_30.1 [symbolic = %.loc14_28 (constants.%.5)] +// CHECK:STDOUT: %N.ref.loc14_29: i32 = name_ref N, %N.loc14_13.1 [symbolic = %N.loc14_13.2 (constants.%N.2)] +// CHECK:STDOUT: %int.make_type_signed.loc14_28: init type = call %Int.ref.loc14_25(%N.ref.loc14_29) [symbolic = %.loc14_28 (constants.%.33)] +// CHECK:STDOUT: %.loc14_30.1: type = value_of_initializer %int.make_type_signed.loc14_28 [symbolic = %.loc14_28 (constants.%.33)] +// CHECK:STDOUT: %.loc14_30.2: type = converted %int.make_type_signed.loc14_28, %.loc14_30.1 [symbolic = %.loc14_28 (constants.%.33)] // CHECK:STDOUT: %Int.ref.loc14_36: %Int.type = name_ref Int, imports.%import_ref.1 [template = constants.%Int] -// CHECK:STDOUT: %N.ref.loc14_40: i32 = name_ref N, %N.loc14_13.1 [symbolic = %N.loc14_13.2 (constants.%N)] -// CHECK:STDOUT: %int.make_type_signed.loc14_39: init type = call %Int.ref.loc14_36(%N.ref.loc14_40) [symbolic = %.loc14_28 (constants.%.5)] -// CHECK:STDOUT: %.loc14_41.1: type = value_of_initializer %int.make_type_signed.loc14_39 [symbolic = %.loc14_28 (constants.%.5)] -// CHECK:STDOUT: %.loc14_41.2: type = converted %int.make_type_signed.loc14_39, %.loc14_41.1 [symbolic = %.loc14_28 (constants.%.5)] +// CHECK:STDOUT: %N.ref.loc14_40: i32 = name_ref N, %N.loc14_13.1 [symbolic = %N.loc14_13.2 (constants.%N.2)] +// CHECK:STDOUT: %int.make_type_signed.loc14_39: init type = call %Int.ref.loc14_36(%N.ref.loc14_40) [symbolic = %.loc14_28 (constants.%.33)] +// CHECK:STDOUT: %.loc14_41.1: type = value_of_initializer %int.make_type_signed.loc14_39 [symbolic = %.loc14_28 (constants.%.33)] +// CHECK:STDOUT: %.loc14_41.2: type = converted %int.make_type_signed.loc14_39, %.loc14_41.1 [symbolic = %.loc14_28 (constants.%.33)] // CHECK:STDOUT: %N.param: i32 = value_param runtime_param -// CHECK:STDOUT: %N.loc14_13.1: i32 = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc14_13.2 (constants.%N)] -// CHECK:STDOUT: %x.param: @Symbolic.%.loc14_28 (%.5) = value_param runtime_param0 -// CHECK:STDOUT: %x: @Symbolic.%.loc14_28 (%.5) = bind_name x, %x.param -// CHECK:STDOUT: %return.param: ref @Symbolic.%.loc14_28 (%.5) = out_param runtime_param1 -// CHECK:STDOUT: %return: ref @Symbolic.%.loc14_28 (%.5) = return_slot %return.param +// CHECK:STDOUT: %N.loc14_13.1: i32 = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc14_13.2 (constants.%N.2)] +// CHECK:STDOUT: %x.param: @Symbolic.%.loc14_28 (%.33) = value_param runtime_param0 +// CHECK:STDOUT: %x: @Symbolic.%.loc14_28 (%.33) = bind_name x, %x.param +// CHECK:STDOUT: %return.param: ref @Symbolic.%.loc14_28 (%.33) = out_param runtime_param1 +// CHECK:STDOUT: %return: ref @Symbolic.%.loc14_28 (%.33) = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Int(%n.param_patt: i32) -> type = "int.make_type_signed"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @F(%n.param_patt: %.2) -> %.2 { +// CHECK:STDOUT: fn @F(%n.param_patt: %.28) -> %.28 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %n.ref: %.2 = name_ref n, %n +// CHECK:STDOUT: %n.ref: %.28 = name_ref n, %n // CHECK:STDOUT: return %n.ref // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @G(%n.param_patt: %.4) -> %.4 { +// CHECK:STDOUT: fn @G(%n.param_patt: %.32) -> %.32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %n.ref: %.4 = name_ref n, %n +// CHECK:STDOUT: %n.ref: %.32 = name_ref n, %n // CHECK:STDOUT: return %n.ref // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @Symbolic(%N.loc14_13.1: i32) { -// CHECK:STDOUT: %N.loc14_13.2: i32 = bind_symbolic_name N, 0 [symbolic = %N.loc14_13.2 (constants.%N)] -// CHECK:STDOUT: %N.patt.loc14_13.2: i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc14_13.2 (constants.%N.patt)] -// CHECK:STDOUT: %.loc14_28: type = int_type signed, %N.loc14_13.2 [symbolic = %.loc14_28 (constants.%.5)] +// CHECK:STDOUT: %N.loc14_13.2: i32 = bind_symbolic_name N, 0 [symbolic = %N.loc14_13.2 (constants.%N.2)] +// CHECK:STDOUT: %N.patt.loc14_13.2: i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc14_13.2 (constants.%N.patt.2)] +// CHECK:STDOUT: %.loc14_28: type = int_type signed, %N.loc14_13.2 [symbolic = %.loc14_28 (constants.%.33)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: fn(%N.param_patt: i32, %x.param_patt: @Symbolic.%.loc14_28 (%.5)) -> @Symbolic.%.loc14_28 (%.5) { +// CHECK:STDOUT: fn(%N.param_patt: i32, %x.param_patt: @Symbolic.%.loc14_28 (%.33)) -> @Symbolic.%.loc14_28 (%.33) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %x.ref: @Symbolic.%.loc14_28 (%.5) = name_ref x, %x +// CHECK:STDOUT: %x.ref: @Symbolic.%.loc14_28 (%.33) = name_ref x, %x // CHECK:STDOUT: return %x.ref // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Symbolic(constants.%N) { -// CHECK:STDOUT: %N.loc14_13.2 => constants.%N -// CHECK:STDOUT: %N.patt.loc14_13.2 => constants.%N -// CHECK:STDOUT: %.loc14_28 => constants.%.5 +// CHECK:STDOUT: specific @Symbolic(constants.%N.2) { +// CHECK:STDOUT: %N.loc14_13.2 => constants.%N.2 +// CHECK:STDOUT: %N.patt.loc14_13.2 => constants.%N.2 +// CHECK:STDOUT: %.loc14_28 => constants.%.33 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- import_types.carbon @@ -281,36 +310,47 @@ var m: Int(1000000000); // CHECK:STDOUT: constants { // CHECK:STDOUT: %Int.type: type = fn_type @Int [template] // CHECK:STDOUT: %Int: %Int.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 64 [template] -// CHECK:STDOUT: %.2: type = int_type signed, %.1 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 64 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 64 [template] +// CHECK:STDOUT: %.28: type = int_type signed, %.27 [template] // CHECK:STDOUT: %UseF.type: type = fn_type @UseF [template] // CHECK:STDOUT: %UseF: %UseF.type = struct_value () [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %.3: i32 = int_value 13 [template] -// CHECK:STDOUT: %.4: type = int_type signed, %.3 [template] +// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 13 [template] +// CHECK:STDOUT: %.30: = bound_method %.29, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 13 [template] +// CHECK:STDOUT: %.32: type = int_type signed, %.31 [template] // CHECK:STDOUT: %UseG.type: type = fn_type @UseG [template] // CHECK:STDOUT: %UseG: %UseG.type = struct_value () [template] // CHECK:STDOUT: %G.type: type = fn_type @G [template] // CHECK:STDOUT: %G: %G.type = struct_value () [template] -// CHECK:STDOUT: %.5: i32 = int_value 24 [template] -// CHECK:STDOUT: %.6: type = int_type signed, %.5 [template] +// CHECK:STDOUT: %.33: Core.IntLiteral = int_value 24 [template] +// CHECK:STDOUT: %.34: = bound_method %.33, %Convert.15 [template] +// CHECK:STDOUT: %.35: i32 = int_value 24 [template] +// CHECK:STDOUT: %.36: type = int_type signed, %.35 [template] // CHECK:STDOUT: %UseSymbolic.type: type = fn_type @UseSymbolic [template] // CHECK:STDOUT: %UseSymbolic: %UseSymbolic.type = struct_value () [template] // CHECK:STDOUT: %Symbolic.type: type = fn_type @Symbolic [template] // CHECK:STDOUT: %Symbolic: %Symbolic.type = struct_value () [template] -// CHECK:STDOUT: %N: i32 = bind_symbolic_name N, 0 [symbolic] -// CHECK:STDOUT: %.7: type = int_type signed, %N [symbolic] -// CHECK:STDOUT: %N.patt: i32 = symbolic_binding_pattern N, 0 [symbolic] -// CHECK:STDOUT: %.8: = specific_function %Symbolic, @Symbolic(%.5) [template] +// CHECK:STDOUT: %N.2: i32 = bind_symbolic_name N, 0 [symbolic] +// CHECK:STDOUT: %.37: type = int_type signed, %N.2 [symbolic] +// CHECK:STDOUT: %N.patt.2: i32 = symbolic_binding_pattern N, 0 [symbolic] +// CHECK:STDOUT: %.38: = specific_function %Symbolic, @Symbolic(%.35) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %import_ref.1: %Int.type = import_ref Main//types, inst+22, loaded [template = constants.%Int] -// CHECK:STDOUT: %import_ref.2: %F.type = import_ref Main//use_types, inst+36, loaded [template = constants.%F] -// CHECK:STDOUT: %import_ref.3: %G.type = import_ref Main//use_types, inst+61, loaded [template = constants.%G] -// CHECK:STDOUT: %import_ref.4: %Symbolic.type = import_ref Main//use_types, inst+101, loaded [template = constants.%Symbolic] +// CHECK:STDOUT: %import_ref.2: %F.type = import_ref Main//use_types, inst+405, loaded [template = constants.%F] +// CHECK:STDOUT: %import_ref.3: %G.type = import_ref Main//use_types, inst+442, loaded [template = constants.%G] +// CHECK:STDOUT: %import_ref.4: %Symbolic.type = import_ref Main//use_types, inst+482, loaded [template = constants.%Symbolic] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { +// CHECK:STDOUT: .ImplicitAs = %import_ref.5 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -330,128 +370,163 @@ var m: Int(1000000000); // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: %UseF.decl: %UseF.type = fn_decl @UseF [template = constants.%UseF] { -// CHECK:STDOUT: %n.patt: %.2 = binding_pattern n -// CHECK:STDOUT: %n.param_patt: %.2 = value_param_pattern %n.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %.2 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %.2 = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: %n.patt: %.28 = binding_pattern n +// CHECK:STDOUT: %n.param_patt: %.28 = value_param_pattern %n.patt, runtime_param0 +// CHECK:STDOUT: %return.patt: %.28 = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: %.28 = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { // CHECK:STDOUT: %Int.ref.loc7_12: %Int.type = name_ref Int, imports.%import_ref.1 [template = constants.%Int] -// CHECK:STDOUT: %.loc7_16: i32 = int_value 64 [template = constants.%.1] -// CHECK:STDOUT: %int.make_type_signed.loc7_15: init type = call %Int.ref.loc7_12(%.loc7_16) [template = constants.%.2] -// CHECK:STDOUT: %.loc7_18.1: type = value_of_initializer %int.make_type_signed.loc7_15 [template = constants.%.2] -// CHECK:STDOUT: %.loc7_18.2: type = converted %int.make_type_signed.loc7_15, %.loc7_18.1 [template = constants.%.2] +// CHECK:STDOUT: %.loc7_16.1: Core.IntLiteral = int_value 64 [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 %.loc7_16.1, %.loc7_16.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc7_16: 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_16 [template = constants.%.27] +// CHECK:STDOUT: %.loc7_16.5: i32 = converted %.loc7_16.1, %.loc7_16.4 [template = constants.%.27] +// CHECK:STDOUT: %int.make_type_signed.loc7_15: init type = call %Int.ref.loc7_12(%.loc7_16.5) [template = constants.%.28] +// CHECK:STDOUT: %.loc7_18.1: type = value_of_initializer %int.make_type_signed.loc7_15 [template = constants.%.28] +// CHECK:STDOUT: %.loc7_18.2: type = converted %int.make_type_signed.loc7_15, %.loc7_18.1 [template = constants.%.28] // CHECK:STDOUT: %Int.ref.loc7_24: %Int.type = name_ref Int, imports.%import_ref.1 [template = constants.%Int] -// CHECK:STDOUT: %.loc7_28: i32 = int_value 64 [template = constants.%.1] -// CHECK:STDOUT: %int.make_type_signed.loc7_27: init type = call %Int.ref.loc7_24(%.loc7_28) [template = constants.%.2] -// CHECK:STDOUT: %.loc7_30.1: type = value_of_initializer %int.make_type_signed.loc7_27 [template = constants.%.2] -// CHECK:STDOUT: %.loc7_30.2: type = converted %int.make_type_signed.loc7_27, %.loc7_30.1 [template = constants.%.2] -// CHECK:STDOUT: %n.param: %.2 = value_param runtime_param0 -// CHECK:STDOUT: %n: %.2 = bind_name n, %n.param -// CHECK:STDOUT: %return.param: ref %.2 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %.2 = return_slot %return.param +// CHECK:STDOUT: %.loc7_28.1: Core.IntLiteral = int_value 64 [template = constants.%.1] +// CHECK:STDOUT: %.loc7_28.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc7_28.3: = bound_method %.loc7_28.1, %.loc7_28.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc7_28: init i32 = call %.loc7_28.3(%.loc7_28.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc7_28.4: i32 = value_of_initializer %int.convert_checked.loc7_28 [template = constants.%.27] +// CHECK:STDOUT: %.loc7_28.5: i32 = converted %.loc7_28.1, %.loc7_28.4 [template = constants.%.27] +// CHECK:STDOUT: %int.make_type_signed.loc7_27: init type = call %Int.ref.loc7_24(%.loc7_28.5) [template = constants.%.28] +// CHECK:STDOUT: %.loc7_30.1: type = value_of_initializer %int.make_type_signed.loc7_27 [template = constants.%.28] +// CHECK:STDOUT: %.loc7_30.2: type = converted %int.make_type_signed.loc7_27, %.loc7_30.1 [template = constants.%.28] +// CHECK:STDOUT: %n.param: %.28 = value_param runtime_param0 +// CHECK:STDOUT: %n: %.28 = bind_name n, %n.param +// CHECK:STDOUT: %return.param: ref %.28 = out_param runtime_param1 +// CHECK:STDOUT: %return: ref %.28 = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: %UseG.decl: %UseG.type = fn_decl @UseG [template = constants.%UseG] { -// CHECK:STDOUT: %n.patt: %.4 = binding_pattern n -// CHECK:STDOUT: %n.param_patt: %.4 = value_param_pattern %n.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %.4 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %.4 = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: %n.patt: %.32 = binding_pattern n +// CHECK:STDOUT: %n.param_patt: %.32 = value_param_pattern %n.patt, runtime_param0 +// CHECK:STDOUT: %return.patt: %.32 = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: %.32 = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { // CHECK:STDOUT: %Int.ref.loc11_12: %Int.type = name_ref Int, imports.%import_ref.1 [template = constants.%Int] -// CHECK:STDOUT: %.loc11_16: i32 = int_value 13 [template = constants.%.3] -// CHECK:STDOUT: %int.make_type_signed.loc11_15: init type = call %Int.ref.loc11_12(%.loc11_16) [template = constants.%.4] -// CHECK:STDOUT: %.loc11_18.1: type = value_of_initializer %int.make_type_signed.loc11_15 [template = constants.%.4] -// CHECK:STDOUT: %.loc11_18.2: type = converted %int.make_type_signed.loc11_15, %.loc11_18.1 [template = constants.%.4] +// CHECK:STDOUT: %.loc11_16.1: Core.IntLiteral = int_value 13 [template = constants.%.29] +// CHECK:STDOUT: %.loc11_16.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_16.3: = bound_method %.loc11_16.1, %.loc11_16.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc11_16: init i32 = call %.loc11_16.3(%.loc11_16.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc11_16.4: i32 = value_of_initializer %int.convert_checked.loc11_16 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_16.5: i32 = converted %.loc11_16.1, %.loc11_16.4 [template = constants.%.31] +// CHECK:STDOUT: %int.make_type_signed.loc11_15: init type = call %Int.ref.loc11_12(%.loc11_16.5) [template = constants.%.32] +// CHECK:STDOUT: %.loc11_18.1: type = value_of_initializer %int.make_type_signed.loc11_15 [template = constants.%.32] +// CHECK:STDOUT: %.loc11_18.2: type = converted %int.make_type_signed.loc11_15, %.loc11_18.1 [template = constants.%.32] // CHECK:STDOUT: %Int.ref.loc11_24: %Int.type = name_ref Int, imports.%import_ref.1 [template = constants.%Int] -// CHECK:STDOUT: %.loc11_28: i32 = int_value 13 [template = constants.%.3] -// CHECK:STDOUT: %int.make_type_signed.loc11_27: init type = call %Int.ref.loc11_24(%.loc11_28) [template = constants.%.4] -// CHECK:STDOUT: %.loc11_30.1: type = value_of_initializer %int.make_type_signed.loc11_27 [template = constants.%.4] -// CHECK:STDOUT: %.loc11_30.2: type = converted %int.make_type_signed.loc11_27, %.loc11_30.1 [template = constants.%.4] -// CHECK:STDOUT: %n.param: %.4 = value_param runtime_param0 -// CHECK:STDOUT: %n: %.4 = bind_name n, %n.param -// CHECK:STDOUT: %return.param: ref %.4 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %.4 = return_slot %return.param +// CHECK:STDOUT: %.loc11_28.1: Core.IntLiteral = int_value 13 [template = constants.%.29] +// CHECK:STDOUT: %.loc11_28.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_28.3: = bound_method %.loc11_28.1, %.loc11_28.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc11_28: init i32 = call %.loc11_28.3(%.loc11_28.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc11_28.4: i32 = value_of_initializer %int.convert_checked.loc11_28 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_28.5: i32 = converted %.loc11_28.1, %.loc11_28.4 [template = constants.%.31] +// CHECK:STDOUT: %int.make_type_signed.loc11_27: init type = call %Int.ref.loc11_24(%.loc11_28.5) [template = constants.%.32] +// CHECK:STDOUT: %.loc11_30.1: type = value_of_initializer %int.make_type_signed.loc11_27 [template = constants.%.32] +// CHECK:STDOUT: %.loc11_30.2: type = converted %int.make_type_signed.loc11_27, %.loc11_30.1 [template = constants.%.32] +// CHECK:STDOUT: %n.param: %.32 = value_param runtime_param0 +// CHECK:STDOUT: %n: %.32 = bind_name n, %n.param +// CHECK:STDOUT: %return.param: ref %.32 = out_param runtime_param1 +// CHECK:STDOUT: %return: ref %.32 = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: %UseSymbolic.decl: %UseSymbolic.type = fn_decl @UseSymbolic [template = constants.%UseSymbolic] { -// CHECK:STDOUT: %n.patt: %.6 = binding_pattern n -// CHECK:STDOUT: %n.param_patt: %.6 = value_param_pattern %n.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %.6 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %.6 = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: %n.patt: %.36 = binding_pattern n +// CHECK:STDOUT: %n.param_patt: %.36 = value_param_pattern %n.patt, runtime_param0 +// CHECK:STDOUT: %return.patt: %.36 = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: %.36 = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { // CHECK:STDOUT: %Int.ref.loc15_19: %Int.type = name_ref Int, imports.%import_ref.1 [template = constants.%Int] -// CHECK:STDOUT: %.loc15_23: i32 = int_value 24 [template = constants.%.5] -// CHECK:STDOUT: %int.make_type_signed.loc15_22: init type = call %Int.ref.loc15_19(%.loc15_23) [template = constants.%.6] -// CHECK:STDOUT: %.loc15_25.1: type = value_of_initializer %int.make_type_signed.loc15_22 [template = constants.%.6] -// CHECK:STDOUT: %.loc15_25.2: type = converted %int.make_type_signed.loc15_22, %.loc15_25.1 [template = constants.%.6] +// CHECK:STDOUT: %.loc15_23.1: Core.IntLiteral = int_value 24 [template = constants.%.33] +// CHECK:STDOUT: %.loc15_23.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc15_23.3: = bound_method %.loc15_23.1, %.loc15_23.2 [template = constants.%.34] +// CHECK:STDOUT: %int.convert_checked.loc15_23: init i32 = call %.loc15_23.3(%.loc15_23.1) [template = constants.%.35] +// CHECK:STDOUT: %.loc15_23.4: i32 = value_of_initializer %int.convert_checked.loc15_23 [template = constants.%.35] +// CHECK:STDOUT: %.loc15_23.5: i32 = converted %.loc15_23.1, %.loc15_23.4 [template = constants.%.35] +// CHECK:STDOUT: %int.make_type_signed.loc15_22: init type = call %Int.ref.loc15_19(%.loc15_23.5) [template = constants.%.36] +// CHECK:STDOUT: %.loc15_25.1: type = value_of_initializer %int.make_type_signed.loc15_22 [template = constants.%.36] +// CHECK:STDOUT: %.loc15_25.2: type = converted %int.make_type_signed.loc15_22, %.loc15_25.1 [template = constants.%.36] // CHECK:STDOUT: %Int.ref.loc15_31: %Int.type = name_ref Int, imports.%import_ref.1 [template = constants.%Int] -// CHECK:STDOUT: %.loc15_35: i32 = int_value 24 [template = constants.%.5] -// CHECK:STDOUT: %int.make_type_signed.loc15_34: init type = call %Int.ref.loc15_31(%.loc15_35) [template = constants.%.6] -// CHECK:STDOUT: %.loc15_37.1: type = value_of_initializer %int.make_type_signed.loc15_34 [template = constants.%.6] -// CHECK:STDOUT: %.loc15_37.2: type = converted %int.make_type_signed.loc15_34, %.loc15_37.1 [template = constants.%.6] -// CHECK:STDOUT: %n.param: %.6 = value_param runtime_param0 -// CHECK:STDOUT: %n: %.6 = bind_name n, %n.param -// CHECK:STDOUT: %return.param: ref %.6 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %.6 = return_slot %return.param +// CHECK:STDOUT: %.loc15_35.1: Core.IntLiteral = int_value 24 [template = constants.%.33] +// CHECK:STDOUT: %.loc15_35.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc15_35.3: = bound_method %.loc15_35.1, %.loc15_35.2 [template = constants.%.34] +// CHECK:STDOUT: %int.convert_checked.loc15_35: init i32 = call %.loc15_35.3(%.loc15_35.1) [template = constants.%.35] +// CHECK:STDOUT: %.loc15_35.4: i32 = value_of_initializer %int.convert_checked.loc15_35 [template = constants.%.35] +// CHECK:STDOUT: %.loc15_35.5: i32 = converted %.loc15_35.1, %.loc15_35.4 [template = constants.%.35] +// CHECK:STDOUT: %int.make_type_signed.loc15_34: init type = call %Int.ref.loc15_31(%.loc15_35.5) [template = constants.%.36] +// CHECK:STDOUT: %.loc15_37.1: type = value_of_initializer %int.make_type_signed.loc15_34 [template = constants.%.36] +// CHECK:STDOUT: %.loc15_37.2: type = converted %int.make_type_signed.loc15_34, %.loc15_37.1 [template = constants.%.36] +// CHECK:STDOUT: %n.param: %.36 = value_param runtime_param0 +// CHECK:STDOUT: %n: %.36 = bind_name n, %n.param +// CHECK:STDOUT: %return.param: ref %.36 = out_param runtime_param1 +// CHECK:STDOUT: %return: ref %.36 = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Int(%n.param_patt: i32) -> type = "int.make_type_signed"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @UseF(%n.param_patt: %.2) -> %.2 { +// CHECK:STDOUT: fn @UseF(%n.param_patt: %.28) -> %.28 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: %F.type = name_ref F, imports.%import_ref.2 [template = constants.%F] -// CHECK:STDOUT: %n.ref: %.2 = name_ref n, %n -// CHECK:STDOUT: %F.call: init %.2 = call %F.ref(%n.ref) -// CHECK:STDOUT: %.loc8_14.1: %.2 = value_of_initializer %F.call -// CHECK:STDOUT: %.loc8_14.2: %.2 = converted %F.call, %.loc8_14.1 +// CHECK:STDOUT: %n.ref: %.28 = name_ref n, %n +// CHECK:STDOUT: %F.call: init %.28 = call %F.ref(%n.ref) +// CHECK:STDOUT: %.loc8_14.1: %.28 = value_of_initializer %F.call +// CHECK:STDOUT: %.loc8_14.2: %.28 = converted %F.call, %.loc8_14.1 // CHECK:STDOUT: return %.loc8_14.2 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F(%n.param_patt: %.2) -> %.2; +// CHECK:STDOUT: fn @F(%n.param_patt: %.28) -> %.28; // CHECK:STDOUT: -// CHECK:STDOUT: fn @UseG(%n.param_patt: %.4) -> %.4 { +// CHECK:STDOUT: fn @UseG(%n.param_patt: %.32) -> %.32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %G.ref: %G.type = name_ref G, imports.%import_ref.3 [template = constants.%G] -// CHECK:STDOUT: %n.ref: %.4 = name_ref n, %n -// CHECK:STDOUT: %G.call: init %.4 = call %G.ref(%n.ref) -// CHECK:STDOUT: %.loc12_14.1: %.4 = value_of_initializer %G.call -// CHECK:STDOUT: %.loc12_14.2: %.4 = converted %G.call, %.loc12_14.1 +// CHECK:STDOUT: %n.ref: %.32 = name_ref n, %n +// CHECK:STDOUT: %G.call: init %.32 = call %G.ref(%n.ref) +// CHECK:STDOUT: %.loc12_14.1: %.32 = value_of_initializer %G.call +// CHECK:STDOUT: %.loc12_14.2: %.32 = converted %G.call, %.loc12_14.1 // CHECK:STDOUT: return %.loc12_14.2 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @G(%n.param_patt: %.4) -> %.4; +// CHECK:STDOUT: fn @G(%n.param_patt: %.32) -> %.32; // CHECK:STDOUT: -// CHECK:STDOUT: fn @UseSymbolic(%n.param_patt: %.6) -> %.6 { +// CHECK:STDOUT: fn @UseSymbolic(%n.param_patt: %.36) -> %.36 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Symbolic.ref: %Symbolic.type = name_ref Symbolic, imports.%import_ref.4 [template = constants.%Symbolic] -// CHECK:STDOUT: %.loc16_19: i32 = int_value 24 [template = constants.%.5] -// CHECK:STDOUT: %n.ref: %.6 = name_ref n, %n -// CHECK:STDOUT: %.loc16_10: = specific_function %Symbolic.ref, @Symbolic(constants.%.5) [template = constants.%.8] -// CHECK:STDOUT: %Symbolic.call: init %.6 = call %.loc16_10(%n.ref) -// CHECK:STDOUT: %.loc16_25.1: %.6 = value_of_initializer %Symbolic.call -// CHECK:STDOUT: %.loc16_25.2: %.6 = converted %Symbolic.call, %.loc16_25.1 +// CHECK:STDOUT: %.loc16_19: Core.IntLiteral = int_value 24 [template = constants.%.33] +// CHECK:STDOUT: %n.ref: %.36 = name_ref n, %n +// CHECK:STDOUT: %.loc16_18.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc16_18.2: = bound_method %.loc16_19, %.loc16_18.1 [template = constants.%.34] +// CHECK:STDOUT: %int.convert_checked.loc16: init i32 = call %.loc16_18.2(%.loc16_19) [template = constants.%.35] +// CHECK:STDOUT: %.loc16_18.3: i32 = value_of_initializer %int.convert_checked.loc16 [template = constants.%.35] +// CHECK:STDOUT: %.loc16_18.4: i32 = converted %.loc16_19, %.loc16_18.3 [template = constants.%.35] +// CHECK:STDOUT: %.loc16_10: = specific_function %Symbolic.ref, @Symbolic(constants.%.35) [template = constants.%.38] +// CHECK:STDOUT: %Symbolic.call: init %.36 = call %.loc16_10(%n.ref) +// CHECK:STDOUT: %.loc16_25.1: %.36 = value_of_initializer %Symbolic.call +// CHECK:STDOUT: %.loc16_25.2: %.36 = converted %Symbolic.call, %.loc16_25.1 // CHECK:STDOUT: return %.loc16_25.2 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Symbolic(constants.%N: i32) { -// CHECK:STDOUT: %N: i32 = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] -// CHECK:STDOUT: %N.patt: i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] -// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: generic fn @Symbolic(constants.%N.2: i32) { +// CHECK:STDOUT: %N: i32 = bind_symbolic_name N, 0 [symbolic = %N (constants.%N.2)] +// CHECK:STDOUT: %N.patt: i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt.2)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.37)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: fn(%N.param_patt: i32, %x.param_patt: @Symbolic.%.1 (%.7)) -> @Symbolic.%.1 (%.7); +// CHECK:STDOUT: fn(%N.param_patt: i32, %x.param_patt: @Symbolic.%.1 (%.37)) -> @Symbolic.%.1 (%.37); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Symbolic(constants.%N) { -// CHECK:STDOUT: %N => constants.%N -// CHECK:STDOUT: %N.patt => constants.%N -// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: specific @Symbolic(constants.%N.2) { +// CHECK:STDOUT: %N => constants.%N.2 +// CHECK:STDOUT: %N.patt => constants.%N.2 +// CHECK:STDOUT: %.1 => constants.%.37 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Symbolic(constants.%.5) { -// CHECK:STDOUT: %N => constants.%.5 -// CHECK:STDOUT: %N.patt => constants.%.5 -// CHECK:STDOUT: %.1 => constants.%.6 +// CHECK:STDOUT: specific @Symbolic(constants.%.35) { +// CHECK:STDOUT: %N => constants.%.35 +// CHECK:STDOUT: %N.patt => constants.%.35 +// CHECK:STDOUT: %.1 => constants.%.36 // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: } @@ -461,12 +536,19 @@ var m: Int(1000000000); // CHECK:STDOUT: constants { // CHECK:STDOUT: %Int.type: type = fn_type @Int [template] // CHECK:STDOUT: %Int: %Int.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { -// CHECK:STDOUT: %import_ref: %Int.type = import_ref Main//types, inst+22, loaded [template = constants.%Int] +// CHECK:STDOUT: %import_ref.1: %Int.type = import_ref Main//types, inst+22, loaded [template = constants.%Int] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -474,15 +556,20 @@ var m: Int(1000000000); // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Int = imports.%import_ref +// CHECK:STDOUT: .Int = imports.%import_ref.1 // CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: .n = %n // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: %Int.ref: %Int.type = name_ref Int, imports.%import_ref [template = constants.%Int] -// CHECK:STDOUT: %.loc10_12: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: %int.make_type_signed: init type = call %Int.ref(%.loc10_12) [template = ] +// CHECK:STDOUT: %Int.ref: %Int.type = name_ref Int, imports.%import_ref.1 [template = constants.%Int] +// CHECK:STDOUT: %.loc10_12.1: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc10_12.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc10_12.3: = bound_method %.loc10_12.1, %.loc10_12.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc10_12.3(%.loc10_12.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc10_12.4: i32 = value_of_initializer %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc10_12.5: i32 = converted %.loc10_12.1, %.loc10_12.4 [template = constants.%.27] +// CHECK:STDOUT: %int.make_type_signed: init type = call %Int.ref(%.loc10_12.5) [template = ] // CHECK:STDOUT: %.loc10_13.1: type = value_of_initializer %int.make_type_signed [template = ] // CHECK:STDOUT: %.loc10_13.2: type = converted %int.make_type_signed, %.loc10_13.1 [template = ] // CHECK:STDOUT: %n.var: ref = var n @@ -500,14 +587,21 @@ var m: Int(1000000000); // CHECK:STDOUT: %Negate: %Negate.type = struct_value () [template] // CHECK:STDOUT: %Int.type: type = fn_type @Int [template] // CHECK:STDOUT: %Int: %Int.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %.2: i32 = int_value -1 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 1 [template] +// CHECK:STDOUT: %.28: i32 = int_value -1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %import_ref.1: %Int.type = import_ref Main//types, inst+22, loaded [template = constants.%Int] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int32 = %import_ref.2 +// CHECK:STDOUT: .ImplicitAs = %import_ref.3 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -541,10 +635,15 @@ var m: Int(1000000000); // CHECK:STDOUT: } // CHECK:STDOUT: %Int.ref: %Int.type = name_ref Int, imports.%import_ref.1 [template = constants.%Int] // CHECK:STDOUT: %Negate.ref: %Negate.type = name_ref Negate, %Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc12_19: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %int.snegate: init i32 = call %Negate.ref(%.loc12_19) [template = constants.%.2] -// CHECK:STDOUT: %.loc12_18.1: i32 = value_of_initializer %int.snegate [template = constants.%.2] -// CHECK:STDOUT: %.loc12_18.2: i32 = converted %int.snegate, %.loc12_18.1 [template = constants.%.2] +// CHECK:STDOUT: %.loc12_19.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc12_19.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_19.3: = bound_method %.loc12_19.1, %.loc12_19.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc12_19.3(%.loc12_19.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc12_19.4: i32 = value_of_initializer %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc12_19.5: i32 = converted %.loc12_19.1, %.loc12_19.4 [template = constants.%.27] +// CHECK:STDOUT: %int.snegate: init i32 = call %Negate.ref(%.loc12_19.5) [template = constants.%.28] +// CHECK:STDOUT: %.loc12_18.1: i32 = value_of_initializer %int.snegate [template = constants.%.28] +// CHECK:STDOUT: %.loc12_18.2: i32 = converted %int.snegate, %.loc12_18.1 [template = constants.%.28] // CHECK:STDOUT: %int.make_type_signed: init type = call %Int.ref(%.loc12_18.2) [template = ] // CHECK:STDOUT: %.loc12_21.1: type = value_of_initializer %int.make_type_signed [template = ] // CHECK:STDOUT: %.loc12_21.2: type = converted %int.make_type_signed, %.loc12_21.1 [template = ] @@ -561,12 +660,19 @@ var m: Int(1000000000); // CHECK:STDOUT: constants { // CHECK:STDOUT: %Int.type: type = fn_type @Int [template] // CHECK:STDOUT: %Int: %Int.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1000000000 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1000000000 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 1000000000 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { -// CHECK:STDOUT: %import_ref: %Int.type = import_ref Main//types, inst+22, loaded [template = constants.%Int] +// CHECK:STDOUT: %import_ref.1: %Int.type = import_ref Main//types, inst+22, loaded [template = constants.%Int] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -574,15 +680,20 @@ var m: Int(1000000000); // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Int = imports.%import_ref +// CHECK:STDOUT: .Int = imports.%import_ref.1 // CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: .m = %m // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: %Int.ref: %Int.type = name_ref Int, imports.%import_ref [template = constants.%Int] -// CHECK:STDOUT: %.loc9_12: i32 = int_value 1000000000 [template = constants.%.1] -// CHECK:STDOUT: %int.make_type_signed: init type = call %Int.ref(%.loc9_12) [template = ] +// CHECK:STDOUT: %Int.ref: %Int.type = name_ref Int, imports.%import_ref.1 [template = constants.%Int] +// CHECK:STDOUT: %.loc9_12.1: Core.IntLiteral = int_value 1000000000 [template = constants.%.1] +// CHECK:STDOUT: %.loc9_12.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_12.3: = bound_method %.loc9_12.1, %.loc9_12.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc9_12.3(%.loc9_12.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc9_12.4: i32 = value_of_initializer %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc9_12.5: i32 = converted %.loc9_12.1, %.loc9_12.4 [template = constants.%.27] +// CHECK:STDOUT: %int.make_type_signed: init type = call %Int.ref(%.loc9_12.5) [template = ] // CHECK:STDOUT: %.loc9_22.1: type = value_of_initializer %int.make_type_signed [template = ] // CHECK:STDOUT: %.loc9_22.2: type = converted %int.make_type_signed, %.loc9_22.1 [template = ] // CHECK:STDOUT: %m.var: ref = var m diff --git a/toolchain/check/testdata/builtins/int/make_type_unsigned.carbon b/toolchain/check/testdata/builtins/int/make_type_unsigned.carbon index bdbae99cae109..7cb91131c4ff4 100644 --- a/toolchain/check/testdata/builtins/int/make_type_unsigned.carbon +++ b/toolchain/check/testdata/builtins/int/make_type_unsigned.carbon @@ -115,19 +115,27 @@ var m: UInt(1000000000); // CHECK:STDOUT: constants { // CHECK:STDOUT: %UInt.type: type = fn_type @UInt [template] // CHECK:STDOUT: %UInt: %UInt.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 64 [template] -// CHECK:STDOUT: %.2: type = int_type unsigned, %.1 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 64 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 64 [template] +// CHECK:STDOUT: %.28: type = int_type unsigned, %.27 [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %.3: i32 = int_value 13 [template] -// CHECK:STDOUT: %.4: type = int_type unsigned, %.3 [template] +// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 13 [template] +// CHECK:STDOUT: %.30: = bound_method %.29, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 13 [template] +// CHECK:STDOUT: %.32: type = int_type unsigned, %.31 [template] // CHECK:STDOUT: %G.type: type = fn_type @G [template] // CHECK:STDOUT: %G: %G.type = struct_value () [template] // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %N: i32 = bind_symbolic_name N, 0 [symbolic] -// CHECK:STDOUT: %N.patt: i32 = symbolic_binding_pattern N, 0 [symbolic] -// CHECK:STDOUT: %.5: type = int_type unsigned, %N [symbolic] +// CHECK:STDOUT: %N.2: i32 = bind_symbolic_name N, 0 [symbolic] +// CHECK:STDOUT: %N.patt.2: i32 = symbolic_binding_pattern N, 0 [symbolic] +// CHECK:STDOUT: %.33: type = int_type unsigned, %N.2 [symbolic] // CHECK:STDOUT: %Symbolic.type: type = fn_type @Symbolic [template] // CHECK:STDOUT: %Symbolic: %Symbolic.type = struct_value () [template] // CHECK:STDOUT: } @@ -135,7 +143,8 @@ var m: UInt(1000000000); // CHECK:STDOUT: imports { // CHECK:STDOUT: %import_ref.1: %UInt.type = import_ref Main//types, inst+22, loaded [template = constants.%UInt] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref.2 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 +// CHECK:STDOUT: .Int32 = %import_ref.51 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -152,109 +161,129 @@ var m: UInt(1000000000); // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] { -// CHECK:STDOUT: %n.patt: %.2 = binding_pattern n -// CHECK:STDOUT: %n.param_patt: %.2 = value_param_pattern %n.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %.2 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %.2 = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: %n.patt: %.28 = binding_pattern n +// CHECK:STDOUT: %n.param_patt: %.28 = value_param_pattern %n.patt, runtime_param0 +// CHECK:STDOUT: %return.patt: %.28 = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: %.28 = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { // CHECK:STDOUT: %UInt.ref.loc6_9: %UInt.type = name_ref UInt, imports.%import_ref.1 [template = constants.%UInt] -// CHECK:STDOUT: %.loc6_14: i32 = int_value 64 [template = constants.%.1] -// CHECK:STDOUT: %int.make_type_unsigned.loc6_13: init type = call %UInt.ref.loc6_9(%.loc6_14) [template = constants.%.2] -// CHECK:STDOUT: %.loc6_16.1: type = value_of_initializer %int.make_type_unsigned.loc6_13 [template = constants.%.2] -// CHECK:STDOUT: %.loc6_16.2: type = converted %int.make_type_unsigned.loc6_13, %.loc6_16.1 [template = constants.%.2] +// CHECK:STDOUT: %.loc6_14.1: Core.IntLiteral = int_value 64 [template = constants.%.1] +// CHECK:STDOUT: %.loc6_14.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc6_14.3: = bound_method %.loc6_14.1, %.loc6_14.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc6_14: init i32 = call %.loc6_14.3(%.loc6_14.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc6_14.4: i32 = value_of_initializer %int.convert_checked.loc6_14 [template = constants.%.27] +// CHECK:STDOUT: %.loc6_14.5: i32 = converted %.loc6_14.1, %.loc6_14.4 [template = constants.%.27] +// CHECK:STDOUT: %int.make_type_unsigned.loc6_13: init type = call %UInt.ref.loc6_9(%.loc6_14.5) [template = constants.%.28] +// CHECK:STDOUT: %.loc6_16.1: type = value_of_initializer %int.make_type_unsigned.loc6_13 [template = constants.%.28] +// CHECK:STDOUT: %.loc6_16.2: type = converted %int.make_type_unsigned.loc6_13, %.loc6_16.1 [template = constants.%.28] // CHECK:STDOUT: %UInt.ref.loc6_22: %UInt.type = name_ref UInt, imports.%import_ref.1 [template = constants.%UInt] -// CHECK:STDOUT: %.loc6_27: i32 = int_value 64 [template = constants.%.1] -// CHECK:STDOUT: %int.make_type_unsigned.loc6_26: init type = call %UInt.ref.loc6_22(%.loc6_27) [template = constants.%.2] -// CHECK:STDOUT: %.loc6_29.1: type = value_of_initializer %int.make_type_unsigned.loc6_26 [template = constants.%.2] -// CHECK:STDOUT: %.loc6_29.2: type = converted %int.make_type_unsigned.loc6_26, %.loc6_29.1 [template = constants.%.2] -// CHECK:STDOUT: %n.param: %.2 = value_param runtime_param0 -// CHECK:STDOUT: %n: %.2 = bind_name n, %n.param -// CHECK:STDOUT: %return.param: ref %.2 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %.2 = return_slot %return.param +// CHECK:STDOUT: %.loc6_27.1: Core.IntLiteral = int_value 64 [template = constants.%.1] +// CHECK:STDOUT: %.loc6_27.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc6_27.3: = bound_method %.loc6_27.1, %.loc6_27.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc6_27: init i32 = call %.loc6_27.3(%.loc6_27.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc6_27.4: i32 = value_of_initializer %int.convert_checked.loc6_27 [template = constants.%.27] +// CHECK:STDOUT: %.loc6_27.5: i32 = converted %.loc6_27.1, %.loc6_27.4 [template = constants.%.27] +// CHECK:STDOUT: %int.make_type_unsigned.loc6_26: init type = call %UInt.ref.loc6_22(%.loc6_27.5) [template = constants.%.28] +// CHECK:STDOUT: %.loc6_29.1: type = value_of_initializer %int.make_type_unsigned.loc6_26 [template = constants.%.28] +// CHECK:STDOUT: %.loc6_29.2: type = converted %int.make_type_unsigned.loc6_26, %.loc6_29.1 [template = constants.%.28] +// CHECK:STDOUT: %n.param: %.28 = value_param runtime_param0 +// CHECK:STDOUT: %n: %.28 = bind_name n, %n.param +// CHECK:STDOUT: %return.param: ref %.28 = out_param runtime_param1 +// CHECK:STDOUT: %return: ref %.28 = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] { -// CHECK:STDOUT: %n.patt: %.4 = binding_pattern n -// CHECK:STDOUT: %n.param_patt: %.4 = value_param_pattern %n.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %.4 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %.4 = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: %n.patt: %.32 = binding_pattern n +// CHECK:STDOUT: %n.param_patt: %.32 = value_param_pattern %n.patt, runtime_param0 +// CHECK:STDOUT: %return.patt: %.32 = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: %.32 = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { // CHECK:STDOUT: %UInt.ref.loc10_9: %UInt.type = name_ref UInt, imports.%import_ref.1 [template = constants.%UInt] -// CHECK:STDOUT: %.loc10_14: i32 = int_value 13 [template = constants.%.3] -// CHECK:STDOUT: %int.make_type_unsigned.loc10_13: init type = call %UInt.ref.loc10_9(%.loc10_14) [template = constants.%.4] -// CHECK:STDOUT: %.loc10_16.1: type = value_of_initializer %int.make_type_unsigned.loc10_13 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_16.2: type = converted %int.make_type_unsigned.loc10_13, %.loc10_16.1 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_14.1: Core.IntLiteral = int_value 13 [template = constants.%.29] +// CHECK:STDOUT: %.loc10_14.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc10_14.3: = bound_method %.loc10_14.1, %.loc10_14.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc10_14: init i32 = call %.loc10_14.3(%.loc10_14.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc10_14.4: i32 = value_of_initializer %int.convert_checked.loc10_14 [template = constants.%.31] +// CHECK:STDOUT: %.loc10_14.5: i32 = converted %.loc10_14.1, %.loc10_14.4 [template = constants.%.31] +// CHECK:STDOUT: %int.make_type_unsigned.loc10_13: init type = call %UInt.ref.loc10_9(%.loc10_14.5) [template = constants.%.32] +// CHECK:STDOUT: %.loc10_16.1: type = value_of_initializer %int.make_type_unsigned.loc10_13 [template = constants.%.32] +// CHECK:STDOUT: %.loc10_16.2: type = converted %int.make_type_unsigned.loc10_13, %.loc10_16.1 [template = constants.%.32] // CHECK:STDOUT: %UInt.ref.loc10_22: %UInt.type = name_ref UInt, imports.%import_ref.1 [template = constants.%UInt] -// CHECK:STDOUT: %.loc10_27: i32 = int_value 13 [template = constants.%.3] -// CHECK:STDOUT: %int.make_type_unsigned.loc10_26: init type = call %UInt.ref.loc10_22(%.loc10_27) [template = constants.%.4] -// CHECK:STDOUT: %.loc10_29.1: type = value_of_initializer %int.make_type_unsigned.loc10_26 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_29.2: type = converted %int.make_type_unsigned.loc10_26, %.loc10_29.1 [template = constants.%.4] -// CHECK:STDOUT: %n.param: %.4 = value_param runtime_param0 -// CHECK:STDOUT: %n: %.4 = bind_name n, %n.param -// CHECK:STDOUT: %return.param: ref %.4 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %.4 = return_slot %return.param +// CHECK:STDOUT: %.loc10_27.1: Core.IntLiteral = int_value 13 [template = constants.%.29] +// CHECK:STDOUT: %.loc10_27.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc10_27.3: = bound_method %.loc10_27.1, %.loc10_27.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc10_27: init i32 = call %.loc10_27.3(%.loc10_27.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc10_27.4: i32 = value_of_initializer %int.convert_checked.loc10_27 [template = constants.%.31] +// CHECK:STDOUT: %.loc10_27.5: i32 = converted %.loc10_27.1, %.loc10_27.4 [template = constants.%.31] +// CHECK:STDOUT: %int.make_type_unsigned.loc10_26: init type = call %UInt.ref.loc10_22(%.loc10_27.5) [template = constants.%.32] +// CHECK:STDOUT: %.loc10_29.1: type = value_of_initializer %int.make_type_unsigned.loc10_26 [template = constants.%.32] +// CHECK:STDOUT: %.loc10_29.2: type = converted %int.make_type_unsigned.loc10_26, %.loc10_29.1 [template = constants.%.32] +// CHECK:STDOUT: %n.param: %.32 = value_param runtime_param0 +// CHECK:STDOUT: %n: %.32 = bind_name n, %n.param +// CHECK:STDOUT: %return.param: ref %.32 = out_param runtime_param1 +// CHECK:STDOUT: %return: ref %.32 = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: %Symbolic.decl: %Symbolic.type = fn_decl @Symbolic [template = constants.%Symbolic] { -// CHECK:STDOUT: %N.patt.loc14_13.1: i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc14_13.2 (constants.%N.patt)] -// CHECK:STDOUT: %N.param_patt: i32 = value_param_pattern %N.patt.loc14_13.1, runtime_param [symbolic = %N.patt.loc14_13.2 (constants.%N.patt)] -// CHECK:STDOUT: %x.patt: @Symbolic.%.loc14_29 (%.5) = binding_pattern x -// CHECK:STDOUT: %x.param_patt: @Symbolic.%.loc14_29 (%.5) = value_param_pattern %x.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: @Symbolic.%.loc14_29 (%.5) = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: @Symbolic.%.loc14_29 (%.5) = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: %N.patt.loc14_13.1: i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc14_13.2 (constants.%N.patt.2)] +// CHECK:STDOUT: %N.param_patt: i32 = value_param_pattern %N.patt.loc14_13.1, runtime_param [symbolic = %N.patt.loc14_13.2 (constants.%N.patt.2)] +// CHECK:STDOUT: %x.patt: @Symbolic.%.loc14_29 (%.33) = binding_pattern x +// CHECK:STDOUT: %x.param_patt: @Symbolic.%.loc14_29 (%.33) = value_param_pattern %x.patt, runtime_param0 +// CHECK:STDOUT: %return.patt: @Symbolic.%.loc14_29 (%.33) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Symbolic.%.loc14_29 (%.33) = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc14_17.1: type = value_of_initializer %int.make_type_32 [template = i32] // CHECK:STDOUT: %.loc14_17.2: type = converted %int.make_type_32, %.loc14_17.1 [template = i32] // CHECK:STDOUT: %UInt.ref.loc14_25: %UInt.type = name_ref UInt, imports.%import_ref.1 [template = constants.%UInt] -// CHECK:STDOUT: %N.ref.loc14_30: i32 = name_ref N, %N.loc14_13.1 [symbolic = %N.loc14_13.2 (constants.%N)] -// CHECK:STDOUT: %int.make_type_unsigned.loc14_29: init type = call %UInt.ref.loc14_25(%N.ref.loc14_30) [symbolic = %.loc14_29 (constants.%.5)] -// CHECK:STDOUT: %.loc14_31.1: type = value_of_initializer %int.make_type_unsigned.loc14_29 [symbolic = %.loc14_29 (constants.%.5)] -// CHECK:STDOUT: %.loc14_31.2: type = converted %int.make_type_unsigned.loc14_29, %.loc14_31.1 [symbolic = %.loc14_29 (constants.%.5)] +// CHECK:STDOUT: %N.ref.loc14_30: i32 = name_ref N, %N.loc14_13.1 [symbolic = %N.loc14_13.2 (constants.%N.2)] +// CHECK:STDOUT: %int.make_type_unsigned.loc14_29: init type = call %UInt.ref.loc14_25(%N.ref.loc14_30) [symbolic = %.loc14_29 (constants.%.33)] +// CHECK:STDOUT: %.loc14_31.1: type = value_of_initializer %int.make_type_unsigned.loc14_29 [symbolic = %.loc14_29 (constants.%.33)] +// CHECK:STDOUT: %.loc14_31.2: type = converted %int.make_type_unsigned.loc14_29, %.loc14_31.1 [symbolic = %.loc14_29 (constants.%.33)] // CHECK:STDOUT: %UInt.ref.loc14_37: %UInt.type = name_ref UInt, imports.%import_ref.1 [template = constants.%UInt] -// CHECK:STDOUT: %N.ref.loc14_42: i32 = name_ref N, %N.loc14_13.1 [symbolic = %N.loc14_13.2 (constants.%N)] -// CHECK:STDOUT: %int.make_type_unsigned.loc14_41: init type = call %UInt.ref.loc14_37(%N.ref.loc14_42) [symbolic = %.loc14_29 (constants.%.5)] -// CHECK:STDOUT: %.loc14_43.1: type = value_of_initializer %int.make_type_unsigned.loc14_41 [symbolic = %.loc14_29 (constants.%.5)] -// CHECK:STDOUT: %.loc14_43.2: type = converted %int.make_type_unsigned.loc14_41, %.loc14_43.1 [symbolic = %.loc14_29 (constants.%.5)] +// CHECK:STDOUT: %N.ref.loc14_42: i32 = name_ref N, %N.loc14_13.1 [symbolic = %N.loc14_13.2 (constants.%N.2)] +// CHECK:STDOUT: %int.make_type_unsigned.loc14_41: init type = call %UInt.ref.loc14_37(%N.ref.loc14_42) [symbolic = %.loc14_29 (constants.%.33)] +// CHECK:STDOUT: %.loc14_43.1: type = value_of_initializer %int.make_type_unsigned.loc14_41 [symbolic = %.loc14_29 (constants.%.33)] +// CHECK:STDOUT: %.loc14_43.2: type = converted %int.make_type_unsigned.loc14_41, %.loc14_43.1 [symbolic = %.loc14_29 (constants.%.33)] // CHECK:STDOUT: %N.param: i32 = value_param runtime_param -// CHECK:STDOUT: %N.loc14_13.1: i32 = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc14_13.2 (constants.%N)] -// CHECK:STDOUT: %x.param: @Symbolic.%.loc14_29 (%.5) = value_param runtime_param0 -// CHECK:STDOUT: %x: @Symbolic.%.loc14_29 (%.5) = bind_name x, %x.param -// CHECK:STDOUT: %return.param: ref @Symbolic.%.loc14_29 (%.5) = out_param runtime_param1 -// CHECK:STDOUT: %return: ref @Symbolic.%.loc14_29 (%.5) = return_slot %return.param +// CHECK:STDOUT: %N.loc14_13.1: i32 = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc14_13.2 (constants.%N.2)] +// CHECK:STDOUT: %x.param: @Symbolic.%.loc14_29 (%.33) = value_param runtime_param0 +// CHECK:STDOUT: %x: @Symbolic.%.loc14_29 (%.33) = bind_name x, %x.param +// CHECK:STDOUT: %return.param: ref @Symbolic.%.loc14_29 (%.33) = out_param runtime_param1 +// CHECK:STDOUT: %return: ref @Symbolic.%.loc14_29 (%.33) = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @UInt(%n.param_patt: i32) -> type = "int.make_type_unsigned"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @F(%n.param_patt: %.2) -> %.2 { +// CHECK:STDOUT: fn @F(%n.param_patt: %.28) -> %.28 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %n.ref: %.2 = name_ref n, %n +// CHECK:STDOUT: %n.ref: %.28 = name_ref n, %n // CHECK:STDOUT: return %n.ref // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @G(%n.param_patt: %.4) -> %.4 { +// CHECK:STDOUT: fn @G(%n.param_patt: %.32) -> %.32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %n.ref: %.4 = name_ref n, %n +// CHECK:STDOUT: %n.ref: %.32 = name_ref n, %n // CHECK:STDOUT: return %n.ref // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @Symbolic(%N.loc14_13.1: i32) { -// CHECK:STDOUT: %N.loc14_13.2: i32 = bind_symbolic_name N, 0 [symbolic = %N.loc14_13.2 (constants.%N)] -// CHECK:STDOUT: %N.patt.loc14_13.2: i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc14_13.2 (constants.%N.patt)] -// CHECK:STDOUT: %.loc14_29: type = int_type unsigned, %N.loc14_13.2 [symbolic = %.loc14_29 (constants.%.5)] +// CHECK:STDOUT: %N.loc14_13.2: i32 = bind_symbolic_name N, 0 [symbolic = %N.loc14_13.2 (constants.%N.2)] +// CHECK:STDOUT: %N.patt.loc14_13.2: i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc14_13.2 (constants.%N.patt.2)] +// CHECK:STDOUT: %.loc14_29: type = int_type unsigned, %N.loc14_13.2 [symbolic = %.loc14_29 (constants.%.33)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: fn(%N.param_patt: i32, %x.param_patt: @Symbolic.%.loc14_29 (%.5)) -> @Symbolic.%.loc14_29 (%.5) { +// CHECK:STDOUT: fn(%N.param_patt: i32, %x.param_patt: @Symbolic.%.loc14_29 (%.33)) -> @Symbolic.%.loc14_29 (%.33) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %x.ref: @Symbolic.%.loc14_29 (%.5) = name_ref x, %x +// CHECK:STDOUT: %x.ref: @Symbolic.%.loc14_29 (%.33) = name_ref x, %x // CHECK:STDOUT: return %x.ref // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Symbolic(constants.%N) { -// CHECK:STDOUT: %N.loc14_13.2 => constants.%N -// CHECK:STDOUT: %N.patt.loc14_13.2 => constants.%N -// CHECK:STDOUT: %.loc14_29 => constants.%.5 +// CHECK:STDOUT: specific @Symbolic(constants.%N.2) { +// CHECK:STDOUT: %N.loc14_13.2 => constants.%N.2 +// CHECK:STDOUT: %N.patt.loc14_13.2 => constants.%N.2 +// CHECK:STDOUT: %.loc14_29 => constants.%.33 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_zero_size.carbon @@ -262,12 +291,19 @@ var m: UInt(1000000000); // CHECK:STDOUT: constants { // CHECK:STDOUT: %UInt.type: type = fn_type @UInt [template] // CHECK:STDOUT: %UInt: %UInt.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { -// CHECK:STDOUT: %import_ref: %UInt.type = import_ref Main//types, inst+22, loaded [template = constants.%UInt] +// CHECK:STDOUT: %import_ref.1: %UInt.type = import_ref Main//types, inst+22, loaded [template = constants.%UInt] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -275,15 +311,20 @@ var m: UInt(1000000000); // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .UInt = imports.%import_ref +// CHECK:STDOUT: .UInt = imports.%import_ref.1 // CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: .n = %n // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: %UInt.ref: %UInt.type = name_ref UInt, imports.%import_ref [template = constants.%UInt] -// CHECK:STDOUT: %.loc10_13: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: %int.make_type_unsigned: init type = call %UInt.ref(%.loc10_13) [template = ] +// CHECK:STDOUT: %UInt.ref: %UInt.type = name_ref UInt, imports.%import_ref.1 [template = constants.%UInt] +// CHECK:STDOUT: %.loc10_13.1: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc10_13.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc10_13.3: = bound_method %.loc10_13.1, %.loc10_13.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc10_13.3(%.loc10_13.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc10_13.4: i32 = value_of_initializer %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc10_13.5: i32 = converted %.loc10_13.1, %.loc10_13.4 [template = constants.%.27] +// CHECK:STDOUT: %int.make_type_unsigned: init type = call %UInt.ref(%.loc10_13.5) [template = ] // CHECK:STDOUT: %.loc10_14.1: type = value_of_initializer %int.make_type_unsigned [template = ] // CHECK:STDOUT: %.loc10_14.2: type = converted %int.make_type_unsigned, %.loc10_14.1 [template = ] // CHECK:STDOUT: %n.var: ref = var n @@ -301,14 +342,21 @@ var m: UInt(1000000000); // CHECK:STDOUT: %Negate: %Negate.type = struct_value () [template] // CHECK:STDOUT: %UInt.type: type = fn_type @UInt [template] // CHECK:STDOUT: %UInt: %UInt.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %.2: i32 = int_value -1 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 1 [template] +// CHECK:STDOUT: %.28: i32 = int_value -1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %import_ref.1: %UInt.type = import_ref Main//types, inst+22, loaded [template = constants.%UInt] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int32 = %import_ref.2 +// CHECK:STDOUT: .ImplicitAs = %import_ref.3 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -342,10 +390,15 @@ var m: UInt(1000000000); // CHECK:STDOUT: } // CHECK:STDOUT: %UInt.ref: %UInt.type = name_ref UInt, imports.%import_ref.1 [template = constants.%UInt] // CHECK:STDOUT: %Negate.ref: %Negate.type = name_ref Negate, %Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc12_20: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %int.snegate: init i32 = call %Negate.ref(%.loc12_20) [template = constants.%.2] -// CHECK:STDOUT: %.loc12_19.1: i32 = value_of_initializer %int.snegate [template = constants.%.2] -// CHECK:STDOUT: %.loc12_19.2: i32 = converted %int.snegate, %.loc12_19.1 [template = constants.%.2] +// CHECK:STDOUT: %.loc12_20.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc12_20.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_20.3: = bound_method %.loc12_20.1, %.loc12_20.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc12_20.3(%.loc12_20.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc12_20.4: i32 = value_of_initializer %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc12_20.5: i32 = converted %.loc12_20.1, %.loc12_20.4 [template = constants.%.27] +// CHECK:STDOUT: %int.snegate: init i32 = call %Negate.ref(%.loc12_20.5) [template = constants.%.28] +// CHECK:STDOUT: %.loc12_19.1: i32 = value_of_initializer %int.snegate [template = constants.%.28] +// CHECK:STDOUT: %.loc12_19.2: i32 = converted %int.snegate, %.loc12_19.1 [template = constants.%.28] // CHECK:STDOUT: %int.make_type_unsigned: init type = call %UInt.ref(%.loc12_19.2) [template = ] // CHECK:STDOUT: %.loc12_22.1: type = value_of_initializer %int.make_type_unsigned [template = ] // CHECK:STDOUT: %.loc12_22.2: type = converted %int.make_type_unsigned, %.loc12_22.1 [template = ] @@ -362,12 +415,19 @@ var m: UInt(1000000000); // CHECK:STDOUT: constants { // CHECK:STDOUT: %UInt.type: type = fn_type @UInt [template] // CHECK:STDOUT: %UInt: %UInt.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1000000000 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1000000000 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 1000000000 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { -// CHECK:STDOUT: %import_ref: %UInt.type = import_ref Main//types, inst+22, loaded [template = constants.%UInt] +// CHECK:STDOUT: %import_ref.1: %UInt.type = import_ref Main//types, inst+22, loaded [template = constants.%UInt] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -375,15 +435,20 @@ var m: UInt(1000000000); // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .UInt = imports.%import_ref +// CHECK:STDOUT: .UInt = imports.%import_ref.1 // CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: .m = %m // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: %UInt.ref: %UInt.type = name_ref UInt, imports.%import_ref [template = constants.%UInt] -// CHECK:STDOUT: %.loc9_13: i32 = int_value 1000000000 [template = constants.%.1] -// CHECK:STDOUT: %int.make_type_unsigned: init type = call %UInt.ref(%.loc9_13) [template = ] +// CHECK:STDOUT: %UInt.ref: %UInt.type = name_ref UInt, imports.%import_ref.1 [template = constants.%UInt] +// CHECK:STDOUT: %.loc9_13.1: Core.IntLiteral = int_value 1000000000 [template = constants.%.1] +// CHECK:STDOUT: %.loc9_13.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_13.3: = bound_method %.loc9_13.1, %.loc9_13.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc9_13.3(%.loc9_13.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc9_13.4: i32 = value_of_initializer %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc9_13.5: i32 = converted %.loc9_13.1, %.loc9_13.4 [template = constants.%.27] +// CHECK:STDOUT: %int.make_type_unsigned: init type = call %UInt.ref(%.loc9_13.5) [template = ] // CHECK:STDOUT: %.loc9_23.1: type = value_of_initializer %int.make_type_unsigned [template = ] // CHECK:STDOUT: %.loc9_23.2: type = converted %int.make_type_unsigned, %.loc9_23.1 [template = ] // CHECK:STDOUT: %m.var: ref = var m diff --git a/toolchain/check/testdata/builtins/int/neq.carbon b/toolchain/check/testdata/builtins/int/neq.carbon index ccc5c05bddbb6..0c06083bfd535 100644 --- a/toolchain/check/testdata/builtins/int/neq.carbon +++ b/toolchain/check/testdata/builtins/int/neq.carbon @@ -39,10 +39,18 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %False: type = class_type @False [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %.4: i32 = int_value 1 [template] -// CHECK:STDOUT: %.5: bool = bool_literal false [template] -// CHECK:STDOUT: %.6: i32 = int_value 2 [template] -// CHECK:STDOUT: %.7: bool = bool_literal true [template] +// CHECK:STDOUT: %.4: 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: %.28: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.29: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 1 [template] +// CHECK:STDOUT: %.31: bool = bool_literal false [template] +// CHECK:STDOUT: %.32: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.33: = bound_method %.32, %Convert.15 [template] +// CHECK:STDOUT: %.34: i32 = int_value 2 [template] +// CHECK:STDOUT: %.35: bool = bool_literal true [template] // CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] // CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] // CHECK:STDOUT: } @@ -51,6 +59,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int32 = %import_ref.1 // CHECK:STDOUT: .Bool = %import_ref.2 +// CHECK:STDOUT: .ImplicitAs = %import_ref.3 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -151,11 +160,21 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %false_.ref: %False = name_ref false_, %false_ // CHECK:STDOUT: %Neq.ref.loc8: %Neq.type = name_ref Neq, file.%Neq.decl [template = constants.%Neq] -// CHECK:STDOUT: %.loc8_21: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc8_24: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %int.neq.loc8: init bool = call %Neq.ref.loc8(%.loc8_21, %.loc8_24) [template = constants.%.5] -// CHECK:STDOUT: %.loc8_14.1: bool = value_of_initializer %int.neq.loc8 [template = constants.%.5] -// CHECK:STDOUT: %.loc8_14.2: bool = converted %int.neq.loc8, %.loc8_14.1 [template = constants.%.5] +// CHECK:STDOUT: %.loc8_21.1: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc8_24.1: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc8_21.2: %Convert.type.2 = interface_witness_access constants.%.28, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc8_21.3: = bound_method %.loc8_21.1, %.loc8_21.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc8_21: init i32 = call %.loc8_21.3(%.loc8_21.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc8_21.4: i32 = value_of_initializer %int.convert_checked.loc8_21 [template = constants.%.30] +// CHECK:STDOUT: %.loc8_21.5: i32 = converted %.loc8_21.1, %.loc8_21.4 [template = constants.%.30] +// CHECK:STDOUT: %.loc8_24.2: %Convert.type.2 = interface_witness_access constants.%.28, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc8_24.3: = bound_method %.loc8_24.1, %.loc8_24.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc8_24: init i32 = call %.loc8_24.3(%.loc8_24.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc8_24.4: i32 = value_of_initializer %int.convert_checked.loc8_24 [template = constants.%.30] +// CHECK:STDOUT: %.loc8_24.5: i32 = converted %.loc8_24.1, %.loc8_24.4 [template = constants.%.30] +// CHECK:STDOUT: %int.neq.loc8: init bool = call %Neq.ref.loc8(%.loc8_21.5, %.loc8_24.5) [template = constants.%.31] +// CHECK:STDOUT: %.loc8_14.1: bool = value_of_initializer %int.neq.loc8 [template = constants.%.31] +// CHECK:STDOUT: %.loc8_14.2: bool = converted %int.neq.loc8, %.loc8_14.1 [template = constants.%.31] // CHECK:STDOUT: if %.loc8_14.2 br !if.expr.then.loc8 else br !if.expr.else.loc8 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc8: @@ -170,11 +189,21 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %.loc8_14.3: type = block_arg !if.expr.result.loc8 [template = constants.%False] // CHECK:STDOUT: %true_.ref: %True = name_ref true_, %true_ // CHECK:STDOUT: %Neq.ref.loc9: %Neq.type = name_ref Neq, file.%Neq.decl [template = constants.%Neq] -// CHECK:STDOUT: %.loc9_20: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc9_23: i32 = int_value 2 [template = constants.%.6] -// CHECK:STDOUT: %int.neq.loc9: init bool = call %Neq.ref.loc9(%.loc9_20, %.loc9_23) [template = constants.%.7] -// CHECK:STDOUT: %.loc9_13.1: bool = value_of_initializer %int.neq.loc9 [template = constants.%.7] -// CHECK:STDOUT: %.loc9_13.2: bool = converted %int.neq.loc9, %.loc9_13.1 [template = constants.%.7] +// CHECK:STDOUT: %.loc9_20.1: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc9_23.1: Core.IntLiteral = int_value 2 [template = constants.%.32] +// CHECK:STDOUT: %.loc9_20.2: %Convert.type.2 = interface_witness_access constants.%.28, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_20.3: = bound_method %.loc9_20.1, %.loc9_20.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc9_20: init i32 = call %.loc9_20.3(%.loc9_20.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc9_20.4: i32 = value_of_initializer %int.convert_checked.loc9_20 [template = constants.%.30] +// CHECK:STDOUT: %.loc9_20.5: i32 = converted %.loc9_20.1, %.loc9_20.4 [template = constants.%.30] +// CHECK:STDOUT: %.loc9_23.2: %Convert.type.2 = interface_witness_access constants.%.28, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_23.3: = bound_method %.loc9_23.1, %.loc9_23.2 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc9_23: init i32 = call %.loc9_23.3(%.loc9_23.1) [template = constants.%.34] +// CHECK:STDOUT: %.loc9_23.4: i32 = value_of_initializer %int.convert_checked.loc9_23 [template = constants.%.34] +// CHECK:STDOUT: %.loc9_23.5: i32 = converted %.loc9_23.1, %.loc9_23.4 [template = constants.%.34] +// CHECK:STDOUT: %int.neq.loc9: init bool = call %Neq.ref.loc9(%.loc9_20.5, %.loc9_23.5) [template = constants.%.35] +// CHECK:STDOUT: %.loc9_13.1: bool = value_of_initializer %int.neq.loc9 [template = constants.%.35] +// CHECK:STDOUT: %.loc9_13.2: bool = converted %int.neq.loc9, %.loc9_13.1 [template = constants.%.35] // CHECK:STDOUT: if %.loc9_13.2 br !if.expr.then.loc9 else br !if.expr.else.loc9 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc9: diff --git a/toolchain/check/testdata/builtins/int/or.carbon b/toolchain/check/testdata/builtins/int/or.carbon index 790e326893b7d..234b4aead0582 100644 --- a/toolchain/check/testdata/builtins/int/or.carbon +++ b/toolchain/check/testdata/builtins/int/or.carbon @@ -26,17 +26,25 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %Or.type: type = fn_type @Or [template] // CHECK:STDOUT: %Or: %Or.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 12 [template] -// CHECK:STDOUT: %.2: i32 = int_value 10 [template] -// CHECK:STDOUT: %.3: i32 = int_value 14 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 12 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 10 [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(i32) [template] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] // CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template] // CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template] -// CHECK:STDOUT: %.27: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.28: = bound_method %.3, %Convert.15 [template] -// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 14 [template] -// CHECK:STDOUT: %.30: type = array_type %.29, i32 [template] -// CHECK:STDOUT: %.31: type = ptr_type %.30 [template] +// CHECK:STDOUT: %.26: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 12 [template] +// CHECK:STDOUT: %.29: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 10 [template] +// CHECK:STDOUT: %.31: i32 = int_value 14 [template] +// CHECK:STDOUT: %Convert.type.16: type = fn_type @Convert.12 [template] +// CHECK:STDOUT: %Convert.16: %Convert.type.16 = struct_value () [template] +// CHECK:STDOUT: %.32: = interface_witness (%Convert.16) [template] +// CHECK:STDOUT: %.33: = bound_method %.31, %Convert.16 [template] +// CHECK:STDOUT: %.34: Core.IntLiteral = int_value 14 [template] +// CHECK:STDOUT: %.35: type = array_type %.34, i32 [template] +// CHECK:STDOUT: %.36: type = ptr_type %.35 [template] // CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] // CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] // CHECK:STDOUT: } @@ -85,32 +93,37 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %Or.ref: %Or.type = name_ref Or, %Or.decl [template = constants.%Or] -// CHECK:STDOUT: %.loc4_19: i32 = int_value 12 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_23: i32 = int_value 10 [template = constants.%.2] -// CHECK:STDOUT: %int.or: init i32 = call %Or.ref(%.loc4_19, %.loc4_23) [template = constants.%.3] +// CHECK:STDOUT: %.loc4_19.1: Core.IntLiteral = int_value 12 [template = constants.%.1] +// CHECK:STDOUT: %.loc4_23.1: Core.IntLiteral = int_value 10 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_19.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_19.3: = bound_method %.loc4_19.1, %.loc4_19.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc4_19: init i32 = call %.loc4_19.3(%.loc4_19.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc4_19.4: i32 = value_of_initializer %int.convert_checked.loc4_19 [template = constants.%.28] +// CHECK:STDOUT: %.loc4_19.5: i32 = converted %.loc4_19.1, %.loc4_19.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc4_23.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_23.3: = bound_method %.loc4_23.1, %.loc4_23.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc4_23: init i32 = call %.loc4_23.3(%.loc4_23.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc4_23.4: i32 = value_of_initializer %int.convert_checked.loc4_23 [template = constants.%.30] +// CHECK:STDOUT: %.loc4_23.5: i32 = converted %.loc4_23.1, %.loc4_23.4 [template = constants.%.30] +// CHECK:STDOUT: %int.or: init i32 = call %Or.ref(%.loc4_19.5, %.loc4_23.5) [template = constants.%.31] // CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] // CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4, %.loc4_11.1 [template = i32] -// CHECK:STDOUT: %.loc4_18.1: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc4_18.2: = bound_method %int.or, %.loc4_18.1 [template = constants.%.28] -// CHECK:STDOUT: %.loc4_18.3: i32 = value_of_initializer %int.or [template = constants.%.3] -// CHECK:STDOUT: %.loc4_18.4: i32 = converted %int.or, %.loc4_18.3 [template = constants.%.3] -// CHECK:STDOUT: %int.convert_checked.loc4: init Core.IntLiteral = call %.loc4_18.2(%.loc4_18.4) [template = constants.%.29] -// CHECK:STDOUT: %.loc4_18.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4 [template = constants.%.29] -// CHECK:STDOUT: %.loc4_18.6: Core.IntLiteral = converted %int.or, %.loc4_18.5 [template = constants.%.29] -// CHECK:STDOUT: %.loc4_26: type = array_type %.loc4_18.6, i32 [template = constants.%.30] -// CHECK:STDOUT: %arr.var: ref %.30 = var arr -// CHECK:STDOUT: %arr: ref %.30 = bind_name arr, %arr.var +// CHECK:STDOUT: %.loc4_18.1: %Convert.type.5 = interface_witness_access constants.%.32, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %.loc4_18.2: = bound_method %int.or, %.loc4_18.1 [template = constants.%.33] +// CHECK:STDOUT: %.loc4_18.3: i32 = value_of_initializer %int.or [template = constants.%.31] +// CHECK:STDOUT: %.loc4_18.4: i32 = converted %int.or, %.loc4_18.3 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc4_18: init Core.IntLiteral = call %.loc4_18.2(%.loc4_18.4) [template = constants.%.34] +// CHECK:STDOUT: %.loc4_18.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4_18 [template = constants.%.34] +// CHECK:STDOUT: %.loc4_18.6: Core.IntLiteral = converted %int.or, %.loc4_18.5 [template = constants.%.34] +// CHECK:STDOUT: %.loc4_26: type = array_type %.loc4_18.6, i32 [template = constants.%.35] +// CHECK:STDOUT: %arr.var: ref %.35 = var arr +// CHECK:STDOUT: %arr: ref %.35 = bind_name arr, %arr.var // CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc5_18.1: i32 = int_value 14 [template = constants.%.3] +// CHECK:STDOUT: %.loc5_18: Core.IntLiteral = int_value 14 [template = constants.%.34] // CHECK:STDOUT: %.loc5_13.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] // CHECK:STDOUT: %.loc5_13.2: type = converted %int.make_type_32.loc5, %.loc5_13.1 [template = i32] -// CHECK:STDOUT: %.loc5_18.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc5_18.3: = bound_method %.loc5_18.1, %.loc5_18.2 [template = constants.%.28] -// CHECK:STDOUT: %int.convert_checked.loc5: init Core.IntLiteral = call %.loc5_18.3(%.loc5_18.1) [template = constants.%.29] -// CHECK:STDOUT: %.loc5_18.4: Core.IntLiteral = value_of_initializer %int.convert_checked.loc5 [template = constants.%.29] -// CHECK:STDOUT: %.loc5_18.5: Core.IntLiteral = converted %.loc5_18.1, %.loc5_18.4 [template = constants.%.29] -// CHECK:STDOUT: %.loc5_20: type = array_type %.loc5_18.5, i32 [template = constants.%.30] -// CHECK:STDOUT: %.loc5_21: type = ptr_type %.30 [template = constants.%.31] +// CHECK:STDOUT: %.loc5_20: type = array_type %.loc5_18, i32 [template = constants.%.35] +// CHECK:STDOUT: %.loc5_21: type = ptr_type %.35 [template = constants.%.36] // CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { // CHECK:STDOUT: %a.patt: i32 = binding_pattern a // CHECK:STDOUT: %a.param_patt: i32 = value_param_pattern %a.patt, runtime_param0 @@ -152,9 +165,9 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %.30 = name_ref arr, file.%arr -// CHECK:STDOUT: %.loc5: %.31 = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %.31 = bind_name arr_p, %.loc5 +// CHECK:STDOUT: %arr.ref: ref %.35 = name_ref arr, file.%arr +// CHECK:STDOUT: %.loc5: %.36 = addr_of %arr.ref +// CHECK:STDOUT: %arr_p: %.36 = bind_name arr_p, %.loc5 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/right_shift.carbon b/toolchain/check/testdata/builtins/int/right_shift.carbon index 164712ae0412a..b6e3c3dd24dca 100644 --- a/toolchain/check/testdata/builtins/int/right_shift.carbon +++ b/toolchain/check/testdata/builtins/int/right_shift.carbon @@ -71,17 +71,25 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %RightShift.type: type = fn_type @RightShift [template] // CHECK:STDOUT: %RightShift: %RightShift.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 22 [template] -// CHECK:STDOUT: %.2: i32 = int_value 2 [template] -// CHECK:STDOUT: %.3: i32 = int_value 5 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 22 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(i32) [template] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] // CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template] // CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template] -// CHECK:STDOUT: %.27: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.28: = bound_method %.3, %Convert.15 [template] -// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 5 [template] -// CHECK:STDOUT: %.30: type = array_type %.29, i32 [template] -// CHECK:STDOUT: %.31: type = ptr_type %.30 [template] +// CHECK:STDOUT: %.26: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 22 [template] +// CHECK:STDOUT: %.29: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 2 [template] +// CHECK:STDOUT: %.31: i32 = int_value 5 [template] +// CHECK:STDOUT: %Convert.type.16: type = fn_type @Convert.12 [template] +// CHECK:STDOUT: %Convert.16: %Convert.type.16 = struct_value () [template] +// CHECK:STDOUT: %.32: = interface_witness (%Convert.16) [template] +// CHECK:STDOUT: %.33: = bound_method %.31, %Convert.16 [template] +// CHECK:STDOUT: %.34: Core.IntLiteral = int_value 5 [template] +// CHECK:STDOUT: %.35: type = array_type %.34, i32 [template] +// CHECK:STDOUT: %.36: type = ptr_type %.35 [template] // CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] // CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] // CHECK:STDOUT: } @@ -130,32 +138,37 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: } // CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %RightShift.ref: %RightShift.type = name_ref RightShift, %RightShift.decl [template = constants.%RightShift] -// CHECK:STDOUT: %.loc4_27: i32 = int_value 22 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_31: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: %int.right_shift: init i32 = call %RightShift.ref(%.loc4_27, %.loc4_31) [template = constants.%.3] +// CHECK:STDOUT: %.loc4_27.1: Core.IntLiteral = int_value 22 [template = constants.%.1] +// CHECK:STDOUT: %.loc4_31.1: Core.IntLiteral = int_value 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_27.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_27.3: = bound_method %.loc4_27.1, %.loc4_27.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc4_27: init i32 = call %.loc4_27.3(%.loc4_27.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc4_27.4: i32 = value_of_initializer %int.convert_checked.loc4_27 [template = constants.%.28] +// CHECK:STDOUT: %.loc4_27.5: i32 = converted %.loc4_27.1, %.loc4_27.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc4_31.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_31.3: = bound_method %.loc4_31.1, %.loc4_31.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc4_31: init i32 = call %.loc4_31.3(%.loc4_31.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc4_31.4: i32 = value_of_initializer %int.convert_checked.loc4_31 [template = constants.%.30] +// CHECK:STDOUT: %.loc4_31.5: i32 = converted %.loc4_31.1, %.loc4_31.4 [template = constants.%.30] +// CHECK:STDOUT: %int.right_shift: init i32 = call %RightShift.ref(%.loc4_27.5, %.loc4_31.5) [template = constants.%.31] // CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] // CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4, %.loc4_11.1 [template = i32] -// CHECK:STDOUT: %.loc4_26.1: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc4_26.2: = bound_method %int.right_shift, %.loc4_26.1 [template = constants.%.28] -// CHECK:STDOUT: %.loc4_26.3: i32 = value_of_initializer %int.right_shift [template = constants.%.3] -// CHECK:STDOUT: %.loc4_26.4: i32 = converted %int.right_shift, %.loc4_26.3 [template = constants.%.3] -// CHECK:STDOUT: %int.convert_checked.loc4: init Core.IntLiteral = call %.loc4_26.2(%.loc4_26.4) [template = constants.%.29] -// CHECK:STDOUT: %.loc4_26.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4 [template = constants.%.29] -// CHECK:STDOUT: %.loc4_26.6: Core.IntLiteral = converted %int.right_shift, %.loc4_26.5 [template = constants.%.29] -// CHECK:STDOUT: %.loc4_33: type = array_type %.loc4_26.6, i32 [template = constants.%.30] -// CHECK:STDOUT: %arr.var: ref %.30 = var arr -// CHECK:STDOUT: %arr: ref %.30 = bind_name arr, %arr.var +// CHECK:STDOUT: %.loc4_26.1: %Convert.type.5 = interface_witness_access constants.%.32, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %.loc4_26.2: = bound_method %int.right_shift, %.loc4_26.1 [template = constants.%.33] +// CHECK:STDOUT: %.loc4_26.3: i32 = value_of_initializer %int.right_shift [template = constants.%.31] +// CHECK:STDOUT: %.loc4_26.4: i32 = converted %int.right_shift, %.loc4_26.3 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc4_26: init Core.IntLiteral = call %.loc4_26.2(%.loc4_26.4) [template = constants.%.34] +// CHECK:STDOUT: %.loc4_26.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4_26 [template = constants.%.34] +// CHECK:STDOUT: %.loc4_26.6: Core.IntLiteral = converted %int.right_shift, %.loc4_26.5 [template = constants.%.34] +// CHECK:STDOUT: %.loc4_33: type = array_type %.loc4_26.6, i32 [template = constants.%.35] +// CHECK:STDOUT: %arr.var: ref %.35 = var arr +// CHECK:STDOUT: %arr: ref %.35 = bind_name arr, %arr.var // CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc5_18.1: i32 = int_value 5 [template = constants.%.3] +// CHECK:STDOUT: %.loc5_18: Core.IntLiteral = int_value 5 [template = constants.%.34] // CHECK:STDOUT: %.loc5_13.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] // CHECK:STDOUT: %.loc5_13.2: type = converted %int.make_type_32.loc5, %.loc5_13.1 [template = i32] -// CHECK:STDOUT: %.loc5_18.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc5_18.3: = bound_method %.loc5_18.1, %.loc5_18.2 [template = constants.%.28] -// CHECK:STDOUT: %int.convert_checked.loc5: init Core.IntLiteral = call %.loc5_18.3(%.loc5_18.1) [template = constants.%.29] -// CHECK:STDOUT: %.loc5_18.4: Core.IntLiteral = value_of_initializer %int.convert_checked.loc5 [template = constants.%.29] -// CHECK:STDOUT: %.loc5_18.5: Core.IntLiteral = converted %.loc5_18.1, %.loc5_18.4 [template = constants.%.29] -// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18.5, i32 [template = constants.%.30] -// CHECK:STDOUT: %.loc5_20: type = ptr_type %.30 [template = constants.%.31] +// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.35] +// CHECK:STDOUT: %.loc5_20: type = ptr_type %.35 [template = constants.%.36] // CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { // CHECK:STDOUT: %a.patt: i32 = binding_pattern a // CHECK:STDOUT: %a.param_patt: i32 = value_param_pattern %a.patt, runtime_param0 @@ -197,9 +210,9 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %.30 = name_ref arr, file.%arr -// CHECK:STDOUT: %.loc5: %.31 = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %.31 = bind_name arr_p, %.loc5 +// CHECK:STDOUT: %arr.ref: ref %.35 = name_ref arr, file.%arr +// CHECK:STDOUT: %.loc5: %.36 = addr_of %arr.ref +// CHECK:STDOUT: %arr_p: %.36 = bind_name arr_p, %.loc5 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -212,25 +225,34 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: %RightShift: %RightShift.type = struct_value () [template] // CHECK:STDOUT: %Negate.type: type = fn_type @Negate [template] // CHECK:STDOUT: %Negate: %Negate.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %.2: i32 = int_value -1 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [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.5: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [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: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.27: = bound_method %.1, %Convert.15 [template] -// CHECK:STDOUT: %.28: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %.29: type = array_type %.28, i32 [template] -// CHECK:STDOUT: %.30: type = ptr_type %.29 [template] -// CHECK:STDOUT: %.31: i32 = int_value 10 [template] -// CHECK:STDOUT: %.32: i32 = int_value -10 [template] -// CHECK:STDOUT: %.33: i32 = int_value 2 [template] -// CHECK:STDOUT: %.34: i32 = int_value -3 [template] -// CHECK:STDOUT: %.35: i32 = int_value 3 [template] -// CHECK:STDOUT: %.36: = bound_method %.35, %Convert.15 [template] -// CHECK:STDOUT: %.37: Core.IntLiteral = int_value 3 [template] -// CHECK:STDOUT: %.38: type = array_type %.37, i32 [template] -// CHECK:STDOUT: %.39: type = ptr_type %.38 [template] +// CHECK:STDOUT: %.25: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 1 [template] +// CHECK:STDOUT: %.28: i32 = int_value -1 [template] +// CHECK:STDOUT: %Convert.type.16: type = fn_type @Convert.12 [template] +// CHECK:STDOUT: %Convert.16: %Convert.type.16 = struct_value () [template] +// CHECK:STDOUT: %.29: = interface_witness (%Convert.16) [template] +// CHECK:STDOUT: %.30: = bound_method %.27, %Convert.16 [template] +// CHECK:STDOUT: %.31: type = array_type %.1, i32 [template] +// CHECK:STDOUT: %.32: type = ptr_type %.31 [template] +// CHECK:STDOUT: %.33: Core.IntLiteral = int_value 10 [template] +// CHECK:STDOUT: %.34: = bound_method %.33, %Convert.15 [template] +// CHECK:STDOUT: %.35: i32 = int_value 10 [template] +// CHECK:STDOUT: %.36: i32 = int_value -10 [template] +// CHECK:STDOUT: %.37: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.38: = bound_method %.37, %Convert.15 [template] +// CHECK:STDOUT: %.39: i32 = int_value 2 [template] +// CHECK:STDOUT: %.40: i32 = int_value -3 [template] +// CHECK:STDOUT: %.41: i32 = int_value 3 [template] +// CHECK:STDOUT: %.42: = bound_method %.41, %Convert.16 [template] +// CHECK:STDOUT: %.43: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.44: type = array_type %.43, i32 [template] +// CHECK:STDOUT: %.45: type = ptr_type %.44 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -298,74 +320,84 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: %Negate.ref.loc10_17: %Negate.type = name_ref Negate, %Negate.decl [template = constants.%Negate] // CHECK:STDOUT: %RightShift.ref.loc10: %RightShift.type = name_ref RightShift, %RightShift.decl [template = constants.%RightShift] // CHECK:STDOUT: %Negate.ref.loc10_35: %Negate.type = name_ref Negate, %Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc10_42: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %int.snegate.loc10_41: init i32 = call %Negate.ref.loc10_35(%.loc10_42) [template = constants.%.2] -// CHECK:STDOUT: %.loc10_46: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc10_41.1: i32 = value_of_initializer %int.snegate.loc10_41 [template = constants.%.2] -// CHECK:STDOUT: %.loc10_41.2: i32 = converted %int.snegate.loc10_41, %.loc10_41.1 [template = constants.%.2] -// CHECK:STDOUT: %int.right_shift.loc10: init i32 = call %RightShift.ref.loc10(%.loc10_41.2, %.loc10_46) [template = constants.%.2] -// CHECK:STDOUT: %.loc10_34.1: i32 = value_of_initializer %int.right_shift.loc10 [template = constants.%.2] -// CHECK:STDOUT: %.loc10_34.2: i32 = converted %int.right_shift.loc10, %.loc10_34.1 [template = constants.%.2] -// CHECK:STDOUT: %int.snegate.loc10_23: init i32 = call %Negate.ref.loc10_17(%.loc10_34.2) [template = constants.%.1] +// CHECK:STDOUT: %.loc10_42.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc10_42.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc10_42.3: = bound_method %.loc10_42.1, %.loc10_42.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc10_42: init i32 = call %.loc10_42.3(%.loc10_42.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc10_42.4: i32 = value_of_initializer %int.convert_checked.loc10_42 [template = constants.%.27] +// CHECK:STDOUT: %.loc10_42.5: i32 = converted %.loc10_42.1, %.loc10_42.4 [template = constants.%.27] +// CHECK:STDOUT: %int.snegate.loc10_41: init i32 = call %Negate.ref.loc10_35(%.loc10_42.5) [template = constants.%.28] +// CHECK:STDOUT: %.loc10_46.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc10_41.1: i32 = value_of_initializer %int.snegate.loc10_41 [template = constants.%.28] +// CHECK:STDOUT: %.loc10_41.2: i32 = converted %int.snegate.loc10_41, %.loc10_41.1 [template = constants.%.28] +// CHECK:STDOUT: %.loc10_46.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc10_46.3: = bound_method %.loc10_46.1, %.loc10_46.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc10_46: init i32 = call %.loc10_46.3(%.loc10_46.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc10_46.4: i32 = value_of_initializer %int.convert_checked.loc10_46 [template = constants.%.27] +// CHECK:STDOUT: %.loc10_46.5: i32 = converted %.loc10_46.1, %.loc10_46.4 [template = constants.%.27] +// CHECK:STDOUT: %int.right_shift.loc10: init i32 = call %RightShift.ref.loc10(%.loc10_41.2, %.loc10_46.5) [template = constants.%.28] +// CHECK:STDOUT: %.loc10_34.1: i32 = value_of_initializer %int.right_shift.loc10 [template = constants.%.28] +// CHECK:STDOUT: %.loc10_34.2: i32 = converted %int.right_shift.loc10, %.loc10_34.1 [template = constants.%.28] +// CHECK:STDOUT: %int.snegate.loc10_23: init i32 = call %Negate.ref.loc10_17(%.loc10_34.2) [template = constants.%.27] // CHECK:STDOUT: %.loc10_12.1: type = value_of_initializer %int.make_type_32.loc10 [template = i32] // CHECK:STDOUT: %.loc10_12.2: type = converted %int.make_type_32.loc10, %.loc10_12.1 [template = i32] -// CHECK:STDOUT: %.loc10_23.1: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc10_23.2: = bound_method %int.snegate.loc10_23, %.loc10_23.1 [template = constants.%.27] -// CHECK:STDOUT: %.loc10_23.3: i32 = value_of_initializer %int.snegate.loc10_23 [template = constants.%.1] -// CHECK:STDOUT: %.loc10_23.4: i32 = converted %int.snegate.loc10_23, %.loc10_23.3 [template = constants.%.1] -// CHECK:STDOUT: %int.convert_checked.loc10: init Core.IntLiteral = call %.loc10_23.2(%.loc10_23.4) [template = constants.%.28] -// CHECK:STDOUT: %.loc10_23.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc10 [template = constants.%.28] -// CHECK:STDOUT: %.loc10_23.6: Core.IntLiteral = converted %int.snegate.loc10_23, %.loc10_23.5 [template = constants.%.28] -// CHECK:STDOUT: %.loc10_49: type = array_type %.loc10_23.6, i32 [template = constants.%.29] -// CHECK:STDOUT: %arr1.var: ref %.29 = var arr1 -// CHECK:STDOUT: %arr1: ref %.29 = bind_name arr1, %arr1.var +// CHECK:STDOUT: %.loc10_23.1: %Convert.type.5 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %.loc10_23.2: = bound_method %int.snegate.loc10_23, %.loc10_23.1 [template = constants.%.30] +// CHECK:STDOUT: %.loc10_23.3: i32 = value_of_initializer %int.snegate.loc10_23 [template = constants.%.27] +// CHECK:STDOUT: %.loc10_23.4: i32 = converted %int.snegate.loc10_23, %.loc10_23.3 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc10_23: init Core.IntLiteral = call %.loc10_23.2(%.loc10_23.4) [template = constants.%.1] +// CHECK:STDOUT: %.loc10_23.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc10_23 [template = constants.%.1] +// CHECK:STDOUT: %.loc10_23.6: Core.IntLiteral = converted %int.snegate.loc10_23, %.loc10_23.5 [template = constants.%.1] +// CHECK:STDOUT: %.loc10_49: type = array_type %.loc10_23.6, i32 [template = constants.%.31] +// CHECK:STDOUT: %arr1.var: ref %.31 = var arr1 +// CHECK:STDOUT: %arr1: ref %.31 = bind_name arr1, %arr1.var // CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc11_19.1: i32 = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_19: Core.IntLiteral = int_value 1 [template = constants.%.1] // CHECK:STDOUT: %.loc11_14.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] // CHECK:STDOUT: %.loc11_14.2: type = converted %int.make_type_32.loc11, %.loc11_14.1 [template = i32] -// CHECK:STDOUT: %.loc11_19.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc11_19.3: = bound_method %.loc11_19.1, %.loc11_19.2 [template = constants.%.27] -// CHECK:STDOUT: %int.convert_checked.loc11: init Core.IntLiteral = call %.loc11_19.3(%.loc11_19.1) [template = constants.%.28] -// CHECK:STDOUT: %.loc11_19.4: Core.IntLiteral = value_of_initializer %int.convert_checked.loc11 [template = constants.%.28] -// CHECK:STDOUT: %.loc11_19.5: Core.IntLiteral = converted %.loc11_19.1, %.loc11_19.4 [template = constants.%.28] -// CHECK:STDOUT: %.loc11_20: type = array_type %.loc11_19.5, i32 [template = constants.%.29] -// CHECK:STDOUT: %.loc11_21: type = ptr_type %.29 [template = constants.%.30] +// CHECK:STDOUT: %.loc11_20: type = array_type %.loc11_19, i32 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_21: type = ptr_type %.31 [template = constants.%.32] // CHECK:STDOUT: %int.make_type_32.loc14: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %Negate.ref.loc14_17: %Negate.type = name_ref Negate, %Negate.decl [template = constants.%Negate] // CHECK:STDOUT: %RightShift.ref.loc14: %RightShift.type = name_ref RightShift, %RightShift.decl [template = constants.%RightShift] // CHECK:STDOUT: %Negate.ref.loc14_35: %Negate.type = name_ref Negate, %Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc14_42: i32 = int_value 10 [template = constants.%.31] -// CHECK:STDOUT: %int.snegate.loc14_41: init i32 = call %Negate.ref.loc14_35(%.loc14_42) [template = constants.%.32] -// CHECK:STDOUT: %.loc14_47: i32 = int_value 2 [template = constants.%.33] -// CHECK:STDOUT: %.loc14_41.1: i32 = value_of_initializer %int.snegate.loc14_41 [template = constants.%.32] -// CHECK:STDOUT: %.loc14_41.2: i32 = converted %int.snegate.loc14_41, %.loc14_41.1 [template = constants.%.32] -// CHECK:STDOUT: %int.right_shift.loc14: init i32 = call %RightShift.ref.loc14(%.loc14_41.2, %.loc14_47) [template = constants.%.34] -// CHECK:STDOUT: %.loc14_34.1: i32 = value_of_initializer %int.right_shift.loc14 [template = constants.%.34] -// CHECK:STDOUT: %.loc14_34.2: i32 = converted %int.right_shift.loc14, %.loc14_34.1 [template = constants.%.34] -// CHECK:STDOUT: %int.snegate.loc14_23: init i32 = call %Negate.ref.loc14_17(%.loc14_34.2) [template = constants.%.35] +// CHECK:STDOUT: %.loc14_42.1: Core.IntLiteral = int_value 10 [template = constants.%.33] +// CHECK:STDOUT: %.loc14_42.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc14_42.3: = bound_method %.loc14_42.1, %.loc14_42.2 [template = constants.%.34] +// CHECK:STDOUT: %int.convert_checked.loc14_42: init i32 = call %.loc14_42.3(%.loc14_42.1) [template = constants.%.35] +// CHECK:STDOUT: %.loc14_42.4: i32 = value_of_initializer %int.convert_checked.loc14_42 [template = constants.%.35] +// CHECK:STDOUT: %.loc14_42.5: i32 = converted %.loc14_42.1, %.loc14_42.4 [template = constants.%.35] +// CHECK:STDOUT: %int.snegate.loc14_41: init i32 = call %Negate.ref.loc14_35(%.loc14_42.5) [template = constants.%.36] +// CHECK:STDOUT: %.loc14_47.1: Core.IntLiteral = int_value 2 [template = constants.%.37] +// CHECK:STDOUT: %.loc14_41.1: i32 = value_of_initializer %int.snegate.loc14_41 [template = constants.%.36] +// CHECK:STDOUT: %.loc14_41.2: i32 = converted %int.snegate.loc14_41, %.loc14_41.1 [template = constants.%.36] +// CHECK:STDOUT: %.loc14_47.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc14_47.3: = bound_method %.loc14_47.1, %.loc14_47.2 [template = constants.%.38] +// CHECK:STDOUT: %int.convert_checked.loc14_47: init i32 = call %.loc14_47.3(%.loc14_47.1) [template = constants.%.39] +// CHECK:STDOUT: %.loc14_47.4: i32 = value_of_initializer %int.convert_checked.loc14_47 [template = constants.%.39] +// CHECK:STDOUT: %.loc14_47.5: i32 = converted %.loc14_47.1, %.loc14_47.4 [template = constants.%.39] +// CHECK:STDOUT: %int.right_shift.loc14: init i32 = call %RightShift.ref.loc14(%.loc14_41.2, %.loc14_47.5) [template = constants.%.40] +// CHECK:STDOUT: %.loc14_34.1: i32 = value_of_initializer %int.right_shift.loc14 [template = constants.%.40] +// CHECK:STDOUT: %.loc14_34.2: i32 = converted %int.right_shift.loc14, %.loc14_34.1 [template = constants.%.40] +// CHECK:STDOUT: %int.snegate.loc14_23: init i32 = call %Negate.ref.loc14_17(%.loc14_34.2) [template = constants.%.41] // CHECK:STDOUT: %.loc14_12.1: type = value_of_initializer %int.make_type_32.loc14 [template = i32] // CHECK:STDOUT: %.loc14_12.2: type = converted %int.make_type_32.loc14, %.loc14_12.1 [template = i32] -// CHECK:STDOUT: %.loc14_23.1: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc14_23.2: = bound_method %int.snegate.loc14_23, %.loc14_23.1 [template = constants.%.36] -// CHECK:STDOUT: %.loc14_23.3: i32 = value_of_initializer %int.snegate.loc14_23 [template = constants.%.35] -// CHECK:STDOUT: %.loc14_23.4: i32 = converted %int.snegate.loc14_23, %.loc14_23.3 [template = constants.%.35] -// CHECK:STDOUT: %int.convert_checked.loc14: init Core.IntLiteral = call %.loc14_23.2(%.loc14_23.4) [template = constants.%.37] -// CHECK:STDOUT: %.loc14_23.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc14 [template = constants.%.37] -// CHECK:STDOUT: %.loc14_23.6: Core.IntLiteral = converted %int.snegate.loc14_23, %.loc14_23.5 [template = constants.%.37] -// CHECK:STDOUT: %.loc14_50: type = array_type %.loc14_23.6, i32 [template = constants.%.38] -// CHECK:STDOUT: %arr2.var: ref %.38 = var arr2 -// CHECK:STDOUT: %arr2: ref %.38 = bind_name arr2, %arr2.var +// CHECK:STDOUT: %.loc14_23.1: %Convert.type.5 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %.loc14_23.2: = bound_method %int.snegate.loc14_23, %.loc14_23.1 [template = constants.%.42] +// CHECK:STDOUT: %.loc14_23.3: i32 = value_of_initializer %int.snegate.loc14_23 [template = constants.%.41] +// CHECK:STDOUT: %.loc14_23.4: i32 = converted %int.snegate.loc14_23, %.loc14_23.3 [template = constants.%.41] +// CHECK:STDOUT: %int.convert_checked.loc14_23: init Core.IntLiteral = call %.loc14_23.2(%.loc14_23.4) [template = constants.%.43] +// CHECK:STDOUT: %.loc14_23.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc14_23 [template = constants.%.43] +// CHECK:STDOUT: %.loc14_23.6: Core.IntLiteral = converted %int.snegate.loc14_23, %.loc14_23.5 [template = constants.%.43] +// CHECK:STDOUT: %.loc14_50: type = array_type %.loc14_23.6, i32 [template = constants.%.44] +// CHECK:STDOUT: %arr2.var: ref %.44 = var arr2 +// CHECK:STDOUT: %arr2: ref %.44 = bind_name arr2, %arr2.var // CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc15_19.1: i32 = int_value 3 [template = constants.%.35] +// CHECK:STDOUT: %.loc15_19: Core.IntLiteral = int_value 3 [template = constants.%.43] // CHECK:STDOUT: %.loc15_14.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] // CHECK:STDOUT: %.loc15_14.2: type = converted %int.make_type_32.loc15, %.loc15_14.1 [template = i32] -// CHECK:STDOUT: %.loc15_19.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc15_19.3: = bound_method %.loc15_19.1, %.loc15_19.2 [template = constants.%.36] -// CHECK:STDOUT: %int.convert_checked.loc15: init Core.IntLiteral = call %.loc15_19.3(%.loc15_19.1) [template = constants.%.37] -// CHECK:STDOUT: %.loc15_19.4: Core.IntLiteral = value_of_initializer %int.convert_checked.loc15 [template = constants.%.37] -// CHECK:STDOUT: %.loc15_19.5: Core.IntLiteral = converted %.loc15_19.1, %.loc15_19.4 [template = constants.%.37] -// CHECK:STDOUT: %.loc15_20: type = array_type %.loc15_19.5, i32 [template = constants.%.38] -// CHECK:STDOUT: %.loc15_21: type = ptr_type %.38 [template = constants.%.39] +// CHECK:STDOUT: %.loc15_20: type = array_type %.loc15_19, i32 [template = constants.%.44] +// CHECK:STDOUT: %.loc15_21: type = ptr_type %.44 [template = constants.%.45] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @RightShift(%a.param_patt: i32, %b.param_patt: i32) -> i32 = "int.right_shift"; @@ -374,12 +406,12 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr1.ref: ref %.29 = name_ref arr1, file.%arr1 -// CHECK:STDOUT: %.loc11: %.30 = addr_of %arr1.ref -// CHECK:STDOUT: %arr1_p: %.30 = bind_name arr1_p, %.loc11 -// CHECK:STDOUT: %arr2.ref: ref %.38 = name_ref arr2, file.%arr2 -// CHECK:STDOUT: %.loc15: %.39 = addr_of %arr2.ref -// CHECK:STDOUT: %arr2_p: %.39 = bind_name arr2_p, %.loc15 +// CHECK:STDOUT: %arr1.ref: ref %.31 = name_ref arr1, file.%arr1 +// CHECK:STDOUT: %.loc11: %.32 = addr_of %arr1.ref +// CHECK:STDOUT: %arr1_p: %.32 = bind_name arr1_p, %.loc11 +// CHECK:STDOUT: %arr2.ref: ref %.44 = name_ref arr2, file.%arr2 +// CHECK:STDOUT: %.loc15: %.45 = addr_of %arr2.ref +// CHECK:STDOUT: %arr2_p: %.45 = bind_name arr2_p, %.loc15 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -392,17 +424,30 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: %RightShift: %RightShift.type = struct_value () [template] // CHECK:STDOUT: %Negate.type: type = fn_type @Negate [template] // CHECK:STDOUT: %Negate: %Negate.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %.2: i32 = int_value 31 [template] -// CHECK:STDOUT: %.3: i32 = int_value 0 [template] -// CHECK:STDOUT: %.4: i32 = int_value 32 [template] -// CHECK:STDOUT: %.5: i32 = int_value 33 [template] -// CHECK:STDOUT: %.6: i32 = int_value -1 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 31 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 1 [template] +// CHECK:STDOUT: %.29: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 31 [template] +// CHECK:STDOUT: %.31: i32 = int_value 0 [template] +// CHECK:STDOUT: %.32: Core.IntLiteral = int_value 32 [template] +// CHECK:STDOUT: %.33: = bound_method %.32, %Convert.15 [template] +// CHECK:STDOUT: %.34: i32 = int_value 32 [template] +// CHECK:STDOUT: %.35: Core.IntLiteral = int_value 33 [template] +// CHECK:STDOUT: %.36: = bound_method %.35, %Convert.15 [template] +// CHECK:STDOUT: %.37: i32 = int_value 33 [template] +// CHECK:STDOUT: %.38: i32 = int_value -1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -481,34 +526,74 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %RightShift.ref.loc8: %RightShift.type = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] -// CHECK:STDOUT: %.loc8_30: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc8_33: i32 = int_value 31 [template = constants.%.2] -// CHECK:STDOUT: %int.right_shift.loc8: init i32 = call %RightShift.ref.loc8(%.loc8_30, %.loc8_33) [template = constants.%.3] -// CHECK:STDOUT: %.loc8_36.1: i32 = value_of_initializer %int.right_shift.loc8 [template = constants.%.3] -// CHECK:STDOUT: %.loc8_36.2: i32 = converted %int.right_shift.loc8, %.loc8_36.1 [template = constants.%.3] +// CHECK:STDOUT: %.loc8_30.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc8_33.1: Core.IntLiteral = int_value 31 [template = constants.%.2] +// CHECK:STDOUT: %.loc8_30.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc8_30.3: = bound_method %.loc8_30.1, %.loc8_30.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc8_30: init i32 = call %.loc8_30.3(%.loc8_30.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc8_30.4: i32 = value_of_initializer %int.convert_checked.loc8_30 [template = constants.%.28] +// CHECK:STDOUT: %.loc8_30.5: i32 = converted %.loc8_30.1, %.loc8_30.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc8_33.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc8_33.3: = bound_method %.loc8_33.1, %.loc8_33.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc8_33: init i32 = call %.loc8_33.3(%.loc8_33.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc8_33.4: i32 = value_of_initializer %int.convert_checked.loc8_33 [template = constants.%.30] +// CHECK:STDOUT: %.loc8_33.5: i32 = converted %.loc8_33.1, %.loc8_33.4 [template = constants.%.30] +// CHECK:STDOUT: %int.right_shift.loc8: init i32 = call %RightShift.ref.loc8(%.loc8_30.5, %.loc8_33.5) [template = constants.%.31] +// CHECK:STDOUT: %.loc8_36.1: i32 = value_of_initializer %int.right_shift.loc8 [template = constants.%.31] +// CHECK:STDOUT: %.loc8_36.2: i32 = converted %int.right_shift.loc8, %.loc8_36.1 [template = constants.%.31] // CHECK:STDOUT: %size_1: i32 = bind_name size_1, %.loc8_36.2 // CHECK:STDOUT: %RightShift.ref.loc13: %RightShift.type = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] -// CHECK:STDOUT: %.loc13_30: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc13_33: i32 = int_value 32 [template = constants.%.4] -// CHECK:STDOUT: %int.right_shift.loc13: init i32 = call %RightShift.ref.loc13(%.loc13_30, %.loc13_33) [template = ] +// CHECK:STDOUT: %.loc13_30.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc13_33.1: Core.IntLiteral = int_value 32 [template = constants.%.32] +// CHECK:STDOUT: %.loc13_30.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_30.3: = bound_method %.loc13_30.1, %.loc13_30.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc13_30: init i32 = call %.loc13_30.3(%.loc13_30.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc13_30.4: i32 = value_of_initializer %int.convert_checked.loc13_30 [template = constants.%.28] +// CHECK:STDOUT: %.loc13_30.5: i32 = converted %.loc13_30.1, %.loc13_30.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc13_33.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_33.3: = bound_method %.loc13_33.1, %.loc13_33.2 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc13_33: init i32 = call %.loc13_33.3(%.loc13_33.1) [template = constants.%.34] +// CHECK:STDOUT: %.loc13_33.4: i32 = value_of_initializer %int.convert_checked.loc13_33 [template = constants.%.34] +// CHECK:STDOUT: %.loc13_33.5: i32 = converted %.loc13_33.1, %.loc13_33.4 [template = constants.%.34] +// CHECK:STDOUT: %int.right_shift.loc13: init i32 = call %RightShift.ref.loc13(%.loc13_30.5, %.loc13_33.5) [template = ] // CHECK:STDOUT: %.loc13_36.1: i32 = value_of_initializer %int.right_shift.loc13 [template = ] // CHECK:STDOUT: %.loc13_36.2: i32 = converted %int.right_shift.loc13, %.loc13_36.1 [template = ] // CHECK:STDOUT: %size_2: i32 = bind_name size_2, %.loc13_36.2 // CHECK:STDOUT: %RightShift.ref.loc18: %RightShift.type = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] -// CHECK:STDOUT: %.loc18_30: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc18_33: i32 = int_value 33 [template = constants.%.5] -// CHECK:STDOUT: %int.right_shift.loc18: init i32 = call %RightShift.ref.loc18(%.loc18_30, %.loc18_33) [template = ] +// CHECK:STDOUT: %.loc18_30.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc18_33.1: Core.IntLiteral = int_value 33 [template = constants.%.35] +// CHECK:STDOUT: %.loc18_30.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc18_30.3: = bound_method %.loc18_30.1, %.loc18_30.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc18_30: init i32 = call %.loc18_30.3(%.loc18_30.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc18_30.4: i32 = value_of_initializer %int.convert_checked.loc18_30 [template = constants.%.28] +// CHECK:STDOUT: %.loc18_30.5: i32 = converted %.loc18_30.1, %.loc18_30.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc18_33.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc18_33.3: = bound_method %.loc18_33.1, %.loc18_33.2 [template = constants.%.36] +// CHECK:STDOUT: %int.convert_checked.loc18_33: init i32 = call %.loc18_33.3(%.loc18_33.1) [template = constants.%.37] +// CHECK:STDOUT: %.loc18_33.4: i32 = value_of_initializer %int.convert_checked.loc18_33 [template = constants.%.37] +// CHECK:STDOUT: %.loc18_33.5: i32 = converted %.loc18_33.1, %.loc18_33.4 [template = constants.%.37] +// CHECK:STDOUT: %int.right_shift.loc18: init i32 = call %RightShift.ref.loc18(%.loc18_30.5, %.loc18_33.5) [template = ] // CHECK:STDOUT: %.loc18_36.1: i32 = value_of_initializer %int.right_shift.loc18 [template = ] // CHECK:STDOUT: %.loc18_36.2: i32 = converted %int.right_shift.loc18, %.loc18_36.1 [template = ] // CHECK:STDOUT: %size_3: i32 = bind_name size_3, %.loc18_36.2 // CHECK:STDOUT: %RightShift.ref.loc24: %RightShift.type = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] -// CHECK:STDOUT: %.loc24_32: i32 = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc24_32.1: Core.IntLiteral = int_value 1 [template = constants.%.1] // CHECK:STDOUT: %Negate.ref: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc24_42: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %int.snegate: init i32 = call %Negate.ref(%.loc24_42) [template = constants.%.6] -// CHECK:STDOUT: %.loc24_41.1: i32 = value_of_initializer %int.snegate [template = constants.%.6] -// CHECK:STDOUT: %.loc24_41.2: i32 = converted %int.snegate, %.loc24_41.1 [template = constants.%.6] -// CHECK:STDOUT: %int.right_shift.loc24: init i32 = call %RightShift.ref.loc24(%.loc24_32, %.loc24_41.2) [template = ] +// CHECK:STDOUT: %.loc24_42.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc24_42.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc24_42.3: = bound_method %.loc24_42.1, %.loc24_42.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc24_42: init i32 = call %.loc24_42.3(%.loc24_42.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc24_42.4: i32 = value_of_initializer %int.convert_checked.loc24_42 [template = constants.%.28] +// CHECK:STDOUT: %.loc24_42.5: i32 = converted %.loc24_42.1, %.loc24_42.4 [template = constants.%.28] +// CHECK:STDOUT: %int.snegate: init i32 = call %Negate.ref(%.loc24_42.5) [template = constants.%.38] +// CHECK:STDOUT: %.loc24_32.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc24_32.3: = bound_method %.loc24_32.1, %.loc24_32.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc24_32: init i32 = call %.loc24_32.3(%.loc24_32.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc24_32.4: i32 = value_of_initializer %int.convert_checked.loc24_32 [template = constants.%.28] +// CHECK:STDOUT: %.loc24_32.5: i32 = converted %.loc24_32.1, %.loc24_32.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc24_41.1: i32 = value_of_initializer %int.snegate [template = constants.%.38] +// CHECK:STDOUT: %.loc24_41.2: i32 = converted %int.snegate, %.loc24_41.1 [template = constants.%.38] +// CHECK:STDOUT: %int.right_shift.loc24: init i32 = call %RightShift.ref.loc24(%.loc24_32.5, %.loc24_41.2) [template = ] // CHECK:STDOUT: %.loc24_45.1: i32 = value_of_initializer %int.right_shift.loc24 [template = ] // CHECK:STDOUT: %.loc24_45.2: i32 = converted %int.right_shift.loc24, %.loc24_45.1 [template = ] // CHECK:STDOUT: %negative: i32 = bind_name negative, %.loc24_45.2 diff --git a/toolchain/check/testdata/builtins/int/sadd.carbon b/toolchain/check/testdata/builtins/int/sadd.carbon index 43a97d94687c4..039dd4910bdbd 100644 --- a/toolchain/check/testdata/builtins/int/sadd.carbon +++ b/toolchain/check/testdata/builtins/int/sadd.carbon @@ -96,17 +96,25 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %Add.type: type = fn_type @Add [template] // CHECK:STDOUT: %Add: %Add.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %.2: i32 = int_value 2 [template] -// CHECK:STDOUT: %.3: i32 = int_value 3 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(i32) [template] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] // CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template] // CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template] -// CHECK:STDOUT: %.27: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.28: = bound_method %.3, %Convert.15 [template] -// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 3 [template] -// CHECK:STDOUT: %.30: type = array_type %.29, i32 [template] -// CHECK:STDOUT: %.31: type = ptr_type %.30 [template] +// CHECK:STDOUT: %.26: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 1 [template] +// CHECK:STDOUT: %.29: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 2 [template] +// CHECK:STDOUT: %.31: i32 = int_value 3 [template] +// CHECK:STDOUT: %Convert.type.16: type = fn_type @Convert.12 [template] +// CHECK:STDOUT: %Convert.16: %Convert.type.16 = struct_value () [template] +// CHECK:STDOUT: %.32: = interface_witness (%Convert.16) [template] +// CHECK:STDOUT: %.33: = bound_method %.31, %Convert.16 [template] +// CHECK:STDOUT: %.34: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.35: type = array_type %.34, i32 [template] +// CHECK:STDOUT: %.36: type = ptr_type %.35 [template] // CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] // CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] // CHECK:STDOUT: } @@ -155,32 +163,37 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: } // CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %Add.ref: %Add.type = name_ref Add, %Add.decl [template = constants.%Add] -// CHECK:STDOUT: %.loc4_20: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_23: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: %int.sadd: init i32 = call %Add.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] +// CHECK:STDOUT: %.loc4_20.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc4_23.1: Core.IntLiteral = int_value 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_20.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_20.3: = bound_method %.loc4_20.1, %.loc4_20.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc4_20: init i32 = call %.loc4_20.3(%.loc4_20.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc4_20.4: i32 = value_of_initializer %int.convert_checked.loc4_20 [template = constants.%.28] +// CHECK:STDOUT: %.loc4_20.5: i32 = converted %.loc4_20.1, %.loc4_20.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc4_23.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_23.3: = bound_method %.loc4_23.1, %.loc4_23.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc4_23: init i32 = call %.loc4_23.3(%.loc4_23.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc4_23.4: i32 = value_of_initializer %int.convert_checked.loc4_23 [template = constants.%.30] +// CHECK:STDOUT: %.loc4_23.5: i32 = converted %.loc4_23.1, %.loc4_23.4 [template = constants.%.30] +// CHECK:STDOUT: %int.sadd: init i32 = call %Add.ref(%.loc4_20.5, %.loc4_23.5) [template = constants.%.31] // CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] // CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4, %.loc4_11.1 [template = i32] -// CHECK:STDOUT: %.loc4_19.1: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc4_19.2: = bound_method %int.sadd, %.loc4_19.1 [template = constants.%.28] -// CHECK:STDOUT: %.loc4_19.3: i32 = value_of_initializer %int.sadd [template = constants.%.3] -// CHECK:STDOUT: %.loc4_19.4: i32 = converted %int.sadd, %.loc4_19.3 [template = constants.%.3] -// CHECK:STDOUT: %int.convert_checked.loc4: init Core.IntLiteral = call %.loc4_19.2(%.loc4_19.4) [template = constants.%.29] -// CHECK:STDOUT: %.loc4_19.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4 [template = constants.%.29] -// CHECK:STDOUT: %.loc4_19.6: Core.IntLiteral = converted %int.sadd, %.loc4_19.5 [template = constants.%.29] -// CHECK:STDOUT: %.loc4_25: type = array_type %.loc4_19.6, i32 [template = constants.%.30] -// CHECK:STDOUT: %arr.var: ref %.30 = var arr -// CHECK:STDOUT: %arr: ref %.30 = bind_name arr, %arr.var +// CHECK:STDOUT: %.loc4_19.1: %Convert.type.5 = interface_witness_access constants.%.32, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %.loc4_19.2: = bound_method %int.sadd, %.loc4_19.1 [template = constants.%.33] +// CHECK:STDOUT: %.loc4_19.3: i32 = value_of_initializer %int.sadd [template = constants.%.31] +// CHECK:STDOUT: %.loc4_19.4: i32 = converted %int.sadd, %.loc4_19.3 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc4_19: init Core.IntLiteral = call %.loc4_19.2(%.loc4_19.4) [template = constants.%.34] +// CHECK:STDOUT: %.loc4_19.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4_19 [template = constants.%.34] +// CHECK:STDOUT: %.loc4_19.6: Core.IntLiteral = converted %int.sadd, %.loc4_19.5 [template = constants.%.34] +// CHECK:STDOUT: %.loc4_25: type = array_type %.loc4_19.6, i32 [template = constants.%.35] +// CHECK:STDOUT: %arr.var: ref %.35 = var arr +// CHECK:STDOUT: %arr: ref %.35 = bind_name arr, %arr.var // CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc5_18.1: i32 = int_value 3 [template = constants.%.3] +// CHECK:STDOUT: %.loc5_18: Core.IntLiteral = int_value 3 [template = constants.%.34] // CHECK:STDOUT: %.loc5_13.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] // CHECK:STDOUT: %.loc5_13.2: type = converted %int.make_type_32.loc5, %.loc5_13.1 [template = i32] -// CHECK:STDOUT: %.loc5_18.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc5_18.3: = bound_method %.loc5_18.1, %.loc5_18.2 [template = constants.%.28] -// CHECK:STDOUT: %int.convert_checked.loc5: init Core.IntLiteral = call %.loc5_18.3(%.loc5_18.1) [template = constants.%.29] -// CHECK:STDOUT: %.loc5_18.4: Core.IntLiteral = value_of_initializer %int.convert_checked.loc5 [template = constants.%.29] -// CHECK:STDOUT: %.loc5_18.5: Core.IntLiteral = converted %.loc5_18.1, %.loc5_18.4 [template = constants.%.29] -// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18.5, i32 [template = constants.%.30] -// CHECK:STDOUT: %.loc5_20: type = ptr_type %.30 [template = constants.%.31] +// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.35] +// CHECK:STDOUT: %.loc5_20: type = ptr_type %.35 [template = constants.%.36] // CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { // CHECK:STDOUT: %a.patt: i32 = binding_pattern a // CHECK:STDOUT: %a.param_patt: i32 = value_param_pattern %a.patt, runtime_param0 @@ -222,9 +235,9 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %.30 = name_ref arr, file.%arr -// CHECK:STDOUT: %.loc5: %.31 = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %.31 = bind_name arr_p, %.loc5 +// CHECK:STDOUT: %arr.ref: ref %.35 = name_ref arr, file.%arr +// CHECK:STDOUT: %.loc5: %.36 = addr_of %arr.ref +// CHECK:STDOUT: %arr_p: %.36 = bind_name arr_p, %.loc5 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -243,9 +256,19 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: %BadReturnType: %BadReturnType.type = struct_value () [template] // CHECK:STDOUT: %JustRight.type: type = fn_type @JustRight [template] // CHECK:STDOUT: %JustRight: %JustRight.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %.2: i32 = int_value 2 [template] -// CHECK:STDOUT: %.3: i32 = int_value 3 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 1 [template] +// CHECK:STDOUT: %.28: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.30: = bound_method %.28, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 2 [template] +// CHECK:STDOUT: %.32: = bound_method %.29, %Convert.15 [template] +// CHECK:STDOUT: %.33: i32 = int_value 3 [template] // CHECK:STDOUT: %RuntimeCallTooFew.type: type = fn_type @RuntimeCallTooFew [template] // CHECK:STDOUT: %RuntimeCallTooFew: %RuntimeCallTooFew.type = struct_value () [template] // CHECK:STDOUT: %RuntimeCallTooMany.type: type = fn_type @RuntimeCallTooMany [template] @@ -258,6 +281,7 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int32 = %import_ref.1 // CHECK:STDOUT: .Bool = %import_ref.2 +// CHECK:STDOUT: .ImplicitAs = %import_ref.3 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -377,36 +401,66 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: } // CHECK:STDOUT: %int.make_type_32.loc25: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %TooFew.ref: %TooFew.type = name_ref TooFew, %TooFew.decl [template = constants.%TooFew] -// CHECK:STDOUT: %.loc25_27: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %TooFew.call: init i32 = call %TooFew.ref(%.loc25_27) +// CHECK:STDOUT: %.loc25_27.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc25_27.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc25_27.3: = bound_method %.loc25_27.1, %.loc25_27.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc25: init i32 = call %.loc25_27.3(%.loc25_27.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc25_27.4: i32 = value_of_initializer %int.convert_checked.loc25 [template = constants.%.27] +// CHECK:STDOUT: %.loc25_27.5: i32 = converted %.loc25_27.1, %.loc25_27.4 [template = constants.%.27] +// CHECK:STDOUT: %TooFew.call: init i32 = call %TooFew.ref(%.loc25_27.5) // CHECK:STDOUT: %.loc25_15.1: type = value_of_initializer %int.make_type_32.loc25 [template = i32] // CHECK:STDOUT: %.loc25_15.2: type = converted %int.make_type_32.loc25, %.loc25_15.1 [template = i32] // CHECK:STDOUT: %too_few.var: ref = var too_few // CHECK:STDOUT: %too_few: ref = bind_name too_few, %too_few.var // CHECK:STDOUT: %int.make_type_32.loc30: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %TooMany.ref: %TooMany.type = name_ref TooMany, %TooMany.decl [template = constants.%TooMany] -// CHECK:STDOUT: %.loc30_29: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc30_32: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc30_35: i32 = int_value 3 [template = constants.%.3] -// CHECK:STDOUT: %TooMany.call: init i32 = call %TooMany.ref(%.loc30_29, %.loc30_32, %.loc30_35) +// CHECK:STDOUT: %.loc30_29.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc30_32.1: Core.IntLiteral = int_value 2 [template = constants.%.28] +// CHECK:STDOUT: %.loc30_35.1: Core.IntLiteral = int_value 3 [template = constants.%.29] +// CHECK:STDOUT: %.loc30_29.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc30_29.3: = bound_method %.loc30_29.1, %.loc30_29.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc30_29: init i32 = call %.loc30_29.3(%.loc30_29.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc30_29.4: i32 = value_of_initializer %int.convert_checked.loc30_29 [template = constants.%.27] +// CHECK:STDOUT: %.loc30_29.5: i32 = converted %.loc30_29.1, %.loc30_29.4 [template = constants.%.27] +// CHECK:STDOUT: %.loc30_32.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc30_32.3: = bound_method %.loc30_32.1, %.loc30_32.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc30_32: init i32 = call %.loc30_32.3(%.loc30_32.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc30_32.4: i32 = value_of_initializer %int.convert_checked.loc30_32 [template = constants.%.31] +// CHECK:STDOUT: %.loc30_32.5: i32 = converted %.loc30_32.1, %.loc30_32.4 [template = constants.%.31] +// CHECK:STDOUT: %.loc30_35.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc30_35.3: = bound_method %.loc30_35.1, %.loc30_35.2 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc30_35: init i32 = call %.loc30_35.3(%.loc30_35.1) [template = constants.%.33] +// CHECK:STDOUT: %.loc30_35.4: i32 = value_of_initializer %int.convert_checked.loc30_35 [template = constants.%.33] +// CHECK:STDOUT: %.loc30_35.5: i32 = converted %.loc30_35.1, %.loc30_35.4 [template = constants.%.33] +// CHECK:STDOUT: %TooMany.call: init i32 = call %TooMany.ref(%.loc30_29.5, %.loc30_32.5, %.loc30_35.5) // CHECK:STDOUT: %.loc30_16.1: type = value_of_initializer %int.make_type_32.loc30 [template = i32] // CHECK:STDOUT: %.loc30_16.2: type = converted %int.make_type_32.loc30, %.loc30_16.1 [template = i32] // CHECK:STDOUT: %too_many.var: ref = var too_many // CHECK:STDOUT: %too_many: ref = bind_name too_many, %too_many.var // CHECK:STDOUT: %int.make_type_32.loc35: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %BadReturnType.ref: %BadReturnType.type = name_ref BadReturnType, %BadReturnType.decl [template = constants.%BadReturnType] -// CHECK:STDOUT: %.loc35_42: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc35_45: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref(%.loc35_42, %.loc35_45) +// CHECK:STDOUT: %.loc35_42.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc35_45.1: Core.IntLiteral = int_value 2 [template = constants.%.28] +// CHECK:STDOUT: %.loc35_42.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc35_42.3: = bound_method %.loc35_42.1, %.loc35_42.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc35_42: init i32 = call %.loc35_42.3(%.loc35_42.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc35_42.4: i32 = value_of_initializer %int.convert_checked.loc35_42 [template = constants.%.27] +// CHECK:STDOUT: %.loc35_42.5: i32 = converted %.loc35_42.1, %.loc35_42.4 [template = constants.%.27] +// CHECK:STDOUT: %.loc35_45.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc35_45.3: = bound_method %.loc35_45.1, %.loc35_45.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc35_45: init i32 = call %.loc35_45.3(%.loc35_45.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc35_45.4: i32 = value_of_initializer %int.convert_checked.loc35_45 [template = constants.%.31] +// CHECK:STDOUT: %.loc35_45.5: i32 = converted %.loc35_45.1, %.loc35_45.4 [template = constants.%.31] +// CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref(%.loc35_42.5, %.loc35_45.5) // CHECK:STDOUT: %.loc35_23.1: type = value_of_initializer %int.make_type_32.loc35 [template = i32] // CHECK:STDOUT: %.loc35_23.2: type = converted %int.make_type_32.loc35, %.loc35_23.1 [template = i32] // CHECK:STDOUT: %bad_return_type.var: ref = var bad_return_type // CHECK:STDOUT: %bad_return_type: ref = bind_name bad_return_type, %bad_return_type.var // CHECK:STDOUT: %int.make_type_32.loc44: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %JustRight.ref: %JustRight.type = name_ref JustRight, %JustRight.decl [template = constants.%JustRight] -// CHECK:STDOUT: %.loc44_31: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc44_34: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc44_37: i32 = int_value 3 [template = constants.%.3] +// CHECK:STDOUT: %.loc44_31: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc44_34: Core.IntLiteral = int_value 2 [template = constants.%.28] +// CHECK:STDOUT: %.loc44_37: Core.IntLiteral = int_value 3 [template = constants.%.29] // CHECK:STDOUT: %.loc44_16.1: type = value_of_initializer %int.make_type_32.loc44 [template = i32] // CHECK:STDOUT: %.loc44_16.2: type = converted %int.make_type_32.loc44, %.loc44_16.1 [template = i32] // CHECK:STDOUT: %.loc44_39: type = array_type , i32 [template = ] @@ -534,15 +588,26 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %Add.type: type = fn_type @Add [template] // CHECK:STDOUT: %Add: %Add.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 2147483647 [template] -// CHECK:STDOUT: %.2: i32 = int_value 0 [template] -// CHECK:STDOUT: %.3: i32 = int_value 1 [template] -// CHECK:STDOUT: %.4: i32 = int_value -2147483648 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 2147483647 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 0 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 2147483647 [template] +// CHECK:STDOUT: %.29: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 0 [template] +// CHECK:STDOUT: %.31: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.32: = bound_method %.31, %Convert.15 [template] +// CHECK:STDOUT: %.33: i32 = int_value 1 [template] +// CHECK:STDOUT: %.34: i32 = int_value -2147483648 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -593,18 +658,38 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Add.ref.loc6: %Add.type = name_ref Add, file.%Add.decl [template = constants.%Add] -// CHECK:STDOUT: %.loc6_18: i32 = int_value 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %.loc6_30: i32 = int_value 0 [template = constants.%.2] -// CHECK:STDOUT: %int.sadd.loc6: init i32 = call %Add.ref.loc6(%.loc6_18, %.loc6_30) [template = constants.%.1] -// CHECK:STDOUT: %.loc6_32.1: i32 = value_of_initializer %int.sadd.loc6 [template = constants.%.1] -// CHECK:STDOUT: %.loc6_32.2: i32 = converted %int.sadd.loc6, %.loc6_32.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc6_18.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.1] +// CHECK:STDOUT: %.loc6_30.1: Core.IntLiteral = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc6_18.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc6_18.3: = bound_method %.loc6_18.1, %.loc6_18.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc6_18: init i32 = call %.loc6_18.3(%.loc6_18.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc6_18.4: i32 = value_of_initializer %int.convert_checked.loc6_18 [template = constants.%.28] +// CHECK:STDOUT: %.loc6_18.5: i32 = converted %.loc6_18.1, %.loc6_18.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc6_30.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc6_30.3: = bound_method %.loc6_30.1, %.loc6_30.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc6_30: init i32 = call %.loc6_30.3(%.loc6_30.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc6_30.4: i32 = value_of_initializer %int.convert_checked.loc6_30 [template = constants.%.30] +// CHECK:STDOUT: %.loc6_30.5: i32 = converted %.loc6_30.1, %.loc6_30.4 [template = constants.%.30] +// CHECK:STDOUT: %int.sadd.loc6: init i32 = call %Add.ref.loc6(%.loc6_18.5, %.loc6_30.5) [template = constants.%.28] +// CHECK:STDOUT: %.loc6_32.1: i32 = value_of_initializer %int.sadd.loc6 [template = constants.%.28] +// CHECK:STDOUT: %.loc6_32.2: i32 = converted %int.sadd.loc6, %.loc6_32.1 [template = constants.%.28] // CHECK:STDOUT: %a: i32 = bind_name a, %.loc6_32.2 // CHECK:STDOUT: %Add.ref.loc10: %Add.type = name_ref Add, file.%Add.decl [template = constants.%Add] -// CHECK:STDOUT: %.loc10_18: i32 = int_value 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %.loc10_30: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: %int.sadd.loc10: init i32 = call %Add.ref.loc10(%.loc10_18, %.loc10_30) [template = constants.%.4] -// CHECK:STDOUT: %.loc10_32.1: i32 = value_of_initializer %int.sadd.loc10 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_32.2: i32 = converted %int.sadd.loc10, %.loc10_32.1 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_18.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.1] +// CHECK:STDOUT: %.loc10_30.1: Core.IntLiteral = int_value 1 [template = constants.%.31] +// CHECK:STDOUT: %.loc10_18.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc10_18.3: = bound_method %.loc10_18.1, %.loc10_18.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc10_18: init i32 = call %.loc10_18.3(%.loc10_18.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc10_18.4: i32 = value_of_initializer %int.convert_checked.loc10_18 [template = constants.%.28] +// CHECK:STDOUT: %.loc10_18.5: i32 = converted %.loc10_18.1, %.loc10_18.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc10_30.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc10_30.3: = bound_method %.loc10_30.1, %.loc10_30.2 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc10_30: init i32 = call %.loc10_30.3(%.loc10_30.1) [template = constants.%.33] +// CHECK:STDOUT: %.loc10_30.4: i32 = value_of_initializer %int.convert_checked.loc10_30 [template = constants.%.33] +// CHECK:STDOUT: %.loc10_30.5: i32 = converted %.loc10_30.1, %.loc10_30.4 [template = constants.%.33] +// CHECK:STDOUT: %int.sadd.loc10: init i32 = call %Add.ref.loc10(%.loc10_18.5, %.loc10_30.5) [template = constants.%.34] +// CHECK:STDOUT: %.loc10_32.1: i32 = value_of_initializer %int.sadd.loc10 [template = constants.%.34] +// CHECK:STDOUT: %.loc10_32.2: i32 = converted %int.sadd.loc10, %.loc10_32.1 [template = constants.%.34] // CHECK:STDOUT: %b: i32 = bind_name b, %.loc10_32.2 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/builtins/int/sdiv.carbon b/toolchain/check/testdata/builtins/int/sdiv.carbon index 485659b1dcd28..83ff76a298fb2 100644 --- a/toolchain/check/testdata/builtins/int/sdiv.carbon +++ b/toolchain/check/testdata/builtins/int/sdiv.carbon @@ -64,17 +64,25 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %Div.type: type = fn_type @Div [template] // CHECK:STDOUT: %Div: %Div.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 3 [template] -// CHECK:STDOUT: %.2: i32 = int_value 2 [template] -// CHECK:STDOUT: %.3: i32 = int_value 1 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(i32) [template] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] // CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template] // CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template] -// CHECK:STDOUT: %.27: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.28: = bound_method %.3, %Convert.15 [template] -// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %.30: type = array_type %.29, i32 [template] -// CHECK:STDOUT: %.31: type = ptr_type %.30 [template] +// CHECK:STDOUT: %.26: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 3 [template] +// CHECK:STDOUT: %.29: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 2 [template] +// CHECK:STDOUT: %.31: i32 = int_value 1 [template] +// CHECK:STDOUT: %Convert.type.16: type = fn_type @Convert.12 [template] +// CHECK:STDOUT: %Convert.16: %Convert.type.16 = struct_value () [template] +// CHECK:STDOUT: %.32: = interface_witness (%Convert.16) [template] +// CHECK:STDOUT: %.33: = bound_method %.31, %Convert.16 [template] +// CHECK:STDOUT: %.34: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.35: type = array_type %.34, i32 [template] +// CHECK:STDOUT: %.36: type = ptr_type %.35 [template] // CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] // CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] // CHECK:STDOUT: } @@ -123,32 +131,37 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: } // CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %Div.ref: %Div.type = name_ref Div, %Div.decl [template = constants.%Div] -// CHECK:STDOUT: %.loc4_20: i32 = int_value 3 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_23: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: %int.sdiv: init i32 = call %Div.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] +// CHECK:STDOUT: %.loc4_20.1: Core.IntLiteral = int_value 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc4_23.1: Core.IntLiteral = int_value 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_20.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_20.3: = bound_method %.loc4_20.1, %.loc4_20.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc4_20: init i32 = call %.loc4_20.3(%.loc4_20.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc4_20.4: i32 = value_of_initializer %int.convert_checked.loc4_20 [template = constants.%.28] +// CHECK:STDOUT: %.loc4_20.5: i32 = converted %.loc4_20.1, %.loc4_20.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc4_23.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_23.3: = bound_method %.loc4_23.1, %.loc4_23.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc4_23: init i32 = call %.loc4_23.3(%.loc4_23.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc4_23.4: i32 = value_of_initializer %int.convert_checked.loc4_23 [template = constants.%.30] +// CHECK:STDOUT: %.loc4_23.5: i32 = converted %.loc4_23.1, %.loc4_23.4 [template = constants.%.30] +// CHECK:STDOUT: %int.sdiv: init i32 = call %Div.ref(%.loc4_20.5, %.loc4_23.5) [template = constants.%.31] // CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] // CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4, %.loc4_11.1 [template = i32] -// CHECK:STDOUT: %.loc4_19.1: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc4_19.2: = bound_method %int.sdiv, %.loc4_19.1 [template = constants.%.28] -// CHECK:STDOUT: %.loc4_19.3: i32 = value_of_initializer %int.sdiv [template = constants.%.3] -// CHECK:STDOUT: %.loc4_19.4: i32 = converted %int.sdiv, %.loc4_19.3 [template = constants.%.3] -// CHECK:STDOUT: %int.convert_checked.loc4: init Core.IntLiteral = call %.loc4_19.2(%.loc4_19.4) [template = constants.%.29] -// CHECK:STDOUT: %.loc4_19.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4 [template = constants.%.29] -// CHECK:STDOUT: %.loc4_19.6: Core.IntLiteral = converted %int.sdiv, %.loc4_19.5 [template = constants.%.29] -// CHECK:STDOUT: %.loc4_25: type = array_type %.loc4_19.6, i32 [template = constants.%.30] -// CHECK:STDOUT: %arr.var: ref %.30 = var arr -// CHECK:STDOUT: %arr: ref %.30 = bind_name arr, %arr.var +// CHECK:STDOUT: %.loc4_19.1: %Convert.type.5 = interface_witness_access constants.%.32, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %.loc4_19.2: = bound_method %int.sdiv, %.loc4_19.1 [template = constants.%.33] +// CHECK:STDOUT: %.loc4_19.3: i32 = value_of_initializer %int.sdiv [template = constants.%.31] +// CHECK:STDOUT: %.loc4_19.4: i32 = converted %int.sdiv, %.loc4_19.3 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc4_19: init Core.IntLiteral = call %.loc4_19.2(%.loc4_19.4) [template = constants.%.34] +// CHECK:STDOUT: %.loc4_19.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4_19 [template = constants.%.34] +// CHECK:STDOUT: %.loc4_19.6: Core.IntLiteral = converted %int.sdiv, %.loc4_19.5 [template = constants.%.34] +// CHECK:STDOUT: %.loc4_25: type = array_type %.loc4_19.6, i32 [template = constants.%.35] +// CHECK:STDOUT: %arr.var: ref %.35 = var arr +// CHECK:STDOUT: %arr: ref %.35 = bind_name arr, %arr.var // CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc5_18.1: i32 = int_value 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc5_18: Core.IntLiteral = int_value 1 [template = constants.%.34] // CHECK:STDOUT: %.loc5_13.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] // CHECK:STDOUT: %.loc5_13.2: type = converted %int.make_type_32.loc5, %.loc5_13.1 [template = i32] -// CHECK:STDOUT: %.loc5_18.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc5_18.3: = bound_method %.loc5_18.1, %.loc5_18.2 [template = constants.%.28] -// CHECK:STDOUT: %int.convert_checked.loc5: init Core.IntLiteral = call %.loc5_18.3(%.loc5_18.1) [template = constants.%.29] -// CHECK:STDOUT: %.loc5_18.4: Core.IntLiteral = value_of_initializer %int.convert_checked.loc5 [template = constants.%.29] -// CHECK:STDOUT: %.loc5_18.5: Core.IntLiteral = converted %.loc5_18.1, %.loc5_18.4 [template = constants.%.29] -// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18.5, i32 [template = constants.%.30] -// CHECK:STDOUT: %.loc5_20: type = ptr_type %.30 [template = constants.%.31] +// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.35] +// CHECK:STDOUT: %.loc5_20: type = ptr_type %.35 [template = constants.%.36] // CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { // CHECK:STDOUT: %a.patt: i32 = binding_pattern a // CHECK:STDOUT: %a.param_patt: i32 = value_param_pattern %a.patt, runtime_param0 @@ -190,9 +203,9 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %.30 = name_ref arr, file.%arr -// CHECK:STDOUT: %.loc5: %.31 = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %.31 = bind_name arr_p, %.loc5 +// CHECK:STDOUT: %arr.ref: ref %.35 = name_ref arr, file.%arr +// CHECK:STDOUT: %.loc5: %.36 = addr_of %arr.ref +// CHECK:STDOUT: %arr_p: %.36 = bind_name arr_p, %.loc5 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -207,16 +220,25 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: %Sub: %Sub.type = struct_value () [template] // CHECK:STDOUT: %Negate.type: type = fn_type @Negate [template] // CHECK:STDOUT: %Negate: %Negate.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 2147483647 [template] -// CHECK:STDOUT: %.2: i32 = int_value -2147483647 [template] -// CHECK:STDOUT: %.3: i32 = int_value 1 [template] -// CHECK:STDOUT: %.4: i32 = int_value -1 [template] -// CHECK:STDOUT: %.5: i32 = int_value -2147483648 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 2147483647 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 2147483647 [template] +// CHECK:STDOUT: %.28: i32 = int_value -2147483647 [template] +// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.30: = bound_method %.29, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 1 [template] +// CHECK:STDOUT: %.32: i32 = int_value -1 [template] +// CHECK:STDOUT: %.33: i32 = int_value -2147483648 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -319,54 +341,94 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Div.ref.loc9: %Div.type = name_ref Div, file.%Div.decl [template = constants.%Div] // CHECK:STDOUT: %Negate.ref.loc9_18: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc9_25: i32 = int_value 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %int.snegate.loc9_24: init i32 = call %Negate.ref.loc9_18(%.loc9_25) [template = constants.%.2] +// CHECK:STDOUT: %.loc9_25.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.1] +// CHECK:STDOUT: %.loc9_25.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_25.3: = bound_method %.loc9_25.1, %.loc9_25.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc9_25: init i32 = call %.loc9_25.3(%.loc9_25.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc9_25.4: i32 = value_of_initializer %int.convert_checked.loc9_25 [template = constants.%.27] +// CHECK:STDOUT: %.loc9_25.5: i32 = converted %.loc9_25.1, %.loc9_25.4 [template = constants.%.27] +// CHECK:STDOUT: %int.snegate.loc9_24: init i32 = call %Negate.ref.loc9_18(%.loc9_25.5) [template = constants.%.28] // CHECK:STDOUT: %Negate.ref.loc9_39: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc9_46: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: %int.snegate.loc9_45: init i32 = call %Negate.ref.loc9_39(%.loc9_46) [template = constants.%.4] -// CHECK:STDOUT: %.loc9_24.1: i32 = value_of_initializer %int.snegate.loc9_24 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_24.2: i32 = converted %int.snegate.loc9_24, %.loc9_24.1 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_45.1: i32 = value_of_initializer %int.snegate.loc9_45 [template = constants.%.4] -// CHECK:STDOUT: %.loc9_45.2: i32 = converted %int.snegate.loc9_45, %.loc9_45.1 [template = constants.%.4] -// CHECK:STDOUT: %int.sdiv.loc9: init i32 = call %Div.ref.loc9(%.loc9_24.2, %.loc9_45.2) [template = constants.%.1] -// CHECK:STDOUT: %.loc9_49.1: i32 = value_of_initializer %int.sdiv.loc9 [template = constants.%.1] -// CHECK:STDOUT: %.loc9_49.2: i32 = converted %int.sdiv.loc9, %.loc9_49.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc9_46.1: Core.IntLiteral = int_value 1 [template = constants.%.29] +// CHECK:STDOUT: %.loc9_46.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_46.3: = bound_method %.loc9_46.1, %.loc9_46.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc9_46: init i32 = call %.loc9_46.3(%.loc9_46.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc9_46.4: i32 = value_of_initializer %int.convert_checked.loc9_46 [template = constants.%.31] +// CHECK:STDOUT: %.loc9_46.5: i32 = converted %.loc9_46.1, %.loc9_46.4 [template = constants.%.31] +// CHECK:STDOUT: %int.snegate.loc9_45: init i32 = call %Negate.ref.loc9_39(%.loc9_46.5) [template = constants.%.32] +// CHECK:STDOUT: %.loc9_24.1: i32 = value_of_initializer %int.snegate.loc9_24 [template = constants.%.28] +// CHECK:STDOUT: %.loc9_24.2: i32 = converted %int.snegate.loc9_24, %.loc9_24.1 [template = constants.%.28] +// CHECK:STDOUT: %.loc9_45.1: i32 = value_of_initializer %int.snegate.loc9_45 [template = constants.%.32] +// CHECK:STDOUT: %.loc9_45.2: i32 = converted %int.snegate.loc9_45, %.loc9_45.1 [template = constants.%.32] +// CHECK:STDOUT: %int.sdiv.loc9: init i32 = call %Div.ref.loc9(%.loc9_24.2, %.loc9_45.2) [template = constants.%.27] +// CHECK:STDOUT: %.loc9_49.1: i32 = value_of_initializer %int.sdiv.loc9 [template = constants.%.27] +// CHECK:STDOUT: %.loc9_49.2: i32 = converted %int.sdiv.loc9, %.loc9_49.1 [template = constants.%.27] // CHECK:STDOUT: %a: i32 = bind_name a, %.loc9_49.2 // CHECK:STDOUT: %Div.ref.loc12: %Div.type = name_ref Div, file.%Div.decl [template = constants.%Div] // CHECK:STDOUT: %Sub.ref.loc12: %Sub.type = name_ref Sub, file.%Sub.decl [template = constants.%Sub] // CHECK:STDOUT: %Negate.ref.loc12: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc12_29: i32 = int_value 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %int.snegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_29) [template = constants.%.2] -// CHECK:STDOUT: %.loc12_43: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc12_28.1: i32 = value_of_initializer %int.snegate.loc12 [template = constants.%.2] -// CHECK:STDOUT: %.loc12_28.2: i32 = converted %int.snegate.loc12, %.loc12_28.1 [template = constants.%.2] -// CHECK:STDOUT: %int.ssub.loc12: init i32 = call %Sub.ref.loc12(%.loc12_28.2, %.loc12_43) [template = constants.%.5] -// CHECK:STDOUT: %.loc12_47: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc12_21.1: i32 = value_of_initializer %int.ssub.loc12 [template = constants.%.5] -// CHECK:STDOUT: %.loc12_21.2: i32 = converted %int.ssub.loc12, %.loc12_21.1 [template = constants.%.5] -// CHECK:STDOUT: %int.sdiv.loc12: init i32 = call %Div.ref.loc12(%.loc12_21.2, %.loc12_47) [template = constants.%.5] -// CHECK:STDOUT: %.loc12_49.1: i32 = value_of_initializer %int.sdiv.loc12 [template = constants.%.5] -// CHECK:STDOUT: %.loc12_49.2: i32 = converted %int.sdiv.loc12, %.loc12_49.1 [template = constants.%.5] +// CHECK:STDOUT: %.loc12_29.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.1] +// CHECK:STDOUT: %.loc12_29.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_29.3: = bound_method %.loc12_29.1, %.loc12_29.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc12_29: init i32 = call %.loc12_29.3(%.loc12_29.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc12_29.4: i32 = value_of_initializer %int.convert_checked.loc12_29 [template = constants.%.27] +// CHECK:STDOUT: %.loc12_29.5: i32 = converted %.loc12_29.1, %.loc12_29.4 [template = constants.%.27] +// CHECK:STDOUT: %int.snegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_29.5) [template = constants.%.28] +// CHECK:STDOUT: %.loc12_43.1: Core.IntLiteral = int_value 1 [template = constants.%.29] +// CHECK:STDOUT: %.loc12_28.1: i32 = value_of_initializer %int.snegate.loc12 [template = constants.%.28] +// CHECK:STDOUT: %.loc12_28.2: i32 = converted %int.snegate.loc12, %.loc12_28.1 [template = constants.%.28] +// CHECK:STDOUT: %.loc12_43.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_43.3: = bound_method %.loc12_43.1, %.loc12_43.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc12_43: init i32 = call %.loc12_43.3(%.loc12_43.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc12_43.4: i32 = value_of_initializer %int.convert_checked.loc12_43 [template = constants.%.31] +// CHECK:STDOUT: %.loc12_43.5: i32 = converted %.loc12_43.1, %.loc12_43.4 [template = constants.%.31] +// CHECK:STDOUT: %int.ssub.loc12: init i32 = call %Sub.ref.loc12(%.loc12_28.2, %.loc12_43.5) [template = constants.%.33] +// CHECK:STDOUT: %.loc12_47.1: Core.IntLiteral = int_value 1 [template = constants.%.29] +// CHECK:STDOUT: %.loc12_21.1: i32 = value_of_initializer %int.ssub.loc12 [template = constants.%.33] +// CHECK:STDOUT: %.loc12_21.2: i32 = converted %int.ssub.loc12, %.loc12_21.1 [template = constants.%.33] +// CHECK:STDOUT: %.loc12_47.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_47.3: = bound_method %.loc12_47.1, %.loc12_47.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc12_47: init i32 = call %.loc12_47.3(%.loc12_47.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc12_47.4: i32 = value_of_initializer %int.convert_checked.loc12_47 [template = constants.%.31] +// CHECK:STDOUT: %.loc12_47.5: i32 = converted %.loc12_47.1, %.loc12_47.4 [template = constants.%.31] +// CHECK:STDOUT: %int.sdiv.loc12: init i32 = call %Div.ref.loc12(%.loc12_21.2, %.loc12_47.5) [template = constants.%.33] +// CHECK:STDOUT: %.loc12_49.1: i32 = value_of_initializer %int.sdiv.loc12 [template = constants.%.33] +// CHECK:STDOUT: %.loc12_49.2: i32 = converted %int.sdiv.loc12, %.loc12_49.1 [template = constants.%.33] // CHECK:STDOUT: %b: i32 = bind_name b, %.loc12_49.2 // CHECK:STDOUT: %Div.ref.loc19: %Div.type = name_ref Div, file.%Div.decl [template = constants.%Div] // CHECK:STDOUT: %Sub.ref.loc19: %Sub.type = name_ref Sub, file.%Sub.decl [template = constants.%Sub] // CHECK:STDOUT: %Negate.ref.loc19_22: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc19_29: i32 = int_value 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %int.snegate.loc19_28: init i32 = call %Negate.ref.loc19_22(%.loc19_29) [template = constants.%.2] -// CHECK:STDOUT: %.loc19_43: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc19_28.1: i32 = value_of_initializer %int.snegate.loc19_28 [template = constants.%.2] -// CHECK:STDOUT: %.loc19_28.2: i32 = converted %int.snegate.loc19_28, %.loc19_28.1 [template = constants.%.2] -// CHECK:STDOUT: %int.ssub.loc19: init i32 = call %Sub.ref.loc19(%.loc19_28.2, %.loc19_43) [template = constants.%.5] +// CHECK:STDOUT: %.loc19_29.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.1] +// CHECK:STDOUT: %.loc19_29.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc19_29.3: = bound_method %.loc19_29.1, %.loc19_29.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc19_29: init i32 = call %.loc19_29.3(%.loc19_29.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc19_29.4: i32 = value_of_initializer %int.convert_checked.loc19_29 [template = constants.%.27] +// CHECK:STDOUT: %.loc19_29.5: i32 = converted %.loc19_29.1, %.loc19_29.4 [template = constants.%.27] +// CHECK:STDOUT: %int.snegate.loc19_28: init i32 = call %Negate.ref.loc19_22(%.loc19_29.5) [template = constants.%.28] +// CHECK:STDOUT: %.loc19_43.1: Core.IntLiteral = int_value 1 [template = constants.%.29] +// CHECK:STDOUT: %.loc19_28.1: i32 = value_of_initializer %int.snegate.loc19_28 [template = constants.%.28] +// CHECK:STDOUT: %.loc19_28.2: i32 = converted %int.snegate.loc19_28, %.loc19_28.1 [template = constants.%.28] +// CHECK:STDOUT: %.loc19_43.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc19_43.3: = bound_method %.loc19_43.1, %.loc19_43.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc19_43: init i32 = call %.loc19_43.3(%.loc19_43.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc19_43.4: i32 = value_of_initializer %int.convert_checked.loc19_43 [template = constants.%.31] +// CHECK:STDOUT: %.loc19_43.5: i32 = converted %.loc19_43.1, %.loc19_43.4 [template = constants.%.31] +// CHECK:STDOUT: %int.ssub.loc19: init i32 = call %Sub.ref.loc19(%.loc19_28.2, %.loc19_43.5) [template = constants.%.33] // CHECK:STDOUT: %Negate.ref.loc19_47: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc19_54: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: %int.snegate.loc19_53: init i32 = call %Negate.ref.loc19_47(%.loc19_54) [template = constants.%.4] -// CHECK:STDOUT: %.loc19_21.1: i32 = value_of_initializer %int.ssub.loc19 [template = constants.%.5] -// CHECK:STDOUT: %.loc19_21.2: i32 = converted %int.ssub.loc19, %.loc19_21.1 [template = constants.%.5] -// CHECK:STDOUT: %.loc19_53.1: i32 = value_of_initializer %int.snegate.loc19_53 [template = constants.%.4] -// CHECK:STDOUT: %.loc19_53.2: i32 = converted %int.snegate.loc19_53, %.loc19_53.1 [template = constants.%.4] -// CHECK:STDOUT: %int.sdiv.loc19: init i32 = call %Div.ref.loc19(%.loc19_21.2, %.loc19_53.2) [template = constants.%.5] -// CHECK:STDOUT: %.loc19_57.1: i32 = value_of_initializer %int.sdiv.loc19 [template = constants.%.5] -// CHECK:STDOUT: %.loc19_57.2: i32 = converted %int.sdiv.loc19, %.loc19_57.1 [template = constants.%.5] +// CHECK:STDOUT: %.loc19_54.1: Core.IntLiteral = int_value 1 [template = constants.%.29] +// CHECK:STDOUT: %.loc19_54.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc19_54.3: = bound_method %.loc19_54.1, %.loc19_54.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc19_54: init i32 = call %.loc19_54.3(%.loc19_54.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc19_54.4: i32 = value_of_initializer %int.convert_checked.loc19_54 [template = constants.%.31] +// CHECK:STDOUT: %.loc19_54.5: i32 = converted %.loc19_54.1, %.loc19_54.4 [template = constants.%.31] +// CHECK:STDOUT: %int.snegate.loc19_53: init i32 = call %Negate.ref.loc19_47(%.loc19_54.5) [template = constants.%.32] +// CHECK:STDOUT: %.loc19_21.1: i32 = value_of_initializer %int.ssub.loc19 [template = constants.%.33] +// CHECK:STDOUT: %.loc19_21.2: i32 = converted %int.ssub.loc19, %.loc19_21.1 [template = constants.%.33] +// CHECK:STDOUT: %.loc19_53.1: i32 = value_of_initializer %int.snegate.loc19_53 [template = constants.%.32] +// CHECK:STDOUT: %.loc19_53.2: i32 = converted %int.snegate.loc19_53, %.loc19_53.1 [template = constants.%.32] +// CHECK:STDOUT: %int.sdiv.loc19: init i32 = call %Div.ref.loc19(%.loc19_21.2, %.loc19_53.2) [template = constants.%.33] +// CHECK:STDOUT: %.loc19_57.1: i32 = value_of_initializer %int.sdiv.loc19 [template = constants.%.33] +// CHECK:STDOUT: %.loc19_57.2: i32 = converted %int.sdiv.loc19, %.loc19_57.1 [template = constants.%.33] // CHECK:STDOUT: %c: i32 = bind_name c, %.loc19_57.2 // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -378,13 +440,22 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %Div.type: type = fn_type @Div [template] // CHECK:STDOUT: %Div: %Div.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %.2: i32 = int_value 0 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 0 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 1 [template] +// CHECK:STDOUT: %.29: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -435,16 +506,36 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Div.ref.loc10: %Div.type = name_ref Div, file.%Div.decl [template = constants.%Div] -// CHECK:STDOUT: %.loc10_18: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc10_21: i32 = int_value 0 [template = constants.%.2] -// CHECK:STDOUT: %int.sdiv.loc10: init i32 = call %Div.ref.loc10(%.loc10_18, %.loc10_21) [template = ] +// CHECK:STDOUT: %.loc10_18.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc10_21.1: Core.IntLiteral = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc10_18.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc10_18.3: = bound_method %.loc10_18.1, %.loc10_18.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc10_18: init i32 = call %.loc10_18.3(%.loc10_18.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc10_18.4: i32 = value_of_initializer %int.convert_checked.loc10_18 [template = constants.%.28] +// CHECK:STDOUT: %.loc10_18.5: i32 = converted %.loc10_18.1, %.loc10_18.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc10_21.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc10_21.3: = bound_method %.loc10_21.1, %.loc10_21.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc10_21: init i32 = call %.loc10_21.3(%.loc10_21.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc10_21.4: i32 = value_of_initializer %int.convert_checked.loc10_21 [template = constants.%.30] +// CHECK:STDOUT: %.loc10_21.5: i32 = converted %.loc10_21.1, %.loc10_21.4 [template = constants.%.30] +// CHECK:STDOUT: %int.sdiv.loc10: init i32 = call %Div.ref.loc10(%.loc10_18.5, %.loc10_21.5) [template = ] // CHECK:STDOUT: %.loc10_23.1: i32 = value_of_initializer %int.sdiv.loc10 [template = ] // CHECK:STDOUT: %.loc10_23.2: i32 = converted %int.sdiv.loc10, %.loc10_23.1 [template = ] // CHECK:STDOUT: %a: i32 = bind_name a, %.loc10_23.2 // CHECK:STDOUT: %Div.ref.loc15: %Div.type = name_ref Div, file.%Div.decl [template = constants.%Div] -// CHECK:STDOUT: %.loc15_18: i32 = int_value 0 [template = constants.%.2] -// CHECK:STDOUT: %.loc15_21: i32 = int_value 0 [template = constants.%.2] -// CHECK:STDOUT: %int.sdiv.loc15: init i32 = call %Div.ref.loc15(%.loc15_18, %.loc15_21) [template = ] +// CHECK:STDOUT: %.loc15_18.1: Core.IntLiteral = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_21.1: Core.IntLiteral = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_18.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc15_18.3: = bound_method %.loc15_18.1, %.loc15_18.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc15_18: init i32 = call %.loc15_18.3(%.loc15_18.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc15_18.4: i32 = value_of_initializer %int.convert_checked.loc15_18 [template = constants.%.30] +// CHECK:STDOUT: %.loc15_18.5: i32 = converted %.loc15_18.1, %.loc15_18.4 [template = constants.%.30] +// CHECK:STDOUT: %.loc15_21.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc15_21.3: = bound_method %.loc15_21.1, %.loc15_21.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc15_21: init i32 = call %.loc15_21.3(%.loc15_21.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc15_21.4: i32 = value_of_initializer %int.convert_checked.loc15_21 [template = constants.%.30] +// CHECK:STDOUT: %.loc15_21.5: i32 = converted %.loc15_21.1, %.loc15_21.4 [template = constants.%.30] +// CHECK:STDOUT: %int.sdiv.loc15: init i32 = call %Div.ref.loc15(%.loc15_18.5, %.loc15_21.5) [template = ] // CHECK:STDOUT: %.loc15_23.1: i32 = value_of_initializer %int.sdiv.loc15 [template = ] // CHECK:STDOUT: %.loc15_23.2: i32 = converted %int.sdiv.loc15, %.loc15_23.1 [template = ] // CHECK:STDOUT: %b: i32 = bind_name b, %.loc15_23.2 diff --git a/toolchain/check/testdata/builtins/int/smod.carbon b/toolchain/check/testdata/builtins/int/smod.carbon index 22c93e094cc11..49470015147fa 100644 --- a/toolchain/check/testdata/builtins/int/smod.carbon +++ b/toolchain/check/testdata/builtins/int/smod.carbon @@ -67,17 +67,25 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %Mod.type: type = fn_type @Mod [template] // CHECK:STDOUT: %Mod: %Mod.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 5 [template] -// CHECK:STDOUT: %.2: i32 = int_value 3 [template] -// CHECK:STDOUT: %.3: i32 = int_value 2 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 5 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(i32) [template] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] // CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template] // CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template] -// CHECK:STDOUT: %.27: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.28: = bound_method %.3, %Convert.15 [template] -// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 2 [template] -// CHECK:STDOUT: %.30: type = array_type %.29, i32 [template] -// CHECK:STDOUT: %.31: type = ptr_type %.30 [template] +// CHECK:STDOUT: %.26: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 5 [template] +// CHECK:STDOUT: %.29: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 3 [template] +// CHECK:STDOUT: %.31: i32 = int_value 2 [template] +// CHECK:STDOUT: %Convert.type.16: type = fn_type @Convert.12 [template] +// CHECK:STDOUT: %Convert.16: %Convert.type.16 = struct_value () [template] +// CHECK:STDOUT: %.32: = interface_witness (%Convert.16) [template] +// CHECK:STDOUT: %.33: = bound_method %.31, %Convert.16 [template] +// CHECK:STDOUT: %.34: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.35: type = array_type %.34, i32 [template] +// CHECK:STDOUT: %.36: type = ptr_type %.35 [template] // CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] // CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] // CHECK:STDOUT: } @@ -126,32 +134,37 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: } // CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %Mod.ref: %Mod.type = name_ref Mod, %Mod.decl [template = constants.%Mod] -// CHECK:STDOUT: %.loc4_20: i32 = int_value 5 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_23: i32 = int_value 3 [template = constants.%.2] -// CHECK:STDOUT: %int.smod: init i32 = call %Mod.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] +// CHECK:STDOUT: %.loc4_20.1: Core.IntLiteral = int_value 5 [template = constants.%.1] +// CHECK:STDOUT: %.loc4_23.1: Core.IntLiteral = int_value 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_20.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_20.3: = bound_method %.loc4_20.1, %.loc4_20.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc4_20: init i32 = call %.loc4_20.3(%.loc4_20.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc4_20.4: i32 = value_of_initializer %int.convert_checked.loc4_20 [template = constants.%.28] +// CHECK:STDOUT: %.loc4_20.5: i32 = converted %.loc4_20.1, %.loc4_20.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc4_23.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_23.3: = bound_method %.loc4_23.1, %.loc4_23.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc4_23: init i32 = call %.loc4_23.3(%.loc4_23.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc4_23.4: i32 = value_of_initializer %int.convert_checked.loc4_23 [template = constants.%.30] +// CHECK:STDOUT: %.loc4_23.5: i32 = converted %.loc4_23.1, %.loc4_23.4 [template = constants.%.30] +// CHECK:STDOUT: %int.smod: init i32 = call %Mod.ref(%.loc4_20.5, %.loc4_23.5) [template = constants.%.31] // CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] // CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4, %.loc4_11.1 [template = i32] -// CHECK:STDOUT: %.loc4_19.1: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc4_19.2: = bound_method %int.smod, %.loc4_19.1 [template = constants.%.28] -// CHECK:STDOUT: %.loc4_19.3: i32 = value_of_initializer %int.smod [template = constants.%.3] -// CHECK:STDOUT: %.loc4_19.4: i32 = converted %int.smod, %.loc4_19.3 [template = constants.%.3] -// CHECK:STDOUT: %int.convert_checked.loc4: init Core.IntLiteral = call %.loc4_19.2(%.loc4_19.4) [template = constants.%.29] -// CHECK:STDOUT: %.loc4_19.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4 [template = constants.%.29] -// CHECK:STDOUT: %.loc4_19.6: Core.IntLiteral = converted %int.smod, %.loc4_19.5 [template = constants.%.29] -// CHECK:STDOUT: %.loc4_25: type = array_type %.loc4_19.6, i32 [template = constants.%.30] -// CHECK:STDOUT: %arr.var: ref %.30 = var arr -// CHECK:STDOUT: %arr: ref %.30 = bind_name arr, %arr.var +// CHECK:STDOUT: %.loc4_19.1: %Convert.type.5 = interface_witness_access constants.%.32, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %.loc4_19.2: = bound_method %int.smod, %.loc4_19.1 [template = constants.%.33] +// CHECK:STDOUT: %.loc4_19.3: i32 = value_of_initializer %int.smod [template = constants.%.31] +// CHECK:STDOUT: %.loc4_19.4: i32 = converted %int.smod, %.loc4_19.3 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc4_19: init Core.IntLiteral = call %.loc4_19.2(%.loc4_19.4) [template = constants.%.34] +// CHECK:STDOUT: %.loc4_19.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4_19 [template = constants.%.34] +// CHECK:STDOUT: %.loc4_19.6: Core.IntLiteral = converted %int.smod, %.loc4_19.5 [template = constants.%.34] +// CHECK:STDOUT: %.loc4_25: type = array_type %.loc4_19.6, i32 [template = constants.%.35] +// CHECK:STDOUT: %arr.var: ref %.35 = var arr +// CHECK:STDOUT: %arr: ref %.35 = bind_name arr, %arr.var // CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc5_18.1: i32 = int_value 2 [template = constants.%.3] +// CHECK:STDOUT: %.loc5_18: Core.IntLiteral = int_value 2 [template = constants.%.34] // CHECK:STDOUT: %.loc5_13.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] // CHECK:STDOUT: %.loc5_13.2: type = converted %int.make_type_32.loc5, %.loc5_13.1 [template = i32] -// CHECK:STDOUT: %.loc5_18.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc5_18.3: = bound_method %.loc5_18.1, %.loc5_18.2 [template = constants.%.28] -// CHECK:STDOUT: %int.convert_checked.loc5: init Core.IntLiteral = call %.loc5_18.3(%.loc5_18.1) [template = constants.%.29] -// CHECK:STDOUT: %.loc5_18.4: Core.IntLiteral = value_of_initializer %int.convert_checked.loc5 [template = constants.%.29] -// CHECK:STDOUT: %.loc5_18.5: Core.IntLiteral = converted %.loc5_18.1, %.loc5_18.4 [template = constants.%.29] -// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18.5, i32 [template = constants.%.30] -// CHECK:STDOUT: %.loc5_20: type = ptr_type %.30 [template = constants.%.31] +// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.35] +// CHECK:STDOUT: %.loc5_20: type = ptr_type %.35 [template = constants.%.36] // CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { // CHECK:STDOUT: %a.patt: i32 = binding_pattern a // CHECK:STDOUT: %a.param_patt: i32 = value_param_pattern %a.patt, runtime_param0 @@ -193,9 +206,9 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %.30 = name_ref arr, file.%arr -// CHECK:STDOUT: %.loc5: %.31 = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %.31 = bind_name arr_p, %.loc5 +// CHECK:STDOUT: %arr.ref: ref %.35 = name_ref arr, file.%arr +// CHECK:STDOUT: %.loc5: %.36 = addr_of %arr.ref +// CHECK:STDOUT: %arr_p: %.36 = bind_name arr_p, %.loc5 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -210,17 +223,26 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: %Sub: %Sub.type = struct_value () [template] // CHECK:STDOUT: %Negate.type: type = fn_type @Negate [template] // CHECK:STDOUT: %Negate: %Negate.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 2147483647 [template] -// CHECK:STDOUT: %.2: i32 = int_value -2147483647 [template] -// CHECK:STDOUT: %.3: i32 = int_value 1 [template] -// CHECK:STDOUT: %.4: i32 = int_value -1 [template] -// CHECK:STDOUT: %.5: i32 = int_value 0 [template] -// CHECK:STDOUT: %.6: i32 = int_value -2147483648 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 2147483647 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 2147483647 [template] +// CHECK:STDOUT: %.28: i32 = int_value -2147483647 [template] +// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.30: = bound_method %.29, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 1 [template] +// CHECK:STDOUT: %.32: i32 = int_value -1 [template] +// CHECK:STDOUT: %.33: i32 = int_value 0 [template] +// CHECK:STDOUT: %.34: i32 = int_value -2147483648 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -323,54 +345,94 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Mod.ref.loc9: %Mod.type = name_ref Mod, file.%Mod.decl [template = constants.%Mod] // CHECK:STDOUT: %Negate.ref.loc9_18: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc9_25: i32 = int_value 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %int.snegate.loc9_24: init i32 = call %Negate.ref.loc9_18(%.loc9_25) [template = constants.%.2] +// CHECK:STDOUT: %.loc9_25.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.1] +// CHECK:STDOUT: %.loc9_25.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_25.3: = bound_method %.loc9_25.1, %.loc9_25.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc9_25: init i32 = call %.loc9_25.3(%.loc9_25.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc9_25.4: i32 = value_of_initializer %int.convert_checked.loc9_25 [template = constants.%.27] +// CHECK:STDOUT: %.loc9_25.5: i32 = converted %.loc9_25.1, %.loc9_25.4 [template = constants.%.27] +// CHECK:STDOUT: %int.snegate.loc9_24: init i32 = call %Negate.ref.loc9_18(%.loc9_25.5) [template = constants.%.28] // CHECK:STDOUT: %Negate.ref.loc9_39: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc9_46: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: %int.snegate.loc9_45: init i32 = call %Negate.ref.loc9_39(%.loc9_46) [template = constants.%.4] -// CHECK:STDOUT: %.loc9_24.1: i32 = value_of_initializer %int.snegate.loc9_24 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_24.2: i32 = converted %int.snegate.loc9_24, %.loc9_24.1 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_45.1: i32 = value_of_initializer %int.snegate.loc9_45 [template = constants.%.4] -// CHECK:STDOUT: %.loc9_45.2: i32 = converted %int.snegate.loc9_45, %.loc9_45.1 [template = constants.%.4] -// CHECK:STDOUT: %int.smod.loc9: init i32 = call %Mod.ref.loc9(%.loc9_24.2, %.loc9_45.2) [template = constants.%.5] -// CHECK:STDOUT: %.loc9_49.1: i32 = value_of_initializer %int.smod.loc9 [template = constants.%.5] -// CHECK:STDOUT: %.loc9_49.2: i32 = converted %int.smod.loc9, %.loc9_49.1 [template = constants.%.5] +// CHECK:STDOUT: %.loc9_46.1: Core.IntLiteral = int_value 1 [template = constants.%.29] +// CHECK:STDOUT: %.loc9_46.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_46.3: = bound_method %.loc9_46.1, %.loc9_46.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc9_46: init i32 = call %.loc9_46.3(%.loc9_46.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc9_46.4: i32 = value_of_initializer %int.convert_checked.loc9_46 [template = constants.%.31] +// CHECK:STDOUT: %.loc9_46.5: i32 = converted %.loc9_46.1, %.loc9_46.4 [template = constants.%.31] +// CHECK:STDOUT: %int.snegate.loc9_45: init i32 = call %Negate.ref.loc9_39(%.loc9_46.5) [template = constants.%.32] +// CHECK:STDOUT: %.loc9_24.1: i32 = value_of_initializer %int.snegate.loc9_24 [template = constants.%.28] +// CHECK:STDOUT: %.loc9_24.2: i32 = converted %int.snegate.loc9_24, %.loc9_24.1 [template = constants.%.28] +// CHECK:STDOUT: %.loc9_45.1: i32 = value_of_initializer %int.snegate.loc9_45 [template = constants.%.32] +// CHECK:STDOUT: %.loc9_45.2: i32 = converted %int.snegate.loc9_45, %.loc9_45.1 [template = constants.%.32] +// CHECK:STDOUT: %int.smod.loc9: init i32 = call %Mod.ref.loc9(%.loc9_24.2, %.loc9_45.2) [template = constants.%.33] +// CHECK:STDOUT: %.loc9_49.1: i32 = value_of_initializer %int.smod.loc9 [template = constants.%.33] +// CHECK:STDOUT: %.loc9_49.2: i32 = converted %int.smod.loc9, %.loc9_49.1 [template = constants.%.33] // CHECK:STDOUT: %a: i32 = bind_name a, %.loc9_49.2 // CHECK:STDOUT: %Mod.ref.loc12: %Mod.type = name_ref Mod, file.%Mod.decl [template = constants.%Mod] // CHECK:STDOUT: %Sub.ref.loc12: %Sub.type = name_ref Sub, file.%Sub.decl [template = constants.%Sub] // CHECK:STDOUT: %Negate.ref.loc12: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc12_29: i32 = int_value 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %int.snegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_29) [template = constants.%.2] -// CHECK:STDOUT: %.loc12_43: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc12_28.1: i32 = value_of_initializer %int.snegate.loc12 [template = constants.%.2] -// CHECK:STDOUT: %.loc12_28.2: i32 = converted %int.snegate.loc12, %.loc12_28.1 [template = constants.%.2] -// CHECK:STDOUT: %int.ssub.loc12: init i32 = call %Sub.ref.loc12(%.loc12_28.2, %.loc12_43) [template = constants.%.6] -// CHECK:STDOUT: %.loc12_47: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc12_21.1: i32 = value_of_initializer %int.ssub.loc12 [template = constants.%.6] -// CHECK:STDOUT: %.loc12_21.2: i32 = converted %int.ssub.loc12, %.loc12_21.1 [template = constants.%.6] -// CHECK:STDOUT: %int.smod.loc12: init i32 = call %Mod.ref.loc12(%.loc12_21.2, %.loc12_47) [template = constants.%.5] -// CHECK:STDOUT: %.loc12_49.1: i32 = value_of_initializer %int.smod.loc12 [template = constants.%.5] -// CHECK:STDOUT: %.loc12_49.2: i32 = converted %int.smod.loc12, %.loc12_49.1 [template = constants.%.5] +// CHECK:STDOUT: %.loc12_29.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.1] +// CHECK:STDOUT: %.loc12_29.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_29.3: = bound_method %.loc12_29.1, %.loc12_29.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc12_29: init i32 = call %.loc12_29.3(%.loc12_29.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc12_29.4: i32 = value_of_initializer %int.convert_checked.loc12_29 [template = constants.%.27] +// CHECK:STDOUT: %.loc12_29.5: i32 = converted %.loc12_29.1, %.loc12_29.4 [template = constants.%.27] +// CHECK:STDOUT: %int.snegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_29.5) [template = constants.%.28] +// CHECK:STDOUT: %.loc12_43.1: Core.IntLiteral = int_value 1 [template = constants.%.29] +// CHECK:STDOUT: %.loc12_28.1: i32 = value_of_initializer %int.snegate.loc12 [template = constants.%.28] +// CHECK:STDOUT: %.loc12_28.2: i32 = converted %int.snegate.loc12, %.loc12_28.1 [template = constants.%.28] +// CHECK:STDOUT: %.loc12_43.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_43.3: = bound_method %.loc12_43.1, %.loc12_43.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc12_43: init i32 = call %.loc12_43.3(%.loc12_43.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc12_43.4: i32 = value_of_initializer %int.convert_checked.loc12_43 [template = constants.%.31] +// CHECK:STDOUT: %.loc12_43.5: i32 = converted %.loc12_43.1, %.loc12_43.4 [template = constants.%.31] +// CHECK:STDOUT: %int.ssub.loc12: init i32 = call %Sub.ref.loc12(%.loc12_28.2, %.loc12_43.5) [template = constants.%.34] +// CHECK:STDOUT: %.loc12_47.1: Core.IntLiteral = int_value 1 [template = constants.%.29] +// CHECK:STDOUT: %.loc12_21.1: i32 = value_of_initializer %int.ssub.loc12 [template = constants.%.34] +// CHECK:STDOUT: %.loc12_21.2: i32 = converted %int.ssub.loc12, %.loc12_21.1 [template = constants.%.34] +// CHECK:STDOUT: %.loc12_47.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_47.3: = bound_method %.loc12_47.1, %.loc12_47.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc12_47: init i32 = call %.loc12_47.3(%.loc12_47.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc12_47.4: i32 = value_of_initializer %int.convert_checked.loc12_47 [template = constants.%.31] +// CHECK:STDOUT: %.loc12_47.5: i32 = converted %.loc12_47.1, %.loc12_47.4 [template = constants.%.31] +// CHECK:STDOUT: %int.smod.loc12: init i32 = call %Mod.ref.loc12(%.loc12_21.2, %.loc12_47.5) [template = constants.%.33] +// CHECK:STDOUT: %.loc12_49.1: i32 = value_of_initializer %int.smod.loc12 [template = constants.%.33] +// CHECK:STDOUT: %.loc12_49.2: i32 = converted %int.smod.loc12, %.loc12_49.1 [template = constants.%.33] // CHECK:STDOUT: %b: i32 = bind_name b, %.loc12_49.2 // CHECK:STDOUT: %Mod.ref.loc20: %Mod.type = name_ref Mod, file.%Mod.decl [template = constants.%Mod] // CHECK:STDOUT: %Sub.ref.loc20: %Sub.type = name_ref Sub, file.%Sub.decl [template = constants.%Sub] // CHECK:STDOUT: %Negate.ref.loc20_22: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc20_29: i32 = int_value 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %int.snegate.loc20_28: init i32 = call %Negate.ref.loc20_22(%.loc20_29) [template = constants.%.2] -// CHECK:STDOUT: %.loc20_43: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc20_28.1: i32 = value_of_initializer %int.snegate.loc20_28 [template = constants.%.2] -// CHECK:STDOUT: %.loc20_28.2: i32 = converted %int.snegate.loc20_28, %.loc20_28.1 [template = constants.%.2] -// CHECK:STDOUT: %int.ssub.loc20: init i32 = call %Sub.ref.loc20(%.loc20_28.2, %.loc20_43) [template = constants.%.6] +// CHECK:STDOUT: %.loc20_29.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.1] +// CHECK:STDOUT: %.loc20_29.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc20_29.3: = bound_method %.loc20_29.1, %.loc20_29.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc20_29: init i32 = call %.loc20_29.3(%.loc20_29.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc20_29.4: i32 = value_of_initializer %int.convert_checked.loc20_29 [template = constants.%.27] +// CHECK:STDOUT: %.loc20_29.5: i32 = converted %.loc20_29.1, %.loc20_29.4 [template = constants.%.27] +// CHECK:STDOUT: %int.snegate.loc20_28: init i32 = call %Negate.ref.loc20_22(%.loc20_29.5) [template = constants.%.28] +// CHECK:STDOUT: %.loc20_43.1: Core.IntLiteral = int_value 1 [template = constants.%.29] +// CHECK:STDOUT: %.loc20_28.1: i32 = value_of_initializer %int.snegate.loc20_28 [template = constants.%.28] +// CHECK:STDOUT: %.loc20_28.2: i32 = converted %int.snegate.loc20_28, %.loc20_28.1 [template = constants.%.28] +// CHECK:STDOUT: %.loc20_43.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc20_43.3: = bound_method %.loc20_43.1, %.loc20_43.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc20_43: init i32 = call %.loc20_43.3(%.loc20_43.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc20_43.4: i32 = value_of_initializer %int.convert_checked.loc20_43 [template = constants.%.31] +// CHECK:STDOUT: %.loc20_43.5: i32 = converted %.loc20_43.1, %.loc20_43.4 [template = constants.%.31] +// CHECK:STDOUT: %int.ssub.loc20: init i32 = call %Sub.ref.loc20(%.loc20_28.2, %.loc20_43.5) [template = constants.%.34] // CHECK:STDOUT: %Negate.ref.loc20_47: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc20_54: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: %int.snegate.loc20_53: init i32 = call %Negate.ref.loc20_47(%.loc20_54) [template = constants.%.4] -// CHECK:STDOUT: %.loc20_21.1: i32 = value_of_initializer %int.ssub.loc20 [template = constants.%.6] -// CHECK:STDOUT: %.loc20_21.2: i32 = converted %int.ssub.loc20, %.loc20_21.1 [template = constants.%.6] -// CHECK:STDOUT: %.loc20_53.1: i32 = value_of_initializer %int.snegate.loc20_53 [template = constants.%.4] -// CHECK:STDOUT: %.loc20_53.2: i32 = converted %int.snegate.loc20_53, %.loc20_53.1 [template = constants.%.4] -// CHECK:STDOUT: %int.smod.loc20: init i32 = call %Mod.ref.loc20(%.loc20_21.2, %.loc20_53.2) [template = constants.%.5] -// CHECK:STDOUT: %.loc20_57.1: i32 = value_of_initializer %int.smod.loc20 [template = constants.%.5] -// CHECK:STDOUT: %.loc20_57.2: i32 = converted %int.smod.loc20, %.loc20_57.1 [template = constants.%.5] +// CHECK:STDOUT: %.loc20_54.1: Core.IntLiteral = int_value 1 [template = constants.%.29] +// CHECK:STDOUT: %.loc20_54.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc20_54.3: = bound_method %.loc20_54.1, %.loc20_54.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc20_54: init i32 = call %.loc20_54.3(%.loc20_54.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc20_54.4: i32 = value_of_initializer %int.convert_checked.loc20_54 [template = constants.%.31] +// CHECK:STDOUT: %.loc20_54.5: i32 = converted %.loc20_54.1, %.loc20_54.4 [template = constants.%.31] +// CHECK:STDOUT: %int.snegate.loc20_53: init i32 = call %Negate.ref.loc20_47(%.loc20_54.5) [template = constants.%.32] +// CHECK:STDOUT: %.loc20_21.1: i32 = value_of_initializer %int.ssub.loc20 [template = constants.%.34] +// CHECK:STDOUT: %.loc20_21.2: i32 = converted %int.ssub.loc20, %.loc20_21.1 [template = constants.%.34] +// CHECK:STDOUT: %.loc20_53.1: i32 = value_of_initializer %int.snegate.loc20_53 [template = constants.%.32] +// CHECK:STDOUT: %.loc20_53.2: i32 = converted %int.snegate.loc20_53, %.loc20_53.1 [template = constants.%.32] +// CHECK:STDOUT: %int.smod.loc20: init i32 = call %Mod.ref.loc20(%.loc20_21.2, %.loc20_53.2) [template = constants.%.33] +// CHECK:STDOUT: %.loc20_57.1: i32 = value_of_initializer %int.smod.loc20 [template = constants.%.33] +// CHECK:STDOUT: %.loc20_57.2: i32 = converted %int.smod.loc20, %.loc20_57.1 [template = constants.%.33] // CHECK:STDOUT: %c: i32 = bind_name c, %.loc20_57.2 // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -382,13 +444,22 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %Mod.type: type = fn_type @Mod [template] // CHECK:STDOUT: %Mod: %Mod.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %.2: i32 = int_value 0 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 0 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 1 [template] +// CHECK:STDOUT: %.29: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -439,16 +510,36 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Mod.ref.loc12: %Mod.type = name_ref Mod, file.%Mod.decl [template = constants.%Mod] -// CHECK:STDOUT: %.loc12_18: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc12_21: i32 = int_value 0 [template = constants.%.2] -// CHECK:STDOUT: %int.smod.loc12: init i32 = call %Mod.ref.loc12(%.loc12_18, %.loc12_21) [template = ] +// CHECK:STDOUT: %.loc12_18.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc12_21.1: Core.IntLiteral = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc12_18.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_18.3: = bound_method %.loc12_18.1, %.loc12_18.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc12_18: init i32 = call %.loc12_18.3(%.loc12_18.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc12_18.4: i32 = value_of_initializer %int.convert_checked.loc12_18 [template = constants.%.28] +// CHECK:STDOUT: %.loc12_18.5: i32 = converted %.loc12_18.1, %.loc12_18.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc12_21.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_21.3: = bound_method %.loc12_21.1, %.loc12_21.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc12_21: init i32 = call %.loc12_21.3(%.loc12_21.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc12_21.4: i32 = value_of_initializer %int.convert_checked.loc12_21 [template = constants.%.30] +// CHECK:STDOUT: %.loc12_21.5: i32 = converted %.loc12_21.1, %.loc12_21.4 [template = constants.%.30] +// CHECK:STDOUT: %int.smod.loc12: init i32 = call %Mod.ref.loc12(%.loc12_18.5, %.loc12_21.5) [template = ] // CHECK:STDOUT: %.loc12_23.1: i32 = value_of_initializer %int.smod.loc12 [template = ] // CHECK:STDOUT: %.loc12_23.2: i32 = converted %int.smod.loc12, %.loc12_23.1 [template = ] // CHECK:STDOUT: %a: i32 = bind_name a, %.loc12_23.2 // CHECK:STDOUT: %Mod.ref.loc17: %Mod.type = name_ref Mod, file.%Mod.decl [template = constants.%Mod] -// CHECK:STDOUT: %.loc17_18: i32 = int_value 0 [template = constants.%.2] -// CHECK:STDOUT: %.loc17_21: i32 = int_value 0 [template = constants.%.2] -// CHECK:STDOUT: %int.smod.loc17: init i32 = call %Mod.ref.loc17(%.loc17_18, %.loc17_21) [template = ] +// CHECK:STDOUT: %.loc17_18.1: Core.IntLiteral = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc17_21.1: Core.IntLiteral = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc17_18.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc17_18.3: = bound_method %.loc17_18.1, %.loc17_18.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc17_18: init i32 = call %.loc17_18.3(%.loc17_18.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc17_18.4: i32 = value_of_initializer %int.convert_checked.loc17_18 [template = constants.%.30] +// CHECK:STDOUT: %.loc17_18.5: i32 = converted %.loc17_18.1, %.loc17_18.4 [template = constants.%.30] +// CHECK:STDOUT: %.loc17_21.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc17_21.3: = bound_method %.loc17_21.1, %.loc17_21.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc17_21: init i32 = call %.loc17_21.3(%.loc17_21.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc17_21.4: i32 = value_of_initializer %int.convert_checked.loc17_21 [template = constants.%.30] +// CHECK:STDOUT: %.loc17_21.5: i32 = converted %.loc17_21.1, %.loc17_21.4 [template = constants.%.30] +// CHECK:STDOUT: %int.smod.loc17: init i32 = call %Mod.ref.loc17(%.loc17_18.5, %.loc17_21.5) [template = ] // CHECK:STDOUT: %.loc17_23.1: i32 = value_of_initializer %int.smod.loc17 [template = ] // CHECK:STDOUT: %.loc17_23.2: i32 = converted %int.smod.loc17, %.loc17_23.1 [template = ] // CHECK:STDOUT: %b: i32 = bind_name b, %.loc17_23.2 diff --git a/toolchain/check/testdata/builtins/int/smul.carbon b/toolchain/check/testdata/builtins/int/smul.carbon index ee55aa21ebfb7..08ac2d506a6be 100644 --- a/toolchain/check/testdata/builtins/int/smul.carbon +++ b/toolchain/check/testdata/builtins/int/smul.carbon @@ -38,17 +38,25 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %Mul.type: type = fn_type @Mul [template] // CHECK:STDOUT: %Mul: %Mul.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 3 [template] -// CHECK:STDOUT: %.2: i32 = int_value 2 [template] -// CHECK:STDOUT: %.3: i32 = int_value 6 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(i32) [template] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] // CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template] // CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template] -// CHECK:STDOUT: %.27: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.28: = bound_method %.3, %Convert.15 [template] -// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 6 [template] -// CHECK:STDOUT: %.30: type = array_type %.29, i32 [template] -// CHECK:STDOUT: %.31: type = ptr_type %.30 [template] +// CHECK:STDOUT: %.26: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 3 [template] +// CHECK:STDOUT: %.29: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 2 [template] +// CHECK:STDOUT: %.31: i32 = int_value 6 [template] +// CHECK:STDOUT: %Convert.type.16: type = fn_type @Convert.12 [template] +// CHECK:STDOUT: %Convert.16: %Convert.type.16 = struct_value () [template] +// CHECK:STDOUT: %.32: = interface_witness (%Convert.16) [template] +// CHECK:STDOUT: %.33: = bound_method %.31, %Convert.16 [template] +// CHECK:STDOUT: %.34: Core.IntLiteral = int_value 6 [template] +// CHECK:STDOUT: %.35: type = array_type %.34, i32 [template] +// CHECK:STDOUT: %.36: type = ptr_type %.35 [template] // CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] // CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] // CHECK:STDOUT: } @@ -97,32 +105,37 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: } // CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %Mul.ref: %Mul.type = name_ref Mul, %Mul.decl [template = constants.%Mul] -// CHECK:STDOUT: %.loc4_20: i32 = int_value 3 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_23: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: %int.smul: init i32 = call %Mul.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] +// CHECK:STDOUT: %.loc4_20.1: Core.IntLiteral = int_value 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc4_23.1: Core.IntLiteral = int_value 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_20.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_20.3: = bound_method %.loc4_20.1, %.loc4_20.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc4_20: init i32 = call %.loc4_20.3(%.loc4_20.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc4_20.4: i32 = value_of_initializer %int.convert_checked.loc4_20 [template = constants.%.28] +// CHECK:STDOUT: %.loc4_20.5: i32 = converted %.loc4_20.1, %.loc4_20.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc4_23.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_23.3: = bound_method %.loc4_23.1, %.loc4_23.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc4_23: init i32 = call %.loc4_23.3(%.loc4_23.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc4_23.4: i32 = value_of_initializer %int.convert_checked.loc4_23 [template = constants.%.30] +// CHECK:STDOUT: %.loc4_23.5: i32 = converted %.loc4_23.1, %.loc4_23.4 [template = constants.%.30] +// CHECK:STDOUT: %int.smul: init i32 = call %Mul.ref(%.loc4_20.5, %.loc4_23.5) [template = constants.%.31] // CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] // CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4, %.loc4_11.1 [template = i32] -// CHECK:STDOUT: %.loc4_19.1: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc4_19.2: = bound_method %int.smul, %.loc4_19.1 [template = constants.%.28] -// CHECK:STDOUT: %.loc4_19.3: i32 = value_of_initializer %int.smul [template = constants.%.3] -// CHECK:STDOUT: %.loc4_19.4: i32 = converted %int.smul, %.loc4_19.3 [template = constants.%.3] -// CHECK:STDOUT: %int.convert_checked.loc4: init Core.IntLiteral = call %.loc4_19.2(%.loc4_19.4) [template = constants.%.29] -// CHECK:STDOUT: %.loc4_19.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4 [template = constants.%.29] -// CHECK:STDOUT: %.loc4_19.6: Core.IntLiteral = converted %int.smul, %.loc4_19.5 [template = constants.%.29] -// CHECK:STDOUT: %.loc4_25: type = array_type %.loc4_19.6, i32 [template = constants.%.30] -// CHECK:STDOUT: %arr.var: ref %.30 = var arr -// CHECK:STDOUT: %arr: ref %.30 = bind_name arr, %arr.var +// CHECK:STDOUT: %.loc4_19.1: %Convert.type.5 = interface_witness_access constants.%.32, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %.loc4_19.2: = bound_method %int.smul, %.loc4_19.1 [template = constants.%.33] +// CHECK:STDOUT: %.loc4_19.3: i32 = value_of_initializer %int.smul [template = constants.%.31] +// CHECK:STDOUT: %.loc4_19.4: i32 = converted %int.smul, %.loc4_19.3 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc4_19: init Core.IntLiteral = call %.loc4_19.2(%.loc4_19.4) [template = constants.%.34] +// CHECK:STDOUT: %.loc4_19.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4_19 [template = constants.%.34] +// CHECK:STDOUT: %.loc4_19.6: Core.IntLiteral = converted %int.smul, %.loc4_19.5 [template = constants.%.34] +// CHECK:STDOUT: %.loc4_25: type = array_type %.loc4_19.6, i32 [template = constants.%.35] +// CHECK:STDOUT: %arr.var: ref %.35 = var arr +// CHECK:STDOUT: %arr: ref %.35 = bind_name arr, %arr.var // CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc5_18.1: i32 = int_value 6 [template = constants.%.3] +// CHECK:STDOUT: %.loc5_18: Core.IntLiteral = int_value 6 [template = constants.%.34] // CHECK:STDOUT: %.loc5_13.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] // CHECK:STDOUT: %.loc5_13.2: type = converted %int.make_type_32.loc5, %.loc5_13.1 [template = i32] -// CHECK:STDOUT: %.loc5_18.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc5_18.3: = bound_method %.loc5_18.1, %.loc5_18.2 [template = constants.%.28] -// CHECK:STDOUT: %int.convert_checked.loc5: init Core.IntLiteral = call %.loc5_18.3(%.loc5_18.1) [template = constants.%.29] -// CHECK:STDOUT: %.loc5_18.4: Core.IntLiteral = value_of_initializer %int.convert_checked.loc5 [template = constants.%.29] -// CHECK:STDOUT: %.loc5_18.5: Core.IntLiteral = converted %.loc5_18.1, %.loc5_18.4 [template = constants.%.29] -// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18.5, i32 [template = constants.%.30] -// CHECK:STDOUT: %.loc5_20: type = ptr_type %.30 [template = constants.%.31] +// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.35] +// CHECK:STDOUT: %.loc5_20: type = ptr_type %.35 [template = constants.%.36] // CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { // CHECK:STDOUT: %a.patt: i32 = binding_pattern a // CHECK:STDOUT: %a.param_patt: i32 = value_param_pattern %a.patt, runtime_param0 @@ -164,9 +177,9 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %.30 = name_ref arr, file.%arr -// CHECK:STDOUT: %.loc5: %.31 = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %.31 = bind_name arr_p, %.loc5 +// CHECK:STDOUT: %arr.ref: ref %.35 = name_ref arr, file.%arr +// CHECK:STDOUT: %.loc5: %.36 = addr_of %arr.ref +// CHECK:STDOUT: %arr_p: %.36 = bind_name arr_p, %.loc5 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -177,16 +190,27 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %Mul.type: type = fn_type @Mul [template] // CHECK:STDOUT: %Mul: %Mul.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 32767 [template] -// CHECK:STDOUT: %.2: i32 = int_value 65536 [template] -// CHECK:STDOUT: %.3: i32 = int_value 2147418112 [template] -// CHECK:STDOUT: %.4: i32 = int_value 32768 [template] -// CHECK:STDOUT: %.5: i32 = int_value -2147483648 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 32767 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 65536 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 32767 [template] +// CHECK:STDOUT: %.29: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 65536 [template] +// CHECK:STDOUT: %.31: i32 = int_value 2147418112 [template] +// CHECK:STDOUT: %.32: Core.IntLiteral = int_value 32768 [template] +// CHECK:STDOUT: %.33: = bound_method %.32, %Convert.15 [template] +// CHECK:STDOUT: %.34: i32 = int_value 32768 [template] +// CHECK:STDOUT: %.35: i32 = int_value -2147483648 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -237,18 +261,38 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Mul.ref.loc6: %Mul.type = name_ref Mul, file.%Mul.decl [template = constants.%Mul] -// CHECK:STDOUT: %.loc6_18: i32 = int_value 32767 [template = constants.%.1] -// CHECK:STDOUT: %.loc6_26: i32 = int_value 65536 [template = constants.%.2] -// CHECK:STDOUT: %int.smul.loc6: init i32 = call %Mul.ref.loc6(%.loc6_18, %.loc6_26) [template = constants.%.3] -// CHECK:STDOUT: %.loc6_34.1: i32 = value_of_initializer %int.smul.loc6 [template = constants.%.3] -// CHECK:STDOUT: %.loc6_34.2: i32 = converted %int.smul.loc6, %.loc6_34.1 [template = constants.%.3] +// CHECK:STDOUT: %.loc6_18.1: Core.IntLiteral = int_value 32767 [template = constants.%.1] +// CHECK:STDOUT: %.loc6_26.1: Core.IntLiteral = int_value 65536 [template = constants.%.2] +// CHECK:STDOUT: %.loc6_18.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc6_18.3: = bound_method %.loc6_18.1, %.loc6_18.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc6_18: init i32 = call %.loc6_18.3(%.loc6_18.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc6_18.4: i32 = value_of_initializer %int.convert_checked.loc6_18 [template = constants.%.28] +// CHECK:STDOUT: %.loc6_18.5: i32 = converted %.loc6_18.1, %.loc6_18.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc6_26.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc6_26.3: = bound_method %.loc6_26.1, %.loc6_26.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc6_26: init i32 = call %.loc6_26.3(%.loc6_26.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc6_26.4: i32 = value_of_initializer %int.convert_checked.loc6_26 [template = constants.%.30] +// CHECK:STDOUT: %.loc6_26.5: i32 = converted %.loc6_26.1, %.loc6_26.4 [template = constants.%.30] +// CHECK:STDOUT: %int.smul.loc6: init i32 = call %Mul.ref.loc6(%.loc6_18.5, %.loc6_26.5) [template = constants.%.31] +// CHECK:STDOUT: %.loc6_34.1: i32 = value_of_initializer %int.smul.loc6 [template = constants.%.31] +// CHECK:STDOUT: %.loc6_34.2: i32 = converted %int.smul.loc6, %.loc6_34.1 [template = constants.%.31] // CHECK:STDOUT: %a: i32 = bind_name a, %.loc6_34.2 // CHECK:STDOUT: %Mul.ref.loc10: %Mul.type = name_ref Mul, file.%Mul.decl [template = constants.%Mul] -// CHECK:STDOUT: %.loc10_18: i32 = int_value 32768 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_26: i32 = int_value 65536 [template = constants.%.2] -// CHECK:STDOUT: %int.smul.loc10: init i32 = call %Mul.ref.loc10(%.loc10_18, %.loc10_26) [template = constants.%.5] -// CHECK:STDOUT: %.loc10_34.1: i32 = value_of_initializer %int.smul.loc10 [template = constants.%.5] -// CHECK:STDOUT: %.loc10_34.2: i32 = converted %int.smul.loc10, %.loc10_34.1 [template = constants.%.5] +// CHECK:STDOUT: %.loc10_18.1: Core.IntLiteral = int_value 32768 [template = constants.%.32] +// CHECK:STDOUT: %.loc10_26.1: Core.IntLiteral = int_value 65536 [template = constants.%.2] +// CHECK:STDOUT: %.loc10_18.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc10_18.3: = bound_method %.loc10_18.1, %.loc10_18.2 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc10_18: init i32 = call %.loc10_18.3(%.loc10_18.1) [template = constants.%.34] +// CHECK:STDOUT: %.loc10_18.4: i32 = value_of_initializer %int.convert_checked.loc10_18 [template = constants.%.34] +// CHECK:STDOUT: %.loc10_18.5: i32 = converted %.loc10_18.1, %.loc10_18.4 [template = constants.%.34] +// CHECK:STDOUT: %.loc10_26.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc10_26.3: = bound_method %.loc10_26.1, %.loc10_26.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc10_26: init i32 = call %.loc10_26.3(%.loc10_26.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc10_26.4: i32 = value_of_initializer %int.convert_checked.loc10_26 [template = constants.%.30] +// CHECK:STDOUT: %.loc10_26.5: i32 = converted %.loc10_26.1, %.loc10_26.4 [template = constants.%.30] +// CHECK:STDOUT: %int.smul.loc10: init i32 = call %Mul.ref.loc10(%.loc10_18.5, %.loc10_26.5) [template = constants.%.35] +// CHECK:STDOUT: %.loc10_34.1: i32 = value_of_initializer %int.smul.loc10 [template = constants.%.35] +// CHECK:STDOUT: %.loc10_34.2: i32 = converted %int.smul.loc10, %.loc10_34.1 [template = constants.%.35] // CHECK:STDOUT: %b: i32 = bind_name b, %.loc10_34.2 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/builtins/int/snegate.carbon b/toolchain/check/testdata/builtins/int/snegate.carbon index b60b69ea1889d..1e134c7c8a48f 100644 --- a/toolchain/check/testdata/builtins/int/snegate.carbon +++ b/toolchain/check/testdata/builtins/int/snegate.carbon @@ -123,18 +123,25 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %Negate.type: type = fn_type @Negate [template] // CHECK:STDOUT: %Negate: %Negate.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 123 [template] -// CHECK:STDOUT: %.2: i32 = int_value -123 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 123 [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(i32) [template] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [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: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.27: = bound_method %.1, %Convert.15 [template] -// CHECK:STDOUT: %.28: Core.IntLiteral = int_value 123 [template] -// CHECK:STDOUT: %.29: type = array_type %.28, i32 [template] -// CHECK:STDOUT: %.30: type = ptr_type %.29 [template] -// CHECK:STDOUT: %.31: i32 = int_value 1 [template] -// CHECK:STDOUT: %.32: i32 = int_value -1 [template] +// CHECK:STDOUT: %.25: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 123 [template] +// CHECK:STDOUT: %.28: i32 = int_value -123 [template] +// CHECK:STDOUT: %Convert.type.16: type = fn_type @Convert.12 [template] +// CHECK:STDOUT: %Convert.16: %Convert.type.16 = struct_value () [template] +// CHECK:STDOUT: %.29: = interface_witness (%Convert.16) [template] +// CHECK:STDOUT: %.30: = bound_method %.27, %Convert.16 [template] +// CHECK:STDOUT: %.31: type = array_type %.1, i32 [template] +// CHECK:STDOUT: %.32: type = ptr_type %.31 [template] +// CHECK:STDOUT: %.33: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.34: = bound_method %.33, %Convert.15 [template] +// CHECK:STDOUT: %.35: i32 = int_value 1 [template] +// CHECK:STDOUT: %.36: i32 = int_value -1 [template] // CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] // CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] // CHECK:STDOUT: } @@ -178,34 +185,34 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %Negate.ref.loc4_16: %Negate.type = name_ref Negate, %Negate.decl [template = constants.%Negate] // CHECK:STDOUT: %Negate.ref.loc4_23: %Negate.type = name_ref Negate, %Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc4_30: i32 = int_value 123 [template = constants.%.1] -// CHECK:STDOUT: %int.snegate.loc4_29: init i32 = call %Negate.ref.loc4_23(%.loc4_30) [template = constants.%.2] -// CHECK:STDOUT: %.loc4_29.1: i32 = value_of_initializer %int.snegate.loc4_29 [template = constants.%.2] -// CHECK:STDOUT: %.loc4_29.2: i32 = converted %int.snegate.loc4_29, %.loc4_29.1 [template = constants.%.2] -// CHECK:STDOUT: %int.snegate.loc4_22: init i32 = call %Negate.ref.loc4_16(%.loc4_29.2) [template = constants.%.1] +// CHECK:STDOUT: %.loc4_30.1: Core.IntLiteral = int_value 123 [template = constants.%.1] +// CHECK:STDOUT: %.loc4_30.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_30.3: = bound_method %.loc4_30.1, %.loc4_30.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc4_30: init i32 = call %.loc4_30.3(%.loc4_30.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc4_30.4: i32 = value_of_initializer %int.convert_checked.loc4_30 [template = constants.%.27] +// CHECK:STDOUT: %.loc4_30.5: i32 = converted %.loc4_30.1, %.loc4_30.4 [template = constants.%.27] +// CHECK:STDOUT: %int.snegate.loc4_29: init i32 = call %Negate.ref.loc4_23(%.loc4_30.5) [template = constants.%.28] +// CHECK:STDOUT: %.loc4_29.1: i32 = value_of_initializer %int.snegate.loc4_29 [template = constants.%.28] +// CHECK:STDOUT: %.loc4_29.2: i32 = converted %int.snegate.loc4_29, %.loc4_29.1 [template = constants.%.28] +// CHECK:STDOUT: %int.snegate.loc4_22: init i32 = call %Negate.ref.loc4_16(%.loc4_29.2) [template = constants.%.27] // CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] // CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4, %.loc4_11.1 [template = i32] -// CHECK:STDOUT: %.loc4_22.1: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc4_22.2: = bound_method %int.snegate.loc4_22, %.loc4_22.1 [template = constants.%.27] -// CHECK:STDOUT: %.loc4_22.3: i32 = value_of_initializer %int.snegate.loc4_22 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_22.4: i32 = converted %int.snegate.loc4_22, %.loc4_22.3 [template = constants.%.1] -// CHECK:STDOUT: %int.convert_checked.loc4: init Core.IntLiteral = call %.loc4_22.2(%.loc4_22.4) [template = constants.%.28] -// CHECK:STDOUT: %.loc4_22.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4 [template = constants.%.28] -// CHECK:STDOUT: %.loc4_22.6: Core.IntLiteral = converted %int.snegate.loc4_22, %.loc4_22.5 [template = constants.%.28] -// CHECK:STDOUT: %.loc4_35: type = array_type %.loc4_22.6, i32 [template = constants.%.29] -// CHECK:STDOUT: %arr.var: ref %.29 = var arr -// CHECK:STDOUT: %arr: ref %.29 = bind_name arr, %arr.var +// CHECK:STDOUT: %.loc4_22.1: %Convert.type.5 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %.loc4_22.2: = bound_method %int.snegate.loc4_22, %.loc4_22.1 [template = constants.%.30] +// CHECK:STDOUT: %.loc4_22.3: i32 = value_of_initializer %int.snegate.loc4_22 [template = constants.%.27] +// CHECK:STDOUT: %.loc4_22.4: i32 = converted %int.snegate.loc4_22, %.loc4_22.3 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc4_22: init Core.IntLiteral = call %.loc4_22.2(%.loc4_22.4) [template = constants.%.1] +// CHECK:STDOUT: %.loc4_22.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4_22 [template = constants.%.1] +// CHECK:STDOUT: %.loc4_22.6: Core.IntLiteral = converted %int.snegate.loc4_22, %.loc4_22.5 [template = constants.%.1] +// CHECK:STDOUT: %.loc4_35: type = array_type %.loc4_22.6, i32 [template = constants.%.31] +// CHECK:STDOUT: %arr.var: ref %.31 = var arr +// CHECK:STDOUT: %arr: ref %.31 = bind_name arr, %arr.var // CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc5_18.1: i32 = int_value 123 [template = constants.%.1] +// CHECK:STDOUT: %.loc5_18: Core.IntLiteral = int_value 123 [template = constants.%.1] // CHECK:STDOUT: %.loc5_13.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] // CHECK:STDOUT: %.loc5_13.2: type = converted %int.make_type_32.loc5, %.loc5_13.1 [template = i32] -// CHECK:STDOUT: %.loc5_18.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc5_18.3: = bound_method %.loc5_18.1, %.loc5_18.2 [template = constants.%.27] -// CHECK:STDOUT: %int.convert_checked.loc5: init Core.IntLiteral = call %.loc5_18.3(%.loc5_18.1) [template = constants.%.28] -// CHECK:STDOUT: %.loc5_18.4: Core.IntLiteral = value_of_initializer %int.convert_checked.loc5 [template = constants.%.28] -// CHECK:STDOUT: %.loc5_18.5: Core.IntLiteral = converted %.loc5_18.1, %.loc5_18.4 [template = constants.%.28] -// CHECK:STDOUT: %.loc5_21: type = array_type %.loc5_18.5, i32 [template = constants.%.29] -// CHECK:STDOUT: %.loc5_22: type = ptr_type %.29 [template = constants.%.30] +// CHECK:STDOUT: %.loc5_21: type = array_type %.loc5_18, i32 [template = constants.%.31] +// CHECK:STDOUT: %.loc5_22: type = ptr_type %.31 [template = constants.%.32] // CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc7_8.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] // CHECK:STDOUT: %.loc7_8.2: type = converted %int.make_type_32.loc7, %.loc7_8.1 [template = i32] @@ -249,14 +256,19 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %.29 = name_ref arr, file.%arr -// CHECK:STDOUT: %.loc5: %.30 = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %.30 = bind_name arr_p, %.loc5 +// CHECK:STDOUT: %arr.ref: ref %.31 = name_ref arr, file.%arr +// CHECK:STDOUT: %.loc5: %.32 = addr_of %arr.ref +// CHECK:STDOUT: %arr_p: %.32 = bind_name arr_p, %.loc5 // CHECK:STDOUT: %Negate.ref: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc7_21: i32 = int_value 1 [template = constants.%.31] -// CHECK:STDOUT: %int.snegate: init i32 = call %Negate.ref(%.loc7_21) [template = constants.%.32] -// CHECK:STDOUT: %.loc7_23.1: i32 = value_of_initializer %int.snegate [template = constants.%.32] -// CHECK:STDOUT: %.loc7_23.2: i32 = converted %int.snegate, %.loc7_23.1 [template = constants.%.32] +// CHECK:STDOUT: %.loc7_21.1: Core.IntLiteral = int_value 1 [template = constants.%.33] +// CHECK:STDOUT: %.loc7_21.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc7_21.3: = bound_method %.loc7_21.1, %.loc7_21.2 [template = constants.%.34] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc7_21.3(%.loc7_21.1) [template = constants.%.35] +// CHECK:STDOUT: %.loc7_21.4: i32 = value_of_initializer %int.convert_checked [template = constants.%.35] +// CHECK:STDOUT: %.loc7_21.5: i32 = converted %.loc7_21.1, %.loc7_21.4 [template = constants.%.35] +// CHECK:STDOUT: %int.snegate: init i32 = call %Negate.ref(%.loc7_21.5) [template = constants.%.36] +// CHECK:STDOUT: %.loc7_23.1: i32 = value_of_initializer %int.snegate [template = constants.%.36] +// CHECK:STDOUT: %.loc7_23.2: i32 = converted %int.snegate, %.loc7_23.1 [template = constants.%.36] // CHECK:STDOUT: %n: i32 = bind_name n, %.loc7_23.2 // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -276,8 +288,16 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: %BadReturnType: %BadReturnType.type = struct_value () [template] // CHECK:STDOUT: %JustRight.type: type = fn_type @JustRight [template] // CHECK:STDOUT: %JustRight: %JustRight.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %.2: i32 = int_value 2 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 2 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 1 [template] +// CHECK:STDOUT: %.29: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 2 [template] // CHECK:STDOUT: %RuntimeCallTooFew.type: type = fn_type @RuntimeCallTooFew [template] // CHECK:STDOUT: %RuntimeCallTooFew: %RuntimeCallTooFew.type = struct_value () [template] // CHECK:STDOUT: %RuntimeCallTooMany.type: type = fn_type @RuntimeCallTooMany [template] @@ -290,6 +310,7 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int32 = %import_ref.1 // CHECK:STDOUT: .Bool = %import_ref.2 +// CHECK:STDOUT: .ImplicitAs = %import_ref.3 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -388,25 +409,40 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: %too_few: ref = bind_name too_few, %too_few.var // CHECK:STDOUT: %int.make_type_32.loc30: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %TooMany.ref: %TooMany.type = name_ref TooMany, %TooMany.decl [template = constants.%TooMany] -// CHECK:STDOUT: %.loc30_29: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc30_32: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: %TooMany.call: init i32 = call %TooMany.ref(%.loc30_29, %.loc30_32) +// CHECK:STDOUT: %.loc30_29.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc30_32.1: Core.IntLiteral = int_value 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc30_29.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc30_29.3: = bound_method %.loc30_29.1, %.loc30_29.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc30_29: init i32 = call %.loc30_29.3(%.loc30_29.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc30_29.4: i32 = value_of_initializer %int.convert_checked.loc30_29 [template = constants.%.28] +// CHECK:STDOUT: %.loc30_29.5: i32 = converted %.loc30_29.1, %.loc30_29.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc30_32.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc30_32.3: = bound_method %.loc30_32.1, %.loc30_32.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc30_32: init i32 = call %.loc30_32.3(%.loc30_32.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc30_32.4: i32 = value_of_initializer %int.convert_checked.loc30_32 [template = constants.%.30] +// CHECK:STDOUT: %.loc30_32.5: i32 = converted %.loc30_32.1, %.loc30_32.4 [template = constants.%.30] +// CHECK:STDOUT: %TooMany.call: init i32 = call %TooMany.ref(%.loc30_29.5, %.loc30_32.5) // CHECK:STDOUT: %.loc30_16.1: type = value_of_initializer %int.make_type_32.loc30 [template = i32] // CHECK:STDOUT: %.loc30_16.2: type = converted %int.make_type_32.loc30, %.loc30_16.1 [template = i32] // CHECK:STDOUT: %too_many.var: ref = var too_many // CHECK:STDOUT: %too_many: ref = bind_name too_many, %too_many.var // CHECK:STDOUT: %int.make_type_32.loc35: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %BadReturnType.ref: %BadReturnType.type = name_ref BadReturnType, %BadReturnType.decl [template = constants.%BadReturnType] -// CHECK:STDOUT: %.loc35_42: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref(%.loc35_42) +// CHECK:STDOUT: %.loc35_42.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc35_42.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc35_42.3: = bound_method %.loc35_42.1, %.loc35_42.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc35: init i32 = call %.loc35_42.3(%.loc35_42.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc35_42.4: i32 = value_of_initializer %int.convert_checked.loc35 [template = constants.%.28] +// CHECK:STDOUT: %.loc35_42.5: i32 = converted %.loc35_42.1, %.loc35_42.4 [template = constants.%.28] +// CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref(%.loc35_42.5) // CHECK:STDOUT: %.loc35_23.1: type = value_of_initializer %int.make_type_32.loc35 [template = i32] // CHECK:STDOUT: %.loc35_23.2: type = converted %int.make_type_32.loc35, %.loc35_23.1 [template = i32] // CHECK:STDOUT: %bad_return_type.var: ref = var bad_return_type // CHECK:STDOUT: %bad_return_type: ref = bind_name bad_return_type, %bad_return_type.var // CHECK:STDOUT: %int.make_type_32.loc44: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %JustRight.ref: %JustRight.type = name_ref JustRight, %JustRight.decl [template = constants.%JustRight] -// CHECK:STDOUT: %.loc44_31: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc44_34: i32 = int_value 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc44_31: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc44_34: Core.IntLiteral = int_value 2 [template = constants.%.2] // CHECK:STDOUT: %.loc44_16.1: type = value_of_initializer %int.make_type_32.loc44 [template = i32] // CHECK:STDOUT: %.loc44_16.2: type = converted %int.make_type_32.loc44, %.loc44_16.1 [template = i32] // CHECK:STDOUT: %.loc44_36: type = array_type , i32 [template = ] @@ -527,15 +563,24 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: %Negate: %Negate.type = struct_value () [template] // CHECK:STDOUT: %Sub.type: type = fn_type @Sub [template] // CHECK:STDOUT: %Sub: %Sub.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 2147483647 [template] -// CHECK:STDOUT: %.2: i32 = int_value -2147483647 [template] -// CHECK:STDOUT: %.3: i32 = int_value 1 [template] -// CHECK:STDOUT: %.4: i32 = int_value -2147483648 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 2147483647 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 2147483647 [template] +// CHECK:STDOUT: %.28: i32 = int_value -2147483647 [template] +// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.30: = bound_method %.29, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 1 [template] +// CHECK:STDOUT: %.32: i32 = int_value -2147483648 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -607,28 +652,43 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Negate.ref.loc8_14: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] // CHECK:STDOUT: %Negate.ref.loc8_21: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc8_28: i32 = int_value 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %int.snegate.loc8_27: init i32 = call %Negate.ref.loc8_21(%.loc8_28) [template = constants.%.2] -// CHECK:STDOUT: %.loc8_27.1: i32 = value_of_initializer %int.snegate.loc8_27 [template = constants.%.2] -// CHECK:STDOUT: %.loc8_27.2: i32 = converted %int.snegate.loc8_27, %.loc8_27.1 [template = constants.%.2] -// CHECK:STDOUT: %int.snegate.loc8_20: init i32 = call %Negate.ref.loc8_14(%.loc8_27.2) [template = constants.%.1] -// CHECK:STDOUT: %.loc8_40.1: i32 = value_of_initializer %int.snegate.loc8_20 [template = constants.%.1] -// CHECK:STDOUT: %.loc8_40.2: i32 = converted %int.snegate.loc8_20, %.loc8_40.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc8_28.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.1] +// CHECK:STDOUT: %.loc8_28.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc8_28.3: = bound_method %.loc8_28.1, %.loc8_28.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc8: init i32 = call %.loc8_28.3(%.loc8_28.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc8_28.4: i32 = value_of_initializer %int.convert_checked.loc8 [template = constants.%.27] +// CHECK:STDOUT: %.loc8_28.5: i32 = converted %.loc8_28.1, %.loc8_28.4 [template = constants.%.27] +// CHECK:STDOUT: %int.snegate.loc8_27: init i32 = call %Negate.ref.loc8_21(%.loc8_28.5) [template = constants.%.28] +// CHECK:STDOUT: %.loc8_27.1: i32 = value_of_initializer %int.snegate.loc8_27 [template = constants.%.28] +// CHECK:STDOUT: %.loc8_27.2: i32 = converted %int.snegate.loc8_27, %.loc8_27.1 [template = constants.%.28] +// CHECK:STDOUT: %int.snegate.loc8_20: init i32 = call %Negate.ref.loc8_14(%.loc8_27.2) [template = constants.%.27] +// CHECK:STDOUT: %.loc8_40.1: i32 = value_of_initializer %int.snegate.loc8_20 [template = constants.%.27] +// CHECK:STDOUT: %.loc8_40.2: i32 = converted %int.snegate.loc8_20, %.loc8_40.1 [template = constants.%.27] // CHECK:STDOUT: %a: i32 = bind_name a, %.loc8_40.2 // CHECK:STDOUT: %Negate.ref.loc14_14: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] // CHECK:STDOUT: %Sub.ref: %Sub.type = name_ref Sub, file.%Sub.decl [template = constants.%Sub] // CHECK:STDOUT: %Negate.ref.loc14_25: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc14_32: i32 = int_value 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %int.snegate.loc14_31: init i32 = call %Negate.ref.loc14_25(%.loc14_32) [template = constants.%.2] -// CHECK:STDOUT: %.loc14_45: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc14_31.1: i32 = value_of_initializer %int.snegate.loc14_31 [template = constants.%.2] -// CHECK:STDOUT: %.loc14_31.2: i32 = converted %int.snegate.loc14_31, %.loc14_31.1 [template = constants.%.2] -// CHECK:STDOUT: %int.ssub: init i32 = call %Sub.ref(%.loc14_31.2, %.loc14_45) [template = constants.%.4] -// CHECK:STDOUT: %.loc14_24.1: i32 = value_of_initializer %int.ssub [template = constants.%.4] -// CHECK:STDOUT: %.loc14_24.2: i32 = converted %int.ssub, %.loc14_24.1 [template = constants.%.4] -// CHECK:STDOUT: %int.snegate.loc14_20: init i32 = call %Negate.ref.loc14_14(%.loc14_24.2) [template = constants.%.4] -// CHECK:STDOUT: %.loc14_48.1: i32 = value_of_initializer %int.snegate.loc14_20 [template = constants.%.4] -// CHECK:STDOUT: %.loc14_48.2: i32 = converted %int.snegate.loc14_20, %.loc14_48.1 [template = constants.%.4] +// CHECK:STDOUT: %.loc14_32.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.1] +// CHECK:STDOUT: %.loc14_32.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc14_32.3: = bound_method %.loc14_32.1, %.loc14_32.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc14_32: init i32 = call %.loc14_32.3(%.loc14_32.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc14_32.4: i32 = value_of_initializer %int.convert_checked.loc14_32 [template = constants.%.27] +// CHECK:STDOUT: %.loc14_32.5: i32 = converted %.loc14_32.1, %.loc14_32.4 [template = constants.%.27] +// CHECK:STDOUT: %int.snegate.loc14_31: init i32 = call %Negate.ref.loc14_25(%.loc14_32.5) [template = constants.%.28] +// CHECK:STDOUT: %.loc14_45.1: Core.IntLiteral = int_value 1 [template = constants.%.29] +// CHECK:STDOUT: %.loc14_31.1: i32 = value_of_initializer %int.snegate.loc14_31 [template = constants.%.28] +// CHECK:STDOUT: %.loc14_31.2: i32 = converted %int.snegate.loc14_31, %.loc14_31.1 [template = constants.%.28] +// CHECK:STDOUT: %.loc14_45.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc14_45.3: = bound_method %.loc14_45.1, %.loc14_45.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc14_45: init i32 = call %.loc14_45.3(%.loc14_45.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc14_45.4: i32 = value_of_initializer %int.convert_checked.loc14_45 [template = constants.%.31] +// CHECK:STDOUT: %.loc14_45.5: i32 = converted %.loc14_45.1, %.loc14_45.4 [template = constants.%.31] +// CHECK:STDOUT: %int.ssub: init i32 = call %Sub.ref(%.loc14_31.2, %.loc14_45.5) [template = constants.%.32] +// CHECK:STDOUT: %.loc14_24.1: i32 = value_of_initializer %int.ssub [template = constants.%.32] +// CHECK:STDOUT: %.loc14_24.2: i32 = converted %int.ssub, %.loc14_24.1 [template = constants.%.32] +// CHECK:STDOUT: %int.snegate.loc14_20: init i32 = call %Negate.ref.loc14_14(%.loc14_24.2) [template = constants.%.32] +// CHECK:STDOUT: %.loc14_48.1: i32 = value_of_initializer %int.snegate.loc14_20 [template = constants.%.32] +// CHECK:STDOUT: %.loc14_48.2: i32 = converted %int.snegate.loc14_20, %.loc14_48.1 [template = constants.%.32] // CHECK:STDOUT: %b: i32 = bind_name b, %.loc14_48.2 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/builtins/int/ssub.carbon b/toolchain/check/testdata/builtins/int/ssub.carbon index 6b8c18c711e82..ffd21dace057d 100644 --- a/toolchain/check/testdata/builtins/int/ssub.carbon +++ b/toolchain/check/testdata/builtins/int/ssub.carbon @@ -39,17 +39,25 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %Sub.type: type = fn_type @Sub [template] // CHECK:STDOUT: %Sub: %Sub.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 3 [template] -// CHECK:STDOUT: %.2: i32 = int_value 2 [template] -// CHECK:STDOUT: %.3: i32 = int_value 1 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(i32) [template] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] // CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template] // CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template] -// CHECK:STDOUT: %.27: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.28: = bound_method %.3, %Convert.15 [template] -// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %.30: type = array_type %.29, i32 [template] -// CHECK:STDOUT: %.31: type = ptr_type %.30 [template] +// CHECK:STDOUT: %.26: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 3 [template] +// CHECK:STDOUT: %.29: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 2 [template] +// CHECK:STDOUT: %.31: i32 = int_value 1 [template] +// CHECK:STDOUT: %Convert.type.16: type = fn_type @Convert.12 [template] +// CHECK:STDOUT: %Convert.16: %Convert.type.16 = struct_value () [template] +// CHECK:STDOUT: %.32: = interface_witness (%Convert.16) [template] +// CHECK:STDOUT: %.33: = bound_method %.31, %Convert.16 [template] +// CHECK:STDOUT: %.34: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.35: type = array_type %.34, i32 [template] +// CHECK:STDOUT: %.36: type = ptr_type %.35 [template] // CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] // CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] // CHECK:STDOUT: } @@ -98,32 +106,37 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDOUT: } // CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %Sub.ref: %Sub.type = name_ref Sub, %Sub.decl [template = constants.%Sub] -// CHECK:STDOUT: %.loc4_20: i32 = int_value 3 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_23: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: %int.ssub: init i32 = call %Sub.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] +// CHECK:STDOUT: %.loc4_20.1: Core.IntLiteral = int_value 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc4_23.1: Core.IntLiteral = int_value 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_20.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_20.3: = bound_method %.loc4_20.1, %.loc4_20.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc4_20: init i32 = call %.loc4_20.3(%.loc4_20.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc4_20.4: i32 = value_of_initializer %int.convert_checked.loc4_20 [template = constants.%.28] +// CHECK:STDOUT: %.loc4_20.5: i32 = converted %.loc4_20.1, %.loc4_20.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc4_23.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_23.3: = bound_method %.loc4_23.1, %.loc4_23.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc4_23: init i32 = call %.loc4_23.3(%.loc4_23.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc4_23.4: i32 = value_of_initializer %int.convert_checked.loc4_23 [template = constants.%.30] +// CHECK:STDOUT: %.loc4_23.5: i32 = converted %.loc4_23.1, %.loc4_23.4 [template = constants.%.30] +// CHECK:STDOUT: %int.ssub: init i32 = call %Sub.ref(%.loc4_20.5, %.loc4_23.5) [template = constants.%.31] // CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] // CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4, %.loc4_11.1 [template = i32] -// CHECK:STDOUT: %.loc4_19.1: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc4_19.2: = bound_method %int.ssub, %.loc4_19.1 [template = constants.%.28] -// CHECK:STDOUT: %.loc4_19.3: i32 = value_of_initializer %int.ssub [template = constants.%.3] -// CHECK:STDOUT: %.loc4_19.4: i32 = converted %int.ssub, %.loc4_19.3 [template = constants.%.3] -// CHECK:STDOUT: %int.convert_checked.loc4: init Core.IntLiteral = call %.loc4_19.2(%.loc4_19.4) [template = constants.%.29] -// CHECK:STDOUT: %.loc4_19.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4 [template = constants.%.29] -// CHECK:STDOUT: %.loc4_19.6: Core.IntLiteral = converted %int.ssub, %.loc4_19.5 [template = constants.%.29] -// CHECK:STDOUT: %.loc4_25: type = array_type %.loc4_19.6, i32 [template = constants.%.30] -// CHECK:STDOUT: %arr.var: ref %.30 = var arr -// CHECK:STDOUT: %arr: ref %.30 = bind_name arr, %arr.var +// CHECK:STDOUT: %.loc4_19.1: %Convert.type.5 = interface_witness_access constants.%.32, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %.loc4_19.2: = bound_method %int.ssub, %.loc4_19.1 [template = constants.%.33] +// CHECK:STDOUT: %.loc4_19.3: i32 = value_of_initializer %int.ssub [template = constants.%.31] +// CHECK:STDOUT: %.loc4_19.4: i32 = converted %int.ssub, %.loc4_19.3 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc4_19: init Core.IntLiteral = call %.loc4_19.2(%.loc4_19.4) [template = constants.%.34] +// CHECK:STDOUT: %.loc4_19.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4_19 [template = constants.%.34] +// CHECK:STDOUT: %.loc4_19.6: Core.IntLiteral = converted %int.ssub, %.loc4_19.5 [template = constants.%.34] +// CHECK:STDOUT: %.loc4_25: type = array_type %.loc4_19.6, i32 [template = constants.%.35] +// CHECK:STDOUT: %arr.var: ref %.35 = var arr +// CHECK:STDOUT: %arr: ref %.35 = bind_name arr, %arr.var // CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc5_18.1: i32 = int_value 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc5_18: Core.IntLiteral = int_value 1 [template = constants.%.34] // CHECK:STDOUT: %.loc5_13.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] // CHECK:STDOUT: %.loc5_13.2: type = converted %int.make_type_32.loc5, %.loc5_13.1 [template = i32] -// CHECK:STDOUT: %.loc5_18.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc5_18.3: = bound_method %.loc5_18.1, %.loc5_18.2 [template = constants.%.28] -// CHECK:STDOUT: %int.convert_checked.loc5: init Core.IntLiteral = call %.loc5_18.3(%.loc5_18.1) [template = constants.%.29] -// CHECK:STDOUT: %.loc5_18.4: Core.IntLiteral = value_of_initializer %int.convert_checked.loc5 [template = constants.%.29] -// CHECK:STDOUT: %.loc5_18.5: Core.IntLiteral = converted %.loc5_18.1, %.loc5_18.4 [template = constants.%.29] -// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18.5, i32 [template = constants.%.30] -// CHECK:STDOUT: %.loc5_20: type = ptr_type %.30 [template = constants.%.31] +// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.35] +// CHECK:STDOUT: %.loc5_20: type = ptr_type %.35 [template = constants.%.36] // CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { // CHECK:STDOUT: %a.patt: i32 = binding_pattern a // CHECK:STDOUT: %a.param_patt: i32 = value_param_pattern %a.patt, runtime_param0 @@ -165,9 +178,9 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %.30 = name_ref arr, file.%arr -// CHECK:STDOUT: %.loc5: %.31 = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %.31 = bind_name arr_p, %.loc5 +// CHECK:STDOUT: %arr.ref: ref %.35 = name_ref arr, file.%arr +// CHECK:STDOUT: %.loc5: %.36 = addr_of %arr.ref +// CHECK:STDOUT: %arr_p: %.36 = bind_name arr_p, %.loc5 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -178,17 +191,30 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %Sub.type: type = fn_type @Sub [template] // CHECK:STDOUT: %Sub: %Sub.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] -// CHECK:STDOUT: %.2: i32 = int_value 2147483647 [template] -// CHECK:STDOUT: %.3: i32 = int_value -2147483647 [template] -// CHECK:STDOUT: %.4: i32 = int_value 1 [template] -// CHECK:STDOUT: %.5: i32 = int_value -2147483648 [template] -// CHECK:STDOUT: %.6: i32 = int_value 2 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 2147483647 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 0 [template] +// CHECK:STDOUT: %.29: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 2147483647 [template] +// CHECK:STDOUT: %.31: i32 = int_value -2147483647 [template] +// CHECK:STDOUT: %.32: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.33: = bound_method %.32, %Convert.15 [template] +// CHECK:STDOUT: %.34: i32 = int_value 1 [template] +// CHECK:STDOUT: %.35: i32 = int_value -2147483648 [template] +// CHECK:STDOUT: %.36: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.37: = bound_method %.36, %Convert.15 [template] +// CHECK:STDOUT: %.38: i32 = int_value 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -243,35 +269,75 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Sub.ref.loc6: %Sub.type = name_ref Sub, file.%Sub.decl [template = constants.%Sub] -// CHECK:STDOUT: %.loc6_18: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: %.loc6_21: i32 = int_value 2147483647 [template = constants.%.2] -// CHECK:STDOUT: %int.ssub.loc6: init i32 = call %Sub.ref.loc6(%.loc6_18, %.loc6_21) [template = constants.%.3] -// CHECK:STDOUT: %.loc6_32.1: i32 = value_of_initializer %int.ssub.loc6 [template = constants.%.3] -// CHECK:STDOUT: %.loc6_32.2: i32 = converted %int.ssub.loc6, %.loc6_32.1 [template = constants.%.3] +// CHECK:STDOUT: %.loc6_18.1: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc6_21.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.2] +// CHECK:STDOUT: %.loc6_18.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc6_18.3: = bound_method %.loc6_18.1, %.loc6_18.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc6_18: init i32 = call %.loc6_18.3(%.loc6_18.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc6_18.4: i32 = value_of_initializer %int.convert_checked.loc6_18 [template = constants.%.28] +// CHECK:STDOUT: %.loc6_18.5: i32 = converted %.loc6_18.1, %.loc6_18.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc6_21.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc6_21.3: = bound_method %.loc6_21.1, %.loc6_21.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc6_21: init i32 = call %.loc6_21.3(%.loc6_21.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc6_21.4: i32 = value_of_initializer %int.convert_checked.loc6_21 [template = constants.%.30] +// CHECK:STDOUT: %.loc6_21.5: i32 = converted %.loc6_21.1, %.loc6_21.4 [template = constants.%.30] +// CHECK:STDOUT: %int.ssub.loc6: init i32 = call %Sub.ref.loc6(%.loc6_18.5, %.loc6_21.5) [template = constants.%.31] +// CHECK:STDOUT: %.loc6_32.1: i32 = value_of_initializer %int.ssub.loc6 [template = constants.%.31] +// CHECK:STDOUT: %.loc6_32.2: i32 = converted %int.ssub.loc6, %.loc6_32.1 [template = constants.%.31] // CHECK:STDOUT: %a: i32 = bind_name a, %.loc6_32.2 // CHECK:STDOUT: %Sub.ref.loc7_14: %Sub.type = name_ref Sub, file.%Sub.decl [template = constants.%Sub] // CHECK:STDOUT: %Sub.ref.loc7_18: %Sub.type = name_ref Sub, file.%Sub.decl [template = constants.%Sub] -// CHECK:STDOUT: %.loc7_22: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: %.loc7_25: i32 = int_value 2147483647 [template = constants.%.2] -// CHECK:STDOUT: %int.ssub.loc7_21: init i32 = call %Sub.ref.loc7_18(%.loc7_22, %.loc7_25) [template = constants.%.3] -// CHECK:STDOUT: %.loc7_38: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc7_21.1: i32 = value_of_initializer %int.ssub.loc7_21 [template = constants.%.3] -// CHECK:STDOUT: %.loc7_21.2: i32 = converted %int.ssub.loc7_21, %.loc7_21.1 [template = constants.%.3] -// CHECK:STDOUT: %int.ssub.loc7_17: init i32 = call %Sub.ref.loc7_14(%.loc7_21.2, %.loc7_38) [template = constants.%.5] -// CHECK:STDOUT: %.loc7_40.1: i32 = value_of_initializer %int.ssub.loc7_17 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_40.2: i32 = converted %int.ssub.loc7_17, %.loc7_40.1 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_22.1: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc7_25.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.2] +// CHECK:STDOUT: %.loc7_22.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc7_22.3: = bound_method %.loc7_22.1, %.loc7_22.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc7_22: init i32 = call %.loc7_22.3(%.loc7_22.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc7_22.4: i32 = value_of_initializer %int.convert_checked.loc7_22 [template = constants.%.28] +// CHECK:STDOUT: %.loc7_22.5: i32 = converted %.loc7_22.1, %.loc7_22.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc7_25.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc7_25.3: = bound_method %.loc7_25.1, %.loc7_25.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc7_25: init i32 = call %.loc7_25.3(%.loc7_25.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc7_25.4: i32 = value_of_initializer %int.convert_checked.loc7_25 [template = constants.%.30] +// CHECK:STDOUT: %.loc7_25.5: i32 = converted %.loc7_25.1, %.loc7_25.4 [template = constants.%.30] +// CHECK:STDOUT: %int.ssub.loc7_21: init i32 = call %Sub.ref.loc7_18(%.loc7_22.5, %.loc7_25.5) [template = constants.%.31] +// CHECK:STDOUT: %.loc7_38.1: Core.IntLiteral = int_value 1 [template = constants.%.32] +// CHECK:STDOUT: %.loc7_21.1: i32 = value_of_initializer %int.ssub.loc7_21 [template = constants.%.31] +// CHECK:STDOUT: %.loc7_21.2: i32 = converted %int.ssub.loc7_21, %.loc7_21.1 [template = constants.%.31] +// CHECK:STDOUT: %.loc7_38.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc7_38.3: = bound_method %.loc7_38.1, %.loc7_38.2 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc7_38: init i32 = call %.loc7_38.3(%.loc7_38.1) [template = constants.%.34] +// CHECK:STDOUT: %.loc7_38.4: i32 = value_of_initializer %int.convert_checked.loc7_38 [template = constants.%.34] +// CHECK:STDOUT: %.loc7_38.5: i32 = converted %.loc7_38.1, %.loc7_38.4 [template = constants.%.34] +// CHECK:STDOUT: %int.ssub.loc7_17: init i32 = call %Sub.ref.loc7_14(%.loc7_21.2, %.loc7_38.5) [template = constants.%.35] +// CHECK:STDOUT: %.loc7_40.1: i32 = value_of_initializer %int.ssub.loc7_17 [template = constants.%.35] +// CHECK:STDOUT: %.loc7_40.2: i32 = converted %int.ssub.loc7_17, %.loc7_40.1 [template = constants.%.35] // CHECK:STDOUT: %b: i32 = bind_name b, %.loc7_40.2 // CHECK:STDOUT: %Sub.ref.loc11_14: %Sub.type = name_ref Sub, file.%Sub.decl [template = constants.%Sub] // CHECK:STDOUT: %Sub.ref.loc11_18: %Sub.type = name_ref Sub, file.%Sub.decl [template = constants.%Sub] -// CHECK:STDOUT: %.loc11_22: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: %.loc11_25: i32 = int_value 2147483647 [template = constants.%.2] -// CHECK:STDOUT: %int.ssub.loc11_21: init i32 = call %Sub.ref.loc11_18(%.loc11_22, %.loc11_25) [template = constants.%.3] -// CHECK:STDOUT: %.loc11_38: i32 = int_value 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc11_21.1: i32 = value_of_initializer %int.ssub.loc11_21 [template = constants.%.3] -// CHECK:STDOUT: %.loc11_21.2: i32 = converted %int.ssub.loc11_21, %.loc11_21.1 [template = constants.%.3] -// CHECK:STDOUT: %int.ssub.loc11_17: init i32 = call %Sub.ref.loc11_14(%.loc11_21.2, %.loc11_38) [template = constants.%.2] -// CHECK:STDOUT: %.loc11_40.1: i32 = value_of_initializer %int.ssub.loc11_17 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_40.2: i32 = converted %int.ssub.loc11_17, %.loc11_40.1 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_22.1: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_25.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_22.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_22.3: = bound_method %.loc11_22.1, %.loc11_22.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc11_22: init i32 = call %.loc11_22.3(%.loc11_22.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc11_22.4: i32 = value_of_initializer %int.convert_checked.loc11_22 [template = constants.%.28] +// CHECK:STDOUT: %.loc11_22.5: i32 = converted %.loc11_22.1, %.loc11_22.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc11_25.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_25.3: = bound_method %.loc11_25.1, %.loc11_25.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc11_25: init i32 = call %.loc11_25.3(%.loc11_25.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc11_25.4: i32 = value_of_initializer %int.convert_checked.loc11_25 [template = constants.%.30] +// CHECK:STDOUT: %.loc11_25.5: i32 = converted %.loc11_25.1, %.loc11_25.4 [template = constants.%.30] +// CHECK:STDOUT: %int.ssub.loc11_21: init i32 = call %Sub.ref.loc11_18(%.loc11_22.5, %.loc11_25.5) [template = constants.%.31] +// CHECK:STDOUT: %.loc11_38.1: Core.IntLiteral = int_value 2 [template = constants.%.36] +// CHECK:STDOUT: %.loc11_21.1: i32 = value_of_initializer %int.ssub.loc11_21 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_21.2: i32 = converted %int.ssub.loc11_21, %.loc11_21.1 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_38.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_38.3: = bound_method %.loc11_38.1, %.loc11_38.2 [template = constants.%.37] +// CHECK:STDOUT: %int.convert_checked.loc11_38: init i32 = call %.loc11_38.3(%.loc11_38.1) [template = constants.%.38] +// CHECK:STDOUT: %.loc11_38.4: i32 = value_of_initializer %int.convert_checked.loc11_38 [template = constants.%.38] +// CHECK:STDOUT: %.loc11_38.5: i32 = converted %.loc11_38.1, %.loc11_38.4 [template = constants.%.38] +// CHECK:STDOUT: %int.ssub.loc11_17: init i32 = call %Sub.ref.loc11_14(%.loc11_21.2, %.loc11_38.5) [template = constants.%.30] +// CHECK:STDOUT: %.loc11_40.1: i32 = value_of_initializer %int.ssub.loc11_17 [template = constants.%.30] +// CHECK:STDOUT: %.loc11_40.2: i32 = converted %int.ssub.loc11_17, %.loc11_40.1 [template = constants.%.30] // CHECK:STDOUT: %c: i32 = bind_name c, %.loc11_40.2 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/builtins/int/uadd.carbon b/toolchain/check/testdata/builtins/int/uadd.carbon index c445539406628..1f54c12769a61 100644 --- a/toolchain/check/testdata/builtins/int/uadd.carbon +++ b/toolchain/check/testdata/builtins/int/uadd.carbon @@ -93,17 +93,25 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %Add.type: type = fn_type @Add [template] // CHECK:STDOUT: %Add: %Add.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %.2: i32 = int_value 2 [template] -// CHECK:STDOUT: %.3: i32 = int_value 3 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(i32) [template] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] // CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template] // CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template] -// CHECK:STDOUT: %.27: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.28: = bound_method %.3, %Convert.15 [template] -// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 3 [template] -// CHECK:STDOUT: %.30: type = array_type %.29, i32 [template] -// CHECK:STDOUT: %.31: type = ptr_type %.30 [template] +// CHECK:STDOUT: %.26: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 1 [template] +// CHECK:STDOUT: %.29: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 2 [template] +// CHECK:STDOUT: %.31: i32 = int_value 3 [template] +// CHECK:STDOUT: %Convert.type.16: type = fn_type @Convert.12 [template] +// CHECK:STDOUT: %Convert.16: %Convert.type.16 = struct_value () [template] +// CHECK:STDOUT: %.32: = interface_witness (%Convert.16) [template] +// CHECK:STDOUT: %.33: = bound_method %.31, %Convert.16 [template] +// CHECK:STDOUT: %.34: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.35: type = array_type %.34, i32 [template] +// CHECK:STDOUT: %.36: type = ptr_type %.35 [template] // CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] // CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] // CHECK:STDOUT: } @@ -152,32 +160,37 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: } // CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %Add.ref: %Add.type = name_ref Add, %Add.decl [template = constants.%Add] -// CHECK:STDOUT: %.loc4_20: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_23: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: %int.uadd: init i32 = call %Add.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] +// CHECK:STDOUT: %.loc4_20.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc4_23.1: Core.IntLiteral = int_value 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_20.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_20.3: = bound_method %.loc4_20.1, %.loc4_20.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc4_20: init i32 = call %.loc4_20.3(%.loc4_20.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc4_20.4: i32 = value_of_initializer %int.convert_checked.loc4_20 [template = constants.%.28] +// CHECK:STDOUT: %.loc4_20.5: i32 = converted %.loc4_20.1, %.loc4_20.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc4_23.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_23.3: = bound_method %.loc4_23.1, %.loc4_23.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc4_23: init i32 = call %.loc4_23.3(%.loc4_23.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc4_23.4: i32 = value_of_initializer %int.convert_checked.loc4_23 [template = constants.%.30] +// CHECK:STDOUT: %.loc4_23.5: i32 = converted %.loc4_23.1, %.loc4_23.4 [template = constants.%.30] +// CHECK:STDOUT: %int.uadd: init i32 = call %Add.ref(%.loc4_20.5, %.loc4_23.5) [template = constants.%.31] // CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] // CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4, %.loc4_11.1 [template = i32] -// CHECK:STDOUT: %.loc4_19.1: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc4_19.2: = bound_method %int.uadd, %.loc4_19.1 [template = constants.%.28] -// CHECK:STDOUT: %.loc4_19.3: i32 = value_of_initializer %int.uadd [template = constants.%.3] -// CHECK:STDOUT: %.loc4_19.4: i32 = converted %int.uadd, %.loc4_19.3 [template = constants.%.3] -// CHECK:STDOUT: %int.convert_checked.loc4: init Core.IntLiteral = call %.loc4_19.2(%.loc4_19.4) [template = constants.%.29] -// CHECK:STDOUT: %.loc4_19.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4 [template = constants.%.29] -// CHECK:STDOUT: %.loc4_19.6: Core.IntLiteral = converted %int.uadd, %.loc4_19.5 [template = constants.%.29] -// CHECK:STDOUT: %.loc4_25: type = array_type %.loc4_19.6, i32 [template = constants.%.30] -// CHECK:STDOUT: %arr.var: ref %.30 = var arr -// CHECK:STDOUT: %arr: ref %.30 = bind_name arr, %arr.var +// CHECK:STDOUT: %.loc4_19.1: %Convert.type.5 = interface_witness_access constants.%.32, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %.loc4_19.2: = bound_method %int.uadd, %.loc4_19.1 [template = constants.%.33] +// CHECK:STDOUT: %.loc4_19.3: i32 = value_of_initializer %int.uadd [template = constants.%.31] +// CHECK:STDOUT: %.loc4_19.4: i32 = converted %int.uadd, %.loc4_19.3 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc4_19: init Core.IntLiteral = call %.loc4_19.2(%.loc4_19.4) [template = constants.%.34] +// CHECK:STDOUT: %.loc4_19.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4_19 [template = constants.%.34] +// CHECK:STDOUT: %.loc4_19.6: Core.IntLiteral = converted %int.uadd, %.loc4_19.5 [template = constants.%.34] +// CHECK:STDOUT: %.loc4_25: type = array_type %.loc4_19.6, i32 [template = constants.%.35] +// CHECK:STDOUT: %arr.var: ref %.35 = var arr +// CHECK:STDOUT: %arr: ref %.35 = bind_name arr, %arr.var // CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc5_18.1: i32 = int_value 3 [template = constants.%.3] +// CHECK:STDOUT: %.loc5_18: Core.IntLiteral = int_value 3 [template = constants.%.34] // CHECK:STDOUT: %.loc5_13.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] // CHECK:STDOUT: %.loc5_13.2: type = converted %int.make_type_32.loc5, %.loc5_13.1 [template = i32] -// CHECK:STDOUT: %.loc5_18.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc5_18.3: = bound_method %.loc5_18.1, %.loc5_18.2 [template = constants.%.28] -// CHECK:STDOUT: %int.convert_checked.loc5: init Core.IntLiteral = call %.loc5_18.3(%.loc5_18.1) [template = constants.%.29] -// CHECK:STDOUT: %.loc5_18.4: Core.IntLiteral = value_of_initializer %int.convert_checked.loc5 [template = constants.%.29] -// CHECK:STDOUT: %.loc5_18.5: Core.IntLiteral = converted %.loc5_18.1, %.loc5_18.4 [template = constants.%.29] -// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18.5, i32 [template = constants.%.30] -// CHECK:STDOUT: %.loc5_20: type = ptr_type %.30 [template = constants.%.31] +// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.35] +// CHECK:STDOUT: %.loc5_20: type = ptr_type %.35 [template = constants.%.36] // CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { // CHECK:STDOUT: %a.patt: i32 = binding_pattern a // CHECK:STDOUT: %a.param_patt: i32 = value_param_pattern %a.patt, runtime_param0 @@ -219,9 +232,9 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %.30 = name_ref arr, file.%arr -// CHECK:STDOUT: %.loc5: %.31 = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %.31 = bind_name arr_p, %.loc5 +// CHECK:STDOUT: %arr.ref: ref %.35 = name_ref arr, file.%arr +// CHECK:STDOUT: %.loc5: %.36 = addr_of %arr.ref +// CHECK:STDOUT: %arr_p: %.36 = bind_name arr_p, %.loc5 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -240,9 +253,19 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: %BadReturnType: %BadReturnType.type = struct_value () [template] // CHECK:STDOUT: %JustRight.type: type = fn_type @JustRight [template] // CHECK:STDOUT: %JustRight: %JustRight.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %.2: i32 = int_value 2 [template] -// CHECK:STDOUT: %.3: i32 = int_value 3 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 1 [template] +// CHECK:STDOUT: %.28: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.30: = bound_method %.28, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 2 [template] +// CHECK:STDOUT: %.32: = bound_method %.29, %Convert.15 [template] +// CHECK:STDOUT: %.33: i32 = int_value 3 [template] // CHECK:STDOUT: %RuntimeCallTooFew.type: type = fn_type @RuntimeCallTooFew [template] // CHECK:STDOUT: %RuntimeCallTooFew: %RuntimeCallTooFew.type = struct_value () [template] // CHECK:STDOUT: %RuntimeCallTooMany.type: type = fn_type @RuntimeCallTooMany [template] @@ -255,6 +278,7 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int32 = %import_ref.1 // CHECK:STDOUT: .Bool = %import_ref.2 +// CHECK:STDOUT: .ImplicitAs = %import_ref.3 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -374,36 +398,66 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: } // CHECK:STDOUT: %int.make_type_32.loc25: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %TooFew.ref: %TooFew.type = name_ref TooFew, %TooFew.decl [template = constants.%TooFew] -// CHECK:STDOUT: %.loc25_27: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %TooFew.call: init i32 = call %TooFew.ref(%.loc25_27) +// CHECK:STDOUT: %.loc25_27.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc25_27.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc25_27.3: = bound_method %.loc25_27.1, %.loc25_27.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc25: init i32 = call %.loc25_27.3(%.loc25_27.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc25_27.4: i32 = value_of_initializer %int.convert_checked.loc25 [template = constants.%.27] +// CHECK:STDOUT: %.loc25_27.5: i32 = converted %.loc25_27.1, %.loc25_27.4 [template = constants.%.27] +// CHECK:STDOUT: %TooFew.call: init i32 = call %TooFew.ref(%.loc25_27.5) // CHECK:STDOUT: %.loc25_15.1: type = value_of_initializer %int.make_type_32.loc25 [template = i32] // CHECK:STDOUT: %.loc25_15.2: type = converted %int.make_type_32.loc25, %.loc25_15.1 [template = i32] // CHECK:STDOUT: %too_few.var: ref = var too_few // CHECK:STDOUT: %too_few: ref = bind_name too_few, %too_few.var // CHECK:STDOUT: %int.make_type_32.loc30: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %TooMany.ref: %TooMany.type = name_ref TooMany, %TooMany.decl [template = constants.%TooMany] -// CHECK:STDOUT: %.loc30_29: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc30_32: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc30_35: i32 = int_value 3 [template = constants.%.3] -// CHECK:STDOUT: %TooMany.call: init i32 = call %TooMany.ref(%.loc30_29, %.loc30_32, %.loc30_35) +// CHECK:STDOUT: %.loc30_29.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc30_32.1: Core.IntLiteral = int_value 2 [template = constants.%.28] +// CHECK:STDOUT: %.loc30_35.1: Core.IntLiteral = int_value 3 [template = constants.%.29] +// CHECK:STDOUT: %.loc30_29.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc30_29.3: = bound_method %.loc30_29.1, %.loc30_29.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc30_29: init i32 = call %.loc30_29.3(%.loc30_29.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc30_29.4: i32 = value_of_initializer %int.convert_checked.loc30_29 [template = constants.%.27] +// CHECK:STDOUT: %.loc30_29.5: i32 = converted %.loc30_29.1, %.loc30_29.4 [template = constants.%.27] +// CHECK:STDOUT: %.loc30_32.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc30_32.3: = bound_method %.loc30_32.1, %.loc30_32.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc30_32: init i32 = call %.loc30_32.3(%.loc30_32.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc30_32.4: i32 = value_of_initializer %int.convert_checked.loc30_32 [template = constants.%.31] +// CHECK:STDOUT: %.loc30_32.5: i32 = converted %.loc30_32.1, %.loc30_32.4 [template = constants.%.31] +// CHECK:STDOUT: %.loc30_35.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc30_35.3: = bound_method %.loc30_35.1, %.loc30_35.2 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc30_35: init i32 = call %.loc30_35.3(%.loc30_35.1) [template = constants.%.33] +// CHECK:STDOUT: %.loc30_35.4: i32 = value_of_initializer %int.convert_checked.loc30_35 [template = constants.%.33] +// CHECK:STDOUT: %.loc30_35.5: i32 = converted %.loc30_35.1, %.loc30_35.4 [template = constants.%.33] +// CHECK:STDOUT: %TooMany.call: init i32 = call %TooMany.ref(%.loc30_29.5, %.loc30_32.5, %.loc30_35.5) // CHECK:STDOUT: %.loc30_16.1: type = value_of_initializer %int.make_type_32.loc30 [template = i32] // CHECK:STDOUT: %.loc30_16.2: type = converted %int.make_type_32.loc30, %.loc30_16.1 [template = i32] // CHECK:STDOUT: %too_many.var: ref = var too_many // CHECK:STDOUT: %too_many: ref = bind_name too_many, %too_many.var // CHECK:STDOUT: %int.make_type_32.loc35: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %BadReturnType.ref: %BadReturnType.type = name_ref BadReturnType, %BadReturnType.decl [template = constants.%BadReturnType] -// CHECK:STDOUT: %.loc35_42: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc35_45: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref(%.loc35_42, %.loc35_45) +// CHECK:STDOUT: %.loc35_42.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc35_45.1: Core.IntLiteral = int_value 2 [template = constants.%.28] +// CHECK:STDOUT: %.loc35_42.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc35_42.3: = bound_method %.loc35_42.1, %.loc35_42.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc35_42: init i32 = call %.loc35_42.3(%.loc35_42.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc35_42.4: i32 = value_of_initializer %int.convert_checked.loc35_42 [template = constants.%.27] +// CHECK:STDOUT: %.loc35_42.5: i32 = converted %.loc35_42.1, %.loc35_42.4 [template = constants.%.27] +// CHECK:STDOUT: %.loc35_45.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc35_45.3: = bound_method %.loc35_45.1, %.loc35_45.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc35_45: init i32 = call %.loc35_45.3(%.loc35_45.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc35_45.4: i32 = value_of_initializer %int.convert_checked.loc35_45 [template = constants.%.31] +// CHECK:STDOUT: %.loc35_45.5: i32 = converted %.loc35_45.1, %.loc35_45.4 [template = constants.%.31] +// CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref(%.loc35_42.5, %.loc35_45.5) // CHECK:STDOUT: %.loc35_23.1: type = value_of_initializer %int.make_type_32.loc35 [template = i32] // CHECK:STDOUT: %.loc35_23.2: type = converted %int.make_type_32.loc35, %.loc35_23.1 [template = i32] // CHECK:STDOUT: %bad_return_type.var: ref = var bad_return_type // CHECK:STDOUT: %bad_return_type: ref = bind_name bad_return_type, %bad_return_type.var // CHECK:STDOUT: %int.make_type_32.loc43: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %JustRight.ref: %JustRight.type = name_ref JustRight, %JustRight.decl [template = constants.%JustRight] -// CHECK:STDOUT: %.loc43_31: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc43_34: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc43_37: i32 = int_value 3 [template = constants.%.3] +// CHECK:STDOUT: %.loc43_31: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc43_34: Core.IntLiteral = int_value 2 [template = constants.%.28] +// CHECK:STDOUT: %.loc43_37: Core.IntLiteral = int_value 3 [template = constants.%.29] // CHECK:STDOUT: %.loc43_16.1: type = value_of_initializer %int.make_type_32.loc43 [template = i32] // CHECK:STDOUT: %.loc43_16.2: type = converted %int.make_type_32.loc43, %.loc43_16.1 [template = i32] // CHECK:STDOUT: %.loc43_39: type = array_type , i32 [template = ] @@ -531,15 +585,26 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %Add.type: type = fn_type @Add [template] // CHECK:STDOUT: %Add: %Add.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 2147483647 [template] -// CHECK:STDOUT: %.2: i32 = int_value 0 [template] -// CHECK:STDOUT: %.3: i32 = int_value 1 [template] -// CHECK:STDOUT: %.4: i32 = int_value -2147483648 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 2147483647 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 0 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 2147483647 [template] +// CHECK:STDOUT: %.29: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 0 [template] +// CHECK:STDOUT: %.31: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.32: = bound_method %.31, %Convert.15 [template] +// CHECK:STDOUT: %.33: i32 = int_value 1 [template] +// CHECK:STDOUT: %.34: i32 = int_value -2147483648 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -590,18 +655,38 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Add.ref.loc7: %Add.type = name_ref Add, file.%Add.decl [template = constants.%Add] -// CHECK:STDOUT: %.loc7_18: i32 = int_value 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %.loc7_30: i32 = int_value 0 [template = constants.%.2] -// CHECK:STDOUT: %int.uadd.loc7: init i32 = call %Add.ref.loc7(%.loc7_18, %.loc7_30) [template = constants.%.1] -// CHECK:STDOUT: %.loc7_32.1: i32 = value_of_initializer %int.uadd.loc7 [template = constants.%.1] -// CHECK:STDOUT: %.loc7_32.2: i32 = converted %int.uadd.loc7, %.loc7_32.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc7_18.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.1] +// CHECK:STDOUT: %.loc7_30.1: Core.IntLiteral = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc7_18.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc7_18.3: = bound_method %.loc7_18.1, %.loc7_18.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc7_18: init i32 = call %.loc7_18.3(%.loc7_18.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc7_18.4: i32 = value_of_initializer %int.convert_checked.loc7_18 [template = constants.%.28] +// CHECK:STDOUT: %.loc7_18.5: i32 = converted %.loc7_18.1, %.loc7_18.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc7_30.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc7_30.3: = bound_method %.loc7_30.1, %.loc7_30.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc7_30: init i32 = call %.loc7_30.3(%.loc7_30.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc7_30.4: i32 = value_of_initializer %int.convert_checked.loc7_30 [template = constants.%.30] +// CHECK:STDOUT: %.loc7_30.5: i32 = converted %.loc7_30.1, %.loc7_30.4 [template = constants.%.30] +// CHECK:STDOUT: %int.uadd.loc7: init i32 = call %Add.ref.loc7(%.loc7_18.5, %.loc7_30.5) [template = constants.%.28] +// CHECK:STDOUT: %.loc7_32.1: i32 = value_of_initializer %int.uadd.loc7 [template = constants.%.28] +// CHECK:STDOUT: %.loc7_32.2: i32 = converted %int.uadd.loc7, %.loc7_32.1 [template = constants.%.28] // CHECK:STDOUT: %a: i32 = bind_name a, %.loc7_32.2 // CHECK:STDOUT: %Add.ref.loc8: %Add.type = name_ref Add, file.%Add.decl [template = constants.%Add] -// CHECK:STDOUT: %.loc8_18: i32 = int_value 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %.loc8_30: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: %int.uadd.loc8: init i32 = call %Add.ref.loc8(%.loc8_18, %.loc8_30) [template = constants.%.4] -// CHECK:STDOUT: %.loc8_32.1: i32 = value_of_initializer %int.uadd.loc8 [template = constants.%.4] -// CHECK:STDOUT: %.loc8_32.2: i32 = converted %int.uadd.loc8, %.loc8_32.1 [template = constants.%.4] +// CHECK:STDOUT: %.loc8_18.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.1] +// CHECK:STDOUT: %.loc8_30.1: Core.IntLiteral = int_value 1 [template = constants.%.31] +// CHECK:STDOUT: %.loc8_18.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc8_18.3: = bound_method %.loc8_18.1, %.loc8_18.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc8_18: init i32 = call %.loc8_18.3(%.loc8_18.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc8_18.4: i32 = value_of_initializer %int.convert_checked.loc8_18 [template = constants.%.28] +// CHECK:STDOUT: %.loc8_18.5: i32 = converted %.loc8_18.1, %.loc8_18.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc8_30.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc8_30.3: = bound_method %.loc8_30.1, %.loc8_30.2 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc8_30: init i32 = call %.loc8_30.3(%.loc8_30.1) [template = constants.%.33] +// CHECK:STDOUT: %.loc8_30.4: i32 = value_of_initializer %int.convert_checked.loc8_30 [template = constants.%.33] +// CHECK:STDOUT: %.loc8_30.5: i32 = converted %.loc8_30.1, %.loc8_30.4 [template = constants.%.33] +// CHECK:STDOUT: %int.uadd.loc8: init i32 = call %Add.ref.loc8(%.loc8_18.5, %.loc8_30.5) [template = constants.%.34] +// CHECK:STDOUT: %.loc8_32.1: i32 = value_of_initializer %int.uadd.loc8 [template = constants.%.34] +// CHECK:STDOUT: %.loc8_32.2: i32 = converted %int.uadd.loc8, %.loc8_32.1 [template = constants.%.34] // CHECK:STDOUT: %b: i32 = bind_name b, %.loc8_32.2 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/builtins/int/udiv.carbon b/toolchain/check/testdata/builtins/int/udiv.carbon index d4303347b093d..8798be0abb9f9 100644 --- a/toolchain/check/testdata/builtins/int/udiv.carbon +++ b/toolchain/check/testdata/builtins/int/udiv.carbon @@ -60,17 +60,25 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %Div.type: type = fn_type @Div [template] // CHECK:STDOUT: %Div: %Div.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 3 [template] -// CHECK:STDOUT: %.2: i32 = int_value 2 [template] -// CHECK:STDOUT: %.3: i32 = int_value 1 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(i32) [template] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] // CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template] // CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template] -// CHECK:STDOUT: %.27: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.28: = bound_method %.3, %Convert.15 [template] -// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %.30: type = array_type %.29, i32 [template] -// CHECK:STDOUT: %.31: type = ptr_type %.30 [template] +// CHECK:STDOUT: %.26: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 3 [template] +// CHECK:STDOUT: %.29: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 2 [template] +// CHECK:STDOUT: %.31: i32 = int_value 1 [template] +// CHECK:STDOUT: %Convert.type.16: type = fn_type @Convert.12 [template] +// CHECK:STDOUT: %Convert.16: %Convert.type.16 = struct_value () [template] +// CHECK:STDOUT: %.32: = interface_witness (%Convert.16) [template] +// CHECK:STDOUT: %.33: = bound_method %.31, %Convert.16 [template] +// CHECK:STDOUT: %.34: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.35: type = array_type %.34, i32 [template] +// CHECK:STDOUT: %.36: type = ptr_type %.35 [template] // CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] // CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] // CHECK:STDOUT: } @@ -119,32 +127,37 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: } // CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %Div.ref: %Div.type = name_ref Div, %Div.decl [template = constants.%Div] -// CHECK:STDOUT: %.loc4_20: i32 = int_value 3 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_23: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: %int.udiv: init i32 = call %Div.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] +// CHECK:STDOUT: %.loc4_20.1: Core.IntLiteral = int_value 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc4_23.1: Core.IntLiteral = int_value 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_20.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_20.3: = bound_method %.loc4_20.1, %.loc4_20.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc4_20: init i32 = call %.loc4_20.3(%.loc4_20.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc4_20.4: i32 = value_of_initializer %int.convert_checked.loc4_20 [template = constants.%.28] +// CHECK:STDOUT: %.loc4_20.5: i32 = converted %.loc4_20.1, %.loc4_20.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc4_23.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_23.3: = bound_method %.loc4_23.1, %.loc4_23.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc4_23: init i32 = call %.loc4_23.3(%.loc4_23.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc4_23.4: i32 = value_of_initializer %int.convert_checked.loc4_23 [template = constants.%.30] +// CHECK:STDOUT: %.loc4_23.5: i32 = converted %.loc4_23.1, %.loc4_23.4 [template = constants.%.30] +// CHECK:STDOUT: %int.udiv: init i32 = call %Div.ref(%.loc4_20.5, %.loc4_23.5) [template = constants.%.31] // CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] // CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4, %.loc4_11.1 [template = i32] -// CHECK:STDOUT: %.loc4_19.1: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc4_19.2: = bound_method %int.udiv, %.loc4_19.1 [template = constants.%.28] -// CHECK:STDOUT: %.loc4_19.3: i32 = value_of_initializer %int.udiv [template = constants.%.3] -// CHECK:STDOUT: %.loc4_19.4: i32 = converted %int.udiv, %.loc4_19.3 [template = constants.%.3] -// CHECK:STDOUT: %int.convert_checked.loc4: init Core.IntLiteral = call %.loc4_19.2(%.loc4_19.4) [template = constants.%.29] -// CHECK:STDOUT: %.loc4_19.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4 [template = constants.%.29] -// CHECK:STDOUT: %.loc4_19.6: Core.IntLiteral = converted %int.udiv, %.loc4_19.5 [template = constants.%.29] -// CHECK:STDOUT: %.loc4_25: type = array_type %.loc4_19.6, i32 [template = constants.%.30] -// CHECK:STDOUT: %arr.var: ref %.30 = var arr -// CHECK:STDOUT: %arr: ref %.30 = bind_name arr, %arr.var +// CHECK:STDOUT: %.loc4_19.1: %Convert.type.5 = interface_witness_access constants.%.32, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %.loc4_19.2: = bound_method %int.udiv, %.loc4_19.1 [template = constants.%.33] +// CHECK:STDOUT: %.loc4_19.3: i32 = value_of_initializer %int.udiv [template = constants.%.31] +// CHECK:STDOUT: %.loc4_19.4: i32 = converted %int.udiv, %.loc4_19.3 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc4_19: init Core.IntLiteral = call %.loc4_19.2(%.loc4_19.4) [template = constants.%.34] +// CHECK:STDOUT: %.loc4_19.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4_19 [template = constants.%.34] +// CHECK:STDOUT: %.loc4_19.6: Core.IntLiteral = converted %int.udiv, %.loc4_19.5 [template = constants.%.34] +// CHECK:STDOUT: %.loc4_25: type = array_type %.loc4_19.6, i32 [template = constants.%.35] +// CHECK:STDOUT: %arr.var: ref %.35 = var arr +// CHECK:STDOUT: %arr: ref %.35 = bind_name arr, %arr.var // CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc5_18.1: i32 = int_value 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc5_18: Core.IntLiteral = int_value 1 [template = constants.%.34] // CHECK:STDOUT: %.loc5_13.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] // CHECK:STDOUT: %.loc5_13.2: type = converted %int.make_type_32.loc5, %.loc5_13.1 [template = i32] -// CHECK:STDOUT: %.loc5_18.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc5_18.3: = bound_method %.loc5_18.1, %.loc5_18.2 [template = constants.%.28] -// CHECK:STDOUT: %int.convert_checked.loc5: init Core.IntLiteral = call %.loc5_18.3(%.loc5_18.1) [template = constants.%.29] -// CHECK:STDOUT: %.loc5_18.4: Core.IntLiteral = value_of_initializer %int.convert_checked.loc5 [template = constants.%.29] -// CHECK:STDOUT: %.loc5_18.5: Core.IntLiteral = converted %.loc5_18.1, %.loc5_18.4 [template = constants.%.29] -// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18.5, i32 [template = constants.%.30] -// CHECK:STDOUT: %.loc5_20: type = ptr_type %.30 [template = constants.%.31] +// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.35] +// CHECK:STDOUT: %.loc5_20: type = ptr_type %.35 [template = constants.%.36] // CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { // CHECK:STDOUT: %a.patt: i32 = binding_pattern a // CHECK:STDOUT: %a.param_patt: i32 = value_param_pattern %a.patt, runtime_param0 @@ -186,9 +199,9 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %.30 = name_ref arr, file.%arr -// CHECK:STDOUT: %.loc5: %.31 = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %.31 = bind_name arr_p, %.loc5 +// CHECK:STDOUT: %arr.ref: ref %.35 = name_ref arr, file.%arr +// CHECK:STDOUT: %.loc5: %.36 = addr_of %arr.ref +// CHECK:STDOUT: %arr_p: %.36 = bind_name arr_p, %.loc5 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -203,17 +216,26 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: %Sub: %Sub.type = struct_value () [template] // CHECK:STDOUT: %Negate.type: type = fn_type @Negate [template] // CHECK:STDOUT: %Negate: %Negate.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 2147483647 [template] -// CHECK:STDOUT: %.2: i32 = int_value -2147483647 [template] -// CHECK:STDOUT: %.3: i32 = int_value 1 [template] -// CHECK:STDOUT: %.4: i32 = int_value -1 [template] -// CHECK:STDOUT: %.5: i32 = int_value 0 [template] -// CHECK:STDOUT: %.6: i32 = int_value -2147483648 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 2147483647 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 2147483647 [template] +// CHECK:STDOUT: %.28: i32 = int_value -2147483647 [template] +// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.30: = bound_method %.29, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 1 [template] +// CHECK:STDOUT: %.32: i32 = int_value -1 [template] +// CHECK:STDOUT: %.33: i32 = int_value 0 [template] +// CHECK:STDOUT: %.34: i32 = int_value -2147483648 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -316,54 +338,94 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Div.ref.loc9: %Div.type = name_ref Div, file.%Div.decl [template = constants.%Div] // CHECK:STDOUT: %Negate.ref.loc9_18: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc9_25: i32 = int_value 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %int.unegate.loc9_24: init i32 = call %Negate.ref.loc9_18(%.loc9_25) [template = constants.%.2] +// CHECK:STDOUT: %.loc9_25.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.1] +// CHECK:STDOUT: %.loc9_25.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_25.3: = bound_method %.loc9_25.1, %.loc9_25.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc9_25: init i32 = call %.loc9_25.3(%.loc9_25.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc9_25.4: i32 = value_of_initializer %int.convert_checked.loc9_25 [template = constants.%.27] +// CHECK:STDOUT: %.loc9_25.5: i32 = converted %.loc9_25.1, %.loc9_25.4 [template = constants.%.27] +// CHECK:STDOUT: %int.unegate.loc9_24: init i32 = call %Negate.ref.loc9_18(%.loc9_25.5) [template = constants.%.28] // CHECK:STDOUT: %Negate.ref.loc9_39: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc9_46: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: %int.unegate.loc9_45: init i32 = call %Negate.ref.loc9_39(%.loc9_46) [template = constants.%.4] -// CHECK:STDOUT: %.loc9_24.1: i32 = value_of_initializer %int.unegate.loc9_24 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_24.2: i32 = converted %int.unegate.loc9_24, %.loc9_24.1 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_45.1: i32 = value_of_initializer %int.unegate.loc9_45 [template = constants.%.4] -// CHECK:STDOUT: %.loc9_45.2: i32 = converted %int.unegate.loc9_45, %.loc9_45.1 [template = constants.%.4] -// CHECK:STDOUT: %int.udiv.loc9: init i32 = call %Div.ref.loc9(%.loc9_24.2, %.loc9_45.2) [template = constants.%.5] -// CHECK:STDOUT: %.loc9_49.1: i32 = value_of_initializer %int.udiv.loc9 [template = constants.%.5] -// CHECK:STDOUT: %.loc9_49.2: i32 = converted %int.udiv.loc9, %.loc9_49.1 [template = constants.%.5] +// CHECK:STDOUT: %.loc9_46.1: Core.IntLiteral = int_value 1 [template = constants.%.29] +// CHECK:STDOUT: %.loc9_46.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_46.3: = bound_method %.loc9_46.1, %.loc9_46.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc9_46: init i32 = call %.loc9_46.3(%.loc9_46.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc9_46.4: i32 = value_of_initializer %int.convert_checked.loc9_46 [template = constants.%.31] +// CHECK:STDOUT: %.loc9_46.5: i32 = converted %.loc9_46.1, %.loc9_46.4 [template = constants.%.31] +// CHECK:STDOUT: %int.unegate.loc9_45: init i32 = call %Negate.ref.loc9_39(%.loc9_46.5) [template = constants.%.32] +// CHECK:STDOUT: %.loc9_24.1: i32 = value_of_initializer %int.unegate.loc9_24 [template = constants.%.28] +// CHECK:STDOUT: %.loc9_24.2: i32 = converted %int.unegate.loc9_24, %.loc9_24.1 [template = constants.%.28] +// CHECK:STDOUT: %.loc9_45.1: i32 = value_of_initializer %int.unegate.loc9_45 [template = constants.%.32] +// CHECK:STDOUT: %.loc9_45.2: i32 = converted %int.unegate.loc9_45, %.loc9_45.1 [template = constants.%.32] +// CHECK:STDOUT: %int.udiv.loc9: init i32 = call %Div.ref.loc9(%.loc9_24.2, %.loc9_45.2) [template = constants.%.33] +// CHECK:STDOUT: %.loc9_49.1: i32 = value_of_initializer %int.udiv.loc9 [template = constants.%.33] +// CHECK:STDOUT: %.loc9_49.2: i32 = converted %int.udiv.loc9, %.loc9_49.1 [template = constants.%.33] // CHECK:STDOUT: %a: i32 = bind_name a, %.loc9_49.2 // CHECK:STDOUT: %Div.ref.loc12: %Div.type = name_ref Div, file.%Div.decl [template = constants.%Div] // CHECK:STDOUT: %Sub.ref.loc12: %Sub.type = name_ref Sub, file.%Sub.decl [template = constants.%Sub] // CHECK:STDOUT: %Negate.ref.loc12: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc12_29: i32 = int_value 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %int.unegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_29) [template = constants.%.2] -// CHECK:STDOUT: %.loc12_43: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc12_28.1: i32 = value_of_initializer %int.unegate.loc12 [template = constants.%.2] -// CHECK:STDOUT: %.loc12_28.2: i32 = converted %int.unegate.loc12, %.loc12_28.1 [template = constants.%.2] -// CHECK:STDOUT: %int.usub.loc12: init i32 = call %Sub.ref.loc12(%.loc12_28.2, %.loc12_43) [template = constants.%.6] -// CHECK:STDOUT: %.loc12_47: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc12_21.1: i32 = value_of_initializer %int.usub.loc12 [template = constants.%.6] -// CHECK:STDOUT: %.loc12_21.2: i32 = converted %int.usub.loc12, %.loc12_21.1 [template = constants.%.6] -// CHECK:STDOUT: %int.udiv.loc12: init i32 = call %Div.ref.loc12(%.loc12_21.2, %.loc12_47) [template = constants.%.6] -// CHECK:STDOUT: %.loc12_49.1: i32 = value_of_initializer %int.udiv.loc12 [template = constants.%.6] -// CHECK:STDOUT: %.loc12_49.2: i32 = converted %int.udiv.loc12, %.loc12_49.1 [template = constants.%.6] +// CHECK:STDOUT: %.loc12_29.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.1] +// CHECK:STDOUT: %.loc12_29.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_29.3: = bound_method %.loc12_29.1, %.loc12_29.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc12_29: init i32 = call %.loc12_29.3(%.loc12_29.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc12_29.4: i32 = value_of_initializer %int.convert_checked.loc12_29 [template = constants.%.27] +// CHECK:STDOUT: %.loc12_29.5: i32 = converted %.loc12_29.1, %.loc12_29.4 [template = constants.%.27] +// CHECK:STDOUT: %int.unegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_29.5) [template = constants.%.28] +// CHECK:STDOUT: %.loc12_43.1: Core.IntLiteral = int_value 1 [template = constants.%.29] +// CHECK:STDOUT: %.loc12_28.1: i32 = value_of_initializer %int.unegate.loc12 [template = constants.%.28] +// CHECK:STDOUT: %.loc12_28.2: i32 = converted %int.unegate.loc12, %.loc12_28.1 [template = constants.%.28] +// CHECK:STDOUT: %.loc12_43.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_43.3: = bound_method %.loc12_43.1, %.loc12_43.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc12_43: init i32 = call %.loc12_43.3(%.loc12_43.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc12_43.4: i32 = value_of_initializer %int.convert_checked.loc12_43 [template = constants.%.31] +// CHECK:STDOUT: %.loc12_43.5: i32 = converted %.loc12_43.1, %.loc12_43.4 [template = constants.%.31] +// CHECK:STDOUT: %int.usub.loc12: init i32 = call %Sub.ref.loc12(%.loc12_28.2, %.loc12_43.5) [template = constants.%.34] +// CHECK:STDOUT: %.loc12_47.1: Core.IntLiteral = int_value 1 [template = constants.%.29] +// CHECK:STDOUT: %.loc12_21.1: i32 = value_of_initializer %int.usub.loc12 [template = constants.%.34] +// CHECK:STDOUT: %.loc12_21.2: i32 = converted %int.usub.loc12, %.loc12_21.1 [template = constants.%.34] +// CHECK:STDOUT: %.loc12_47.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_47.3: = bound_method %.loc12_47.1, %.loc12_47.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc12_47: init i32 = call %.loc12_47.3(%.loc12_47.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc12_47.4: i32 = value_of_initializer %int.convert_checked.loc12_47 [template = constants.%.31] +// CHECK:STDOUT: %.loc12_47.5: i32 = converted %.loc12_47.1, %.loc12_47.4 [template = constants.%.31] +// CHECK:STDOUT: %int.udiv.loc12: init i32 = call %Div.ref.loc12(%.loc12_21.2, %.loc12_47.5) [template = constants.%.34] +// CHECK:STDOUT: %.loc12_49.1: i32 = value_of_initializer %int.udiv.loc12 [template = constants.%.34] +// CHECK:STDOUT: %.loc12_49.2: i32 = converted %int.udiv.loc12, %.loc12_49.1 [template = constants.%.34] // CHECK:STDOUT: %b: i32 = bind_name b, %.loc12_49.2 // CHECK:STDOUT: %Div.ref.loc15: %Div.type = name_ref Div, file.%Div.decl [template = constants.%Div] // CHECK:STDOUT: %Sub.ref.loc15: %Sub.type = name_ref Sub, file.%Sub.decl [template = constants.%Sub] // CHECK:STDOUT: %Negate.ref.loc15_22: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc15_29: i32 = int_value 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %int.unegate.loc15_28: init i32 = call %Negate.ref.loc15_22(%.loc15_29) [template = constants.%.2] -// CHECK:STDOUT: %.loc15_43: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc15_28.1: i32 = value_of_initializer %int.unegate.loc15_28 [template = constants.%.2] -// CHECK:STDOUT: %.loc15_28.2: i32 = converted %int.unegate.loc15_28, %.loc15_28.1 [template = constants.%.2] -// CHECK:STDOUT: %int.usub.loc15: init i32 = call %Sub.ref.loc15(%.loc15_28.2, %.loc15_43) [template = constants.%.6] +// CHECK:STDOUT: %.loc15_29.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.1] +// CHECK:STDOUT: %.loc15_29.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc15_29.3: = bound_method %.loc15_29.1, %.loc15_29.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc15_29: init i32 = call %.loc15_29.3(%.loc15_29.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc15_29.4: i32 = value_of_initializer %int.convert_checked.loc15_29 [template = constants.%.27] +// CHECK:STDOUT: %.loc15_29.5: i32 = converted %.loc15_29.1, %.loc15_29.4 [template = constants.%.27] +// CHECK:STDOUT: %int.unegate.loc15_28: init i32 = call %Negate.ref.loc15_22(%.loc15_29.5) [template = constants.%.28] +// CHECK:STDOUT: %.loc15_43.1: Core.IntLiteral = int_value 1 [template = constants.%.29] +// CHECK:STDOUT: %.loc15_28.1: i32 = value_of_initializer %int.unegate.loc15_28 [template = constants.%.28] +// CHECK:STDOUT: %.loc15_28.2: i32 = converted %int.unegate.loc15_28, %.loc15_28.1 [template = constants.%.28] +// CHECK:STDOUT: %.loc15_43.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc15_43.3: = bound_method %.loc15_43.1, %.loc15_43.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc15_43: init i32 = call %.loc15_43.3(%.loc15_43.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc15_43.4: i32 = value_of_initializer %int.convert_checked.loc15_43 [template = constants.%.31] +// CHECK:STDOUT: %.loc15_43.5: i32 = converted %.loc15_43.1, %.loc15_43.4 [template = constants.%.31] +// CHECK:STDOUT: %int.usub.loc15: init i32 = call %Sub.ref.loc15(%.loc15_28.2, %.loc15_43.5) [template = constants.%.34] // CHECK:STDOUT: %Negate.ref.loc15_47: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc15_54: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: %int.unegate.loc15_53: init i32 = call %Negate.ref.loc15_47(%.loc15_54) [template = constants.%.4] -// CHECK:STDOUT: %.loc15_21.1: i32 = value_of_initializer %int.usub.loc15 [template = constants.%.6] -// CHECK:STDOUT: %.loc15_21.2: i32 = converted %int.usub.loc15, %.loc15_21.1 [template = constants.%.6] -// CHECK:STDOUT: %.loc15_53.1: i32 = value_of_initializer %int.unegate.loc15_53 [template = constants.%.4] -// CHECK:STDOUT: %.loc15_53.2: i32 = converted %int.unegate.loc15_53, %.loc15_53.1 [template = constants.%.4] -// CHECK:STDOUT: %int.udiv.loc15: init i32 = call %Div.ref.loc15(%.loc15_21.2, %.loc15_53.2) [template = constants.%.5] -// CHECK:STDOUT: %.loc15_57.1: i32 = value_of_initializer %int.udiv.loc15 [template = constants.%.5] -// CHECK:STDOUT: %.loc15_57.2: i32 = converted %int.udiv.loc15, %.loc15_57.1 [template = constants.%.5] +// CHECK:STDOUT: %.loc15_54.1: Core.IntLiteral = int_value 1 [template = constants.%.29] +// CHECK:STDOUT: %.loc15_54.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc15_54.3: = bound_method %.loc15_54.1, %.loc15_54.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc15_54: init i32 = call %.loc15_54.3(%.loc15_54.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc15_54.4: i32 = value_of_initializer %int.convert_checked.loc15_54 [template = constants.%.31] +// CHECK:STDOUT: %.loc15_54.5: i32 = converted %.loc15_54.1, %.loc15_54.4 [template = constants.%.31] +// CHECK:STDOUT: %int.unegate.loc15_53: init i32 = call %Negate.ref.loc15_47(%.loc15_54.5) [template = constants.%.32] +// CHECK:STDOUT: %.loc15_21.1: i32 = value_of_initializer %int.usub.loc15 [template = constants.%.34] +// CHECK:STDOUT: %.loc15_21.2: i32 = converted %int.usub.loc15, %.loc15_21.1 [template = constants.%.34] +// CHECK:STDOUT: %.loc15_53.1: i32 = value_of_initializer %int.unegate.loc15_53 [template = constants.%.32] +// CHECK:STDOUT: %.loc15_53.2: i32 = converted %int.unegate.loc15_53, %.loc15_53.1 [template = constants.%.32] +// CHECK:STDOUT: %int.udiv.loc15: init i32 = call %Div.ref.loc15(%.loc15_21.2, %.loc15_53.2) [template = constants.%.33] +// CHECK:STDOUT: %.loc15_57.1: i32 = value_of_initializer %int.udiv.loc15 [template = constants.%.33] +// CHECK:STDOUT: %.loc15_57.2: i32 = converted %int.udiv.loc15, %.loc15_57.1 [template = constants.%.33] // CHECK:STDOUT: %c: i32 = bind_name c, %.loc15_57.2 // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -375,13 +437,22 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %Div.type: type = fn_type @Div [template] // CHECK:STDOUT: %Div: %Div.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %.2: i32 = int_value 0 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 0 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 1 [template] +// CHECK:STDOUT: %.29: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -432,16 +503,36 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Div.ref.loc10: %Div.type = name_ref Div, file.%Div.decl [template = constants.%Div] -// CHECK:STDOUT: %.loc10_18: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc10_21: i32 = int_value 0 [template = constants.%.2] -// CHECK:STDOUT: %int.udiv.loc10: init i32 = call %Div.ref.loc10(%.loc10_18, %.loc10_21) [template = ] +// CHECK:STDOUT: %.loc10_18.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc10_21.1: Core.IntLiteral = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc10_18.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc10_18.3: = bound_method %.loc10_18.1, %.loc10_18.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc10_18: init i32 = call %.loc10_18.3(%.loc10_18.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc10_18.4: i32 = value_of_initializer %int.convert_checked.loc10_18 [template = constants.%.28] +// CHECK:STDOUT: %.loc10_18.5: i32 = converted %.loc10_18.1, %.loc10_18.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc10_21.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc10_21.3: = bound_method %.loc10_21.1, %.loc10_21.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc10_21: init i32 = call %.loc10_21.3(%.loc10_21.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc10_21.4: i32 = value_of_initializer %int.convert_checked.loc10_21 [template = constants.%.30] +// CHECK:STDOUT: %.loc10_21.5: i32 = converted %.loc10_21.1, %.loc10_21.4 [template = constants.%.30] +// CHECK:STDOUT: %int.udiv.loc10: init i32 = call %Div.ref.loc10(%.loc10_18.5, %.loc10_21.5) [template = ] // CHECK:STDOUT: %.loc10_23.1: i32 = value_of_initializer %int.udiv.loc10 [template = ] // CHECK:STDOUT: %.loc10_23.2: i32 = converted %int.udiv.loc10, %.loc10_23.1 [template = ] // CHECK:STDOUT: %a: i32 = bind_name a, %.loc10_23.2 // CHECK:STDOUT: %Div.ref.loc15: %Div.type = name_ref Div, file.%Div.decl [template = constants.%Div] -// CHECK:STDOUT: %.loc15_18: i32 = int_value 0 [template = constants.%.2] -// CHECK:STDOUT: %.loc15_21: i32 = int_value 0 [template = constants.%.2] -// CHECK:STDOUT: %int.udiv.loc15: init i32 = call %Div.ref.loc15(%.loc15_18, %.loc15_21) [template = ] +// CHECK:STDOUT: %.loc15_18.1: Core.IntLiteral = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_21.1: Core.IntLiteral = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_18.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc15_18.3: = bound_method %.loc15_18.1, %.loc15_18.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc15_18: init i32 = call %.loc15_18.3(%.loc15_18.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc15_18.4: i32 = value_of_initializer %int.convert_checked.loc15_18 [template = constants.%.30] +// CHECK:STDOUT: %.loc15_18.5: i32 = converted %.loc15_18.1, %.loc15_18.4 [template = constants.%.30] +// CHECK:STDOUT: %.loc15_21.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc15_21.3: = bound_method %.loc15_21.1, %.loc15_21.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc15_21: init i32 = call %.loc15_21.3(%.loc15_21.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc15_21.4: i32 = value_of_initializer %int.convert_checked.loc15_21 [template = constants.%.30] +// CHECK:STDOUT: %.loc15_21.5: i32 = converted %.loc15_21.1, %.loc15_21.4 [template = constants.%.30] +// CHECK:STDOUT: %int.udiv.loc15: init i32 = call %Div.ref.loc15(%.loc15_18.5, %.loc15_21.5) [template = ] // CHECK:STDOUT: %.loc15_23.1: i32 = value_of_initializer %int.udiv.loc15 [template = ] // CHECK:STDOUT: %.loc15_23.2: i32 = converted %int.udiv.loc15, %.loc15_23.1 [template = ] // CHECK:STDOUT: %b: i32 = bind_name b, %.loc15_23.2 diff --git a/toolchain/check/testdata/builtins/int/umod.carbon b/toolchain/check/testdata/builtins/int/umod.carbon index 341ea409e052d..f1109a4dff40a 100644 --- a/toolchain/check/testdata/builtins/int/umod.carbon +++ b/toolchain/check/testdata/builtins/int/umod.carbon @@ -62,17 +62,25 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %Mod.type: type = fn_type @Mod [template] // CHECK:STDOUT: %Mod: %Mod.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 5 [template] -// CHECK:STDOUT: %.2: i32 = int_value 3 [template] -// CHECK:STDOUT: %.3: i32 = int_value 2 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 5 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(i32) [template] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] // CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template] // CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template] -// CHECK:STDOUT: %.27: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.28: = bound_method %.3, %Convert.15 [template] -// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 2 [template] -// CHECK:STDOUT: %.30: type = array_type %.29, i32 [template] -// CHECK:STDOUT: %.31: type = ptr_type %.30 [template] +// CHECK:STDOUT: %.26: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 5 [template] +// CHECK:STDOUT: %.29: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 3 [template] +// CHECK:STDOUT: %.31: i32 = int_value 2 [template] +// CHECK:STDOUT: %Convert.type.16: type = fn_type @Convert.12 [template] +// CHECK:STDOUT: %Convert.16: %Convert.type.16 = struct_value () [template] +// CHECK:STDOUT: %.32: = interface_witness (%Convert.16) [template] +// CHECK:STDOUT: %.33: = bound_method %.31, %Convert.16 [template] +// CHECK:STDOUT: %.34: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.35: type = array_type %.34, i32 [template] +// CHECK:STDOUT: %.36: type = ptr_type %.35 [template] // CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] // CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] // CHECK:STDOUT: } @@ -121,32 +129,37 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: } // CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %Mod.ref: %Mod.type = name_ref Mod, %Mod.decl [template = constants.%Mod] -// CHECK:STDOUT: %.loc4_20: i32 = int_value 5 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_23: i32 = int_value 3 [template = constants.%.2] -// CHECK:STDOUT: %int.umod: init i32 = call %Mod.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] +// CHECK:STDOUT: %.loc4_20.1: Core.IntLiteral = int_value 5 [template = constants.%.1] +// CHECK:STDOUT: %.loc4_23.1: Core.IntLiteral = int_value 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_20.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_20.3: = bound_method %.loc4_20.1, %.loc4_20.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc4_20: init i32 = call %.loc4_20.3(%.loc4_20.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc4_20.4: i32 = value_of_initializer %int.convert_checked.loc4_20 [template = constants.%.28] +// CHECK:STDOUT: %.loc4_20.5: i32 = converted %.loc4_20.1, %.loc4_20.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc4_23.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_23.3: = bound_method %.loc4_23.1, %.loc4_23.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc4_23: init i32 = call %.loc4_23.3(%.loc4_23.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc4_23.4: i32 = value_of_initializer %int.convert_checked.loc4_23 [template = constants.%.30] +// CHECK:STDOUT: %.loc4_23.5: i32 = converted %.loc4_23.1, %.loc4_23.4 [template = constants.%.30] +// CHECK:STDOUT: %int.umod: init i32 = call %Mod.ref(%.loc4_20.5, %.loc4_23.5) [template = constants.%.31] // CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] // CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4, %.loc4_11.1 [template = i32] -// CHECK:STDOUT: %.loc4_19.1: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc4_19.2: = bound_method %int.umod, %.loc4_19.1 [template = constants.%.28] -// CHECK:STDOUT: %.loc4_19.3: i32 = value_of_initializer %int.umod [template = constants.%.3] -// CHECK:STDOUT: %.loc4_19.4: i32 = converted %int.umod, %.loc4_19.3 [template = constants.%.3] -// CHECK:STDOUT: %int.convert_checked.loc4: init Core.IntLiteral = call %.loc4_19.2(%.loc4_19.4) [template = constants.%.29] -// CHECK:STDOUT: %.loc4_19.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4 [template = constants.%.29] -// CHECK:STDOUT: %.loc4_19.6: Core.IntLiteral = converted %int.umod, %.loc4_19.5 [template = constants.%.29] -// CHECK:STDOUT: %.loc4_25: type = array_type %.loc4_19.6, i32 [template = constants.%.30] -// CHECK:STDOUT: %arr.var: ref %.30 = var arr -// CHECK:STDOUT: %arr: ref %.30 = bind_name arr, %arr.var +// CHECK:STDOUT: %.loc4_19.1: %Convert.type.5 = interface_witness_access constants.%.32, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %.loc4_19.2: = bound_method %int.umod, %.loc4_19.1 [template = constants.%.33] +// CHECK:STDOUT: %.loc4_19.3: i32 = value_of_initializer %int.umod [template = constants.%.31] +// CHECK:STDOUT: %.loc4_19.4: i32 = converted %int.umod, %.loc4_19.3 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc4_19: init Core.IntLiteral = call %.loc4_19.2(%.loc4_19.4) [template = constants.%.34] +// CHECK:STDOUT: %.loc4_19.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4_19 [template = constants.%.34] +// CHECK:STDOUT: %.loc4_19.6: Core.IntLiteral = converted %int.umod, %.loc4_19.5 [template = constants.%.34] +// CHECK:STDOUT: %.loc4_25: type = array_type %.loc4_19.6, i32 [template = constants.%.35] +// CHECK:STDOUT: %arr.var: ref %.35 = var arr +// CHECK:STDOUT: %arr: ref %.35 = bind_name arr, %arr.var // CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc5_18.1: i32 = int_value 2 [template = constants.%.3] +// CHECK:STDOUT: %.loc5_18: Core.IntLiteral = int_value 2 [template = constants.%.34] // CHECK:STDOUT: %.loc5_13.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] // CHECK:STDOUT: %.loc5_13.2: type = converted %int.make_type_32.loc5, %.loc5_13.1 [template = i32] -// CHECK:STDOUT: %.loc5_18.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc5_18.3: = bound_method %.loc5_18.1, %.loc5_18.2 [template = constants.%.28] -// CHECK:STDOUT: %int.convert_checked.loc5: init Core.IntLiteral = call %.loc5_18.3(%.loc5_18.1) [template = constants.%.29] -// CHECK:STDOUT: %.loc5_18.4: Core.IntLiteral = value_of_initializer %int.convert_checked.loc5 [template = constants.%.29] -// CHECK:STDOUT: %.loc5_18.5: Core.IntLiteral = converted %.loc5_18.1, %.loc5_18.4 [template = constants.%.29] -// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18.5, i32 [template = constants.%.30] -// CHECK:STDOUT: %.loc5_20: type = ptr_type %.30 [template = constants.%.31] +// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.35] +// CHECK:STDOUT: %.loc5_20: type = ptr_type %.35 [template = constants.%.36] // CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { // CHECK:STDOUT: %a.patt: i32 = binding_pattern a // CHECK:STDOUT: %a.param_patt: i32 = value_param_pattern %a.patt, runtime_param0 @@ -188,9 +201,9 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %.30 = name_ref arr, file.%arr -// CHECK:STDOUT: %.loc5: %.31 = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %.31 = bind_name arr_p, %.loc5 +// CHECK:STDOUT: %arr.ref: ref %.35 = name_ref arr, file.%arr +// CHECK:STDOUT: %.loc5: %.36 = addr_of %arr.ref +// CHECK:STDOUT: %arr_p: %.36 = bind_name arr_p, %.loc5 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -205,17 +218,26 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: %Sub: %Sub.type = struct_value () [template] // CHECK:STDOUT: %Negate.type: type = fn_type @Negate [template] // CHECK:STDOUT: %Negate: %Negate.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 2147483647 [template] -// CHECK:STDOUT: %.2: i32 = int_value -2147483647 [template] -// CHECK:STDOUT: %.3: i32 = int_value 1 [template] -// CHECK:STDOUT: %.4: i32 = int_value -1 [template] -// CHECK:STDOUT: %.5: i32 = int_value -2147483648 [template] -// CHECK:STDOUT: %.6: i32 = int_value 0 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 2147483647 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 2147483647 [template] +// CHECK:STDOUT: %.28: i32 = int_value -2147483647 [template] +// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.30: = bound_method %.29, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 1 [template] +// CHECK:STDOUT: %.32: i32 = int_value -1 [template] +// CHECK:STDOUT: %.33: i32 = int_value -2147483648 [template] +// CHECK:STDOUT: %.34: i32 = int_value 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -318,54 +340,94 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Mod.ref.loc9: %Mod.type = name_ref Mod, file.%Mod.decl [template = constants.%Mod] // CHECK:STDOUT: %Negate.ref.loc9_18: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc9_25: i32 = int_value 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %int.unegate.loc9_24: init i32 = call %Negate.ref.loc9_18(%.loc9_25) [template = constants.%.2] +// CHECK:STDOUT: %.loc9_25.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.1] +// CHECK:STDOUT: %.loc9_25.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_25.3: = bound_method %.loc9_25.1, %.loc9_25.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc9_25: init i32 = call %.loc9_25.3(%.loc9_25.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc9_25.4: i32 = value_of_initializer %int.convert_checked.loc9_25 [template = constants.%.27] +// CHECK:STDOUT: %.loc9_25.5: i32 = converted %.loc9_25.1, %.loc9_25.4 [template = constants.%.27] +// CHECK:STDOUT: %int.unegate.loc9_24: init i32 = call %Negate.ref.loc9_18(%.loc9_25.5) [template = constants.%.28] // CHECK:STDOUT: %Negate.ref.loc9_39: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc9_46: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: %int.unegate.loc9_45: init i32 = call %Negate.ref.loc9_39(%.loc9_46) [template = constants.%.4] -// CHECK:STDOUT: %.loc9_24.1: i32 = value_of_initializer %int.unegate.loc9_24 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_24.2: i32 = converted %int.unegate.loc9_24, %.loc9_24.1 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_45.1: i32 = value_of_initializer %int.unegate.loc9_45 [template = constants.%.4] -// CHECK:STDOUT: %.loc9_45.2: i32 = converted %int.unegate.loc9_45, %.loc9_45.1 [template = constants.%.4] -// CHECK:STDOUT: %int.umod.loc9: init i32 = call %Mod.ref.loc9(%.loc9_24.2, %.loc9_45.2) [template = constants.%.2] -// CHECK:STDOUT: %.loc9_49.1: i32 = value_of_initializer %int.umod.loc9 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_49.2: i32 = converted %int.umod.loc9, %.loc9_49.1 [template = constants.%.2] +// CHECK:STDOUT: %.loc9_46.1: Core.IntLiteral = int_value 1 [template = constants.%.29] +// CHECK:STDOUT: %.loc9_46.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_46.3: = bound_method %.loc9_46.1, %.loc9_46.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc9_46: init i32 = call %.loc9_46.3(%.loc9_46.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc9_46.4: i32 = value_of_initializer %int.convert_checked.loc9_46 [template = constants.%.31] +// CHECK:STDOUT: %.loc9_46.5: i32 = converted %.loc9_46.1, %.loc9_46.4 [template = constants.%.31] +// CHECK:STDOUT: %int.unegate.loc9_45: init i32 = call %Negate.ref.loc9_39(%.loc9_46.5) [template = constants.%.32] +// CHECK:STDOUT: %.loc9_24.1: i32 = value_of_initializer %int.unegate.loc9_24 [template = constants.%.28] +// CHECK:STDOUT: %.loc9_24.2: i32 = converted %int.unegate.loc9_24, %.loc9_24.1 [template = constants.%.28] +// CHECK:STDOUT: %.loc9_45.1: i32 = value_of_initializer %int.unegate.loc9_45 [template = constants.%.32] +// CHECK:STDOUT: %.loc9_45.2: i32 = converted %int.unegate.loc9_45, %.loc9_45.1 [template = constants.%.32] +// CHECK:STDOUT: %int.umod.loc9: init i32 = call %Mod.ref.loc9(%.loc9_24.2, %.loc9_45.2) [template = constants.%.28] +// CHECK:STDOUT: %.loc9_49.1: i32 = value_of_initializer %int.umod.loc9 [template = constants.%.28] +// CHECK:STDOUT: %.loc9_49.2: i32 = converted %int.umod.loc9, %.loc9_49.1 [template = constants.%.28] // CHECK:STDOUT: %a: i32 = bind_name a, %.loc9_49.2 // CHECK:STDOUT: %Mod.ref.loc12: %Mod.type = name_ref Mod, file.%Mod.decl [template = constants.%Mod] // CHECK:STDOUT: %Sub.ref.loc12: %Sub.type = name_ref Sub, file.%Sub.decl [template = constants.%Sub] // CHECK:STDOUT: %Negate.ref.loc12: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc12_29: i32 = int_value 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %int.unegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_29) [template = constants.%.2] -// CHECK:STDOUT: %.loc12_43: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc12_28.1: i32 = value_of_initializer %int.unegate.loc12 [template = constants.%.2] -// CHECK:STDOUT: %.loc12_28.2: i32 = converted %int.unegate.loc12, %.loc12_28.1 [template = constants.%.2] -// CHECK:STDOUT: %int.usub.loc12: init i32 = call %Sub.ref.loc12(%.loc12_28.2, %.loc12_43) [template = constants.%.5] -// CHECK:STDOUT: %.loc12_47: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc12_21.1: i32 = value_of_initializer %int.usub.loc12 [template = constants.%.5] -// CHECK:STDOUT: %.loc12_21.2: i32 = converted %int.usub.loc12, %.loc12_21.1 [template = constants.%.5] -// CHECK:STDOUT: %int.umod.loc12: init i32 = call %Mod.ref.loc12(%.loc12_21.2, %.loc12_47) [template = constants.%.6] -// CHECK:STDOUT: %.loc12_49.1: i32 = value_of_initializer %int.umod.loc12 [template = constants.%.6] -// CHECK:STDOUT: %.loc12_49.2: i32 = converted %int.umod.loc12, %.loc12_49.1 [template = constants.%.6] +// CHECK:STDOUT: %.loc12_29.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.1] +// CHECK:STDOUT: %.loc12_29.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_29.3: = bound_method %.loc12_29.1, %.loc12_29.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc12_29: init i32 = call %.loc12_29.3(%.loc12_29.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc12_29.4: i32 = value_of_initializer %int.convert_checked.loc12_29 [template = constants.%.27] +// CHECK:STDOUT: %.loc12_29.5: i32 = converted %.loc12_29.1, %.loc12_29.4 [template = constants.%.27] +// CHECK:STDOUT: %int.unegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_29.5) [template = constants.%.28] +// CHECK:STDOUT: %.loc12_43.1: Core.IntLiteral = int_value 1 [template = constants.%.29] +// CHECK:STDOUT: %.loc12_28.1: i32 = value_of_initializer %int.unegate.loc12 [template = constants.%.28] +// CHECK:STDOUT: %.loc12_28.2: i32 = converted %int.unegate.loc12, %.loc12_28.1 [template = constants.%.28] +// CHECK:STDOUT: %.loc12_43.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_43.3: = bound_method %.loc12_43.1, %.loc12_43.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc12_43: init i32 = call %.loc12_43.3(%.loc12_43.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc12_43.4: i32 = value_of_initializer %int.convert_checked.loc12_43 [template = constants.%.31] +// CHECK:STDOUT: %.loc12_43.5: i32 = converted %.loc12_43.1, %.loc12_43.4 [template = constants.%.31] +// CHECK:STDOUT: %int.usub.loc12: init i32 = call %Sub.ref.loc12(%.loc12_28.2, %.loc12_43.5) [template = constants.%.33] +// CHECK:STDOUT: %.loc12_47.1: Core.IntLiteral = int_value 1 [template = constants.%.29] +// CHECK:STDOUT: %.loc12_21.1: i32 = value_of_initializer %int.usub.loc12 [template = constants.%.33] +// CHECK:STDOUT: %.loc12_21.2: i32 = converted %int.usub.loc12, %.loc12_21.1 [template = constants.%.33] +// CHECK:STDOUT: %.loc12_47.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_47.3: = bound_method %.loc12_47.1, %.loc12_47.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc12_47: init i32 = call %.loc12_47.3(%.loc12_47.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc12_47.4: i32 = value_of_initializer %int.convert_checked.loc12_47 [template = constants.%.31] +// CHECK:STDOUT: %.loc12_47.5: i32 = converted %.loc12_47.1, %.loc12_47.4 [template = constants.%.31] +// CHECK:STDOUT: %int.umod.loc12: init i32 = call %Mod.ref.loc12(%.loc12_21.2, %.loc12_47.5) [template = constants.%.34] +// CHECK:STDOUT: %.loc12_49.1: i32 = value_of_initializer %int.umod.loc12 [template = constants.%.34] +// CHECK:STDOUT: %.loc12_49.2: i32 = converted %int.umod.loc12, %.loc12_49.1 [template = constants.%.34] // CHECK:STDOUT: %b: i32 = bind_name b, %.loc12_49.2 // CHECK:STDOUT: %Mod.ref.loc15: %Mod.type = name_ref Mod, file.%Mod.decl [template = constants.%Mod] // CHECK:STDOUT: %Sub.ref.loc15: %Sub.type = name_ref Sub, file.%Sub.decl [template = constants.%Sub] // CHECK:STDOUT: %Negate.ref.loc15_22: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc15_29: i32 = int_value 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %int.unegate.loc15_28: init i32 = call %Negate.ref.loc15_22(%.loc15_29) [template = constants.%.2] -// CHECK:STDOUT: %.loc15_43: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc15_28.1: i32 = value_of_initializer %int.unegate.loc15_28 [template = constants.%.2] -// CHECK:STDOUT: %.loc15_28.2: i32 = converted %int.unegate.loc15_28, %.loc15_28.1 [template = constants.%.2] -// CHECK:STDOUT: %int.usub.loc15: init i32 = call %Sub.ref.loc15(%.loc15_28.2, %.loc15_43) [template = constants.%.5] +// CHECK:STDOUT: %.loc15_29.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.1] +// CHECK:STDOUT: %.loc15_29.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc15_29.3: = bound_method %.loc15_29.1, %.loc15_29.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc15_29: init i32 = call %.loc15_29.3(%.loc15_29.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc15_29.4: i32 = value_of_initializer %int.convert_checked.loc15_29 [template = constants.%.27] +// CHECK:STDOUT: %.loc15_29.5: i32 = converted %.loc15_29.1, %.loc15_29.4 [template = constants.%.27] +// CHECK:STDOUT: %int.unegate.loc15_28: init i32 = call %Negate.ref.loc15_22(%.loc15_29.5) [template = constants.%.28] +// CHECK:STDOUT: %.loc15_43.1: Core.IntLiteral = int_value 1 [template = constants.%.29] +// CHECK:STDOUT: %.loc15_28.1: i32 = value_of_initializer %int.unegate.loc15_28 [template = constants.%.28] +// CHECK:STDOUT: %.loc15_28.2: i32 = converted %int.unegate.loc15_28, %.loc15_28.1 [template = constants.%.28] +// CHECK:STDOUT: %.loc15_43.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc15_43.3: = bound_method %.loc15_43.1, %.loc15_43.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc15_43: init i32 = call %.loc15_43.3(%.loc15_43.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc15_43.4: i32 = value_of_initializer %int.convert_checked.loc15_43 [template = constants.%.31] +// CHECK:STDOUT: %.loc15_43.5: i32 = converted %.loc15_43.1, %.loc15_43.4 [template = constants.%.31] +// CHECK:STDOUT: %int.usub.loc15: init i32 = call %Sub.ref.loc15(%.loc15_28.2, %.loc15_43.5) [template = constants.%.33] // CHECK:STDOUT: %Negate.ref.loc15_47: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc15_54: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: %int.unegate.loc15_53: init i32 = call %Negate.ref.loc15_47(%.loc15_54) [template = constants.%.4] -// CHECK:STDOUT: %.loc15_21.1: i32 = value_of_initializer %int.usub.loc15 [template = constants.%.5] -// CHECK:STDOUT: %.loc15_21.2: i32 = converted %int.usub.loc15, %.loc15_21.1 [template = constants.%.5] -// CHECK:STDOUT: %.loc15_53.1: i32 = value_of_initializer %int.unegate.loc15_53 [template = constants.%.4] -// CHECK:STDOUT: %.loc15_53.2: i32 = converted %int.unegate.loc15_53, %.loc15_53.1 [template = constants.%.4] -// CHECK:STDOUT: %int.umod.loc15: init i32 = call %Mod.ref.loc15(%.loc15_21.2, %.loc15_53.2) [template = constants.%.5] -// CHECK:STDOUT: %.loc15_57.1: i32 = value_of_initializer %int.umod.loc15 [template = constants.%.5] -// CHECK:STDOUT: %.loc15_57.2: i32 = converted %int.umod.loc15, %.loc15_57.1 [template = constants.%.5] +// CHECK:STDOUT: %.loc15_54.1: Core.IntLiteral = int_value 1 [template = constants.%.29] +// CHECK:STDOUT: %.loc15_54.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc15_54.3: = bound_method %.loc15_54.1, %.loc15_54.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc15_54: init i32 = call %.loc15_54.3(%.loc15_54.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc15_54.4: i32 = value_of_initializer %int.convert_checked.loc15_54 [template = constants.%.31] +// CHECK:STDOUT: %.loc15_54.5: i32 = converted %.loc15_54.1, %.loc15_54.4 [template = constants.%.31] +// CHECK:STDOUT: %int.unegate.loc15_53: init i32 = call %Negate.ref.loc15_47(%.loc15_54.5) [template = constants.%.32] +// CHECK:STDOUT: %.loc15_21.1: i32 = value_of_initializer %int.usub.loc15 [template = constants.%.33] +// CHECK:STDOUT: %.loc15_21.2: i32 = converted %int.usub.loc15, %.loc15_21.1 [template = constants.%.33] +// CHECK:STDOUT: %.loc15_53.1: i32 = value_of_initializer %int.unegate.loc15_53 [template = constants.%.32] +// CHECK:STDOUT: %.loc15_53.2: i32 = converted %int.unegate.loc15_53, %.loc15_53.1 [template = constants.%.32] +// CHECK:STDOUT: %int.umod.loc15: init i32 = call %Mod.ref.loc15(%.loc15_21.2, %.loc15_53.2) [template = constants.%.33] +// CHECK:STDOUT: %.loc15_57.1: i32 = value_of_initializer %int.umod.loc15 [template = constants.%.33] +// CHECK:STDOUT: %.loc15_57.2: i32 = converted %int.umod.loc15, %.loc15_57.1 [template = constants.%.33] // CHECK:STDOUT: %c: i32 = bind_name c, %.loc15_57.2 // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -377,13 +439,22 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %Mod.type: type = fn_type @Mod [template] // CHECK:STDOUT: %Mod: %Mod.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %.2: i32 = int_value 0 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 0 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 1 [template] +// CHECK:STDOUT: %.29: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -434,16 +505,36 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Mod.ref.loc12: %Mod.type = name_ref Mod, file.%Mod.decl [template = constants.%Mod] -// CHECK:STDOUT: %.loc12_18: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc12_21: i32 = int_value 0 [template = constants.%.2] -// CHECK:STDOUT: %int.umod.loc12: init i32 = call %Mod.ref.loc12(%.loc12_18, %.loc12_21) [template = ] +// CHECK:STDOUT: %.loc12_18.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc12_21.1: Core.IntLiteral = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc12_18.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_18.3: = bound_method %.loc12_18.1, %.loc12_18.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc12_18: init i32 = call %.loc12_18.3(%.loc12_18.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc12_18.4: i32 = value_of_initializer %int.convert_checked.loc12_18 [template = constants.%.28] +// CHECK:STDOUT: %.loc12_18.5: i32 = converted %.loc12_18.1, %.loc12_18.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc12_21.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_21.3: = bound_method %.loc12_21.1, %.loc12_21.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc12_21: init i32 = call %.loc12_21.3(%.loc12_21.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc12_21.4: i32 = value_of_initializer %int.convert_checked.loc12_21 [template = constants.%.30] +// CHECK:STDOUT: %.loc12_21.5: i32 = converted %.loc12_21.1, %.loc12_21.4 [template = constants.%.30] +// CHECK:STDOUT: %int.umod.loc12: init i32 = call %Mod.ref.loc12(%.loc12_18.5, %.loc12_21.5) [template = ] // CHECK:STDOUT: %.loc12_23.1: i32 = value_of_initializer %int.umod.loc12 [template = ] // CHECK:STDOUT: %.loc12_23.2: i32 = converted %int.umod.loc12, %.loc12_23.1 [template = ] // CHECK:STDOUT: %a: i32 = bind_name a, %.loc12_23.2 // CHECK:STDOUT: %Mod.ref.loc17: %Mod.type = name_ref Mod, file.%Mod.decl [template = constants.%Mod] -// CHECK:STDOUT: %.loc17_18: i32 = int_value 0 [template = constants.%.2] -// CHECK:STDOUT: %.loc17_21: i32 = int_value 0 [template = constants.%.2] -// CHECK:STDOUT: %int.umod.loc17: init i32 = call %Mod.ref.loc17(%.loc17_18, %.loc17_21) [template = ] +// CHECK:STDOUT: %.loc17_18.1: Core.IntLiteral = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc17_21.1: Core.IntLiteral = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc17_18.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc17_18.3: = bound_method %.loc17_18.1, %.loc17_18.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc17_18: init i32 = call %.loc17_18.3(%.loc17_18.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc17_18.4: i32 = value_of_initializer %int.convert_checked.loc17_18 [template = constants.%.30] +// CHECK:STDOUT: %.loc17_18.5: i32 = converted %.loc17_18.1, %.loc17_18.4 [template = constants.%.30] +// CHECK:STDOUT: %.loc17_21.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc17_21.3: = bound_method %.loc17_21.1, %.loc17_21.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc17_21: init i32 = call %.loc17_21.3(%.loc17_21.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc17_21.4: i32 = value_of_initializer %int.convert_checked.loc17_21 [template = constants.%.30] +// CHECK:STDOUT: %.loc17_21.5: i32 = converted %.loc17_21.1, %.loc17_21.4 [template = constants.%.30] +// CHECK:STDOUT: %int.umod.loc17: init i32 = call %Mod.ref.loc17(%.loc17_18.5, %.loc17_21.5) [template = ] // CHECK:STDOUT: %.loc17_23.1: i32 = value_of_initializer %int.umod.loc17 [template = ] // CHECK:STDOUT: %.loc17_23.2: i32 = converted %int.umod.loc17, %.loc17_23.1 [template = ] // CHECK:STDOUT: %b: i32 = bind_name b, %.loc17_23.2 diff --git a/toolchain/check/testdata/builtins/int/umul.carbon b/toolchain/check/testdata/builtins/int/umul.carbon index 9d0a91b37b042..6f32948b514bf 100644 --- a/toolchain/check/testdata/builtins/int/umul.carbon +++ b/toolchain/check/testdata/builtins/int/umul.carbon @@ -35,17 +35,25 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %Mul.type: type = fn_type @Mul [template] // CHECK:STDOUT: %Mul: %Mul.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 3 [template] -// CHECK:STDOUT: %.2: i32 = int_value 2 [template] -// CHECK:STDOUT: %.3: i32 = int_value 6 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(i32) [template] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] // CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template] // CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template] -// CHECK:STDOUT: %.27: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.28: = bound_method %.3, %Convert.15 [template] -// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 6 [template] -// CHECK:STDOUT: %.30: type = array_type %.29, i32 [template] -// CHECK:STDOUT: %.31: type = ptr_type %.30 [template] +// CHECK:STDOUT: %.26: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 3 [template] +// CHECK:STDOUT: %.29: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 2 [template] +// CHECK:STDOUT: %.31: i32 = int_value 6 [template] +// CHECK:STDOUT: %Convert.type.16: type = fn_type @Convert.12 [template] +// CHECK:STDOUT: %Convert.16: %Convert.type.16 = struct_value () [template] +// CHECK:STDOUT: %.32: = interface_witness (%Convert.16) [template] +// CHECK:STDOUT: %.33: = bound_method %.31, %Convert.16 [template] +// CHECK:STDOUT: %.34: Core.IntLiteral = int_value 6 [template] +// CHECK:STDOUT: %.35: type = array_type %.34, i32 [template] +// CHECK:STDOUT: %.36: type = ptr_type %.35 [template] // CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] // CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] // CHECK:STDOUT: } @@ -94,32 +102,37 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: } // CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %Mul.ref: %Mul.type = name_ref Mul, %Mul.decl [template = constants.%Mul] -// CHECK:STDOUT: %.loc4_20: i32 = int_value 3 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_23: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: %int.umul: init i32 = call %Mul.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] +// CHECK:STDOUT: %.loc4_20.1: Core.IntLiteral = int_value 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc4_23.1: Core.IntLiteral = int_value 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_20.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_20.3: = bound_method %.loc4_20.1, %.loc4_20.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc4_20: init i32 = call %.loc4_20.3(%.loc4_20.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc4_20.4: i32 = value_of_initializer %int.convert_checked.loc4_20 [template = constants.%.28] +// CHECK:STDOUT: %.loc4_20.5: i32 = converted %.loc4_20.1, %.loc4_20.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc4_23.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_23.3: = bound_method %.loc4_23.1, %.loc4_23.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc4_23: init i32 = call %.loc4_23.3(%.loc4_23.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc4_23.4: i32 = value_of_initializer %int.convert_checked.loc4_23 [template = constants.%.30] +// CHECK:STDOUT: %.loc4_23.5: i32 = converted %.loc4_23.1, %.loc4_23.4 [template = constants.%.30] +// CHECK:STDOUT: %int.umul: init i32 = call %Mul.ref(%.loc4_20.5, %.loc4_23.5) [template = constants.%.31] // CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] // CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4, %.loc4_11.1 [template = i32] -// CHECK:STDOUT: %.loc4_19.1: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc4_19.2: = bound_method %int.umul, %.loc4_19.1 [template = constants.%.28] -// CHECK:STDOUT: %.loc4_19.3: i32 = value_of_initializer %int.umul [template = constants.%.3] -// CHECK:STDOUT: %.loc4_19.4: i32 = converted %int.umul, %.loc4_19.3 [template = constants.%.3] -// CHECK:STDOUT: %int.convert_checked.loc4: init Core.IntLiteral = call %.loc4_19.2(%.loc4_19.4) [template = constants.%.29] -// CHECK:STDOUT: %.loc4_19.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4 [template = constants.%.29] -// CHECK:STDOUT: %.loc4_19.6: Core.IntLiteral = converted %int.umul, %.loc4_19.5 [template = constants.%.29] -// CHECK:STDOUT: %.loc4_25: type = array_type %.loc4_19.6, i32 [template = constants.%.30] -// CHECK:STDOUT: %arr.var: ref %.30 = var arr -// CHECK:STDOUT: %arr: ref %.30 = bind_name arr, %arr.var +// CHECK:STDOUT: %.loc4_19.1: %Convert.type.5 = interface_witness_access constants.%.32, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %.loc4_19.2: = bound_method %int.umul, %.loc4_19.1 [template = constants.%.33] +// CHECK:STDOUT: %.loc4_19.3: i32 = value_of_initializer %int.umul [template = constants.%.31] +// CHECK:STDOUT: %.loc4_19.4: i32 = converted %int.umul, %.loc4_19.3 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc4_19: init Core.IntLiteral = call %.loc4_19.2(%.loc4_19.4) [template = constants.%.34] +// CHECK:STDOUT: %.loc4_19.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4_19 [template = constants.%.34] +// CHECK:STDOUT: %.loc4_19.6: Core.IntLiteral = converted %int.umul, %.loc4_19.5 [template = constants.%.34] +// CHECK:STDOUT: %.loc4_25: type = array_type %.loc4_19.6, i32 [template = constants.%.35] +// CHECK:STDOUT: %arr.var: ref %.35 = var arr +// CHECK:STDOUT: %arr: ref %.35 = bind_name arr, %arr.var // CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc5_18.1: i32 = int_value 6 [template = constants.%.3] +// CHECK:STDOUT: %.loc5_18: Core.IntLiteral = int_value 6 [template = constants.%.34] // CHECK:STDOUT: %.loc5_13.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] // CHECK:STDOUT: %.loc5_13.2: type = converted %int.make_type_32.loc5, %.loc5_13.1 [template = i32] -// CHECK:STDOUT: %.loc5_18.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc5_18.3: = bound_method %.loc5_18.1, %.loc5_18.2 [template = constants.%.28] -// CHECK:STDOUT: %int.convert_checked.loc5: init Core.IntLiteral = call %.loc5_18.3(%.loc5_18.1) [template = constants.%.29] -// CHECK:STDOUT: %.loc5_18.4: Core.IntLiteral = value_of_initializer %int.convert_checked.loc5 [template = constants.%.29] -// CHECK:STDOUT: %.loc5_18.5: Core.IntLiteral = converted %.loc5_18.1, %.loc5_18.4 [template = constants.%.29] -// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18.5, i32 [template = constants.%.30] -// CHECK:STDOUT: %.loc5_20: type = ptr_type %.30 [template = constants.%.31] +// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.35] +// CHECK:STDOUT: %.loc5_20: type = ptr_type %.35 [template = constants.%.36] // CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { // CHECK:STDOUT: %a.patt: i32 = binding_pattern a // CHECK:STDOUT: %a.param_patt: i32 = value_param_pattern %a.patt, runtime_param0 @@ -161,9 +174,9 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %.30 = name_ref arr, file.%arr -// CHECK:STDOUT: %.loc5: %.31 = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %.31 = bind_name arr_p, %.loc5 +// CHECK:STDOUT: %arr.ref: ref %.35 = name_ref arr, file.%arr +// CHECK:STDOUT: %.loc5: %.36 = addr_of %arr.ref +// CHECK:STDOUT: %arr_p: %.36 = bind_name arr_p, %.loc5 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -174,16 +187,27 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %Mul.type: type = fn_type @Mul [template] // CHECK:STDOUT: %Mul: %Mul.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 32767 [template] -// CHECK:STDOUT: %.2: i32 = int_value 65536 [template] -// CHECK:STDOUT: %.3: i32 = int_value 2147418112 [template] -// CHECK:STDOUT: %.4: i32 = int_value 32768 [template] -// CHECK:STDOUT: %.5: i32 = int_value -2147483648 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 32767 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 65536 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 32767 [template] +// CHECK:STDOUT: %.29: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 65536 [template] +// CHECK:STDOUT: %.31: i32 = int_value 2147418112 [template] +// CHECK:STDOUT: %.32: Core.IntLiteral = int_value 32768 [template] +// CHECK:STDOUT: %.33: = bound_method %.32, %Convert.15 [template] +// CHECK:STDOUT: %.34: i32 = int_value 32768 [template] +// CHECK:STDOUT: %.35: i32 = int_value -2147483648 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -234,18 +258,38 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Mul.ref.loc6: %Mul.type = name_ref Mul, file.%Mul.decl [template = constants.%Mul] -// CHECK:STDOUT: %.loc6_18: i32 = int_value 32767 [template = constants.%.1] -// CHECK:STDOUT: %.loc6_26: i32 = int_value 65536 [template = constants.%.2] -// CHECK:STDOUT: %int.umul.loc6: init i32 = call %Mul.ref.loc6(%.loc6_18, %.loc6_26) [template = constants.%.3] -// CHECK:STDOUT: %.loc6_34.1: i32 = value_of_initializer %int.umul.loc6 [template = constants.%.3] -// CHECK:STDOUT: %.loc6_34.2: i32 = converted %int.umul.loc6, %.loc6_34.1 [template = constants.%.3] +// CHECK:STDOUT: %.loc6_18.1: Core.IntLiteral = int_value 32767 [template = constants.%.1] +// CHECK:STDOUT: %.loc6_26.1: Core.IntLiteral = int_value 65536 [template = constants.%.2] +// CHECK:STDOUT: %.loc6_18.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc6_18.3: = bound_method %.loc6_18.1, %.loc6_18.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc6_18: init i32 = call %.loc6_18.3(%.loc6_18.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc6_18.4: i32 = value_of_initializer %int.convert_checked.loc6_18 [template = constants.%.28] +// CHECK:STDOUT: %.loc6_18.5: i32 = converted %.loc6_18.1, %.loc6_18.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc6_26.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc6_26.3: = bound_method %.loc6_26.1, %.loc6_26.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc6_26: init i32 = call %.loc6_26.3(%.loc6_26.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc6_26.4: i32 = value_of_initializer %int.convert_checked.loc6_26 [template = constants.%.30] +// CHECK:STDOUT: %.loc6_26.5: i32 = converted %.loc6_26.1, %.loc6_26.4 [template = constants.%.30] +// CHECK:STDOUT: %int.umul.loc6: init i32 = call %Mul.ref.loc6(%.loc6_18.5, %.loc6_26.5) [template = constants.%.31] +// CHECK:STDOUT: %.loc6_34.1: i32 = value_of_initializer %int.umul.loc6 [template = constants.%.31] +// CHECK:STDOUT: %.loc6_34.2: i32 = converted %int.umul.loc6, %.loc6_34.1 [template = constants.%.31] // CHECK:STDOUT: %a: i32 = bind_name a, %.loc6_34.2 // CHECK:STDOUT: %Mul.ref.loc7: %Mul.type = name_ref Mul, file.%Mul.decl [template = constants.%Mul] -// CHECK:STDOUT: %.loc7_18: i32 = int_value 32768 [template = constants.%.4] -// CHECK:STDOUT: %.loc7_26: i32 = int_value 65536 [template = constants.%.2] -// CHECK:STDOUT: %int.umul.loc7: init i32 = call %Mul.ref.loc7(%.loc7_18, %.loc7_26) [template = constants.%.5] -// CHECK:STDOUT: %.loc7_34.1: i32 = value_of_initializer %int.umul.loc7 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_34.2: i32 = converted %int.umul.loc7, %.loc7_34.1 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_18.1: Core.IntLiteral = int_value 32768 [template = constants.%.32] +// CHECK:STDOUT: %.loc7_26.1: Core.IntLiteral = int_value 65536 [template = constants.%.2] +// CHECK:STDOUT: %.loc7_18.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc7_18.3: = bound_method %.loc7_18.1, %.loc7_18.2 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc7_18: init i32 = call %.loc7_18.3(%.loc7_18.1) [template = constants.%.34] +// CHECK:STDOUT: %.loc7_18.4: i32 = value_of_initializer %int.convert_checked.loc7_18 [template = constants.%.34] +// CHECK:STDOUT: %.loc7_18.5: i32 = converted %.loc7_18.1, %.loc7_18.4 [template = constants.%.34] +// CHECK:STDOUT: %.loc7_26.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc7_26.3: = bound_method %.loc7_26.1, %.loc7_26.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc7_26: init i32 = call %.loc7_26.3(%.loc7_26.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc7_26.4: i32 = value_of_initializer %int.convert_checked.loc7_26 [template = constants.%.30] +// CHECK:STDOUT: %.loc7_26.5: i32 = converted %.loc7_26.1, %.loc7_26.4 [template = constants.%.30] +// CHECK:STDOUT: %int.umul.loc7: init i32 = call %Mul.ref.loc7(%.loc7_18.5, %.loc7_26.5) [template = constants.%.35] +// CHECK:STDOUT: %.loc7_34.1: i32 = value_of_initializer %int.umul.loc7 [template = constants.%.35] +// CHECK:STDOUT: %.loc7_34.2: i32 = converted %int.umul.loc7, %.loc7_34.1 [template = constants.%.35] // CHECK:STDOUT: %b: i32 = bind_name b, %.loc7_34.2 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/builtins/int/unegate.carbon b/toolchain/check/testdata/builtins/int/unegate.carbon index 9d779b1d81dfa..0f945326e8382 100644 --- a/toolchain/check/testdata/builtins/int/unegate.carbon +++ b/toolchain/check/testdata/builtins/int/unegate.carbon @@ -119,18 +119,25 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %Negate.type: type = fn_type @Negate [template] // CHECK:STDOUT: %Negate: %Negate.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 123 [template] -// CHECK:STDOUT: %.2: i32 = int_value -123 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 123 [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(i32) [template] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [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: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.27: = bound_method %.1, %Convert.15 [template] -// CHECK:STDOUT: %.28: Core.IntLiteral = int_value 123 [template] -// CHECK:STDOUT: %.29: type = array_type %.28, i32 [template] -// CHECK:STDOUT: %.30: type = ptr_type %.29 [template] -// CHECK:STDOUT: %.31: i32 = int_value 1 [template] -// CHECK:STDOUT: %.32: i32 = int_value -1 [template] +// CHECK:STDOUT: %.25: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 123 [template] +// CHECK:STDOUT: %.28: i32 = int_value -123 [template] +// CHECK:STDOUT: %Convert.type.16: type = fn_type @Convert.12 [template] +// CHECK:STDOUT: %Convert.16: %Convert.type.16 = struct_value () [template] +// CHECK:STDOUT: %.29: = interface_witness (%Convert.16) [template] +// CHECK:STDOUT: %.30: = bound_method %.27, %Convert.16 [template] +// CHECK:STDOUT: %.31: type = array_type %.1, i32 [template] +// CHECK:STDOUT: %.32: type = ptr_type %.31 [template] +// CHECK:STDOUT: %.33: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.34: = bound_method %.33, %Convert.15 [template] +// CHECK:STDOUT: %.35: i32 = int_value 1 [template] +// CHECK:STDOUT: %.36: i32 = int_value -1 [template] // CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] // CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] // CHECK:STDOUT: } @@ -174,34 +181,34 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %Negate.ref.loc4_16: %Negate.type = name_ref Negate, %Negate.decl [template = constants.%Negate] // CHECK:STDOUT: %Negate.ref.loc4_23: %Negate.type = name_ref Negate, %Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc4_30: i32 = int_value 123 [template = constants.%.1] -// CHECK:STDOUT: %int.unegate.loc4_29: init i32 = call %Negate.ref.loc4_23(%.loc4_30) [template = constants.%.2] -// CHECK:STDOUT: %.loc4_29.1: i32 = value_of_initializer %int.unegate.loc4_29 [template = constants.%.2] -// CHECK:STDOUT: %.loc4_29.2: i32 = converted %int.unegate.loc4_29, %.loc4_29.1 [template = constants.%.2] -// CHECK:STDOUT: %int.unegate.loc4_22: init i32 = call %Negate.ref.loc4_16(%.loc4_29.2) [template = constants.%.1] +// CHECK:STDOUT: %.loc4_30.1: Core.IntLiteral = int_value 123 [template = constants.%.1] +// CHECK:STDOUT: %.loc4_30.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_30.3: = bound_method %.loc4_30.1, %.loc4_30.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc4_30: init i32 = call %.loc4_30.3(%.loc4_30.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc4_30.4: i32 = value_of_initializer %int.convert_checked.loc4_30 [template = constants.%.27] +// CHECK:STDOUT: %.loc4_30.5: i32 = converted %.loc4_30.1, %.loc4_30.4 [template = constants.%.27] +// CHECK:STDOUT: %int.unegate.loc4_29: init i32 = call %Negate.ref.loc4_23(%.loc4_30.5) [template = constants.%.28] +// CHECK:STDOUT: %.loc4_29.1: i32 = value_of_initializer %int.unegate.loc4_29 [template = constants.%.28] +// CHECK:STDOUT: %.loc4_29.2: i32 = converted %int.unegate.loc4_29, %.loc4_29.1 [template = constants.%.28] +// CHECK:STDOUT: %int.unegate.loc4_22: init i32 = call %Negate.ref.loc4_16(%.loc4_29.2) [template = constants.%.27] // CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] // CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4, %.loc4_11.1 [template = i32] -// CHECK:STDOUT: %.loc4_22.1: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc4_22.2: = bound_method %int.unegate.loc4_22, %.loc4_22.1 [template = constants.%.27] -// CHECK:STDOUT: %.loc4_22.3: i32 = value_of_initializer %int.unegate.loc4_22 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_22.4: i32 = converted %int.unegate.loc4_22, %.loc4_22.3 [template = constants.%.1] -// CHECK:STDOUT: %int.convert_checked.loc4: init Core.IntLiteral = call %.loc4_22.2(%.loc4_22.4) [template = constants.%.28] -// CHECK:STDOUT: %.loc4_22.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4 [template = constants.%.28] -// CHECK:STDOUT: %.loc4_22.6: Core.IntLiteral = converted %int.unegate.loc4_22, %.loc4_22.5 [template = constants.%.28] -// CHECK:STDOUT: %.loc4_35: type = array_type %.loc4_22.6, i32 [template = constants.%.29] -// CHECK:STDOUT: %arr.var: ref %.29 = var arr -// CHECK:STDOUT: %arr: ref %.29 = bind_name arr, %arr.var +// CHECK:STDOUT: %.loc4_22.1: %Convert.type.5 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %.loc4_22.2: = bound_method %int.unegate.loc4_22, %.loc4_22.1 [template = constants.%.30] +// CHECK:STDOUT: %.loc4_22.3: i32 = value_of_initializer %int.unegate.loc4_22 [template = constants.%.27] +// CHECK:STDOUT: %.loc4_22.4: i32 = converted %int.unegate.loc4_22, %.loc4_22.3 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc4_22: init Core.IntLiteral = call %.loc4_22.2(%.loc4_22.4) [template = constants.%.1] +// CHECK:STDOUT: %.loc4_22.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4_22 [template = constants.%.1] +// CHECK:STDOUT: %.loc4_22.6: Core.IntLiteral = converted %int.unegate.loc4_22, %.loc4_22.5 [template = constants.%.1] +// CHECK:STDOUT: %.loc4_35: type = array_type %.loc4_22.6, i32 [template = constants.%.31] +// CHECK:STDOUT: %arr.var: ref %.31 = var arr +// CHECK:STDOUT: %arr: ref %.31 = bind_name arr, %arr.var // CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc5_18.1: i32 = int_value 123 [template = constants.%.1] +// CHECK:STDOUT: %.loc5_18: Core.IntLiteral = int_value 123 [template = constants.%.1] // CHECK:STDOUT: %.loc5_13.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] // CHECK:STDOUT: %.loc5_13.2: type = converted %int.make_type_32.loc5, %.loc5_13.1 [template = i32] -// CHECK:STDOUT: %.loc5_18.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc5_18.3: = bound_method %.loc5_18.1, %.loc5_18.2 [template = constants.%.27] -// CHECK:STDOUT: %int.convert_checked.loc5: init Core.IntLiteral = call %.loc5_18.3(%.loc5_18.1) [template = constants.%.28] -// CHECK:STDOUT: %.loc5_18.4: Core.IntLiteral = value_of_initializer %int.convert_checked.loc5 [template = constants.%.28] -// CHECK:STDOUT: %.loc5_18.5: Core.IntLiteral = converted %.loc5_18.1, %.loc5_18.4 [template = constants.%.28] -// CHECK:STDOUT: %.loc5_21: type = array_type %.loc5_18.5, i32 [template = constants.%.29] -// CHECK:STDOUT: %.loc5_22: type = ptr_type %.29 [template = constants.%.30] +// CHECK:STDOUT: %.loc5_21: type = array_type %.loc5_18, i32 [template = constants.%.31] +// CHECK:STDOUT: %.loc5_22: type = ptr_type %.31 [template = constants.%.32] // CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc7_8.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] // CHECK:STDOUT: %.loc7_8.2: type = converted %int.make_type_32.loc7, %.loc7_8.1 [template = i32] @@ -245,14 +252,19 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %.29 = name_ref arr, file.%arr -// CHECK:STDOUT: %.loc5: %.30 = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %.30 = bind_name arr_p, %.loc5 +// CHECK:STDOUT: %arr.ref: ref %.31 = name_ref arr, file.%arr +// CHECK:STDOUT: %.loc5: %.32 = addr_of %arr.ref +// CHECK:STDOUT: %arr_p: %.32 = bind_name arr_p, %.loc5 // CHECK:STDOUT: %Negate.ref: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc7_21: i32 = int_value 1 [template = constants.%.31] -// CHECK:STDOUT: %int.unegate: init i32 = call %Negate.ref(%.loc7_21) [template = constants.%.32] -// CHECK:STDOUT: %.loc7_23.1: i32 = value_of_initializer %int.unegate [template = constants.%.32] -// CHECK:STDOUT: %.loc7_23.2: i32 = converted %int.unegate, %.loc7_23.1 [template = constants.%.32] +// CHECK:STDOUT: %.loc7_21.1: Core.IntLiteral = int_value 1 [template = constants.%.33] +// CHECK:STDOUT: %.loc7_21.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc7_21.3: = bound_method %.loc7_21.1, %.loc7_21.2 [template = constants.%.34] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc7_21.3(%.loc7_21.1) [template = constants.%.35] +// CHECK:STDOUT: %.loc7_21.4: i32 = value_of_initializer %int.convert_checked [template = constants.%.35] +// CHECK:STDOUT: %.loc7_21.5: i32 = converted %.loc7_21.1, %.loc7_21.4 [template = constants.%.35] +// CHECK:STDOUT: %int.unegate: init i32 = call %Negate.ref(%.loc7_21.5) [template = constants.%.36] +// CHECK:STDOUT: %.loc7_23.1: i32 = value_of_initializer %int.unegate [template = constants.%.36] +// CHECK:STDOUT: %.loc7_23.2: i32 = converted %int.unegate, %.loc7_23.1 [template = constants.%.36] // CHECK:STDOUT: %n: i32 = bind_name n, %.loc7_23.2 // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -272,8 +284,16 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: %BadReturnType: %BadReturnType.type = struct_value () [template] // CHECK:STDOUT: %JustRight.type: type = fn_type @JustRight [template] // CHECK:STDOUT: %JustRight: %JustRight.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %.2: i32 = int_value 2 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 2 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 1 [template] +// CHECK:STDOUT: %.29: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 2 [template] // CHECK:STDOUT: %RuntimeCallTooFew.type: type = fn_type @RuntimeCallTooFew [template] // CHECK:STDOUT: %RuntimeCallTooFew: %RuntimeCallTooFew.type = struct_value () [template] // CHECK:STDOUT: %RuntimeCallTooMany.type: type = fn_type @RuntimeCallTooMany [template] @@ -286,6 +306,7 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int32 = %import_ref.1 // CHECK:STDOUT: .Bool = %import_ref.2 +// CHECK:STDOUT: .ImplicitAs = %import_ref.3 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -384,25 +405,40 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: %too_few: ref = bind_name too_few, %too_few.var // CHECK:STDOUT: %int.make_type_32.loc30: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %TooMany.ref: %TooMany.type = name_ref TooMany, %TooMany.decl [template = constants.%TooMany] -// CHECK:STDOUT: %.loc30_29: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc30_32: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: %TooMany.call: init i32 = call %TooMany.ref(%.loc30_29, %.loc30_32) +// CHECK:STDOUT: %.loc30_29.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc30_32.1: Core.IntLiteral = int_value 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc30_29.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc30_29.3: = bound_method %.loc30_29.1, %.loc30_29.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc30_29: init i32 = call %.loc30_29.3(%.loc30_29.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc30_29.4: i32 = value_of_initializer %int.convert_checked.loc30_29 [template = constants.%.28] +// CHECK:STDOUT: %.loc30_29.5: i32 = converted %.loc30_29.1, %.loc30_29.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc30_32.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc30_32.3: = bound_method %.loc30_32.1, %.loc30_32.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc30_32: init i32 = call %.loc30_32.3(%.loc30_32.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc30_32.4: i32 = value_of_initializer %int.convert_checked.loc30_32 [template = constants.%.30] +// CHECK:STDOUT: %.loc30_32.5: i32 = converted %.loc30_32.1, %.loc30_32.4 [template = constants.%.30] +// CHECK:STDOUT: %TooMany.call: init i32 = call %TooMany.ref(%.loc30_29.5, %.loc30_32.5) // CHECK:STDOUT: %.loc30_16.1: type = value_of_initializer %int.make_type_32.loc30 [template = i32] // CHECK:STDOUT: %.loc30_16.2: type = converted %int.make_type_32.loc30, %.loc30_16.1 [template = i32] // CHECK:STDOUT: %too_many.var: ref = var too_many // CHECK:STDOUT: %too_many: ref = bind_name too_many, %too_many.var // CHECK:STDOUT: %int.make_type_32.loc35: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %BadReturnType.ref: %BadReturnType.type = name_ref BadReturnType, %BadReturnType.decl [template = constants.%BadReturnType] -// CHECK:STDOUT: %.loc35_42: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref(%.loc35_42) +// CHECK:STDOUT: %.loc35_42.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc35_42.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc35_42.3: = bound_method %.loc35_42.1, %.loc35_42.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc35: init i32 = call %.loc35_42.3(%.loc35_42.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc35_42.4: i32 = value_of_initializer %int.convert_checked.loc35 [template = constants.%.28] +// CHECK:STDOUT: %.loc35_42.5: i32 = converted %.loc35_42.1, %.loc35_42.4 [template = constants.%.28] +// CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref(%.loc35_42.5) // CHECK:STDOUT: %.loc35_23.1: type = value_of_initializer %int.make_type_32.loc35 [template = i32] // CHECK:STDOUT: %.loc35_23.2: type = converted %int.make_type_32.loc35, %.loc35_23.1 [template = i32] // CHECK:STDOUT: %bad_return_type.var: ref = var bad_return_type // CHECK:STDOUT: %bad_return_type: ref = bind_name bad_return_type, %bad_return_type.var // CHECK:STDOUT: %int.make_type_32.loc44: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %JustRight.ref: %JustRight.type = name_ref JustRight, %JustRight.decl [template = constants.%JustRight] -// CHECK:STDOUT: %.loc44_31: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc44_34: i32 = int_value 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc44_31: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc44_34: Core.IntLiteral = int_value 2 [template = constants.%.2] // CHECK:STDOUT: %.loc44_16.1: type = value_of_initializer %int.make_type_32.loc44 [template = i32] // CHECK:STDOUT: %.loc44_16.2: type = converted %int.make_type_32.loc44, %.loc44_16.1 [template = i32] // CHECK:STDOUT: %.loc44_36: type = array_type , i32 [template = ] @@ -523,15 +559,24 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: %Negate: %Negate.type = struct_value () [template] // CHECK:STDOUT: %Sub.type: type = fn_type @Sub [template] // CHECK:STDOUT: %Sub: %Sub.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 2147483647 [template] -// CHECK:STDOUT: %.2: i32 = int_value -2147483647 [template] -// CHECK:STDOUT: %.3: i32 = int_value 1 [template] -// CHECK:STDOUT: %.4: i32 = int_value -2147483648 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 2147483647 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 2147483647 [template] +// CHECK:STDOUT: %.28: i32 = int_value -2147483647 [template] +// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.30: = bound_method %.29, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 1 [template] +// CHECK:STDOUT: %.32: i32 = int_value -2147483648 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -603,28 +648,43 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Negate.ref.loc8_14: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] // CHECK:STDOUT: %Negate.ref.loc8_21: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc8_28: i32 = int_value 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %int.unegate.loc8_27: init i32 = call %Negate.ref.loc8_21(%.loc8_28) [template = constants.%.2] -// CHECK:STDOUT: %.loc8_27.1: i32 = value_of_initializer %int.unegate.loc8_27 [template = constants.%.2] -// CHECK:STDOUT: %.loc8_27.2: i32 = converted %int.unegate.loc8_27, %.loc8_27.1 [template = constants.%.2] -// CHECK:STDOUT: %int.unegate.loc8_20: init i32 = call %Negate.ref.loc8_14(%.loc8_27.2) [template = constants.%.1] -// CHECK:STDOUT: %.loc8_40.1: i32 = value_of_initializer %int.unegate.loc8_20 [template = constants.%.1] -// CHECK:STDOUT: %.loc8_40.2: i32 = converted %int.unegate.loc8_20, %.loc8_40.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc8_28.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.1] +// CHECK:STDOUT: %.loc8_28.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc8_28.3: = bound_method %.loc8_28.1, %.loc8_28.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc8: init i32 = call %.loc8_28.3(%.loc8_28.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc8_28.4: i32 = value_of_initializer %int.convert_checked.loc8 [template = constants.%.27] +// CHECK:STDOUT: %.loc8_28.5: i32 = converted %.loc8_28.1, %.loc8_28.4 [template = constants.%.27] +// CHECK:STDOUT: %int.unegate.loc8_27: init i32 = call %Negate.ref.loc8_21(%.loc8_28.5) [template = constants.%.28] +// CHECK:STDOUT: %.loc8_27.1: i32 = value_of_initializer %int.unegate.loc8_27 [template = constants.%.28] +// CHECK:STDOUT: %.loc8_27.2: i32 = converted %int.unegate.loc8_27, %.loc8_27.1 [template = constants.%.28] +// CHECK:STDOUT: %int.unegate.loc8_20: init i32 = call %Negate.ref.loc8_14(%.loc8_27.2) [template = constants.%.27] +// CHECK:STDOUT: %.loc8_40.1: i32 = value_of_initializer %int.unegate.loc8_20 [template = constants.%.27] +// CHECK:STDOUT: %.loc8_40.2: i32 = converted %int.unegate.loc8_20, %.loc8_40.1 [template = constants.%.27] // CHECK:STDOUT: %a: i32 = bind_name a, %.loc8_40.2 // CHECK:STDOUT: %Negate.ref.loc11_14: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] // CHECK:STDOUT: %Sub.ref: %Sub.type = name_ref Sub, file.%Sub.decl [template = constants.%Sub] // CHECK:STDOUT: %Negate.ref.loc11_25: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %.loc11_32: i32 = int_value 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %int.unegate.loc11_31: init i32 = call %Negate.ref.loc11_25(%.loc11_32) [template = constants.%.2] -// CHECK:STDOUT: %.loc11_45: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc11_31.1: i32 = value_of_initializer %int.unegate.loc11_31 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_31.2: i32 = converted %int.unegate.loc11_31, %.loc11_31.1 [template = constants.%.2] -// CHECK:STDOUT: %int.usub: init i32 = call %Sub.ref(%.loc11_31.2, %.loc11_45) [template = constants.%.4] -// CHECK:STDOUT: %.loc11_24.1: i32 = value_of_initializer %int.usub [template = constants.%.4] -// CHECK:STDOUT: %.loc11_24.2: i32 = converted %int.usub, %.loc11_24.1 [template = constants.%.4] -// CHECK:STDOUT: %int.unegate.loc11_20: init i32 = call %Negate.ref.loc11_14(%.loc11_24.2) [template = constants.%.4] -// CHECK:STDOUT: %.loc11_48.1: i32 = value_of_initializer %int.unegate.loc11_20 [template = constants.%.4] -// CHECK:STDOUT: %.loc11_48.2: i32 = converted %int.unegate.loc11_20, %.loc11_48.1 [template = constants.%.4] +// CHECK:STDOUT: %.loc11_32.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_32.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_32.3: = bound_method %.loc11_32.1, %.loc11_32.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc11_32: init i32 = call %.loc11_32.3(%.loc11_32.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc11_32.4: i32 = value_of_initializer %int.convert_checked.loc11_32 [template = constants.%.27] +// CHECK:STDOUT: %.loc11_32.5: i32 = converted %.loc11_32.1, %.loc11_32.4 [template = constants.%.27] +// CHECK:STDOUT: %int.unegate.loc11_31: init i32 = call %Negate.ref.loc11_25(%.loc11_32.5) [template = constants.%.28] +// CHECK:STDOUT: %.loc11_45.1: Core.IntLiteral = int_value 1 [template = constants.%.29] +// CHECK:STDOUT: %.loc11_31.1: i32 = value_of_initializer %int.unegate.loc11_31 [template = constants.%.28] +// CHECK:STDOUT: %.loc11_31.2: i32 = converted %int.unegate.loc11_31, %.loc11_31.1 [template = constants.%.28] +// CHECK:STDOUT: %.loc11_45.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_45.3: = bound_method %.loc11_45.1, %.loc11_45.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc11_45: init i32 = call %.loc11_45.3(%.loc11_45.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc11_45.4: i32 = value_of_initializer %int.convert_checked.loc11_45 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_45.5: i32 = converted %.loc11_45.1, %.loc11_45.4 [template = constants.%.31] +// CHECK:STDOUT: %int.usub: init i32 = call %Sub.ref(%.loc11_31.2, %.loc11_45.5) [template = constants.%.32] +// CHECK:STDOUT: %.loc11_24.1: i32 = value_of_initializer %int.usub [template = constants.%.32] +// CHECK:STDOUT: %.loc11_24.2: i32 = converted %int.usub, %.loc11_24.1 [template = constants.%.32] +// CHECK:STDOUT: %int.unegate.loc11_20: init i32 = call %Negate.ref.loc11_14(%.loc11_24.2) [template = constants.%.32] +// CHECK:STDOUT: %.loc11_48.1: i32 = value_of_initializer %int.unegate.loc11_20 [template = constants.%.32] +// CHECK:STDOUT: %.loc11_48.2: i32 = converted %int.unegate.loc11_20, %.loc11_48.1 [template = constants.%.32] // CHECK:STDOUT: %b: i32 = bind_name b, %.loc11_48.2 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/builtins/int/usub.carbon b/toolchain/check/testdata/builtins/int/usub.carbon index e9deadb8fc956..6abef0a0da302 100644 --- a/toolchain/check/testdata/builtins/int/usub.carbon +++ b/toolchain/check/testdata/builtins/int/usub.carbon @@ -36,17 +36,25 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %Sub.type: type = fn_type @Sub [template] // CHECK:STDOUT: %Sub: %Sub.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 3 [template] -// CHECK:STDOUT: %.2: i32 = int_value 2 [template] -// CHECK:STDOUT: %.3: i32 = int_value 1 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(i32) [template] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] // CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template] // CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template] -// CHECK:STDOUT: %.27: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.28: = bound_method %.3, %Convert.15 [template] -// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %.30: type = array_type %.29, i32 [template] -// CHECK:STDOUT: %.31: type = ptr_type %.30 [template] +// CHECK:STDOUT: %.26: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 3 [template] +// CHECK:STDOUT: %.29: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 2 [template] +// CHECK:STDOUT: %.31: i32 = int_value 1 [template] +// CHECK:STDOUT: %Convert.type.16: type = fn_type @Convert.12 [template] +// CHECK:STDOUT: %Convert.16: %Convert.type.16 = struct_value () [template] +// CHECK:STDOUT: %.32: = interface_witness (%Convert.16) [template] +// CHECK:STDOUT: %.33: = bound_method %.31, %Convert.16 [template] +// CHECK:STDOUT: %.34: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.35: type = array_type %.34, i32 [template] +// CHECK:STDOUT: %.36: type = ptr_type %.35 [template] // CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] // CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] // CHECK:STDOUT: } @@ -95,32 +103,37 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDOUT: } // CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %Sub.ref: %Sub.type = name_ref Sub, %Sub.decl [template = constants.%Sub] -// CHECK:STDOUT: %.loc4_20: i32 = int_value 3 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_23: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: %int.usub: init i32 = call %Sub.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] +// CHECK:STDOUT: %.loc4_20.1: Core.IntLiteral = int_value 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc4_23.1: Core.IntLiteral = int_value 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_20.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_20.3: = bound_method %.loc4_20.1, %.loc4_20.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc4_20: init i32 = call %.loc4_20.3(%.loc4_20.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc4_20.4: i32 = value_of_initializer %int.convert_checked.loc4_20 [template = constants.%.28] +// CHECK:STDOUT: %.loc4_20.5: i32 = converted %.loc4_20.1, %.loc4_20.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc4_23.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_23.3: = bound_method %.loc4_23.1, %.loc4_23.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc4_23: init i32 = call %.loc4_23.3(%.loc4_23.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc4_23.4: i32 = value_of_initializer %int.convert_checked.loc4_23 [template = constants.%.30] +// CHECK:STDOUT: %.loc4_23.5: i32 = converted %.loc4_23.1, %.loc4_23.4 [template = constants.%.30] +// CHECK:STDOUT: %int.usub: init i32 = call %Sub.ref(%.loc4_20.5, %.loc4_23.5) [template = constants.%.31] // CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] // CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4, %.loc4_11.1 [template = i32] -// CHECK:STDOUT: %.loc4_19.1: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc4_19.2: = bound_method %int.usub, %.loc4_19.1 [template = constants.%.28] -// CHECK:STDOUT: %.loc4_19.3: i32 = value_of_initializer %int.usub [template = constants.%.3] -// CHECK:STDOUT: %.loc4_19.4: i32 = converted %int.usub, %.loc4_19.3 [template = constants.%.3] -// CHECK:STDOUT: %int.convert_checked.loc4: init Core.IntLiteral = call %.loc4_19.2(%.loc4_19.4) [template = constants.%.29] -// CHECK:STDOUT: %.loc4_19.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4 [template = constants.%.29] -// CHECK:STDOUT: %.loc4_19.6: Core.IntLiteral = converted %int.usub, %.loc4_19.5 [template = constants.%.29] -// CHECK:STDOUT: %.loc4_25: type = array_type %.loc4_19.6, i32 [template = constants.%.30] -// CHECK:STDOUT: %arr.var: ref %.30 = var arr -// CHECK:STDOUT: %arr: ref %.30 = bind_name arr, %arr.var +// CHECK:STDOUT: %.loc4_19.1: %Convert.type.5 = interface_witness_access constants.%.32, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %.loc4_19.2: = bound_method %int.usub, %.loc4_19.1 [template = constants.%.33] +// CHECK:STDOUT: %.loc4_19.3: i32 = value_of_initializer %int.usub [template = constants.%.31] +// CHECK:STDOUT: %.loc4_19.4: i32 = converted %int.usub, %.loc4_19.3 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc4_19: init Core.IntLiteral = call %.loc4_19.2(%.loc4_19.4) [template = constants.%.34] +// CHECK:STDOUT: %.loc4_19.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4_19 [template = constants.%.34] +// CHECK:STDOUT: %.loc4_19.6: Core.IntLiteral = converted %int.usub, %.loc4_19.5 [template = constants.%.34] +// CHECK:STDOUT: %.loc4_25: type = array_type %.loc4_19.6, i32 [template = constants.%.35] +// CHECK:STDOUT: %arr.var: ref %.35 = var arr +// CHECK:STDOUT: %arr: ref %.35 = bind_name arr, %arr.var // CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc5_18.1: i32 = int_value 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc5_18: Core.IntLiteral = int_value 1 [template = constants.%.34] // CHECK:STDOUT: %.loc5_13.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] // CHECK:STDOUT: %.loc5_13.2: type = converted %int.make_type_32.loc5, %.loc5_13.1 [template = i32] -// CHECK:STDOUT: %.loc5_18.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc5_18.3: = bound_method %.loc5_18.1, %.loc5_18.2 [template = constants.%.28] -// CHECK:STDOUT: %int.convert_checked.loc5: init Core.IntLiteral = call %.loc5_18.3(%.loc5_18.1) [template = constants.%.29] -// CHECK:STDOUT: %.loc5_18.4: Core.IntLiteral = value_of_initializer %int.convert_checked.loc5 [template = constants.%.29] -// CHECK:STDOUT: %.loc5_18.5: Core.IntLiteral = converted %.loc5_18.1, %.loc5_18.4 [template = constants.%.29] -// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18.5, i32 [template = constants.%.30] -// CHECK:STDOUT: %.loc5_20: type = ptr_type %.30 [template = constants.%.31] +// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.35] +// CHECK:STDOUT: %.loc5_20: type = ptr_type %.35 [template = constants.%.36] // CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { // CHECK:STDOUT: %a.patt: i32 = binding_pattern a // CHECK:STDOUT: %a.param_patt: i32 = value_param_pattern %a.patt, runtime_param0 @@ -162,9 +175,9 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %.30 = name_ref arr, file.%arr -// CHECK:STDOUT: %.loc5: %.31 = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %.31 = bind_name arr_p, %.loc5 +// CHECK:STDOUT: %arr.ref: ref %.35 = name_ref arr, file.%arr +// CHECK:STDOUT: %.loc5: %.36 = addr_of %arr.ref +// CHECK:STDOUT: %arr_p: %.36 = bind_name arr_p, %.loc5 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -175,17 +188,30 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %Sub.type: type = fn_type @Sub [template] // CHECK:STDOUT: %Sub: %Sub.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] -// CHECK:STDOUT: %.2: i32 = int_value 2147483647 [template] -// CHECK:STDOUT: %.3: i32 = int_value -2147483647 [template] -// CHECK:STDOUT: %.4: i32 = int_value 1 [template] -// CHECK:STDOUT: %.5: i32 = int_value -2147483648 [template] -// CHECK:STDOUT: %.6: i32 = int_value 2 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 2147483647 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 0 [template] +// CHECK:STDOUT: %.29: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 2147483647 [template] +// CHECK:STDOUT: %.31: i32 = int_value -2147483647 [template] +// CHECK:STDOUT: %.32: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.33: = bound_method %.32, %Convert.15 [template] +// CHECK:STDOUT: %.34: i32 = int_value 1 [template] +// CHECK:STDOUT: %.35: i32 = int_value -2147483648 [template] +// CHECK:STDOUT: %.36: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.37: = bound_method %.36, %Convert.15 [template] +// CHECK:STDOUT: %.38: i32 = int_value 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -240,35 +266,75 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Sub.ref.loc6: %Sub.type = name_ref Sub, file.%Sub.decl [template = constants.%Sub] -// CHECK:STDOUT: %.loc6_18: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: %.loc6_21: i32 = int_value 2147483647 [template = constants.%.2] -// CHECK:STDOUT: %int.usub.loc6: init i32 = call %Sub.ref.loc6(%.loc6_18, %.loc6_21) [template = constants.%.3] -// CHECK:STDOUT: %.loc6_32.1: i32 = value_of_initializer %int.usub.loc6 [template = constants.%.3] -// CHECK:STDOUT: %.loc6_32.2: i32 = converted %int.usub.loc6, %.loc6_32.1 [template = constants.%.3] +// CHECK:STDOUT: %.loc6_18.1: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc6_21.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.2] +// CHECK:STDOUT: %.loc6_18.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc6_18.3: = bound_method %.loc6_18.1, %.loc6_18.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc6_18: init i32 = call %.loc6_18.3(%.loc6_18.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc6_18.4: i32 = value_of_initializer %int.convert_checked.loc6_18 [template = constants.%.28] +// CHECK:STDOUT: %.loc6_18.5: i32 = converted %.loc6_18.1, %.loc6_18.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc6_21.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc6_21.3: = bound_method %.loc6_21.1, %.loc6_21.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc6_21: init i32 = call %.loc6_21.3(%.loc6_21.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc6_21.4: i32 = value_of_initializer %int.convert_checked.loc6_21 [template = constants.%.30] +// CHECK:STDOUT: %.loc6_21.5: i32 = converted %.loc6_21.1, %.loc6_21.4 [template = constants.%.30] +// CHECK:STDOUT: %int.usub.loc6: init i32 = call %Sub.ref.loc6(%.loc6_18.5, %.loc6_21.5) [template = constants.%.31] +// CHECK:STDOUT: %.loc6_32.1: i32 = value_of_initializer %int.usub.loc6 [template = constants.%.31] +// CHECK:STDOUT: %.loc6_32.2: i32 = converted %int.usub.loc6, %.loc6_32.1 [template = constants.%.31] // CHECK:STDOUT: %a: i32 = bind_name a, %.loc6_32.2 // CHECK:STDOUT: %Sub.ref.loc7_14: %Sub.type = name_ref Sub, file.%Sub.decl [template = constants.%Sub] // CHECK:STDOUT: %Sub.ref.loc7_18: %Sub.type = name_ref Sub, file.%Sub.decl [template = constants.%Sub] -// CHECK:STDOUT: %.loc7_22: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: %.loc7_25: i32 = int_value 2147483647 [template = constants.%.2] -// CHECK:STDOUT: %int.usub.loc7_21: init i32 = call %Sub.ref.loc7_18(%.loc7_22, %.loc7_25) [template = constants.%.3] -// CHECK:STDOUT: %.loc7_38: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc7_21.1: i32 = value_of_initializer %int.usub.loc7_21 [template = constants.%.3] -// CHECK:STDOUT: %.loc7_21.2: i32 = converted %int.usub.loc7_21, %.loc7_21.1 [template = constants.%.3] -// CHECK:STDOUT: %int.usub.loc7_17: init i32 = call %Sub.ref.loc7_14(%.loc7_21.2, %.loc7_38) [template = constants.%.5] -// CHECK:STDOUT: %.loc7_40.1: i32 = value_of_initializer %int.usub.loc7_17 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_40.2: i32 = converted %int.usub.loc7_17, %.loc7_40.1 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_22.1: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc7_25.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.2] +// CHECK:STDOUT: %.loc7_22.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc7_22.3: = bound_method %.loc7_22.1, %.loc7_22.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc7_22: init i32 = call %.loc7_22.3(%.loc7_22.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc7_22.4: i32 = value_of_initializer %int.convert_checked.loc7_22 [template = constants.%.28] +// CHECK:STDOUT: %.loc7_22.5: i32 = converted %.loc7_22.1, %.loc7_22.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc7_25.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc7_25.3: = bound_method %.loc7_25.1, %.loc7_25.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc7_25: init i32 = call %.loc7_25.3(%.loc7_25.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc7_25.4: i32 = value_of_initializer %int.convert_checked.loc7_25 [template = constants.%.30] +// CHECK:STDOUT: %.loc7_25.5: i32 = converted %.loc7_25.1, %.loc7_25.4 [template = constants.%.30] +// CHECK:STDOUT: %int.usub.loc7_21: init i32 = call %Sub.ref.loc7_18(%.loc7_22.5, %.loc7_25.5) [template = constants.%.31] +// CHECK:STDOUT: %.loc7_38.1: Core.IntLiteral = int_value 1 [template = constants.%.32] +// CHECK:STDOUT: %.loc7_21.1: i32 = value_of_initializer %int.usub.loc7_21 [template = constants.%.31] +// CHECK:STDOUT: %.loc7_21.2: i32 = converted %int.usub.loc7_21, %.loc7_21.1 [template = constants.%.31] +// CHECK:STDOUT: %.loc7_38.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc7_38.3: = bound_method %.loc7_38.1, %.loc7_38.2 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc7_38: init i32 = call %.loc7_38.3(%.loc7_38.1) [template = constants.%.34] +// CHECK:STDOUT: %.loc7_38.4: i32 = value_of_initializer %int.convert_checked.loc7_38 [template = constants.%.34] +// CHECK:STDOUT: %.loc7_38.5: i32 = converted %.loc7_38.1, %.loc7_38.4 [template = constants.%.34] +// CHECK:STDOUT: %int.usub.loc7_17: init i32 = call %Sub.ref.loc7_14(%.loc7_21.2, %.loc7_38.5) [template = constants.%.35] +// CHECK:STDOUT: %.loc7_40.1: i32 = value_of_initializer %int.usub.loc7_17 [template = constants.%.35] +// CHECK:STDOUT: %.loc7_40.2: i32 = converted %int.usub.loc7_17, %.loc7_40.1 [template = constants.%.35] // CHECK:STDOUT: %b: i32 = bind_name b, %.loc7_40.2 // CHECK:STDOUT: %Sub.ref.loc8_14: %Sub.type = name_ref Sub, file.%Sub.decl [template = constants.%Sub] // CHECK:STDOUT: %Sub.ref.loc8_18: %Sub.type = name_ref Sub, file.%Sub.decl [template = constants.%Sub] -// CHECK:STDOUT: %.loc8_22: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: %.loc8_25: i32 = int_value 2147483647 [template = constants.%.2] -// CHECK:STDOUT: %int.usub.loc8_21: init i32 = call %Sub.ref.loc8_18(%.loc8_22, %.loc8_25) [template = constants.%.3] -// CHECK:STDOUT: %.loc8_38: i32 = int_value 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc8_21.1: i32 = value_of_initializer %int.usub.loc8_21 [template = constants.%.3] -// CHECK:STDOUT: %.loc8_21.2: i32 = converted %int.usub.loc8_21, %.loc8_21.1 [template = constants.%.3] -// CHECK:STDOUT: %int.usub.loc8_17: init i32 = call %Sub.ref.loc8_14(%.loc8_21.2, %.loc8_38) [template = constants.%.2] -// CHECK:STDOUT: %.loc8_40.1: i32 = value_of_initializer %int.usub.loc8_17 [template = constants.%.2] -// CHECK:STDOUT: %.loc8_40.2: i32 = converted %int.usub.loc8_17, %.loc8_40.1 [template = constants.%.2] +// CHECK:STDOUT: %.loc8_22.1: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc8_25.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.2] +// CHECK:STDOUT: %.loc8_22.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc8_22.3: = bound_method %.loc8_22.1, %.loc8_22.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc8_22: init i32 = call %.loc8_22.3(%.loc8_22.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc8_22.4: i32 = value_of_initializer %int.convert_checked.loc8_22 [template = constants.%.28] +// CHECK:STDOUT: %.loc8_22.5: i32 = converted %.loc8_22.1, %.loc8_22.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc8_25.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc8_25.3: = bound_method %.loc8_25.1, %.loc8_25.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc8_25: init i32 = call %.loc8_25.3(%.loc8_25.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc8_25.4: i32 = value_of_initializer %int.convert_checked.loc8_25 [template = constants.%.30] +// CHECK:STDOUT: %.loc8_25.5: i32 = converted %.loc8_25.1, %.loc8_25.4 [template = constants.%.30] +// CHECK:STDOUT: %int.usub.loc8_21: init i32 = call %Sub.ref.loc8_18(%.loc8_22.5, %.loc8_25.5) [template = constants.%.31] +// CHECK:STDOUT: %.loc8_38.1: Core.IntLiteral = int_value 2 [template = constants.%.36] +// CHECK:STDOUT: %.loc8_21.1: i32 = value_of_initializer %int.usub.loc8_21 [template = constants.%.31] +// CHECK:STDOUT: %.loc8_21.2: i32 = converted %int.usub.loc8_21, %.loc8_21.1 [template = constants.%.31] +// CHECK:STDOUT: %.loc8_38.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc8_38.3: = bound_method %.loc8_38.1, %.loc8_38.2 [template = constants.%.37] +// CHECK:STDOUT: %int.convert_checked.loc8_38: init i32 = call %.loc8_38.3(%.loc8_38.1) [template = constants.%.38] +// CHECK:STDOUT: %.loc8_38.4: i32 = value_of_initializer %int.convert_checked.loc8_38 [template = constants.%.38] +// CHECK:STDOUT: %.loc8_38.5: i32 = converted %.loc8_38.1, %.loc8_38.4 [template = constants.%.38] +// CHECK:STDOUT: %int.usub.loc8_17: init i32 = call %Sub.ref.loc8_14(%.loc8_21.2, %.loc8_38.5) [template = constants.%.30] +// CHECK:STDOUT: %.loc8_40.1: i32 = value_of_initializer %int.usub.loc8_17 [template = constants.%.30] +// CHECK:STDOUT: %.loc8_40.2: i32 = converted %int.usub.loc8_17, %.loc8_40.1 [template = constants.%.30] // CHECK:STDOUT: %c: i32 = bind_name c, %.loc8_40.2 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/builtins/int/xor.carbon b/toolchain/check/testdata/builtins/int/xor.carbon index b0f35417098be..0803ec32e40e8 100644 --- a/toolchain/check/testdata/builtins/int/xor.carbon +++ b/toolchain/check/testdata/builtins/int/xor.carbon @@ -26,17 +26,25 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %Xor.type: type = fn_type @Xor [template] // CHECK:STDOUT: %Xor: %Xor.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 12 [template] -// CHECK:STDOUT: %.2: i32 = int_value 10 [template] -// CHECK:STDOUT: %.3: i32 = int_value 6 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 12 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 10 [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(i32) [template] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] // CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template] // CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template] -// CHECK:STDOUT: %.27: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.28: = bound_method %.3, %Convert.15 [template] -// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 6 [template] -// CHECK:STDOUT: %.30: type = array_type %.29, i32 [template] -// CHECK:STDOUT: %.31: type = ptr_type %.30 [template] +// CHECK:STDOUT: %.26: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 12 [template] +// CHECK:STDOUT: %.29: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 10 [template] +// CHECK:STDOUT: %.31: i32 = int_value 6 [template] +// CHECK:STDOUT: %Convert.type.16: type = fn_type @Convert.12 [template] +// CHECK:STDOUT: %Convert.16: %Convert.type.16 = struct_value () [template] +// CHECK:STDOUT: %.32: = interface_witness (%Convert.16) [template] +// CHECK:STDOUT: %.33: = bound_method %.31, %Convert.16 [template] +// CHECK:STDOUT: %.34: Core.IntLiteral = int_value 6 [template] +// CHECK:STDOUT: %.35: type = array_type %.34, i32 [template] +// CHECK:STDOUT: %.36: type = ptr_type %.35 [template] // CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] // CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] // CHECK:STDOUT: } @@ -85,32 +93,37 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %Xor.ref: %Xor.type = name_ref Xor, %Xor.decl [template = constants.%Xor] -// CHECK:STDOUT: %.loc4_20: i32 = int_value 12 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_24: i32 = int_value 10 [template = constants.%.2] -// CHECK:STDOUT: %int.xor: init i32 = call %Xor.ref(%.loc4_20, %.loc4_24) [template = constants.%.3] +// CHECK:STDOUT: %.loc4_20.1: Core.IntLiteral = int_value 12 [template = constants.%.1] +// CHECK:STDOUT: %.loc4_24.1: Core.IntLiteral = int_value 10 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_20.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_20.3: = bound_method %.loc4_20.1, %.loc4_20.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc4_20: init i32 = call %.loc4_20.3(%.loc4_20.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc4_20.4: i32 = value_of_initializer %int.convert_checked.loc4_20 [template = constants.%.28] +// CHECK:STDOUT: %.loc4_20.5: i32 = converted %.loc4_20.1, %.loc4_20.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc4_24.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_24.3: = bound_method %.loc4_24.1, %.loc4_24.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc4_24: init i32 = call %.loc4_24.3(%.loc4_24.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc4_24.4: i32 = value_of_initializer %int.convert_checked.loc4_24 [template = constants.%.30] +// CHECK:STDOUT: %.loc4_24.5: i32 = converted %.loc4_24.1, %.loc4_24.4 [template = constants.%.30] +// CHECK:STDOUT: %int.xor: init i32 = call %Xor.ref(%.loc4_20.5, %.loc4_24.5) [template = constants.%.31] // CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] // CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4, %.loc4_11.1 [template = i32] -// CHECK:STDOUT: %.loc4_19.1: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc4_19.2: = bound_method %int.xor, %.loc4_19.1 [template = constants.%.28] -// CHECK:STDOUT: %.loc4_19.3: i32 = value_of_initializer %int.xor [template = constants.%.3] -// CHECK:STDOUT: %.loc4_19.4: i32 = converted %int.xor, %.loc4_19.3 [template = constants.%.3] -// CHECK:STDOUT: %int.convert_checked.loc4: init Core.IntLiteral = call %.loc4_19.2(%.loc4_19.4) [template = constants.%.29] -// CHECK:STDOUT: %.loc4_19.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4 [template = constants.%.29] -// CHECK:STDOUT: %.loc4_19.6: Core.IntLiteral = converted %int.xor, %.loc4_19.5 [template = constants.%.29] -// CHECK:STDOUT: %.loc4_27: type = array_type %.loc4_19.6, i32 [template = constants.%.30] -// CHECK:STDOUT: %arr.var: ref %.30 = var arr -// CHECK:STDOUT: %arr: ref %.30 = bind_name arr, %arr.var +// CHECK:STDOUT: %.loc4_19.1: %Convert.type.5 = interface_witness_access constants.%.32, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %.loc4_19.2: = bound_method %int.xor, %.loc4_19.1 [template = constants.%.33] +// CHECK:STDOUT: %.loc4_19.3: i32 = value_of_initializer %int.xor [template = constants.%.31] +// CHECK:STDOUT: %.loc4_19.4: i32 = converted %int.xor, %.loc4_19.3 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc4_19: init Core.IntLiteral = call %.loc4_19.2(%.loc4_19.4) [template = constants.%.34] +// CHECK:STDOUT: %.loc4_19.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4_19 [template = constants.%.34] +// CHECK:STDOUT: %.loc4_19.6: Core.IntLiteral = converted %int.xor, %.loc4_19.5 [template = constants.%.34] +// CHECK:STDOUT: %.loc4_27: type = array_type %.loc4_19.6, i32 [template = constants.%.35] +// CHECK:STDOUT: %arr.var: ref %.35 = var arr +// CHECK:STDOUT: %arr: ref %.35 = bind_name arr, %arr.var // CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc5_18.1: i32 = int_value 6 [template = constants.%.3] +// CHECK:STDOUT: %.loc5_18: Core.IntLiteral = int_value 6 [template = constants.%.34] // CHECK:STDOUT: %.loc5_13.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] // CHECK:STDOUT: %.loc5_13.2: type = converted %int.make_type_32.loc5, %.loc5_13.1 [template = i32] -// CHECK:STDOUT: %.loc5_18.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc5_18.3: = bound_method %.loc5_18.1, %.loc5_18.2 [template = constants.%.28] -// CHECK:STDOUT: %int.convert_checked.loc5: init Core.IntLiteral = call %.loc5_18.3(%.loc5_18.1) [template = constants.%.29] -// CHECK:STDOUT: %.loc5_18.4: Core.IntLiteral = value_of_initializer %int.convert_checked.loc5 [template = constants.%.29] -// CHECK:STDOUT: %.loc5_18.5: Core.IntLiteral = converted %.loc5_18.1, %.loc5_18.4 [template = constants.%.29] -// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18.5, i32 [template = constants.%.30] -// CHECK:STDOUT: %.loc5_20: type = ptr_type %.30 [template = constants.%.31] +// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.35] +// CHECK:STDOUT: %.loc5_20: type = ptr_type %.35 [template = constants.%.36] // CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { // CHECK:STDOUT: %a.patt: i32 = binding_pattern a // CHECK:STDOUT: %a.param_patt: i32 = value_param_pattern %a.patt, runtime_param0 @@ -152,9 +165,9 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %.30 = name_ref arr, file.%arr -// CHECK:STDOUT: %.loc5: %.31 = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %.31 = bind_name arr_p, %.loc5 +// CHECK:STDOUT: %arr.ref: ref %.35 = name_ref arr, file.%arr +// CHECK:STDOUT: %.loc5: %.36 = addr_of %arr.ref +// CHECK:STDOUT: %arr_p: %.36 = bind_name arr_p, %.loc5 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/print.carbon b/toolchain/check/testdata/builtins/print.carbon index 618d3535ebe69..0592defe4f3a2 100644 --- a/toolchain/check/testdata/builtins/print.carbon +++ b/toolchain/check/testdata/builtins/print.carbon @@ -26,20 +26,29 @@ fn Main() { // CHECK:STDOUT: %Print.1: %Print.type.1 = struct_value () [template] // CHECK:STDOUT: %Main.type: type = fn_type @Main [template] // CHECK:STDOUT: %Main: %Main.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 1 [template] // CHECK:STDOUT: %Print.type.2: type = fn_type @Print.2 [template] // CHECK:STDOUT: %Print.2: %Print.type.2 = struct_value () [template] -// CHECK:STDOUT: %.2: i32 = int_value 2 [template] +// CHECK:STDOUT: %.28: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.29: = bound_method %.28, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int32 = %import_ref.1 -// CHECK:STDOUT: .Print = %import_ref.2 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 +// CHECK:STDOUT: .Print = %import_ref.51 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.2: %Print.type.2 = import_ref Core//prelude, inst+51, loaded [template = constants.%Print.2] +// CHECK:STDOUT: %import_ref.51: %Print.type.2 = import_ref Core//prelude, inst+51, loaded [template = constants.%Print.2] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -67,12 +76,22 @@ fn Main() { // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Print.ref.loc14: %Print.type.1 = name_ref Print, file.%Print.decl [template = constants.%Print.1] -// CHECK:STDOUT: %.loc14: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %print.int.loc14: init %empty_tuple.type = call %Print.ref.loc14(%.loc14) +// CHECK:STDOUT: %.loc14_9.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc14_9.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc14_9.3: = bound_method %.loc14_9.1, %.loc14_9.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc14: init i32 = call %.loc14_9.3(%.loc14_9.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc14_9.4: i32 = value_of_initializer %int.convert_checked.loc14 [template = constants.%.27] +// CHECK:STDOUT: %.loc14_9.5: i32 = converted %.loc14_9.1, %.loc14_9.4 [template = constants.%.27] +// CHECK:STDOUT: %print.int.loc14: init %empty_tuple.type = call %Print.ref.loc14(%.loc14_9.5) // CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] -// CHECK:STDOUT: %Print.ref.loc16: %Print.type.2 = name_ref Print, imports.%import_ref.2 [template = constants.%Print.2] -// CHECK:STDOUT: %.loc16: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: %print.int.loc16: init %empty_tuple.type = call %Print.ref.loc16(%.loc16) +// CHECK:STDOUT: %Print.ref.loc16: %Print.type.2 = name_ref Print, imports.%import_ref.51 [template = constants.%Print.2] +// CHECK:STDOUT: %.loc16_14.1: Core.IntLiteral = int_value 2 [template = constants.%.28] +// CHECK:STDOUT: %.loc16_14.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc16_14.3: = bound_method %.loc16_14.1, %.loc16_14.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc16: init i32 = call %.loc16_14.3(%.loc16_14.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc16_14.4: i32 = value_of_initializer %int.convert_checked.loc16 [template = constants.%.30] +// CHECK:STDOUT: %.loc16_14.5: i32 = converted %.loc16_14.1, %.loc16_14.4 [template = constants.%.30] +// CHECK:STDOUT: %print.int.loc16: init %empty_tuple.type = call %Print.ref.loc16(%.loc16_14.5) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/access_modifers.carbon b/toolchain/check/testdata/class/access_modifers.carbon index 39da2af1f78bf..e86a1443dd29a 100644 --- a/toolchain/check/testdata/class/access_modifers.carbon +++ b/toolchain/check/testdata/class/access_modifers.carbon @@ -152,22 +152,32 @@ class A { // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %.1: type = unbound_element_type %Circle, i32 [template] -// CHECK:STDOUT: %.2: i32 = int_value 5 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 5 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 5 [template] // CHECK:STDOUT: %SomeInternalFunction.type: type = fn_type @SomeInternalFunction [template] // CHECK:STDOUT: %SomeInternalFunction: %SomeInternalFunction.type = struct_value () [template] // CHECK:STDOUT: %Make.type: type = fn_type @Make [template] // CHECK:STDOUT: %Make: %Make.type = struct_value () [template] -// CHECK:STDOUT: %.3: type = struct_type {.radius: i32} [template] -// CHECK:STDOUT: %.4: = complete_type_witness %.3 [template] -// CHECK:STDOUT: %.5: i32 = int_value 0 [template] -// CHECK:STDOUT: %struct: %Circle = struct_value (%.2) [template] +// CHECK:STDOUT: %.29: type = struct_type {.radius: i32} [template] +// CHECK:STDOUT: %.30: = complete_type_witness %.29 [template] +// CHECK:STDOUT: %.31: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %.32: = bound_method %.31, %Convert.15 [template] +// CHECK:STDOUT: %.33: i32 = int_value 0 [template] +// CHECK:STDOUT: %.35: type = struct_type {.radius: Core.IntLiteral} [template] +// CHECK:STDOUT: %struct: %Circle = struct_value (%.28) [template] // CHECK:STDOUT: %Run.type: type = fn_type @Run [template] // CHECK:STDOUT: %Run: %Run.type = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -192,8 +202,13 @@ class A { // CHECK:STDOUT: %int.make_type_32.loc6: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc6_39.1: type = value_of_initializer %int.make_type_32.loc6 [template = i32] // CHECK:STDOUT: %.loc6_39.2: type = converted %int.make_type_32.loc6, %.loc6_39.1 [template = i32] -// CHECK:STDOUT: %.loc6_45: i32 = int_value 5 [template = constants.%.2] -// CHECK:STDOUT: %SOME_INTERNAL_CONSTANT: i32 = bind_name SOME_INTERNAL_CONSTANT, %.loc6_45 +// CHECK:STDOUT: %.loc6_45: Core.IntLiteral = int_value 5 [template = constants.%.2] +// CHECK:STDOUT: %.loc6_46.1: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc6_46.2: = bound_method %.loc6_45, %.loc6_46.1 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc6_46.2(%.loc6_45) [template = constants.%.28] +// CHECK:STDOUT: %.loc6_46.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.28] +// CHECK:STDOUT: %.loc6_46.4: i32 = converted %.loc6_45, %.loc6_46.3 [template = constants.%.28] +// CHECK:STDOUT: %SOME_INTERNAL_CONSTANT: i32 = bind_name SOME_INTERNAL_CONSTANT, %.loc6_46.4 // CHECK:STDOUT: %SomeInternalFunction.decl: %SomeInternalFunction.type = fn_decl @SomeInternalFunction [template = constants.%SomeInternalFunction] { // CHECK:STDOUT: %return.patt: i32 = return_slot_pattern // CHECK:STDOUT: %return.param_patt: i32 = out_param_pattern %return.patt, runtime_param0 @@ -212,7 +227,7 @@ class A { // CHECK:STDOUT: %return.param: ref %Circle = out_param runtime_param0 // CHECK:STDOUT: %return: ref %Circle = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc15: = complete_type_witness %.3 [template = constants.%.4] +// CHECK:STDOUT: %.loc15: = complete_type_witness %.29 [template = constants.%.30] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Circle @@ -224,18 +239,27 @@ class A { // CHECK:STDOUT: // CHECK:STDOUT: fn @SomeInternalFunction() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc9: i32 = int_value 0 [template = constants.%.5] -// CHECK:STDOUT: return %.loc9 +// CHECK:STDOUT: %.loc9_12: Core.IntLiteral = int_value 0 [template = constants.%.31] +// CHECK:STDOUT: %.loc9_13.1: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_13.2: = bound_method %.loc9_12, %.loc9_13.1 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc9_13.2(%.loc9_12) [template = constants.%.33] +// CHECK:STDOUT: %.loc9_13.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.33] +// CHECK:STDOUT: %.loc9_13.4: i32 = converted %.loc9_12, %.loc9_13.3 [template = constants.%.33] +// CHECK:STDOUT: return %.loc9_13.4 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Make() -> %return: %Circle { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc13_23: i32 = int_value 5 [template = constants.%.2] -// CHECK:STDOUT: %.loc13_24.1: %.3 = struct_literal (%.loc13_23) -// CHECK:STDOUT: %.loc13_24.2: ref i32 = class_element_access %return, element0 -// CHECK:STDOUT: %.loc13_24.3: init i32 = initialize_from %.loc13_23 to %.loc13_24.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc13_24.4: init %Circle = class_init (%.loc13_24.3), %return [template = constants.%struct] -// CHECK:STDOUT: %.loc13_25: init %Circle = converted %.loc13_24.1, %.loc13_24.4 [template = constants.%struct] +// CHECK:STDOUT: %.loc13_23: Core.IntLiteral = int_value 5 [template = constants.%.2] +// CHECK:STDOUT: %.loc13_24.1: %.35 = struct_literal (%.loc13_23) +// CHECK:STDOUT: %.loc13_24.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_24.3: = bound_method %.loc13_23, %.loc13_24.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc13_24.3(%.loc13_23) [template = constants.%.28] +// CHECK:STDOUT: %.loc13_24.4: init i32 = converted %.loc13_23, %int.convert_checked [template = constants.%.28] +// CHECK:STDOUT: %.loc13_24.5: ref i32 = class_element_access %return, element0 +// CHECK:STDOUT: %.loc13_24.6: init i32 = initialize_from %.loc13_24.4 to %.loc13_24.5 [template = constants.%.28] +// CHECK:STDOUT: %.loc13_24.7: init %Circle = class_init (%.loc13_24.6), %return [template = constants.%struct] +// CHECK:STDOUT: %.loc13_25: init %Circle = converted %.loc13_24.1, %.loc13_24.7 [template = constants.%struct] // CHECK:STDOUT: return %.loc13_25 to %return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -257,7 +281,7 @@ class A { // CHECK:STDOUT: %radius: i32 = bind_name radius, // CHECK:STDOUT: %circle.ref.loc34: %Circle = name_ref circle, %circle // CHECK:STDOUT: %radius.ref.loc34: = name_ref radius, [template = ] -// CHECK:STDOUT: %.loc34: i32 = int_value 5 [template = constants.%.2] +// CHECK:STDOUT: %.loc34: Core.IntLiteral = int_value 5 [template = constants.%.2] // CHECK:STDOUT: assign %radius.ref.loc34, // CHECK:STDOUT: %circle.ref.loc42: %Circle = name_ref circle, %circle // CHECK:STDOUT: %SOME_INTERNAL_CONSTANT.ref: = name_ref SOME_INTERNAL_CONSTANT, [template = ] @@ -336,12 +360,19 @@ class A { // CHECK:STDOUT: %Compute: %Compute.type = struct_value () [template] // CHECK:STDOUT: %.2: type = struct_type {.radius: i32} [template] // CHECK:STDOUT: %.3: = complete_type_witness %.2 [template] -// CHECK:STDOUT: %.5: i32 = int_value 0 [template] +// CHECK:STDOUT: %.5: Core.IntLiteral = int_value 0 [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: %.29: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.30: = bound_method %.5, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -422,8 +453,13 @@ class A { // CHECK:STDOUT: // CHECK:STDOUT: fn @SomeInternalFunction() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc12: i32 = int_value 0 [template = constants.%.5] -// CHECK:STDOUT: return %.loc12 +// CHECK:STDOUT: %.loc12_12: Core.IntLiteral = int_value 0 [template = constants.%.5] +// CHECK:STDOUT: %.loc12_13.1: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_13.2: = bound_method %.loc12_12, %.loc12_13.1 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc12_13.2(%.loc12_12) [template = constants.%.31] +// CHECK:STDOUT: %.loc12_13.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.31] +// CHECK:STDOUT: %.loc12_13.4: i32 = converted %.loc12_12, %.loc12_13.3 [template = constants.%.31] +// CHECK:STDOUT: return %.loc12_13.4 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Compute[%self.param_patt: %Circle]() -> i32 { @@ -442,14 +478,21 @@ class A { // CHECK:STDOUT: %A: type = class_type @A [template] // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 5 [template] -// CHECK:STDOUT: %.2: type = struct_type {} [template] -// CHECK:STDOUT: %.3: = complete_type_witness %.2 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 5 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 5 [template] +// CHECK:STDOUT: %.28: type = struct_type {} [template] +// CHECK:STDOUT: %.29: = complete_type_witness %.28 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -472,9 +515,14 @@ class A { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc5_10.1: type = value_of_initializer %int.make_type_32 [template = i32] // CHECK:STDOUT: %.loc5_10.2: type = converted %int.make_type_32, %.loc5_10.1 [template = i32] -// CHECK:STDOUT: %.loc5_16: i32 = int_value 5 [template = constants.%.1] -// CHECK:STDOUT: %x: i32 = bind_name x, %.loc5_16 -// CHECK:STDOUT: %.loc6: = complete_type_witness %.2 [template = constants.%.3] +// CHECK:STDOUT: %.loc5_16: Core.IntLiteral = int_value 5 [template = constants.%.1] +// CHECK:STDOUT: %.loc5_17.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc5_17.2: = bound_method %.loc5_16, %.loc5_17.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc5_17.2(%.loc5_16) [template = constants.%.27] +// CHECK:STDOUT: %.loc5_17.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc5_17.4: i32 = converted %.loc5_16, %.loc5_17.3 [template = constants.%.27] +// CHECK:STDOUT: %x: i32 = bind_name x, %.loc5_17.4 +// CHECK:STDOUT: %.loc6: = complete_type_witness %.28 [template = constants.%.29] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%A @@ -495,14 +543,21 @@ class A { // CHECK:STDOUT: %A: type = class_type @A [template] // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 5 [template] -// CHECK:STDOUT: %.2: type = struct_type {} [template] -// CHECK:STDOUT: %.3: = complete_type_witness %.2 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 5 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 5 [template] +// CHECK:STDOUT: %.28: type = struct_type {} [template] +// CHECK:STDOUT: %.29: = complete_type_witness %.28 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -529,14 +584,24 @@ class A { // CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc5_20.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] // CHECK:STDOUT: %.loc5_20.2: type = converted %int.make_type_32.loc5, %.loc5_20.1 [template = i32] -// CHECK:STDOUT: %.loc5_26: i32 = int_value 5 [template = constants.%.1] -// CHECK:STDOUT: %x: i32 = bind_name x, %.loc5_26 +// CHECK:STDOUT: %.loc5_26: Core.IntLiteral = int_value 5 [template = constants.%.1] +// CHECK:STDOUT: %.loc5_27.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc5_27.2: = bound_method %.loc5_26, %.loc5_27.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc5: init i32 = call %.loc5_27.2(%.loc5_26) [template = constants.%.27] +// CHECK:STDOUT: %.loc5_27.3: i32 = value_of_initializer %int.convert_checked.loc5 [template = constants.%.27] +// CHECK:STDOUT: %.loc5_27.4: i32 = converted %.loc5_26, %.loc5_27.3 [template = constants.%.27] +// CHECK:STDOUT: %x: i32 = bind_name x, %.loc5_27.4 // CHECK:STDOUT: %int.make_type_32.loc6: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc6_18.1: type = value_of_initializer %int.make_type_32.loc6 [template = i32] // CHECK:STDOUT: %.loc6_18.2: type = converted %int.make_type_32.loc6, %.loc6_18.1 [template = i32] -// CHECK:STDOUT: %.loc6_24: i32 = int_value 5 [template = constants.%.1] -// CHECK:STDOUT: %y: i32 = bind_name y, %.loc6_24 -// CHECK:STDOUT: %.loc7: = complete_type_witness %.2 [template = constants.%.3] +// CHECK:STDOUT: %.loc6_24: Core.IntLiteral = int_value 5 [template = constants.%.1] +// CHECK:STDOUT: %.loc6_25.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc6_25.2: = bound_method %.loc6_24, %.loc6_25.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc6: init i32 = call %.loc6_25.2(%.loc6_24) [template = constants.%.27] +// CHECK:STDOUT: %.loc6_25.3: i32 = value_of_initializer %int.convert_checked.loc6 [template = constants.%.27] +// CHECK:STDOUT: %.loc6_25.4: i32 = converted %.loc6_24, %.loc6_25.3 [template = constants.%.27] +// CHECK:STDOUT: %y: i32 = bind_name y, %.loc6_25.4 +// CHECK:STDOUT: %.loc7: = complete_type_witness %.28 [template = constants.%.29] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%A diff --git a/toolchain/check/testdata/class/base.carbon b/toolchain/check/testdata/class/base.carbon index f7daac17665a5..2f55f2021c77c 100644 --- a/toolchain/check/testdata/class/base.carbon +++ b/toolchain/check/testdata/class/base.carbon @@ -42,11 +42,20 @@ fn Access(d: Derived) -> (i32, i32) { // CHECK:STDOUT: %.8: = complete_type_witness %.7 [template] // CHECK:STDOUT: %Make.type: type = fn_type @Make [template] // CHECK:STDOUT: %Make: %Make.type = struct_value () [template] -// CHECK:STDOUT: %.12: i32 = int_value 4 [template] -// CHECK:STDOUT: %.13: i32 = int_value 7 [template] -// CHECK:STDOUT: %.14: type = struct_type {.base: %.2, .d: i32} [template] -// CHECK:STDOUT: %struct.1: %Base = struct_value (%.12) [template] -// CHECK:STDOUT: %struct.2: %Derived = struct_value (%struct.1, %.13) [template] +// CHECK:STDOUT: %.12: Core.IntLiteral = int_value 4 [template] +// CHECK:STDOUT: %.13: type = struct_type {.b: Core.IntLiteral} [template] +// CHECK:STDOUT: %.14: Core.IntLiteral = int_value 7 [template] +// CHECK:STDOUT: %.15: type = struct_type {.base: %.13, .d: Core.IntLiteral} [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: %.39: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.40: = bound_method %.12, %Convert.15 [template] +// CHECK:STDOUT: %.41: i32 = int_value 4 [template] +// CHECK:STDOUT: %struct.1: %Base = struct_value (%.41) [template] +// CHECK:STDOUT: %.42: = bound_method %.14, %Convert.15 [template] +// CHECK:STDOUT: %.43: i32 = int_value 7 [template] +// CHECK:STDOUT: %struct.2: %Derived = struct_value (%struct.1, %.43) [template] // CHECK:STDOUT: %tuple.type.1: type = tuple_type (type, type) [template] // CHECK:STDOUT: %tuple.type.2: type = tuple_type (i32, i32) [template] // CHECK:STDOUT: %Access.type: type = fn_type @Access [template] @@ -55,7 +64,8 @@ fn Access(d: Derived) -> (i32, i32) { // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -132,19 +142,27 @@ fn Access(d: Derived) -> (i32, i32) { // CHECK:STDOUT: // CHECK:STDOUT: fn @Make() -> %return: %Derived { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc22_25: i32 = int_value 4 [template = constants.%.12] -// CHECK:STDOUT: %.loc22_26.1: %.2 = struct_literal (%.loc22_25) -// CHECK:STDOUT: %.loc22_34: i32 = int_value 7 [template = constants.%.13] -// CHECK:STDOUT: %.loc22_35.1: %.14 = struct_literal (%.loc22_26.1, %.loc22_34) +// CHECK:STDOUT: %.loc22_25: Core.IntLiteral = int_value 4 [template = constants.%.12] +// CHECK:STDOUT: %.loc22_26.1: %.13 = struct_literal (%.loc22_25) +// CHECK:STDOUT: %.loc22_34: Core.IntLiteral = int_value 7 [template = constants.%.14] +// CHECK:STDOUT: %.loc22_35.1: %.15 = struct_literal (%.loc22_26.1, %.loc22_34) +// CHECK:STDOUT: %.loc22_26.2: %Convert.type.2 = interface_witness_access constants.%.39, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc22_26.3: = bound_method %.loc22_25, %.loc22_26.2 [template = constants.%.40] +// CHECK:STDOUT: %int.convert_checked.loc22_26: init i32 = call %.loc22_26.3(%.loc22_25) [template = constants.%.41] +// CHECK:STDOUT: %.loc22_26.4: init i32 = converted %.loc22_25, %int.convert_checked.loc22_26 [template = constants.%.41] // CHECK:STDOUT: %.loc22_35.2: ref %Base = class_element_access %return, element0 -// CHECK:STDOUT: %.loc22_26.2: ref i32 = class_element_access %.loc22_35.2, element0 -// CHECK:STDOUT: %.loc22_26.3: init i32 = initialize_from %.loc22_25 to %.loc22_26.2 [template = constants.%.12] -// CHECK:STDOUT: %.loc22_26.4: init %Base = class_init (%.loc22_26.3), %.loc22_35.2 [template = constants.%struct.1] -// CHECK:STDOUT: %.loc22_35.3: init %Base = converted %.loc22_26.1, %.loc22_26.4 [template = constants.%struct.1] -// CHECK:STDOUT: %.loc22_35.4: ref i32 = class_element_access %return, element1 -// CHECK:STDOUT: %.loc22_35.5: init i32 = initialize_from %.loc22_34 to %.loc22_35.4 [template = constants.%.13] -// CHECK:STDOUT: %.loc22_35.6: init %Derived = class_init (%.loc22_35.3, %.loc22_35.5), %return [template = constants.%struct.2] -// CHECK:STDOUT: %.loc22_36: init %Derived = converted %.loc22_35.1, %.loc22_35.6 [template = constants.%struct.2] +// CHECK:STDOUT: %.loc22_26.5: ref i32 = class_element_access %.loc22_35.2, element0 +// CHECK:STDOUT: %.loc22_26.6: init i32 = initialize_from %.loc22_26.4 to %.loc22_26.5 [template = constants.%.41] +// CHECK:STDOUT: %.loc22_26.7: init %Base = class_init (%.loc22_26.6), %.loc22_35.2 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc22_35.3: init %Base = converted %.loc22_26.1, %.loc22_26.7 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc22_35.4: %Convert.type.2 = interface_witness_access constants.%.39, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc22_35.5: = bound_method %.loc22_34, %.loc22_35.4 [template = constants.%.42] +// CHECK:STDOUT: %int.convert_checked.loc22_35: init i32 = call %.loc22_35.5(%.loc22_34) [template = constants.%.43] +// CHECK:STDOUT: %.loc22_35.6: init i32 = converted %.loc22_34, %int.convert_checked.loc22_35 [template = constants.%.43] +// CHECK:STDOUT: %.loc22_35.7: ref i32 = class_element_access %return, element1 +// CHECK:STDOUT: %.loc22_35.8: init i32 = initialize_from %.loc22_35.6 to %.loc22_35.7 [template = constants.%.43] +// CHECK:STDOUT: %.loc22_35.9: init %Derived = class_init (%.loc22_35.3, %.loc22_35.8), %return [template = constants.%struct.2] +// CHECK:STDOUT: %.loc22_36: init %Derived = converted %.loc22_35.1, %.loc22_35.9 [template = constants.%struct.2] // CHECK:STDOUT: return %.loc22_36 to %return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/base_method.carbon b/toolchain/check/testdata/class/base_method.carbon index 319c039b31152..56a568d336072 100644 --- a/toolchain/check/testdata/class/base_method.carbon +++ b/toolchain/check/testdata/class/base_method.carbon @@ -39,19 +39,26 @@ fn Call(p: Derived*) { // CHECK:STDOUT: %F: %F.type = struct_value () [template] // CHECK:STDOUT: %.3: type = struct_type {.a: i32} [template] // CHECK:STDOUT: %.4: = complete_type_witness %.3 [template] -// CHECK:STDOUT: %.6: i32 = int_value 1 [template] +// CHECK:STDOUT: %.6: 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: %.30: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.31: = bound_method %.6, %Convert.15 [template] +// CHECK:STDOUT: %.32: i32 = int_value 1 [template] // CHECK:STDOUT: %Derived: type = class_type @Derived [template] -// CHECK:STDOUT: %.7: type = unbound_element_type %Derived, %Base [template] -// CHECK:STDOUT: %.8: type = struct_type {.base: %Base} [template] -// CHECK:STDOUT: %.9: = complete_type_witness %.8 [template] -// CHECK:STDOUT: %.10: type = ptr_type %Derived [template] +// CHECK:STDOUT: %.33: type = unbound_element_type %Derived, %Base [template] +// CHECK:STDOUT: %.34: type = struct_type {.base: %Base} [template] +// CHECK:STDOUT: %.35: = complete_type_witness %.34 [template] +// CHECK:STDOUT: %.36: type = ptr_type %Derived [template] // CHECK:STDOUT: %Call.type: type = fn_type @Call [template] // CHECK:STDOUT: %Call: %Call.type = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -78,13 +85,13 @@ fn Call(p: Derived*) { // CHECK:STDOUT: } // CHECK:STDOUT: %Derived.decl: type = class_decl @Derived [template = constants.%Derived] {} {} // CHECK:STDOUT: %Call.decl: %Call.type = fn_decl @Call [template = constants.%Call] { -// CHECK:STDOUT: %p.patt: %.10 = binding_pattern p -// CHECK:STDOUT: %p.param_patt: %.10 = value_param_pattern %p.patt, runtime_param0 +// CHECK:STDOUT: %p.patt: %.36 = binding_pattern p +// CHECK:STDOUT: %p.param_patt: %.36 = value_param_pattern %p.patt, runtime_param0 // CHECK:STDOUT: } { // CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl [template = constants.%Derived] -// CHECK:STDOUT: %.loc25: type = ptr_type %Derived [template = constants.%.10] -// CHECK:STDOUT: %p.param: %.10 = value_param runtime_param0 -// CHECK:STDOUT: %p: %.10 = bind_name p, %p.param +// CHECK:STDOUT: %.loc25: type = ptr_type %Derived [template = constants.%.36] +// CHECK:STDOUT: %p.param: %.36 = value_param runtime_param0 +// CHECK:STDOUT: %p: %.36 = bind_name p, %p.param // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -113,8 +120,8 @@ fn Call(p: Derived*) { // CHECK:STDOUT: // CHECK:STDOUT: class @Derived { // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] -// CHECK:STDOUT: %.loc22: %.7 = base_decl %Base, element0 [template] -// CHECK:STDOUT: %.loc23: = complete_type_witness %.8 [template = constants.%.9] +// CHECK:STDOUT: %.loc22: %.33 = base_decl %Base, element0 [template] +// CHECK:STDOUT: %.loc23: = complete_type_witness %.34 [template = constants.%.35] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Derived @@ -128,18 +135,22 @@ fn Call(p: Derived*) { // CHECK:STDOUT: %.loc18_4: ref %Base = deref %self.ref // CHECK:STDOUT: %a.ref: %.1 = name_ref a, @Base.%.loc12_8 [template = @Base.%.loc12_8] // CHECK:STDOUT: %.loc18_10: ref i32 = class_element_access %.loc18_4, element0 -// CHECK:STDOUT: %.loc18_15: i32 = int_value 1 [template = constants.%.6] -// CHECK:STDOUT: assign %.loc18_10, %.loc18_15 +// CHECK:STDOUT: %.loc18_15: Core.IntLiteral = int_value 1 [template = constants.%.6] +// CHECK:STDOUT: %.loc18_13.1: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc18_13.2: = bound_method %.loc18_15, %.loc18_13.1 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc18_13.2(%.loc18_15) [template = constants.%.32] +// CHECK:STDOUT: %.loc18_13.3: init i32 = converted %.loc18_15, %int.convert_checked [template = constants.%.32] +// CHECK:STDOUT: assign %.loc18_10, %.loc18_13.3 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Call(%p.param_patt: %.10) { +// CHECK:STDOUT: fn @Call(%p.param_patt: %.36) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %p.ref: %.10 = name_ref p, %p +// CHECK:STDOUT: %p.ref: %.36 = name_ref p, %p // CHECK:STDOUT: %.loc26_4.1: ref %Derived = deref %p.ref // CHECK:STDOUT: %F.ref: %F.type = name_ref F, @Base.%F.decl [template = constants.%F] // CHECK:STDOUT: %.loc26_7: = bound_method %.loc26_4.1, %F.ref -// CHECK:STDOUT: %.loc26_4.2: %.10 = addr_of %.loc26_4.1 +// CHECK:STDOUT: %.loc26_4.2: %.36 = addr_of %.loc26_4.1 // CHECK:STDOUT: %.loc26_4.3: ref %Derived = deref %.loc26_4.2 // CHECK:STDOUT: %.loc26_4.4: ref %Base = class_element_access %.loc26_4.3, element0 // CHECK:STDOUT: %.loc26_4.5: %.2 = addr_of %.loc26_4.4 diff --git a/toolchain/check/testdata/class/basic.carbon b/toolchain/check/testdata/class/basic.carbon index bccb031ebea19..152d3e80ccf8e 100644 --- a/toolchain/check/testdata/class/basic.carbon +++ b/toolchain/check/testdata/class/basic.carbon @@ -41,12 +41,19 @@ fn Run() -> i32 { // CHECK:STDOUT: %.3: = complete_type_witness %.2 [template] // CHECK:STDOUT: %Run.type: type = fn_type @Run [template] // CHECK:STDOUT: %Run: %Run.type = struct_value () [template] -// CHECK:STDOUT: %.5: i32 = int_value 4 [template] +// CHECK:STDOUT: %.5: Core.IntLiteral = int_value 4 [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: %.29: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.30: = bound_method %.5, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 4 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -153,8 +160,13 @@ fn Run() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %F.ref: %F.type = name_ref F, @Class.%F.decl [template = constants.%F] -// CHECK:STDOUT: %.loc26_18: i32 = int_value 4 [template = constants.%.5] -// CHECK:STDOUT: %F.call: init i32 = call %F.ref(%.loc26_18) +// CHECK:STDOUT: %.loc26_18.1: Core.IntLiteral = int_value 4 [template = constants.%.5] +// CHECK:STDOUT: %.loc26_18.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc26_18.3: = bound_method %.loc26_18.1, %.loc26_18.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc26_18.3(%.loc26_18.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc26_18.4: i32 = value_of_initializer %int.convert_checked [template = constants.%.31] +// CHECK:STDOUT: %.loc26_18.5: i32 = converted %.loc26_18.1, %.loc26_18.4 [template = constants.%.31] +// CHECK:STDOUT: %F.call: init i32 = call %F.ref(%.loc26_18.5) // CHECK:STDOUT: %.loc26_20.1: i32 = value_of_initializer %F.call // CHECK:STDOUT: %.loc26_20.2: i32 = converted %F.call, %.loc26_20.1 // CHECK:STDOUT: return %.loc26_20.2 diff --git a/toolchain/check/testdata/class/derived_to_base.carbon b/toolchain/check/testdata/class/derived_to_base.carbon index 694c0856b6c77..bb3dd2bc35808 100644 --- a/toolchain/check/testdata/class/derived_to_base.carbon +++ b/toolchain/check/testdata/class/derived_to_base.carbon @@ -72,19 +72,31 @@ fn ConvertInit() { // CHECK:STDOUT: %ConvertRef: %ConvertRef.type = struct_value () [template] // CHECK:STDOUT: %ConvertInit.type: type = fn_type @ConvertInit [template] // CHECK:STDOUT: %ConvertInit: %ConvertInit.type = struct_value () [template] -// CHECK:STDOUT: %.22: i32 = int_value 1 [template] -// CHECK:STDOUT: %.23: i32 = int_value 2 [template] -// CHECK:STDOUT: %.24: type = struct_type {.base: %.2, .b: i32} [template] -// CHECK:STDOUT: %.25: i32 = int_value 3 [template] -// CHECK:STDOUT: %.26: type = struct_type {.base: %.24, .c: i32} [template] -// CHECK:STDOUT: %struct.1: %A = struct_value (%.22) [template] -// CHECK:STDOUT: %struct.2: %B = struct_value (%struct.1, %.23) [template] -// CHECK:STDOUT: %struct.3: %C = struct_value (%struct.2, %.25) [template] +// CHECK:STDOUT: %.22: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.23: type = struct_type {.a: Core.IntLiteral} [template] +// CHECK:STDOUT: %.24: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.25: type = struct_type {.base: %.23, .b: Core.IntLiteral} [template] +// CHECK:STDOUT: %.26: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.27: type = struct_type {.base: %.25, .c: Core.IntLiteral} [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: %.51: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.52: = bound_method %.22, %Convert.15 [template] +// CHECK:STDOUT: %.53: i32 = int_value 1 [template] +// CHECK:STDOUT: %struct.1: %A = struct_value (%.53) [template] +// CHECK:STDOUT: %.54: = bound_method %.24, %Convert.15 [template] +// CHECK:STDOUT: %.55: i32 = int_value 2 [template] +// CHECK:STDOUT: %struct.2: %B = struct_value (%struct.1, %.55) [template] +// CHECK:STDOUT: %.56: = bound_method %.26, %Convert.15 [template] +// CHECK:STDOUT: %.57: i32 = int_value 3 [template] +// CHECK:STDOUT: %struct.3: %C = struct_value (%struct.2, %.57) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -280,29 +292,41 @@ fn ConvertInit() { // CHECK:STDOUT: fn @ConvertInit() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A] -// CHECK:STDOUT: %.loc38_38: i32 = int_value 1 [template = constants.%.22] -// CHECK:STDOUT: %.loc38_39.1: %.2 = struct_literal (%.loc38_38) -// CHECK:STDOUT: %.loc38_47: i32 = int_value 2 [template = constants.%.23] -// CHECK:STDOUT: %.loc38_48.1: %.24 = struct_literal (%.loc38_39.1, %.loc38_47) -// CHECK:STDOUT: %.loc38_56: i32 = int_value 3 [template = constants.%.25] -// CHECK:STDOUT: %.loc38_57.1: %.26 = struct_literal (%.loc38_48.1, %.loc38_56) +// CHECK:STDOUT: %.loc38_38: Core.IntLiteral = int_value 1 [template = constants.%.22] +// CHECK:STDOUT: %.loc38_39.1: %.23 = struct_literal (%.loc38_38) +// CHECK:STDOUT: %.loc38_47: Core.IntLiteral = int_value 2 [template = constants.%.24] +// CHECK:STDOUT: %.loc38_48.1: %.25 = struct_literal (%.loc38_39.1, %.loc38_47) +// CHECK:STDOUT: %.loc38_56: Core.IntLiteral = int_value 3 [template = constants.%.26] +// CHECK:STDOUT: %.loc38_57.1: %.27 = struct_literal (%.loc38_48.1, %.loc38_56) // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %.loc38_39.2: %Convert.type.2 = interface_witness_access constants.%.51, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc38_39.3: = bound_method %.loc38_38, %.loc38_39.2 [template = constants.%.52] +// CHECK:STDOUT: %int.convert_checked.loc38_39: init i32 = call %.loc38_39.3(%.loc38_38) [template = constants.%.53] +// CHECK:STDOUT: %.loc38_39.4: init i32 = converted %.loc38_38, %int.convert_checked.loc38_39 [template = constants.%.53] // CHECK:STDOUT: %.loc38_57.2: ref %C = temporary_storage // CHECK:STDOUT: %.loc38_57.3: ref %B = class_element_access %.loc38_57.2, element0 // CHECK:STDOUT: %.loc38_48.2: ref %A = class_element_access %.loc38_57.3, element0 -// CHECK:STDOUT: %.loc38_39.2: ref i32 = class_element_access %.loc38_48.2, element0 -// CHECK:STDOUT: %.loc38_39.3: init i32 = initialize_from %.loc38_38 to %.loc38_39.2 [template = constants.%.22] -// CHECK:STDOUT: %.loc38_39.4: init %A = class_init (%.loc38_39.3), %.loc38_48.2 [template = constants.%struct.1] -// CHECK:STDOUT: %.loc38_48.3: init %A = converted %.loc38_39.1, %.loc38_39.4 [template = constants.%struct.1] -// CHECK:STDOUT: %.loc38_48.4: ref i32 = class_element_access %.loc38_57.3, element1 -// CHECK:STDOUT: %.loc38_48.5: init i32 = initialize_from %.loc38_47 to %.loc38_48.4 [template = constants.%.23] -// CHECK:STDOUT: %.loc38_48.6: init %B = class_init (%.loc38_48.3, %.loc38_48.5), %.loc38_57.3 [template = constants.%struct.2] -// CHECK:STDOUT: %.loc38_57.4: init %B = converted %.loc38_48.1, %.loc38_48.6 [template = constants.%struct.2] -// CHECK:STDOUT: %.loc38_57.5: ref i32 = class_element_access %.loc38_57.2, element1 -// CHECK:STDOUT: %.loc38_57.6: init i32 = initialize_from %.loc38_56 to %.loc38_57.5 [template = constants.%.25] -// CHECK:STDOUT: %.loc38_57.7: init %C = class_init (%.loc38_57.4, %.loc38_57.6), %.loc38_57.2 [template = constants.%struct.3] -// CHECK:STDOUT: %.loc38_57.8: ref %C = temporary %.loc38_57.2, %.loc38_57.7 -// CHECK:STDOUT: %.loc38_59: ref %C = converted %.loc38_57.1, %.loc38_57.8 +// CHECK:STDOUT: %.loc38_39.5: ref i32 = class_element_access %.loc38_48.2, element0 +// CHECK:STDOUT: %.loc38_39.6: init i32 = initialize_from %.loc38_39.4 to %.loc38_39.5 [template = constants.%.53] +// CHECK:STDOUT: %.loc38_39.7: init %A = class_init (%.loc38_39.6), %.loc38_48.2 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc38_48.3: init %A = converted %.loc38_39.1, %.loc38_39.7 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc38_48.4: %Convert.type.2 = interface_witness_access constants.%.51, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc38_48.5: = bound_method %.loc38_47, %.loc38_48.4 [template = constants.%.54] +// CHECK:STDOUT: %int.convert_checked.loc38_48: init i32 = call %.loc38_48.5(%.loc38_47) [template = constants.%.55] +// CHECK:STDOUT: %.loc38_48.6: init i32 = converted %.loc38_47, %int.convert_checked.loc38_48 [template = constants.%.55] +// CHECK:STDOUT: %.loc38_48.7: ref i32 = class_element_access %.loc38_57.3, element1 +// CHECK:STDOUT: %.loc38_48.8: init i32 = initialize_from %.loc38_48.6 to %.loc38_48.7 [template = constants.%.55] +// CHECK:STDOUT: %.loc38_48.9: init %B = class_init (%.loc38_48.3, %.loc38_48.8), %.loc38_57.3 [template = constants.%struct.2] +// CHECK:STDOUT: %.loc38_57.4: init %B = converted %.loc38_48.1, %.loc38_48.9 [template = constants.%struct.2] +// CHECK:STDOUT: %.loc38_57.5: %Convert.type.2 = interface_witness_access constants.%.51, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc38_57.6: = bound_method %.loc38_56, %.loc38_57.5 [template = constants.%.56] +// CHECK:STDOUT: %int.convert_checked.loc38_57: init i32 = call %.loc38_57.6(%.loc38_56) [template = constants.%.57] +// CHECK:STDOUT: %.loc38_57.7: init i32 = converted %.loc38_56, %int.convert_checked.loc38_57 [template = constants.%.57] +// CHECK:STDOUT: %.loc38_57.8: ref i32 = class_element_access %.loc38_57.2, element1 +// CHECK:STDOUT: %.loc38_57.9: init i32 = initialize_from %.loc38_57.7 to %.loc38_57.8 [template = constants.%.57] +// CHECK:STDOUT: %.loc38_57.10: init %C = class_init (%.loc38_57.4, %.loc38_57.9), %.loc38_57.2 [template = constants.%struct.3] +// CHECK:STDOUT: %.loc38_57.11: ref %C = temporary %.loc38_57.2, %.loc38_57.10 +// CHECK:STDOUT: %.loc38_59: ref %C = converted %.loc38_57.1, %.loc38_57.11 // CHECK:STDOUT: %.loc38_63.1: ref %B = class_element_access %.loc38_59, element0 // CHECK:STDOUT: %.loc38_63.2: ref %A = class_element_access %.loc38_63.1, element0 // CHECK:STDOUT: %.loc38_63.3: ref %A = converted %.loc38_59, %.loc38_63.2 diff --git a/toolchain/check/testdata/class/fail_abstract.carbon b/toolchain/check/testdata/class/fail_abstract.carbon index 9ffb119de85e8..6d03114f22954 100644 --- a/toolchain/check/testdata/class/fail_abstract.carbon +++ b/toolchain/check/testdata/class/fail_abstract.carbon @@ -447,10 +447,10 @@ fn CallReturnAbstract() { // CHECK:STDOUT: %.7: = complete_type_witness %.6 [template] // CHECK:STDOUT: %Make.type: type = fn_type @Make [template] // CHECK:STDOUT: %Make: %Make.type = struct_value () [template] -// CHECK:STDOUT: %.11: i32 = int_value 1 [template] -// CHECK:STDOUT: %.12: type = struct_type {.a: i32} [template] -// CHECK:STDOUT: %.13: i32 = int_value 7 [template] -// CHECK:STDOUT: %.14: type = struct_type {.base: %.12, .d: i32} [template] +// CHECK:STDOUT: %.11: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.12: type = struct_type {.a: Core.IntLiteral} [template] +// CHECK:STDOUT: %.13: Core.IntLiteral = int_value 7 [template] +// CHECK:STDOUT: %.14: type = struct_type {.base: %.12, .d: Core.IntLiteral} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -506,9 +506,9 @@ fn CallReturnAbstract() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Make() -> %return: %Derived { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc22_25: i32 = int_value 1 [template = constants.%.11] +// CHECK:STDOUT: %.loc22_25: Core.IntLiteral = int_value 1 [template = constants.%.11] // CHECK:STDOUT: %.loc22_26: %.12 = struct_literal (%.loc22_25) -// CHECK:STDOUT: %.loc22_34: i32 = int_value 7 [template = constants.%.13] +// CHECK:STDOUT: %.loc22_34: Core.IntLiteral = int_value 7 [template = constants.%.13] // CHECK:STDOUT: %.loc22_35: %.14 = struct_literal (%.loc22_26, %.loc22_34) // CHECK:STDOUT: return to %return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/fail_adapt_bad_decl.carbon b/toolchain/check/testdata/class/fail_adapt_bad_decl.carbon index 7998da61e22e9..8e81326df9163 100644 --- a/toolchain/check/testdata/class/fail_adapt_bad_decl.carbon +++ b/toolchain/check/testdata/class/fail_adapt_bad_decl.carbon @@ -13,10 +13,10 @@ library "[[@TEST_NAME]]"; class Bad { - // CHECK:STDERR: fail_not_type.carbon:[[@LINE+7]]:3: error: cannot implicitly convert from `i32` to `type` [ImplicitAsConversionFailure] + // CHECK:STDERR: fail_not_type.carbon:[[@LINE+7]]:3: error: cannot implicitly convert from `Core.IntLiteral` to `type` [ImplicitAsConversionFailure] // CHECK:STDERR: adapt 100; // CHECK:STDERR: ^~~~~~~~~~ - // CHECK:STDERR: fail_not_type.carbon:[[@LINE+4]]:3: note: type `i32` does not implement interface `ImplicitAs(type)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_not_type.carbon:[[@LINE+4]]:3: note: type `Core.IntLiteral` does not implement interface `ImplicitAs(type)` [MissingImplInMemberAccessNote] // CHECK:STDERR: adapt 100; // CHECK:STDERR: ^~~~~~~~~~ // CHECK:STDERR: @@ -34,10 +34,10 @@ fn Use(b: Bad) { b.F(); } library "[[@TEST_NAME]]"; class Bad { - // CHECK:STDERR: fail_extend_not_type.carbon:[[@LINE+7]]:3: error: cannot implicitly convert from `i32` to `type` [ImplicitAsConversionFailure] + // CHECK:STDERR: fail_extend_not_type.carbon:[[@LINE+7]]:3: error: cannot implicitly convert from `Core.IntLiteral` to `type` [ImplicitAsConversionFailure] // CHECK:STDERR: extend adapt 100; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_extend_not_type.carbon:[[@LINE+4]]:3: note: type `i32` does not implement interface `ImplicitAs(type)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_extend_not_type.carbon:[[@LINE+4]]:3: note: type `Core.IntLiteral` does not implement interface `ImplicitAs(type)` [MissingImplInMemberAccessNote] // CHECK:STDERR: extend adapt 100; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -106,7 +106,7 @@ class C { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Bad: type = class_type @Bad [template] -// CHECK:STDOUT: %.1: i32 = int_value 100 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 100 [template] // CHECK:STDOUT: %Use.type: type = fn_type @Use [template] // CHECK:STDOUT: %Use: %Use.type = struct_value () [template] // CHECK:STDOUT: } @@ -138,7 +138,7 @@ class C { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Bad { -// CHECK:STDOUT: %.loc12_9: i32 = int_value 100 [template = constants.%.1] +// CHECK:STDOUT: %.loc12_9: Core.IntLiteral = int_value 100 [template = constants.%.1] // CHECK:STDOUT: %.loc12_12: type = converted %.loc12_9, [template = ] // CHECK:STDOUT: adapt_decl // CHECK:STDOUT: %.loc13: = complete_type_witness [template = ] @@ -158,7 +158,7 @@ class C { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Bad: type = class_type @Bad [template] -// CHECK:STDOUT: %.1: i32 = int_value 100 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 100 [template] // CHECK:STDOUT: %Use.type: type = fn_type @Use [template] // CHECK:STDOUT: %Use: %Use.type = struct_value () [template] // CHECK:STDOUT: } @@ -190,7 +190,7 @@ class C { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Bad { -// CHECK:STDOUT: %.loc12_16: i32 = int_value 100 [template = constants.%.1] +// CHECK:STDOUT: %.loc12_16: Core.IntLiteral = int_value 100 [template = constants.%.1] // CHECK:STDOUT: %.loc12_19: type = converted %.loc12_16, [template = ] // CHECK:STDOUT: adapt_decl // CHECK:STDOUT: %.loc13: = complete_type_witness [template = ] diff --git a/toolchain/check/testdata/class/fail_base_bad_type.carbon b/toolchain/check/testdata/class/fail_base_bad_type.carbon index d343d7bf3e180..620753ce7c43c 100644 --- a/toolchain/check/testdata/class/fail_base_bad_type.carbon +++ b/toolchain/check/testdata/class/fail_base_bad_type.carbon @@ -26,10 +26,10 @@ fn AccessMemberWithInvalidBaseError(p: DeriveFromError*) -> i32 { return (*p).n; // --- fail_derive_from_non_type.carbon class DeriveFromNonType { - // CHECK:STDERR: fail_derive_from_non_type.carbon:[[@LINE+9]]:16: error: cannot implicitly convert from `i32` to `type` [ImplicitAsConversionFailure] + // CHECK:STDERR: fail_derive_from_non_type.carbon:[[@LINE+9]]:16: error: cannot implicitly convert from `Core.IntLiteral` to `type` [ImplicitAsConversionFailure] // CHECK:STDERR: extend base: 32; // CHECK:STDERR: ^~ - // CHECK:STDERR: fail_derive_from_non_type.carbon:[[@LINE+6]]:16: note: type `i32` does not implement interface `ImplicitAs(type)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_derive_from_non_type.carbon:[[@LINE+6]]:16: note: type `Core.IntLiteral` does not implement interface `ImplicitAs(type)` [MissingImplInMemberAccessNote] // CHECK:STDERR: extend base: 32; // CHECK:STDERR: ^~ // CHECK:STDERR: @@ -246,7 +246,7 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %DeriveFromNonType: type = class_type @DeriveFromNonType [template] -// CHECK:STDOUT: %.1: i32 = int_value 32 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 32 [template] // CHECK:STDOUT: %.27: type = ptr_type %DeriveFromNonType [template] // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] @@ -290,7 +290,7 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @DeriveFromNonType { -// CHECK:STDOUT: %.loc12_16.1: i32 = int_value 32 [template = constants.%.1] +// CHECK:STDOUT: %.loc12_16.1: Core.IntLiteral = int_value 32 [template = constants.%.1] // CHECK:STDOUT: %.loc12_16.2: type = converted %.loc12_16.1, [template = ] // CHECK:STDOUT: %.loc12_18: = base_decl , element0 [template] // CHECK:STDOUT: %.loc13: = complete_type_witness [template = ] diff --git a/toolchain/check/testdata/class/fail_convert_to_invalid.carbon b/toolchain/check/testdata/class/fail_convert_to_invalid.carbon index 4cea650bceefc..f3b7bfd9f5775 100644 --- a/toolchain/check/testdata/class/fail_convert_to_invalid.carbon +++ b/toolchain/check/testdata/class/fail_convert_to_invalid.carbon @@ -25,8 +25,8 @@ fn Make() -> C { // CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %Make.type: type = fn_type @Make [template] // CHECK:STDOUT: %Make: %Make.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 123 [template] -// CHECK:STDOUT: %.2: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 123 [template] +// CHECK:STDOUT: %.2: type = struct_type {.a: Core.IntLiteral} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -66,7 +66,7 @@ fn Make() -> C { // CHECK:STDOUT: // CHECK:STDOUT: fn @Make() -> %return: %C { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc19_16: i32 = int_value 123 [template = constants.%.1] +// CHECK:STDOUT: %.loc19_16: Core.IntLiteral = int_value 123 [template = constants.%.1] // CHECK:STDOUT: %.loc19_19: %.2 = struct_literal (%.loc19_16) // CHECK:STDOUT: return to %return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/fail_field_modifiers.carbon b/toolchain/check/testdata/class/fail_field_modifiers.carbon index e2133034c6166..524c8a47e2b6a 100644 --- a/toolchain/check/testdata/class/fail_field_modifiers.carbon +++ b/toolchain/check/testdata/class/fail_field_modifiers.carbon @@ -41,15 +41,24 @@ class Class { // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %.1: type = unbound_element_type %Class, i32 [template] -// CHECK:STDOUT: %.2: i32 = int_value 0 [template] -// CHECK:STDOUT: %.3: i32 = int_value 1 [template] -// CHECK:STDOUT: %.4: type = struct_type {.j: i32, .k: i32} [template] -// CHECK:STDOUT: %.5: = complete_type_witness %.4 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 0 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 0 [template] +// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.30: = bound_method %.29, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 1 [template] +// CHECK:STDOUT: %.32: type = struct_type {.j: i32, .k: i32} [template] +// CHECK:STDOUT: %.33: = complete_type_witness %.32 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -76,14 +85,24 @@ class Class { // CHECK:STDOUT: %int.make_type_32.loc29: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc29_18.1: type = value_of_initializer %int.make_type_32.loc29 [template = i32] // CHECK:STDOUT: %.loc29_18.2: type = converted %int.make_type_32.loc29, %.loc29_18.1 [template = i32] -// CHECK:STDOUT: %.loc29_24: i32 = int_value 0 [template = constants.%.2] -// CHECK:STDOUT: %l: i32 = bind_name l, %.loc29_24 +// CHECK:STDOUT: %.loc29_24: Core.IntLiteral = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc29_25.1: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc29_25.2: = bound_method %.loc29_24, %.loc29_25.1 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc29: init i32 = call %.loc29_25.2(%.loc29_24) [template = constants.%.28] +// CHECK:STDOUT: %.loc29_25.3: i32 = value_of_initializer %int.convert_checked.loc29 [template = constants.%.28] +// CHECK:STDOUT: %.loc29_25.4: i32 = converted %.loc29_24, %.loc29_25.3 [template = constants.%.28] +// CHECK:STDOUT: %l: i32 = bind_name l, %.loc29_25.4 // CHECK:STDOUT: %int.make_type_32.loc34: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc34_16.1: type = value_of_initializer %int.make_type_32.loc34 [template = i32] // CHECK:STDOUT: %.loc34_16.2: type = converted %int.make_type_32.loc34, %.loc34_16.1 [template = i32] -// CHECK:STDOUT: %.loc34_22: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: %m: i32 = bind_name m, %.loc34_22 -// CHECK:STDOUT: %.loc35: = complete_type_witness %.4 [template = constants.%.5] +// CHECK:STDOUT: %.loc34_22: Core.IntLiteral = int_value 1 [template = constants.%.29] +// CHECK:STDOUT: %.loc34_23.1: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc34_23.2: = bound_method %.loc34_22, %.loc34_23.1 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc34: init i32 = call %.loc34_23.2(%.loc34_22) [template = constants.%.31] +// CHECK:STDOUT: %.loc34_23.3: i32 = value_of_initializer %int.convert_checked.loc34 [template = constants.%.31] +// CHECK:STDOUT: %.loc34_23.4: i32 = converted %.loc34_22, %.loc34_23.3 [template = constants.%.31] +// CHECK:STDOUT: %m: i32 = bind_name m, %.loc34_23.4 +// CHECK:STDOUT: %.loc35: = complete_type_witness %.32 [template = constants.%.33] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class diff --git a/toolchain/check/testdata/class/fail_init.carbon b/toolchain/check/testdata/class/fail_init.carbon index 68919aebc762a..de11dad874d42 100644 --- a/toolchain/check/testdata/class/fail_init.carbon +++ b/toolchain/check/testdata/class/fail_init.carbon @@ -41,17 +41,24 @@ fn F() { // CHECK:STDOUT: %.3: = complete_type_witness %.2 [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %.4: i32 = int_value 1 [template] -// CHECK:STDOUT: %.5: type = struct_type {.a: i32} [template] -// CHECK:STDOUT: %.7: i32 = int_value 2 [template] -// CHECK:STDOUT: %.8: type = struct_type {.a: i32, .c: i32} [template] -// CHECK:STDOUT: %.9: i32 = int_value 3 [template] -// CHECK:STDOUT: %.10: type = struct_type {.a: i32, .b: i32, .c: i32} [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.5: type = struct_type {.a: Core.IntLiteral} [template] +// CHECK:STDOUT: %.7: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.8: type = struct_type {.a: Core.IntLiteral, .c: Core.IntLiteral} [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: %.32: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.33: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.34: i32 = int_value 1 [template] +// CHECK:STDOUT: %.35: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.36: type = struct_type {.a: Core.IntLiteral, .b: Core.IntLiteral, .c: Core.IntLiteral} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -87,25 +94,29 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc21_9: i32 = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc21_9: Core.IntLiteral = int_value 1 [template = constants.%.4] // CHECK:STDOUT: %.loc21_10.1: %.5 = struct_literal (%.loc21_9) // CHECK:STDOUT: %Class.ref.loc21: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %.loc21_10.2: ref %Class = temporary_storage // CHECK:STDOUT: %.loc21_10.3: ref %Class = temporary %.loc21_10.2, // CHECK:STDOUT: %.loc21_12: ref %Class = converted %.loc21_10.1, %.loc21_10.3 -// CHECK:STDOUT: %.loc26_9: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc26_17: i32 = int_value 2 [template = constants.%.7] +// CHECK:STDOUT: %.loc26_9: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc26_17: Core.IntLiteral = int_value 2 [template = constants.%.7] // CHECK:STDOUT: %.loc26_18.1: %.8 = struct_literal (%.loc26_9, %.loc26_17) // CHECK:STDOUT: %Class.ref.loc26: type = name_ref Class, file.%Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc26_18.2: ref %Class = temporary_storage -// CHECK:STDOUT: %.loc26_18.3: ref i32 = class_element_access %.loc26_18.2, element0 -// CHECK:STDOUT: %.loc26_18.4: init i32 = initialize_from %.loc26_9 to %.loc26_18.3 [template = constants.%.4] -// CHECK:STDOUT: %.loc26_18.5: ref %Class = temporary %.loc26_18.2, -// CHECK:STDOUT: %.loc26_20: ref %Class = converted %.loc26_18.1, %.loc26_18.5 -// CHECK:STDOUT: %.loc30_9: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc30_17: i32 = int_value 2 [template = constants.%.7] -// CHECK:STDOUT: %.loc30_25: i32 = int_value 3 [template = constants.%.9] -// CHECK:STDOUT: %.loc30_26.1: %.10 = struct_literal (%.loc30_9, %.loc30_17, %.loc30_25) +// CHECK:STDOUT: %.loc26_18.2: %Convert.type.2 = interface_witness_access constants.%.32, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc26_18.3: = bound_method %.loc26_9, %.loc26_18.2 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc26_18.3(%.loc26_9) [template = constants.%.34] +// CHECK:STDOUT: %.loc26_18.4: init i32 = converted %.loc26_9, %int.convert_checked [template = constants.%.34] +// CHECK:STDOUT: %.loc26_18.5: ref %Class = temporary_storage +// CHECK:STDOUT: %.loc26_18.6: ref i32 = class_element_access %.loc26_18.5, element0 +// CHECK:STDOUT: %.loc26_18.7: init i32 = initialize_from %.loc26_18.4 to %.loc26_18.6 [template = constants.%.34] +// CHECK:STDOUT: %.loc26_18.8: ref %Class = temporary %.loc26_18.5, +// CHECK:STDOUT: %.loc26_20: ref %Class = converted %.loc26_18.1, %.loc26_18.8 +// CHECK:STDOUT: %.loc30_9: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc30_17: Core.IntLiteral = int_value 2 [template = constants.%.7] +// CHECK:STDOUT: %.loc30_25: Core.IntLiteral = int_value 3 [template = constants.%.35] +// CHECK:STDOUT: %.loc30_26.1: %.36 = struct_literal (%.loc30_9, %.loc30_17, %.loc30_25) // CHECK:STDOUT: %Class.ref.loc30: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %.loc30_26.2: ref %Class = temporary_storage // CHECK:STDOUT: %.loc30_26.3: ref %Class = temporary %.loc30_26.2, diff --git a/toolchain/check/testdata/class/fail_init_as_inplace.carbon b/toolchain/check/testdata/class/fail_init_as_inplace.carbon index 43d4e2e434ec9..f284efbfbd6a1 100644 --- a/toolchain/check/testdata/class/fail_init_as_inplace.carbon +++ b/toolchain/check/testdata/class/fail_init_as_inplace.carbon @@ -41,14 +41,24 @@ fn F() { // CHECK:STDOUT: %G: %G.type = struct_value () [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %.6: i32 = int_value 1 [template] -// CHECK:STDOUT: %.7: i32 = int_value 2 [template] -// CHECK:STDOUT: %struct: %Class = struct_value (%.6, %.7) [template] +// CHECK:STDOUT: %.6: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.7: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.8: type = struct_type {.a: Core.IntLiteral, .b: Core.IntLiteral} [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: %.32: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.33: = bound_method %.6, %Convert.15 [template] +// CHECK:STDOUT: %.34: i32 = int_value 1 [template] +// CHECK:STDOUT: %.35: = bound_method %.7, %Convert.15 [template] +// CHECK:STDOUT: %.36: i32 = int_value 2 [template] +// CHECK:STDOUT: %struct: %Class = struct_value (%.34, %.36) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -99,18 +109,26 @@ fn F() { // CHECK:STDOUT: %Class.ref.loc25_10: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %c.var: ref %Class = var c // CHECK:STDOUT: %c: ref %Class = bind_name c, %c.var -// CHECK:STDOUT: %.loc25_24: i32 = int_value 1 [template = constants.%.6] -// CHECK:STDOUT: %.loc25_32: i32 = int_value 2 [template = constants.%.7] -// CHECK:STDOUT: %.loc25_33.1: %.2 = struct_literal (%.loc25_24, %.loc25_32) +// CHECK:STDOUT: %.loc25_24: Core.IntLiteral = int_value 1 [template = constants.%.6] +// CHECK:STDOUT: %.loc25_32: Core.IntLiteral = int_value 2 [template = constants.%.7] +// CHECK:STDOUT: %.loc25_33.1: %.8 = struct_literal (%.loc25_24, %.loc25_32) // CHECK:STDOUT: %Class.ref.loc25_38: type = name_ref Class, file.%Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc25_33.2: ref %Class = temporary_storage -// CHECK:STDOUT: %.loc25_33.3: ref i32 = class_element_access %.loc25_33.2, element0 -// CHECK:STDOUT: %.loc25_33.4: init i32 = initialize_from %.loc25_24 to %.loc25_33.3 [template = constants.%.6] -// CHECK:STDOUT: %.loc25_33.5: ref i32 = class_element_access %.loc25_33.2, element1 -// CHECK:STDOUT: %.loc25_33.6: init i32 = initialize_from %.loc25_32 to %.loc25_33.5 [template = constants.%.7] -// CHECK:STDOUT: %.loc25_33.7: init %Class = class_init (%.loc25_33.4, %.loc25_33.6), %.loc25_33.2 [template = constants.%struct] -// CHECK:STDOUT: %.loc25_33.8: ref %Class = temporary %.loc25_33.2, %.loc25_33.7 -// CHECK:STDOUT: %.loc25_35.1: ref %Class = converted %.loc25_33.1, %.loc25_33.8 +// CHECK:STDOUT: %.loc25_33.2: %Convert.type.2 = interface_witness_access constants.%.32, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc25_33.3: = bound_method %.loc25_24, %.loc25_33.2 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc25_33.1: init i32 = call %.loc25_33.3(%.loc25_24) [template = constants.%.34] +// CHECK:STDOUT: %.loc25_33.4: init i32 = converted %.loc25_24, %int.convert_checked.loc25_33.1 [template = constants.%.34] +// CHECK:STDOUT: %.loc25_33.5: ref %Class = temporary_storage +// CHECK:STDOUT: %.loc25_33.6: ref i32 = class_element_access %.loc25_33.5, element0 +// CHECK:STDOUT: %.loc25_33.7: init i32 = initialize_from %.loc25_33.4 to %.loc25_33.6 [template = constants.%.34] +// CHECK:STDOUT: %.loc25_33.8: %Convert.type.2 = interface_witness_access constants.%.32, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc25_33.9: = bound_method %.loc25_32, %.loc25_33.8 [template = constants.%.35] +// CHECK:STDOUT: %int.convert_checked.loc25_33.2: init i32 = call %.loc25_33.9(%.loc25_32) [template = constants.%.36] +// CHECK:STDOUT: %.loc25_33.10: init i32 = converted %.loc25_32, %int.convert_checked.loc25_33.2 [template = constants.%.36] +// CHECK:STDOUT: %.loc25_33.11: ref i32 = class_element_access %.loc25_33.5, element1 +// CHECK:STDOUT: %.loc25_33.12: init i32 = initialize_from %.loc25_33.10 to %.loc25_33.11 [template = constants.%.36] +// CHECK:STDOUT: %.loc25_33.13: init %Class = class_init (%.loc25_33.7, %.loc25_33.12), %.loc25_33.5 [template = constants.%struct] +// CHECK:STDOUT: %.loc25_33.14: ref %Class = temporary %.loc25_33.5, %.loc25_33.13 +// CHECK:STDOUT: %.loc25_35.1: ref %Class = converted %.loc25_33.1, %.loc25_33.14 // CHECK:STDOUT: %.loc25_35.2: %Class = bind_value %.loc25_35.1 // CHECK:STDOUT: assign %c.var, // CHECK:STDOUT: %G.ref: %G.type = name_ref G, file.%G.decl [template = constants.%G] diff --git a/toolchain/check/testdata/class/fail_scope.carbon b/toolchain/check/testdata/class/fail_scope.carbon index 515ae11ab54ae..8f22045b22835 100644 --- a/toolchain/check/testdata/class/fail_scope.carbon +++ b/toolchain/check/testdata/class/fail_scope.carbon @@ -31,14 +31,21 @@ fn G() -> i32 { // CHECK:STDOUT: %F: %F.type = struct_value () [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: = complete_type_witness %.1 [template] -// CHECK:STDOUT: %.3: i32 = int_value 1 [template] +// CHECK:STDOUT: %.3: 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: %.27: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.28: = bound_method %.3, %Convert.15 [template] +// CHECK:STDOUT: %.29: i32 = int_value 1 [template] // CHECK:STDOUT: %G.type: type = fn_type @G [template] // CHECK:STDOUT: %G: %G.type = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -84,8 +91,13 @@ fn G() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc13: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: return %.loc13 +// CHECK:STDOUT: %.loc13_12: Core.IntLiteral = int_value 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc13_13.1: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_13.2: = bound_method %.loc13_12, %.loc13_13.1 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc13_13.2(%.loc13_12) [template = constants.%.29] +// CHECK:STDOUT: %.loc13_13.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.29] +// CHECK:STDOUT: %.loc13_13.4: i32 = converted %.loc13_12, %.loc13_13.3 [template = constants.%.29] +// CHECK:STDOUT: return %.loc13_13.4 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> i32 { diff --git a/toolchain/check/testdata/class/fail_self_param.carbon b/toolchain/check/testdata/class/fail_self_param.carbon index ef73e9ea3264d..b1b321defab1e 100644 --- a/toolchain/check/testdata/class/fail_self_param.carbon +++ b/toolchain/check/testdata/class/fail_self_param.carbon @@ -24,7 +24,7 @@ var v: C(0); // CHECK:STDOUT: %C.2: type = class_type @C, @C(%x) [symbolic] // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: = complete_type_witness %.1 [template] -// CHECK:STDOUT: %.3: i32 = int_value 0 [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -50,7 +50,7 @@ var v: C(0); // CHECK:STDOUT: %x.loc14_22.1: = bind_symbolic_name x, 0, %x.param [symbolic = %x.loc14_22.2 (constants.%x)] // CHECK:STDOUT: } // CHECK:STDOUT: %C.ref: %C.type = name_ref C, %C.decl [template = constants.%C.1] -// CHECK:STDOUT: %.loc15: i32 = int_value 0 [template = constants.%.3] +// CHECK:STDOUT: %.loc15: Core.IntLiteral = int_value 0 [template = constants.%.3] // CHECK:STDOUT: %v.var: ref = var v // CHECK:STDOUT: %v: ref = bind_name v, %v.var // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/field_access.carbon b/toolchain/check/testdata/class/field_access.carbon index 5c8a300b8e9ac..583b86c87dd53 100644 --- a/toolchain/check/testdata/class/field_access.carbon +++ b/toolchain/check/testdata/class/field_access.carbon @@ -32,13 +32,22 @@ fn Run() { // CHECK:STDOUT: %.3: = complete_type_witness %.2 [template] // CHECK:STDOUT: %Run.type: type = fn_type @Run [template] // CHECK:STDOUT: %Run: %Run.type = struct_value () [template] -// CHECK:STDOUT: %.5: i32 = int_value 1 [template] -// CHECK:STDOUT: %.6: i32 = int_value 2 [template] +// CHECK:STDOUT: %.5: 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: %.29: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.30: = bound_method %.5, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 1 [template] +// CHECK:STDOUT: %.32: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.33: = bound_method %.32, %Convert.15 [template] +// CHECK:STDOUT: %.34: i32 = int_value 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -80,13 +89,21 @@ fn Run() { // CHECK:STDOUT: %c.ref.loc18: ref %Class = name_ref c, %c // CHECK:STDOUT: %j.ref.loc18: %.1 = name_ref j, @Class.%.loc12_8 [template = @Class.%.loc12_8] // CHECK:STDOUT: %.loc18_4: ref i32 = class_element_access %c.ref.loc18, element0 -// CHECK:STDOUT: %.loc18_9: i32 = int_value 1 [template = constants.%.5] -// CHECK:STDOUT: assign %.loc18_4, %.loc18_9 +// CHECK:STDOUT: %.loc18_9: Core.IntLiteral = int_value 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc18_7.1: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc18_7.2: = bound_method %.loc18_9, %.loc18_7.1 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc18: init i32 = call %.loc18_7.2(%.loc18_9) [template = constants.%.31] +// CHECK:STDOUT: %.loc18_7.3: init i32 = converted %.loc18_9, %int.convert_checked.loc18 [template = constants.%.31] +// CHECK:STDOUT: assign %.loc18_4, %.loc18_7.3 // CHECK:STDOUT: %c.ref.loc19: ref %Class = name_ref c, %c // CHECK:STDOUT: %k.ref.loc19: %.1 = name_ref k, @Class.%.loc13_8 [template = @Class.%.loc13_8] // CHECK:STDOUT: %.loc19_4: ref i32 = class_element_access %c.ref.loc19, element1 -// CHECK:STDOUT: %.loc19_9: i32 = int_value 2 [template = constants.%.6] -// CHECK:STDOUT: assign %.loc19_4, %.loc19_9 +// CHECK:STDOUT: %.loc19_9: Core.IntLiteral = int_value 2 [template = constants.%.32] +// CHECK:STDOUT: %.loc19_7.1: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc19_7.2: = bound_method %.loc19_9, %.loc19_7.1 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc19: init i32 = call %.loc19_7.2(%.loc19_9) [template = constants.%.34] +// CHECK:STDOUT: %.loc19_7.3: init i32 = converted %.loc19_9, %int.convert_checked.loc19 [template = constants.%.34] +// CHECK:STDOUT: assign %.loc19_4, %.loc19_7.3 // CHECK:STDOUT: %int.make_type_32.loc20: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc20_11.1: type = value_of_initializer %int.make_type_32.loc20 [template = i32] // CHECK:STDOUT: %.loc20_11.2: type = converted %int.make_type_32.loc20, %.loc20_11.1 [template = i32] diff --git a/toolchain/check/testdata/class/field_access_in_value.carbon b/toolchain/check/testdata/class/field_access_in_value.carbon index 46e8ced9d6e5d..7db89460b93e2 100644 --- a/toolchain/check/testdata/class/field_access_in_value.carbon +++ b/toolchain/check/testdata/class/field_access_in_value.carbon @@ -33,13 +33,22 @@ fn Test() { // CHECK:STDOUT: %.3: = complete_type_witness %.2 [template] // CHECK:STDOUT: %Test.type: type = fn_type @Test [template] // CHECK:STDOUT: %Test: %Test.type = struct_value () [template] -// CHECK:STDOUT: %.5: i32 = int_value 1 [template] -// CHECK:STDOUT: %.6: i32 = int_value 2 [template] +// CHECK:STDOUT: %.5: 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: %.29: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.30: = bound_method %.5, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 1 [template] +// CHECK:STDOUT: %.32: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.33: = bound_method %.32, %Convert.15 [template] +// CHECK:STDOUT: %.34: i32 = int_value 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -81,13 +90,21 @@ fn Test() { // CHECK:STDOUT: %cv.ref.loc18: ref %Class = name_ref cv, %cv // CHECK:STDOUT: %j.ref.loc18: %.1 = name_ref j, @Class.%.loc12_8 [template = @Class.%.loc12_8] // CHECK:STDOUT: %.loc18_5: ref i32 = class_element_access %cv.ref.loc18, element0 -// CHECK:STDOUT: %.loc18_10: i32 = int_value 1 [template = constants.%.5] -// CHECK:STDOUT: assign %.loc18_5, %.loc18_10 +// CHECK:STDOUT: %.loc18_10: Core.IntLiteral = int_value 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc18_8.1: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc18_8.2: = bound_method %.loc18_10, %.loc18_8.1 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc18: init i32 = call %.loc18_8.2(%.loc18_10) [template = constants.%.31] +// CHECK:STDOUT: %.loc18_8.3: init i32 = converted %.loc18_10, %int.convert_checked.loc18 [template = constants.%.31] +// CHECK:STDOUT: assign %.loc18_5, %.loc18_8.3 // CHECK:STDOUT: %cv.ref.loc19: ref %Class = name_ref cv, %cv // CHECK:STDOUT: %k.ref.loc19: %.1 = name_ref k, @Class.%.loc13_8 [template = @Class.%.loc13_8] // CHECK:STDOUT: %.loc19_5: ref i32 = class_element_access %cv.ref.loc19, element1 -// CHECK:STDOUT: %.loc19_10: i32 = int_value 2 [template = constants.%.6] -// CHECK:STDOUT: assign %.loc19_5, %.loc19_10 +// CHECK:STDOUT: %.loc19_10: Core.IntLiteral = int_value 2 [template = constants.%.32] +// CHECK:STDOUT: %.loc19_8.1: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc19_8.2: = bound_method %.loc19_10, %.loc19_8.1 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc19: init i32 = call %.loc19_8.2(%.loc19_10) [template = constants.%.34] +// CHECK:STDOUT: %.loc19_8.3: init i32 = converted %.loc19_10, %int.convert_checked.loc19 [template = constants.%.34] +// CHECK:STDOUT: assign %.loc19_5, %.loc19_8.3 // CHECK:STDOUT: %Class.ref.loc20: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %cv.ref.loc20: ref %Class = name_ref cv, %cv // CHECK:STDOUT: %.loc20: %Class = bind_value %cv.ref.loc20 diff --git a/toolchain/check/testdata/class/generic/call.carbon b/toolchain/check/testdata/class/generic/call.carbon index 16033f7787526..e408a84306e07 100644 --- a/toolchain/check/testdata/class/generic/call.carbon +++ b/toolchain/check/testdata/class/generic/call.carbon @@ -55,10 +55,10 @@ library "[[@TEST_NAME]]"; class Class(T:! type, N:! i32) {} -// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+9]]:8: error: cannot implicitly convert from `i32` to `type` [ImplicitAsConversionFailure] +// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+9]]:8: error: cannot implicitly convert from `Core.IntLiteral` to `type` [ImplicitAsConversionFailure] // CHECK:STDERR: var a: Class(5, i32*); // CHECK:STDERR: ^~~~~~ -// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+6]]:8: note: type `i32` does not implement interface `ImplicitAs(type)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+6]]:8: note: type `Core.IntLiteral` does not implement interface `ImplicitAs(type)` [MissingImplInMemberAccessNote] // CHECK:STDERR: var a: Class(5, i32*); // CHECK:STDERR: ^~~~~~ // CHECK:STDERR: fail_no_conversion.carbon:[[@LINE-8]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] @@ -93,23 +93,32 @@ class Outer(T:! type) { // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %N: i32 = bind_symbolic_name N, 1 [symbolic] -// CHECK:STDOUT: %N.patt: i32 = symbolic_binding_pattern N, 1 [symbolic] +// CHECK:STDOUT: %N.1: i32 = bind_symbolic_name N, 1 [symbolic] +// CHECK:STDOUT: %N.patt.1: i32 = symbolic_binding_pattern N, 1 [symbolic] // CHECK:STDOUT: %Class.type: type = generic_class_type @Class [template] // CHECK:STDOUT: %Class.1: %Class.type = struct_value () [template] -// CHECK:STDOUT: %Class.2: type = class_type @Class, @Class(%T, %N) [symbolic] +// CHECK:STDOUT: %Class.2: type = class_type @Class, @Class(%T, %N.1) [symbolic] // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: = complete_type_witness %.1 [template] // CHECK:STDOUT: %.3: type = ptr_type i32 [template] -// CHECK:STDOUT: %.4: i32 = int_value 5 [template] -// CHECK:STDOUT: %Class.3: type = class_type @Class, @Class(%.3, %.4) [template] -// CHECK:STDOUT: %.6: i32 = int_value 0 [template] -// CHECK:STDOUT: %Class.4: type = class_type @Class, @Class(%empty_tuple.type, %.6) [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 5 [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: %.28: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.29: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 5 [template] +// CHECK:STDOUT: %Class.3: type = class_type @Class, @Class(%.3, %.30) [template] +// CHECK:STDOUT: %.32: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %.33: = bound_method %.32, %Convert.15 [template] +// CHECK:STDOUT: %.34: i32 = int_value 0 [template] +// CHECK:STDOUT: %Class.4: type = class_type @Class, @Class(%empty_tuple.type, %.34) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -126,8 +135,8 @@ class Outer(T:! type) { // CHECK:STDOUT: %Class.decl: %Class.type = class_decl @Class [template = constants.%Class.1] { // CHECK:STDOUT: %T.patt.loc4_13.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_13.2 (constants.%T.patt)] // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc4_13.1, runtime_param [symbolic = %T.patt.loc4_13.2 (constants.%T.patt)] -// CHECK:STDOUT: %N.patt.loc4_23.1: i32 = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc4_23.2 (constants.%N.patt)] -// CHECK:STDOUT: %N.param_patt: i32 = value_param_pattern %N.patt.loc4_23.1, runtime_param [symbolic = %N.patt.loc4_23.2 (constants.%N.patt)] +// CHECK:STDOUT: %N.patt.loc4_23.1: i32 = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc4_23.2 (constants.%N.patt.1)] +// CHECK:STDOUT: %N.param_patt: i32 = value_param_pattern %N.patt.loc4_23.1, runtime_param [symbolic = %N.patt.loc4_23.2 (constants.%N.patt.1)] // CHECK:STDOUT: } { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc4_27.1: type = value_of_initializer %int.make_type_32 [template = i32] @@ -135,22 +144,32 @@ class Outer(T:! type) { // CHECK:STDOUT: %T.param: type = value_param runtime_param // CHECK:STDOUT: %T.loc4_13.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc4_13.2 (constants.%T)] // CHECK:STDOUT: %N.param: i32 = value_param runtime_param -// CHECK:STDOUT: %N.loc4_23.1: i32 = bind_symbolic_name N, 1, %N.param [symbolic = %N.loc4_23.2 (constants.%N)] +// CHECK:STDOUT: %N.loc4_23.1: i32 = bind_symbolic_name N, 1, %N.param [symbolic = %N.loc4_23.2 (constants.%N.1)] // CHECK:STDOUT: } // CHECK:STDOUT: %Class.ref.loc6: %Class.type = name_ref Class, %Class.decl [template = constants.%Class.1] // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc6_17.1: type = value_of_initializer %int.make_type_32 [template = i32] // CHECK:STDOUT: %.loc6_17.2: type = converted %int.make_type_32, %.loc6_17.1 [template = i32] // CHECK:STDOUT: %.loc6_17.3: type = ptr_type i32 [template = constants.%.3] -// CHECK:STDOUT: %.loc6_20: i32 = int_value 5 [template = constants.%.4] -// CHECK:STDOUT: %Class.loc6: type = class_type @Class, @Class(constants.%.3, constants.%.4) [template = constants.%Class.3] +// CHECK:STDOUT: %.loc6_20: Core.IntLiteral = int_value 5 [template = constants.%.4] +// CHECK:STDOUT: %.loc6_13.1: %Convert.type.2 = interface_witness_access constants.%.28, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc6_13.2: = bound_method %.loc6_20, %.loc6_13.1 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc6: init i32 = call %.loc6_13.2(%.loc6_20) [template = constants.%.30] +// CHECK:STDOUT: %.loc6_13.3: i32 = value_of_initializer %int.convert_checked.loc6 [template = constants.%.30] +// CHECK:STDOUT: %.loc6_13.4: i32 = converted %.loc6_20, %.loc6_13.3 [template = constants.%.30] +// CHECK:STDOUT: %Class.loc6: type = class_type @Class, @Class(constants.%.3, constants.%.30) [template = constants.%Class.3] // CHECK:STDOUT: %a.var: ref %Class.3 = var a // CHECK:STDOUT: %a: ref %Class.3 = bind_name a, %a.var // CHECK:STDOUT: %Class.ref.loc9: %Class.type = name_ref Class, %Class.decl [template = constants.%Class.1] // CHECK:STDOUT: %.loc9_15: %empty_tuple.type = tuple_literal () -// CHECK:STDOUT: %.loc9_18: i32 = int_value 0 [template = constants.%.6] -// CHECK:STDOUT: %.loc9_13: type = converted %.loc9_15, constants.%empty_tuple.type [template = constants.%empty_tuple.type] -// CHECK:STDOUT: %Class.loc9: type = class_type @Class, @Class(constants.%empty_tuple.type, constants.%.6) [template = constants.%Class.4] +// CHECK:STDOUT: %.loc9_18: Core.IntLiteral = int_value 0 [template = constants.%.32] +// CHECK:STDOUT: %.loc9_13.1: type = converted %.loc9_15, constants.%empty_tuple.type [template = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc9_13.2: %Convert.type.2 = interface_witness_access constants.%.28, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_13.3: = bound_method %.loc9_18, %.loc9_13.2 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc9: init i32 = call %.loc9_13.3(%.loc9_18) [template = constants.%.34] +// CHECK:STDOUT: %.loc9_13.4: i32 = value_of_initializer %int.convert_checked.loc9 [template = constants.%.34] +// CHECK:STDOUT: %.loc9_13.5: i32 = converted %.loc9_18, %.loc9_13.4 [template = constants.%.34] +// CHECK:STDOUT: %Class.loc9: type = class_type @Class, @Class(constants.%empty_tuple.type, constants.%.34) [template = constants.%Class.4] // CHECK:STDOUT: %b.var: ref %Class.4 = var b // CHECK:STDOUT: %b: ref %Class.4 = bind_name b, %b.var // CHECK:STDOUT: } @@ -158,8 +177,8 @@ class Outer(T:! type) { // CHECK:STDOUT: generic class @Class(%T.loc4_13.1: type, %N.loc4_23.1: i32) { // CHECK:STDOUT: %T.loc4_13.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_13.2 (constants.%T)] // CHECK:STDOUT: %T.patt.loc4_13.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_13.2 (constants.%T.patt)] -// CHECK:STDOUT: %N.loc4_23.2: i32 = bind_symbolic_name N, 1 [symbolic = %N.loc4_23.2 (constants.%N)] -// CHECK:STDOUT: %N.patt.loc4_23.2: i32 = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc4_23.2 (constants.%N.patt)] +// CHECK:STDOUT: %N.loc4_23.2: i32 = bind_symbolic_name N, 1 [symbolic = %N.loc4_23.2 (constants.%N.1)] +// CHECK:STDOUT: %N.patt.loc4_23.2: i32 = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc4_23.2 (constants.%N.patt.1)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -171,27 +190,27 @@ class Outer(T:! type) { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Class(constants.%T, constants.%N) { +// CHECK:STDOUT: specific @Class(constants.%T, constants.%N.1) { // CHECK:STDOUT: %T.loc4_13.2 => constants.%T // CHECK:STDOUT: %T.patt.loc4_13.2 => constants.%T -// CHECK:STDOUT: %N.loc4_23.2 => constants.%N -// CHECK:STDOUT: %N.patt.loc4_23.2 => constants.%N +// CHECK:STDOUT: %N.loc4_23.2 => constants.%N.1 +// CHECK:STDOUT: %N.patt.loc4_23.2 => constants.%N.1 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Class(constants.%.3, constants.%.4) { +// CHECK:STDOUT: specific @Class(constants.%.3, constants.%.30) { // CHECK:STDOUT: %T.loc4_13.2 => constants.%.3 // CHECK:STDOUT: %T.patt.loc4_13.2 => constants.%.3 -// CHECK:STDOUT: %N.loc4_23.2 => constants.%.4 -// CHECK:STDOUT: %N.patt.loc4_23.2 => constants.%.4 +// CHECK:STDOUT: %N.loc4_23.2 => constants.%.30 +// CHECK:STDOUT: %N.patt.loc4_23.2 => constants.%.30 // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Class(constants.%empty_tuple.type, constants.%.6) { +// CHECK:STDOUT: specific @Class(constants.%empty_tuple.type, constants.%.34) { // CHECK:STDOUT: %T.loc4_13.2 => constants.%empty_tuple.type // CHECK:STDOUT: %T.patt.loc4_13.2 => constants.%empty_tuple.type -// CHECK:STDOUT: %N.loc4_23.2 => constants.%.6 -// CHECK:STDOUT: %N.patt.loc4_23.2 => constants.%.6 +// CHECK:STDOUT: %N.loc4_23.2 => constants.%.34 +// CHECK:STDOUT: %N.patt.loc4_23.2 => constants.%.34 // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: } @@ -289,8 +308,8 @@ class Outer(T:! type) { // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: = complete_type_witness %.1 [template] // CHECK:STDOUT: %.3: type = ptr_type i32 [template] -// CHECK:STDOUT: %.4: i32 = int_value 1 [template] -// CHECK:STDOUT: %.5: i32 = int_value 2 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.5: Core.IntLiteral = int_value 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -327,8 +346,8 @@ class Outer(T:! type) { // CHECK:STDOUT: %.loc13_17.1: type = value_of_initializer %int.make_type_32 [template = i32] // CHECK:STDOUT: %.loc13_17.2: type = converted %int.make_type_32, %.loc13_17.1 [template = i32] // CHECK:STDOUT: %.loc13_17.3: type = ptr_type i32 [template = constants.%.3] -// CHECK:STDOUT: %.loc13_20: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc13_23: i32 = int_value 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc13_20: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc13_23: Core.IntLiteral = int_value 2 [template = constants.%.5] // CHECK:STDOUT: %a.var: ref = var a // CHECK:STDOUT: %a: ref = bind_name a, %a.var // CHECK:STDOUT: } @@ -370,7 +389,7 @@ class Outer(T:! type) { // CHECK:STDOUT: %Class.2: type = class_type @Class, @Class(%T, %N.1) [symbolic] // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: = complete_type_witness %.1 [template] -// CHECK:STDOUT: %.3: i32 = int_value 5 [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 5 [template] // CHECK:STDOUT: %.4: type = ptr_type i32 [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -405,7 +424,7 @@ class Outer(T:! type) { // CHECK:STDOUT: %N.loc4_23.1: i32 = bind_symbolic_name N, 1, %N.param [symbolic = %N.loc4_23.2 (constants.%N.1)] // CHECK:STDOUT: } // CHECK:STDOUT: %Class.ref: %Class.type = name_ref Class, %Class.decl [template = constants.%Class.1] -// CHECK:STDOUT: %.loc15_14: i32 = int_value 5 [template = constants.%.3] +// CHECK:STDOUT: %.loc15_14: Core.IntLiteral = int_value 5 [template = constants.%.3] // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc15_20.1: type = value_of_initializer %int.make_type_32 [template = i32] // CHECK:STDOUT: %.loc15_20.2: type = converted %int.make_type_32, %.loc15_20.1 [template = i32] diff --git a/toolchain/check/testdata/class/generic/import.carbon b/toolchain/check/testdata/class/generic/import.carbon index 7c07e8a0312a5..05c1bc66a84fe 100644 --- a/toolchain/check/testdata/class/generic/import.carbon +++ b/toolchain/check/testdata/class/generic/import.carbon @@ -101,7 +101,13 @@ class Class(U:! type) { // CHECK:STDOUT: %F.1: %F.type.1 = struct_value () [symbolic] // CHECK:STDOUT: %.2: type = struct_type {.n: i32} [template] // CHECK:STDOUT: %.3: = complete_type_witness %.2 [template] -// CHECK:STDOUT: %.4: i32 = int_value 0 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 0 [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: %.28: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.29: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 0 [template] // CHECK:STDOUT: %CompleteClass.3: type = class_type @CompleteClass, @CompleteClass(i32) [template] // CHECK:STDOUT: %F.type.2: type = fn_type @F.2 [template] // CHECK:STDOUT: %F.2: %F.type.2 = struct_value () [template] @@ -109,7 +115,8 @@ class Class(U:! type) { // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -197,8 +204,13 @@ class Class(U:! type) { // CHECK:STDOUT: // CHECK:STDOUT: fn() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8_26: i32 = int_value 0 [template = constants.%.4] -// CHECK:STDOUT: return %.loc8_26 +// CHECK:STDOUT: %.loc8_26: Core.IntLiteral = int_value 0 [template = constants.%.4] +// CHECK:STDOUT: %.loc8_27.1: %Convert.type.2 = interface_witness_access constants.%.28, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc8_27.2: = bound_method %.loc8_26, %.loc8_27.1 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc8_27.2(%.loc8_26) [template = constants.%.30] +// CHECK:STDOUT: %.loc8_27.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.30] +// CHECK:STDOUT: %.loc8_27.4: i32 = converted %.loc8_26, %.loc8_27.3 [template = constants.%.30] +// CHECK:STDOUT: return %.loc8_27.4 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -235,19 +247,86 @@ class Class(U:! type) { // CHECK:STDOUT: --- foo.impl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.2: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic] +// CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2) = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.3: type = facet_type <@ImplicitAs, @ImplicitAs(i32)> [template] +// CHECK:STDOUT: %Self.2: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Convert.type.1: type = fn_type @Convert.1, @ImplicitAs(%Dest) [symbolic] +// CHECK:STDOUT: %Convert.1: %Convert.type.1 = struct_value () [symbolic] +// CHECK:STDOUT: %.1: type = assoc_entity_type %ImplicitAs.type.2, %Convert.type.1 [symbolic] +// CHECK:STDOUT: %.2: %.1 = assoc_entity element0, imports.%import_ref.10 [symbolic] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(i32) [template] +// CHECK:STDOUT: %Convert.2: %Convert.type.2 = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type %ImplicitAs.type.3, %Convert.type.2 [template] +// CHECK:STDOUT: %.4: %.3 = assoc_entity element0, imports.%import_ref.11 [template] +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic] +// CHECK:STDOUT: %.5: type = int_type signed, %N [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.4: type = facet_type <@ImplicitAs, @ImplicitAs(%.5)> [symbolic] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.3: type = fn_type @Convert.2, @impl.2(%N) [symbolic] +// CHECK:STDOUT: %Convert.3: %Convert.type.3 = struct_value () [symbolic] +// CHECK:STDOUT: %.6: = interface_witness (%Convert.3) [symbolic] +// CHECK:STDOUT: %.7: type = int_type unsigned, %N [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.5: type = facet_type <@ImplicitAs, @ImplicitAs(%.7)> [symbolic] +// CHECK:STDOUT: %Convert.type.4: type = fn_type @Convert.3, @impl.3(%N) [symbolic] +// CHECK:STDOUT: %Convert.4: %Convert.type.4 = struct_value () [symbolic] +// CHECK:STDOUT: %.8: = interface_witness (%Convert.4) [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.6: type = facet_type <@ImplicitAs, @ImplicitAs(Core.IntLiteral)> [template] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %Convert.5: %Convert.type.5 = struct_value () [template] +// CHECK:STDOUT: %.9: type = assoc_entity_type %ImplicitAs.type.6, %Convert.type.5 [template] +// CHECK:STDOUT: %.10: %.9 = assoc_entity element0, imports.%import_ref.21 [template] +// CHECK:STDOUT: %Convert.type.6: type = fn_type @Convert.4, @impl.5(%N) [symbolic] +// CHECK:STDOUT: %Convert.6: %Convert.type.6 = struct_value () [symbolic] +// CHECK:STDOUT: %.11: = interface_witness (%Convert.6) [symbolic] +// CHECK:STDOUT: %Convert.type.7: type = fn_type @Convert.5, @impl.6(%N) [symbolic] +// CHECK:STDOUT: %Convert.7: %Convert.type.7 = struct_value () [symbolic] +// CHECK:STDOUT: %.12: = interface_witness (%Convert.7) [symbolic] +// CHECK:STDOUT: %As.type.2: type = facet_type <@As, @As(%Dest)> [symbolic] +// CHECK:STDOUT: %Self.3: @As.%As.type (%As.type.2) = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %As.type.3: type = facet_type <@As, @As(i32)> [template] +// CHECK:STDOUT: %Self.4: %As.type.2 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Convert.type.8: type = fn_type @Convert.6, @As(%Dest) [symbolic] +// CHECK:STDOUT: %Convert.8: %Convert.type.8 = struct_value () [symbolic] +// CHECK:STDOUT: %.13: type = assoc_entity_type %As.type.2, %Convert.type.8 [symbolic] +// CHECK:STDOUT: %.14: %.13 = assoc_entity element0, imports.%import_ref.34 [symbolic] +// CHECK:STDOUT: %Convert.type.9: type = fn_type @Convert.6, @As(i32) [template] +// CHECK:STDOUT: %Convert.9: %Convert.type.9 = struct_value () [template] +// CHECK:STDOUT: %.15: type = assoc_entity_type %As.type.3, %Convert.type.9 [template] +// CHECK:STDOUT: %.16: %.15 = assoc_entity element0, imports.%import_ref.35 [template] +// CHECK:STDOUT: %As.type.4: type = facet_type <@As, @As(%.5)> [symbolic] +// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.7, @impl.8(%N) [symbolic] +// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [symbolic] +// CHECK:STDOUT: %.17: = interface_witness (%Convert.10) [symbolic] +// CHECK:STDOUT: %As.type.5: type = facet_type <@As, @As(%.7)> [symbolic] +// CHECK:STDOUT: %Convert.type.11: type = fn_type @Convert.8, @impl.9(%N) [symbolic] +// CHECK:STDOUT: %Convert.11: %Convert.type.11 = struct_value () [symbolic] +// CHECK:STDOUT: %.18: = interface_witness (%Convert.11) [symbolic] +// CHECK:STDOUT: %As.type.6: type = facet_type <@As, @As(Core.IntLiteral)> [template] +// CHECK:STDOUT: %Convert.type.12: type = fn_type @Convert.6, @As(Core.IntLiteral) [template] +// CHECK:STDOUT: %Convert.12: %Convert.type.12 = struct_value () [template] +// CHECK:STDOUT: %.19: type = assoc_entity_type %As.type.6, %Convert.type.12 [template] +// CHECK:STDOUT: %.20: %.19 = assoc_entity element0, imports.%import_ref.45 [template] +// CHECK:STDOUT: %Convert.type.13: type = fn_type @Convert.9, @impl.11(%N) [symbolic] +// CHECK:STDOUT: %Convert.13: %Convert.type.13 = struct_value () [symbolic] +// CHECK:STDOUT: %.21: = interface_witness (%Convert.13) [symbolic] +// CHECK:STDOUT: %Convert.type.14: type = fn_type @Convert.10, @impl.12(%N) [symbolic] +// CHECK:STDOUT: %Convert.14: %Convert.type.14 = struct_value () [symbolic] +// CHECK:STDOUT: %.22: = interface_witness (%Convert.14) [symbolic] // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic] // CHECK:STDOUT: %Class.type: type = generic_class_type @Class [template] // CHECK:STDOUT: %Class.1: %Class.type = struct_value () [template] // CHECK:STDOUT: %Class.2: type = class_type @Class, @Class(%T) [symbolic] -// CHECK:STDOUT: %.1: type = unbound_element_type %Class.2, %T [symbolic] -// CHECK:STDOUT: %.2: type = struct_type {.x: %T} [symbolic] -// CHECK:STDOUT: %.3: = complete_type_witness %.2 [symbolic] +// CHECK:STDOUT: %.23: type = unbound_element_type %Class.2, %T [symbolic] +// CHECK:STDOUT: %.24: type = struct_type {.x: %T} [symbolic] +// CHECK:STDOUT: %.25: = complete_type_witness %.24 [symbolic] // CHECK:STDOUT: %CompleteClass.type: type = generic_class_type @CompleteClass [template] // CHECK:STDOUT: %CompleteClass.1: %CompleteClass.type = struct_value () [template] -// CHECK:STDOUT: %.4: type = struct_type {.n: i32} [template] // CHECK:STDOUT: %CompleteClass.2: type = class_type @CompleteClass, @CompleteClass(%T) [symbolic] -// CHECK:STDOUT: %.6: type = unbound_element_type %CompleteClass.2, i32 [symbolic] +// CHECK:STDOUT: %.28: type = unbound_element_type %CompleteClass.2, i32 [symbolic] // CHECK:STDOUT: %F.type.1: type = fn_type @F.1, @CompleteClass(%T) [symbolic] // CHECK:STDOUT: %F.1: %F.type.1 = struct_value () [symbolic] // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] @@ -255,23 +334,75 @@ class Class(U:! type) { // CHECK:STDOUT: %CompleteClass.3: type = class_type @CompleteClass, @CompleteClass(i32) [template] // CHECK:STDOUT: %F.type.2: type = fn_type @F.2 [template] // CHECK:STDOUT: %F.2: %F.type.2 = struct_value () [template] -// CHECK:STDOUT: %.7: type = unbound_element_type %CompleteClass.3, i32 [template] +// CHECK:STDOUT: %.29: type = unbound_element_type %CompleteClass.3, i32 [template] // CHECK:STDOUT: %F.type.3: type = fn_type @F.1, @CompleteClass(i32) [template] // CHECK:STDOUT: %F.3: %F.type.3 = struct_value () [template] -// CHECK:STDOUT: %.9: i32 = int_value 1 [template] -// CHECK:STDOUT: %struct: %CompleteClass.3 = struct_value (%.9) [template] +// CHECK:STDOUT: %.31: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.32: type = struct_type {.n: Core.IntLiteral} [template] +// CHECK:STDOUT: %.33: %.1 = assoc_entity element0, imports.%import_ref.57 [symbolic] +// CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template] +// CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template] +// CHECK:STDOUT: %.34: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.35: = bound_method %.31, %Convert.15 [template] +// CHECK:STDOUT: %.36: i32 = int_value 1 [template] +// CHECK:STDOUT: %struct: %CompleteClass.3 = struct_value (%.36) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %import_ref.2: %CompleteClass.type = import_ref Main//foo, inst+20, loaded [template = constants.%CompleteClass.1] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref.7 +// CHECK:STDOUT: .Int32 = %import_ref.55 +// CHECK:STDOUT: .ImplicitAs = %import_ref.56 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.4 = import_ref Main//foo, inst+25, unloaded -// CHECK:STDOUT: %import_ref.5 = import_ref Main//foo, inst+37, unloaded -// CHECK:STDOUT: %import_ref.6 = import_ref Main//foo, inst+45, unloaded +// CHECK:STDOUT: %import_ref.4 = import_ref Main//foo, inst+69, unloaded +// CHECK:STDOUT: %import_ref.5: @ImplicitAs.%.1 (%.1) = import_ref Main//foo, inst+70, loaded [symbolic = @ImplicitAs.%.2 (constants.%.33)] +// CHECK:STDOUT: %import_ref.6 = import_ref Main//foo, inst+71, unloaded +// CHECK:STDOUT: %import_ref.7: type = import_ref Main//foo, inst+105, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.8: type = import_ref Main//foo, inst+106, loaded [template = constants.%ImplicitAs.type.3] +// CHECK:STDOUT: %import_ref.9: = import_ref Main//foo, inst+107, loaded [template = constants.%.34] +// CHECK:STDOUT: %import_ref.10 = import_ref Main//foo, inst+86, unloaded +// CHECK:STDOUT: %import_ref.12: type = import_ref Main//foo, inst+117, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.13: type = import_ref Main//foo, inst+118, loaded [symbolic = @impl.2.%ImplicitAs.type (constants.%ImplicitAs.type.4)] +// CHECK:STDOUT: %import_ref.14 = import_ref Main//foo, inst+119, unloaded +// CHECK:STDOUT: %import_ref.15: type = import_ref Main//foo, inst+147, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.16: type = import_ref Main//foo, inst+148, loaded [symbolic = @impl.3.%ImplicitAs.type (constants.%ImplicitAs.type.5)] +// CHECK:STDOUT: %import_ref.17 = import_ref Main//foo, inst+149, unloaded +// CHECK:STDOUT: %import_ref.18: type = import_ref Main//foo, inst+172, loaded [template = i32] +// CHECK:STDOUT: %import_ref.19: type = import_ref Main//foo, inst+173, loaded [template = constants.%ImplicitAs.type.6] +// CHECK:STDOUT: %import_ref.20 = import_ref Main//foo, inst+174, unloaded +// CHECK:STDOUT: %import_ref.22: type = import_ref Main//foo, inst+185, loaded [symbolic = @impl.5.%.1 (constants.%.5)] +// CHECK:STDOUT: %import_ref.23: type = import_ref Main//foo, inst+186, loaded [template = constants.%ImplicitAs.type.6] +// CHECK:STDOUT: %import_ref.24 = import_ref Main//foo, inst+187, unloaded +// CHECK:STDOUT: %import_ref.25: type = import_ref Main//foo, inst+212, loaded [symbolic = @impl.6.%.1 (constants.%.7)] +// CHECK:STDOUT: %import_ref.26: type = import_ref Main//foo, inst+213, loaded [template = constants.%ImplicitAs.type.6] +// CHECK:STDOUT: %import_ref.27 = import_ref Main//foo, inst+214, unloaded +// CHECK:STDOUT: %import_ref.28 = import_ref Main//foo, inst+244, unloaded +// CHECK:STDOUT: %import_ref.29 = import_ref Main//foo, inst+245, unloaded +// CHECK:STDOUT: %import_ref.30 = import_ref Main//foo, inst+246, unloaded +// CHECK:STDOUT: %import_ref.31: type = import_ref Main//foo, inst+248, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.32: type = import_ref Main//foo, inst+249, loaded [template = constants.%As.type.3] +// CHECK:STDOUT: %import_ref.33 = import_ref Main//foo, inst+250, unloaded +// CHECK:STDOUT: %import_ref.34 = import_ref Main//foo, inst+265, unloaded +// CHECK:STDOUT: %import_ref.36: type = import_ref Main//foo, inst+287, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.37: type = import_ref Main//foo, inst+288, loaded [symbolic = @impl.8.%As.type (constants.%As.type.4)] +// CHECK:STDOUT: %import_ref.38 = import_ref Main//foo, inst+289, unloaded +// CHECK:STDOUT: %import_ref.39: type = import_ref Main//foo, inst+316, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.40: type = import_ref Main//foo, inst+317, loaded [symbolic = @impl.9.%As.type (constants.%As.type.5)] +// CHECK:STDOUT: %import_ref.41 = import_ref Main//foo, inst+318, unloaded +// CHECK:STDOUT: %import_ref.42: type = import_ref Main//foo, inst+341, loaded [template = i32] +// CHECK:STDOUT: %import_ref.43: type = import_ref Main//foo, inst+342, loaded [template = constants.%As.type.6] +// CHECK:STDOUT: %import_ref.44 = import_ref Main//foo, inst+343, unloaded +// CHECK:STDOUT: %import_ref.46: type = import_ref Main//foo, inst+354, loaded [symbolic = @impl.11.%.1 (constants.%.5)] +// CHECK:STDOUT: %import_ref.47: type = import_ref Main//foo, inst+355, loaded [template = constants.%As.type.6] +// CHECK:STDOUT: %import_ref.48 = import_ref Main//foo, inst+356, unloaded +// CHECK:STDOUT: %import_ref.49: type = import_ref Main//foo, inst+381, loaded [symbolic = @impl.12.%.1 (constants.%.7)] +// CHECK:STDOUT: %import_ref.50: type = import_ref Main//foo, inst+382, loaded [template = constants.%As.type.6] +// CHECK:STDOUT: %import_ref.51 = import_ref Main//foo, inst+383, unloaded +// CHECK:STDOUT: %import_ref.52 = import_ref Main//foo, inst+25, unloaded +// CHECK:STDOUT: %import_ref.53 = import_ref Main//foo, inst+37, unloaded +// CHECK:STDOUT: %import_ref.54 = import_ref Main//foo, inst+45, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -305,20 +436,212 @@ class Class(U:! type) { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(constants.%Dest: type) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)] +// CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.1, @ImplicitAs(%Dest) [symbolic = %Convert.type (constants.%Convert.type.1)] +// CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.1) = struct_value () [symbolic = %Convert (constants.%Convert.1)] +// CHECK:STDOUT: %.1: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2), @ImplicitAs.%Convert.type (%Convert.type.1) [symbolic = %.1 (constants.%.1)] +// CHECK:STDOUT: %.2: @ImplicitAs.%.1 (%.1) = assoc_entity element0, imports.%import_ref.10 [symbolic = %.2 (constants.%.2)] +// CHECK:STDOUT: +// CHECK:STDOUT: interface { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%import_ref.4 +// CHECK:STDOUT: .Convert = imports.%import_ref.5 +// CHECK:STDOUT: witness = (imports.%import_ref.6) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @As(constants.%Dest: type) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest)> [symbolic = %As.type (constants.%As.type.2)] +// CHECK:STDOUT: %Self: %As.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.4)] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.6, @As(%Dest) [symbolic = %Convert.type (constants.%Convert.type.8)] +// CHECK:STDOUT: %Convert: @As.%Convert.type (%Convert.type.8) = struct_value () [symbolic = %Convert (constants.%Convert.8)] +// CHECK:STDOUT: %.1: type = assoc_entity_type @As.%As.type (%As.type.2), @As.%Convert.type (%Convert.type.8) [symbolic = %.1 (constants.%.13)] +// CHECK:STDOUT: %.2: @As.%.1 (%.13) = assoc_entity element0, imports.%import_ref.34 [symbolic = %.2 (constants.%.14)] +// CHECK:STDOUT: +// CHECK:STDOUT: interface { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%import_ref.28 +// CHECK:STDOUT: .Convert = imports.%import_ref.29 +// CHECK:STDOUT: witness = (imports.%import_ref.30) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.1: imports.%import_ref.7 as imports.%import_ref.8 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.9 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.2(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%.1)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.4)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.2, @impl.2(%N) [symbolic = %Convert.type (constants.%Convert.type.3)] +// CHECK:STDOUT: %Convert: @impl.2.%Convert.type (%Convert.type.3) = struct_value () [symbolic = %Convert (constants.%Convert.3)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.6)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.12 as imports.%import_ref.13 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.14 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.3(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%.1)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.3, @impl.3(%N) [symbolic = %Convert.type (constants.%Convert.type.4)] +// CHECK:STDOUT: %Convert: @impl.3.%Convert.type (%Convert.type.4) = struct_value () [symbolic = %Convert (constants.%Convert.4)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.8)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.15 as imports.%import_ref.16 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.17 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.4: imports.%import_ref.18 as imports.%import_ref.19 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.20 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.5(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.4, @impl.5(%N) [symbolic = %Convert.type (constants.%Convert.type.6)] +// CHECK:STDOUT: %Convert: @impl.5.%Convert.type (%Convert.type.6) = struct_value () [symbolic = %Convert (constants.%Convert.6)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.11)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.22 as imports.%import_ref.23 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.24 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.6(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.5, @impl.6(%N) [symbolic = %Convert.type (constants.%Convert.type.7)] +// CHECK:STDOUT: %Convert: @impl.6.%Convert.type (%Convert.type.7) = struct_value () [symbolic = %Convert (constants.%Convert.7)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.12)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.25 as imports.%import_ref.26 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.27 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.7: imports.%import_ref.31 as imports.%import_ref.32 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.33 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.8(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%.1)> [symbolic = %As.type (constants.%As.type.4)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.7, @impl.8(%N) [symbolic = %Convert.type (constants.%Convert.type.10)] +// CHECK:STDOUT: %Convert: @impl.8.%Convert.type (%Convert.type.10) = struct_value () [symbolic = %Convert (constants.%Convert.10)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.17)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.36 as imports.%import_ref.37 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.38 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.9(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%.1)> [symbolic = %As.type (constants.%As.type.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.8, @impl.9(%N) [symbolic = %Convert.type (constants.%Convert.type.11)] +// CHECK:STDOUT: %Convert: @impl.9.%Convert.type (%Convert.type.11) = struct_value () [symbolic = %Convert (constants.%Convert.11)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.18)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.39 as imports.%import_ref.40 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.41 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.10: imports.%import_ref.42 as imports.%import_ref.43 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.44 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.11(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.9, @impl.11(%N) [symbolic = %Convert.type (constants.%Convert.type.13)] +// CHECK:STDOUT: %Convert: @impl.11.%Convert.type (%Convert.type.13) = struct_value () [symbolic = %Convert (constants.%Convert.13)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.21)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.46 as imports.%import_ref.47 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.48 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.12(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.10, @impl.12(%N) [symbolic = %Convert.type (constants.%Convert.type.14)] +// CHECK:STDOUT: %Convert: @impl.12.%Convert.type (%Convert.type.14) = struct_value () [symbolic = %Convert (constants.%Convert.14)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.22)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.49 as imports.%import_ref.50 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.51 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: generic class @Class(constants.%T: type) { // CHECK:STDOUT: %T.1: type = bind_symbolic_name T, 0 [symbolic = %T.1 (constants.%T)] // CHECK:STDOUT: %T.patt.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.1 (constants.%T.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %Class: type = class_type @Class, @Class(%T.1) [symbolic = %Class (constants.%Class.2)] -// CHECK:STDOUT: %.loc5_8.2: type = unbound_element_type @Class.%Class (%Class.2), @Class.%T.1 (%T) [symbolic = %.loc5_8.2 (constants.%.1)] -// CHECK:STDOUT: %.loc6_1.2: type = struct_type {.x: @Class.%T.1 (%T)} [symbolic = %.loc6_1.2 (constants.%.2)] -// CHECK:STDOUT: %.loc6_1.3: = complete_type_witness @Class.%.loc6_1.2 (%.2) [symbolic = %.loc6_1.3 (constants.%.3)] +// CHECK:STDOUT: %.loc5_8.2: type = unbound_element_type @Class.%Class (%Class.2), @Class.%T.1 (%T) [symbolic = %.loc5_8.2 (constants.%.23)] +// CHECK:STDOUT: %.loc6_1.2: type = struct_type {.x: @Class.%T.1 (%T)} [symbolic = %.loc6_1.2 (constants.%.24)] +// CHECK:STDOUT: %.loc6_1.3: = complete_type_witness @Class.%.loc6_1.2 (%.24) [symbolic = %.loc6_1.3 (constants.%.25)] // CHECK:STDOUT: // CHECK:STDOUT: class { // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc4 [symbolic = %T.1 (constants.%T)] -// CHECK:STDOUT: %.loc5_8.1: @Class.%.loc5_8.2 (%.1) = field_decl x, element0 [template] -// CHECK:STDOUT: %.loc6_1.1: = complete_type_witness %.2 [symbolic = %.loc6_1.3 (constants.%.3)] +// CHECK:STDOUT: %.loc5_8.1: @Class.%.loc5_8.2 (%.23) = field_decl x, element0 [template] +// CHECK:STDOUT: %.loc6_1.1: = complete_type_witness %.24 [symbolic = %.loc6_1.3 (constants.%.25)] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class.2 @@ -332,18 +655,106 @@ class Class(U:! type) { // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %CompleteClass: type = class_type @CompleteClass, @CompleteClass(%T) [symbolic = %CompleteClass (constants.%CompleteClass.2)] -// CHECK:STDOUT: %.1: type = unbound_element_type @CompleteClass.%CompleteClass (%CompleteClass.2), i32 [symbolic = %.1 (constants.%.6)] +// CHECK:STDOUT: %.1: type = unbound_element_type @CompleteClass.%CompleteClass (%CompleteClass.2), i32 [symbolic = %.1 (constants.%.28)] // CHECK:STDOUT: %F.type: type = fn_type @F.1, @CompleteClass(%T) [symbolic = %F.type (constants.%F.type.1)] // CHECK:STDOUT: %F: @CompleteClass.%F.type (%F.type.1) = struct_value () [symbolic = %F (constants.%F.1)] // CHECK:STDOUT: // CHECK:STDOUT: class { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = imports.%import_ref.4 -// CHECK:STDOUT: .n = imports.%import_ref.5 -// CHECK:STDOUT: .F = imports.%import_ref.6 +// CHECK:STDOUT: .Self = imports.%import_ref.52 +// CHECK:STDOUT: .n = imports.%import_ref.53 +// CHECK:STDOUT: .F = imports.%import_ref.54 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.1(constants.%Dest: type, constants.%Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2)) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)] +// CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.1.%Self (%Self.2)]() -> @Convert.1.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.2(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.2.%.1 (%.5) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.3(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.3.%.1 (%.7) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.4(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.4.%.1 (%.5)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.5(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.5.%.1 (%.7)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.6(constants.%Dest: type, constants.%Self.3: @As.%As.type (%As.type.2)) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest)> [symbolic = %As.type (constants.%As.type.2)] +// CHECK:STDOUT: %Self: %As.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.4)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.6.%Self (%Self.4)]() -> @Convert.6.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.7(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.7.%.1 (%.5) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.8(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.8.%.1 (%.7) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.9(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.9.%.1 (%.5)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.10(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.10.%.1 (%.7)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: generic fn @F.1(constants.%T: type) { // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -352,15 +763,299 @@ class Class(U:! type) { // CHECK:STDOUT: // CHECK:STDOUT: fn @F.2() -> %return: %CompleteClass.3 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc9_16: i32 = int_value 1 [template = constants.%.9] -// CHECK:STDOUT: %.loc9_17.1: %.4 = struct_literal (%.loc9_16) -// CHECK:STDOUT: %.loc9_17.2: ref i32 = class_element_access %return, element0 -// CHECK:STDOUT: %.loc9_17.3: init i32 = initialize_from %.loc9_16 to %.loc9_17.2 [template = constants.%.9] -// CHECK:STDOUT: %.loc9_17.4: init %CompleteClass.3 = class_init (%.loc9_17.3), %return [template = constants.%struct] -// CHECK:STDOUT: %.loc9_18: init %CompleteClass.3 = converted %.loc9_17.1, %.loc9_17.4 [template = constants.%struct] +// CHECK:STDOUT: %.loc9_16: Core.IntLiteral = int_value 1 [template = constants.%.31] +// CHECK:STDOUT: %.loc9_17.1: %.32 = struct_literal (%.loc9_16) +// CHECK:STDOUT: %.loc9_17.2: %Convert.type.2 = interface_witness_access constants.%.34, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_17.3: = bound_method %.loc9_16, %.loc9_17.2 [template = constants.%.35] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc9_17.3(%.loc9_16) [template = constants.%.36] +// CHECK:STDOUT: %.loc9_17.4: init i32 = converted %.loc9_16, %int.convert_checked [template = constants.%.36] +// CHECK:STDOUT: %.loc9_17.5: ref i32 = class_element_access %return, element0 +// CHECK:STDOUT: %.loc9_17.6: init i32 = initialize_from %.loc9_17.4 to %.loc9_17.5 [template = constants.%.36] +// CHECK:STDOUT: %.loc9_17.7: init %CompleteClass.3 = class_init (%.loc9_17.6), %return [template = constants.%struct] +// CHECK:STDOUT: %.loc9_18: init %CompleteClass.3 = converted %.loc9_17.1, %.loc9_17.7 [template = constants.%struct] // CHECK:STDOUT: return %.loc9_18 to %return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Convert.11[%self.param_patt: Core.IntLiteral]() -> i32 = "int.convert_checked"; +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(i32) { +// CHECK:STDOUT: %Dest => i32 +// CHECK:STDOUT: %Dest.patt => i32 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3 +// CHECK:STDOUT: %Self => constants.%Self.2 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.2 +// CHECK:STDOUT: %Convert => constants.%Convert.2 +// CHECK:STDOUT: %.1 => constants.%.3 +// CHECK:STDOUT: %.2 => constants.%.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@Convert.1.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.1(constants.%Dest, constants.%Self.1) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.2 +// CHECK:STDOUT: %Self => constants.%Self.1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%.5) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@impl.2.%.1) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.2(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.2(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.2(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%.7) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@impl.3.%.1) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.3(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.3(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.3(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(Core.IntLiteral) { +// CHECK:STDOUT: %Dest => Core.IntLiteral +// CHECK:STDOUT: %Dest.patt => Core.IntLiteral +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.6 +// CHECK:STDOUT: %Self => constants.%Self.2 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.5 +// CHECK:STDOUT: %Convert => constants.%Convert.5 +// CHECK:STDOUT: %.1 => constants.%.9 +// CHECK:STDOUT: %.2 => constants.%.10 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.5(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.5(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.4(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.6(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.6(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.5(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(i32) { +// CHECK:STDOUT: %Dest => i32 +// CHECK:STDOUT: %Dest.patt => i32 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type => constants.%As.type.3 +// CHECK:STDOUT: %Self => constants.%Self.4 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.9 +// CHECK:STDOUT: %Convert => constants.%Convert.9 +// CHECK:STDOUT: %.1 => constants.%.15 +// CHECK:STDOUT: %.2 => constants.%.16 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(@Convert.6.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.6(constants.%Dest, constants.%Self.3) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %As.type => constants.%As.type.2 +// CHECK:STDOUT: %Self => constants.%Self.3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%.5) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(@impl.8.%.1) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.8(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %As.type => constants.%As.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.8(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %As.type => constants.%As.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.7(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%.7) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(@impl.9.%.1) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.9(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %As.type => constants.%As.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.9(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %As.type => constants.%As.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.8(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(Core.IntLiteral) { +// CHECK:STDOUT: %Dest => Core.IntLiteral +// CHECK:STDOUT: %Dest.patt => Core.IntLiteral +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type => constants.%As.type.6 +// CHECK:STDOUT: %Self => constants.%Self.4 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.12 +// CHECK:STDOUT: %Convert => constants.%Convert.12 +// CHECK:STDOUT: %.1 => constants.%.19 +// CHECK:STDOUT: %.2 => constants.%.20 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.11(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.11(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.9(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.12(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.12(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.10(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: specific @Class(constants.%T) { // CHECK:STDOUT: %T.1 => constants.%T // CHECK:STDOUT: %T.patt.1 => constants.%T @@ -377,7 +1072,7 @@ class Class(U:! type) { // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %CompleteClass => constants.%CompleteClass.2 -// CHECK:STDOUT: %.1 => constants.%.6 +// CHECK:STDOUT: %.1 => constants.%.28 // CHECK:STDOUT: %F.type => constants.%F.type.1 // CHECK:STDOUT: %F => constants.%F.1 // CHECK:STDOUT: } @@ -395,7 +1090,7 @@ class Class(U:! type) { // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %CompleteClass => constants.%CompleteClass.3 -// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %.1 => constants.%.29 // CHECK:STDOUT: %F.type => constants.%F.type.3 // CHECK:STDOUT: %F => constants.%F.3 // CHECK:STDOUT: } @@ -429,7 +1124,7 @@ class Class(U:! type) { // CHECK:STDOUT: imports { // CHECK:STDOUT: %import_ref.1 = import_ref Main//foo, inst+9, unloaded // CHECK:STDOUT: %import_ref.2: %CompleteClass.type = import_ref Main//foo, inst+20, loaded [template = constants.%CompleteClass.1] -// CHECK:STDOUT: %import_ref.3: %F.type.3 = import_ref Main//foo, inst+68, loaded [template = constants.%F.3] +// CHECK:STDOUT: %import_ref.3: %F.type.3 = import_ref Main//foo, inst+432, loaded [template = constants.%F.3] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int32 = %import_ref.4 // CHECK:STDOUT: import Core//prelude @@ -601,12 +1296,65 @@ class Class(U:! type) { // CHECK:STDOUT: %.7: type = unbound_element_type %CompleteClass.4, i32 [template] // CHECK:STDOUT: %F.type.4: type = fn_type @F.1, @CompleteClass(i32) [template] // CHECK:STDOUT: %F.4: %F.type.4 = struct_value () [template] +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.4: type = facet_type <@ImplicitAs, @ImplicitAs(i32)> [template] +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic] +// CHECK:STDOUT: %.15: type = int_type signed, %N [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.5: type = facet_type <@ImplicitAs, @ImplicitAs(%.15)> [symbolic] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.4: type = fn_type @Convert.2, @impl.2(%N) [symbolic] +// CHECK:STDOUT: %Convert.4: %Convert.type.4 = struct_value () [symbolic] +// CHECK:STDOUT: %.16: = interface_witness (%Convert.4) [symbolic] +// CHECK:STDOUT: %.17: type = int_type unsigned, %N [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.6: type = facet_type <@ImplicitAs, @ImplicitAs(%.17)> [symbolic] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.3, @impl.3(%N) [symbolic] +// CHECK:STDOUT: %Convert.5: %Convert.type.5 = struct_value () [symbolic] +// CHECK:STDOUT: %.18: = interface_witness (%Convert.5) [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.7: type = facet_type <@ImplicitAs, @ImplicitAs(Core.IntLiteral)> [template] +// CHECK:STDOUT: %Convert.type.7: type = fn_type @Convert.4, @impl.5(%N) [symbolic] +// CHECK:STDOUT: %Convert.7: %Convert.type.7 = struct_value () [symbolic] +// CHECK:STDOUT: %.21: = interface_witness (%Convert.7) [symbolic] +// CHECK:STDOUT: %Convert.type.8: type = fn_type @Convert.5, @impl.6(%N) [symbolic] +// CHECK:STDOUT: %Convert.8: %Convert.type.8 = struct_value () [symbolic] +// CHECK:STDOUT: %.22: = interface_witness (%Convert.8) [symbolic] +// CHECK:STDOUT: %As.type.2: type = facet_type <@As, @As(%Dest)> [symbolic] +// CHECK:STDOUT: %Self.3: @As.%As.type (%As.type.2) = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %As.type.3: type = facet_type <@As, @As(i32)> [template] +// CHECK:STDOUT: %Self.4: %As.type.2 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Convert.type.9: type = fn_type @Convert.6, @As(%Dest) [symbolic] +// CHECK:STDOUT: %Convert.9: %Convert.type.9 = struct_value () [symbolic] +// CHECK:STDOUT: %.23: type = assoc_entity_type %As.type.2, %Convert.type.9 [symbolic] +// CHECK:STDOUT: %.24: %.23 = assoc_entity element0, imports.%import_ref.40 [symbolic] +// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.6, @As(i32) [template] +// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] +// CHECK:STDOUT: %.25: type = assoc_entity_type %As.type.3, %Convert.type.10 [template] +// CHECK:STDOUT: %.26: %.25 = assoc_entity element0, imports.%import_ref.41 [template] +// CHECK:STDOUT: %As.type.4: type = facet_type <@As, @As(%.15)> [symbolic] +// CHECK:STDOUT: %Convert.type.11: type = fn_type @Convert.7, @impl.8(%N) [symbolic] +// CHECK:STDOUT: %Convert.11: %Convert.type.11 = struct_value () [symbolic] +// CHECK:STDOUT: %.27: = interface_witness (%Convert.11) [symbolic] +// CHECK:STDOUT: %As.type.5: type = facet_type <@As, @As(%.17)> [symbolic] +// CHECK:STDOUT: %Convert.type.12: type = fn_type @Convert.8, @impl.9(%N) [symbolic] +// CHECK:STDOUT: %Convert.12: %Convert.type.12 = struct_value () [symbolic] +// CHECK:STDOUT: %.28: = interface_witness (%Convert.12) [symbolic] +// CHECK:STDOUT: %As.type.6: type = facet_type <@As, @As(Core.IntLiteral)> [template] +// CHECK:STDOUT: %Convert.type.13: type = fn_type @Convert.6, @As(Core.IntLiteral) [template] +// CHECK:STDOUT: %Convert.13: %Convert.type.13 = struct_value () [template] +// CHECK:STDOUT: %.29: type = assoc_entity_type %As.type.6, %Convert.type.13 [template] +// CHECK:STDOUT: %.30: %.29 = assoc_entity element0, imports.%import_ref.51 [template] +// CHECK:STDOUT: %Convert.type.14: type = fn_type @Convert.9, @impl.11(%N) [symbolic] +// CHECK:STDOUT: %Convert.14: %Convert.type.14 = struct_value () [symbolic] +// CHECK:STDOUT: %.31: = interface_witness (%Convert.14) [symbolic] +// CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.10, @impl.12(%N) [symbolic] +// CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [symbolic] +// CHECK:STDOUT: %.32: = interface_witness (%Convert.15) [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %import_ref.1 = import_ref Main//foo, inst+9, unloaded // CHECK:STDOUT: %import_ref.2: %CompleteClass.type = import_ref Main//foo, inst+20, loaded [template = constants.%CompleteClass.1] -// CHECK:STDOUT: %import_ref.3: %F.type.3 = import_ref Main//foo, inst+68, loaded [template = constants.%F.3] +// CHECK:STDOUT: %import_ref.3: %F.type.3 = import_ref Main//foo, inst+432, loaded [template = constants.%F.3] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int32 = %import_ref.7 // CHECK:STDOUT: .ImplicitAs = %import_ref.8 @@ -616,6 +1364,46 @@ class Class(U:! type) { // CHECK:STDOUT: %import_ref.4 = import_ref Main//foo, inst+25, unloaded // CHECK:STDOUT: %import_ref.5 = import_ref Main//foo, inst+37, unloaded // CHECK:STDOUT: %import_ref.6 = import_ref Main//foo, inst+45, unloaded +// CHECK:STDOUT: %import_ref.14: type = import_ref Main//foo, inst+105, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.15: type = import_ref Main//foo, inst+106, loaded [template = constants.%ImplicitAs.type.4] +// CHECK:STDOUT: %import_ref.16 = import_ref Main//foo, inst+107, unloaded +// CHECK:STDOUT: %import_ref.18: type = import_ref Main//foo, inst+117, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.19: type = import_ref Main//foo, inst+118, loaded [symbolic = @impl.2.%ImplicitAs.type (constants.%ImplicitAs.type.5)] +// CHECK:STDOUT: %import_ref.20 = import_ref Main//foo, inst+119, unloaded +// CHECK:STDOUT: %import_ref.21: type = import_ref Main//foo, inst+147, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.22: type = import_ref Main//foo, inst+148, loaded [symbolic = @impl.3.%ImplicitAs.type (constants.%ImplicitAs.type.6)] +// CHECK:STDOUT: %import_ref.23 = import_ref Main//foo, inst+149, unloaded +// CHECK:STDOUT: %import_ref.24: type = import_ref Main//foo, inst+172, loaded [template = i32] +// CHECK:STDOUT: %import_ref.25: type = import_ref Main//foo, inst+173, loaded [template = constants.%ImplicitAs.type.7] +// CHECK:STDOUT: %import_ref.26 = import_ref Main//foo, inst+174, unloaded +// CHECK:STDOUT: %import_ref.28: type = import_ref Main//foo, inst+185, loaded [symbolic = @impl.5.%.1 (constants.%.15)] +// CHECK:STDOUT: %import_ref.29: type = import_ref Main//foo, inst+186, loaded [template = constants.%ImplicitAs.type.7] +// CHECK:STDOUT: %import_ref.30 = import_ref Main//foo, inst+187, unloaded +// CHECK:STDOUT: %import_ref.31: type = import_ref Main//foo, inst+212, loaded [symbolic = @impl.6.%.1 (constants.%.17)] +// CHECK:STDOUT: %import_ref.32: type = import_ref Main//foo, inst+213, loaded [template = constants.%ImplicitAs.type.7] +// CHECK:STDOUT: %import_ref.33 = import_ref Main//foo, inst+214, unloaded +// CHECK:STDOUT: %import_ref.34 = import_ref Main//foo, inst+244, unloaded +// CHECK:STDOUT: %import_ref.35 = import_ref Main//foo, inst+245, unloaded +// CHECK:STDOUT: %import_ref.36 = import_ref Main//foo, inst+246, unloaded +// CHECK:STDOUT: %import_ref.37: type = import_ref Main//foo, inst+248, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.38: type = import_ref Main//foo, inst+249, loaded [template = constants.%As.type.3] +// CHECK:STDOUT: %import_ref.39 = import_ref Main//foo, inst+250, unloaded +// CHECK:STDOUT: %import_ref.40 = import_ref Main//foo, inst+265, unloaded +// CHECK:STDOUT: %import_ref.42: type = import_ref Main//foo, inst+287, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.43: type = import_ref Main//foo, inst+288, loaded [symbolic = @impl.8.%As.type (constants.%As.type.4)] +// CHECK:STDOUT: %import_ref.44 = import_ref Main//foo, inst+289, unloaded +// CHECK:STDOUT: %import_ref.45: type = import_ref Main//foo, inst+316, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.46: type = import_ref Main//foo, inst+317, loaded [symbolic = @impl.9.%As.type (constants.%As.type.5)] +// CHECK:STDOUT: %import_ref.47 = import_ref Main//foo, inst+318, unloaded +// CHECK:STDOUT: %import_ref.48: type = import_ref Main//foo, inst+341, loaded [template = i32] +// CHECK:STDOUT: %import_ref.49: type = import_ref Main//foo, inst+342, loaded [template = constants.%As.type.6] +// CHECK:STDOUT: %import_ref.50 = import_ref Main//foo, inst+343, unloaded +// CHECK:STDOUT: %import_ref.52: type = import_ref Main//foo, inst+354, loaded [symbolic = @impl.11.%.1 (constants.%.15)] +// CHECK:STDOUT: %import_ref.53: type = import_ref Main//foo, inst+355, loaded [template = constants.%As.type.6] +// CHECK:STDOUT: %import_ref.54 = import_ref Main//foo, inst+356, unloaded +// CHECK:STDOUT: %import_ref.55: type = import_ref Main//foo, inst+381, loaded [symbolic = @impl.12.%.1 (constants.%.17)] +// CHECK:STDOUT: %import_ref.56: type = import_ref Main//foo, inst+382, loaded [template = constants.%As.type.6] +// CHECK:STDOUT: %import_ref.57 = import_ref Main//foo, inst+383, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -631,9 +1419,181 @@ class Class(U:! type) { // CHECK:STDOUT: %Use.decl: %Use.type = fn_decl @Use [template = constants.%Use] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @CompleteClass(constants.%T: type) { -// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] -// CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)] +// CHECK:STDOUT: generic interface @As(constants.%Dest: type) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest)> [symbolic = %As.type (constants.%As.type.2)] +// CHECK:STDOUT: %Self: %As.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.4)] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.6, @As(%Dest) [symbolic = %Convert.type (constants.%Convert.type.9)] +// CHECK:STDOUT: %Convert: @As.%Convert.type (%Convert.type.9) = struct_value () [symbolic = %Convert (constants.%Convert.9)] +// CHECK:STDOUT: %.1: type = assoc_entity_type @As.%As.type (%As.type.2), @As.%Convert.type (%Convert.type.9) [symbolic = %.1 (constants.%.23)] +// CHECK:STDOUT: %.2: @As.%.1 (%.23) = assoc_entity element0, imports.%import_ref.40 [symbolic = %.2 (constants.%.24)] +// CHECK:STDOUT: +// CHECK:STDOUT: interface { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%import_ref.34 +// CHECK:STDOUT: .Convert = imports.%import_ref.35 +// CHECK:STDOUT: witness = (imports.%import_ref.36) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.1: imports.%import_ref.14 as imports.%import_ref.15 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.16 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.2(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.15)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%.1)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.2, @impl.2(%N) [symbolic = %Convert.type (constants.%Convert.type.4)] +// CHECK:STDOUT: %Convert: @impl.2.%Convert.type (%Convert.type.4) = struct_value () [symbolic = %Convert (constants.%Convert.4)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.16)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.18 as imports.%import_ref.19 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.20 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.3(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.17)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%.1)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.6)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.3, @impl.3(%N) [symbolic = %Convert.type (constants.%Convert.type.5)] +// CHECK:STDOUT: %Convert: @impl.3.%Convert.type (%Convert.type.5) = struct_value () [symbolic = %Convert (constants.%Convert.5)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.18)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.21 as imports.%import_ref.22 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.23 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.4: imports.%import_ref.24 as imports.%import_ref.25 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.26 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.5(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.15)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.4, @impl.5(%N) [symbolic = %Convert.type (constants.%Convert.type.7)] +// CHECK:STDOUT: %Convert: @impl.5.%Convert.type (%Convert.type.7) = struct_value () [symbolic = %Convert (constants.%Convert.7)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.21)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.28 as imports.%import_ref.29 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.30 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.6(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.17)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.5, @impl.6(%N) [symbolic = %Convert.type (constants.%Convert.type.8)] +// CHECK:STDOUT: %Convert: @impl.6.%Convert.type (%Convert.type.8) = struct_value () [symbolic = %Convert (constants.%Convert.8)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.22)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.31 as imports.%import_ref.32 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.33 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.7: imports.%import_ref.37 as imports.%import_ref.38 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.39 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.8(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.15)] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%.1)> [symbolic = %As.type (constants.%As.type.4)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.7, @impl.8(%N) [symbolic = %Convert.type (constants.%Convert.type.11)] +// CHECK:STDOUT: %Convert: @impl.8.%Convert.type (%Convert.type.11) = struct_value () [symbolic = %Convert (constants.%Convert.11)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.27)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.42 as imports.%import_ref.43 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.44 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.9(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.17)] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%.1)> [symbolic = %As.type (constants.%As.type.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.8, @impl.9(%N) [symbolic = %Convert.type (constants.%Convert.type.12)] +// CHECK:STDOUT: %Convert: @impl.9.%Convert.type (%Convert.type.12) = struct_value () [symbolic = %Convert (constants.%Convert.12)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.28)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.45 as imports.%import_ref.46 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.47 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.10: imports.%import_ref.48 as imports.%import_ref.49 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.50 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.11(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.15)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.9, @impl.11(%N) [symbolic = %Convert.type (constants.%Convert.type.14)] +// CHECK:STDOUT: %Convert: @impl.11.%Convert.type (%Convert.type.14) = struct_value () [symbolic = %Convert (constants.%Convert.14)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.31)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.52 as imports.%import_ref.53 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.54 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.12(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.17)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.10, @impl.12(%N) [symbolic = %Convert.type (constants.%Convert.type.15)] +// CHECK:STDOUT: %Convert: @impl.12.%Convert.type (%Convert.type.15) = struct_value () [symbolic = %Convert (constants.%Convert.15)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.32)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.55 as imports.%import_ref.56 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.57 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic class @CompleteClass(constants.%T: type) { +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %CompleteClass: type = class_type @CompleteClass, @CompleteClass(%T) [symbolic = %CompleteClass (constants.%CompleteClass.2)] @@ -675,6 +1635,86 @@ class Class(U:! type) { // CHECK:STDOUT: // CHECK:STDOUT: fn @F.2() -> %CompleteClass.4; // CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.2(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.15)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.2.%.1 (%.15) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.3(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.17)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.3.%.1 (%.17) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.4(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.15)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.4.%.1 (%.15)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.5(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.17)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.5.%.1 (%.17)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.6(constants.%Dest: type, constants.%Self.3: @As.%As.type (%As.type.2)) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest)> [symbolic = %As.type (constants.%As.type.2)] +// CHECK:STDOUT: %Self: %As.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.4)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.6.%Self (%Self.4)]() -> @Convert.6.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.7(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.15)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.7.%.1 (%.15) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.8(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.17)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.8.%.1 (%.17) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.9(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.15)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.9.%.1 (%.15)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.10(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.17)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.10.%.1 (%.17)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: specific @CompleteClass(constants.%T) { // CHECK:STDOUT: %T => constants.%T // CHECK:STDOUT: %T.patt => constants.%T @@ -715,9 +1755,288 @@ class Class(U:! type) { // CHECK:STDOUT: %F => constants.%F.4 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.2(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.15 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.2(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.15 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.2(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.15 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.3(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.17 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.6 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.3(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.17 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.6 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.3(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.17 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.5(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.15 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.5(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.15 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.4(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.15 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.6(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.17 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.6(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.17 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.5(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.17 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(i32) { +// CHECK:STDOUT: %Dest => i32 +// CHECK:STDOUT: %Dest.patt => i32 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type => constants.%As.type.3 +// CHECK:STDOUT: %Self => constants.%Self.4 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.10 +// CHECK:STDOUT: %Convert => constants.%Convert.10 +// CHECK:STDOUT: %.1 => constants.%.25 +// CHECK:STDOUT: %.2 => constants.%.26 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(@Convert.6.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.6(constants.%Dest, constants.%Self.3) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %As.type => constants.%As.type.2 +// CHECK:STDOUT: %Self => constants.%Self.3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%.15) { +// CHECK:STDOUT: %Dest => constants.%.15 +// CHECK:STDOUT: %Dest.patt => constants.%.15 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(@impl.8.%.1) { +// CHECK:STDOUT: %Dest => constants.%.15 +// CHECK:STDOUT: %Dest.patt => constants.%.15 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.8(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.15 +// CHECK:STDOUT: %As.type => constants.%As.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.8(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.15 +// CHECK:STDOUT: %As.type => constants.%As.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.7(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.15 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%.17) { +// CHECK:STDOUT: %Dest => constants.%.17 +// CHECK:STDOUT: %Dest.patt => constants.%.17 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(@impl.9.%.1) { +// CHECK:STDOUT: %Dest => constants.%.17 +// CHECK:STDOUT: %Dest.patt => constants.%.17 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.9(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.17 +// CHECK:STDOUT: %As.type => constants.%As.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.9(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.17 +// CHECK:STDOUT: %As.type => constants.%As.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.8(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.17 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(Core.IntLiteral) { +// CHECK:STDOUT: %Dest => Core.IntLiteral +// CHECK:STDOUT: %Dest.patt => Core.IntLiteral +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type => constants.%As.type.6 +// CHECK:STDOUT: %Self => constants.%Self.4 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.13 +// CHECK:STDOUT: %Convert => constants.%Convert.13 +// CHECK:STDOUT: %.1 => constants.%.29 +// CHECK:STDOUT: %.2 => constants.%.30 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.11(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.15 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.11(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.15 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.9(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.15 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.12(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.17 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.12(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.17 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.10(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.17 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: --- fail_foo.impl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.2: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic] +// CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2) = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.3: type = facet_type <@ImplicitAs, @ImplicitAs(i32)> [template] +// CHECK:STDOUT: %Self.2: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Convert.type.1: type = fn_type @Convert.1, @ImplicitAs(%Dest) [symbolic] +// CHECK:STDOUT: %Convert.1: %Convert.type.1 = struct_value () [symbolic] +// CHECK:STDOUT: %.1: type = assoc_entity_type %ImplicitAs.type.2, %Convert.type.1 [symbolic] +// CHECK:STDOUT: %.2: %.1 = assoc_entity element0, imports.%import_ref.10 [symbolic] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(i32) [template] +// CHECK:STDOUT: %Convert.2: %Convert.type.2 = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type %ImplicitAs.type.3, %Convert.type.2 [template] +// CHECK:STDOUT: %.4: %.3 = assoc_entity element0, imports.%import_ref.11 [template] +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic] +// CHECK:STDOUT: %.5: type = int_type signed, %N [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.4: type = facet_type <@ImplicitAs, @ImplicitAs(%.5)> [symbolic] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.3: type = fn_type @Convert.2, @impl.2(%N) [symbolic] +// CHECK:STDOUT: %Convert.3: %Convert.type.3 = struct_value () [symbolic] +// CHECK:STDOUT: %.6: = interface_witness (%Convert.3) [symbolic] +// CHECK:STDOUT: %.7: type = int_type unsigned, %N [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.5: type = facet_type <@ImplicitAs, @ImplicitAs(%.7)> [symbolic] +// CHECK:STDOUT: %Convert.type.4: type = fn_type @Convert.3, @impl.3(%N) [symbolic] +// CHECK:STDOUT: %Convert.4: %Convert.type.4 = struct_value () [symbolic] +// CHECK:STDOUT: %.8: = interface_witness (%Convert.4) [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.6: type = facet_type <@ImplicitAs, @ImplicitAs(Core.IntLiteral)> [template] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %Convert.5: %Convert.type.5 = struct_value () [template] +// CHECK:STDOUT: %.9: type = assoc_entity_type %ImplicitAs.type.6, %Convert.type.5 [template] +// CHECK:STDOUT: %.10: %.9 = assoc_entity element0, imports.%import_ref.21 [template] +// CHECK:STDOUT: %Convert.type.6: type = fn_type @Convert.4, @impl.5(%N) [symbolic] +// CHECK:STDOUT: %Convert.6: %Convert.type.6 = struct_value () [symbolic] +// CHECK:STDOUT: %.11: = interface_witness (%Convert.6) [symbolic] +// CHECK:STDOUT: %Convert.type.7: type = fn_type @Convert.5, @impl.6(%N) [symbolic] +// CHECK:STDOUT: %Convert.7: %Convert.type.7 = struct_value () [symbolic] +// CHECK:STDOUT: %.12: = interface_witness (%Convert.7) [symbolic] +// CHECK:STDOUT: %As.type.2: type = facet_type <@As, @As(%Dest)> [symbolic] +// CHECK:STDOUT: %Self.3: @As.%As.type (%As.type.2) = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %As.type.3: type = facet_type <@As, @As(i32)> [template] +// CHECK:STDOUT: %Self.4: %As.type.2 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Convert.type.8: type = fn_type @Convert.6, @As(%Dest) [symbolic] +// CHECK:STDOUT: %Convert.8: %Convert.type.8 = struct_value () [symbolic] +// CHECK:STDOUT: %.13: type = assoc_entity_type %As.type.2, %Convert.type.8 [symbolic] +// CHECK:STDOUT: %.14: %.13 = assoc_entity element0, imports.%import_ref.34 [symbolic] +// CHECK:STDOUT: %Convert.type.9: type = fn_type @Convert.6, @As(i32) [template] +// CHECK:STDOUT: %Convert.9: %Convert.type.9 = struct_value () [template] +// CHECK:STDOUT: %.15: type = assoc_entity_type %As.type.3, %Convert.type.9 [template] +// CHECK:STDOUT: %.16: %.15 = assoc_entity element0, imports.%import_ref.35 [template] +// CHECK:STDOUT: %As.type.4: type = facet_type <@As, @As(%.5)> [symbolic] +// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.7, @impl.8(%N) [symbolic] +// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [symbolic] +// CHECK:STDOUT: %.17: = interface_witness (%Convert.10) [symbolic] +// CHECK:STDOUT: %As.type.5: type = facet_type <@As, @As(%.7)> [symbolic] +// CHECK:STDOUT: %Convert.type.11: type = fn_type @Convert.8, @impl.9(%N) [symbolic] +// CHECK:STDOUT: %Convert.11: %Convert.type.11 = struct_value () [symbolic] +// CHECK:STDOUT: %.18: = interface_witness (%Convert.11) [symbolic] +// CHECK:STDOUT: %As.type.6: type = facet_type <@As, @As(Core.IntLiteral)> [template] +// CHECK:STDOUT: %Convert.type.12: type = fn_type @Convert.6, @As(Core.IntLiteral) [template] +// CHECK:STDOUT: %Convert.12: %Convert.type.12 = struct_value () [template] +// CHECK:STDOUT: %.19: type = assoc_entity_type %As.type.6, %Convert.type.12 [template] +// CHECK:STDOUT: %.20: %.19 = assoc_entity element0, imports.%import_ref.45 [template] +// CHECK:STDOUT: %Convert.type.13: type = fn_type @Convert.9, @impl.11(%N) [symbolic] +// CHECK:STDOUT: %Convert.13: %Convert.type.13 = struct_value () [symbolic] +// CHECK:STDOUT: %.21: = interface_witness (%Convert.13) [symbolic] +// CHECK:STDOUT: %Convert.type.14: type = fn_type @Convert.10, @impl.12(%N) [symbolic] +// CHECK:STDOUT: %Convert.14: %Convert.type.14 = struct_value () [symbolic] +// CHECK:STDOUT: %.22: = interface_witness (%Convert.14) [symbolic] // CHECK:STDOUT: %U: type = bind_symbolic_name U, 0 [symbolic] // CHECK:STDOUT: %U.patt: type = symbolic_binding_pattern U, 0 [symbolic] // CHECK:STDOUT: %Class.type: type = generic_class_type @Class [template] @@ -725,18 +2044,62 @@ class Class(U:! type) { // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic] // CHECK:STDOUT: %.type: type = generic_class_type @.1 [template] -// CHECK:STDOUT: %.1: %.type = struct_value () [template] -// CHECK:STDOUT: %.2: type = class_type @.1, @.1(%U) [symbolic] +// CHECK:STDOUT: %.23: %.type = struct_value () [template] +// CHECK:STDOUT: %.24: type = class_type @.1, @.1(%U) [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %import_ref.1: %Class.type = import_ref Main//foo, inst+9, loaded [template = constants.%Class.1] // CHECK:STDOUT: %import_ref.2 = import_ref Main//foo, inst+20, unloaded -// CHECK:STDOUT: %import_ref.3 = import_ref Main//foo, inst+68, unloaded +// CHECK:STDOUT: %import_ref.3 = import_ref Main//foo, inst+432, unloaded // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.4 = import_ref Main//foo, inst+69, unloaded +// CHECK:STDOUT: %import_ref.5 = import_ref Main//foo, inst+70, unloaded +// CHECK:STDOUT: %import_ref.6 = import_ref Main//foo, inst+71, unloaded +// CHECK:STDOUT: %import_ref.7: type = import_ref Main//foo, inst+105, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.8: type = import_ref Main//foo, inst+106, loaded [template = constants.%ImplicitAs.type.3] +// CHECK:STDOUT: %import_ref.9 = import_ref Main//foo, inst+107, unloaded +// CHECK:STDOUT: %import_ref.10 = import_ref Main//foo, inst+86, unloaded +// CHECK:STDOUT: %import_ref.12: type = import_ref Main//foo, inst+117, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.13: type = import_ref Main//foo, inst+118, loaded [symbolic = @impl.2.%ImplicitAs.type (constants.%ImplicitAs.type.4)] +// CHECK:STDOUT: %import_ref.14 = import_ref Main//foo, inst+119, unloaded +// CHECK:STDOUT: %import_ref.15: type = import_ref Main//foo, inst+147, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.16: type = import_ref Main//foo, inst+148, loaded [symbolic = @impl.3.%ImplicitAs.type (constants.%ImplicitAs.type.5)] +// CHECK:STDOUT: %import_ref.17 = import_ref Main//foo, inst+149, unloaded +// CHECK:STDOUT: %import_ref.18: type = import_ref Main//foo, inst+172, loaded [template = i32] +// CHECK:STDOUT: %import_ref.19: type = import_ref Main//foo, inst+173, loaded [template = constants.%ImplicitAs.type.6] +// CHECK:STDOUT: %import_ref.20 = import_ref Main//foo, inst+174, unloaded +// CHECK:STDOUT: %import_ref.22: type = import_ref Main//foo, inst+185, loaded [symbolic = @impl.5.%.1 (constants.%.5)] +// CHECK:STDOUT: %import_ref.23: type = import_ref Main//foo, inst+186, loaded [template = constants.%ImplicitAs.type.6] +// CHECK:STDOUT: %import_ref.24 = import_ref Main//foo, inst+187, unloaded +// CHECK:STDOUT: %import_ref.25: type = import_ref Main//foo, inst+212, loaded [symbolic = @impl.6.%.1 (constants.%.7)] +// CHECK:STDOUT: %import_ref.26: type = import_ref Main//foo, inst+213, loaded [template = constants.%ImplicitAs.type.6] +// CHECK:STDOUT: %import_ref.27 = import_ref Main//foo, inst+214, unloaded +// CHECK:STDOUT: %import_ref.28 = import_ref Main//foo, inst+244, unloaded +// CHECK:STDOUT: %import_ref.29 = import_ref Main//foo, inst+245, unloaded +// CHECK:STDOUT: %import_ref.30 = import_ref Main//foo, inst+246, unloaded +// CHECK:STDOUT: %import_ref.31: type = import_ref Main//foo, inst+248, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.32: type = import_ref Main//foo, inst+249, loaded [template = constants.%As.type.3] +// CHECK:STDOUT: %import_ref.33 = import_ref Main//foo, inst+250, unloaded +// CHECK:STDOUT: %import_ref.34 = import_ref Main//foo, inst+265, unloaded +// CHECK:STDOUT: %import_ref.36: type = import_ref Main//foo, inst+287, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.37: type = import_ref Main//foo, inst+288, loaded [symbolic = @impl.8.%As.type (constants.%As.type.4)] +// CHECK:STDOUT: %import_ref.38 = import_ref Main//foo, inst+289, unloaded +// CHECK:STDOUT: %import_ref.39: type = import_ref Main//foo, inst+316, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.40: type = import_ref Main//foo, inst+317, loaded [symbolic = @impl.9.%As.type (constants.%As.type.5)] +// CHECK:STDOUT: %import_ref.41 = import_ref Main//foo, inst+318, unloaded +// CHECK:STDOUT: %import_ref.42: type = import_ref Main//foo, inst+341, loaded [template = i32] +// CHECK:STDOUT: %import_ref.43: type = import_ref Main//foo, inst+342, loaded [template = constants.%As.type.6] +// CHECK:STDOUT: %import_ref.44 = import_ref Main//foo, inst+343, unloaded +// CHECK:STDOUT: %import_ref.46: type = import_ref Main//foo, inst+354, loaded [symbolic = @impl.11.%.1 (constants.%.5)] +// CHECK:STDOUT: %import_ref.47: type = import_ref Main//foo, inst+355, loaded [template = constants.%As.type.6] +// CHECK:STDOUT: %import_ref.48 = import_ref Main//foo, inst+356, unloaded +// CHECK:STDOUT: %import_ref.49: type = import_ref Main//foo, inst+381, loaded [symbolic = @impl.12.%.1 (constants.%.7)] +// CHECK:STDOUT: %import_ref.50: type = import_ref Main//foo, inst+382, loaded [template = constants.%As.type.6] +// CHECK:STDOUT: %import_ref.51 = import_ref Main//foo, inst+383, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -749,7 +2112,7 @@ class Class(U:! type) { // CHECK:STDOUT: %default.import.loc2_6.1 = import // CHECK:STDOUT: %default.import.loc2_6.2 = import // CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %.decl: %.type = class_decl @.1 [template = constants.%.1] { +// CHECK:STDOUT: %.decl: %.type = class_decl @.1 [template = constants.%.23] { // CHECK:STDOUT: %U.patt.loc12_13.1: type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc12_13.2 (constants.%U.patt)] // CHECK:STDOUT: %U.param_patt: type = value_param_pattern %U.patt.loc12_13.1, runtime_param [symbolic = %U.patt.loc12_13.2 (constants.%U.patt)] // CHECK:STDOUT: } { @@ -758,6 +2121,198 @@ class Class(U:! type) { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(constants.%Dest: type) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)] +// CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.1, @ImplicitAs(%Dest) [symbolic = %Convert.type (constants.%Convert.type.1)] +// CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.1) = struct_value () [symbolic = %Convert (constants.%Convert.1)] +// CHECK:STDOUT: %.1: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2), @ImplicitAs.%Convert.type (%Convert.type.1) [symbolic = %.1 (constants.%.1)] +// CHECK:STDOUT: %.2: @ImplicitAs.%.1 (%.1) = assoc_entity element0, imports.%import_ref.10 [symbolic = %.2 (constants.%.2)] +// CHECK:STDOUT: +// CHECK:STDOUT: interface { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%import_ref.4 +// CHECK:STDOUT: .Convert = imports.%import_ref.5 +// CHECK:STDOUT: witness = (imports.%import_ref.6) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @As(constants.%Dest: type) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest)> [symbolic = %As.type (constants.%As.type.2)] +// CHECK:STDOUT: %Self: %As.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.4)] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.6, @As(%Dest) [symbolic = %Convert.type (constants.%Convert.type.8)] +// CHECK:STDOUT: %Convert: @As.%Convert.type (%Convert.type.8) = struct_value () [symbolic = %Convert (constants.%Convert.8)] +// CHECK:STDOUT: %.1: type = assoc_entity_type @As.%As.type (%As.type.2), @As.%Convert.type (%Convert.type.8) [symbolic = %.1 (constants.%.13)] +// CHECK:STDOUT: %.2: @As.%.1 (%.13) = assoc_entity element0, imports.%import_ref.34 [symbolic = %.2 (constants.%.14)] +// CHECK:STDOUT: +// CHECK:STDOUT: interface { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%import_ref.28 +// CHECK:STDOUT: .Convert = imports.%import_ref.29 +// CHECK:STDOUT: witness = (imports.%import_ref.30) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.1: imports.%import_ref.7 as imports.%import_ref.8 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.9 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.2(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%.1)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.4)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.2, @impl.2(%N) [symbolic = %Convert.type (constants.%Convert.type.3)] +// CHECK:STDOUT: %Convert: @impl.2.%Convert.type (%Convert.type.3) = struct_value () [symbolic = %Convert (constants.%Convert.3)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.6)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.12 as imports.%import_ref.13 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.14 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.3(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%.1)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.3, @impl.3(%N) [symbolic = %Convert.type (constants.%Convert.type.4)] +// CHECK:STDOUT: %Convert: @impl.3.%Convert.type (%Convert.type.4) = struct_value () [symbolic = %Convert (constants.%Convert.4)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.8)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.15 as imports.%import_ref.16 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.17 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.4: imports.%import_ref.18 as imports.%import_ref.19 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.20 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.5(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.4, @impl.5(%N) [symbolic = %Convert.type (constants.%Convert.type.6)] +// CHECK:STDOUT: %Convert: @impl.5.%Convert.type (%Convert.type.6) = struct_value () [symbolic = %Convert (constants.%Convert.6)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.11)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.22 as imports.%import_ref.23 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.24 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.6(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.5, @impl.6(%N) [symbolic = %Convert.type (constants.%Convert.type.7)] +// CHECK:STDOUT: %Convert: @impl.6.%Convert.type (%Convert.type.7) = struct_value () [symbolic = %Convert (constants.%Convert.7)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.12)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.25 as imports.%import_ref.26 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.27 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.7: imports.%import_ref.31 as imports.%import_ref.32 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.33 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.8(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%.1)> [symbolic = %As.type (constants.%As.type.4)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.7, @impl.8(%N) [symbolic = %Convert.type (constants.%Convert.type.10)] +// CHECK:STDOUT: %Convert: @impl.8.%Convert.type (%Convert.type.10) = struct_value () [symbolic = %Convert (constants.%Convert.10)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.17)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.36 as imports.%import_ref.37 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.38 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.9(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%.1)> [symbolic = %As.type (constants.%As.type.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.8, @impl.9(%N) [symbolic = %Convert.type (constants.%Convert.type.11)] +// CHECK:STDOUT: %Convert: @impl.9.%Convert.type (%Convert.type.11) = struct_value () [symbolic = %Convert (constants.%Convert.11)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.18)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.39 as imports.%import_ref.40 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.41 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.10: imports.%import_ref.42 as imports.%import_ref.43 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.44 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.11(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.9, @impl.11(%N) [symbolic = %Convert.type (constants.%Convert.type.13)] +// CHECK:STDOUT: %Convert: @impl.11.%Convert.type (%Convert.type.13) = struct_value () [symbolic = %Convert (constants.%Convert.13)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.21)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.46 as imports.%import_ref.47 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.48 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.12(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.10, @impl.12(%N) [symbolic = %Convert.type (constants.%Convert.type.14)] +// CHECK:STDOUT: %Convert: @impl.12.%Convert.type (%Convert.type.14) = struct_value () [symbolic = %Convert (constants.%Convert.14)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.22)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.49 as imports.%import_ref.50 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.51 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: generic class @Class(constants.%T: type) { // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)] @@ -777,11 +2332,377 @@ class Class(U:! type) { // CHECK:STDOUT: %.loc17: = complete_type_witness [template = ] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%.2 +// CHECK:STDOUT: .Self = constants.%.24 // CHECK:STDOUT: .x = %.loc16 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.1(constants.%Dest: type, constants.%Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2)) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)] +// CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.1.%Self (%Self.2)]() -> @Convert.1.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.2(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.2.%.1 (%.5) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.3(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.3.%.1 (%.7) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.4(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.4.%.1 (%.5)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.5(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.5.%.1 (%.7)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.6(constants.%Dest: type, constants.%Self.3: @As.%As.type (%As.type.2)) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest)> [symbolic = %As.type (constants.%As.type.2)] +// CHECK:STDOUT: %Self: %As.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.4)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.6.%Self (%Self.4)]() -> @Convert.6.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.7(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.7.%.1 (%.5) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.8(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.8.%.1 (%.7) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.9(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.9.%.1 (%.5)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.10(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.10.%.1 (%.7)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(i32) { +// CHECK:STDOUT: %Dest => i32 +// CHECK:STDOUT: %Dest.patt => i32 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3 +// CHECK:STDOUT: %Self => constants.%Self.2 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.2 +// CHECK:STDOUT: %Convert => constants.%Convert.2 +// CHECK:STDOUT: %.1 => constants.%.3 +// CHECK:STDOUT: %.2 => constants.%.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@Convert.1.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.1(constants.%Dest, constants.%Self.1) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.2 +// CHECK:STDOUT: %Self => constants.%Self.1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%.5) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@impl.2.%.1) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.2(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.2(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.2(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%.7) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@impl.3.%.1) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.3(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.3(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.3(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(Core.IntLiteral) { +// CHECK:STDOUT: %Dest => Core.IntLiteral +// CHECK:STDOUT: %Dest.patt => Core.IntLiteral +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.6 +// CHECK:STDOUT: %Self => constants.%Self.2 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.5 +// CHECK:STDOUT: %Convert => constants.%Convert.5 +// CHECK:STDOUT: %.1 => constants.%.9 +// CHECK:STDOUT: %.2 => constants.%.10 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.5(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.5(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.4(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.6(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.6(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.5(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(i32) { +// CHECK:STDOUT: %Dest => i32 +// CHECK:STDOUT: %Dest.patt => i32 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type => constants.%As.type.3 +// CHECK:STDOUT: %Self => constants.%Self.4 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.9 +// CHECK:STDOUT: %Convert => constants.%Convert.9 +// CHECK:STDOUT: %.1 => constants.%.15 +// CHECK:STDOUT: %.2 => constants.%.16 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(@Convert.6.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.6(constants.%Dest, constants.%Self.3) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %As.type => constants.%As.type.2 +// CHECK:STDOUT: %Self => constants.%Self.3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%.5) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(@impl.8.%.1) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.8(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %As.type => constants.%As.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.8(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %As.type => constants.%As.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.7(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%.7) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(@impl.9.%.1) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.9(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %As.type => constants.%As.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.9(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %As.type => constants.%As.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.8(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(Core.IntLiteral) { +// CHECK:STDOUT: %Dest => Core.IntLiteral +// CHECK:STDOUT: %Dest.patt => Core.IntLiteral +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type => constants.%As.type.6 +// CHECK:STDOUT: %Self => constants.%Self.4 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.12 +// CHECK:STDOUT: %Convert => constants.%Convert.12 +// CHECK:STDOUT: %.1 => constants.%.19 +// CHECK:STDOUT: %.2 => constants.%.20 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.11(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.11(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.9(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.12(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.12(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.10(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: specific @Class(constants.%T) { // CHECK:STDOUT: %T => constants.%T // CHECK:STDOUT: %T.patt => constants.%T diff --git a/toolchain/check/testdata/class/import.carbon b/toolchain/check/testdata/class/import.carbon index bdac6988e8879..4912008aa7c1a 100644 --- a/toolchain/check/testdata/class/import.carbon +++ b/toolchain/check/testdata/class/import.carbon @@ -156,20 +156,28 @@ fn Run() { // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %struct.1: %Empty = struct_value () [template] // CHECK:STDOUT: %Field: type = class_type @Field [template] -// CHECK:STDOUT: %.4: type = struct_type {.x: i32} [template] -// CHECK:STDOUT: %.7: i32 = int_value 1 [template] -// CHECK:STDOUT: %struct.2: %Field = struct_value (%.7) [template] -// CHECK:STDOUT: %.8: type = unbound_element_type %Field, i32 [template] -// CHECK:STDOUT: %.9: i32 = int_value 2 [template] +// CHECK:STDOUT: %.7: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.8: type = struct_type {.x: Core.IntLiteral} [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: %.32: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.33: = bound_method %.7, %Convert.15 [template] +// CHECK:STDOUT: %.34: i32 = int_value 1 [template] +// CHECK:STDOUT: %struct.2: %Field = struct_value (%.34) [template] +// CHECK:STDOUT: %.35: type = unbound_element_type %Field, i32 [template] +// CHECK:STDOUT: %.36: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.37: = bound_method %.36, %Convert.15 [template] +// CHECK:STDOUT: %.38: i32 = int_value 2 [template] // CHECK:STDOUT: %ForwardDeclared.1: type = class_type @ForwardDeclared.1 [template] // CHECK:STDOUT: %struct.3: %ForwardDeclared.1 = struct_value () [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] // CHECK:STDOUT: %G.type: type = fn_type @G [template] // CHECK:STDOUT: %G: %G.type = struct_value () [template] -// CHECK:STDOUT: %.10: type = ptr_type %ForwardDeclared.1 [template] +// CHECK:STDOUT: %.39: type = ptr_type %ForwardDeclared.1 [template] // CHECK:STDOUT: %Incomplete: type = class_type @Incomplete [template] -// CHECK:STDOUT: %.11: type = ptr_type %Incomplete [template] +// CHECK:STDOUT: %.40: type = ptr_type %Incomplete [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -178,18 +186,19 @@ fn Run() { // CHECK:STDOUT: %import_ref.3: type = import_ref Main//a, inst+26, loaded [template = constants.%ForwardDeclared.1] // CHECK:STDOUT: %import_ref.4: type = import_ref Main//a, inst+49, loaded [template = constants.%Incomplete] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { +// CHECK:STDOUT: .ImplicitAs = %import_ref.8 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.5 = import_ref Main//a, inst+4, unloaded // CHECK:STDOUT: %import_ref.6 = import_ref Main//a, inst+9, unloaded -// CHECK:STDOUT: %import_ref.7: %.8 = import_ref Main//a, inst+22, loaded [template = %.1] -// CHECK:STDOUT: %import_ref.8 = import_ref Main//a, inst+27, unloaded -// CHECK:STDOUT: %import_ref.9: %F.type = import_ref Main//a, inst+34, loaded [template = constants.%F] -// CHECK:STDOUT: %import_ref.10: %G.type = import_ref Main//a, inst+45, loaded [template = constants.%G] -// CHECK:STDOUT: %import_ref.11 = import_ref Main//a, inst+27, unloaded -// CHECK:STDOUT: %import_ref.12 = import_ref Main//a, inst+34, unloaded -// CHECK:STDOUT: %import_ref.13 = import_ref Main//a, inst+45, unloaded +// CHECK:STDOUT: %import_ref.7: %.35 = import_ref Main//a, inst+22, loaded [template = %.1] +// CHECK:STDOUT: %import_ref.57 = import_ref Main//a, inst+27, unloaded +// CHECK:STDOUT: %import_ref.58: %F.type = import_ref Main//a, inst+34, loaded [template = constants.%F] +// CHECK:STDOUT: %import_ref.59: %G.type = import_ref Main//a, inst+45, loaded [template = constants.%G] +// CHECK:STDOUT: %import_ref.60 = import_ref Main//a, inst+27, unloaded +// CHECK:STDOUT: %import_ref.61 = import_ref Main//a, inst+34, unloaded +// CHECK:STDOUT: %import_ref.62 = import_ref Main//a, inst+45, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -219,16 +228,16 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: class @ForwardDeclared.1 { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = imports.%import_ref.8 -// CHECK:STDOUT: .F = imports.%import_ref.9 -// CHECK:STDOUT: .G = imports.%import_ref.10 +// CHECK:STDOUT: .Self = imports.%import_ref.57 +// CHECK:STDOUT: .F = imports.%import_ref.58 +// CHECK:STDOUT: .G = imports.%import_ref.59 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @ForwardDeclared.2 { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = imports.%import_ref.11 -// CHECK:STDOUT: .F = imports.%import_ref.12 -// CHECK:STDOUT: .G = imports.%import_ref.13 +// CHECK:STDOUT: .Self = imports.%import_ref.60 +// CHECK:STDOUT: .F = imports.%import_ref.61 +// CHECK:STDOUT: .G = imports.%import_ref.62 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Incomplete; @@ -245,18 +254,26 @@ fn Run() { // CHECK:STDOUT: %Field.ref: type = name_ref Field, imports.%import_ref.2 [template = constants.%Field] // CHECK:STDOUT: %b.var: ref %Field = var b // CHECK:STDOUT: %b: ref %Field = bind_name b, %b.var -// CHECK:STDOUT: %.loc9_24: i32 = int_value 1 [template = constants.%.7] -// CHECK:STDOUT: %.loc9_25.1: %.4 = struct_literal (%.loc9_24) -// CHECK:STDOUT: %.loc9_25.2: ref i32 = class_element_access %b.var, element0 -// CHECK:STDOUT: %.loc9_25.3: init i32 = initialize_from %.loc9_24 to %.loc9_25.2 [template = constants.%.7] -// CHECK:STDOUT: %.loc9_25.4: init %Field = class_init (%.loc9_25.3), %b.var [template = constants.%struct.2] -// CHECK:STDOUT: %.loc9_26: init %Field = converted %.loc9_25.1, %.loc9_25.4 [template = constants.%struct.2] +// CHECK:STDOUT: %.loc9_24: Core.IntLiteral = int_value 1 [template = constants.%.7] +// CHECK:STDOUT: %.loc9_25.1: %.8 = struct_literal (%.loc9_24) +// CHECK:STDOUT: %.loc9_25.2: %Convert.type.2 = interface_witness_access constants.%.32, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_25.3: = bound_method %.loc9_24, %.loc9_25.2 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc9: init i32 = call %.loc9_25.3(%.loc9_24) [template = constants.%.34] +// CHECK:STDOUT: %.loc9_25.4: init i32 = converted %.loc9_24, %int.convert_checked.loc9 [template = constants.%.34] +// CHECK:STDOUT: %.loc9_25.5: ref i32 = class_element_access %b.var, element0 +// CHECK:STDOUT: %.loc9_25.6: init i32 = initialize_from %.loc9_25.4 to %.loc9_25.5 [template = constants.%.34] +// CHECK:STDOUT: %.loc9_25.7: init %Field = class_init (%.loc9_25.6), %b.var [template = constants.%struct.2] +// CHECK:STDOUT: %.loc9_26: init %Field = converted %.loc9_25.1, %.loc9_25.7 [template = constants.%struct.2] // CHECK:STDOUT: assign %b.var, %.loc9_26 // CHECK:STDOUT: %b.ref: ref %Field = name_ref b, %b -// CHECK:STDOUT: %x.ref: %.8 = name_ref x, imports.%import_ref.7 [template = imports.%.1] +// CHECK:STDOUT: %x.ref: %.35 = name_ref x, imports.%import_ref.7 [template = imports.%.1] // CHECK:STDOUT: %.loc10_4: ref i32 = class_element_access %b.ref, element0 -// CHECK:STDOUT: %.loc10_9: i32 = int_value 2 [template = constants.%.9] -// CHECK:STDOUT: assign %.loc10_4, %.loc10_9 +// CHECK:STDOUT: %.loc10_9: Core.IntLiteral = int_value 2 [template = constants.%.36] +// CHECK:STDOUT: %.loc10_7.1: %Convert.type.2 = interface_witness_access constants.%.32, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc10_7.2: = bound_method %.loc10_9, %.loc10_7.1 [template = constants.%.37] +// CHECK:STDOUT: %int.convert_checked.loc10: init i32 = call %.loc10_7.2(%.loc10_9) [template = constants.%.38] +// CHECK:STDOUT: %.loc10_7.3: init i32 = converted %.loc10_9, %int.convert_checked.loc10 [template = constants.%.38] +// CHECK:STDOUT: assign %.loc10_4, %.loc10_7.3 // CHECK:STDOUT: %ForwardDeclared.ref.loc12: type = name_ref ForwardDeclared, imports.%import_ref.3 [template = constants.%ForwardDeclared.1] // CHECK:STDOUT: %c.var: ref %ForwardDeclared.1 = var c // CHECK:STDOUT: %c: ref %ForwardDeclared.1 = bind_name c, %c.var @@ -265,30 +282,30 @@ fn Run() { // CHECK:STDOUT: %.loc12_30: init %ForwardDeclared.1 = converted %.loc12_29.1, %.loc12_29.2 [template = constants.%struct.3] // CHECK:STDOUT: assign %c.var, %.loc12_30 // CHECK:STDOUT: %c.ref.loc13: ref %ForwardDeclared.1 = name_ref c, %c -// CHECK:STDOUT: %F.ref: %F.type = name_ref F, imports.%import_ref.9 [template = constants.%F] +// CHECK:STDOUT: %F.ref: %F.type = name_ref F, imports.%import_ref.58 [template = constants.%F] // CHECK:STDOUT: %.loc13_4: = bound_method %c.ref.loc13, %F.ref // CHECK:STDOUT: %.loc13_3: %ForwardDeclared.1 = bind_value %c.ref.loc13 // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %.loc13_4(%.loc13_3) // CHECK:STDOUT: %c.ref.loc14: ref %ForwardDeclared.1 = name_ref c, %c -// CHECK:STDOUT: %G.ref: %G.type = name_ref G, imports.%import_ref.10 [template = constants.%G] +// CHECK:STDOUT: %G.ref: %G.type = name_ref G, imports.%import_ref.59 [template = constants.%G] // CHECK:STDOUT: %.loc14_4: = bound_method %c.ref.loc14, %G.ref -// CHECK:STDOUT: %.loc14_3: %.10 = addr_of %c.ref.loc14 +// CHECK:STDOUT: %.loc14_3: %.39 = addr_of %c.ref.loc14 // CHECK:STDOUT: %G.call: init %empty_tuple.type = call %.loc14_4(%.loc14_3) // CHECK:STDOUT: %ForwardDeclared.ref.loc16: type = name_ref ForwardDeclared, imports.%import_ref.3 [template = constants.%ForwardDeclared.1] -// CHECK:STDOUT: %.loc16_25: type = ptr_type %ForwardDeclared.1 [template = constants.%.10] -// CHECK:STDOUT: %d.var: ref %.10 = var d -// CHECK:STDOUT: %d: ref %.10 = bind_name d, %d.var +// CHECK:STDOUT: %.loc16_25: type = ptr_type %ForwardDeclared.1 [template = constants.%.39] +// CHECK:STDOUT: %d.var: ref %.39 = var d +// CHECK:STDOUT: %d: ref %.39 = bind_name d, %d.var // CHECK:STDOUT: %c.ref.loc16: ref %ForwardDeclared.1 = name_ref c, %c -// CHECK:STDOUT: %.loc16_29: %.10 = addr_of %c.ref.loc16 +// CHECK:STDOUT: %.loc16_29: %.39 = addr_of %c.ref.loc16 // CHECK:STDOUT: assign %d.var, %.loc16_29 // CHECK:STDOUT: %Incomplete.ref: type = name_ref Incomplete, imports.%import_ref.4 [template = constants.%Incomplete] -// CHECK:STDOUT: %.loc18: type = ptr_type %Incomplete [template = constants.%.11] -// CHECK:STDOUT: %e.var: ref %.11 = var e -// CHECK:STDOUT: %e: ref %.11 = bind_name e, %e.var +// CHECK:STDOUT: %.loc18: type = ptr_type %Incomplete [template = constants.%.40] +// CHECK:STDOUT: %e.var: ref %.40 = var e +// CHECK:STDOUT: %e: ref %.40 = bind_name e, %e.var // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F[%self.param_patt: %ForwardDeclared.1](); // CHECK:STDOUT: -// CHECK:STDOUT: fn @G[addr .inst+91: %.10](); +// CHECK:STDOUT: fn @G[addr .inst+461: %.39](); // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/import_base.carbon b/toolchain/check/testdata/class/import_base.carbon index 930c03f69788f..075e349fa1c44 100644 --- a/toolchain/check/testdata/class/import_base.carbon +++ b/toolchain/check/testdata/class/import_base.carbon @@ -132,14 +132,24 @@ fn Run() { // CHECK:STDOUT: %Run: %Run.type = struct_value () [template] // CHECK:STDOUT: %Child: type = class_type @Child [template] // CHECK:STDOUT: %Base: type = class_type @Base [template] -// CHECK:STDOUT: %.1: type = struct_type {.x: i32, .unused: i32} [template] -// CHECK:STDOUT: %.9: i32 = int_value 0 [template] -// CHECK:STDOUT: %.10: i32 = int_value 1 [template] -// CHECK:STDOUT: %.11: type = struct_type {.base: %.1} [template] -// CHECK:STDOUT: %struct.1: %Base = struct_value (%.9, %.10) [template] +// CHECK:STDOUT: %.9: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %.10: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.11: type = struct_type {.x: Core.IntLiteral, .unused: Core.IntLiteral} [template] +// CHECK:STDOUT: %.12: type = struct_type {.base: %.11} [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: %.36: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.37: = bound_method %.9, %Convert.15 [template] +// CHECK:STDOUT: %.38: i32 = int_value 0 [template] +// CHECK:STDOUT: %.39: = bound_method %.10, %Convert.15 [template] +// CHECK:STDOUT: %.40: i32 = int_value 1 [template] +// CHECK:STDOUT: %struct.1: %Base = struct_value (%.38, %.40) [template] // CHECK:STDOUT: %struct.2: %Child = struct_value (%struct.1) [template] -// CHECK:STDOUT: %.12: type = unbound_element_type %Base, i32 [template] -// CHECK:STDOUT: %.13: i32 = int_value 2 [template] +// CHECK:STDOUT: %.41: type = unbound_element_type %Base, i32 [template] +// CHECK:STDOUT: %.42: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.43: = bound_method %.42, %Convert.15 [template] +// CHECK:STDOUT: %.44: i32 = int_value 2 [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] // CHECK:STDOUT: } @@ -148,13 +158,14 @@ fn Run() { // CHECK:STDOUT: %import_ref.1 = import_ref Main//a, inst+3, unloaded // CHECK:STDOUT: %import_ref.2: type = import_ref Main//a, inst+41, loaded [template = constants.%Child] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { +// CHECK:STDOUT: .ImplicitAs = %import_ref.10 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.3 = import_ref Main//a, inst+4, unloaded // CHECK:STDOUT: %import_ref.4: %F.type = import_ref Main//a, inst+10, loaded [template = constants.%F] // CHECK:STDOUT: %import_ref.5 = import_ref Main//a, inst+19, unloaded -// CHECK:STDOUT: %import_ref.6: %.12 = import_ref Main//a, inst+33, loaded [template = %.1] +// CHECK:STDOUT: %import_ref.6: %.41 = import_ref Main//a, inst+33, loaded [template = %.1] // CHECK:STDOUT: %import_ref.7 = import_ref Main//a, inst+37, unloaded // CHECK:STDOUT: %import_ref.8 = import_ref Main//a, inst+42, unloaded // CHECK:STDOUT: %import_ref.9 = import_ref Main//a, inst+46, unloaded @@ -193,27 +204,39 @@ fn Run() { // CHECK:STDOUT: %Child.ref: type = name_ref Child, imports.%import_ref.2 [template = constants.%Child] // CHECK:STDOUT: %a.var: ref %Child = var a // CHECK:STDOUT: %a: ref %Child = bind_name a, %a.var -// CHECK:STDOUT: %.loc7_33: i32 = int_value 0 [template = constants.%.9] -// CHECK:STDOUT: %.loc7_46: i32 = int_value 1 [template = constants.%.10] -// CHECK:STDOUT: %.loc7_47.1: %.1 = struct_literal (%.loc7_33, %.loc7_46) -// CHECK:STDOUT: %.loc7_48.1: %.11 = struct_literal (%.loc7_47.1) +// CHECK:STDOUT: %.loc7_33: Core.IntLiteral = int_value 0 [template = constants.%.9] +// CHECK:STDOUT: %.loc7_46: Core.IntLiteral = int_value 1 [template = constants.%.10] +// CHECK:STDOUT: %.loc7_47.1: %.11 = struct_literal (%.loc7_33, %.loc7_46) +// CHECK:STDOUT: %.loc7_48.1: %.12 = struct_literal (%.loc7_47.1) +// CHECK:STDOUT: %.loc7_47.2: %Convert.type.2 = interface_witness_access constants.%.36, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc7_47.3: = bound_method %.loc7_33, %.loc7_47.2 [template = constants.%.37] +// CHECK:STDOUT: %int.convert_checked.loc7_47.1: init i32 = call %.loc7_47.3(%.loc7_33) [template = constants.%.38] +// CHECK:STDOUT: %.loc7_47.4: init i32 = converted %.loc7_33, %int.convert_checked.loc7_47.1 [template = constants.%.38] // CHECK:STDOUT: %.loc7_48.2: ref %Base = class_element_access %a.var, element0 -// CHECK:STDOUT: %.loc7_47.2: ref i32 = class_element_access %.loc7_48.2, element0 -// CHECK:STDOUT: %.loc7_47.3: init i32 = initialize_from %.loc7_33 to %.loc7_47.2 [template = constants.%.9] -// CHECK:STDOUT: %.loc7_47.4: ref i32 = class_element_access %.loc7_48.2, element1 -// CHECK:STDOUT: %.loc7_47.5: init i32 = initialize_from %.loc7_46 to %.loc7_47.4 [template = constants.%.10] -// CHECK:STDOUT: %.loc7_47.6: init %Base = class_init (%.loc7_47.3, %.loc7_47.5), %.loc7_48.2 [template = constants.%struct.1] -// CHECK:STDOUT: %.loc7_48.3: init %Base = converted %.loc7_47.1, %.loc7_47.6 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc7_47.5: ref i32 = class_element_access %.loc7_48.2, element0 +// CHECK:STDOUT: %.loc7_47.6: init i32 = initialize_from %.loc7_47.4 to %.loc7_47.5 [template = constants.%.38] +// CHECK:STDOUT: %.loc7_47.7: %Convert.type.2 = interface_witness_access constants.%.36, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc7_47.8: = bound_method %.loc7_46, %.loc7_47.7 [template = constants.%.39] +// CHECK:STDOUT: %int.convert_checked.loc7_47.2: init i32 = call %.loc7_47.8(%.loc7_46) [template = constants.%.40] +// CHECK:STDOUT: %.loc7_47.9: init i32 = converted %.loc7_46, %int.convert_checked.loc7_47.2 [template = constants.%.40] +// CHECK:STDOUT: %.loc7_47.10: ref i32 = class_element_access %.loc7_48.2, element1 +// CHECK:STDOUT: %.loc7_47.11: init i32 = initialize_from %.loc7_47.9 to %.loc7_47.10 [template = constants.%.40] +// CHECK:STDOUT: %.loc7_47.12: init %Base = class_init (%.loc7_47.6, %.loc7_47.11), %.loc7_48.2 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc7_48.3: init %Base = converted %.loc7_47.1, %.loc7_47.12 [template = constants.%struct.1] // CHECK:STDOUT: %.loc7_48.4: init %Child = class_init (%.loc7_48.3), %a.var [template = constants.%struct.2] // CHECK:STDOUT: %.loc7_49: init %Child = converted %.loc7_48.1, %.loc7_48.4 [template = constants.%struct.2] // CHECK:STDOUT: assign %a.var, %.loc7_49 // CHECK:STDOUT: %a.ref.loc8: ref %Child = name_ref a, %a -// CHECK:STDOUT: %x.ref: %.12 = name_ref x, imports.%import_ref.6 [template = imports.%.1] +// CHECK:STDOUT: %x.ref: %.41 = name_ref x, imports.%import_ref.6 [template = imports.%.1] // CHECK:STDOUT: %.loc8_4.1: ref %Base = class_element_access %a.ref.loc8, element0 // CHECK:STDOUT: %.loc8_4.2: ref %Base = converted %a.ref.loc8, %.loc8_4.1 // CHECK:STDOUT: %.loc8_4.3: ref i32 = class_element_access %.loc8_4.2, element0 -// CHECK:STDOUT: %.loc8_9: i32 = int_value 2 [template = constants.%.13] -// CHECK:STDOUT: assign %.loc8_4.3, %.loc8_9 +// CHECK:STDOUT: %.loc8_9: Core.IntLiteral = int_value 2 [template = constants.%.42] +// CHECK:STDOUT: %.loc8_7.1: %Convert.type.2 = interface_witness_access constants.%.36, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc8_7.2: = bound_method %.loc8_9, %.loc8_7.1 [template = constants.%.43] +// CHECK:STDOUT: %int.convert_checked.loc8: init i32 = call %.loc8_7.2(%.loc8_9) [template = constants.%.44] +// CHECK:STDOUT: %.loc8_7.3: init i32 = converted %.loc8_9, %int.convert_checked.loc8 [template = constants.%.44] +// CHECK:STDOUT: assign %.loc8_4.3, %.loc8_7.3 // CHECK:STDOUT: %a.ref.loc9: ref %Child = name_ref a, %a // CHECK:STDOUT: %F.ref: %F.type = name_ref F, imports.%import_ref.4 [template = constants.%F] // CHECK:STDOUT: %.loc9_4: = bound_method %a.ref.loc9, %F.ref diff --git a/toolchain/check/testdata/class/inheritance_access.carbon b/toolchain/check/testdata/class/inheritance_access.carbon index 83dbad354e2ec..e4f374c27435b 100644 --- a/toolchain/check/testdata/class/inheritance_access.carbon +++ b/toolchain/check/testdata/class/inheritance_access.carbon @@ -463,24 +463,31 @@ class B { // CHECK:STDOUT: %A: type = class_type @A [template] // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 5 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 5 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 5 [template] // CHECK:STDOUT: %SomeProtectedFunction.type: type = fn_type @SomeProtectedFunction [template] // CHECK:STDOUT: %SomeProtectedFunction: %SomeProtectedFunction.type = struct_value () [template] -// CHECK:STDOUT: %.2: type = struct_type {} [template] -// CHECK:STDOUT: %.3: = complete_type_witness %.2 [template] +// CHECK:STDOUT: %.28: type = struct_type {} [template] +// CHECK:STDOUT: %.29: = complete_type_witness %.28 [template] // CHECK:STDOUT: %B: type = class_type @B [template] -// CHECK:STDOUT: %.5: type = unbound_element_type %B, %A [template] +// CHECK:STDOUT: %.31: type = unbound_element_type %B, %A [template] // CHECK:STDOUT: %G.type: type = fn_type @G [template] // CHECK:STDOUT: %G: %G.type = struct_value () [template] // CHECK:STDOUT: %H.type: type = fn_type @H [template] // CHECK:STDOUT: %H: %H.type = struct_value () [template] -// CHECK:STDOUT: %.6: type = struct_type {.base: %A} [template] -// CHECK:STDOUT: %.7: = complete_type_witness %.6 [template] +// CHECK:STDOUT: %.32: type = struct_type {.base: %A} [template] +// CHECK:STDOUT: %.33: = complete_type_witness %.32 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -501,8 +508,13 @@ class B { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc5_32.1: type = value_of_initializer %int.make_type_32 [template = i32] // CHECK:STDOUT: %.loc5_32.2: type = converted %int.make_type_32, %.loc5_32.1 [template = i32] -// CHECK:STDOUT: %.loc5_38: i32 = int_value 5 [template = constants.%.1] -// CHECK:STDOUT: %SOME_CONSTANT: i32 = bind_name SOME_CONSTANT, %.loc5_38 +// CHECK:STDOUT: %.loc5_38: Core.IntLiteral = int_value 5 [template = constants.%.1] +// CHECK:STDOUT: %.loc5_39.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc5_39.2: = bound_method %.loc5_38, %.loc5_39.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc5_39.2(%.loc5_38) [template = constants.%.27] +// CHECK:STDOUT: %.loc5_39.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc5_39.4: i32 = converted %.loc5_38, %.loc5_39.3 [template = constants.%.27] +// CHECK:STDOUT: %SOME_CONSTANT: i32 = bind_name SOME_CONSTANT, %.loc5_39.4 // CHECK:STDOUT: %SomeProtectedFunction.decl: %SomeProtectedFunction.type = fn_decl @SomeProtectedFunction [template = constants.%SomeProtectedFunction] { // CHECK:STDOUT: %return.patt: i32 = return_slot_pattern // CHECK:STDOUT: %return.param_patt: i32 = out_param_pattern %return.patt, runtime_param0 @@ -513,7 +525,7 @@ class B { // CHECK:STDOUT: %return.param: ref i32 = out_param runtime_param0 // CHECK:STDOUT: %return: ref i32 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc9: = complete_type_witness %.2 [template = constants.%.3] +// CHECK:STDOUT: %.loc9: = complete_type_witness %.28 [template = constants.%.29] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%A @@ -523,7 +535,7 @@ class B { // CHECK:STDOUT: // CHECK:STDOUT: class @B { // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A] -// CHECK:STDOUT: %.loc12: %.5 = base_decl %A, element0 [template] +// CHECK:STDOUT: %.loc12: %.31 = base_decl %A, element0 [template] // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] { // CHECK:STDOUT: %return.patt: i32 = return_slot_pattern // CHECK:STDOUT: %return.param_patt: i32 = out_param_pattern %return.patt, runtime_param0 @@ -544,7 +556,7 @@ class B { // CHECK:STDOUT: %return.param: ref i32 = out_param runtime_param0 // CHECK:STDOUT: %return: ref i32 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc21: = complete_type_witness %.6 [template = constants.%.7] +// CHECK:STDOUT: %.loc21: = complete_type_witness %.32 [template = constants.%.33] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%B @@ -556,8 +568,13 @@ class B { // CHECK:STDOUT: // CHECK:STDOUT: fn @SomeProtectedFunction() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7: i32 = int_value 5 [template = constants.%.1] -// CHECK:STDOUT: return %.loc7 +// CHECK:STDOUT: %.loc7_12: Core.IntLiteral = int_value 5 [template = constants.%.1] +// CHECK:STDOUT: %.loc7_13.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc7_13.2: = bound_method %.loc7_12, %.loc7_13.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc7_13.2(%.loc7_12) [template = constants.%.27] +// CHECK:STDOUT: %.loc7_13.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc7_13.4: i32 = converted %.loc7_12, %.loc7_13.3 [template = constants.%.27] +// CHECK:STDOUT: return %.loc7_13.4 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> i32 { @@ -909,23 +926,30 @@ class B { // CHECK:STDOUT: %A: type = class_type @A [template] // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 5 [template] -// CHECK:STDOUT: %.2: type = struct_type {} [template] -// CHECK:STDOUT: %.3: = complete_type_witness %.2 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 5 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 5 [template] +// CHECK:STDOUT: %.28: type = struct_type {} [template] +// CHECK:STDOUT: %.29: = complete_type_witness %.28 [template] // CHECK:STDOUT: %Internal: type = class_type @Internal [template] // CHECK:STDOUT: %B: type = class_type @B [template] -// CHECK:STDOUT: %.5: type = unbound_element_type %B, %Internal [template] +// CHECK:STDOUT: %.31: type = unbound_element_type %B, %Internal [template] // CHECK:STDOUT: %G.type: type = fn_type @G [template] // CHECK:STDOUT: %G: %G.type = struct_value () [template] // CHECK:STDOUT: %SomeFunc.type: type = fn_type @SomeFunc [template] // CHECK:STDOUT: %SomeFunc: %SomeFunc.type = struct_value () [template] -// CHECK:STDOUT: %.6: type = struct_type {.internal: %Internal} [template] -// CHECK:STDOUT: %.7: = complete_type_witness %.6 [template] +// CHECK:STDOUT: %.32: type = struct_type {.internal: %Internal} [template] +// CHECK:STDOUT: %.33: = complete_type_witness %.32 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -948,14 +972,24 @@ class B { // CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc5_42.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] // CHECK:STDOUT: %.loc5_42.2: type = converted %int.make_type_32.loc5, %.loc5_42.1 [template = i32] -// CHECK:STDOUT: %.loc5_48: i32 = int_value 5 [template = constants.%.1] -// CHECK:STDOUT: %SOME_PROTECTED_CONSTANT: i32 = bind_name SOME_PROTECTED_CONSTANT, %.loc5_48 +// CHECK:STDOUT: %.loc5_48: Core.IntLiteral = int_value 5 [template = constants.%.1] +// CHECK:STDOUT: %.loc5_49.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc5_49.2: = bound_method %.loc5_48, %.loc5_49.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc5: init i32 = call %.loc5_49.2(%.loc5_48) [template = constants.%.27] +// CHECK:STDOUT: %.loc5_49.3: i32 = value_of_initializer %int.convert_checked.loc5 [template = constants.%.27] +// CHECK:STDOUT: %.loc5_49.4: i32 = converted %.loc5_48, %.loc5_49.3 [template = constants.%.27] +// CHECK:STDOUT: %SOME_PROTECTED_CONSTANT: i32 = bind_name SOME_PROTECTED_CONSTANT, %.loc5_49.4 // CHECK:STDOUT: %int.make_type_32.loc6: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc6_38.1: type = value_of_initializer %int.make_type_32.loc6 [template = i32] // CHECK:STDOUT: %.loc6_38.2: type = converted %int.make_type_32.loc6, %.loc6_38.1 [template = i32] -// CHECK:STDOUT: %.loc6_44: i32 = int_value 5 [template = constants.%.1] -// CHECK:STDOUT: %SOME_PRIVATE_CONSTANT: i32 = bind_name SOME_PRIVATE_CONSTANT, %.loc6_44 -// CHECK:STDOUT: %.loc7: = complete_type_witness %.2 [template = constants.%.3] +// CHECK:STDOUT: %.loc6_44: Core.IntLiteral = int_value 5 [template = constants.%.1] +// CHECK:STDOUT: %.loc6_45.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc6_45.2: = bound_method %.loc6_44, %.loc6_45.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc6: init i32 = call %.loc6_45.2(%.loc6_44) [template = constants.%.27] +// CHECK:STDOUT: %.loc6_45.3: i32 = value_of_initializer %int.convert_checked.loc6 [template = constants.%.27] +// CHECK:STDOUT: %.loc6_45.4: i32 = converted %.loc6_44, %.loc6_45.3 [template = constants.%.27] +// CHECK:STDOUT: %SOME_PRIVATE_CONSTANT: i32 = bind_name SOME_PRIVATE_CONSTANT, %.loc6_45.4 +// CHECK:STDOUT: %.loc7: = complete_type_witness %.28 [template = constants.%.29] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%A @@ -967,9 +1001,14 @@ class B { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc10_36.1: type = value_of_initializer %int.make_type_32 [template = i32] // CHECK:STDOUT: %.loc10_36.2: type = converted %int.make_type_32, %.loc10_36.1 [template = i32] -// CHECK:STDOUT: %.loc10_42: i32 = int_value 5 [template = constants.%.1] -// CHECK:STDOUT: %INTERNAL_CONSTANT: i32 = bind_name INTERNAL_CONSTANT, %.loc10_42 -// CHECK:STDOUT: %.loc11: = complete_type_witness %.2 [template = constants.%.3] +// CHECK:STDOUT: %.loc10_42: Core.IntLiteral = int_value 5 [template = constants.%.1] +// CHECK:STDOUT: %.loc10_43.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc10_43.2: = bound_method %.loc10_42, %.loc10_43.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc10_43.2(%.loc10_42) [template = constants.%.27] +// CHECK:STDOUT: %.loc10_43.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc10_43.4: i32 = converted %.loc10_42, %.loc10_43.3 [template = constants.%.27] +// CHECK:STDOUT: %INTERNAL_CONSTANT: i32 = bind_name INTERNAL_CONSTANT, %.loc10_43.4 +// CHECK:STDOUT: %.loc11: = complete_type_witness %.28 [template = constants.%.29] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Internal @@ -978,7 +1017,7 @@ class B { // CHECK:STDOUT: // CHECK:STDOUT: class @B { // CHECK:STDOUT: %Internal.ref: type = name_ref Internal, file.%Internal.decl [template = constants.%Internal] -// CHECK:STDOUT: %.loc14: %.5 = field_decl internal, element0 [template] +// CHECK:STDOUT: %.loc14: %.31 = field_decl internal, element0 [template] // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] { // CHECK:STDOUT: %return.patt: i32 = return_slot_pattern // CHECK:STDOUT: %return.param_patt: i32 = out_param_pattern %return.patt, runtime_param0 @@ -1004,7 +1043,7 @@ class B { // CHECK:STDOUT: %return.param: ref i32 = out_param runtime_param1 // CHECK:STDOUT: %return: ref i32 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc46: = complete_type_witness %.6 [template = constants.%.7] +// CHECK:STDOUT: %.loc46: = complete_type_witness %.32 [template = constants.%.33] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%B @@ -1025,7 +1064,7 @@ class B { // CHECK:STDOUT: fn @SomeFunc[%self.param_patt: %B]() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %self.ref: %B = name_ref self, %self -// CHECK:STDOUT: %internal.ref: %.5 = name_ref internal, @B.%.loc14 [template = @B.%.loc14] +// CHECK:STDOUT: %internal.ref: %.31 = name_ref internal, @B.%.loc14 [template = @B.%.loc14] // CHECK:STDOUT: %.loc44_16.1: ref %Internal = class_element_access %self.ref, element0 // CHECK:STDOUT: %.loc44_16.2: %Internal = bind_value %.loc44_16.1 // CHECK:STDOUT: %INTERNAL_CONSTANT.ref: = name_ref INTERNAL_CONSTANT, [template = ] diff --git a/toolchain/check/testdata/class/init_adapt.carbon b/toolchain/check/testdata/class/init_adapt.carbon index 39f82bdf857a5..a94bb105297bf 100644 --- a/toolchain/check/testdata/class/init_adapt.carbon +++ b/toolchain/check/testdata/class/init_adapt.carbon @@ -102,9 +102,18 @@ var e: C = MakeAdaptC(); // CHECK:STDOUT: %.3: = complete_type_witness %.2 [template] // CHECK:STDOUT: %AdaptC: type = class_type @AdaptC [template] // CHECK:STDOUT: %.5: = complete_type_witness %C [template] -// CHECK:STDOUT: %.6: i32 = int_value 1 [template] -// CHECK:STDOUT: %.7: i32 = int_value 2 [template] -// CHECK:STDOUT: %struct: %C = struct_value (%.6, %.7) [template] +// CHECK:STDOUT: %.6: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.7: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.8: type = struct_type {.a: Core.IntLiteral, .b: Core.IntLiteral} [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: %.32: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.33: = bound_method %.6, %Convert.15 [template] +// CHECK:STDOUT: %.34: i32 = int_value 1 [template] +// CHECK:STDOUT: %.35: = bound_method %.7, %Convert.15 [template] +// CHECK:STDOUT: %.36: i32 = int_value 2 [template] +// CHECK:STDOUT: %struct: %C = struct_value (%.34, %.36) [template] // CHECK:STDOUT: %MakeC.type: type = fn_type @MakeC [template] // CHECK:STDOUT: %MakeC: %MakeC.type = struct_value () [template] // CHECK:STDOUT: %MakeAdaptC.type: type = fn_type @MakeAdaptC [template] @@ -113,7 +122,8 @@ var e: C = MakeAdaptC(); // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -194,17 +204,25 @@ var e: C = MakeAdaptC(); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc13_18: i32 = int_value 1 [template = constants.%.6] -// CHECK:STDOUT: %.loc13_26: i32 = int_value 2 [template = constants.%.7] -// CHECK:STDOUT: %.loc13_27.1: %.2 = struct_literal (%.loc13_18, %.loc13_26) -// CHECK:STDOUT: %.loc13_27.2: ref %C = temporary_storage -// CHECK:STDOUT: %.loc13_27.3: ref i32 = class_element_access %.loc13_27.2, element0 -// CHECK:STDOUT: %.loc13_27.4: init i32 = initialize_from %.loc13_18 to %.loc13_27.3 [template = constants.%.6] -// CHECK:STDOUT: %.loc13_27.5: ref i32 = class_element_access %.loc13_27.2, element1 -// CHECK:STDOUT: %.loc13_27.6: init i32 = initialize_from %.loc13_26 to %.loc13_27.5 [template = constants.%.7] -// CHECK:STDOUT: %.loc13_27.7: init %C = class_init (%.loc13_27.4, %.loc13_27.6), %.loc13_27.2 [template = constants.%struct] -// CHECK:STDOUT: %.loc13_27.8: ref %C = temporary %.loc13_27.2, %.loc13_27.7 -// CHECK:STDOUT: %.loc13_28.1: ref %C = converted %.loc13_27.1, %.loc13_27.8 +// CHECK:STDOUT: %.loc13_18: Core.IntLiteral = int_value 1 [template = constants.%.6] +// CHECK:STDOUT: %.loc13_26: Core.IntLiteral = int_value 2 [template = constants.%.7] +// CHECK:STDOUT: %.loc13_27.1: %.8 = struct_literal (%.loc13_18, %.loc13_26) +// CHECK:STDOUT: %.loc13_27.2: %Convert.type.2 = interface_witness_access constants.%.32, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_27.3: = bound_method %.loc13_18, %.loc13_27.2 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc13_27.1: init i32 = call %.loc13_27.3(%.loc13_18) [template = constants.%.34] +// CHECK:STDOUT: %.loc13_27.4: init i32 = converted %.loc13_18, %int.convert_checked.loc13_27.1 [template = constants.%.34] +// CHECK:STDOUT: %.loc13_27.5: ref %C = temporary_storage +// CHECK:STDOUT: %.loc13_27.6: ref i32 = class_element_access %.loc13_27.5, element0 +// CHECK:STDOUT: %.loc13_27.7: init i32 = initialize_from %.loc13_27.4 to %.loc13_27.6 [template = constants.%.34] +// CHECK:STDOUT: %.loc13_27.8: %Convert.type.2 = interface_witness_access constants.%.32, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_27.9: = bound_method %.loc13_26, %.loc13_27.8 [template = constants.%.35] +// CHECK:STDOUT: %int.convert_checked.loc13_27.2: init i32 = call %.loc13_27.9(%.loc13_26) [template = constants.%.36] +// CHECK:STDOUT: %.loc13_27.10: init i32 = converted %.loc13_26, %int.convert_checked.loc13_27.2 [template = constants.%.36] +// CHECK:STDOUT: %.loc13_27.11: ref i32 = class_element_access %.loc13_27.5, element1 +// CHECK:STDOUT: %.loc13_27.12: init i32 = initialize_from %.loc13_27.10 to %.loc13_27.11 [template = constants.%.36] +// CHECK:STDOUT: %.loc13_27.13: init %C = class_init (%.loc13_27.7, %.loc13_27.12), %.loc13_27.5 [template = constants.%struct] +// CHECK:STDOUT: %.loc13_27.14: ref %C = temporary %.loc13_27.5, %.loc13_27.13 +// CHECK:STDOUT: %.loc13_28.1: ref %C = converted %.loc13_27.1, %.loc13_27.14 // CHECK:STDOUT: %.loc13_28.2: %C = bind_value %.loc13_28.1 // CHECK:STDOUT: %a: %C = bind_name a, %.loc13_28.2 // CHECK:STDOUT: %a.ref: %C = name_ref a, %a @@ -245,9 +263,18 @@ var e: C = MakeAdaptC(); // CHECK:STDOUT: %.3: = complete_type_witness %.2 [template] // CHECK:STDOUT: %AdaptC: type = class_type @AdaptC [template] // CHECK:STDOUT: %.5: = complete_type_witness %C [template] -// CHECK:STDOUT: %.6: i32 = int_value 1 [template] -// CHECK:STDOUT: %.7: i32 = int_value 2 [template] -// CHECK:STDOUT: %struct: %C = struct_value (%.6, %.7) [template] +// CHECK:STDOUT: %.6: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.7: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.8: type = struct_type {.a: Core.IntLiteral, .b: Core.IntLiteral} [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: %.32: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.33: = bound_method %.6, %Convert.15 [template] +// CHECK:STDOUT: %.34: i32 = int_value 1 [template] +// CHECK:STDOUT: %.35: = bound_method %.7, %Convert.15 [template] +// CHECK:STDOUT: %.36: i32 = int_value 2 [template] +// CHECK:STDOUT: %struct: %C = struct_value (%.34, %.36) [template] // CHECK:STDOUT: %MakeC.type: type = fn_type @MakeC [template] // CHECK:STDOUT: %MakeC: %MakeC.type = struct_value () [template] // CHECK:STDOUT: %MakeAdaptC.type: type = fn_type @MakeAdaptC [template] @@ -338,17 +365,25 @@ var e: C = MakeAdaptC(); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc13_18: i32 = int_value 1 [template = constants.%.6] -// CHECK:STDOUT: %.loc13_26: i32 = int_value 2 [template = constants.%.7] -// CHECK:STDOUT: %.loc13_27.1: %.2 = struct_literal (%.loc13_18, %.loc13_26) -// CHECK:STDOUT: %.loc13_27.2: ref %C = temporary_storage -// CHECK:STDOUT: %.loc13_27.3: ref i32 = class_element_access %.loc13_27.2, element0 -// CHECK:STDOUT: %.loc13_27.4: init i32 = initialize_from %.loc13_18 to %.loc13_27.3 [template = constants.%.6] -// CHECK:STDOUT: %.loc13_27.5: ref i32 = class_element_access %.loc13_27.2, element1 -// CHECK:STDOUT: %.loc13_27.6: init i32 = initialize_from %.loc13_26 to %.loc13_27.5 [template = constants.%.7] -// CHECK:STDOUT: %.loc13_27.7: init %C = class_init (%.loc13_27.4, %.loc13_27.6), %.loc13_27.2 [template = constants.%struct] -// CHECK:STDOUT: %.loc13_27.8: ref %C = temporary %.loc13_27.2, %.loc13_27.7 -// CHECK:STDOUT: %.loc13_28.1: ref %C = converted %.loc13_27.1, %.loc13_27.8 +// CHECK:STDOUT: %.loc13_18: Core.IntLiteral = int_value 1 [template = constants.%.6] +// CHECK:STDOUT: %.loc13_26: Core.IntLiteral = int_value 2 [template = constants.%.7] +// CHECK:STDOUT: %.loc13_27.1: %.8 = struct_literal (%.loc13_18, %.loc13_26) +// CHECK:STDOUT: %.loc13_27.2: %Convert.type.2 = interface_witness_access constants.%.32, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_27.3: = bound_method %.loc13_18, %.loc13_27.2 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc13_27.1: init i32 = call %.loc13_27.3(%.loc13_18) [template = constants.%.34] +// CHECK:STDOUT: %.loc13_27.4: init i32 = converted %.loc13_18, %int.convert_checked.loc13_27.1 [template = constants.%.34] +// CHECK:STDOUT: %.loc13_27.5: ref %C = temporary_storage +// CHECK:STDOUT: %.loc13_27.6: ref i32 = class_element_access %.loc13_27.5, element0 +// CHECK:STDOUT: %.loc13_27.7: init i32 = initialize_from %.loc13_27.4 to %.loc13_27.6 [template = constants.%.34] +// CHECK:STDOUT: %.loc13_27.8: %Convert.type.2 = interface_witness_access constants.%.32, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_27.9: = bound_method %.loc13_26, %.loc13_27.8 [template = constants.%.35] +// CHECK:STDOUT: %int.convert_checked.loc13_27.2: init i32 = call %.loc13_27.9(%.loc13_26) [template = constants.%.36] +// CHECK:STDOUT: %.loc13_27.10: init i32 = converted %.loc13_26, %int.convert_checked.loc13_27.2 [template = constants.%.36] +// CHECK:STDOUT: %.loc13_27.11: ref i32 = class_element_access %.loc13_27.5, element1 +// CHECK:STDOUT: %.loc13_27.12: init i32 = initialize_from %.loc13_27.10 to %.loc13_27.11 [template = constants.%.36] +// CHECK:STDOUT: %.loc13_27.13: init %C = class_init (%.loc13_27.7, %.loc13_27.12), %.loc13_27.5 [template = constants.%struct] +// CHECK:STDOUT: %.loc13_27.14: ref %C = temporary %.loc13_27.5, %.loc13_27.13 +// CHECK:STDOUT: %.loc13_28.1: ref %C = converted %.loc13_27.1, %.loc13_27.14 // CHECK:STDOUT: %.loc13_28.2: %C = bind_value %.loc13_28.1 // CHECK:STDOUT: %a: %C = bind_name a, %.loc13_28.2 // CHECK:STDOUT: %a.ref: %C = name_ref a, %a diff --git a/toolchain/check/testdata/class/init_as.carbon b/toolchain/check/testdata/class/init_as.carbon index 68a22a92957d1..e91a29f703bb1 100644 --- a/toolchain/check/testdata/class/init_as.carbon +++ b/toolchain/check/testdata/class/init_as.carbon @@ -28,14 +28,24 @@ fn F() -> i32 { // CHECK:STDOUT: %.3: = complete_type_witness %.2 [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %.4: i32 = int_value 1 [template] -// CHECK:STDOUT: %.5: i32 = int_value 2 [template] -// CHECK:STDOUT: %struct: %Class = struct_value (%.4, %.5) [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.5: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.6: type = struct_type {.a: Core.IntLiteral, .b: Core.IntLiteral} [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: %.31: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.32: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.33: i32 = int_value 1 [template] +// CHECK:STDOUT: %.34: = bound_method %.5, %Convert.15 [template] +// CHECK:STDOUT: %.35: i32 = int_value 2 [template] +// CHECK:STDOUT: %struct: %Class = struct_value (%.33, %.35) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -80,18 +90,26 @@ fn F() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc17_17: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc17_25: i32 = int_value 2 [template = constants.%.5] -// CHECK:STDOUT: %.loc17_26.1: %.2 = struct_literal (%.loc17_17, %.loc17_25) +// CHECK:STDOUT: %.loc17_17: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc17_25: Core.IntLiteral = int_value 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc17_26.1: %.6 = struct_literal (%.loc17_17, %.loc17_25) // CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc17_26.2: ref %Class = temporary_storage -// CHECK:STDOUT: %.loc17_26.3: ref i32 = class_element_access %.loc17_26.2, element0 -// CHECK:STDOUT: %.loc17_26.4: init i32 = initialize_from %.loc17_17 to %.loc17_26.3 [template = constants.%.4] -// CHECK:STDOUT: %.loc17_26.5: ref i32 = class_element_access %.loc17_26.2, element1 -// CHECK:STDOUT: %.loc17_26.6: init i32 = initialize_from %.loc17_25 to %.loc17_26.5 [template = constants.%.5] -// CHECK:STDOUT: %.loc17_26.7: init %Class = class_init (%.loc17_26.4, %.loc17_26.6), %.loc17_26.2 [template = constants.%struct] -// CHECK:STDOUT: %.loc17_26.8: ref %Class = temporary %.loc17_26.2, %.loc17_26.7 -// CHECK:STDOUT: %.loc17_28: ref %Class = converted %.loc17_26.1, %.loc17_26.8 +// CHECK:STDOUT: %.loc17_26.2: %Convert.type.2 = interface_witness_access constants.%.31, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc17_26.3: = bound_method %.loc17_17, %.loc17_26.2 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc17_26.1: init i32 = call %.loc17_26.3(%.loc17_17) [template = constants.%.33] +// CHECK:STDOUT: %.loc17_26.4: init i32 = converted %.loc17_17, %int.convert_checked.loc17_26.1 [template = constants.%.33] +// CHECK:STDOUT: %.loc17_26.5: ref %Class = temporary_storage +// CHECK:STDOUT: %.loc17_26.6: ref i32 = class_element_access %.loc17_26.5, element0 +// CHECK:STDOUT: %.loc17_26.7: init i32 = initialize_from %.loc17_26.4 to %.loc17_26.6 [template = constants.%.33] +// CHECK:STDOUT: %.loc17_26.8: %Convert.type.2 = interface_witness_access constants.%.31, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc17_26.9: = bound_method %.loc17_25, %.loc17_26.8 [template = constants.%.34] +// CHECK:STDOUT: %int.convert_checked.loc17_26.2: init i32 = call %.loc17_26.9(%.loc17_25) [template = constants.%.35] +// CHECK:STDOUT: %.loc17_26.10: init i32 = converted %.loc17_25, %int.convert_checked.loc17_26.2 [template = constants.%.35] +// CHECK:STDOUT: %.loc17_26.11: ref i32 = class_element_access %.loc17_26.5, element1 +// CHECK:STDOUT: %.loc17_26.12: init i32 = initialize_from %.loc17_26.10 to %.loc17_26.11 [template = constants.%.35] +// CHECK:STDOUT: %.loc17_26.13: init %Class = class_init (%.loc17_26.7, %.loc17_26.12), %.loc17_26.5 [template = constants.%struct] +// CHECK:STDOUT: %.loc17_26.14: ref %Class = temporary %.loc17_26.5, %.loc17_26.13 +// CHECK:STDOUT: %.loc17_28: ref %Class = converted %.loc17_26.1, %.loc17_26.14 // CHECK:STDOUT: %a.ref: %.1 = name_ref a, @Class.%.loc12_8 [template = @Class.%.loc12_8] // CHECK:STDOUT: %.loc17_37.1: ref i32 = class_element_access %.loc17_28, element0 // CHECK:STDOUT: %.loc17_37.2: i32 = bind_value %.loc17_37.1 diff --git a/toolchain/check/testdata/class/method.carbon b/toolchain/check/testdata/class/method.carbon index ef6b8612911b1..89cb9aba07b1d 100644 --- a/toolchain/check/testdata/class/method.carbon +++ b/toolchain/check/testdata/class/method.carbon @@ -78,8 +78,15 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: %CallAlias: %CallAlias.type = struct_value () [template] // CHECK:STDOUT: %CallOnConstBoundMethod.type: type = fn_type @CallOnConstBoundMethod [template] // CHECK:STDOUT: %CallOnConstBoundMethod: %CallOnConstBoundMethod.type = struct_value () [template] -// CHECK:STDOUT: %.6: i32 = int_value 1 [template] -// CHECK:STDOUT: %struct: %Class = struct_value (%.6) [template] +// CHECK:STDOUT: %.6: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.7: type = struct_type {.k: Core.IntLiteral} [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: %.31: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.32: = bound_method %.6, %Convert.15 [template] +// CHECK:STDOUT: %.33: i32 = int_value 1 [template] +// CHECK:STDOUT: %struct: %Class = struct_value (%.33) [template] // CHECK:STDOUT: %CallWithAddr.type: type = fn_type @CallWithAddr [template] // CHECK:STDOUT: %CallWithAddr: %CallWithAddr.type = struct_value () [template] // CHECK:STDOUT: %CallFThroughPointer.type: type = fn_type @CallFThroughPointer [template] @@ -96,7 +103,8 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -329,15 +337,19 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @CallOnConstBoundMethod() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc35_17: i32 = int_value 1 [template = constants.%.6] -// CHECK:STDOUT: %.loc35_18.1: %.3 = struct_literal (%.loc35_17) +// CHECK:STDOUT: %.loc35_17: Core.IntLiteral = int_value 1 [template = constants.%.6] +// CHECK:STDOUT: %.loc35_18.1: %.7 = struct_literal (%.loc35_17) // CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc35_18.2: ref %Class = temporary_storage -// CHECK:STDOUT: %.loc35_18.3: ref i32 = class_element_access %.loc35_18.2, element0 -// CHECK:STDOUT: %.loc35_18.4: init i32 = initialize_from %.loc35_17 to %.loc35_18.3 [template = constants.%.6] -// CHECK:STDOUT: %.loc35_18.5: init %Class = class_init (%.loc35_18.4), %.loc35_18.2 [template = constants.%struct] -// CHECK:STDOUT: %.loc35_18.6: ref %Class = temporary %.loc35_18.2, %.loc35_18.5 -// CHECK:STDOUT: %.loc35_20.1: ref %Class = converted %.loc35_18.1, %.loc35_18.6 +// CHECK:STDOUT: %.loc35_18.2: %Convert.type.2 = interface_witness_access constants.%.31, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc35_18.3: = bound_method %.loc35_17, %.loc35_18.2 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc35_18.3(%.loc35_17) [template = constants.%.33] +// CHECK:STDOUT: %.loc35_18.4: init i32 = converted %.loc35_17, %int.convert_checked [template = constants.%.33] +// CHECK:STDOUT: %.loc35_18.5: ref %Class = temporary_storage +// CHECK:STDOUT: %.loc35_18.6: ref i32 = class_element_access %.loc35_18.5, element0 +// CHECK:STDOUT: %.loc35_18.7: init i32 = initialize_from %.loc35_18.4 to %.loc35_18.6 [template = constants.%.33] +// CHECK:STDOUT: %.loc35_18.8: init %Class = class_init (%.loc35_18.7), %.loc35_18.5 [template = constants.%struct] +// CHECK:STDOUT: %.loc35_18.9: ref %Class = temporary %.loc35_18.5, %.loc35_18.8 +// CHECK:STDOUT: %.loc35_20.1: ref %Class = converted %.loc35_18.1, %.loc35_18.9 // CHECK:STDOUT: %F.ref: %F.type = name_ref F, @Class.%F.decl [template = constants.%F] // CHECK:STDOUT: %.loc35_29: = bound_method %.loc35_20.1, %F.ref // CHECK:STDOUT: %.loc35_20.2: %Class = bind_value %.loc35_20.1 diff --git a/toolchain/check/testdata/class/reorder.carbon b/toolchain/check/testdata/class/reorder.carbon index 9047817d228a9..d6c39c8657084 100644 --- a/toolchain/check/testdata/class/reorder.carbon +++ b/toolchain/check/testdata/class/reorder.carbon @@ -30,12 +30,19 @@ class Class { // CHECK:STDOUT: %F: %F.type = struct_value () [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: = complete_type_witness %.1 [template] -// CHECK:STDOUT: %.4: i32 = int_value 1 [template] +// CHECK:STDOUT: %.4: 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: %.28: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.29: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -91,7 +98,12 @@ class Class { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc17: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: return %.loc17 +// CHECK:STDOUT: %.loc17_12: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc17_13.1: %Convert.type.2 = interface_witness_access constants.%.28, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc17_13.2: = bound_method %.loc17_12, %.loc17_13.1 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc17_13.2(%.loc17_12) [template = constants.%.30] +// CHECK:STDOUT: %.loc17_13.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.30] +// CHECK:STDOUT: %.loc17_13.4: i32 = converted %.loc17_12, %.loc17_13.3 [template = constants.%.30] +// CHECK:STDOUT: return %.loc17_13.4 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/reorder_qualified.carbon b/toolchain/check/testdata/class/reorder_qualified.carbon index 57acf0f1cfc6c..33f813f3c4d84 100644 --- a/toolchain/check/testdata/class/reorder_qualified.carbon +++ b/toolchain/check/testdata/class/reorder_qualified.carbon @@ -78,19 +78,36 @@ class A { // CHECK:STDOUT: %.10: type = unbound_element_type %A, i32 [template] // CHECK:STDOUT: %.11: type = struct_type {.a: i32} [template] // CHECK:STDOUT: %.12: = complete_type_witness %.11 [template] -// CHECK:STDOUT: %.14: i32 = int_value 1 [template] -// CHECK:STDOUT: %struct.1: %A = struct_value (%.14) [template] -// CHECK:STDOUT: %.16: i32 = int_value 2 [template] -// CHECK:STDOUT: %struct.2: %B = struct_value (%.16) [template] -// CHECK:STDOUT: %.18: i32 = int_value 3 [template] -// CHECK:STDOUT: %struct.3: %C = struct_value (%.18) [template] -// CHECK:STDOUT: %.20: i32 = int_value 4 [template] -// CHECK:STDOUT: %struct.4: %D = struct_value (%.20) [template] +// CHECK:STDOUT: %.14: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.15: type = struct_type {.a: Core.IntLiteral} [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: %.39: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.40: = bound_method %.14, %Convert.15 [template] +// CHECK:STDOUT: %.41: i32 = int_value 1 [template] +// CHECK:STDOUT: %struct.1: %A = struct_value (%.41) [template] +// CHECK:STDOUT: %.43: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.44: type = struct_type {.b: Core.IntLiteral} [template] +// CHECK:STDOUT: %.45: = bound_method %.43, %Convert.15 [template] +// CHECK:STDOUT: %.46: i32 = int_value 2 [template] +// CHECK:STDOUT: %struct.2: %B = struct_value (%.46) [template] +// CHECK:STDOUT: %.48: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.49: type = struct_type {.c: Core.IntLiteral} [template] +// CHECK:STDOUT: %.50: = bound_method %.48, %Convert.15 [template] +// CHECK:STDOUT: %.51: i32 = int_value 3 [template] +// CHECK:STDOUT: %struct.3: %C = struct_value (%.51) [template] +// CHECK:STDOUT: %.53: Core.IntLiteral = int_value 4 [template] +// CHECK:STDOUT: %.54: type = struct_type {.d: Core.IntLiteral} [template] +// CHECK:STDOUT: %.55: = bound_method %.53, %Convert.15 [template] +// CHECK:STDOUT: %.56: i32 = int_value 4 [template] +// CHECK:STDOUT: %struct.4: %D = struct_value (%.56) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -180,42 +197,58 @@ class A { // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A] // CHECK:STDOUT: %a.var: ref %A = var a // CHECK:STDOUT: %a: ref %A = bind_name a, %a.var -// CHECK:STDOUT: %.loc29_24: i32 = int_value 1 [template = constants.%.14] -// CHECK:STDOUT: %.loc29_25.1: %.11 = struct_literal (%.loc29_24) -// CHECK:STDOUT: %.loc29_25.2: ref i32 = class_element_access %a.var, element0 -// CHECK:STDOUT: %.loc29_25.3: init i32 = initialize_from %.loc29_24 to %.loc29_25.2 [template = constants.%.14] -// CHECK:STDOUT: %.loc29_25.4: init %A = class_init (%.loc29_25.3), %a.var [template = constants.%struct.1] -// CHECK:STDOUT: %.loc29_26: init %A = converted %.loc29_25.1, %.loc29_25.4 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc29_24: Core.IntLiteral = int_value 1 [template = constants.%.14] +// CHECK:STDOUT: %.loc29_25.1: %.15 = struct_literal (%.loc29_24) +// CHECK:STDOUT: %.loc29_25.2: %Convert.type.2 = interface_witness_access constants.%.39, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc29_25.3: = bound_method %.loc29_24, %.loc29_25.2 [template = constants.%.40] +// CHECK:STDOUT: %int.convert_checked.loc29: init i32 = call %.loc29_25.3(%.loc29_24) [template = constants.%.41] +// CHECK:STDOUT: %.loc29_25.4: init i32 = converted %.loc29_24, %int.convert_checked.loc29 [template = constants.%.41] +// CHECK:STDOUT: %.loc29_25.5: ref i32 = class_element_access %a.var, element0 +// CHECK:STDOUT: %.loc29_25.6: init i32 = initialize_from %.loc29_25.4 to %.loc29_25.5 [template = constants.%.41] +// CHECK:STDOUT: %.loc29_25.7: init %A = class_init (%.loc29_25.6), %a.var [template = constants.%struct.1] +// CHECK:STDOUT: %.loc29_26: init %A = converted %.loc29_25.1, %.loc29_25.7 [template = constants.%struct.1] // CHECK:STDOUT: assign %a.var, %.loc29_26 // CHECK:STDOUT: %B.ref: type = name_ref B, @A.%B.decl [template = constants.%B] // CHECK:STDOUT: %b.var: ref %B = var b // CHECK:STDOUT: %b: ref %B = bind_name b, %b.var -// CHECK:STDOUT: %.loc30_24: i32 = int_value 2 [template = constants.%.16] -// CHECK:STDOUT: %.loc30_25.1: %.2 = struct_literal (%.loc30_24) -// CHECK:STDOUT: %.loc30_25.2: ref i32 = class_element_access %b.var, element0 -// CHECK:STDOUT: %.loc30_25.3: init i32 = initialize_from %.loc30_24 to %.loc30_25.2 [template = constants.%.16] -// CHECK:STDOUT: %.loc30_25.4: init %B = class_init (%.loc30_25.3), %b.var [template = constants.%struct.2] -// CHECK:STDOUT: %.loc30_26: init %B = converted %.loc30_25.1, %.loc30_25.4 [template = constants.%struct.2] +// CHECK:STDOUT: %.loc30_24: Core.IntLiteral = int_value 2 [template = constants.%.43] +// CHECK:STDOUT: %.loc30_25.1: %.44 = struct_literal (%.loc30_24) +// CHECK:STDOUT: %.loc30_25.2: %Convert.type.2 = interface_witness_access constants.%.39, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc30_25.3: = bound_method %.loc30_24, %.loc30_25.2 [template = constants.%.45] +// CHECK:STDOUT: %int.convert_checked.loc30: init i32 = call %.loc30_25.3(%.loc30_24) [template = constants.%.46] +// CHECK:STDOUT: %.loc30_25.4: init i32 = converted %.loc30_24, %int.convert_checked.loc30 [template = constants.%.46] +// CHECK:STDOUT: %.loc30_25.5: ref i32 = class_element_access %b.var, element0 +// CHECK:STDOUT: %.loc30_25.6: init i32 = initialize_from %.loc30_25.4 to %.loc30_25.5 [template = constants.%.46] +// CHECK:STDOUT: %.loc30_25.7: init %B = class_init (%.loc30_25.6), %b.var [template = constants.%struct.2] +// CHECK:STDOUT: %.loc30_26: init %B = converted %.loc30_25.1, %.loc30_25.7 [template = constants.%struct.2] // CHECK:STDOUT: assign %b.var, %.loc30_26 // CHECK:STDOUT: %C.ref: type = name_ref C, @B.%C.decl [template = constants.%C] // CHECK:STDOUT: %c.var: ref %C = var c // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var -// CHECK:STDOUT: %.loc31_24: i32 = int_value 3 [template = constants.%.18] -// CHECK:STDOUT: %.loc31_25.1: %.8 = struct_literal (%.loc31_24) -// CHECK:STDOUT: %.loc31_25.2: ref i32 = class_element_access %c.var, element0 -// CHECK:STDOUT: %.loc31_25.3: init i32 = initialize_from %.loc31_24 to %.loc31_25.2 [template = constants.%.18] -// CHECK:STDOUT: %.loc31_25.4: init %C = class_init (%.loc31_25.3), %c.var [template = constants.%struct.3] -// CHECK:STDOUT: %.loc31_26: init %C = converted %.loc31_25.1, %.loc31_25.4 [template = constants.%struct.3] +// CHECK:STDOUT: %.loc31_24: Core.IntLiteral = int_value 3 [template = constants.%.48] +// CHECK:STDOUT: %.loc31_25.1: %.49 = struct_literal (%.loc31_24) +// CHECK:STDOUT: %.loc31_25.2: %Convert.type.2 = interface_witness_access constants.%.39, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc31_25.3: = bound_method %.loc31_24, %.loc31_25.2 [template = constants.%.50] +// CHECK:STDOUT: %int.convert_checked.loc31: init i32 = call %.loc31_25.3(%.loc31_24) [template = constants.%.51] +// CHECK:STDOUT: %.loc31_25.4: init i32 = converted %.loc31_24, %int.convert_checked.loc31 [template = constants.%.51] +// CHECK:STDOUT: %.loc31_25.5: ref i32 = class_element_access %c.var, element0 +// CHECK:STDOUT: %.loc31_25.6: init i32 = initialize_from %.loc31_25.4 to %.loc31_25.5 [template = constants.%.51] +// CHECK:STDOUT: %.loc31_25.7: init %C = class_init (%.loc31_25.6), %c.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc31_26: init %C = converted %.loc31_25.1, %.loc31_25.7 [template = constants.%struct.3] // CHECK:STDOUT: assign %c.var, %.loc31_26 // CHECK:STDOUT: %D.ref: type = name_ref D, @C.%D.decl [template = constants.%D] // CHECK:STDOUT: %d.var: ref %D = var d // CHECK:STDOUT: %d: ref %D = bind_name d, %d.var -// CHECK:STDOUT: %.loc32_24: i32 = int_value 4 [template = constants.%.20] -// CHECK:STDOUT: %.loc32_25.1: %.5 = struct_literal (%.loc32_24) -// CHECK:STDOUT: %.loc32_25.2: ref i32 = class_element_access %d.var, element0 -// CHECK:STDOUT: %.loc32_25.3: init i32 = initialize_from %.loc32_24 to %.loc32_25.2 [template = constants.%.20] -// CHECK:STDOUT: %.loc32_25.4: init %D = class_init (%.loc32_25.3), %d.var [template = constants.%struct.4] -// CHECK:STDOUT: %.loc32_26: init %D = converted %.loc32_25.1, %.loc32_25.4 [template = constants.%struct.4] +// CHECK:STDOUT: %.loc32_24: Core.IntLiteral = int_value 4 [template = constants.%.53] +// CHECK:STDOUT: %.loc32_25.1: %.54 = struct_literal (%.loc32_24) +// CHECK:STDOUT: %.loc32_25.2: %Convert.type.2 = interface_witness_access constants.%.39, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc32_25.3: = bound_method %.loc32_24, %.loc32_25.2 [template = constants.%.55] +// CHECK:STDOUT: %int.convert_checked.loc32: init i32 = call %.loc32_25.3(%.loc32_24) [template = constants.%.56] +// CHECK:STDOUT: %.loc32_25.4: init i32 = converted %.loc32_24, %int.convert_checked.loc32 [template = constants.%.56] +// CHECK:STDOUT: %.loc32_25.5: ref i32 = class_element_access %d.var, element0 +// CHECK:STDOUT: %.loc32_25.6: init i32 = initialize_from %.loc32_25.4 to %.loc32_25.5 [template = constants.%.56] +// CHECK:STDOUT: %.loc32_25.7: init %D = class_init (%.loc32_25.6), %d.var [template = constants.%struct.4] +// CHECK:STDOUT: %.loc32_26: init %D = converted %.loc32_25.1, %.loc32_25.7 [template = constants.%struct.4] // CHECK:STDOUT: assign %d.var, %.loc32_26 // CHECK:STDOUT: %AF.ref: %AF.type = name_ref AF, @A.%AF.decl [template = constants.%AF] // CHECK:STDOUT: %AF.call: init %empty_tuple.type = call %AF.ref() diff --git a/toolchain/check/testdata/class/scope.carbon b/toolchain/check/testdata/class/scope.carbon index 4d83445c186ed..403876c6bfdc6 100644 --- a/toolchain/check/testdata/class/scope.carbon +++ b/toolchain/check/testdata/class/scope.carbon @@ -39,17 +39,26 @@ fn Run() { // CHECK:STDOUT: %G: %G.type = struct_value () [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: = complete_type_witness %.1 [template] -// CHECK:STDOUT: %.3: i32 = int_value 1 [template] +// CHECK:STDOUT: %.3: 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: %.27: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.28: = bound_method %.3, %Convert.15 [template] +// CHECK:STDOUT: %.29: i32 = int_value 1 [template] // CHECK:STDOUT: %F.type.2: type = fn_type @F.2 [template] // CHECK:STDOUT: %F.2: %F.type.2 = struct_value () [template] -// CHECK:STDOUT: %.4: i32 = int_value 2 [template] +// CHECK:STDOUT: %.30: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.31: = bound_method %.30, %Convert.15 [template] +// CHECK:STDOUT: %.32: i32 = int_value 2 [template] // CHECK:STDOUT: %Run.type: type = fn_type @Run [template] // CHECK:STDOUT: %Run: %Run.type = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -108,8 +117,13 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F.1() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc13: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: return %.loc13 +// CHECK:STDOUT: %.loc13_12: Core.IntLiteral = int_value 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc13_13.1: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_13.2: = bound_method %.loc13_12, %.loc13_13.1 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc13_13.2(%.loc13_12) [template = constants.%.29] +// CHECK:STDOUT: %.loc13_13.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.29] +// CHECK:STDOUT: %.loc13_13.4: i32 = converted %.loc13_12, %.loc13_13.3 [template = constants.%.29] +// CHECK:STDOUT: return %.loc13_13.4 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> i32 { @@ -123,8 +137,13 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F.2() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc22: i32 = int_value 2 [template = constants.%.4] -// CHECK:STDOUT: return %.loc22 +// CHECK:STDOUT: %.loc22_10: Core.IntLiteral = int_value 2 [template = constants.%.30] +// CHECK:STDOUT: %.loc22_11.1: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc22_11.2: = bound_method %.loc22_10, %.loc22_11.1 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc22_11.2(%.loc22_10) [template = constants.%.32] +// CHECK:STDOUT: %.loc22_11.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.32] +// CHECK:STDOUT: %.loc22_11.4: i32 = converted %.loc22_10, %.loc22_11.3 [template = constants.%.32] +// CHECK:STDOUT: return %.loc22_11.4 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { diff --git a/toolchain/check/testdata/class/self_conversion.carbon b/toolchain/check/testdata/class/self_conversion.carbon index 20fbf9323ac7e..ff79b38923821 100644 --- a/toolchain/check/testdata/class/self_conversion.carbon +++ b/toolchain/check/testdata/class/self_conversion.carbon @@ -51,15 +51,22 @@ fn Call(p: Derived*) -> i32 { // CHECK:STDOUT: %AddrSelfBase: %AddrSelfBase.type = struct_value () [template] // CHECK:STDOUT: %.7: type = struct_type {.base: %Base} [template] // CHECK:STDOUT: %.8: = complete_type_witness %.7 [template] -// CHECK:STDOUT: %.9: i32 = int_value 1 [template] -// CHECK:STDOUT: %.10: type = ptr_type %Derived [template] +// CHECK:STDOUT: %.9: 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: %.33: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.34: = bound_method %.9, %Convert.15 [template] +// CHECK:STDOUT: %.35: i32 = int_value 1 [template] +// CHECK:STDOUT: %.36: type = ptr_type %Derived [template] // CHECK:STDOUT: %Call.type: type = fn_type @Call [template] // CHECK:STDOUT: %Call: %Call.type = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -101,18 +108,18 @@ fn Call(p: Derived*) -> i32 { // CHECK:STDOUT: %self.loc26: %.6 = bind_name self, %self.param.loc26 // CHECK:STDOUT: } // CHECK:STDOUT: %Call.decl: %Call.type = fn_decl @Call [template = constants.%Call] { -// CHECK:STDOUT: %p.patt: %.10 = binding_pattern p -// CHECK:STDOUT: %p.param_patt: %.10 = value_param_pattern %p.patt, runtime_param0 +// CHECK:STDOUT: %p.patt: %.36 = binding_pattern p +// CHECK:STDOUT: %p.param_patt: %.36 = value_param_pattern %p.patt, runtime_param0 // CHECK:STDOUT: %return.patt: i32 = return_slot_pattern // CHECK:STDOUT: %return.param_patt: i32 = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { // CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl [template = constants.%Derived] -// CHECK:STDOUT: %.loc30_19: type = ptr_type %Derived [template = constants.%.10] +// CHECK:STDOUT: %.loc30_19: type = ptr_type %Derived [template = constants.%.36] // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc30_25.1: type = value_of_initializer %int.make_type_32 [template = i32] // CHECK:STDOUT: %.loc30_25.2: type = converted %int.make_type_32, %.loc30_25.1 [template = i32] -// CHECK:STDOUT: %p.param: %.10 = value_param runtime_param0 -// CHECK:STDOUT: %p: %.10 = bind_name p, %p.param +// CHECK:STDOUT: %p.param: %.36 = value_param runtime_param0 +// CHECK:STDOUT: %p: %.36 = bind_name p, %p.param // CHECK:STDOUT: %return.param: ref i32 = out_param runtime_param1 // CHECK:STDOUT: %return: ref i32 = return_slot %return.param // CHECK:STDOUT: } @@ -183,24 +190,28 @@ fn Call(p: Derived*) -> i32 { // CHECK:STDOUT: %.loc27_4: ref %Base = deref %self.ref // CHECK:STDOUT: %a.ref: %.1 = name_ref a, @Base.%.loc12_8 [template = @Base.%.loc12_8] // CHECK:STDOUT: %.loc27_10: ref i32 = class_element_access %.loc27_4, element0 -// CHECK:STDOUT: %.loc27_15: i32 = int_value 1 [template = constants.%.9] -// CHECK:STDOUT: assign %.loc27_10, %.loc27_15 +// CHECK:STDOUT: %.loc27_15: Core.IntLiteral = int_value 1 [template = constants.%.9] +// CHECK:STDOUT: %.loc27_13.1: %Convert.type.2 = interface_witness_access constants.%.33, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc27_13.2: = bound_method %.loc27_15, %.loc27_13.1 [template = constants.%.34] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc27_13.2(%.loc27_15) [template = constants.%.35] +// CHECK:STDOUT: %.loc27_13.3: init i32 = converted %.loc27_15, %int.convert_checked [template = constants.%.35] +// CHECK:STDOUT: assign %.loc27_10, %.loc27_13.3 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Call(%p.param_patt: %.10) -> i32 { +// CHECK:STDOUT: fn @Call(%p.param_patt: %.36) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %p.ref.loc31: %.10 = name_ref p, %p +// CHECK:STDOUT: %p.ref.loc31: %.36 = name_ref p, %p // CHECK:STDOUT: %.loc31_4.1: ref %Derived = deref %p.ref.loc31 // CHECK:STDOUT: %AddrSelfBase.ref: %AddrSelfBase.type = name_ref AddrSelfBase, @Derived.%AddrSelfBase.decl [template = constants.%AddrSelfBase] // CHECK:STDOUT: %.loc31_7: = bound_method %.loc31_4.1, %AddrSelfBase.ref -// CHECK:STDOUT: %.loc31_4.2: %.10 = addr_of %.loc31_4.1 +// CHECK:STDOUT: %.loc31_4.2: %.36 = addr_of %.loc31_4.1 // CHECK:STDOUT: %.loc31_4.3: ref %Derived = deref %.loc31_4.2 // CHECK:STDOUT: %.loc31_4.4: ref %Base = class_element_access %.loc31_4.3, element0 // CHECK:STDOUT: %.loc31_4.5: %.6 = addr_of %.loc31_4.4 // CHECK:STDOUT: %.loc31_4.6: %.6 = converted %.loc31_4.2, %.loc31_4.5 // CHECK:STDOUT: %AddrSelfBase.call: init %empty_tuple.type = call %.loc31_7(%.loc31_4.6) -// CHECK:STDOUT: %p.ref.loc32: %.10 = name_ref p, %p +// CHECK:STDOUT: %p.ref.loc32: %.36 = name_ref p, %p // CHECK:STDOUT: %.loc32_11.1: ref %Derived = deref %p.ref.loc32 // CHECK:STDOUT: %SelfBase.ref: %SelfBase.type = name_ref SelfBase, @Derived.%SelfBase.decl [template = constants.%SelfBase] // CHECK:STDOUT: %.loc32_14: = bound_method %.loc32_11.1, %SelfBase.ref diff --git a/toolchain/check/testdata/class/syntactic_merge_literal.carbon b/toolchain/check/testdata/class/syntactic_merge_literal.carbon index 235117890a430..1d4c5299d5a2c 100644 --- a/toolchain/check/testdata/class/syntactic_merge_literal.carbon +++ b/toolchain/check/testdata/class/syntactic_merge_literal.carbon @@ -40,8 +40,14 @@ class D(b:! C(1_000)) {} // CHECK:STDOUT: %C.2: type = class_type @C, @C(%a) [symbolic] // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: = complete_type_witness %.1 [template] -// CHECK:STDOUT: %.3: i32 = int_value 1000 [template] -// CHECK:STDOUT: %C.3: type = class_type @C, @C(%.3) [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 1000 [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: %.27: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.28: = bound_method %.3, %Convert.15 [template] +// CHECK:STDOUT: %.29: i32 = int_value 1000 [template] +// CHECK:STDOUT: %C.3: type = class_type @C, @C(%.29) [template] // CHECK:STDOUT: %b: %C.3 = bind_symbolic_name b, 0 [symbolic] // CHECK:STDOUT: %b.patt: %C.3 = symbolic_binding_pattern b, 0 [symbolic] // CHECK:STDOUT: %D.type: type = generic_class_type @D [template] @@ -51,7 +57,8 @@ class D(b:! C(1_000)) {} // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -79,8 +86,13 @@ class D(b:! C(1_000)) {} // CHECK:STDOUT: %b.param_patt: %C.3 = value_param_pattern %b.patt.loc4, runtime_param [symbolic = constants.%b.patt] // CHECK:STDOUT: } { // CHECK:STDOUT: %C.ref.loc3: %C.type = name_ref C, file.%C.decl [template = constants.%C.1] -// CHECK:STDOUT: %.loc3: i32 = int_value 1000 [template = constants.%.3] -// CHECK:STDOUT: %C.loc3: type = class_type @C, @C(constants.%.3) [template = constants.%C.3] +// CHECK:STDOUT: %.loc3_15: Core.IntLiteral = int_value 1000 [template = constants.%.3] +// CHECK:STDOUT: %.loc3_14.1: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc3_14.2: = bound_method %.loc3_15, %.loc3_14.1 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked.loc3: init i32 = call %.loc3_14.2(%.loc3_15) [template = constants.%.29] +// CHECK:STDOUT: %.loc3_14.3: i32 = value_of_initializer %int.convert_checked.loc3 [template = constants.%.29] +// CHECK:STDOUT: %.loc3_14.4: i32 = converted %.loc3_15, %.loc3_14.3 [template = constants.%.29] +// CHECK:STDOUT: %C.loc3: type = class_type @C, @C(constants.%.29) [template = constants.%C.3] // CHECK:STDOUT: %b.param.loc3: %C.3 = value_param runtime_param // CHECK:STDOUT: %b.loc3_9.1: %C.3 = bind_symbolic_name b, 0, %b.param.loc3 [symbolic = %b.loc3_9.2 (constants.%b)] // CHECK:STDOUT: } @@ -89,8 +101,13 @@ class D(b:! C(1_000)) {} // CHECK:STDOUT: %b.param_patt: %C.3 = value_param_pattern %b.patt.loc4, runtime_param [symbolic = constants.%b.patt] // CHECK:STDOUT: } { // CHECK:STDOUT: %C.ref.loc4: %C.type = name_ref C, file.%C.decl [template = constants.%C.1] -// CHECK:STDOUT: %.loc4_15: i32 = int_value 1000 [template = constants.%.3] -// CHECK:STDOUT: %C.loc4: type = class_type @C, @C(constants.%.3) [template = constants.%C.3] +// CHECK:STDOUT: %.loc4_15: Core.IntLiteral = int_value 1000 [template = constants.%.3] +// CHECK:STDOUT: %.loc4_14.1: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_14.2: = bound_method %.loc4_15, %.loc4_14.1 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked.loc4: init i32 = call %.loc4_14.2(%.loc4_15) [template = constants.%.29] +// CHECK:STDOUT: %.loc4_14.3: i32 = value_of_initializer %int.convert_checked.loc4 [template = constants.%.29] +// CHECK:STDOUT: %.loc4_14.4: i32 = converted %.loc4_15, %.loc4_14.3 [template = constants.%.29] +// CHECK:STDOUT: %C.loc4: type = class_type @C, @C(constants.%.29) [template = constants.%C.3] // CHECK:STDOUT: %b.param.loc4: %C.3 = value_param runtime_param // CHECK:STDOUT: %b.loc4: %C.3 = bind_symbolic_name b, 0, %b.param.loc4 [symbolic = constants.%b] // CHECK:STDOUT: } @@ -129,9 +146,9 @@ class D(b:! C(1_000)) {} // CHECK:STDOUT: %a.patt.loc2_9.2 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @C(constants.%.3) { -// CHECK:STDOUT: %a.loc2_9.2 => constants.%.3 -// CHECK:STDOUT: %a.patt.loc2_9.2 => constants.%.3 +// CHECK:STDOUT: specific @C(constants.%.29) { +// CHECK:STDOUT: %a.loc2_9.2 => constants.%.29 +// CHECK:STDOUT: %a.patt.loc2_9.2 => constants.%.29 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @D(constants.%b) { @@ -151,20 +168,27 @@ class D(b:! C(1_000)) {} // CHECK:STDOUT: %C.2: type = class_type @C, @C(%a) [symbolic] // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: = complete_type_witness %.1 [template] -// CHECK:STDOUT: %.3: i32 = int_value 1000 [template] -// CHECK:STDOUT: %C.3: type = class_type @C, @C(%.3) [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 1000 [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: %.27: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.28: = bound_method %.3, %Convert.15 [template] +// CHECK:STDOUT: %.29: i32 = int_value 1000 [template] +// CHECK:STDOUT: %C.3: type = class_type @C, @C(%.29) [template] // CHECK:STDOUT: %b: %C.3 = bind_symbolic_name b, 0 [symbolic] // CHECK:STDOUT: %b.patt: %C.3 = symbolic_binding_pattern b, 0 [symbolic] // CHECK:STDOUT: %D.type: type = generic_class_type @D [template] // CHECK:STDOUT: %D.1: %D.type = struct_value () [template] // CHECK:STDOUT: %.type: type = generic_class_type @.1 [template] -// CHECK:STDOUT: %.4: %.type = struct_value () [template] -// CHECK:STDOUT: %.5: type = class_type @.1, @.1(%b) [symbolic] +// CHECK:STDOUT: %.30: %.type = struct_value () [template] +// CHECK:STDOUT: %.31: type = class_type @.1, @.1(%b) [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -192,18 +216,28 @@ class D(b:! C(1_000)) {} // CHECK:STDOUT: %b.param_patt: %C.3 = value_param_pattern %b.patt.loc3_9.1, runtime_param [symbolic = %b.patt.loc3_9.2 (constants.%b.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [template = constants.%C.1] -// CHECK:STDOUT: %.loc3: i32 = int_value 1000 [template = constants.%.3] -// CHECK:STDOUT: %C: type = class_type @C, @C(constants.%.3) [template = constants.%C.3] +// CHECK:STDOUT: %.loc3_15: Core.IntLiteral = int_value 1000 [template = constants.%.3] +// CHECK:STDOUT: %.loc3_14.1: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc3_14.2: = bound_method %.loc3_15, %.loc3_14.1 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc3_14.2(%.loc3_15) [template = constants.%.29] +// CHECK:STDOUT: %.loc3_14.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.29] +// CHECK:STDOUT: %.loc3_14.4: i32 = converted %.loc3_15, %.loc3_14.3 [template = constants.%.29] +// CHECK:STDOUT: %C: type = class_type @C, @C(constants.%.29) [template = constants.%C.3] // CHECK:STDOUT: %b.param: %C.3 = value_param runtime_param // CHECK:STDOUT: %b.loc3_9.1: %C.3 = bind_symbolic_name b, 0, %b.param [symbolic = %b.loc3_9.2 (constants.%b)] // CHECK:STDOUT: } -// CHECK:STDOUT: %.decl: %.type = class_decl @.1 [template = constants.%.4] { +// CHECK:STDOUT: %.decl: %.type = class_decl @.1 [template = constants.%.30] { // CHECK:STDOUT: %b.patt.loc10_9.1: %C.3 = symbolic_binding_pattern b, 0 [symbolic = %b.patt.loc10_9.2 (constants.%b.patt)] // CHECK:STDOUT: %b.param_patt: %C.3 = value_param_pattern %b.patt.loc10_9.1, runtime_param [symbolic = %b.patt.loc10_9.2 (constants.%b.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [template = constants.%C.1] -// CHECK:STDOUT: %.loc10_15: i32 = int_value 1000 [template = constants.%.3] -// CHECK:STDOUT: %C: type = class_type @C, @C(constants.%.3) [template = constants.%C.3] +// CHECK:STDOUT: %.loc10_15: Core.IntLiteral = int_value 1000 [template = constants.%.3] +// CHECK:STDOUT: %.loc10_14.1: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc10_14.2: = bound_method %.loc10_15, %.loc10_14.1 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc10_14.2(%.loc10_15) [template = constants.%.29] +// CHECK:STDOUT: %.loc10_14.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.29] +// CHECK:STDOUT: %.loc10_14.4: i32 = converted %.loc10_15, %.loc10_14.3 [template = constants.%.29] +// CHECK:STDOUT: %C: type = class_type @C, @C(constants.%.29) [template = constants.%C.3] // CHECK:STDOUT: %b.param: %C.3 = value_param runtime_param // CHECK:STDOUT: %b.loc10_9.1: %C.3 = bind_symbolic_name b, 0, %b.param [symbolic = %b.loc10_9.2 (constants.%b)] // CHECK:STDOUT: } @@ -240,7 +274,7 @@ class D(b:! C(1_000)) {} // CHECK:STDOUT: %.loc10_24: = complete_type_witness %.1 [template = constants.%.2] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%.5 +// CHECK:STDOUT: .Self = constants.%.31 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -249,9 +283,9 @@ class D(b:! C(1_000)) {} // CHECK:STDOUT: %a.patt.loc2_9.2 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @C(constants.%.3) { -// CHECK:STDOUT: %a.loc2_9.2 => constants.%.3 -// CHECK:STDOUT: %a.patt.loc2_9.2 => constants.%.3 +// CHECK:STDOUT: specific @C(constants.%.29) { +// CHECK:STDOUT: %a.loc2_9.2 => constants.%.29 +// CHECK:STDOUT: %a.patt.loc2_9.2 => constants.%.29 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @D(constants.%b) { diff --git a/toolchain/check/testdata/deduce/array.carbon b/toolchain/check/testdata/deduce/array.carbon index 6af9c06d7d3cf..cc8cc55328494 100644 --- a/toolchain/check/testdata/deduce/array.carbon +++ b/toolchain/check/testdata/deduce/array.carbon @@ -105,20 +105,20 @@ fn G() -> C { // CHECK:STDOUT: %.2: = complete_type_witness %.1 [template] // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic] -// CHECK:STDOUT: %.3: i32 = int_value 3 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] -// CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template] -// CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template] -// CHECK:STDOUT: %.27: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.28: = bound_method %.3, %Convert.15 [template] -// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 3 [template] -// CHECK:STDOUT: %.30: type = array_type %.29, %T [symbolic] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.4: type = array_type %.3, %T [symbolic] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] +// CHECK:STDOUT: %.6: Core.IntLiteral = int_value 0 [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: %.30: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.31: = bound_method %.6, %Convert.15 [template] // CHECK:STDOUT: %.32: i32 = int_value 0 [template] // CHECK:STDOUT: %G.type: type = fn_type @G [template] // CHECK:STDOUT: %G: %G.type = struct_value () [template] -// CHECK:STDOUT: %.34: type = array_type %.29, %C [template] +// CHECK:STDOUT: %.34: type = array_type %.3, %C [template] // CHECK:STDOUT: %tuple.type: type = tuple_type (%.1, %.1, %.1) [template] // CHECK:STDOUT: %struct: %C = struct_value () [template] // CHECK:STDOUT: %.36: i32 = int_value 1 [template] @@ -147,24 +147,19 @@ fn G() -> C { // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] { // CHECK:STDOUT: %T.patt.loc6_6.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_6.2 (constants.%T.patt)] // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc6_6.1, runtime_param [symbolic = %T.patt.loc6_6.2 (constants.%T.patt)] -// CHECK:STDOUT: %a.patt: @F.%.loc6_24.2 (%.30) = binding_pattern a -// CHECK:STDOUT: %a.param_patt: @F.%.loc6_24.2 (%.30) = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %a.patt: @F.%.loc6_24.2 (%.4) = binding_pattern a +// CHECK:STDOUT: %a.param_patt: @F.%.loc6_24.2 (%.4) = value_param_pattern %a.patt, runtime_param0 // CHECK:STDOUT: %return.patt: @F.%T.loc6_6.2 (%T) = return_slot_pattern // CHECK:STDOUT: %return.param_patt: @F.%T.loc6_6.2 (%T) = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { // CHECK:STDOUT: %T.ref.loc6_20: type = name_ref T, %T.loc6_6.1 [symbolic = %T.loc6_6.2 (constants.%T)] -// CHECK:STDOUT: %.loc6_23.1: i32 = int_value 3 [template = constants.%.3] -// CHECK:STDOUT: %.loc6_23.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc6_23.3: = bound_method %.loc6_23.1, %.loc6_23.2 [template = constants.%.28] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc6_23.3(%.loc6_23.1) [template = constants.%.29] -// CHECK:STDOUT: %.loc6_23.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.29] -// CHECK:STDOUT: %.loc6_23.5: Core.IntLiteral = converted %.loc6_23.1, %.loc6_23.4 [template = constants.%.29] -// CHECK:STDOUT: %.loc6_24.1: type = array_type %.loc6_23.5, %T [symbolic = %.loc6_24.2 (constants.%.30)] +// CHECK:STDOUT: %.loc6_23: Core.IntLiteral = int_value 3 [template = constants.%.3] +// CHECK:STDOUT: %.loc6_24.1: type = array_type %.loc6_23, %T [symbolic = %.loc6_24.2 (constants.%.4)] // CHECK:STDOUT: %T.ref.loc6_30: type = name_ref T, %T.loc6_6.1 [symbolic = %T.loc6_6.2 (constants.%T)] // CHECK:STDOUT: %T.param: type = value_param runtime_param // CHECK:STDOUT: %T.loc6_6.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc6_6.2 (constants.%T)] -// CHECK:STDOUT: %a.param: @F.%.loc6_24.2 (%.30) = value_param runtime_param0 -// CHECK:STDOUT: %a: @F.%.loc6_24.2 (%.30) = bind_name a, %a.param +// CHECK:STDOUT: %a.param: @F.%.loc6_24.2 (%.4) = value_param runtime_param0 +// CHECK:STDOUT: %a: @F.%.loc6_24.2 (%.4) = bind_name a, %a.param // CHECK:STDOUT: %return.param: ref @F.%T.loc6_6.2 (%T) = out_param runtime_param1 // CHECK:STDOUT: %return: ref @F.%T.loc6_6.2 (%T) = return_slot %return.param // CHECK:STDOUT: } @@ -188,16 +183,21 @@ fn G() -> C { // CHECK:STDOUT: generic fn @F(%T.loc6_6.1: type) { // CHECK:STDOUT: %T.loc6_6.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc6_6.2 (constants.%T)] // CHECK:STDOUT: %T.patt.loc6_6.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_6.2 (constants.%T.patt)] -// CHECK:STDOUT: %.loc6_24.2: type = array_type constants.%.29, @F.%T.loc6_6.2 (%T) [symbolic = %.loc6_24.2 (constants.%.30)] +// CHECK:STDOUT: %.loc6_24.2: type = array_type constants.%.3, @F.%T.loc6_6.2 (%T) [symbolic = %.loc6_24.2 (constants.%.4)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: fn[%T.param_patt: type](%a.param_patt: @F.%.loc6_24.2 (%.30)) -> @F.%T.loc6_6.2 (%T) { +// CHECK:STDOUT: fn[%T.param_patt: type](%a.param_patt: @F.%.loc6_24.2 (%.4)) -> @F.%T.loc6_6.2 (%T) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %a.ref: @F.%.loc6_24.2 (%.30) = name_ref a, %a -// CHECK:STDOUT: %.loc6_43: i32 = int_value 0 [template = constants.%.32] -// CHECK:STDOUT: %.loc6_44.1: ref @F.%.loc6_24.2 (%.30) = value_as_ref %a.ref -// CHECK:STDOUT: %.loc6_44.2: ref @F.%T.loc6_6.2 (%T) = array_index %.loc6_44.1, %.loc6_43 +// CHECK:STDOUT: %a.ref: @F.%.loc6_24.2 (%.4) = name_ref a, %a +// CHECK:STDOUT: %.loc6_43.1: Core.IntLiteral = int_value 0 [template = constants.%.6] +// CHECK:STDOUT: %.loc6_43.2: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc6_43.3: = bound_method %.loc6_43.1, %.loc6_43.2 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc6_43.3(%.loc6_43.1) [template = constants.%.32] +// CHECK:STDOUT: %.loc6_43.4: i32 = value_of_initializer %int.convert_checked [template = constants.%.32] +// CHECK:STDOUT: %.loc6_43.5: i32 = converted %.loc6_43.1, %.loc6_43.4 [template = constants.%.32] +// CHECK:STDOUT: %.loc6_44.1: ref @F.%.loc6_24.2 (%.4) = value_as_ref %a.ref +// CHECK:STDOUT: %.loc6_44.2: ref @F.%T.loc6_6.2 (%T) = array_index %.loc6_44.1, %.loc6_43.5 // CHECK:STDOUT: %.loc6_44.3: @F.%T.loc6_6.2 (%T) = bind_value %.loc6_44.2 // CHECK:STDOUT: return %.loc6_44.3 // CHECK:STDOUT: } @@ -206,13 +206,8 @@ fn G() -> C { // CHECK:STDOUT: fn @G() -> %return: %C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.ref.loc9: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc9_14.1: i32 = int_value 3 [template = constants.%.3] -// CHECK:STDOUT: %.loc9_14.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc9_14.3: = bound_method %.loc9_14.1, %.loc9_14.2 [template = constants.%.28] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc9_14.3(%.loc9_14.1) [template = constants.%.29] -// CHECK:STDOUT: %.loc9_14.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.29] -// CHECK:STDOUT: %.loc9_14.5: Core.IntLiteral = converted %.loc9_14.1, %.loc9_14.4 [template = constants.%.29] -// CHECK:STDOUT: %.loc9_15: type = array_type %.loc9_14.5, %C [template = constants.%.34] +// CHECK:STDOUT: %.loc9_14: Core.IntLiteral = int_value 3 [template = constants.%.3] +// CHECK:STDOUT: %.loc9_15: type = array_type %.loc9_14, %C [template = constants.%.34] // CHECK:STDOUT: %a.var: ref %.34 = var a // CHECK:STDOUT: %a: ref %.34 = bind_name a, %a.var // CHECK:STDOUT: %.loc9_21.1: %.1 = struct_literal () @@ -246,7 +241,7 @@ fn G() -> C { // CHECK:STDOUT: specific @F(constants.%T) { // CHECK:STDOUT: %T.loc6_6.2 => constants.%T // CHECK:STDOUT: %T.patt.loc6_6.2 => constants.%T -// CHECK:STDOUT: %.loc6_24.2 => constants.%.30 +// CHECK:STDOUT: %.loc6_24.2 => constants.%.4 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @F(constants.%C) { @@ -277,16 +272,14 @@ fn G() -> C { // CHECK:STDOUT: %F: %F.type = struct_value () [template] // CHECK:STDOUT: %G.type: type = fn_type @G [template] // CHECK:STDOUT: %G: %G.type = struct_value () [template] -// CHECK:STDOUT: %.29: i32 = int_value 3 [template] -// CHECK:STDOUT: %.30: = bound_method %.29, %Convert.15 [template] -// CHECK:STDOUT: %.31: Core.IntLiteral = int_value 3 [template] -// CHECK:STDOUT: %.32: type = array_type %.31, %C [template] +// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.30: type = array_type %.29, %C [template] // CHECK:STDOUT: %tuple.type: type = tuple_type (%.1, %.1, %.1) [template] -// CHECK:STDOUT: %.34: i32 = int_value 0 [template] +// CHECK:STDOUT: %.32: i32 = int_value 0 [template] // CHECK:STDOUT: %struct: %C = struct_value () [template] -// CHECK:STDOUT: %.35: i32 = int_value 1 [template] -// CHECK:STDOUT: %.36: i32 = int_value 2 [template] -// CHECK:STDOUT: %array: %.32 = tuple_value (%struct, %struct, %struct) [template] +// CHECK:STDOUT: %.33: i32 = int_value 1 [template] +// CHECK:STDOUT: %.34: i32 = int_value 2 [template] +// CHECK:STDOUT: %array: %.30 = tuple_value (%struct, %struct, %struct) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -371,36 +364,31 @@ fn G() -> C { // CHECK:STDOUT: fn @G() -> %return: %C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.ref.loc13: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc13_14.1: i32 = int_value 3 [template = constants.%.29] -// CHECK:STDOUT: %.loc13_14.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc13_14.3: = bound_method %.loc13_14.1, %.loc13_14.2 [template = constants.%.30] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc13_14.3(%.loc13_14.1) [template = constants.%.31] -// CHECK:STDOUT: %.loc13_14.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.31] -// CHECK:STDOUT: %.loc13_14.5: Core.IntLiteral = converted %.loc13_14.1, %.loc13_14.4 [template = constants.%.31] -// CHECK:STDOUT: %.loc13_15: type = array_type %.loc13_14.5, %C [template = constants.%.32] -// CHECK:STDOUT: %a.var: ref %.32 = var a -// CHECK:STDOUT: %a: ref %.32 = bind_name a, %a.var +// CHECK:STDOUT: %.loc13_14: Core.IntLiteral = int_value 3 [template = constants.%.29] +// CHECK:STDOUT: %.loc13_15: type = array_type %.loc13_14, %C [template = constants.%.30] +// CHECK:STDOUT: %a.var: ref %.30 = var a +// CHECK:STDOUT: %a: ref %.30 = bind_name a, %a.var // CHECK:STDOUT: %.loc13_21.1: %.1 = struct_literal () // CHECK:STDOUT: %.loc13_25.1: %.1 = struct_literal () // CHECK:STDOUT: %.loc13_29.1: %.1 = struct_literal () // CHECK:STDOUT: %.loc13_30.1: %tuple.type = tuple_literal (%.loc13_21.1, %.loc13_25.1, %.loc13_29.1) -// CHECK:STDOUT: %.loc13_30.2: i32 = int_value 0 [template = constants.%.34] +// CHECK:STDOUT: %.loc13_30.2: i32 = int_value 0 [template = constants.%.32] // CHECK:STDOUT: %.loc13_30.3: ref %C = array_index %a.var, %.loc13_30.2 // CHECK:STDOUT: %.loc13_21.2: init %C = class_init (), %.loc13_30.3 [template = constants.%struct] // CHECK:STDOUT: %.loc13_30.4: init %C = converted %.loc13_21.1, %.loc13_21.2 [template = constants.%struct] -// CHECK:STDOUT: %.loc13_30.5: i32 = int_value 1 [template = constants.%.35] +// CHECK:STDOUT: %.loc13_30.5: i32 = int_value 1 [template = constants.%.33] // CHECK:STDOUT: %.loc13_30.6: ref %C = array_index %a.var, %.loc13_30.5 // CHECK:STDOUT: %.loc13_25.2: init %C = class_init (), %.loc13_30.6 [template = constants.%struct] // CHECK:STDOUT: %.loc13_30.7: init %C = converted %.loc13_25.1, %.loc13_25.2 [template = constants.%struct] -// CHECK:STDOUT: %.loc13_30.8: i32 = int_value 2 [template = constants.%.36] +// CHECK:STDOUT: %.loc13_30.8: i32 = int_value 2 [template = constants.%.34] // CHECK:STDOUT: %.loc13_30.9: ref %C = array_index %a.var, %.loc13_30.8 // CHECK:STDOUT: %.loc13_29.2: init %C = class_init (), %.loc13_30.9 [template = constants.%struct] // CHECK:STDOUT: %.loc13_30.10: init %C = converted %.loc13_29.1, %.loc13_29.2 [template = constants.%struct] -// CHECK:STDOUT: %.loc13_30.11: init %.32 = array_init (%.loc13_30.4, %.loc13_30.7, %.loc13_30.10) to %a.var [template = constants.%array] -// CHECK:STDOUT: %.loc13_31: init %.32 = converted %.loc13_30.1, %.loc13_30.11 [template = constants.%array] +// CHECK:STDOUT: %.loc13_30.11: init %.30 = array_init (%.loc13_30.4, %.loc13_30.7, %.loc13_30.10) to %a.var [template = constants.%array] +// CHECK:STDOUT: %.loc13_31: init %.30 = converted %.loc13_30.1, %.loc13_30.11 [template = constants.%array] // CHECK:STDOUT: assign %a.var, %.loc13_31 // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [template = constants.%F] -// CHECK:STDOUT: %a.ref: ref %.32 = name_ref a, %a +// CHECK:STDOUT: %a.ref: ref %.30 = name_ref a, %a // CHECK:STDOUT: return to %return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -433,16 +421,14 @@ fn G() -> C { // CHECK:STDOUT: %F: %F.type = struct_value () [template] // CHECK:STDOUT: %G.type: type = fn_type @G [template] // CHECK:STDOUT: %G: %G.type = struct_value () [template] -// CHECK:STDOUT: %.29: i32 = int_value 3 [template] -// CHECK:STDOUT: %.30: = bound_method %.29, %Convert.15 [template] -// CHECK:STDOUT: %.31: Core.IntLiteral = int_value 3 [template] -// CHECK:STDOUT: %.32: type = array_type %.31, %C [template] +// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.30: type = array_type %.29, %C [template] // CHECK:STDOUT: %tuple.type: type = tuple_type (%.1, %.1, %.1) [template] -// CHECK:STDOUT: %.34: i32 = int_value 0 [template] +// CHECK:STDOUT: %.32: i32 = int_value 0 [template] // CHECK:STDOUT: %struct: %C = struct_value () [template] -// CHECK:STDOUT: %.35: i32 = int_value 1 [template] -// CHECK:STDOUT: %.36: i32 = int_value 2 [template] -// CHECK:STDOUT: %array: %.32 = tuple_value (%struct, %struct, %struct) [template] +// CHECK:STDOUT: %.33: i32 = int_value 1 [template] +// CHECK:STDOUT: %.34: i32 = int_value 2 [template] +// CHECK:STDOUT: %array: %.30 = tuple_value (%struct, %struct, %struct) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -525,36 +511,31 @@ fn G() -> C { // CHECK:STDOUT: fn @G() -> %return: %C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.ref.loc13: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc13_14.1: i32 = int_value 3 [template = constants.%.29] -// CHECK:STDOUT: %.loc13_14.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc13_14.3: = bound_method %.loc13_14.1, %.loc13_14.2 [template = constants.%.30] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc13_14.3(%.loc13_14.1) [template = constants.%.31] -// CHECK:STDOUT: %.loc13_14.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.31] -// CHECK:STDOUT: %.loc13_14.5: Core.IntLiteral = converted %.loc13_14.1, %.loc13_14.4 [template = constants.%.31] -// CHECK:STDOUT: %.loc13_15: type = array_type %.loc13_14.5, %C [template = constants.%.32] -// CHECK:STDOUT: %a.var: ref %.32 = var a -// CHECK:STDOUT: %a: ref %.32 = bind_name a, %a.var +// CHECK:STDOUT: %.loc13_14: Core.IntLiteral = int_value 3 [template = constants.%.29] +// CHECK:STDOUT: %.loc13_15: type = array_type %.loc13_14, %C [template = constants.%.30] +// CHECK:STDOUT: %a.var: ref %.30 = var a +// CHECK:STDOUT: %a: ref %.30 = bind_name a, %a.var // CHECK:STDOUT: %.loc13_21.1: %.1 = struct_literal () // CHECK:STDOUT: %.loc13_25.1: %.1 = struct_literal () // CHECK:STDOUT: %.loc13_29.1: %.1 = struct_literal () // CHECK:STDOUT: %.loc13_30.1: %tuple.type = tuple_literal (%.loc13_21.1, %.loc13_25.1, %.loc13_29.1) -// CHECK:STDOUT: %.loc13_30.2: i32 = int_value 0 [template = constants.%.34] +// CHECK:STDOUT: %.loc13_30.2: i32 = int_value 0 [template = constants.%.32] // CHECK:STDOUT: %.loc13_30.3: ref %C = array_index %a.var, %.loc13_30.2 // CHECK:STDOUT: %.loc13_21.2: init %C = class_init (), %.loc13_30.3 [template = constants.%struct] // CHECK:STDOUT: %.loc13_30.4: init %C = converted %.loc13_21.1, %.loc13_21.2 [template = constants.%struct] -// CHECK:STDOUT: %.loc13_30.5: i32 = int_value 1 [template = constants.%.35] +// CHECK:STDOUT: %.loc13_30.5: i32 = int_value 1 [template = constants.%.33] // CHECK:STDOUT: %.loc13_30.6: ref %C = array_index %a.var, %.loc13_30.5 // CHECK:STDOUT: %.loc13_25.2: init %C = class_init (), %.loc13_30.6 [template = constants.%struct] // CHECK:STDOUT: %.loc13_30.7: init %C = converted %.loc13_25.1, %.loc13_25.2 [template = constants.%struct] -// CHECK:STDOUT: %.loc13_30.8: i32 = int_value 2 [template = constants.%.36] +// CHECK:STDOUT: %.loc13_30.8: i32 = int_value 2 [template = constants.%.34] // CHECK:STDOUT: %.loc13_30.9: ref %C = array_index %a.var, %.loc13_30.8 // CHECK:STDOUT: %.loc13_29.2: init %C = class_init (), %.loc13_30.9 [template = constants.%struct] // CHECK:STDOUT: %.loc13_30.10: init %C = converted %.loc13_29.1, %.loc13_29.2 [template = constants.%struct] -// CHECK:STDOUT: %.loc13_30.11: init %.32 = array_init (%.loc13_30.4, %.loc13_30.7, %.loc13_30.10) to %a.var [template = constants.%array] -// CHECK:STDOUT: %.loc13_31: init %.32 = converted %.loc13_30.1, %.loc13_30.11 [template = constants.%array] +// CHECK:STDOUT: %.loc13_30.11: init %.30 = array_init (%.loc13_30.4, %.loc13_30.7, %.loc13_30.10) to %a.var [template = constants.%array] +// CHECK:STDOUT: %.loc13_31: init %.30 = converted %.loc13_30.1, %.loc13_30.11 [template = constants.%array] // CHECK:STDOUT: assign %a.var, %.loc13_31 // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [template = constants.%F] -// CHECK:STDOUT: %a.ref: ref %.32 = name_ref a, %a +// CHECK:STDOUT: %a.ref: ref %.30 = name_ref a, %a // CHECK:STDOUT: return to %return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -575,29 +556,28 @@ fn G() -> C { // CHECK:STDOUT: %.2: = complete_type_witness %.1 [template] // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic] -// CHECK:STDOUT: %.3: i32 = int_value 2 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] -// CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template] -// CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template] -// CHECK:STDOUT: %.27: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.28: = bound_method %.3, %Convert.15 [template] -// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 2 [template] -// CHECK:STDOUT: %.30: type = array_type %.29, %T [symbolic] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.4: type = array_type %.3, %T [symbolic] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] +// CHECK:STDOUT: %.6: Core.IntLiteral = int_value 0 [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: %.30: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.31: = bound_method %.6, %Convert.15 [template] // CHECK:STDOUT: %.32: i32 = int_value 0 [template] // CHECK:STDOUT: %G.type: type = fn_type @G [template] // CHECK:STDOUT: %G: %G.type = struct_value () [template] -// CHECK:STDOUT: %.34: i32 = int_value 3 [template] -// CHECK:STDOUT: %.35: = bound_method %.34, %Convert.15 [template] -// CHECK:STDOUT: %.36: Core.IntLiteral = int_value 3 [template] -// CHECK:STDOUT: %.37: type = array_type %.36, %C [template] +// CHECK:STDOUT: %.34: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.35: type = array_type %.34, %C [template] // CHECK:STDOUT: %tuple.type: type = tuple_type (%.1, %.1, %.1) [template] // CHECK:STDOUT: %struct: %C = struct_value () [template] -// CHECK:STDOUT: %.39: i32 = int_value 1 [template] -// CHECK:STDOUT: %array: %.37 = tuple_value (%struct, %struct, %struct) [template] -// CHECK:STDOUT: %.40: type = array_type %.29, %C [template] -// CHECK:STDOUT: %.41: = specific_function %F, @F(%C) [template] +// CHECK:STDOUT: %.37: i32 = int_value 1 [template] +// CHECK:STDOUT: %.38: i32 = int_value 2 [template] +// CHECK:STDOUT: %array: %.35 = tuple_value (%struct, %struct, %struct) [template] +// CHECK:STDOUT: %.39: type = array_type %.3, %C [template] +// CHECK:STDOUT: %.40: = specific_function %F, @F(%C) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -620,24 +600,19 @@ fn G() -> C { // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] { // CHECK:STDOUT: %T.patt.loc6_6.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_6.2 (constants.%T.patt)] // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc6_6.1, runtime_param [symbolic = %T.patt.loc6_6.2 (constants.%T.patt)] -// CHECK:STDOUT: %a.patt: @F.%.loc6_24.2 (%.30) = binding_pattern a -// CHECK:STDOUT: %a.param_patt: @F.%.loc6_24.2 (%.30) = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %a.patt: @F.%.loc6_24.2 (%.4) = binding_pattern a +// CHECK:STDOUT: %a.param_patt: @F.%.loc6_24.2 (%.4) = value_param_pattern %a.patt, runtime_param0 // CHECK:STDOUT: %return.patt: @F.%T.loc6_6.2 (%T) = return_slot_pattern // CHECK:STDOUT: %return.param_patt: @F.%T.loc6_6.2 (%T) = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { // CHECK:STDOUT: %T.ref.loc6_20: type = name_ref T, %T.loc6_6.1 [symbolic = %T.loc6_6.2 (constants.%T)] -// CHECK:STDOUT: %.loc6_23.1: i32 = int_value 2 [template = constants.%.3] -// CHECK:STDOUT: %.loc6_23.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc6_23.3: = bound_method %.loc6_23.1, %.loc6_23.2 [template = constants.%.28] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc6_23.3(%.loc6_23.1) [template = constants.%.29] -// CHECK:STDOUT: %.loc6_23.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.29] -// CHECK:STDOUT: %.loc6_23.5: Core.IntLiteral = converted %.loc6_23.1, %.loc6_23.4 [template = constants.%.29] -// CHECK:STDOUT: %.loc6_24.1: type = array_type %.loc6_23.5, %T [symbolic = %.loc6_24.2 (constants.%.30)] +// CHECK:STDOUT: %.loc6_23: Core.IntLiteral = int_value 2 [template = constants.%.3] +// CHECK:STDOUT: %.loc6_24.1: type = array_type %.loc6_23, %T [symbolic = %.loc6_24.2 (constants.%.4)] // CHECK:STDOUT: %T.ref.loc6_30: type = name_ref T, %T.loc6_6.1 [symbolic = %T.loc6_6.2 (constants.%T)] // CHECK:STDOUT: %T.param: type = value_param runtime_param // CHECK:STDOUT: %T.loc6_6.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc6_6.2 (constants.%T)] -// CHECK:STDOUT: %a.param: @F.%.loc6_24.2 (%.30) = value_param runtime_param0 -// CHECK:STDOUT: %a: @F.%.loc6_24.2 (%.30) = bind_name a, %a.param +// CHECK:STDOUT: %a.param: @F.%.loc6_24.2 (%.4) = value_param runtime_param0 +// CHECK:STDOUT: %a: @F.%.loc6_24.2 (%.4) = bind_name a, %a.param // CHECK:STDOUT: %return.param: ref @F.%T.loc6_6.2 (%T) = out_param runtime_param1 // CHECK:STDOUT: %return: ref @F.%T.loc6_6.2 (%T) = return_slot %return.param // CHECK:STDOUT: } @@ -661,16 +636,21 @@ fn G() -> C { // CHECK:STDOUT: generic fn @F(%T.loc6_6.1: type) { // CHECK:STDOUT: %T.loc6_6.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc6_6.2 (constants.%T)] // CHECK:STDOUT: %T.patt.loc6_6.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_6.2 (constants.%T.patt)] -// CHECK:STDOUT: %.loc6_24.2: type = array_type constants.%.29, @F.%T.loc6_6.2 (%T) [symbolic = %.loc6_24.2 (constants.%.30)] +// CHECK:STDOUT: %.loc6_24.2: type = array_type constants.%.3, @F.%T.loc6_6.2 (%T) [symbolic = %.loc6_24.2 (constants.%.4)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: fn[%T.param_patt: type](%a.param_patt: @F.%.loc6_24.2 (%.30)) -> @F.%T.loc6_6.2 (%T) { +// CHECK:STDOUT: fn[%T.param_patt: type](%a.param_patt: @F.%.loc6_24.2 (%.4)) -> @F.%T.loc6_6.2 (%T) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %a.ref: @F.%.loc6_24.2 (%.30) = name_ref a, %a -// CHECK:STDOUT: %.loc6_43: i32 = int_value 0 [template = constants.%.32] -// CHECK:STDOUT: %.loc6_44.1: ref @F.%.loc6_24.2 (%.30) = value_as_ref %a.ref -// CHECK:STDOUT: %.loc6_44.2: ref @F.%T.loc6_6.2 (%T) = array_index %.loc6_44.1, %.loc6_43 +// CHECK:STDOUT: %a.ref: @F.%.loc6_24.2 (%.4) = name_ref a, %a +// CHECK:STDOUT: %.loc6_43.1: Core.IntLiteral = int_value 0 [template = constants.%.6] +// CHECK:STDOUT: %.loc6_43.2: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc6_43.3: = bound_method %.loc6_43.1, %.loc6_43.2 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc6_43.3(%.loc6_43.1) [template = constants.%.32] +// CHECK:STDOUT: %.loc6_43.4: i32 = value_of_initializer %int.convert_checked [template = constants.%.32] +// CHECK:STDOUT: %.loc6_43.5: i32 = converted %.loc6_43.1, %.loc6_43.4 [template = constants.%.32] +// CHECK:STDOUT: %.loc6_44.1: ref @F.%.loc6_24.2 (%.4) = value_as_ref %a.ref +// CHECK:STDOUT: %.loc6_44.2: ref @F.%T.loc6_6.2 (%T) = array_index %.loc6_44.1, %.loc6_43.5 // CHECK:STDOUT: %.loc6_44.3: @F.%T.loc6_6.2 (%T) = bind_value %.loc6_44.2 // CHECK:STDOUT: return %.loc6_44.3 // CHECK:STDOUT: } @@ -679,15 +659,10 @@ fn G() -> C { // CHECK:STDOUT: fn @G() -> %return: %C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.ref.loc10: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc10_14.1: i32 = int_value 3 [template = constants.%.34] -// CHECK:STDOUT: %.loc10_14.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc10_14.3: = bound_method %.loc10_14.1, %.loc10_14.2 [template = constants.%.35] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc10_14.3(%.loc10_14.1) [template = constants.%.36] -// CHECK:STDOUT: %.loc10_14.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.36] -// CHECK:STDOUT: %.loc10_14.5: Core.IntLiteral = converted %.loc10_14.1, %.loc10_14.4 [template = constants.%.36] -// CHECK:STDOUT: %.loc10_15: type = array_type %.loc10_14.5, %C [template = constants.%.37] -// CHECK:STDOUT: %a.var: ref %.37 = var a -// CHECK:STDOUT: %a: ref %.37 = bind_name a, %a.var +// CHECK:STDOUT: %.loc10_14: Core.IntLiteral = int_value 3 [template = constants.%.34] +// CHECK:STDOUT: %.loc10_15: type = array_type %.loc10_14, %C [template = constants.%.35] +// CHECK:STDOUT: %a.var: ref %.35 = var a +// CHECK:STDOUT: %a: ref %.35 = bind_name a, %a.var // CHECK:STDOUT: %.loc10_21.1: %.1 = struct_literal () // CHECK:STDOUT: %.loc10_25.1: %.1 = struct_literal () // CHECK:STDOUT: %.loc10_29.1: %.1 = struct_literal () @@ -696,22 +671,22 @@ fn G() -> C { // CHECK:STDOUT: %.loc10_30.3: ref %C = array_index %a.var, %.loc10_30.2 // CHECK:STDOUT: %.loc10_21.2: init %C = class_init (), %.loc10_30.3 [template = constants.%struct] // CHECK:STDOUT: %.loc10_30.4: init %C = converted %.loc10_21.1, %.loc10_21.2 [template = constants.%struct] -// CHECK:STDOUT: %.loc10_30.5: i32 = int_value 1 [template = constants.%.39] +// CHECK:STDOUT: %.loc10_30.5: i32 = int_value 1 [template = constants.%.37] // CHECK:STDOUT: %.loc10_30.6: ref %C = array_index %a.var, %.loc10_30.5 // CHECK:STDOUT: %.loc10_25.2: init %C = class_init (), %.loc10_30.6 [template = constants.%struct] // CHECK:STDOUT: %.loc10_30.7: init %C = converted %.loc10_25.1, %.loc10_25.2 [template = constants.%struct] -// CHECK:STDOUT: %.loc10_30.8: i32 = int_value 2 [template = constants.%.3] +// CHECK:STDOUT: %.loc10_30.8: i32 = int_value 2 [template = constants.%.38] // CHECK:STDOUT: %.loc10_30.9: ref %C = array_index %a.var, %.loc10_30.8 // CHECK:STDOUT: %.loc10_29.2: init %C = class_init (), %.loc10_30.9 [template = constants.%struct] // CHECK:STDOUT: %.loc10_30.10: init %C = converted %.loc10_29.1, %.loc10_29.2 [template = constants.%struct] -// CHECK:STDOUT: %.loc10_30.11: init %.37 = array_init (%.loc10_30.4, %.loc10_30.7, %.loc10_30.10) to %a.var [template = constants.%array] -// CHECK:STDOUT: %.loc10_31: init %.37 = converted %.loc10_30.1, %.loc10_30.11 [template = constants.%array] +// CHECK:STDOUT: %.loc10_30.11: init %.35 = array_init (%.loc10_30.4, %.loc10_30.7, %.loc10_30.10) to %a.var [template = constants.%array] +// CHECK:STDOUT: %.loc10_31: init %.35 = converted %.loc10_30.1, %.loc10_30.11 [template = constants.%array] // CHECK:STDOUT: assign %a.var, %.loc10_31 // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [template = constants.%F] -// CHECK:STDOUT: %a.ref: ref %.37 = name_ref a, %a -// CHECK:STDOUT: %.loc21_10: = specific_function %F.ref, @F(constants.%C) [template = constants.%.41] +// CHECK:STDOUT: %a.ref: ref %.35 = name_ref a, %a +// CHECK:STDOUT: %.loc21_10: = specific_function %F.ref, @F(constants.%C) [template = constants.%.40] // CHECK:STDOUT: %.loc8_8.2: ref %C = splice_block %return {} -// CHECK:STDOUT: %.loc21_12: %.40 = converted %a.ref, [template = ] +// CHECK:STDOUT: %.loc21_12: %.39 = converted %a.ref, [template = ] // CHECK:STDOUT: %F.call: init %C = call %.loc21_10() to %.loc8_8.2 // CHECK:STDOUT: return %F.call to %return // CHECK:STDOUT: } @@ -719,13 +694,13 @@ fn G() -> C { // CHECK:STDOUT: specific @F(constants.%T) { // CHECK:STDOUT: %T.loc6_6.2 => constants.%T // CHECK:STDOUT: %T.patt.loc6_6.2 => constants.%T -// CHECK:STDOUT: %.loc6_24.2 => constants.%.30 +// CHECK:STDOUT: %.loc6_24.2 => constants.%.4 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @F(constants.%C) { // CHECK:STDOUT: %T.loc6_6.2 => constants.%C // CHECK:STDOUT: %T.patt.loc6_6.2 => constants.%C -// CHECK:STDOUT: %.loc6_24.2 => constants.%.40 +// CHECK:STDOUT: %.loc6_24.2 => constants.%.39 // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: } @@ -751,16 +726,14 @@ fn G() -> C { // CHECK:STDOUT: %F: %F.type = struct_value () [template] // CHECK:STDOUT: %G.type: type = fn_type @G [template] // CHECK:STDOUT: %G: %G.type = struct_value () [template] -// CHECK:STDOUT: %.29: i32 = int_value 3 [template] -// CHECK:STDOUT: %.30: = bound_method %.29, %Convert.15 [template] -// CHECK:STDOUT: %.31: Core.IntLiteral = int_value 3 [template] -// CHECK:STDOUT: %.32: type = array_type %.31, %D [template] +// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.30: type = array_type %.29, %D [template] // CHECK:STDOUT: %tuple.type: type = tuple_type (%.1, %.1, %.1) [template] -// CHECK:STDOUT: %.34: i32 = int_value 0 [template] +// CHECK:STDOUT: %.32: i32 = int_value 0 [template] // CHECK:STDOUT: %struct: %D = struct_value () [template] -// CHECK:STDOUT: %.35: i32 = int_value 1 [template] -// CHECK:STDOUT: %.36: i32 = int_value 2 [template] -// CHECK:STDOUT: %array: %.32 = tuple_value (%struct, %struct, %struct) [template] +// CHECK:STDOUT: %.33: i32 = int_value 1 [template] +// CHECK:STDOUT: %.34: i32 = int_value 2 [template] +// CHECK:STDOUT: %array: %.30 = tuple_value (%struct, %struct, %struct) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -854,36 +827,31 @@ fn G() -> C { // CHECK:STDOUT: fn @G() -> %return: %C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [template = constants.%D] -// CHECK:STDOUT: %.loc13_14.1: i32 = int_value 3 [template = constants.%.29] -// CHECK:STDOUT: %.loc13_14.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc13_14.3: = bound_method %.loc13_14.1, %.loc13_14.2 [template = constants.%.30] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc13_14.3(%.loc13_14.1) [template = constants.%.31] -// CHECK:STDOUT: %.loc13_14.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.31] -// CHECK:STDOUT: %.loc13_14.5: Core.IntLiteral = converted %.loc13_14.1, %.loc13_14.4 [template = constants.%.31] -// CHECK:STDOUT: %.loc13_15: type = array_type %.loc13_14.5, %D [template = constants.%.32] -// CHECK:STDOUT: %a.var: ref %.32 = var a -// CHECK:STDOUT: %a: ref %.32 = bind_name a, %a.var +// CHECK:STDOUT: %.loc13_14: Core.IntLiteral = int_value 3 [template = constants.%.29] +// CHECK:STDOUT: %.loc13_15: type = array_type %.loc13_14, %D [template = constants.%.30] +// CHECK:STDOUT: %a.var: ref %.30 = var a +// CHECK:STDOUT: %a: ref %.30 = bind_name a, %a.var // CHECK:STDOUT: %.loc13_21.1: %.1 = struct_literal () // CHECK:STDOUT: %.loc13_25.1: %.1 = struct_literal () // CHECK:STDOUT: %.loc13_29.1: %.1 = struct_literal () // CHECK:STDOUT: %.loc13_30.1: %tuple.type = tuple_literal (%.loc13_21.1, %.loc13_25.1, %.loc13_29.1) -// CHECK:STDOUT: %.loc13_30.2: i32 = int_value 0 [template = constants.%.34] +// CHECK:STDOUT: %.loc13_30.2: i32 = int_value 0 [template = constants.%.32] // CHECK:STDOUT: %.loc13_30.3: ref %D = array_index %a.var, %.loc13_30.2 // CHECK:STDOUT: %.loc13_21.2: init %D = class_init (), %.loc13_30.3 [template = constants.%struct] // CHECK:STDOUT: %.loc13_30.4: init %D = converted %.loc13_21.1, %.loc13_21.2 [template = constants.%struct] -// CHECK:STDOUT: %.loc13_30.5: i32 = int_value 1 [template = constants.%.35] +// CHECK:STDOUT: %.loc13_30.5: i32 = int_value 1 [template = constants.%.33] // CHECK:STDOUT: %.loc13_30.6: ref %D = array_index %a.var, %.loc13_30.5 // CHECK:STDOUT: %.loc13_25.2: init %D = class_init (), %.loc13_30.6 [template = constants.%struct] // CHECK:STDOUT: %.loc13_30.7: init %D = converted %.loc13_25.1, %.loc13_25.2 [template = constants.%struct] -// CHECK:STDOUT: %.loc13_30.8: i32 = int_value 2 [template = constants.%.36] +// CHECK:STDOUT: %.loc13_30.8: i32 = int_value 2 [template = constants.%.34] // CHECK:STDOUT: %.loc13_30.9: ref %D = array_index %a.var, %.loc13_30.8 // CHECK:STDOUT: %.loc13_29.2: init %D = class_init (), %.loc13_30.9 [template = constants.%struct] // CHECK:STDOUT: %.loc13_30.10: init %D = converted %.loc13_29.1, %.loc13_29.2 [template = constants.%struct] -// CHECK:STDOUT: %.loc13_30.11: init %.32 = array_init (%.loc13_30.4, %.loc13_30.7, %.loc13_30.10) to %a.var [template = constants.%array] -// CHECK:STDOUT: %.loc13_31: init %.32 = converted %.loc13_30.1, %.loc13_30.11 [template = constants.%array] +// CHECK:STDOUT: %.loc13_30.11: init %.30 = array_init (%.loc13_30.4, %.loc13_30.7, %.loc13_30.10) to %a.var [template = constants.%array] +// CHECK:STDOUT: %.loc13_31: init %.30 = converted %.loc13_30.1, %.loc13_30.11 [template = constants.%array] // CHECK:STDOUT: assign %a.var, %.loc13_31 // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [template = constants.%F] -// CHECK:STDOUT: %a.ref: ref %.32 = name_ref a, %a +// CHECK:STDOUT: %a.ref: ref %.30 = name_ref a, %a // CHECK:STDOUT: return to %return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/deduce/generic_type.carbon b/toolchain/check/testdata/deduce/generic_type.carbon index 495aa6c5439ac..ed5030884a59b 100644 --- a/toolchain/check/testdata/deduce/generic_type.carbon +++ b/toolchain/check/testdata/deduce/generic_type.carbon @@ -716,26 +716,33 @@ fn G() -> i32 { // CHECK:STDOUT: constants { // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %N: i32 = bind_symbolic_name N, 0 [symbolic] -// CHECK:STDOUT: %N.patt: i32 = symbolic_binding_pattern N, 0 [symbolic] +// CHECK:STDOUT: %N.1: i32 = bind_symbolic_name N, 0 [symbolic] +// CHECK:STDOUT: %N.patt.1: i32 = symbolic_binding_pattern N, 0 [symbolic] // CHECK:STDOUT: %WithNontype.type: type = generic_class_type @WithNontype [template] // CHECK:STDOUT: %WithNontype.1: %WithNontype.type = struct_value () [template] -// CHECK:STDOUT: %WithNontype.2: type = class_type @WithNontype, @WithNontype(%N) [symbolic] +// CHECK:STDOUT: %WithNontype.2: type = class_type @WithNontype, @WithNontype(%N.1) [symbolic] // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: = complete_type_witness %.1 [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] // CHECK:STDOUT: %G.type: type = fn_type @G [template] // CHECK:STDOUT: %G: %G.type = struct_value () [template] -// CHECK:STDOUT: %.4: i32 = int_value 0 [template] -// CHECK:STDOUT: %WithNontype.3: type = class_type @WithNontype, @WithNontype(%.4) [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 0 [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: %.28: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.29: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 0 [template] +// CHECK:STDOUT: %WithNontype.3: type = class_type @WithNontype, @WithNontype(%.30) [template] // CHECK:STDOUT: %struct: %WithNontype.3 = struct_value () [template] -// CHECK:STDOUT: %.5: = specific_function %F, @F(%.4) [template] +// CHECK:STDOUT: %.31: = specific_function %F, @F(%.30) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -750,18 +757,18 @@ fn G() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %WithNontype.decl: %WithNontype.type = class_decl @WithNontype [template = constants.%WithNontype.1] { -// CHECK:STDOUT: %N.patt.loc4_19.1: i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc4_19.2 (constants.%N.patt)] -// CHECK:STDOUT: %N.param_patt: i32 = value_param_pattern %N.patt.loc4_19.1, runtime_param [symbolic = %N.patt.loc4_19.2 (constants.%N.patt)] +// CHECK:STDOUT: %N.patt.loc4_19.1: i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc4_19.2 (constants.%N.patt.1)] +// CHECK:STDOUT: %N.param_patt: i32 = value_param_pattern %N.patt.loc4_19.1, runtime_param [symbolic = %N.patt.loc4_19.2 (constants.%N.patt.1)] // CHECK:STDOUT: } { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc4_23.1: type = value_of_initializer %int.make_type_32 [template = i32] // CHECK:STDOUT: %.loc4_23.2: type = converted %int.make_type_32, %.loc4_23.1 [template = i32] // CHECK:STDOUT: %N.param: i32 = value_param runtime_param -// CHECK:STDOUT: %N.loc4_19.1: i32 = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc4_19.2 (constants.%N)] +// CHECK:STDOUT: %N.loc4_19.1: i32 = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc4_19.2 (constants.%N.1)] // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] { -// CHECK:STDOUT: %N.patt.loc6_6.1: i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_6.2 (constants.%N.patt)] -// CHECK:STDOUT: %N.param_patt: i32 = value_param_pattern %N.patt.loc6_6.1, runtime_param [symbolic = %N.patt.loc6_6.2 (constants.%N.patt)] +// CHECK:STDOUT: %N.patt.loc6_6.1: i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_6.2 (constants.%N.patt.1)] +// CHECK:STDOUT: %N.param_patt: i32 = value_param_pattern %N.patt.loc6_6.1, runtime_param [symbolic = %N.patt.loc6_6.2 (constants.%N.patt.1)] // CHECK:STDOUT: %x.patt: @F.%WithNontype.loc6_29.2 (%WithNontype.2) = binding_pattern x // CHECK:STDOUT: %x.param_patt: @F.%WithNontype.loc6_29.2 (%WithNontype.2) = value_param_pattern %x.patt, runtime_param0 // CHECK:STDOUT: %return.patt: i32 = return_slot_pattern @@ -771,13 +778,13 @@ fn G() -> i32 { // CHECK:STDOUT: %.loc6_10.1: type = value_of_initializer %int.make_type_32.loc6_10 [template = i32] // CHECK:STDOUT: %.loc6_10.2: type = converted %int.make_type_32.loc6_10, %.loc6_10.1 [template = i32] // CHECK:STDOUT: %WithNontype.ref: %WithNontype.type = name_ref WithNontype, file.%WithNontype.decl [template = constants.%WithNontype.1] -// CHECK:STDOUT: %N.ref.loc6_30: i32 = name_ref N, %N.loc6_6.1 [symbolic = %N.loc6_6.2 (constants.%N)] -// CHECK:STDOUT: %WithNontype.loc6_29.1: type = class_type @WithNontype, @WithNontype(constants.%N) [symbolic = %WithNontype.loc6_29.2 (constants.%WithNontype.2)] +// CHECK:STDOUT: %N.ref.loc6_30: i32 = name_ref N, %N.loc6_6.1 [symbolic = %N.loc6_6.2 (constants.%N.1)] +// CHECK:STDOUT: %WithNontype.loc6_29.1: type = class_type @WithNontype, @WithNontype(constants.%N.1) [symbolic = %WithNontype.loc6_29.2 (constants.%WithNontype.2)] // CHECK:STDOUT: %int.make_type_32.loc6_37: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc6_37.1: type = value_of_initializer %int.make_type_32.loc6_37 [template = i32] // CHECK:STDOUT: %.loc6_37.2: type = converted %int.make_type_32.loc6_37, %.loc6_37.1 [template = i32] // CHECK:STDOUT: %N.param: i32 = value_param runtime_param -// CHECK:STDOUT: %N.loc6_6.1: i32 = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc6_6.2 (constants.%N)] +// CHECK:STDOUT: %N.loc6_6.1: i32 = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc6_6.2 (constants.%N.1)] // CHECK:STDOUT: %x.param: @F.%WithNontype.loc6_29.2 (%WithNontype.2) = value_param runtime_param0 // CHECK:STDOUT: %x: @F.%WithNontype.loc6_29.2 (%WithNontype.2) = bind_name x, %x.param // CHECK:STDOUT: %return.param: ref i32 = out_param runtime_param1 @@ -796,8 +803,8 @@ fn G() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic class @WithNontype(%N.loc4_19.1: i32) { -// CHECK:STDOUT: %N.loc4_19.2: i32 = bind_symbolic_name N, 0 [symbolic = %N.loc4_19.2 (constants.%N)] -// CHECK:STDOUT: %N.patt.loc4_19.2: i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc4_19.2 (constants.%N.patt)] +// CHECK:STDOUT: %N.loc4_19.2: i32 = bind_symbolic_name N, 0 [symbolic = %N.loc4_19.2 (constants.%N.1)] +// CHECK:STDOUT: %N.patt.loc4_19.2: i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc4_19.2 (constants.%N.patt.1)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -810,15 +817,15 @@ fn G() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @F(%N.loc6_6.1: i32) { -// CHECK:STDOUT: %N.loc6_6.2: i32 = bind_symbolic_name N, 0 [symbolic = %N.loc6_6.2 (constants.%N)] -// CHECK:STDOUT: %N.patt.loc6_6.2: i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_6.2 (constants.%N.patt)] +// CHECK:STDOUT: %N.loc6_6.2: i32 = bind_symbolic_name N, 0 [symbolic = %N.loc6_6.2 (constants.%N.1)] +// CHECK:STDOUT: %N.patt.loc6_6.2: i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_6.2 (constants.%N.patt.1)] // CHECK:STDOUT: %WithNontype.loc6_29.2: type = class_type @WithNontype, @WithNontype(%N.loc6_6.2) [symbolic = %WithNontype.loc6_29.2 (constants.%WithNontype.2)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: // CHECK:STDOUT: fn[%N.param_patt: i32](%x.param_patt: @F.%WithNontype.loc6_29.2 (%WithNontype.2)) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %N.ref.loc6_50: i32 = name_ref N, %N.loc6_6.1 [symbolic = %N.loc6_6.2 (constants.%N)] +// CHECK:STDOUT: %N.ref.loc6_50: i32 = name_ref N, %N.loc6_6.1 [symbolic = %N.loc6_6.2 (constants.%N.1)] // CHECK:STDOUT: return %N.ref.loc6_50 // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -828,13 +835,18 @@ fn G() -> i32 { // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [template = constants.%F] // CHECK:STDOUT: %.loc9_13.1: %.1 = struct_literal () // CHECK:STDOUT: %WithNontype.ref: %WithNontype.type = name_ref WithNontype, file.%WithNontype.decl [template = constants.%WithNontype.1] -// CHECK:STDOUT: %.loc9_30: i32 = int_value 0 [template = constants.%.4] -// CHECK:STDOUT: %WithNontype: type = class_type @WithNontype, @WithNontype(constants.%.4) [template = constants.%WithNontype.3] +// CHECK:STDOUT: %.loc9_30: Core.IntLiteral = int_value 0 [template = constants.%.4] +// CHECK:STDOUT: %.loc9_29.1: %Convert.type.2 = interface_witness_access constants.%.28, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_29.2: = bound_method %.loc9_30, %.loc9_29.1 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc9_29.2(%.loc9_30) [template = constants.%.30] +// CHECK:STDOUT: %.loc9_29.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.30] +// CHECK:STDOUT: %.loc9_29.4: i32 = converted %.loc9_30, %.loc9_29.3 [template = constants.%.30] +// CHECK:STDOUT: %WithNontype: type = class_type @WithNontype, @WithNontype(constants.%.30) [template = constants.%WithNontype.3] // CHECK:STDOUT: %.loc9_13.2: ref %WithNontype.3 = temporary_storage // CHECK:STDOUT: %.loc9_13.3: init %WithNontype.3 = class_init (), %.loc9_13.2 [template = constants.%struct] // CHECK:STDOUT: %.loc9_13.4: ref %WithNontype.3 = temporary %.loc9_13.2, %.loc9_13.3 // CHECK:STDOUT: %.loc9_15.1: ref %WithNontype.3 = converted %.loc9_13.1, %.loc9_13.4 -// CHECK:STDOUT: %.loc9_10: = specific_function %F.ref, @F(constants.%.4) [template = constants.%.5] +// CHECK:STDOUT: %.loc9_10: = specific_function %F.ref, @F(constants.%.30) [template = constants.%.31] // CHECK:STDOUT: %.loc9_15.2: %WithNontype.3 = bind_value %.loc9_15.1 // CHECK:STDOUT: %F.call: init i32 = call %.loc9_10(%.loc9_15.2) // CHECK:STDOUT: %.loc9_33.1: i32 = value_of_initializer %F.call @@ -842,34 +854,34 @@ fn G() -> i32 { // CHECK:STDOUT: return %.loc9_33.2 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @WithNontype(constants.%N) { -// CHECK:STDOUT: %N.loc4_19.2 => constants.%N -// CHECK:STDOUT: %N.patt.loc4_19.2 => constants.%N +// CHECK:STDOUT: specific @WithNontype(constants.%N.1) { +// CHECK:STDOUT: %N.loc4_19.2 => constants.%N.1 +// CHECK:STDOUT: %N.patt.loc4_19.2 => constants.%N.1 // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @WithNontype(@F.%N.loc6_6.2) { -// CHECK:STDOUT: %N.loc4_19.2 => constants.%N -// CHECK:STDOUT: %N.patt.loc4_19.2 => constants.%N +// CHECK:STDOUT: %N.loc4_19.2 => constants.%N.1 +// CHECK:STDOUT: %N.patt.loc4_19.2 => constants.%N.1 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F(constants.%N) { -// CHECK:STDOUT: %N.loc6_6.2 => constants.%N -// CHECK:STDOUT: %N.patt.loc6_6.2 => constants.%N +// CHECK:STDOUT: specific @F(constants.%N.1) { +// CHECK:STDOUT: %N.loc6_6.2 => constants.%N.1 +// CHECK:STDOUT: %N.patt.loc6_6.2 => constants.%N.1 // CHECK:STDOUT: %WithNontype.loc6_29.2 => constants.%WithNontype.2 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @WithNontype(constants.%.4) { -// CHECK:STDOUT: %N.loc4_19.2 => constants.%.4 -// CHECK:STDOUT: %N.patt.loc4_19.2 => constants.%.4 +// CHECK:STDOUT: specific @WithNontype(constants.%.30) { +// CHECK:STDOUT: %N.loc4_19.2 => constants.%.30 +// CHECK:STDOUT: %N.patt.loc4_19.2 => constants.%.30 // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F(constants.%.4) { -// CHECK:STDOUT: %N.loc6_6.2 => constants.%.4 -// CHECK:STDOUT: %N.patt.loc6_6.2 => constants.%.4 +// CHECK:STDOUT: specific @F(constants.%.30) { +// CHECK:STDOUT: %N.loc6_6.2 => constants.%.30 +// CHECK:STDOUT: %N.patt.loc6_6.2 => constants.%.30 // CHECK:STDOUT: %WithNontype.loc6_29.2 => constants.%WithNontype.3 // CHECK:STDOUT: // CHECK:STDOUT: !definition: diff --git a/toolchain/check/testdata/deduce/tuple.carbon b/toolchain/check/testdata/deduce/tuple.carbon index ff9c36a9cbd4d..81ce433754e39 100644 --- a/toolchain/check/testdata/deduce/tuple.carbon +++ b/toolchain/check/testdata/deduce/tuple.carbon @@ -232,18 +232,28 @@ fn G(pair: (C, D)) -> D { // CHECK:STDOUT: %HasPair.3: type = class_type @HasPair, @HasPair(%tuple.1) [symbolic] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %.5: i32 = int_value 1 [template] -// CHECK:STDOUT: %.6: i32 = int_value 2 [template] -// CHECK:STDOUT: %tuple.2: %tuple.type.2 = tuple_value (%.5, %.6) [template] +// CHECK:STDOUT: %.5: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.6: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %tuple.type.3: type = tuple_type (Core.IntLiteral, Core.IntLiteral) [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: %.30: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.31: = bound_method %.5, %Convert.15 [template] +// CHECK:STDOUT: %.32: i32 = int_value 1 [template] +// CHECK:STDOUT: %.33: = bound_method %.6, %Convert.15 [template] +// CHECK:STDOUT: %.34: i32 = int_value 2 [template] +// CHECK:STDOUT: %tuple.2: %tuple.type.2 = tuple_value (%.32, %.34) [template] // CHECK:STDOUT: %HasPair.4: type = class_type @HasPair, @HasPair(%tuple.2) [template] // CHECK:STDOUT: %G.type: type = fn_type @G [template] // CHECK:STDOUT: %G: %G.type = struct_value () [template] -// CHECK:STDOUT: %.7: = specific_function %F, @F(%.5, %.6) [template] +// CHECK:STDOUT: %.35: = specific_function %F, @F(%.32, %.34) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -314,11 +324,21 @@ fn G(pair: (C, D)) -> D { // CHECK:STDOUT: %return.param_patt: i32 = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { // CHECK:STDOUT: %HasPair.ref: %HasPair.type = name_ref HasPair, file.%HasPair.decl [template = constants.%HasPair.1] -// CHECK:STDOUT: %.loc8_18: i32 = int_value 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc8_21: i32 = int_value 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc8_22: %tuple.type.2 = tuple_literal (%.loc8_18, %.loc8_21) -// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.loc8_18, %.loc8_21) [template = constants.%tuple.2] -// CHECK:STDOUT: %.loc8_16: %tuple.type.2 = converted %.loc8_22, %tuple [template = constants.%tuple.2] +// CHECK:STDOUT: %.loc8_18: Core.IntLiteral = int_value 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc8_21: Core.IntLiteral = int_value 2 [template = constants.%.6] +// CHECK:STDOUT: %.loc8_22.1: %tuple.type.3 = tuple_literal (%.loc8_18, %.loc8_21) +// CHECK:STDOUT: %.loc8_22.2: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc8_22.3: = bound_method %.loc8_18, %.loc8_22.2 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc8_22.1: init i32 = call %.loc8_22.3(%.loc8_18) [template = constants.%.32] +// CHECK:STDOUT: %.loc8_22.4: i32 = value_of_initializer %int.convert_checked.loc8_22.1 [template = constants.%.32] +// CHECK:STDOUT: %.loc8_22.5: i32 = converted %.loc8_18, %.loc8_22.4 [template = constants.%.32] +// CHECK:STDOUT: %.loc8_22.6: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc8_22.7: = bound_method %.loc8_21, %.loc8_22.6 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc8_22.2: init i32 = call %.loc8_22.7(%.loc8_21) [template = constants.%.34] +// CHECK:STDOUT: %.loc8_22.8: i32 = value_of_initializer %int.convert_checked.loc8_22.2 [template = constants.%.34] +// CHECK:STDOUT: %.loc8_22.9: i32 = converted %.loc8_21, %.loc8_22.8 [template = constants.%.34] +// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.loc8_22.5, %.loc8_22.9) [template = constants.%tuple.2] +// CHECK:STDOUT: %.loc8_16: %tuple.type.2 = converted %.loc8_22.1, %tuple [template = constants.%tuple.2] // CHECK:STDOUT: %HasPair: type = class_type @HasPair, @HasPair(constants.%tuple.2) [template = constants.%HasPair.4] // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc8_29.1: type = value_of_initializer %int.make_type_32 [template = i32] @@ -365,7 +385,7 @@ fn G(pair: (C, D)) -> D { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [template = constants.%F] // CHECK:STDOUT: %h.ref: %HasPair.4 = name_ref h, %h -// CHECK:STDOUT: %.loc9_10: = specific_function %F.ref, @F(constants.%.5, constants.%.6) [template = constants.%.7] +// CHECK:STDOUT: %.loc9_10: = specific_function %F.ref, @F(constants.%.32, constants.%.34) [template = constants.%.35] // CHECK:STDOUT: %F.call: init i32 = call %.loc9_10(%h.ref) // CHECK:STDOUT: %.loc9_14.1: i32 = value_of_initializer %F.call // CHECK:STDOUT: %.loc9_14.2: i32 = converted %F.call, %.loc9_14.1 @@ -405,11 +425,11 @@ fn G(pair: (C, D)) -> D { // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F(constants.%.5, constants.%.6) { -// CHECK:STDOUT: %A.loc6_6.2 => constants.%.5 -// CHECK:STDOUT: %A.patt.loc6_6.2 => constants.%.5 -// CHECK:STDOUT: %B.loc6_15.2 => constants.%.6 -// CHECK:STDOUT: %B.patt.loc6_15.2 => constants.%.6 +// CHECK:STDOUT: specific @F(constants.%.32, constants.%.34) { +// CHECK:STDOUT: %A.loc6_6.2 => constants.%.32 +// CHECK:STDOUT: %A.patt.loc6_6.2 => constants.%.32 +// CHECK:STDOUT: %B.loc6_15.2 => constants.%.34 +// CHECK:STDOUT: %B.patt.loc6_15.2 => constants.%.34 // CHECK:STDOUT: %tuple.loc6_40.2 => constants.%tuple.2 // CHECK:STDOUT: %HasPair.loc6_34.2 => constants.%HasPair.4 // CHECK:STDOUT: diff --git a/toolchain/check/testdata/eval/aggregate.carbon b/toolchain/check/testdata/eval/aggregate.carbon index e200d2acb7681..ddcc8d769acea 100644 --- a/toolchain/check/testdata/eval/aggregate.carbon +++ b/toolchain/check/testdata/eval/aggregate.carbon @@ -23,32 +23,39 @@ var struct_access: [i32; 1] = (0,) as [i32; {.a = 3, .b = 1}.b]; // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %tuple.type.1: type = tuple_type (type, type) [template] // CHECK:STDOUT: %tuple.type.2: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.2: i32 = int_value 1 [template] -// CHECK:STDOUT: %.3: i32 = int_value 2 [template] -// CHECK:STDOUT: %tuple.1: %tuple.type.2 = tuple_value (%.2, %.3) [template] -// CHECK:STDOUT: %.4: type = struct_type {.a: i32, .b: i32, .c: i32} [template] -// CHECK:STDOUT: %.6: i32 = int_value 3 [template] -// CHECK:STDOUT: %.7: type = struct_type {.c: i32, .b: i32, .a: i32} [template] -// CHECK:STDOUT: %.8: type = struct_type {.b: i32, .a: i32, .c: i32} [template] -// CHECK:STDOUT: %struct.1: %.8 = struct_value (%.3, %.2, %.6) [template] -// CHECK:STDOUT: %struct.2: %.4 = struct_value (%.2, %.3, %.6) [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %tuple.type.3: type = tuple_type (Core.IntLiteral, Core.IntLiteral) [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: %.33: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.34: = bound_method %.2, %Convert.15 [template] -// CHECK:STDOUT: %.35: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %.36: type = array_type %.35, i32 [template] -// CHECK:STDOUT: %.38: i32 = int_value 0 [template] -// CHECK:STDOUT: %tuple.type.3: type = tuple_type (i32) [template] -// CHECK:STDOUT: %.39: i32 = int_value 5 [template] -// CHECK:STDOUT: %.40: i32 = int_value 7 [template] -// CHECK:STDOUT: %.41: i32 = int_value 9 [template] -// CHECK:STDOUT: %tuple.type.4: type = tuple_type (i32, i32, i32, i32) [template] -// CHECK:STDOUT: %tuple.2: %tuple.type.4 = tuple_value (%.39, %.40, %.2, %.41) [template] -// CHECK:STDOUT: %array: %.36 = tuple_value (%.38) [template] -// CHECK:STDOUT: %.43: type = struct_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %struct.3: %.43 = struct_value (%.6, %.2) [template] +// CHECK:STDOUT: %.27: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.28: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.29: i32 = int_value 1 [template] +// CHECK:STDOUT: %.30: = bound_method %.3, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 2 [template] +// CHECK:STDOUT: %tuple.1: %tuple.type.2 = tuple_value (%.29, %.31) [template] +// CHECK:STDOUT: %.32: type = struct_type {.a: i32, .b: i32, .c: i32} [template] +// CHECK:STDOUT: %.34: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.35: type = struct_type {.c: Core.IntLiteral, .b: Core.IntLiteral, .a: Core.IntLiteral} [template] +// CHECK:STDOUT: %.36: type = struct_type {.b: i32, .a: i32, .c: i32} [template] +// CHECK:STDOUT: %.38: = bound_method %.34, %Convert.15 [template] +// CHECK:STDOUT: %.39: i32 = int_value 3 [template] +// CHECK:STDOUT: %struct.1: %.36 = struct_value (%.31, %.29, %.39) [template] +// CHECK:STDOUT: %struct.2: %.32 = struct_value (%.29, %.31, %.39) [template] +// CHECK:STDOUT: %.40: type = array_type %.2, i32 [template] +// CHECK:STDOUT: %.42: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %tuple.type.4: type = tuple_type (Core.IntLiteral) [template] +// CHECK:STDOUT: %.43: Core.IntLiteral = int_value 5 [template] +// CHECK:STDOUT: %.44: Core.IntLiteral = int_value 7 [template] +// CHECK:STDOUT: %.45: Core.IntLiteral = int_value 9 [template] +// CHECK:STDOUT: %tuple.type.5: type = tuple_type (Core.IntLiteral, Core.IntLiteral, Core.IntLiteral, Core.IntLiteral) [template] +// CHECK:STDOUT: %tuple.2: %tuple.type.5 = tuple_value (%.43, %.44, %.2, %.45) [template] +// CHECK:STDOUT: %.47: i32 = int_value 0 [template] +// CHECK:STDOUT: %.48: = bound_method %.42, %Convert.15 [template] +// CHECK:STDOUT: %array: %.40 = tuple_value (%.47) [template] +// CHECK:STDOUT: %.49: type = struct_type {.a: Core.IntLiteral, .b: Core.IntLiteral} [template] +// CHECK:STDOUT: %struct.3: %.49 = struct_value (%.34, %.2) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -88,40 +95,30 @@ var struct_access: [i32; 1] = (0,) as [i32; {.a = 3, .b = 1}.b]; // CHECK:STDOUT: %int.make_type_32.loc13_41: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc13_41.1: type = value_of_initializer %int.make_type_32.loc13_41 [template = i32] // CHECK:STDOUT: %.loc13_41.2: type = converted %int.make_type_32.loc13_41, %.loc13_41.1 [template = i32] -// CHECK:STDOUT: %.loc13_44: type = struct_type {.a: i32, .b: i32, .c: i32} [template = constants.%.4] -// CHECK:STDOUT: %struct_copy.var: ref %.4 = var struct_copy -// CHECK:STDOUT: %struct_copy: ref %.4 = bind_name struct_copy, %struct_copy.var +// CHECK:STDOUT: %.loc13_44: type = struct_type {.a: i32, .b: i32, .c: i32} [template = constants.%.32] +// CHECK:STDOUT: %struct_copy.var: ref %.32 = var struct_copy +// CHECK:STDOUT: %struct_copy: ref %.32 = bind_name struct_copy, %struct_copy.var // CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc15_24.1: i32 = int_value 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_24: Core.IntLiteral = int_value 1 [template = constants.%.2] // CHECK:STDOUT: %.loc15_19.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] // CHECK:STDOUT: %.loc15_19.2: type = converted %int.make_type_32.loc15, %.loc15_19.1 [template = i32] -// CHECK:STDOUT: %.loc15_24.2: %Convert.type.2 = interface_witness_access constants.%.33, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc15_24.3: = bound_method %.loc15_24.1, %.loc15_24.2 [template = constants.%.34] -// CHECK:STDOUT: %int.convert_checked.loc15: init Core.IntLiteral = call %.loc15_24.3(%.loc15_24.1) [template = constants.%.35] -// CHECK:STDOUT: %.loc15_24.4: Core.IntLiteral = value_of_initializer %int.convert_checked.loc15 [template = constants.%.35] -// CHECK:STDOUT: %.loc15_24.5: Core.IntLiteral = converted %.loc15_24.1, %.loc15_24.4 [template = constants.%.35] -// CHECK:STDOUT: %.loc15_25: type = array_type %.loc15_24.5, i32 [template = constants.%.36] -// CHECK:STDOUT: %tuple_index.var: ref %.36 = var tuple_index -// CHECK:STDOUT: %tuple_index: ref %.36 = bind_name tuple_index, %tuple_index.var +// CHECK:STDOUT: %.loc15_25: type = array_type %.loc15_24, i32 [template = constants.%.40] +// CHECK:STDOUT: %tuple_index.var: ref %.40 = var tuple_index +// CHECK:STDOUT: %tuple_index: ref %.40 = bind_name tuple_index, %tuple_index.var // CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc17_26.1: i32 = int_value 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc17_26: Core.IntLiteral = int_value 1 [template = constants.%.2] // CHECK:STDOUT: %.loc17_21.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] // CHECK:STDOUT: %.loc17_21.2: type = converted %int.make_type_32.loc17, %.loc17_21.1 [template = i32] -// CHECK:STDOUT: %.loc17_26.2: %Convert.type.2 = interface_witness_access constants.%.33, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc17_26.3: = bound_method %.loc17_26.1, %.loc17_26.2 [template = constants.%.34] -// CHECK:STDOUT: %int.convert_checked.loc17: init Core.IntLiteral = call %.loc17_26.3(%.loc17_26.1) [template = constants.%.35] -// CHECK:STDOUT: %.loc17_26.4: Core.IntLiteral = value_of_initializer %int.convert_checked.loc17 [template = constants.%.35] -// CHECK:STDOUT: %.loc17_26.5: Core.IntLiteral = converted %.loc17_26.1, %.loc17_26.4 [template = constants.%.35] -// CHECK:STDOUT: %.loc17_27: type = array_type %.loc17_26.5, i32 [template = constants.%.36] -// CHECK:STDOUT: %struct_access.var: ref %.36 = var struct_access -// CHECK:STDOUT: %struct_access: ref %.36 = bind_name struct_access, %struct_access.var +// CHECK:STDOUT: %.loc17_27: type = array_type %.loc17_26, i32 [template = constants.%.40] +// CHECK:STDOUT: %struct_access.var: ref %.40 = var struct_access +// CHECK:STDOUT: %struct_access: ref %.40 = bind_name struct_access, %struct_access.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_31: i32 = int_value 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_34: i32 = int_value 2 [template = constants.%.3] -// CHECK:STDOUT: %.loc11_35.1: %tuple.type.2 = tuple_literal (%.loc11_31, %.loc11_34) +// CHECK:STDOUT: %.loc11_31: Core.IntLiteral = int_value 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_34: Core.IntLiteral = int_value 2 [template = constants.%.3] +// CHECK:STDOUT: %.loc11_35.1: %tuple.type.3 = tuple_literal (%.loc11_31, %.loc11_34) // CHECK:STDOUT: %int.make_type_32.loc11_41: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %int.make_type_32.loc11_46: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc11_49.1: %tuple.type.1 = tuple_literal (%int.make_type_32.loc11_41, %int.make_type_32.loc11_46) @@ -130,17 +127,31 @@ var struct_access: [i32; 1] = (0,) as [i32; {.a = 3, .b = 1}.b]; // CHECK:STDOUT: %.loc11_49.4: type = value_of_initializer %int.make_type_32.loc11_46 [template = i32] // CHECK:STDOUT: %.loc11_49.5: type = converted %int.make_type_32.loc11_46, %.loc11_49.4 [template = i32] // CHECK:STDOUT: %.loc11_49.6: type = converted %.loc11_49.1, constants.%tuple.type.2 [template = constants.%tuple.type.2] -// CHECK:STDOUT: %.loc11_35.2: ref i32 = tuple_access file.%tuple_copy.var, element0 -// CHECK:STDOUT: %.loc11_35.3: init i32 = initialize_from %.loc11_31 to %.loc11_35.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_35.4: ref i32 = tuple_access file.%tuple_copy.var, element1 -// CHECK:STDOUT: %.loc11_35.5: init i32 = initialize_from %.loc11_34 to %.loc11_35.4 [template = constants.%.3] -// CHECK:STDOUT: %.loc11_35.6: init %tuple.type.2 = tuple_init (%.loc11_35.3, %.loc11_35.5) to file.%tuple_copy.var [template = constants.%tuple.1] -// CHECK:STDOUT: %.loc11_50: init %tuple.type.2 = converted %.loc11_35.1, %.loc11_35.6 [template = constants.%tuple.1] +// CHECK:STDOUT: %.loc11_35.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_35.3: = bound_method %.loc11_31, %.loc11_35.2 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked.loc11_35.1: init i32 = call %.loc11_35.3(%.loc11_31) [template = constants.%.29] +// CHECK:STDOUT: %.loc11_35.4: i32 = value_of_initializer %int.convert_checked.loc11_35.1 [template = constants.%.29] +// CHECK:STDOUT: %.loc11_35.5: i32 = converted %.loc11_31, %.loc11_35.4 [template = constants.%.29] +// CHECK:STDOUT: %.loc11_35.6: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_35.7: = bound_method %.loc11_34, %.loc11_35.6 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc11_35.2: init i32 = call %.loc11_35.7(%.loc11_34) [template = constants.%.31] +// CHECK:STDOUT: %.loc11_35.8: i32 = value_of_initializer %int.convert_checked.loc11_35.2 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_35.9: i32 = converted %.loc11_34, %.loc11_35.8 [template = constants.%.31] +// CHECK:STDOUT: %tuple.loc11: %tuple.type.2 = tuple_value (%.loc11_35.5, %.loc11_35.9) [template = constants.%tuple.1] +// CHECK:STDOUT: %.loc11_37.1: %tuple.type.2 = converted %.loc11_35.1, %tuple.loc11 [template = constants.%tuple.1] +// CHECK:STDOUT: %.loc11_37.2: i32 = tuple_access %.loc11_37.1, element0 [template = constants.%.29] +// CHECK:STDOUT: %.loc11_37.3: ref i32 = tuple_access file.%tuple_copy.var, element0 +// CHECK:STDOUT: %.loc11_37.4: init i32 = initialize_from %.loc11_37.2 to %.loc11_37.3 [template = constants.%.29] +// CHECK:STDOUT: %.loc11_37.5: i32 = tuple_access %.loc11_37.1, element1 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_37.6: ref i32 = tuple_access file.%tuple_copy.var, element1 +// CHECK:STDOUT: %.loc11_37.7: init i32 = initialize_from %.loc11_37.5 to %.loc11_37.6 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_37.8: init %tuple.type.2 = tuple_init (%.loc11_37.4, %.loc11_37.7) to file.%tuple_copy.var [template = constants.%tuple.1] +// CHECK:STDOUT: %.loc11_50: init %tuple.type.2 = converted %.loc11_37.1, %.loc11_37.8 [template = constants.%tuple.1] // CHECK:STDOUT: assign file.%tuple_copy.var, %.loc11_50 -// CHECK:STDOUT: %.loc13_54: i32 = int_value 3 [template = constants.%.6] -// CHECK:STDOUT: %.loc13_62: i32 = int_value 2 [template = constants.%.3] -// CHECK:STDOUT: %.loc13_70: i32 = int_value 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc13_71: %.7 = struct_literal (%.loc13_54, %.loc13_62, %.loc13_70) +// CHECK:STDOUT: %.loc13_54: Core.IntLiteral = int_value 3 [template = constants.%.34] +// CHECK:STDOUT: %.loc13_62: Core.IntLiteral = int_value 2 [template = constants.%.3] +// CHECK:STDOUT: %.loc13_70: Core.IntLiteral = int_value 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc13_71.1: %.35 = struct_literal (%.loc13_54, %.loc13_62, %.loc13_70) // CHECK:STDOUT: %int.make_type_32.loc13_81: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc13_81.1: type = value_of_initializer %int.make_type_32.loc13_81 [template = i32] // CHECK:STDOUT: %.loc13_81.2: type = converted %int.make_type_32.loc13_81, %.loc13_81.1 [template = i32] @@ -150,71 +161,84 @@ var struct_access: [i32; 1] = (0,) as [i32; {.a = 3, .b = 1}.b]; // CHECK:STDOUT: %int.make_type_32.loc13_99: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc13_99.1: type = value_of_initializer %int.make_type_32.loc13_99 [template = i32] // CHECK:STDOUT: %.loc13_99.2: type = converted %int.make_type_32.loc13_99, %.loc13_99.1 [template = i32] -// CHECK:STDOUT: %.loc13_102: type = struct_type {.b: i32, .a: i32, .c: i32} [template = constants.%.8] -// CHECK:STDOUT: %struct.loc13: %.8 = struct_value (%.loc13_62, %.loc13_70, %.loc13_54) [template = constants.%struct.1] -// CHECK:STDOUT: %.loc13_73.1: %.8 = converted %.loc13_71, %struct.loc13 [template = constants.%struct.1] -// CHECK:STDOUT: %.loc13_73.2: i32 = struct_access %.loc13_73.1, element1 [template = constants.%.2] +// CHECK:STDOUT: %.loc13_102: type = struct_type {.b: i32, .a: i32, .c: i32} [template = constants.%.36] +// CHECK:STDOUT: %.loc13_71.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_71.3: = bound_method %.loc13_62, %.loc13_71.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc13_71.1: init i32 = call %.loc13_71.3(%.loc13_62) [template = constants.%.31] +// CHECK:STDOUT: %.loc13_71.4: i32 = value_of_initializer %int.convert_checked.loc13_71.1 [template = constants.%.31] +// CHECK:STDOUT: %.loc13_71.5: i32 = converted %.loc13_62, %.loc13_71.4 [template = constants.%.31] +// CHECK:STDOUT: %.loc13_71.6: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_71.7: = bound_method %.loc13_70, %.loc13_71.6 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked.loc13_71.2: init i32 = call %.loc13_71.7(%.loc13_70) [template = constants.%.29] +// CHECK:STDOUT: %.loc13_71.8: i32 = value_of_initializer %int.convert_checked.loc13_71.2 [template = constants.%.29] +// CHECK:STDOUT: %.loc13_71.9: i32 = converted %.loc13_70, %.loc13_71.8 [template = constants.%.29] +// CHECK:STDOUT: %.loc13_71.10: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_71.11: = bound_method %.loc13_54, %.loc13_71.10 [template = constants.%.38] +// CHECK:STDOUT: %int.convert_checked.loc13_71.3: init i32 = call %.loc13_71.11(%.loc13_54) [template = constants.%.39] +// CHECK:STDOUT: %.loc13_71.12: i32 = value_of_initializer %int.convert_checked.loc13_71.3 [template = constants.%.39] +// CHECK:STDOUT: %.loc13_71.13: i32 = converted %.loc13_54, %.loc13_71.12 [template = constants.%.39] +// CHECK:STDOUT: %struct.loc13: %.36 = struct_value (%.loc13_71.5, %.loc13_71.9, %.loc13_71.13) [template = constants.%struct.1] +// CHECK:STDOUT: %.loc13_73.1: %.36 = converted %.loc13_71.1, %struct.loc13 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc13_73.2: i32 = struct_access %.loc13_73.1, element1 [template = constants.%.29] // CHECK:STDOUT: %.loc13_73.3: ref i32 = struct_access file.%struct_copy.var, element1 -// CHECK:STDOUT: %.loc13_73.4: init i32 = initialize_from %.loc13_73.2 to %.loc13_73.3 [template = constants.%.2] -// CHECK:STDOUT: %.loc13_73.5: i32 = struct_access %.loc13_73.1, element0 [template = constants.%.3] +// CHECK:STDOUT: %.loc13_73.4: init i32 = initialize_from %.loc13_73.2 to %.loc13_73.3 [template = constants.%.29] +// CHECK:STDOUT: %.loc13_73.5: i32 = struct_access %.loc13_73.1, element0 [template = constants.%.31] // CHECK:STDOUT: %.loc13_73.6: ref i32 = struct_access file.%struct_copy.var, element0 -// CHECK:STDOUT: %.loc13_73.7: init i32 = initialize_from %.loc13_73.5 to %.loc13_73.6 [template = constants.%.3] -// CHECK:STDOUT: %.loc13_73.8: i32 = struct_access %.loc13_73.1, element2 [template = constants.%.6] +// CHECK:STDOUT: %.loc13_73.7: init i32 = initialize_from %.loc13_73.5 to %.loc13_73.6 [template = constants.%.31] +// CHECK:STDOUT: %.loc13_73.8: i32 = struct_access %.loc13_73.1, element2 [template = constants.%.39] // CHECK:STDOUT: %.loc13_73.9: ref i32 = struct_access file.%struct_copy.var, element2 -// CHECK:STDOUT: %.loc13_73.10: init i32 = initialize_from %.loc13_73.8 to %.loc13_73.9 [template = constants.%.6] -// CHECK:STDOUT: %.loc13_73.11: init %.4 = struct_init (%.loc13_73.4, %.loc13_73.7, %.loc13_73.10) to file.%struct_copy.var [template = constants.%struct.2] -// CHECK:STDOUT: %.loc13_103: init %.4 = converted %.loc13_73.1, %.loc13_73.11 [template = constants.%struct.2] +// CHECK:STDOUT: %.loc13_73.10: init i32 = initialize_from %.loc13_73.8 to %.loc13_73.9 [template = constants.%.39] +// CHECK:STDOUT: %.loc13_73.11: init %.32 = struct_init (%.loc13_73.4, %.loc13_73.7, %.loc13_73.10) to file.%struct_copy.var [template = constants.%struct.2] +// CHECK:STDOUT: %.loc13_103: init %.32 = converted %.loc13_73.1, %.loc13_73.11 [template = constants.%struct.2] // CHECK:STDOUT: assign file.%struct_copy.var, %.loc13_103 -// CHECK:STDOUT: %.loc15_30: i32 = int_value 0 [template = constants.%.38] -// CHECK:STDOUT: %.loc15_32.1: %tuple.type.3 = tuple_literal (%.loc15_30) +// CHECK:STDOUT: %.loc15_30: Core.IntLiteral = int_value 0 [template = constants.%.42] +// CHECK:STDOUT: %.loc15_32.1: %tuple.type.4 = tuple_literal (%.loc15_30) // CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc15_44: i32 = int_value 5 [template = constants.%.39] -// CHECK:STDOUT: %.loc15_47: i32 = int_value 7 [template = constants.%.40] -// CHECK:STDOUT: %.loc15_50: i32 = int_value 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc15_53: i32 = int_value 9 [template = constants.%.41] -// CHECK:STDOUT: %.loc15_54.1: %tuple.type.4 = tuple_literal (%.loc15_44, %.loc15_47, %.loc15_50, %.loc15_53) -// CHECK:STDOUT: %.loc15_56: i32 = int_value 2 [template = constants.%.3] -// CHECK:STDOUT: %tuple: %tuple.type.4 = tuple_value (%.loc15_44, %.loc15_47, %.loc15_50, %.loc15_53) [template = constants.%tuple.2] -// CHECK:STDOUT: %.loc15_54.2: %tuple.type.4 = converted %.loc15_54.1, %tuple [template = constants.%tuple.2] -// CHECK:STDOUT: %.loc15_55.1: i32 = tuple_access %.loc15_54.2, element2 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_44: Core.IntLiteral = int_value 5 [template = constants.%.43] +// CHECK:STDOUT: %.loc15_47: Core.IntLiteral = int_value 7 [template = constants.%.44] +// CHECK:STDOUT: %.loc15_50: Core.IntLiteral = int_value 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_53: Core.IntLiteral = int_value 9 [template = constants.%.45] +// CHECK:STDOUT: %.loc15_54.1: %tuple.type.5 = tuple_literal (%.loc15_44, %.loc15_47, %.loc15_50, %.loc15_53) +// CHECK:STDOUT: %.loc15_56: Core.IntLiteral = int_value 2 [template = constants.%.3] +// CHECK:STDOUT: %tuple.loc15: %tuple.type.5 = tuple_value (%.loc15_44, %.loc15_47, %.loc15_50, %.loc15_53) [template = constants.%tuple.2] +// CHECK:STDOUT: %.loc15_54.2: %tuple.type.5 = converted %.loc15_54.1, %tuple.loc15 [template = constants.%tuple.2] +// CHECK:STDOUT: %.loc15_55: Core.IntLiteral = tuple_access %.loc15_54.2, element2 [template = constants.%.2] // CHECK:STDOUT: %.loc15_38.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] // CHECK:STDOUT: %.loc15_38.2: type = converted %int.make_type_32.loc15, %.loc15_38.1 [template = i32] -// CHECK:STDOUT: %.loc15_55.2: %Convert.type.2 = interface_witness_access constants.%.33, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc15_55.3: = bound_method %.loc15_55.1, %.loc15_55.2 [template = constants.%.34] -// CHECK:STDOUT: %int.convert_checked.loc15: init Core.IntLiteral = call %.loc15_55.3(%.loc15_55.1) [template = constants.%.35] -// CHECK:STDOUT: %.loc15_55.4: Core.IntLiteral = value_of_initializer %int.convert_checked.loc15 [template = constants.%.35] -// CHECK:STDOUT: %.loc15_55.5: Core.IntLiteral = converted %.loc15_55.1, %.loc15_55.4 [template = constants.%.35] -// CHECK:STDOUT: %.loc15_57: type = array_type %.loc15_55.5, i32 [template = constants.%.36] -// CHECK:STDOUT: %.loc15_5: ref %.36 = splice_block file.%tuple_index.var {} -// CHECK:STDOUT: %.loc15_32.2: i32 = int_value 0 [template = constants.%.38] -// CHECK:STDOUT: %.loc15_32.3: ref i32 = array_index %.loc15_5, %.loc15_32.2 -// CHECK:STDOUT: %.loc15_32.4: init i32 = initialize_from %.loc15_30 to %.loc15_32.3 [template = constants.%.38] -// CHECK:STDOUT: %.loc15_32.5: init %.36 = array_init (%.loc15_32.4) to %.loc15_5 [template = constants.%array] -// CHECK:STDOUT: %.loc15_34: init %.36 = converted %.loc15_32.1, %.loc15_32.5 [template = constants.%array] +// CHECK:STDOUT: %.loc15_57: type = array_type %.loc15_55, i32 [template = constants.%.40] +// CHECK:STDOUT: %.loc15_32.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc15_32.3: = bound_method %.loc15_30, %.loc15_32.2 [template = constants.%.48] +// CHECK:STDOUT: %int.convert_checked.loc15: init i32 = call %.loc15_32.3(%.loc15_30) [template = constants.%.47] +// CHECK:STDOUT: %.loc15_32.4: init i32 = converted %.loc15_30, %int.convert_checked.loc15 [template = constants.%.47] +// CHECK:STDOUT: %.loc15_5: ref %.40 = splice_block file.%tuple_index.var {} +// CHECK:STDOUT: %.loc15_32.5: i32 = int_value 0 [template = constants.%.47] +// CHECK:STDOUT: %.loc15_32.6: ref i32 = array_index %.loc15_5, %.loc15_32.5 +// CHECK:STDOUT: %.loc15_32.7: init i32 = initialize_from %.loc15_32.4 to %.loc15_32.6 [template = constants.%.47] +// CHECK:STDOUT: %.loc15_32.8: init %.40 = array_init (%.loc15_32.7) to %.loc15_5 [template = constants.%array] +// CHECK:STDOUT: %.loc15_34: init %.40 = converted %.loc15_32.1, %.loc15_32.8 [template = constants.%array] // CHECK:STDOUT: assign file.%tuple_index.var, %.loc15_34 -// CHECK:STDOUT: %.loc17_32: i32 = int_value 0 [template = constants.%.38] -// CHECK:STDOUT: %.loc17_34.1: %tuple.type.3 = tuple_literal (%.loc17_32) +// CHECK:STDOUT: %.loc17_32: Core.IntLiteral = int_value 0 [template = constants.%.42] +// CHECK:STDOUT: %.loc17_34.1: %tuple.type.4 = tuple_literal (%.loc17_32) // CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc17_51: i32 = int_value 3 [template = constants.%.6] -// CHECK:STDOUT: %.loc17_59: i32 = int_value 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc17_60.1: %.43 = struct_literal (%.loc17_51, %.loc17_59) -// CHECK:STDOUT: %struct.loc17: %.43 = struct_value (%.loc17_51, %.loc17_59) [template = constants.%struct.3] -// CHECK:STDOUT: %.loc17_60.2: %.43 = converted %.loc17_60.1, %struct.loc17 [template = constants.%struct.3] -// CHECK:STDOUT: %.loc17_61.1: i32 = struct_access %.loc17_60.2, element1 [template = constants.%.2] +// CHECK:STDOUT: %.loc17_51: Core.IntLiteral = int_value 3 [template = constants.%.34] +// CHECK:STDOUT: %.loc17_59: Core.IntLiteral = int_value 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc17_60.1: %.49 = struct_literal (%.loc17_51, %.loc17_59) +// CHECK:STDOUT: %struct.loc17: %.49 = struct_value (%.loc17_51, %.loc17_59) [template = constants.%struct.3] +// CHECK:STDOUT: %.loc17_60.2: %.49 = converted %.loc17_60.1, %struct.loc17 [template = constants.%struct.3] +// CHECK:STDOUT: %.loc17_61: Core.IntLiteral = struct_access %.loc17_60.2, element1 [template = constants.%.2] // CHECK:STDOUT: %.loc17_40.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] // CHECK:STDOUT: %.loc17_40.2: type = converted %int.make_type_32.loc17, %.loc17_40.1 [template = i32] -// CHECK:STDOUT: %.loc17_61.2: %Convert.type.2 = interface_witness_access constants.%.33, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc17_61.3: = bound_method %.loc17_61.1, %.loc17_61.2 [template = constants.%.34] -// CHECK:STDOUT: %int.convert_checked.loc17: init Core.IntLiteral = call %.loc17_61.3(%.loc17_61.1) [template = constants.%.35] -// CHECK:STDOUT: %.loc17_61.4: Core.IntLiteral = value_of_initializer %int.convert_checked.loc17 [template = constants.%.35] -// CHECK:STDOUT: %.loc17_61.5: Core.IntLiteral = converted %.loc17_61.1, %.loc17_61.4 [template = constants.%.35] -// CHECK:STDOUT: %.loc17_63: type = array_type %.loc17_61.5, i32 [template = constants.%.36] -// CHECK:STDOUT: %.loc17_5: ref %.36 = splice_block file.%struct_access.var {} -// CHECK:STDOUT: %.loc17_34.2: i32 = int_value 0 [template = constants.%.38] -// CHECK:STDOUT: %.loc17_34.3: ref i32 = array_index %.loc17_5, %.loc17_34.2 -// CHECK:STDOUT: %.loc17_34.4: init i32 = initialize_from %.loc17_32 to %.loc17_34.3 [template = constants.%.38] -// CHECK:STDOUT: %.loc17_34.5: init %.36 = array_init (%.loc17_34.4) to %.loc17_5 [template = constants.%array] -// CHECK:STDOUT: %.loc17_36: init %.36 = converted %.loc17_34.1, %.loc17_34.5 [template = constants.%array] +// CHECK:STDOUT: %.loc17_63: type = array_type %.loc17_61, i32 [template = constants.%.40] +// CHECK:STDOUT: %.loc17_34.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc17_34.3: = bound_method %.loc17_32, %.loc17_34.2 [template = constants.%.48] +// CHECK:STDOUT: %int.convert_checked.loc17: init i32 = call %.loc17_34.3(%.loc17_32) [template = constants.%.47] +// CHECK:STDOUT: %.loc17_34.4: init i32 = converted %.loc17_32, %int.convert_checked.loc17 [template = constants.%.47] +// CHECK:STDOUT: %.loc17_5: ref %.40 = splice_block file.%struct_access.var {} +// CHECK:STDOUT: %.loc17_34.5: i32 = int_value 0 [template = constants.%.47] +// CHECK:STDOUT: %.loc17_34.6: ref i32 = array_index %.loc17_5, %.loc17_34.5 +// CHECK:STDOUT: %.loc17_34.7: init i32 = initialize_from %.loc17_34.4 to %.loc17_34.6 [template = constants.%.47] +// CHECK:STDOUT: %.loc17_34.8: init %.40 = array_init (%.loc17_34.7) to %.loc17_5 [template = constants.%array] +// CHECK:STDOUT: %.loc17_36: init %.40 = converted %.loc17_34.1, %.loc17_34.8 [template = constants.%array] // CHECK:STDOUT: assign file.%struct_access.var, %.loc17_36 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/eval/fail_aggregate.carbon b/toolchain/check/testdata/eval/fail_aggregate.carbon index 2021f7e8b9505..b4d94bcb19ca3 100644 --- a/toolchain/check/testdata/eval/fail_aggregate.carbon +++ b/toolchain/check/testdata/eval/fail_aggregate.carbon @@ -20,27 +20,34 @@ var array_index: [i32; 1] = (0,) as [i32; ((5, 7, 1, 9) as [i32; 4])[2]]; // CHECK:STDOUT: constants { // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.2: type = array_type %.1, i32 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %tuple.type.1: type = tuple_type (Core.IntLiteral) [template] +// CHECK:STDOUT: %.5: Core.IntLiteral = int_value 5 [template] +// CHECK:STDOUT: %.6: Core.IntLiteral = int_value 7 [template] +// CHECK:STDOUT: %.7: Core.IntLiteral = int_value 9 [template] +// CHECK:STDOUT: %tuple.type.2: type = tuple_type (Core.IntLiteral, Core.IntLiteral, Core.IntLiteral, Core.IntLiteral) [template] +// CHECK:STDOUT: %.8: Core.IntLiteral = int_value 4 [template] +// CHECK:STDOUT: %.9: type = array_type %.8, i32 [template] +// CHECK:STDOUT: %.11: i32 = int_value 0 [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: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] -// CHECK:STDOUT: %.27: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %.28: type = array_type %.27, i32 [template] -// CHECK:STDOUT: %.30: i32 = int_value 0 [template] -// CHECK:STDOUT: %tuple.type.1: type = tuple_type (i32) [template] -// CHECK:STDOUT: %.31: i32 = int_value 5 [template] -// CHECK:STDOUT: %.32: i32 = int_value 7 [template] -// CHECK:STDOUT: %.33: i32 = int_value 9 [template] -// CHECK:STDOUT: %tuple.type.2: type = tuple_type (i32, i32, i32, i32) [template] -// CHECK:STDOUT: %.34: i32 = int_value 4 [template] -// CHECK:STDOUT: %.35: = bound_method %.34, %Convert.15 [template] -// CHECK:STDOUT: %.36: Core.IntLiteral = int_value 4 [template] -// CHECK:STDOUT: %.37: type = array_type %.36, i32 [template] -// CHECK:STDOUT: %.39: i32 = int_value 2 [template] -// CHECK:STDOUT: %.40: i32 = int_value 3 [template] -// CHECK:STDOUT: %array: %.37 = tuple_value (%.31, %.32, %.1, %.33) [template] +// CHECK:STDOUT: %.35: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.36: = bound_method %.5, %Convert.15 [template] +// CHECK:STDOUT: %.37: i32 = int_value 5 [template] +// CHECK:STDOUT: %.38: i32 = int_value 1 [template] +// CHECK:STDOUT: %.39: = bound_method %.6, %Convert.15 [template] +// CHECK:STDOUT: %.40: i32 = int_value 7 [template] +// CHECK:STDOUT: %.41: i32 = int_value 2 [template] +// CHECK:STDOUT: %.42: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.43: i32 = int_value 3 [template] +// CHECK:STDOUT: %.44: = bound_method %.7, %Convert.15 [template] +// CHECK:STDOUT: %.45: i32 = int_value 9 [template] +// CHECK:STDOUT: %array: %.9 = tuple_value (%.37, %.40, %.38, %.45) [template] +// CHECK:STDOUT: %.46: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.47: = bound_method %.46, %Convert.15 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -59,57 +66,68 @@ var array_index: [i32; 1] = (0,) as [i32; ((5, 7, 1, 9) as [i32; 4])[2]]; // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc16_24.1: i32 = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc16_24: Core.IntLiteral = int_value 1 [template = constants.%.1] // CHECK:STDOUT: %.loc16_19.1: type = value_of_initializer %int.make_type_32 [template = i32] // CHECK:STDOUT: %.loc16_19.2: type = converted %int.make_type_32, %.loc16_19.1 [template = i32] -// CHECK:STDOUT: %.loc16_24.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc16_24.3: = bound_method %.loc16_24.1, %.loc16_24.2 [template = constants.%.26] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc16_24.3(%.loc16_24.1) [template = constants.%.27] -// CHECK:STDOUT: %.loc16_24.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.27] -// CHECK:STDOUT: %.loc16_24.5: Core.IntLiteral = converted %.loc16_24.1, %.loc16_24.4 [template = constants.%.27] -// CHECK:STDOUT: %.loc16_25: type = array_type %.loc16_24.5, i32 [template = constants.%.28] -// CHECK:STDOUT: %array_index.var: ref %.28 = var array_index -// CHECK:STDOUT: %array_index: ref %.28 = bind_name array_index, %array_index.var +// CHECK:STDOUT: %.loc16_25: type = array_type %.loc16_24, i32 [template = constants.%.2] +// CHECK:STDOUT: %array_index.var: ref %.2 = var array_index +// CHECK:STDOUT: %array_index: ref %.2 = bind_name array_index, %array_index.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc16_30: i32 = int_value 0 [template = constants.%.30] +// CHECK:STDOUT: %.loc16_30: Core.IntLiteral = int_value 0 [template = constants.%.4] // CHECK:STDOUT: %.loc16_32: %tuple.type.1 = tuple_literal (%.loc16_30) // CHECK:STDOUT: %int.make_type_32.loc16_38: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc16_45: i32 = int_value 5 [template = constants.%.31] -// CHECK:STDOUT: %.loc16_48: i32 = int_value 7 [template = constants.%.32] -// CHECK:STDOUT: %.loc16_51: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc16_54: i32 = int_value 9 [template = constants.%.33] +// CHECK:STDOUT: %.loc16_45: Core.IntLiteral = int_value 5 [template = constants.%.5] +// CHECK:STDOUT: %.loc16_48: Core.IntLiteral = int_value 7 [template = constants.%.6] +// CHECK:STDOUT: %.loc16_51: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc16_54: Core.IntLiteral = int_value 9 [template = constants.%.7] // CHECK:STDOUT: %.loc16_55.1: %tuple.type.2 = tuple_literal (%.loc16_45, %.loc16_48, %.loc16_51, %.loc16_54) // CHECK:STDOUT: %int.make_type_32.loc16_61: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc16_66.1: i32 = int_value 4 [template = constants.%.34] +// CHECK:STDOUT: %.loc16_66: Core.IntLiteral = int_value 4 [template = constants.%.8] // CHECK:STDOUT: %.loc16_61.1: type = value_of_initializer %int.make_type_32.loc16_61 [template = i32] // CHECK:STDOUT: %.loc16_61.2: type = converted %int.make_type_32.loc16_61, %.loc16_61.1 [template = i32] -// CHECK:STDOUT: %.loc16_66.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc16_66.3: = bound_method %.loc16_66.1, %.loc16_66.2 [template = constants.%.35] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc16_66.3(%.loc16_66.1) [template = constants.%.36] -// CHECK:STDOUT: %.loc16_66.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.36] -// CHECK:STDOUT: %.loc16_66.5: Core.IntLiteral = converted %.loc16_66.1, %.loc16_66.4 [template = constants.%.36] -// CHECK:STDOUT: %.loc16_67: type = array_type %.loc16_66.5, i32 [template = constants.%.37] -// CHECK:STDOUT: %.loc16_55.2: ref %.37 = temporary_storage -// CHECK:STDOUT: %.loc16_55.3: i32 = int_value 0 [template = constants.%.30] -// CHECK:STDOUT: %.loc16_55.4: ref i32 = array_index %.loc16_55.2, %.loc16_55.3 -// CHECK:STDOUT: %.loc16_55.5: init i32 = initialize_from %.loc16_45 to %.loc16_55.4 [template = constants.%.31] -// CHECK:STDOUT: %.loc16_55.6: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc16_55.7: ref i32 = array_index %.loc16_55.2, %.loc16_55.6 -// CHECK:STDOUT: %.loc16_55.8: init i32 = initialize_from %.loc16_48 to %.loc16_55.7 [template = constants.%.32] -// CHECK:STDOUT: %.loc16_55.9: i32 = int_value 2 [template = constants.%.39] -// CHECK:STDOUT: %.loc16_55.10: ref i32 = array_index %.loc16_55.2, %.loc16_55.9 -// CHECK:STDOUT: %.loc16_55.11: init i32 = initialize_from %.loc16_51 to %.loc16_55.10 [template = constants.%.1] -// CHECK:STDOUT: %.loc16_55.12: i32 = int_value 3 [template = constants.%.40] -// CHECK:STDOUT: %.loc16_55.13: ref i32 = array_index %.loc16_55.2, %.loc16_55.12 -// CHECK:STDOUT: %.loc16_55.14: init i32 = initialize_from %.loc16_54 to %.loc16_55.13 [template = constants.%.33] -// CHECK:STDOUT: %.loc16_55.15: init %.37 = array_init (%.loc16_55.5, %.loc16_55.8, %.loc16_55.11, %.loc16_55.14) to %.loc16_55.2 [template = constants.%array] -// CHECK:STDOUT: %.loc16_57.1: init %.37 = converted %.loc16_55.1, %.loc16_55.15 [template = constants.%array] -// CHECK:STDOUT: %.loc16_70: i32 = int_value 2 [template = constants.%.39] -// CHECK:STDOUT: %.loc16_57.2: ref %.37 = temporary %.loc16_55.2, %.loc16_57.1 -// CHECK:STDOUT: %.loc16_71.1: ref i32 = array_index %.loc16_57.2, %.loc16_70 +// CHECK:STDOUT: %.loc16_67: type = array_type %.loc16_66, i32 [template = constants.%.9] +// CHECK:STDOUT: %.loc16_55.2: %Convert.type.2 = interface_witness_access constants.%.35, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc16_55.3: = bound_method %.loc16_45, %.loc16_55.2 [template = constants.%.36] +// CHECK:STDOUT: %int.convert_checked.loc16_55.1: init i32 = call %.loc16_55.3(%.loc16_45) [template = constants.%.37] +// CHECK:STDOUT: %.loc16_55.4: init i32 = converted %.loc16_45, %int.convert_checked.loc16_55.1 [template = constants.%.37] +// CHECK:STDOUT: %.loc16_55.5: ref %.9 = temporary_storage +// CHECK:STDOUT: %.loc16_55.6: i32 = int_value 0 [template = constants.%.11] +// CHECK:STDOUT: %.loc16_55.7: ref i32 = array_index %.loc16_55.5, %.loc16_55.6 +// CHECK:STDOUT: %.loc16_55.8: init i32 = initialize_from %.loc16_55.4 to %.loc16_55.7 [template = constants.%.37] +// CHECK:STDOUT: %.loc16_55.9: %Convert.type.2 = interface_witness_access constants.%.35, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc16_55.10: = bound_method %.loc16_48, %.loc16_55.9 [template = constants.%.39] +// CHECK:STDOUT: %int.convert_checked.loc16_55.2: init i32 = call %.loc16_55.10(%.loc16_48) [template = constants.%.40] +// CHECK:STDOUT: %.loc16_55.11: init i32 = converted %.loc16_48, %int.convert_checked.loc16_55.2 [template = constants.%.40] +// CHECK:STDOUT: %.loc16_55.12: i32 = int_value 1 [template = constants.%.38] +// CHECK:STDOUT: %.loc16_55.13: ref i32 = array_index %.loc16_55.5, %.loc16_55.12 +// CHECK:STDOUT: %.loc16_55.14: init i32 = initialize_from %.loc16_55.11 to %.loc16_55.13 [template = constants.%.40] +// CHECK:STDOUT: %.loc16_55.15: %Convert.type.2 = interface_witness_access constants.%.35, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc16_55.16: = bound_method %.loc16_51, %.loc16_55.15 [template = constants.%.42] +// CHECK:STDOUT: %int.convert_checked.loc16_55.3: init i32 = call %.loc16_55.16(%.loc16_51) [template = constants.%.38] +// CHECK:STDOUT: %.loc16_55.17: init i32 = converted %.loc16_51, %int.convert_checked.loc16_55.3 [template = constants.%.38] +// CHECK:STDOUT: %.loc16_55.18: i32 = int_value 2 [template = constants.%.41] +// CHECK:STDOUT: %.loc16_55.19: ref i32 = array_index %.loc16_55.5, %.loc16_55.18 +// CHECK:STDOUT: %.loc16_55.20: init i32 = initialize_from %.loc16_55.17 to %.loc16_55.19 [template = constants.%.38] +// CHECK:STDOUT: %.loc16_55.21: %Convert.type.2 = interface_witness_access constants.%.35, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc16_55.22: = bound_method %.loc16_54, %.loc16_55.21 [template = constants.%.44] +// CHECK:STDOUT: %int.convert_checked.loc16_55.4: init i32 = call %.loc16_55.22(%.loc16_54) [template = constants.%.45] +// CHECK:STDOUT: %.loc16_55.23: init i32 = converted %.loc16_54, %int.convert_checked.loc16_55.4 [template = constants.%.45] +// CHECK:STDOUT: %.loc16_55.24: i32 = int_value 3 [template = constants.%.43] +// CHECK:STDOUT: %.loc16_55.25: ref i32 = array_index %.loc16_55.5, %.loc16_55.24 +// CHECK:STDOUT: %.loc16_55.26: init i32 = initialize_from %.loc16_55.23 to %.loc16_55.25 [template = constants.%.45] +// CHECK:STDOUT: %.loc16_55.27: init %.9 = array_init (%.loc16_55.8, %.loc16_55.14, %.loc16_55.20, %.loc16_55.26) to %.loc16_55.5 [template = constants.%array] +// CHECK:STDOUT: %.loc16_57.1: init %.9 = converted %.loc16_55.1, %.loc16_55.27 [template = constants.%array] +// CHECK:STDOUT: %.loc16_70.1: Core.IntLiteral = int_value 2 [template = constants.%.46] +// CHECK:STDOUT: %.loc16_57.2: ref %.9 = temporary %.loc16_55.5, %.loc16_57.1 +// CHECK:STDOUT: %.loc16_70.2: %Convert.type.2 = interface_witness_access constants.%.35, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc16_70.3: = bound_method %.loc16_70.1, %.loc16_70.2 [template = constants.%.47] +// CHECK:STDOUT: %int.convert_checked.loc16_70: init i32 = call %.loc16_70.3(%.loc16_70.1) [template = constants.%.41] +// CHECK:STDOUT: %.loc16_70.4: i32 = value_of_initializer %int.convert_checked.loc16_70 [template = constants.%.41] +// CHECK:STDOUT: %.loc16_70.5: i32 = converted %.loc16_70.1, %.loc16_70.4 [template = constants.%.41] +// CHECK:STDOUT: %.loc16_71.1: ref i32 = array_index %.loc16_57.2, %.loc16_70.5 // CHECK:STDOUT: %.loc16_71.2: i32 = bind_value %.loc16_71.1 // CHECK:STDOUT: %.loc16_38.1: type = value_of_initializer %int.make_type_32.loc16_38 [template = i32] // CHECK:STDOUT: %.loc16_38.2: type = converted %int.make_type_32.loc16_38, %.loc16_38.1 [template = i32] diff --git a/toolchain/check/testdata/eval/symbolic.carbon b/toolchain/check/testdata/eval/symbolic.carbon index 51d8e55608e00..eb050302ac1f4 100644 --- a/toolchain/check/testdata/eval/symbolic.carbon +++ b/toolchain/check/testdata/eval/symbolic.carbon @@ -27,19 +27,12 @@ fn F(T:! type) { // CHECK:STDOUT: %tuple.type.1: type = tuple_type (type, type) [template] // CHECK:STDOUT: %tuple.type.2: type = tuple_type (%.1, %.2) [symbolic] // CHECK:STDOUT: %.4: type = struct_type {.a: %T} [symbolic] -// CHECK:STDOUT: %.5: i32 = int_value 5 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] -// CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template] -// CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template] -// CHECK:STDOUT: %.29: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.30: = bound_method %.5, %Convert.15 [template] -// CHECK:STDOUT: %.31: Core.IntLiteral = int_value 5 [template] -// CHECK:STDOUT: %.32: type = array_type %.31, %T [symbolic] +// CHECK:STDOUT: %.5: Core.IntLiteral = int_value 5 [template] +// CHECK:STDOUT: %.6: type = array_type %.5, %T [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .ImplicitAs = %import_ref.1 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -69,7 +62,7 @@ fn F(T:! type) { // CHECK:STDOUT: %.loc13_15.2: type = const_type @F.%T.loc12_6.2 (%T) [symbolic = %.loc13_15.2 (constants.%.2)] // CHECK:STDOUT: %tuple.type: type = tuple_type (@F.%.loc13_12.2 (%.1), @F.%.loc13_15.2 (%.2)) [symbolic = %tuple.type (constants.%tuple.type.2)] // CHECK:STDOUT: %.loc14_16.2: type = struct_type {.a: @F.%T.loc12_6.2 (%T)} [symbolic = %.loc14_16.2 (constants.%.4)] -// CHECK:STDOUT: %.loc15_15.2: type = array_type constants.%.31, @F.%T.loc12_6.2 (%T) [symbolic = %.loc15_15.2 (constants.%.32)] +// CHECK:STDOUT: %.loc15_15.2: type = array_type constants.%.5, @F.%T.loc12_6.2 (%T) [symbolic = %.loc15_15.2 (constants.%.6)] // CHECK:STDOUT: // CHECK:STDOUT: fn(%T.param_patt: type) { // CHECK:STDOUT: !entry: @@ -86,15 +79,10 @@ fn F(T:! type) { // CHECK:STDOUT: %v.var: ref @F.%.loc14_16.2 (%.4) = var v // CHECK:STDOUT: %v: ref @F.%.loc14_16.2 (%.4) = bind_name v, %v.var // CHECK:STDOUT: %T.ref.loc15: type = name_ref T, %T.loc12_6.1 [symbolic = %T.loc12_6.2 (constants.%T)] -// CHECK:STDOUT: %.loc15_14.1: i32 = int_value 5 [template = constants.%.5] -// CHECK:STDOUT: %.loc15_14.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc15_14.3: = bound_method %.loc15_14.1, %.loc15_14.2 [template = constants.%.30] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc15_14.3(%.loc15_14.1) [template = constants.%.31] -// CHECK:STDOUT: %.loc15_14.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.31] -// CHECK:STDOUT: %.loc15_14.5: Core.IntLiteral = converted %.loc15_14.1, %.loc15_14.4 [template = constants.%.31] -// CHECK:STDOUT: %.loc15_15.1: type = array_type %.loc15_14.5, %T [symbolic = %.loc15_15.2 (constants.%.32)] -// CHECK:STDOUT: %w.var: ref @F.%.loc15_15.2 (%.32) = var w -// CHECK:STDOUT: %w: ref @F.%.loc15_15.2 (%.32) = bind_name w, %w.var +// CHECK:STDOUT: %.loc15_14: Core.IntLiteral = int_value 5 [template = constants.%.5] +// CHECK:STDOUT: %.loc15_15.1: type = array_type %.loc15_14, %T [symbolic = %.loc15_15.2 (constants.%.6)] +// CHECK:STDOUT: %w.var: ref @F.%.loc15_15.2 (%.6) = var w +// CHECK:STDOUT: %w: ref @F.%.loc15_15.2 (%.6) = bind_name w, %w.var // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/expr_category/in_place_tuple_init.carbon b/toolchain/check/testdata/expr_category/in_place_tuple_init.carbon index 9c0cf281ef822..96d1261d4f6cf 100644 --- a/toolchain/check/testdata/expr_category/in_place_tuple_init.carbon +++ b/toolchain/check/testdata/expr_category/in_place_tuple_init.carbon @@ -33,7 +33,7 @@ fn H() -> i32 { // CHECK:STDOUT: %G: %G.type = struct_value () [template] // CHECK:STDOUT: %H.type: type = fn_type @H [template] // CHECK:STDOUT: %H: %H.type = struct_value () [template] -// CHECK:STDOUT: %.2: i32 = int_value 0 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -128,7 +128,7 @@ fn H() -> i32 { // CHECK:STDOUT: %G.ref: %G.type = name_ref G, file.%G.decl [template = constants.%G] // CHECK:STDOUT: %.loc20_11.1: ref %tuple.type.2 = temporary_storage // CHECK:STDOUT: %G.call: init %tuple.type.2 = call %G.ref() to %.loc20_11.1 -// CHECK:STDOUT: %.loc20_14: i32 = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc20_14: Core.IntLiteral = int_value 0 [template = constants.%.2] // CHECK:STDOUT: %.loc20_11.2: ref %tuple.type.2 = temporary %.loc20_11.1, %G.call // CHECK:STDOUT: %.loc20_13.1: ref i32 = tuple_access %.loc20_11.2, element0 // CHECK:STDOUT: %.loc20_13.2: i32 = bind_value %.loc20_13.1 diff --git a/toolchain/check/testdata/function/builtin/call.carbon b/toolchain/check/testdata/function/builtin/call.carbon index c9d3d342c77f0..3a187c902d3f1 100644 --- a/toolchain/check/testdata/function/builtin/call.carbon +++ b/toolchain/check/testdata/function/builtin/call.carbon @@ -19,16 +19,24 @@ var arr: [i32; Add(1, 2)]; // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %Add.type: type = fn_type @Add [template] // CHECK:STDOUT: %Add: %Add.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %.2: i32 = int_value 2 [template] -// CHECK:STDOUT: %.3: i32 = int_value 3 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(i32) [template] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] // CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template] // CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template] -// CHECK:STDOUT: %.27: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.28: = bound_method %.3, %Convert.15 [template] -// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 3 [template] -// CHECK:STDOUT: %.30: type = array_type %.29, i32 [template] +// CHECK:STDOUT: %.26: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 1 [template] +// CHECK:STDOUT: %.29: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 2 [template] +// CHECK:STDOUT: %.31: i32 = int_value 3 [template] +// CHECK:STDOUT: %Convert.type.16: type = fn_type @Convert.12 [template] +// CHECK:STDOUT: %Convert.16: %Convert.type.16 = struct_value () [template] +// CHECK:STDOUT: %.32: = interface_witness (%Convert.16) [template] +// CHECK:STDOUT: %.33: = bound_method %.31, %Convert.16 [template] +// CHECK:STDOUT: %.34: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.35: type = array_type %.34, i32 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -73,21 +81,31 @@ var arr: [i32; Add(1, 2)]; // CHECK:STDOUT: } // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %Add.ref: %Add.type = name_ref Add, %Add.decl [template = constants.%Add] -// CHECK:STDOUT: %.loc13_20: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc13_23: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: %int.sadd: init i32 = call %Add.ref(%.loc13_20, %.loc13_23) [template = constants.%.3] +// CHECK:STDOUT: %.loc13_20.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc13_23.1: Core.IntLiteral = int_value 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc13_20.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_20.3: = bound_method %.loc13_20.1, %.loc13_20.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc13_20: init i32 = call %.loc13_20.3(%.loc13_20.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc13_20.4: i32 = value_of_initializer %int.convert_checked.loc13_20 [template = constants.%.28] +// CHECK:STDOUT: %.loc13_20.5: i32 = converted %.loc13_20.1, %.loc13_20.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc13_23.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_23.3: = bound_method %.loc13_23.1, %.loc13_23.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc13_23: init i32 = call %.loc13_23.3(%.loc13_23.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc13_23.4: i32 = value_of_initializer %int.convert_checked.loc13_23 [template = constants.%.30] +// CHECK:STDOUT: %.loc13_23.5: i32 = converted %.loc13_23.1, %.loc13_23.4 [template = constants.%.30] +// CHECK:STDOUT: %int.sadd: init i32 = call %Add.ref(%.loc13_20.5, %.loc13_23.5) [template = constants.%.31] // CHECK:STDOUT: %.loc13_11.1: type = value_of_initializer %int.make_type_32 [template = i32] // CHECK:STDOUT: %.loc13_11.2: type = converted %int.make_type_32, %.loc13_11.1 [template = i32] -// CHECK:STDOUT: %.loc13_19.1: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc13_19.2: = bound_method %int.sadd, %.loc13_19.1 [template = constants.%.28] -// CHECK:STDOUT: %.loc13_19.3: i32 = value_of_initializer %int.sadd [template = constants.%.3] -// CHECK:STDOUT: %.loc13_19.4: i32 = converted %int.sadd, %.loc13_19.3 [template = constants.%.3] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc13_19.2(%.loc13_19.4) [template = constants.%.29] -// CHECK:STDOUT: %.loc13_19.5: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.29] -// CHECK:STDOUT: %.loc13_19.6: Core.IntLiteral = converted %int.sadd, %.loc13_19.5 [template = constants.%.29] -// CHECK:STDOUT: %.loc13_25: type = array_type %.loc13_19.6, i32 [template = constants.%.30] -// CHECK:STDOUT: %arr.var: ref %.30 = var arr -// CHECK:STDOUT: %arr: ref %.30 = bind_name arr, %arr.var +// CHECK:STDOUT: %.loc13_19.1: %Convert.type.5 = interface_witness_access constants.%.32, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %.loc13_19.2: = bound_method %int.sadd, %.loc13_19.1 [template = constants.%.33] +// CHECK:STDOUT: %.loc13_19.3: i32 = value_of_initializer %int.sadd [template = constants.%.31] +// CHECK:STDOUT: %.loc13_19.4: i32 = converted %int.sadd, %.loc13_19.3 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc13_19: init Core.IntLiteral = call %.loc13_19.2(%.loc13_19.4) [template = constants.%.34] +// CHECK:STDOUT: %.loc13_19.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc13_19 [template = constants.%.34] +// CHECK:STDOUT: %.loc13_19.6: Core.IntLiteral = converted %int.sadd, %.loc13_19.5 [template = constants.%.34] +// CHECK:STDOUT: %.loc13_25: type = array_type %.loc13_19.6, i32 [template = constants.%.35] +// CHECK:STDOUT: %arr.var: ref %.35 = var arr +// CHECK:STDOUT: %arr: ref %.35 = bind_name arr, %arr.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Add(%a.param_patt: i32, %b.param_patt: i32) -> i32 = "int.sadd"; diff --git a/toolchain/check/testdata/function/builtin/method.carbon b/toolchain/check/testdata/function/builtin/method.carbon index e67e4ea3e462a..ca35cd60b0739 100644 --- a/toolchain/check/testdata/function/builtin/method.carbon +++ b/toolchain/check/testdata/function/builtin/method.carbon @@ -16,7 +16,7 @@ impl i32 as I { fn F[self: i32](other: i32) -> i32 = "int.sadd"; } -var arr: [i32; 1.(I.F)(2)]; +var arr: [i32; (1 as i32).(I.F)(2)]; // CHECK:STDOUT: --- method.carbon // CHECK:STDOUT: @@ -32,23 +32,36 @@ var arr: [i32; 1.(I.F)(2)]; // CHECK:STDOUT: %F.type.2: type = fn_type @F.2 [template] // CHECK:STDOUT: %F.2: %F.type.2 = struct_value () [template] // CHECK:STDOUT: %.3: = interface_witness (%F.2) [template] -// CHECK:STDOUT: %.4: i32 = int_value 1 [template] -// CHECK:STDOUT: %.5: = bound_method %.4, %F.2 [template] -// CHECK:STDOUT: %.6: i32 = int_value 2 [template] -// CHECK:STDOUT: %.7: i32 = int_value 3 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @As(i32) [template] +// CHECK:STDOUT: %Convert.type.4: type = fn_type @Convert.2, @ImplicitAs(i32) [template] +// CHECK:STDOUT: %Convert.type.7: type = fn_type @Convert.2, @ImplicitAs(Core.IntLiteral) [template] // CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template] // CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template] -// CHECK:STDOUT: %.31: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.32: = bound_method %.7, %Convert.15 [template] -// CHECK:STDOUT: %.33: Core.IntLiteral = int_value 3 [template] -// CHECK:STDOUT: %.34: type = array_type %.33, i32 [template] +// CHECK:STDOUT: %.28: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.29: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 1 [template] +// CHECK:STDOUT: %.31: = bound_method %.30, %F.2 [template] +// CHECK:STDOUT: %.32: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %Convert.type.16: type = fn_type @Convert.12 [template] +// CHECK:STDOUT: %Convert.16: %Convert.type.16 = struct_value () [template] +// CHECK:STDOUT: %.34: = interface_witness (%Convert.16) [template] +// CHECK:STDOUT: %.35: = bound_method %.32, %Convert.16 [template] +// CHECK:STDOUT: %.36: i32 = int_value 2 [template] +// CHECK:STDOUT: %.37: i32 = int_value 3 [template] +// CHECK:STDOUT: %Convert.type.17: type = fn_type @Convert.13 [template] +// CHECK:STDOUT: %Convert.17: %Convert.type.17 = struct_value () [template] +// CHECK:STDOUT: %.38: = interface_witness (%Convert.17) [template] +// CHECK:STDOUT: %.39: = bound_method %.37, %Convert.17 [template] +// CHECK:STDOUT: %.40: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.41: type = array_type %.40, i32 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int32 = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.2 +// CHECK:STDOUT: .As = %import_ref.2 +// CHECK:STDOUT: .ImplicitAs = %import_ref.51 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -68,26 +81,39 @@ var arr: [i32; 1.(I.F)(2)]; // CHECK:STDOUT: %.loc15_6.2: type = converted %int.make_type_32, %.loc15_6.1 [template = i32] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc19_16: i32 = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %int.make_type_32.loc19_11: init type = call constants.%Int32() [template = i32] +// CHECK:STDOUT: %.loc19_17: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %int.make_type_32.loc19_22: init type = call constants.%Int32() [template = i32] +// CHECK:STDOUT: %.loc19_22.1: type = value_of_initializer %int.make_type_32.loc19_22 [template = i32] +// CHECK:STDOUT: %.loc19_22.2: type = converted %int.make_type_32.loc19_22, %.loc19_22.1 [template = i32] +// CHECK:STDOUT: %.loc19_19.1: %Convert.type.2 = interface_witness_access constants.%.28, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc19_19.2: = bound_method %.loc19_17, %.loc19_19.1 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc19_19: init i32 = call %.loc19_19.2(%.loc19_17) [template = constants.%.30] +// CHECK:STDOUT: %.loc19_19.3: i32 = value_of_initializer %int.convert_checked.loc19_19 [template = constants.%.30] +// CHECK:STDOUT: %.loc19_19.4: i32 = converted %.loc19_17, %.loc19_19.3 [template = constants.%.30] // CHECK:STDOUT: %I.ref: type = name_ref I, %I.decl [template = constants.%I.type] // CHECK:STDOUT: %F.ref: %.1 = name_ref F, @I.%.loc12 [template = constants.%.2] -// CHECK:STDOUT: %.loc19_17.1: %F.type.1 = interface_witness_access constants.%.3, element0 [template = constants.%F.2] -// CHECK:STDOUT: %.loc19_17.2: = bound_method %.loc19_16, %.loc19_17.1 [template = constants.%.5] -// CHECK:STDOUT: %.loc19_24: i32 = int_value 2 [template = constants.%.6] -// CHECK:STDOUT: %int.sadd: init i32 = call %.loc19_17.2(%.loc19_16, %.loc19_24) [template = constants.%.7] -// CHECK:STDOUT: %.loc19_11.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc19_11.2: type = converted %int.make_type_32, %.loc19_11.1 [template = i32] -// CHECK:STDOUT: %.loc19_23.1: %Convert.type.2 = interface_witness_access constants.%.31, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc19_23.2: = bound_method %int.sadd, %.loc19_23.1 [template = constants.%.32] -// CHECK:STDOUT: %.loc19_23.3: i32 = value_of_initializer %int.sadd [template = constants.%.7] -// CHECK:STDOUT: %.loc19_23.4: i32 = converted %int.sadd, %.loc19_23.3 [template = constants.%.7] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc19_23.2(%.loc19_23.4) [template = constants.%.33] -// CHECK:STDOUT: %.loc19_23.5: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.33] -// CHECK:STDOUT: %.loc19_23.6: Core.IntLiteral = converted %int.sadd, %.loc19_23.5 [template = constants.%.33] -// CHECK:STDOUT: %.loc19_26: type = array_type %.loc19_23.6, i32 [template = constants.%.34] -// CHECK:STDOUT: %arr.var: ref %.34 = var arr -// CHECK:STDOUT: %arr: ref %.34 = bind_name arr, %arr.var +// CHECK:STDOUT: %.loc19_26.1: %F.type.1 = interface_witness_access constants.%.3, element0 [template = constants.%F.2] +// CHECK:STDOUT: %.loc19_26.2: = bound_method %.loc19_19.4, %.loc19_26.1 [template = constants.%.31] +// CHECK:STDOUT: %.loc19_33.1: Core.IntLiteral = int_value 2 [template = constants.%.32] +// CHECK:STDOUT: %.loc19_33.2: %Convert.type.4 = interface_witness_access constants.%.34, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %.loc19_33.3: = bound_method %.loc19_33.1, %.loc19_33.2 [template = constants.%.35] +// CHECK:STDOUT: %int.convert_checked.loc19_33: init i32 = call %.loc19_33.3(%.loc19_33.1) [template = constants.%.36] +// CHECK:STDOUT: %.loc19_33.4: i32 = value_of_initializer %int.convert_checked.loc19_33 [template = constants.%.36] +// CHECK:STDOUT: %.loc19_33.5: i32 = converted %.loc19_33.1, %.loc19_33.4 [template = constants.%.36] +// CHECK:STDOUT: %int.sadd: init i32 = call %.loc19_26.2(%.loc19_19.4, %.loc19_33.5) [template = constants.%.37] +// CHECK:STDOUT: %.loc19_11.1: type = value_of_initializer %int.make_type_32.loc19_11 [template = i32] +// CHECK:STDOUT: %.loc19_11.2: type = converted %int.make_type_32.loc19_11, %.loc19_11.1 [template = i32] +// CHECK:STDOUT: %.loc19_32.1: %Convert.type.7 = interface_witness_access constants.%.38, element0 [template = constants.%Convert.17] +// CHECK:STDOUT: %.loc19_32.2: = bound_method %int.sadd, %.loc19_32.1 [template = constants.%.39] +// CHECK:STDOUT: %.loc19_32.3: i32 = value_of_initializer %int.sadd [template = constants.%.37] +// CHECK:STDOUT: %.loc19_32.4: i32 = converted %int.sadd, %.loc19_32.3 [template = constants.%.37] +// CHECK:STDOUT: %int.convert_checked.loc19_32: init Core.IntLiteral = call %.loc19_32.2(%.loc19_32.4) [template = constants.%.40] +// CHECK:STDOUT: %.loc19_32.5: Core.IntLiteral = value_of_initializer %int.convert_checked.loc19_32 [template = constants.%.40] +// CHECK:STDOUT: %.loc19_32.6: Core.IntLiteral = converted %int.sadd, %.loc19_32.5 [template = constants.%.40] +// CHECK:STDOUT: %.loc19_35: type = array_type %.loc19_32.6, i32 [template = constants.%.41] +// CHECK:STDOUT: %arr.var: ref %.41 = var arr +// CHECK:STDOUT: %arr: ref %.41 = bind_name arr, %arr.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { diff --git a/toolchain/check/testdata/function/builtin/no_prelude/call_from_operator.carbon b/toolchain/check/testdata/function/builtin/no_prelude/call_from_operator.carbon index 90095b9662c33..a14ad28562e23 100644 --- a/toolchain/check/testdata/function/builtin/no_prelude/call_from_operator.carbon +++ b/toolchain/check/testdata/function/builtin/no_prelude/call_from_operator.carbon @@ -19,6 +19,10 @@ interface Add { fn Op[self: Self](other: Self) -> Self; } +interface As(T:! type) { + fn Convert[self: Self]() -> T; +} + interface ImplicitAs(T:! type) { fn Convert[self: Self]() -> T; } @@ -27,6 +31,14 @@ impl i32 as Add { fn Op[self: Self](other: Self) -> Self = "int.sadd"; } +impl IntLiteral() as As(i32) { + fn Convert[self: Self]() -> i32 = "int.convert_checked"; +} + +impl IntLiteral() as ImplicitAs(i32) { + fn Convert[self: Self]() -> i32 = "int.convert_checked"; +} + impl i32 as ImplicitAs(IntLiteral()) { fn Convert[self: Self]() -> IntLiteral() = "int.convert_checked"; } @@ -35,7 +47,7 @@ impl i32 as ImplicitAs(IntLiteral()) { import Core; -var arr: [i32; 1 + 2] = (3, 4, 3 + 4); +var arr: [i32; (1 as i32) + (2 as i32)] = (3, 4, (3 as i32) + (4 as i32)); // CHECK:STDOUT: --- core.carbon // CHECK:STDOUT: @@ -52,25 +64,49 @@ var arr: [i32; 1 + 2] = (3, 4, 3 + 4); // CHECK:STDOUT: %.2: %.1 = assoc_entity element0, @Add.%Op.decl [template] // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic] +// CHECK:STDOUT: %As.type.1: type = generic_interface_type @As [template] +// CHECK:STDOUT: %As: %As.type.1 = struct_value () [template] +// CHECK:STDOUT: %As.type.2: type = facet_type <@As, @As(%T)> [symbolic] +// CHECK:STDOUT: %Self.2: %As.type.2 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Convert.type.1: type = fn_type @Convert.1, @As(%T) [symbolic] +// CHECK:STDOUT: %Convert.1: %Convert.type.1 = struct_value () [symbolic] +// CHECK:STDOUT: %.3: type = assoc_entity_type %As.type.2, %Convert.type.1 [symbolic] +// CHECK:STDOUT: %.4: %.3 = assoc_entity element0, @As.%Convert.decl [symbolic] // CHECK:STDOUT: %ImplicitAs.type.1: type = generic_interface_type @ImplicitAs [template] // CHECK:STDOUT: %ImplicitAs: %ImplicitAs.type.1 = struct_value () [template] // CHECK:STDOUT: %ImplicitAs.type.2: type = facet_type <@ImplicitAs, @ImplicitAs(%T)> [symbolic] -// CHECK:STDOUT: %Self.2: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic] -// CHECK:STDOUT: %Convert.type.1: type = fn_type @Convert.1, @ImplicitAs(%T) [symbolic] -// CHECK:STDOUT: %Convert.1: %Convert.type.1 = struct_value () [symbolic] -// CHECK:STDOUT: %.3: type = assoc_entity_type %ImplicitAs.type.2, %Convert.type.1 [symbolic] -// CHECK:STDOUT: %.4: %.3 = assoc_entity element0, @ImplicitAs.%Convert.decl [symbolic] +// CHECK:STDOUT: %Self.3: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.2, @ImplicitAs(%T) [symbolic] +// CHECK:STDOUT: %Convert.2: %Convert.type.2 = struct_value () [symbolic] +// CHECK:STDOUT: %.5: type = assoc_entity_type %ImplicitAs.type.2, %Convert.type.2 [symbolic] +// CHECK:STDOUT: %.6: %.5 = assoc_entity element0, @ImplicitAs.%Convert.decl [symbolic] // CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] // CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template] -// CHECK:STDOUT: %.5: = interface_witness (%Op.2) [template] -// CHECK:STDOUT: %ImplicitAs.type.3: type = facet_type <@ImplicitAs, @ImplicitAs(Core.IntLiteral)> [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.2 [template] -// CHECK:STDOUT: %Convert.2: %Convert.type.2 = struct_value () [template] -// CHECK:STDOUT: %Convert.type.3: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.7: = interface_witness (%Op.2) [template] +// CHECK:STDOUT: %As.type.3: type = facet_type <@As, @As(i32)> [template] +// CHECK:STDOUT: %Convert.type.3: type = fn_type @Convert.3 [template] // CHECK:STDOUT: %Convert.3: %Convert.type.3 = struct_value () [template] -// CHECK:STDOUT: %.6: type = assoc_entity_type %ImplicitAs.type.3, %Convert.type.3 [template] -// CHECK:STDOUT: %.7: %.6 = assoc_entity element0, @ImplicitAs.%Convert.decl [template] -// CHECK:STDOUT: %.8: = interface_witness (%Convert.2) [template] +// CHECK:STDOUT: %Convert.type.4: type = fn_type @Convert.1, @As(i32) [template] +// CHECK:STDOUT: %Convert.4: %Convert.type.4 = struct_value () [template] +// CHECK:STDOUT: %.8: type = assoc_entity_type %As.type.3, %Convert.type.4 [template] +// CHECK:STDOUT: %.9: %.8 = assoc_entity element0, @As.%Convert.decl [template] +// CHECK:STDOUT: %.10: = interface_witness (%Convert.3) [template] +// CHECK:STDOUT: %ImplicitAs.type.3: type = facet_type <@ImplicitAs, @ImplicitAs(i32)> [template] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.4 [template] +// CHECK:STDOUT: %Convert.5: %Convert.type.5 = struct_value () [template] +// CHECK:STDOUT: %Convert.type.6: type = fn_type @Convert.2, @ImplicitAs(i32) [template] +// CHECK:STDOUT: %Convert.6: %Convert.type.6 = struct_value () [template] +// CHECK:STDOUT: %.11: type = assoc_entity_type %ImplicitAs.type.3, %Convert.type.6 [template] +// CHECK:STDOUT: %.12: %.11 = assoc_entity element0, @ImplicitAs.%Convert.decl [template] +// CHECK:STDOUT: %.13: = interface_witness (%Convert.5) [template] +// CHECK:STDOUT: %ImplicitAs.type.4: type = facet_type <@ImplicitAs, @ImplicitAs(Core.IntLiteral)> [template] +// CHECK:STDOUT: %Convert.type.7: type = fn_type @Convert.5 [template] +// CHECK:STDOUT: %Convert.7: %Convert.type.7 = struct_value () [template] +// CHECK:STDOUT: %Convert.type.8: type = fn_type @Convert.2, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %Convert.8: %Convert.type.8 = struct_value () [template] +// CHECK:STDOUT: %.14: type = assoc_entity_type %ImplicitAs.type.4, %Convert.type.8 [template] +// CHECK:STDOUT: %.15: %.14 = assoc_entity element0, @ImplicitAs.%Convert.decl [template] +// CHECK:STDOUT: %.16: = interface_witness (%Convert.7) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -78,6 +114,7 @@ var arr: [i32; 1 + 2] = (3, 4, 3 + 4); // CHECK:STDOUT: .Int32 = %Int32.decl // CHECK:STDOUT: .IntLiteral = %IntLiteral.decl // CHECK:STDOUT: .Add = %Add.decl +// CHECK:STDOUT: .As = %As.decl // CHECK:STDOUT: .ImplicitAs = %ImplicitAs.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Int32.decl: %Int32.type = fn_decl @Int32 [template = constants.%Int32] { @@ -95,29 +132,58 @@ var arr: [i32; 1 + 2] = (3, 4, 3 + 4); // CHECK:STDOUT: %return: ref type = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: %Add.decl: type = interface_decl @Add [template = constants.%Add.type] {} {} +// CHECK:STDOUT: %As.decl: %As.type.1 = interface_decl @As [template = constants.%As] { +// CHECK:STDOUT: %T.patt.loc11_14.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_14.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc11_14.1, runtime_param [symbolic = %T.patt.loc11_14.2 (constants.%T.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %T.param: type = value_param runtime_param +// CHECK:STDOUT: %T.loc11_14.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc11_14.2 (constants.%T)] +// CHECK:STDOUT: } // CHECK:STDOUT: %ImplicitAs.decl: %ImplicitAs.type.1 = interface_decl @ImplicitAs [template = constants.%ImplicitAs] { -// CHECK:STDOUT: %T.patt.loc11_22.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_22.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc11_22.1, runtime_param [symbolic = %T.patt.loc11_22.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.patt.loc15_22.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc15_22.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc15_22.1, runtime_param [symbolic = %T.patt.loc15_22.2 (constants.%T.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %T.param: type = value_param runtime_param -// CHECK:STDOUT: %T.loc11_22.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc11_22.2 (constants.%T)] +// CHECK:STDOUT: %T.loc15_22.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc15_22.2 (constants.%T)] // CHECK:STDOUT: } // CHECK:STDOUT: impl_decl @impl.1 [template] {} { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc15_6.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc15_6.2: type = converted %int.make_type_32, %.loc15_6.1 [template = i32] +// CHECK:STDOUT: %.loc19_6.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc19_6.2: type = converted %int.make_type_32, %.loc19_6.1 [template = i32] // CHECK:STDOUT: %Add.ref: type = name_ref Add, file.%Add.decl [template = constants.%Add.type] // CHECK:STDOUT: } // CHECK:STDOUT: impl_decl @impl.2 [template] {} { +// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, file.%IntLiteral.decl [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc23_17.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc23_17.2: type = converted %int_literal.make_type, %.loc23_17.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %As.ref: %As.type.1 = name_ref As, file.%As.decl [template = constants.%As] // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc19_6.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc19_6.2: type = converted %int.make_type_32, %.loc19_6.1 [template = i32] +// CHECK:STDOUT: %.loc23_24.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc23_24.2: type = converted %int.make_type_32, %.loc23_24.1 [template = i32] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(i32)> [template = constants.%As.type.3] +// CHECK:STDOUT: } +// CHECK:STDOUT: impl_decl @impl.3 [template] {} { +// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, file.%IntLiteral.decl [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc27_17.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc27_17.2: type = converted %int_literal.make_type, %.loc27_17.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %ImplicitAs.ref: %ImplicitAs.type.1 = name_ref ImplicitAs, file.%ImplicitAs.decl [template = constants.%ImplicitAs] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] +// CHECK:STDOUT: %.loc27_32.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc27_32.2: type = converted %int.make_type_32, %.loc27_32.1 [template = i32] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(i32)> [template = constants.%ImplicitAs.type.3] +// CHECK:STDOUT: } +// CHECK:STDOUT: impl_decl @impl.4 [template] {} { +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] +// CHECK:STDOUT: %.loc31_6.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc31_6.2: type = converted %int.make_type_32, %.loc31_6.1 [template = i32] // CHECK:STDOUT: %ImplicitAs.ref: %ImplicitAs.type.1 = name_ref ImplicitAs, file.%ImplicitAs.decl [template = constants.%ImplicitAs] // CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, file.%IntLiteral.decl [template = constants.%IntLiteral] // CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] -// CHECK:STDOUT: %.loc19_23.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] -// CHECK:STDOUT: %.loc19_23.2: type = converted %int_literal.make_type, %.loc19_23.1 [template = Core.IntLiteral] -// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(Core.IntLiteral)> [template = constants.%ImplicitAs.type.3] +// CHECK:STDOUT: %.loc31_23.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc31_23.2: type = converted %int_literal.make_type, %.loc31_23.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(Core.IntLiteral)> [template = constants.%ImplicitAs.type.4] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -155,37 +221,37 @@ var arr: [i32; 1 + 2] = (3, 4, 3 + 4); // CHECK:STDOUT: witness = (%Op.decl) // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @ImplicitAs(%T.loc11_22.1: type) { -// CHECK:STDOUT: %T.loc11_22.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc11_22.2 (constants.%T)] -// CHECK:STDOUT: %T.patt.loc11_22.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_22.2 (constants.%T.patt)] +// CHECK:STDOUT: generic interface @As(%T.loc11_14.1: type) { +// CHECK:STDOUT: %T.loc11_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc11_14.2 (constants.%T)] +// CHECK:STDOUT: %T.patt.loc11_14.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_14.2 (constants.%T.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%T.loc11_22.2)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)] -// CHECK:STDOUT: %Self.2: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self.2)] -// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.1, @ImplicitAs(%T.loc11_22.2) [symbolic = %Convert.type (constants.%Convert.type.1)] -// CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.1) = struct_value () [symbolic = %Convert (constants.%Convert.1)] -// CHECK:STDOUT: %.loc12_32.2: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2), @ImplicitAs.%Convert.type (%Convert.type.1) [symbolic = %.loc12_32.2 (constants.%.3)] -// CHECK:STDOUT: %.loc12_32.3: @ImplicitAs.%.loc12_32.2 (%.3) = assoc_entity element0, %Convert.decl [symbolic = %.loc12_32.3 (constants.%.4)] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%T.loc11_14.2)> [symbolic = %As.type (constants.%As.type.2)] +// CHECK:STDOUT: %Self.2: %As.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self.2)] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.1, @As(%T.loc11_14.2) [symbolic = %Convert.type (constants.%Convert.type.1)] +// CHECK:STDOUT: %Convert: @As.%Convert.type (%Convert.type.1) = struct_value () [symbolic = %Convert (constants.%Convert.1)] +// CHECK:STDOUT: %.loc12_32.2: type = assoc_entity_type @As.%As.type (%As.type.2), @As.%Convert.type (%Convert.type.1) [symbolic = %.loc12_32.2 (constants.%.3)] +// CHECK:STDOUT: %.loc12_32.3: @As.%.loc12_32.2 (%.3) = assoc_entity element0, %Convert.decl [symbolic = %.loc12_32.3 (constants.%.4)] // CHECK:STDOUT: // CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self.2)] -// CHECK:STDOUT: %Convert.decl: @ImplicitAs.%Convert.type (%Convert.type.1) = fn_decl @Convert.1 [symbolic = @ImplicitAs.%Convert (constants.%Convert.1)] { +// CHECK:STDOUT: %Self.1: @As.%As.type (%As.type.2) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self.2)] +// CHECK:STDOUT: %Convert.decl: @As.%Convert.type (%Convert.type.1) = fn_decl @Convert.1 [symbolic = @As.%Convert (constants.%Convert.1)] { // CHECK:STDOUT: %self.patt: @Convert.1.%Self (%Self.2) = binding_pattern self // CHECK:STDOUT: %self.param_patt: @Convert.1.%Self (%Self.2) = value_param_pattern %self.patt, runtime_param0 // CHECK:STDOUT: %return.patt: @Convert.1.%T (%T) = return_slot_pattern // CHECK:STDOUT: %return.param_patt: @Convert.1.%T (%T) = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc12_20.1: @Convert.1.%ImplicitAs.type (%ImplicitAs.type.2) = specific_constant @ImplicitAs.%Self.1, @ImplicitAs(constants.%T) [symbolic = %Self (constants.%Self.2)] -// CHECK:STDOUT: %Self.ref: @Convert.1.%ImplicitAs.type (%ImplicitAs.type.2) = name_ref Self, %.loc12_20.1 [symbolic = %Self (constants.%Self.2)] +// CHECK:STDOUT: %.loc12_20.1: @Convert.1.%As.type (%As.type.2) = specific_constant @As.%Self.1, @As(constants.%T) [symbolic = %Self (constants.%Self.2)] +// CHECK:STDOUT: %Self.ref: @Convert.1.%As.type (%As.type.2) = name_ref Self, %.loc12_20.1 [symbolic = %Self (constants.%Self.2)] // CHECK:STDOUT: %.loc12_20.2: type = facet_type_access %Self.ref [symbolic = %Self (constants.%Self.2)] // CHECK:STDOUT: %.loc12_20.3: type = converted %Self.ref, %.loc12_20.2 [symbolic = %Self (constants.%Self.2)] -// CHECK:STDOUT: %T.ref: type = name_ref T, @ImplicitAs.%T.loc11_22.1 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %T.ref: type = name_ref T, @As.%T.loc11_14.1 [symbolic = %T (constants.%T)] // CHECK:STDOUT: %self.param: @Convert.1.%Self (%Self.2) = value_param runtime_param0 // CHECK:STDOUT: %self: @Convert.1.%Self (%Self.2) = bind_name self, %self.param // CHECK:STDOUT: %return.param: ref @Convert.1.%T (%T) = out_param runtime_param1 // CHECK:STDOUT: %return: ref @Convert.1.%T (%T) = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc12_32.1: @ImplicitAs.%.loc12_32.2 (%.3) = assoc_entity element0, %Convert.decl [symbolic = %.loc12_32.3 (constants.%.4)] +// CHECK:STDOUT: %.loc12_32.1: @As.%.loc12_32.2 (%.3) = assoc_entity element0, %Convert.decl [symbolic = %.loc12_32.3 (constants.%.4)] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self.1 @@ -194,7 +260,46 @@ var arr: [i32; 1 + 2] = (3, 4, 3 + 4); // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl.1: %.loc15_6.2 as %Add.ref { +// CHECK:STDOUT: generic interface @ImplicitAs(%T.loc15_22.1: type) { +// CHECK:STDOUT: %T.loc15_22.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc15_22.2 (constants.%T)] +// CHECK:STDOUT: %T.patt.loc15_22.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc15_22.2 (constants.%T.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%T.loc15_22.2)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)] +// CHECK:STDOUT: %Self.2: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self.3)] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.2, @ImplicitAs(%T.loc15_22.2) [symbolic = %Convert.type (constants.%Convert.type.2)] +// CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.2) = struct_value () [symbolic = %Convert (constants.%Convert.2)] +// CHECK:STDOUT: %.loc16_32.2: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2), @ImplicitAs.%Convert.type (%Convert.type.2) [symbolic = %.loc16_32.2 (constants.%.5)] +// CHECK:STDOUT: %.loc16_32.3: @ImplicitAs.%.loc16_32.2 (%.5) = assoc_entity element0, %Convert.decl [symbolic = %.loc16_32.3 (constants.%.6)] +// CHECK:STDOUT: +// CHECK:STDOUT: interface { +// CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self.3)] +// CHECK:STDOUT: %Convert.decl: @ImplicitAs.%Convert.type (%Convert.type.2) = fn_decl @Convert.2 [symbolic = @ImplicitAs.%Convert (constants.%Convert.2)] { +// CHECK:STDOUT: %self.patt: @Convert.2.%Self (%Self.3) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.2.%Self (%Self.3) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: %return.patt: @Convert.2.%T (%T) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Convert.2.%T (%T) = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %.loc16_20.1: @Convert.2.%ImplicitAs.type (%ImplicitAs.type.2) = specific_constant @ImplicitAs.%Self.1, @ImplicitAs(constants.%T) [symbolic = %Self (constants.%Self.3)] +// CHECK:STDOUT: %Self.ref: @Convert.2.%ImplicitAs.type (%ImplicitAs.type.2) = name_ref Self, %.loc16_20.1 [symbolic = %Self (constants.%Self.3)] +// CHECK:STDOUT: %.loc16_20.2: type = facet_type_access %Self.ref [symbolic = %Self (constants.%Self.3)] +// CHECK:STDOUT: %.loc16_20.3: type = converted %Self.ref, %.loc16_20.2 [symbolic = %Self (constants.%Self.3)] +// CHECK:STDOUT: %T.ref: type = name_ref T, @ImplicitAs.%T.loc15_22.1 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %self.param: @Convert.2.%Self (%Self.3) = value_param runtime_param0 +// CHECK:STDOUT: %self: @Convert.2.%Self (%Self.3) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.2.%T (%T) = out_param runtime_param1 +// CHECK:STDOUT: %return: ref @Convert.2.%T (%T) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %.loc16_32.1: @ImplicitAs.%.loc16_32.2 (%.5) = assoc_entity element0, %Convert.decl [symbolic = %.loc16_32.3 (constants.%.6)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Convert = %.loc16_32.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.1: %.loc19_6.2 as %Add.ref { // CHECK:STDOUT: %Op.decl: %Op.type.2 = fn_decl @Op.2 [template = constants.%Op.2] { // CHECK:STDOUT: %self.patt: i32 = binding_pattern self // CHECK:STDOUT: %self.param_patt: i32 = value_param_pattern %self.patt, runtime_param0 @@ -203,9 +308,9 @@ var arr: [i32; 1 + 2] = (3, 4, 3 + 4); // CHECK:STDOUT: %return.patt: i32 = return_slot_pattern // CHECK:STDOUT: %return.param_patt: i32 = out_param_pattern %return.patt, runtime_param2 // CHECK:STDOUT: } { -// CHECK:STDOUT: %Self.ref.loc16_15: type = name_ref Self, @impl.1.%.loc15_6.2 [template = i32] -// CHECK:STDOUT: %Self.ref.loc16_28: type = name_ref Self, @impl.1.%.loc15_6.2 [template = i32] -// CHECK:STDOUT: %Self.ref.loc16_37: type = name_ref Self, @impl.1.%.loc15_6.2 [template = i32] +// CHECK:STDOUT: %Self.ref.loc20_15: type = name_ref Self, @impl.1.%.loc19_6.2 [template = i32] +// CHECK:STDOUT: %Self.ref.loc20_28: type = name_ref Self, @impl.1.%.loc19_6.2 [template = i32] +// CHECK:STDOUT: %Self.ref.loc20_37: type = name_ref Self, @impl.1.%.loc19_6.2 [template = i32] // CHECK:STDOUT: %self.param: i32 = value_param runtime_param0 // CHECK:STDOUT: %self: i32 = bind_name self, %self.param // CHECK:STDOUT: %other.param: i32 = value_param runtime_param1 @@ -213,35 +318,81 @@ var arr: [i32; 1 + 2] = (3, 4, 3 + 4); // CHECK:STDOUT: %return.param: ref i32 = out_param runtime_param2 // CHECK:STDOUT: %return: ref i32 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc15_17: = interface_witness (%Op.decl) [template = constants.%.5] +// CHECK:STDOUT: %.loc19_17: = interface_witness (%Op.decl) [template = constants.%.7] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Op = %Op.decl -// CHECK:STDOUT: witness = %.loc15_17 +// CHECK:STDOUT: witness = %.loc19_17 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl.2: %.loc19_6.2 as %ImplicitAs.type { -// CHECK:STDOUT: %Convert.decl: %Convert.type.2 = fn_decl @Convert.2 [template = constants.%Convert.2] { +// CHECK:STDOUT: impl @impl.2: %.loc23_17.2 as %As.type { +// CHECK:STDOUT: %Convert.decl: %Convert.type.3 = fn_decl @Convert.3 [template = constants.%Convert.3] { +// CHECK:STDOUT: %self.patt: Core.IntLiteral = binding_pattern self +// CHECK:STDOUT: %self.param_patt: Core.IntLiteral = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: %return.patt: i32 = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: i32 = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.2.%.loc23_17.2 [template = Core.IntLiteral] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] +// CHECK:STDOUT: %.loc24_31.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc24_31.2: type = converted %int.make_type_32, %.loc24_31.1 [template = i32] +// CHECK:STDOUT: %self.param: Core.IntLiteral = value_param runtime_param0 +// CHECK:STDOUT: %self: Core.IntLiteral = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref i32 = out_param runtime_param1 +// CHECK:STDOUT: %return: ref i32 = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %.loc23_30: = interface_witness (%Convert.decl) [template = constants.%.10] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Convert = %Convert.decl +// CHECK:STDOUT: witness = %.loc23_30 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.3: %.loc27_17.2 as %ImplicitAs.type { +// CHECK:STDOUT: %Convert.decl: %Convert.type.5 = fn_decl @Convert.4 [template = constants.%Convert.5] { +// CHECK:STDOUT: %self.patt: Core.IntLiteral = binding_pattern self +// CHECK:STDOUT: %self.param_patt: Core.IntLiteral = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: %return.patt: i32 = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: i32 = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.3.%.loc27_17.2 [template = Core.IntLiteral] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] +// CHECK:STDOUT: %.loc28_31.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc28_31.2: type = converted %int.make_type_32, %.loc28_31.1 [template = i32] +// CHECK:STDOUT: %self.param: Core.IntLiteral = value_param runtime_param0 +// CHECK:STDOUT: %self: Core.IntLiteral = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref i32 = out_param runtime_param1 +// CHECK:STDOUT: %return: ref i32 = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %.loc27_38: = interface_witness (%Convert.decl) [template = constants.%.13] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Convert = %Convert.decl +// CHECK:STDOUT: witness = %.loc27_38 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.4: %.loc31_6.2 as %ImplicitAs.type { +// CHECK:STDOUT: %Convert.decl: %Convert.type.7 = fn_decl @Convert.5 [template = constants.%Convert.7] { // CHECK:STDOUT: %self.patt: i32 = binding_pattern self // CHECK:STDOUT: %self.param_patt: i32 = value_param_pattern %self.patt, runtime_param0 // CHECK:STDOUT: %return.patt: Core.IntLiteral = return_slot_pattern // CHECK:STDOUT: %return.param_patt: Core.IntLiteral = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { -// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.2.%.loc19_6.2 [template = i32] +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.4.%.loc31_6.2 [template = i32] // CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, file.%IntLiteral.decl [template = constants.%IntLiteral] // CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] -// CHECK:STDOUT: %.loc20_42.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] -// CHECK:STDOUT: %.loc20_42.2: type = converted %int_literal.make_type, %.loc20_42.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc32_42.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc32_42.2: type = converted %int_literal.make_type, %.loc32_42.1 [template = Core.IntLiteral] // CHECK:STDOUT: %self.param: i32 = value_param runtime_param0 // CHECK:STDOUT: %self: i32 = bind_name self, %self.param // CHECK:STDOUT: %return.param: ref Core.IntLiteral = out_param runtime_param1 // CHECK:STDOUT: %return: ref Core.IntLiteral = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc19_38: = interface_witness (%Convert.decl) [template = constants.%.8] +// CHECK:STDOUT: %.loc31_38: = interface_witness (%Convert.decl) [template = constants.%.16] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Convert = %Convert.decl -// CHECK:STDOUT: witness = %.loc19_38 +// CHECK:STDOUT: witness = %.loc31_38 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; @@ -254,63 +405,134 @@ var arr: [i32; 1 + 2] = (3, 4, 3 + 4); // CHECK:STDOUT: fn[%self.param_patt: @Op.1.%Self (%Self.1)](%other.param_patt: @Op.1.%Self (%Self.1)) -> @Op.1.%Self (%Self.1); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Convert.1(@ImplicitAs.%T.loc11_22.1: type, @ImplicitAs.%Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2)) { +// CHECK:STDOUT: generic fn @Convert.1(@As.%T.loc11_14.1: type, @As.%Self.1: @As.%As.type (%As.type.2)) { // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] -// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%T)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)] -// CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%T)> [symbolic = %As.type (constants.%As.type.2)] +// CHECK:STDOUT: %Self: %As.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)] // CHECK:STDOUT: // CHECK:STDOUT: fn[%self.param_patt: @Convert.1.%Self (%Self.2)]() -> @Convert.1.%T (%T); // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.2(@ImplicitAs.%T.loc15_22.1: type, @ImplicitAs.%Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2)) { +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%T)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)] +// CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.3)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.2.%Self (%Self.3)]() -> @Convert.2.%T (%T); +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: fn @Op.2[%self.param_patt: i32](%other.param_patt: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Convert.2[%self.param_patt: i32]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: fn @Convert.3[%self.param_patt: Core.IntLiteral]() -> i32 = "int.convert_checked"; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Convert.4[%self.param_patt: Core.IntLiteral]() -> i32 = "int.convert_checked"; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Convert.5[%self.param_patt: i32]() -> Core.IntLiteral = "int.convert_checked"; // CHECK:STDOUT: // CHECK:STDOUT: specific @Op.1(constants.%Self.1) { // CHECK:STDOUT: %Self => constants.%Self.1 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(constants.%T) { -// CHECK:STDOUT: %T.loc11_22.2 => constants.%T -// CHECK:STDOUT: %T.patt.loc11_22.2 => constants.%T +// CHECK:STDOUT: specific @As(constants.%T) { +// CHECK:STDOUT: %T.loc11_14.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc11_14.2 => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(@Convert.1.%T) { -// CHECK:STDOUT: %T.loc11_22.2 => constants.%T -// CHECK:STDOUT: %T.patt.loc11_22.2 => constants.%T +// CHECK:STDOUT: specific @As(@Convert.1.%T) { +// CHECK:STDOUT: %T.loc11_14.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc11_14.2 => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Convert.1(constants.%T, constants.%Self.2) { // CHECK:STDOUT: %T => constants.%T -// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.2 +// CHECK:STDOUT: %As.type => constants.%As.type.2 // CHECK:STDOUT: %Self => constants.%Self.2 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(%T.loc11_22.2) { -// CHECK:STDOUT: %T.loc11_22.2 => constants.%T -// CHECK:STDOUT: %T.patt.loc11_22.2 => constants.%T +// CHECK:STDOUT: specific @As(%T.loc11_14.2) { +// CHECK:STDOUT: %T.loc11_14.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc11_14.2 => constants.%T +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%T) { +// CHECK:STDOUT: %T.loc15_22.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc15_22.2 => constants.%T +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@Convert.2.%T) { +// CHECK:STDOUT: %T.loc15_22.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc15_22.2 => constants.%T +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.2(constants.%T, constants.%Self.3) { +// CHECK:STDOUT: %T => constants.%T +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.2 +// CHECK:STDOUT: %Self => constants.%Self.3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(%T.loc15_22.2) { +// CHECK:STDOUT: %T.loc15_22.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc15_22.2 => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Op.1(i32) { // CHECK:STDOUT: %Self => i32 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(Core.IntLiteral) { -// CHECK:STDOUT: %T.loc11_22.2 => Core.IntLiteral -// CHECK:STDOUT: %T.patt.loc11_22.2 => Core.IntLiteral +// CHECK:STDOUT: specific @As(i32) { +// CHECK:STDOUT: %T.loc11_14.2 => i32 +// CHECK:STDOUT: %T.patt.loc11_14.2 => i32 // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3 +// CHECK:STDOUT: %As.type => constants.%As.type.3 // CHECK:STDOUT: %Self.2 => constants.%Self.2 -// CHECK:STDOUT: %Convert.type => constants.%Convert.type.3 -// CHECK:STDOUT: %Convert => constants.%Convert.3 -// CHECK:STDOUT: %.loc12_32.2 => constants.%.6 -// CHECK:STDOUT: %.loc12_32.3 => constants.%.7 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.4 +// CHECK:STDOUT: %Convert => constants.%Convert.4 +// CHECK:STDOUT: %.loc12_32.2 => constants.%.8 +// CHECK:STDOUT: %.loc12_32.3 => constants.%.9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Convert.1(Core.IntLiteral, i32) { -// CHECK:STDOUT: %T => Core.IntLiteral +// CHECK:STDOUT: specific @Convert.1(i32, Core.IntLiteral) { +// CHECK:STDOUT: %T => i32 +// CHECK:STDOUT: %As.type => constants.%As.type.3 +// CHECK:STDOUT: %Self => Core.IntLiteral +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(i32) { +// CHECK:STDOUT: %T.loc15_22.2 => i32 +// CHECK:STDOUT: %T.patt.loc15_22.2 => i32 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3 +// CHECK:STDOUT: %Self.2 => constants.%Self.3 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.6 +// CHECK:STDOUT: %Convert => constants.%Convert.6 +// CHECK:STDOUT: %.loc16_32.2 => constants.%.11 +// CHECK:STDOUT: %.loc16_32.3 => constants.%.12 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.2(i32, Core.IntLiteral) { +// CHECK:STDOUT: %T => i32 // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3 +// CHECK:STDOUT: %Self => Core.IntLiteral +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(Core.IntLiteral) { +// CHECK:STDOUT: %T.loc15_22.2 => Core.IntLiteral +// CHECK:STDOUT: %T.patt.loc15_22.2 => Core.IntLiteral +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.4 +// CHECK:STDOUT: %Self.2 => constants.%Self.3 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.8 +// CHECK:STDOUT: %Convert => constants.%Convert.8 +// CHECK:STDOUT: %.loc16_32.2 => constants.%.14 +// CHECK:STDOUT: %.loc16_32.3 => constants.%.15 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.2(Core.IntLiteral, i32) { +// CHECK:STDOUT: %T => Core.IntLiteral +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.4 // CHECK:STDOUT: %Self => i32 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -319,67 +541,111 @@ var arr: [i32; 1 + 2] = (3, 4, 3 + 4); // CHECK:STDOUT: constants { // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %.2: i32 = int_value 2 [template] -// CHECK:STDOUT: %Add.type: type = facet_type <@Add> [template] -// CHECK:STDOUT: %Self.1: %Add.type = bind_symbolic_name Self, 0 [symbolic] -// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] -// CHECK:STDOUT: %.3: type = assoc_entity_type %Add.type, %Op.type.1 [template] -// CHECK:STDOUT: %.4: %.3 = assoc_entity element0, imports.%import_ref.6 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1 [template] // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] -// CHECK:STDOUT: %ImplicitAs.type.2: type = facet_type <@ImplicitAs, @ImplicitAs(%T)> [symbolic] -// CHECK:STDOUT: %Self.2: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2) = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %As.type.2: type = facet_type <@As, @As(%T)> [symbolic] +// CHECK:STDOUT: %Self.1: @As.%As.type (%As.type.2) = bind_symbolic_name Self, 1 [symbolic] // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic] -// CHECK:STDOUT: %ImplicitAs.type.3: type = facet_type <@ImplicitAs, @ImplicitAs(Core.IntLiteral)> [template] -// CHECK:STDOUT: %Self.3: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic] -// CHECK:STDOUT: %Convert.type.1: type = fn_type @Convert.1, @ImplicitAs(%T) [symbolic] +// CHECK:STDOUT: %Self.2: %As.type.2 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Convert.type.1: type = fn_type @Convert.1, @As(%T) [symbolic] // CHECK:STDOUT: %Convert.1: %Convert.type.1 = struct_value () [symbolic] -// CHECK:STDOUT: %.5: type = assoc_entity_type %ImplicitAs.type.2, %Convert.type.1 [symbolic] -// CHECK:STDOUT: %.6: %.5 = assoc_entity element0, imports.%import_ref.16 [symbolic] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.2: type = assoc_entity_type %As.type.2, %Convert.type.1 [symbolic] +// CHECK:STDOUT: %.3: %.2 = assoc_entity element0, imports.%import_ref.6 [symbolic] +// CHECK:STDOUT: %As.type.3: type = facet_type <@As, @As(i32)> [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @As(i32) [template] // CHECK:STDOUT: %Convert.2: %Convert.type.2 = struct_value () [template] -// CHECK:STDOUT: %.7: type = assoc_entity_type %ImplicitAs.type.3, %Convert.type.2 [template] -// CHECK:STDOUT: %.8: %.7 = assoc_entity element0, imports.%import_ref.17 [template] +// CHECK:STDOUT: %.4: type = assoc_entity_type %As.type.3, %Convert.type.2 [template] +// CHECK:STDOUT: %.5: %.4 = assoc_entity element0, imports.%import_ref.6 [template] +// CHECK:STDOUT: %.6: %.2 = assoc_entity element0, imports.%import_ref.7 [symbolic] +// CHECK:STDOUT: %Add.type: type = facet_type <@Add> [template] +// CHECK:STDOUT: %Self.3: %Add.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.2: type = facet_type <@ImplicitAs, @ImplicitAs(%T)> [symbolic] +// CHECK:STDOUT: %Self.4: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2) = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.3: type = facet_type <@ImplicitAs, @ImplicitAs(i32)> [template] +// CHECK:STDOUT: %Self.5: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Convert.type.3: type = fn_type @Convert.2, @ImplicitAs(%T) [symbolic] +// CHECK:STDOUT: %Convert.3: %Convert.type.3 = struct_value () [symbolic] +// CHECK:STDOUT: %.7: type = assoc_entity_type %ImplicitAs.type.2, %Convert.type.3 [symbolic] +// CHECK:STDOUT: %.8: %.7 = assoc_entity element0, imports.%import_ref.23 [symbolic] +// CHECK:STDOUT: %Convert.type.4: type = fn_type @Convert.2, @ImplicitAs(i32) [template] +// CHECK:STDOUT: %Convert.4: %Convert.type.4 = struct_value () [template] +// CHECK:STDOUT: %.9: type = assoc_entity_type %ImplicitAs.type.3, %Convert.type.4 [template] +// CHECK:STDOUT: %.10: %.9 = assoc_entity element0, imports.%import_ref.24 [template] +// CHECK:STDOUT: %ImplicitAs.type.4: type = facet_type <@ImplicitAs, @ImplicitAs(Core.IntLiteral)> [template] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.2, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %Convert.5: %Convert.type.5 = struct_value () [template] +// CHECK:STDOUT: %.11: type = assoc_entity_type %ImplicitAs.type.4, %Convert.type.5 [template] +// CHECK:STDOUT: %.12: %.11 = assoc_entity element0, imports.%import_ref.28 [template] +// CHECK:STDOUT: %Convert.type.6: type = fn_type @Convert.3 [template] +// CHECK:STDOUT: %Convert.6: %Convert.type.6 = struct_value () [template] +// CHECK:STDOUT: %.13: = interface_witness (%Convert.6) [template] +// CHECK:STDOUT: %.14: = bound_method %.1, %Convert.6 [template] +// CHECK:STDOUT: %.15: i32 = int_value 1 [template] +// CHECK:STDOUT: %.16: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.17: = bound_method %.16, %Convert.6 [template] +// CHECK:STDOUT: %.18: i32 = int_value 2 [template] +// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %.19: type = assoc_entity_type %Add.type, %Op.type.1 [template] +// CHECK:STDOUT: %.20: %.19 = assoc_entity element0, imports.%import_ref.30 [template] // CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] // CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template] -// CHECK:STDOUT: %.9: = interface_witness (%Op.2) [template] -// CHECK:STDOUT: %.10: = bound_method %.1, %Op.2 [template] -// CHECK:STDOUT: %.11: i32 = int_value 3 [template] -// CHECK:STDOUT: %.12: %.5 = assoc_entity element0, imports.%import_ref.19 [symbolic] -// CHECK:STDOUT: %Convert.type.3: type = fn_type @Convert.2 [template] -// CHECK:STDOUT: %Convert.3: %Convert.type.3 = struct_value () [template] -// CHECK:STDOUT: %.13: = interface_witness (%Convert.3) [template] -// CHECK:STDOUT: %.14: = bound_method %.11, %Convert.3 [template] -// CHECK:STDOUT: %.15: Core.IntLiteral = int_value 3 [template] -// CHECK:STDOUT: %.16: type = array_type %.15, i32 [template] -// CHECK:STDOUT: %.18: i32 = int_value 4 [template] -// CHECK:STDOUT: %.19: = bound_method %.11, %Op.2 [template] -// CHECK:STDOUT: %.20: i32 = int_value 7 [template] -// CHECK:STDOUT: %tuple.type: type = tuple_type (i32, i32, i32) [template] -// CHECK:STDOUT: %.21: i32 = int_value 0 [template] -// CHECK:STDOUT: %array: %.16 = tuple_value (%.11, %.18, %.20) [template] +// CHECK:STDOUT: %.21: = interface_witness (%Op.2) [template] +// CHECK:STDOUT: %.22: = bound_method %.15, %Op.2 [template] +// CHECK:STDOUT: %.23: i32 = int_value 3 [template] +// CHECK:STDOUT: %.24: %.7 = assoc_entity element0, imports.%import_ref.32 [symbolic] +// CHECK:STDOUT: %Convert.type.7: type = fn_type @Convert.4 [template] +// CHECK:STDOUT: %Convert.7: %Convert.type.7 = struct_value () [template] +// CHECK:STDOUT: %.25: = interface_witness (%Convert.7) [template] +// CHECK:STDOUT: %.26: = bound_method %.23, %Convert.7 [template] +// CHECK:STDOUT: %.27: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.28: type = array_type %.27, i32 [template] +// CHECK:STDOUT: %.30: Core.IntLiteral = int_value 4 [template] +// CHECK:STDOUT: %.31: = bound_method %.27, %Convert.6 [template] +// CHECK:STDOUT: %.32: = bound_method %.30, %Convert.6 [template] +// CHECK:STDOUT: %.33: i32 = int_value 4 [template] +// CHECK:STDOUT: %.34: = bound_method %.23, %Op.2 [template] +// CHECK:STDOUT: %.35: i32 = int_value 7 [template] +// CHECK:STDOUT: %tuple.type: type = tuple_type (Core.IntLiteral, Core.IntLiteral, i32) [template] +// CHECK:STDOUT: %.36: i32 = int_value 0 [template] +// CHECK:STDOUT: %Convert.type.8: type = fn_type @Convert.5 [template] +// CHECK:STDOUT: %Convert.8: %Convert.type.8 = struct_value () [template] +// CHECK:STDOUT: %.37: = interface_witness (%Convert.8) [template] +// CHECK:STDOUT: %.38: = bound_method %.27, %Convert.8 [template] +// CHECK:STDOUT: %.39: = bound_method %.30, %Convert.8 [template] +// CHECK:STDOUT: %array: %.28 = tuple_value (%.23, %.33, %.35) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int32 = %import_ref.1 -// CHECK:STDOUT: .Add = %import_ref.2 -// CHECK:STDOUT: .ImplicitAs = %import_ref.18 +// CHECK:STDOUT: .As = %import_ref.2 +// CHECK:STDOUT: .Add = %import_ref.29 +// CHECK:STDOUT: .ImplicitAs = %import_ref.31 // CHECK:STDOUT: import Core//default // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.3 = import_ref Core//default, inst+18, unloaded -// CHECK:STDOUT: %import_ref.4: %.3 = import_ref Core//default, inst+46, loaded [template = constants.%.4] -// CHECK:STDOUT: %import_ref.5 = import_ref Core//default, inst+41, unloaded -// CHECK:STDOUT: %import_ref.7: type = import_ref Core//default, inst+92, loaded [template = i32] -// CHECK:STDOUT: %import_ref.8: type = import_ref Core//default, inst+93, loaded [template = constants.%Add.type] -// CHECK:STDOUT: %import_ref.9: = import_ref Core//default, inst+113, loaded [template = constants.%.9] -// CHECK:STDOUT: %import_ref.10 = import_ref Core//default, inst+60, unloaded -// CHECK:STDOUT: %import_ref.11: @ImplicitAs.%.1 (%.5) = import_ref Core//default, inst+82, loaded [symbolic = @ImplicitAs.%.2 (constants.%.12)] -// CHECK:STDOUT: %import_ref.12 = import_ref Core//default, inst+75, unloaded -// CHECK:STDOUT: %import_ref.13: type = import_ref Core//default, inst+117, loaded [template = i32] -// CHECK:STDOUT: %import_ref.14: type = import_ref Core//default, inst+123, loaded [template = constants.%ImplicitAs.type.3] -// CHECK:STDOUT: %import_ref.15: = import_ref Core//default, inst+146, loaded [template = constants.%.13] -// CHECK:STDOUT: %import_ref.16 = import_ref Core//default, inst+75, unloaded +// CHECK:STDOUT: %import_ref.3 = import_ref Core//default, inst+60, unloaded +// CHECK:STDOUT: %import_ref.4: @As.%.1 (%.2) = import_ref Core//default, inst+82, loaded [symbolic = @As.%.2 (constants.%.6)] +// CHECK:STDOUT: %import_ref.5 = import_ref Core//default, inst+75, unloaded +// CHECK:STDOUT: %import_ref.6 = import_ref Core//default, inst+75, unloaded +// CHECK:STDOUT: %import_ref.8 = import_ref Core//default, inst+18, unloaded +// CHECK:STDOUT: %import_ref.9: %.19 = import_ref Core//default, inst+46, loaded [template = constants.%.20] +// CHECK:STDOUT: %import_ref.10 = import_ref Core//default, inst+41, unloaded +// CHECK:STDOUT: %import_ref.11: type = import_ref Core//default, inst+132, loaded [template = i32] +// CHECK:STDOUT: %import_ref.12: type = import_ref Core//default, inst+133, loaded [template = constants.%Add.type] +// CHECK:STDOUT: %import_ref.13: = import_ref Core//default, inst+153, loaded [template = constants.%.21] +// CHECK:STDOUT: %import_ref.14: type = import_ref Core//default, inst+158, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.15: type = import_ref Core//default, inst+163, loaded [template = constants.%As.type.3] +// CHECK:STDOUT: %import_ref.16: = import_ref Core//default, inst+185, loaded [template = constants.%.13] +// CHECK:STDOUT: %import_ref.17 = import_ref Core//default, inst+100, unloaded +// CHECK:STDOUT: %import_ref.18: @ImplicitAs.%.1 (%.7) = import_ref Core//default, inst+122, loaded [symbolic = @ImplicitAs.%.2 (constants.%.24)] +// CHECK:STDOUT: %import_ref.19 = import_ref Core//default, inst+115, unloaded +// CHECK:STDOUT: %import_ref.20: type = import_ref Core//default, inst+190, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.21: type = import_ref Core//default, inst+195, loaded [template = constants.%ImplicitAs.type.3] +// CHECK:STDOUT: %import_ref.22: = import_ref Core//default, inst+217, loaded [template = constants.%.37] +// CHECK:STDOUT: %import_ref.23 = import_ref Core//default, inst+115, unloaded +// CHECK:STDOUT: %import_ref.25: type = import_ref Core//default, inst+221, loaded [template = i32] +// CHECK:STDOUT: %import_ref.26: type = import_ref Core//default, inst+227, loaded [template = constants.%ImplicitAs.type.4] +// CHECK:STDOUT: %import_ref.27: = import_ref Core//default, inst+250, loaded [template = constants.%.25] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -388,31 +654,67 @@ var arr: [i32; 1 + 2] = (3, 4, 3 + 4); // CHECK:STDOUT: .arr = %arr // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc4_16: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_20: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc4_18.1: %Op.type.1 = interface_witness_access constants.%.9, element0 [template = constants.%Op.2] -// CHECK:STDOUT: %.loc4_18.2: = bound_method %.loc4_16, %.loc4_18.1 [template = constants.%.10] -// CHECK:STDOUT: %int.sadd: init i32 = call %.loc4_18.2(%.loc4_16, %.loc4_20) [template = constants.%.11] -// CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32, %.loc4_11.1 [template = i32] -// CHECK:STDOUT: %.loc4_18.3: %Convert.type.2 = interface_witness_access constants.%.13, element0 [template = constants.%Convert.3] -// CHECK:STDOUT: %.loc4_18.4: = bound_method %int.sadd, %.loc4_18.3 [template = constants.%.14] -// CHECK:STDOUT: %.loc4_18.5: i32 = value_of_initializer %int.sadd [template = constants.%.11] -// CHECK:STDOUT: %.loc4_18.6: i32 = converted %int.sadd, %.loc4_18.5 [template = constants.%.11] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc4_18.4(%.loc4_18.6) [template = constants.%.15] -// CHECK:STDOUT: %.loc4_18.7: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.15] -// CHECK:STDOUT: %.loc4_18.8: Core.IntLiteral = converted %int.sadd, %.loc4_18.7 [template = constants.%.15] -// CHECK:STDOUT: %.loc4_21: type = array_type %.loc4_18.8, i32 [template = constants.%.16] -// CHECK:STDOUT: %arr.var: ref %.16 = var arr -// CHECK:STDOUT: %arr: ref %.16 = bind_name arr, %arr.var +// CHECK:STDOUT: %int.make_type_32.loc4_11: init type = call constants.%Int32() [template = i32] +// CHECK:STDOUT: %.loc4_17: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %int.make_type_32.loc4_22: init type = call constants.%Int32() [template = i32] +// CHECK:STDOUT: %.loc4_22.1: type = value_of_initializer %int.make_type_32.loc4_22 [template = i32] +// CHECK:STDOUT: %.loc4_22.2: type = converted %int.make_type_32.loc4_22, %.loc4_22.1 [template = i32] +// CHECK:STDOUT: %.loc4_19.1: %Convert.type.2 = interface_witness_access constants.%.13, element0 [template = constants.%Convert.6] +// CHECK:STDOUT: %.loc4_19.2: = bound_method %.loc4_17, %.loc4_19.1 [template = constants.%.14] +// CHECK:STDOUT: %int.convert_checked.loc4_19: init i32 = call %.loc4_19.2(%.loc4_17) [template = constants.%.15] +// CHECK:STDOUT: %.loc4_19.3: i32 = value_of_initializer %int.convert_checked.loc4_19 [template = constants.%.15] +// CHECK:STDOUT: %.loc4_19.4: i32 = converted %.loc4_17, %.loc4_19.3 [template = constants.%.15] +// CHECK:STDOUT: %.loc4_30: Core.IntLiteral = int_value 2 [template = constants.%.16] +// CHECK:STDOUT: %int.make_type_32.loc4_35: init type = call constants.%Int32() [template = i32] +// CHECK:STDOUT: %.loc4_35.1: type = value_of_initializer %int.make_type_32.loc4_35 [template = i32] +// CHECK:STDOUT: %.loc4_35.2: type = converted %int.make_type_32.loc4_35, %.loc4_35.1 [template = i32] +// CHECK:STDOUT: %.loc4_32.1: %Convert.type.2 = interface_witness_access constants.%.13, element0 [template = constants.%Convert.6] +// CHECK:STDOUT: %.loc4_32.2: = bound_method %.loc4_30, %.loc4_32.1 [template = constants.%.17] +// CHECK:STDOUT: %int.convert_checked.loc4_32: init i32 = call %.loc4_32.2(%.loc4_30) [template = constants.%.18] +// CHECK:STDOUT: %.loc4_32.3: i32 = value_of_initializer %int.convert_checked.loc4_32 [template = constants.%.18] +// CHECK:STDOUT: %.loc4_32.4: i32 = converted %.loc4_30, %.loc4_32.3 [template = constants.%.18] +// CHECK:STDOUT: %.loc4_27.1: %Op.type.1 = interface_witness_access constants.%.21, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %.loc4_27.2: = bound_method %.loc4_19.4, %.loc4_27.1 [template = constants.%.22] +// CHECK:STDOUT: %int.sadd: init i32 = call %.loc4_27.2(%.loc4_19.4, %.loc4_32.4) [template = constants.%.23] +// CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32.loc4_11 [template = i32] +// CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32.loc4_11, %.loc4_11.1 [template = i32] +// CHECK:STDOUT: %.loc4_27.3: %Convert.type.5 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.7] +// CHECK:STDOUT: %.loc4_27.4: = bound_method %int.sadd, %.loc4_27.3 [template = constants.%.26] +// CHECK:STDOUT: %.loc4_27.5: i32 = value_of_initializer %int.sadd [template = constants.%.23] +// CHECK:STDOUT: %.loc4_27.6: i32 = converted %int.sadd, %.loc4_27.5 [template = constants.%.23] +// CHECK:STDOUT: %int.convert_checked.loc4_27: init Core.IntLiteral = call %.loc4_27.4(%.loc4_27.6) [template = constants.%.27] +// CHECK:STDOUT: %.loc4_27.7: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4_27 [template = constants.%.27] +// CHECK:STDOUT: %.loc4_27.8: Core.IntLiteral = converted %int.sadd, %.loc4_27.7 [template = constants.%.27] +// CHECK:STDOUT: %.loc4_39: type = array_type %.loc4_27.8, i32 [template = constants.%.28] +// CHECK:STDOUT: %arr.var: ref %.28 = var arr +// CHECK:STDOUT: %arr: ref %.28 = bind_name arr, %arr.var +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @As(constants.%T: type) { +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%T)> [symbolic = %As.type (constants.%As.type.2)] +// CHECK:STDOUT: %Self: %As.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.1, @As(%T) [symbolic = %Convert.type (constants.%Convert.type.1)] +// CHECK:STDOUT: %Convert: @As.%Convert.type (%Convert.type.1) = struct_value () [symbolic = %Convert (constants.%Convert.1)] +// CHECK:STDOUT: %.1: type = assoc_entity_type @As.%As.type (%As.type.2), @As.%Convert.type (%Convert.type.1) [symbolic = %.1 (constants.%.2)] +// CHECK:STDOUT: %.2: @As.%.1 (%.2) = assoc_entity element0, imports.%import_ref.6 [symbolic = %.2 (constants.%.3)] +// CHECK:STDOUT: +// CHECK:STDOUT: interface { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%import_ref.3 +// CHECK:STDOUT: .Convert = imports.%import_ref.4 +// CHECK:STDOUT: witness = (imports.%import_ref.5) +// CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Add { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = imports.%import_ref.3 -// CHECK:STDOUT: .Op = imports.%import_ref.4 -// CHECK:STDOUT: witness = (imports.%import_ref.5) +// CHECK:STDOUT: .Self = imports.%import_ref.8 +// CHECK:STDOUT: .Op = imports.%import_ref.9 +// CHECK:STDOUT: witness = (imports.%import_ref.10) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic interface @ImplicitAs(constants.%T: type) { @@ -421,95 +723,171 @@ var arr: [i32; 1 + 2] = (3, 4, 3 + 4); // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%T)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)] -// CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.3)] -// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.1, @ImplicitAs(%T) [symbolic = %Convert.type (constants.%Convert.type.1)] -// CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.1) = struct_value () [symbolic = %Convert (constants.%Convert.1)] -// CHECK:STDOUT: %.1: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2), @ImplicitAs.%Convert.type (%Convert.type.1) [symbolic = %.1 (constants.%.5)] -// CHECK:STDOUT: %.2: @ImplicitAs.%.1 (%.5) = assoc_entity element0, imports.%import_ref.16 [symbolic = %.2 (constants.%.6)] +// CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.5)] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.2, @ImplicitAs(%T) [symbolic = %Convert.type (constants.%Convert.type.3)] +// CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.3) = struct_value () [symbolic = %Convert (constants.%Convert.3)] +// CHECK:STDOUT: %.1: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2), @ImplicitAs.%Convert.type (%Convert.type.3) [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: %.2: @ImplicitAs.%.1 (%.7) = assoc_entity element0, imports.%import_ref.23 [symbolic = %.2 (constants.%.8)] // CHECK:STDOUT: // CHECK:STDOUT: interface { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = imports.%import_ref.10 -// CHECK:STDOUT: .Convert = imports.%import_ref.11 -// CHECK:STDOUT: witness = (imports.%import_ref.12) +// CHECK:STDOUT: .Self = imports.%import_ref.17 +// CHECK:STDOUT: .Convert = imports.%import_ref.18 +// CHECK:STDOUT: witness = (imports.%import_ref.19) // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl.1: imports.%import_ref.7 as imports.%import_ref.8 { +// CHECK:STDOUT: impl @impl.1: imports.%import_ref.11 as imports.%import_ref.12 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.13 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.2: imports.%import_ref.14 as imports.%import_ref.15 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.16 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.3: imports.%import_ref.20 as imports.%import_ref.21 { // CHECK:STDOUT: !members: -// CHECK:STDOUT: witness = imports.%import_ref.9 +// CHECK:STDOUT: witness = imports.%import_ref.22 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl.2: imports.%import_ref.13 as imports.%import_ref.14 { +// CHECK:STDOUT: impl @impl.4: imports.%import_ref.25 as imports.%import_ref.26 { // CHECK:STDOUT: !members: -// CHECK:STDOUT: witness = imports.%import_ref.15 +// CHECK:STDOUT: witness = imports.%import_ref.27 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Op.1(constants.%Self.1: %Add.type) { -// CHECK:STDOUT: %Self: %Add.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.1)] +// CHECK:STDOUT: generic fn @Convert.1(constants.%T: type, constants.%Self.1: @As.%As.type (%As.type.2)) { +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%T)> [symbolic = %As.type (constants.%As.type.2)] +// CHECK:STDOUT: %Self: %As.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)] // CHECK:STDOUT: -// CHECK:STDOUT: fn[%self.param_patt: @Op.1.%Self (%Self.1)](%other.param_patt: @Op.1.%Self (%Self.1)) -> @Op.1.%Self (%Self.1); +// CHECK:STDOUT: fn[%self.param_patt: @Convert.1.%Self (%Self.2)]() -> @Convert.1.%T (%T); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Convert.1(constants.%T: type, constants.%Self.2: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2)) { +// CHECK:STDOUT: generic fn @Convert.2(constants.%T: type, constants.%Self.4: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2)) { // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] // CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%T)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)] -// CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.3)] +// CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.5)] // CHECK:STDOUT: -// CHECK:STDOUT: fn[%self.param_patt: @Convert.1.%Self (%Self.3)]() -> @Convert.1.%T (%T); +// CHECK:STDOUT: fn[%self.param_patt: @Convert.2.%Self (%Self.5)]() -> @Convert.2.%T (%T); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Convert.3[%self.param_patt: Core.IntLiteral]() -> i32 = "int.convert_checked"; +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Op.1(constants.%Self.3: %Add.type) { +// CHECK:STDOUT: %Self: %Add.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.3)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Op.1.%Self (%Self.3)](%other.param_patt: @Op.1.%Self (%Self.3)) -> @Op.1.%Self (%Self.3); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Op.2[%self.param_patt: i32](%other.param_patt: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Convert.2[%self.param_patt: i32]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: fn @Convert.4[%self.param_patt: i32]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Convert.5[%self.param_patt: Core.IntLiteral]() -> i32 = "int.convert_checked"; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc4_26: i32 = int_value 3 [template = constants.%.11] -// CHECK:STDOUT: %.loc4_29: i32 = int_value 4 [template = constants.%.18] -// CHECK:STDOUT: %.loc4_32: i32 = int_value 3 [template = constants.%.11] -// CHECK:STDOUT: %.loc4_36: i32 = int_value 4 [template = constants.%.18] -// CHECK:STDOUT: %.loc4_34.1: %Op.type.1 = interface_witness_access constants.%.9, element0 [template = constants.%Op.2] -// CHECK:STDOUT: %.loc4_34.2: = bound_method %.loc4_32, %.loc4_34.1 [template = constants.%.19] -// CHECK:STDOUT: %int.sadd: init i32 = call %.loc4_34.2(%.loc4_32, %.loc4_36) [template = constants.%.20] -// CHECK:STDOUT: %.loc4_37.1: %tuple.type = tuple_literal (%.loc4_26, %.loc4_29, %int.sadd) -// CHECK:STDOUT: %.loc4_37.2: i32 = int_value 0 [template = constants.%.21] -// CHECK:STDOUT: %.loc4_37.3: ref i32 = array_index file.%arr.var, %.loc4_37.2 -// CHECK:STDOUT: %.loc4_37.4: init i32 = initialize_from %.loc4_26 to %.loc4_37.3 [template = constants.%.11] -// CHECK:STDOUT: %.loc4_37.5: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_37.6: ref i32 = array_index file.%arr.var, %.loc4_37.5 -// CHECK:STDOUT: %.loc4_37.7: init i32 = initialize_from %.loc4_29 to %.loc4_37.6 [template = constants.%.18] -// CHECK:STDOUT: %.loc4_37.8: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc4_37.9: ref i32 = array_index file.%arr.var, %.loc4_37.8 -// CHECK:STDOUT: %.loc4_37.10: init i32 = initialize_from %int.sadd to %.loc4_37.9 [template = constants.%.20] -// CHECK:STDOUT: %.loc4_37.11: init %.16 = array_init (%.loc4_37.4, %.loc4_37.7, %.loc4_37.10) to file.%arr.var [template = constants.%array] -// CHECK:STDOUT: %.loc4_38: init %.16 = converted %.loc4_37.1, %.loc4_37.11 [template = constants.%array] -// CHECK:STDOUT: assign file.%arr.var, %.loc4_38 +// CHECK:STDOUT: %.loc4_44: Core.IntLiteral = int_value 3 [template = constants.%.27] +// CHECK:STDOUT: %.loc4_47: Core.IntLiteral = int_value 4 [template = constants.%.30] +// CHECK:STDOUT: %.loc4_51: Core.IntLiteral = int_value 3 [template = constants.%.27] +// CHECK:STDOUT: %int.make_type_32.loc4_56: init type = call constants.%Int32() [template = i32] +// CHECK:STDOUT: %.loc4_56.1: type = value_of_initializer %int.make_type_32.loc4_56 [template = i32] +// CHECK:STDOUT: %.loc4_56.2: type = converted %int.make_type_32.loc4_56, %.loc4_56.1 [template = i32] +// CHECK:STDOUT: %.loc4_53.1: %Convert.type.2 = interface_witness_access constants.%.13, element0 [template = constants.%Convert.6] +// CHECK:STDOUT: %.loc4_53.2: = bound_method %.loc4_51, %.loc4_53.1 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc4_53: init i32 = call %.loc4_53.2(%.loc4_51) [template = constants.%.23] +// CHECK:STDOUT: %.loc4_53.3: i32 = value_of_initializer %int.convert_checked.loc4_53 [template = constants.%.23] +// CHECK:STDOUT: %.loc4_53.4: i32 = converted %.loc4_51, %.loc4_53.3 [template = constants.%.23] +// CHECK:STDOUT: %.loc4_64: Core.IntLiteral = int_value 4 [template = constants.%.30] +// CHECK:STDOUT: %int.make_type_32.loc4_69: init type = call constants.%Int32() [template = i32] +// CHECK:STDOUT: %.loc4_69.1: type = value_of_initializer %int.make_type_32.loc4_69 [template = i32] +// CHECK:STDOUT: %.loc4_69.2: type = converted %int.make_type_32.loc4_69, %.loc4_69.1 [template = i32] +// CHECK:STDOUT: %.loc4_66.1: %Convert.type.2 = interface_witness_access constants.%.13, element0 [template = constants.%Convert.6] +// CHECK:STDOUT: %.loc4_66.2: = bound_method %.loc4_64, %.loc4_66.1 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc4_66: init i32 = call %.loc4_66.2(%.loc4_64) [template = constants.%.33] +// CHECK:STDOUT: %.loc4_66.3: i32 = value_of_initializer %int.convert_checked.loc4_66 [template = constants.%.33] +// CHECK:STDOUT: %.loc4_66.4: i32 = converted %.loc4_64, %.loc4_66.3 [template = constants.%.33] +// CHECK:STDOUT: %.loc4_61.1: %Op.type.1 = interface_witness_access constants.%.21, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %.loc4_61.2: = bound_method %.loc4_53.4, %.loc4_61.1 [template = constants.%.34] +// CHECK:STDOUT: %int.sadd: init i32 = call %.loc4_61.2(%.loc4_53.4, %.loc4_66.4) [template = constants.%.35] +// CHECK:STDOUT: %.loc4_73.1: %tuple.type = tuple_literal (%.loc4_44, %.loc4_47, %int.sadd) +// CHECK:STDOUT: %.loc4_73.2: %Convert.type.4 = interface_witness_access constants.%.37, element0 [template = constants.%Convert.8] +// CHECK:STDOUT: %.loc4_73.3: = bound_method %.loc4_44, %.loc4_73.2 [template = constants.%.38] +// CHECK:STDOUT: %int.convert_checked.loc4_73.1: init i32 = call %.loc4_73.3(%.loc4_44) [template = constants.%.23] +// CHECK:STDOUT: %.loc4_73.4: init i32 = converted %.loc4_44, %int.convert_checked.loc4_73.1 [template = constants.%.23] +// CHECK:STDOUT: %.loc4_73.5: i32 = int_value 0 [template = constants.%.36] +// CHECK:STDOUT: %.loc4_73.6: ref i32 = array_index file.%arr.var, %.loc4_73.5 +// CHECK:STDOUT: %.loc4_73.7: init i32 = initialize_from %.loc4_73.4 to %.loc4_73.6 [template = constants.%.23] +// CHECK:STDOUT: %.loc4_73.8: %Convert.type.4 = interface_witness_access constants.%.37, element0 [template = constants.%Convert.8] +// CHECK:STDOUT: %.loc4_73.9: = bound_method %.loc4_47, %.loc4_73.8 [template = constants.%.39] +// CHECK:STDOUT: %int.convert_checked.loc4_73.2: init i32 = call %.loc4_73.9(%.loc4_47) [template = constants.%.33] +// CHECK:STDOUT: %.loc4_73.10: init i32 = converted %.loc4_47, %int.convert_checked.loc4_73.2 [template = constants.%.33] +// CHECK:STDOUT: %.loc4_73.11: i32 = int_value 1 [template = constants.%.15] +// CHECK:STDOUT: %.loc4_73.12: ref i32 = array_index file.%arr.var, %.loc4_73.11 +// CHECK:STDOUT: %.loc4_73.13: init i32 = initialize_from %.loc4_73.10 to %.loc4_73.12 [template = constants.%.33] +// CHECK:STDOUT: %.loc4_73.14: i32 = int_value 2 [template = constants.%.18] +// CHECK:STDOUT: %.loc4_73.15: ref i32 = array_index file.%arr.var, %.loc4_73.14 +// CHECK:STDOUT: %.loc4_73.16: init i32 = initialize_from %int.sadd to %.loc4_73.15 [template = constants.%.35] +// CHECK:STDOUT: %.loc4_73.17: init %.28 = array_init (%.loc4_73.7, %.loc4_73.13, %.loc4_73.16) to file.%arr.var [template = constants.%array] +// CHECK:STDOUT: %.loc4_74: init %.28 = converted %.loc4_73.1, %.loc4_73.17 [template = constants.%array] +// CHECK:STDOUT: assign file.%arr.var, %.loc4_74 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Op.1(constants.%Self.1) { +// CHECK:STDOUT: specific @As(constants.%T) { +// CHECK:STDOUT: %T => constants.%T +// CHECK:STDOUT: %T.patt => constants.%T +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(%T) { +// CHECK:STDOUT: %T => constants.%T +// CHECK:STDOUT: %T.patt => constants.%T +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(@Convert.1.%T) { +// CHECK:STDOUT: %T => constants.%T +// CHECK:STDOUT: %T.patt => constants.%T +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.1(constants.%T, constants.%Self.1) { +// CHECK:STDOUT: %T => constants.%T +// CHECK:STDOUT: %As.type => constants.%As.type.2 // CHECK:STDOUT: %Self => constants.%Self.1 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: specific @As(i32) { +// CHECK:STDOUT: %T => i32 +// CHECK:STDOUT: %T.patt => i32 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type => constants.%As.type.3 +// CHECK:STDOUT: %Self => constants.%Self.2 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.2 +// CHECK:STDOUT: %Convert => constants.%Convert.2 +// CHECK:STDOUT: %.1 => constants.%.4 +// CHECK:STDOUT: %.2 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: specific @ImplicitAs(constants.%T) { // CHECK:STDOUT: %T => constants.%T // CHECK:STDOUT: %T.patt => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(Core.IntLiteral) { -// CHECK:STDOUT: %T => Core.IntLiteral -// CHECK:STDOUT: %T.patt => Core.IntLiteral +// CHECK:STDOUT: specific @ImplicitAs(i32) { +// CHECK:STDOUT: %T => i32 +// CHECK:STDOUT: %T.patt => i32 // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3 -// CHECK:STDOUT: %Self => constants.%Self.3 -// CHECK:STDOUT: %Convert.type => constants.%Convert.type.2 -// CHECK:STDOUT: %Convert => constants.%Convert.2 -// CHECK:STDOUT: %.1 => constants.%.7 -// CHECK:STDOUT: %.2 => constants.%.8 +// CHECK:STDOUT: %Self => constants.%Self.5 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.4 +// CHECK:STDOUT: %Convert => constants.%Convert.4 +// CHECK:STDOUT: %.1 => constants.%.9 +// CHECK:STDOUT: %.2 => constants.%.10 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @ImplicitAs(%T) { @@ -517,14 +895,31 @@ var arr: [i32; 1 + 2] = (3, 4, 3 + 4); // CHECK:STDOUT: %T.patt => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(@Convert.1.%T) { +// CHECK:STDOUT: specific @ImplicitAs(@Convert.2.%T) { // CHECK:STDOUT: %T => constants.%T // CHECK:STDOUT: %T.patt => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Convert.1(constants.%T, constants.%Self.2) { +// CHECK:STDOUT: specific @Convert.2(constants.%T, constants.%Self.4) { // CHECK:STDOUT: %T => constants.%T // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.2 -// CHECK:STDOUT: %Self => constants.%Self.2 +// CHECK:STDOUT: %Self => constants.%Self.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(Core.IntLiteral) { +// CHECK:STDOUT: %T => Core.IntLiteral +// CHECK:STDOUT: %T.patt => Core.IntLiteral +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.4 +// CHECK:STDOUT: %Self => constants.%Self.5 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.5 +// CHECK:STDOUT: %Convert => constants.%Convert.5 +// CHECK:STDOUT: %.1 => constants.%.11 +// CHECK:STDOUT: %.2 => constants.%.12 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Op.1(constants.%Self.3) { +// CHECK:STDOUT: %Self => constants.%Self.3 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/builtin/no_prelude/import.carbon b/toolchain/check/testdata/function/builtin/no_prelude/import.carbon index 68eef40ec6519..6e738d6786cf3 100644 --- a/toolchain/check/testdata/function/builtin/no_prelude/import.carbon +++ b/toolchain/check/testdata/function/builtin/no_prelude/import.carbon @@ -17,12 +17,13 @@ fn TestAdd(a: i32, b: i32) -> i32 = "int.sadd"; fn IntLiteral() -> type = "int_literal.make_type"; fn AsIntLiteral(a: i32) -> IntLiteral() = "int.convert_checked"; +fn AsI32(a: IntLiteral()) -> i32 = "int.convert_checked"; // --- use.carbon import Core library "core"; -var arr: [i32; Core.AsIntLiteral(Core.TestAdd(1, 2))] = (1, 2, 3); +var arr: [i32; Core.AsIntLiteral(Core.TestAdd(Core.AsI32(1), Core.AsI32(2)))] = (Core.AsI32(1), Core.AsI32(2), Core.AsI32(3)); // CHECK:STDOUT: --- core.carbon // CHECK:STDOUT: @@ -35,6 +36,8 @@ var arr: [i32; Core.AsIntLiteral(Core.TestAdd(1, 2))] = (1, 2, 3); // CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] // CHECK:STDOUT: %AsIntLiteral.type: type = fn_type @AsIntLiteral [template] // CHECK:STDOUT: %AsIntLiteral: %AsIntLiteral.type = struct_value () [template] +// CHECK:STDOUT: %AsI32.type: type = fn_type @AsI32 [template] +// CHECK:STDOUT: %AsI32: %AsI32.type = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -43,6 +46,7 @@ var arr: [i32; Core.AsIntLiteral(Core.TestAdd(1, 2))] = (1, 2, 3); // CHECK:STDOUT: .TestAdd = %TestAdd.decl // CHECK:STDOUT: .IntLiteral = %IntLiteral.decl // CHECK:STDOUT: .AsIntLiteral = %AsIntLiteral.decl +// CHECK:STDOUT: .AsI32 = %AsI32.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Int32.decl: %Int32.type = fn_decl @Int32 [template = constants.%Int32] { // CHECK:STDOUT: %return.patt: type = return_slot_pattern @@ -100,6 +104,24 @@ var arr: [i32; Core.AsIntLiteral(Core.TestAdd(1, 2))] = (1, 2, 3); // CHECK:STDOUT: %return.param: ref Core.IntLiteral = out_param runtime_param1 // CHECK:STDOUT: %return: ref Core.IntLiteral = return_slot %return.param // CHECK:STDOUT: } +// CHECK:STDOUT: %AsI32.decl: %AsI32.type = fn_decl @AsI32 [template = constants.%AsI32] { +// CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a +// CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %return.patt: i32 = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: i32 = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, file.%IntLiteral.decl [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc9_24.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc9_24.2: type = converted %int_literal.make_type, %.loc9_24.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] +// CHECK:STDOUT: %.loc9_30.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc9_30.2: type = converted %int.make_type_32, %.loc9_30.1 [template = i32] +// CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0 +// CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param +// CHECK:STDOUT: %return.param: ref i32 = out_param runtime_param1 +// CHECK:STDOUT: %return: ref i32 = return_slot %return.param +// CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; @@ -110,6 +132,8 @@ var arr: [i32; Core.AsIntLiteral(Core.TestAdd(1, 2))] = (1, 2, 3); // CHECK:STDOUT: // CHECK:STDOUT: fn @AsIntLiteral(%a.param_patt: i32) -> Core.IntLiteral = "int.convert_checked"; // CHECK:STDOUT: +// CHECK:STDOUT: fn @AsI32(%a.param_patt: Core.IntLiteral) -> i32 = "int.convert_checked"; +// CHECK:STDOUT: // CHECK:STDOUT: --- use.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -119,14 +143,18 @@ var arr: [i32; Core.AsIntLiteral(Core.TestAdd(1, 2))] = (1, 2, 3); // 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: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %.2: i32 = int_value 2 [template] -// CHECK:STDOUT: %.3: i32 = int_value 3 [template] -// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 3 [template] -// CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] +// CHECK:STDOUT: %AsI32.type: type = fn_type @AsI32 [template] +// CHECK:STDOUT: %AsI32: %AsI32.type = struct_value () [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.2: i32 = int_value 1 [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.4: i32 = int_value 2 [template] +// CHECK:STDOUT: %.5: i32 = int_value 3 [template] +// CHECK:STDOUT: %.6: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.7: type = array_type %.6, i32 [template] // CHECK:STDOUT: %tuple.type: type = tuple_type (i32, i32, i32) [template] -// CHECK:STDOUT: %.7: i32 = int_value 0 [template] -// CHECK:STDOUT: %array: %.5 = tuple_value (%.1, %.2, %.3) [template] +// CHECK:STDOUT: %.9: i32 = int_value 0 [template] +// CHECK:STDOUT: %array: %.7 = tuple_value (%.2, %.4, %.5) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -134,10 +162,12 @@ var arr: [i32; Core.AsIntLiteral(Core.TestAdd(1, 2))] = (1, 2, 3); // CHECK:STDOUT: .Int32 = %import_ref.1 // CHECK:STDOUT: .AsIntLiteral = %import_ref.2 // CHECK:STDOUT: .TestAdd = %import_ref.3 +// CHECK:STDOUT: .AsI32 = %import_ref.4 // CHECK:STDOUT: import Core//core // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.2: %AsIntLiteral.type = import_ref Core//core, inst+55, loaded [template = constants.%AsIntLiteral] // CHECK:STDOUT: %import_ref.3: %TestAdd.type = import_ref Core//core, inst+30, loaded [template = constants.%TestAdd] +// CHECK:STDOUT: %import_ref.4: %AsI32.type = import_ref Core//core, inst+73, loaded [template = constants.%AsI32] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -151,19 +181,29 @@ var arr: [i32; Core.AsIntLiteral(Core.TestAdd(1, 2))] = (1, 2, 3); // CHECK:STDOUT: %AsIntLiteral.ref: %AsIntLiteral.type = name_ref AsIntLiteral, imports.%import_ref.2 [template = constants.%AsIntLiteral] // CHECK:STDOUT: %Core.ref.loc4_34: = name_ref Core, imports.%Core [template = imports.%Core] // CHECK:STDOUT: %TestAdd.ref: %TestAdd.type = name_ref TestAdd, imports.%import_ref.3 [template = constants.%TestAdd] -// CHECK:STDOUT: %.loc4_47: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_50: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: %int.sadd: init i32 = call %TestAdd.ref(%.loc4_47, %.loc4_50) [template = constants.%.3] -// CHECK:STDOUT: %.loc4_46.1: i32 = value_of_initializer %int.sadd [template = constants.%.3] -// CHECK:STDOUT: %.loc4_46.2: i32 = converted %int.sadd, %.loc4_46.1 [template = constants.%.3] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %AsIntLiteral.ref(%.loc4_46.2) [template = constants.%.4] +// CHECK:STDOUT: %Core.ref.loc4_47: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %AsI32.ref.loc4_51: %AsI32.type = name_ref AsI32, imports.%import_ref.4 [template = constants.%AsI32] +// CHECK:STDOUT: %.loc4_58: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %int.convert_checked.loc4_57: init i32 = call %AsI32.ref.loc4_51(%.loc4_58) [template = constants.%.2] +// CHECK:STDOUT: %Core.ref.loc4_62: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %AsI32.ref.loc4_66: %AsI32.type = name_ref AsI32, imports.%import_ref.4 [template = constants.%AsI32] +// CHECK:STDOUT: %.loc4_73: Core.IntLiteral = int_value 2 [template = constants.%.3] +// CHECK:STDOUT: %int.convert_checked.loc4_72: init i32 = call %AsI32.ref.loc4_66(%.loc4_73) [template = constants.%.4] +// CHECK:STDOUT: %.loc4_57.1: i32 = value_of_initializer %int.convert_checked.loc4_57 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_57.2: i32 = converted %int.convert_checked.loc4_57, %.loc4_57.1 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_72.1: i32 = value_of_initializer %int.convert_checked.loc4_72 [template = constants.%.4] +// CHECK:STDOUT: %.loc4_72.2: i32 = converted %int.convert_checked.loc4_72, %.loc4_72.1 [template = constants.%.4] +// CHECK:STDOUT: %int.sadd: init i32 = call %TestAdd.ref(%.loc4_57.2, %.loc4_72.2) [template = constants.%.5] +// CHECK:STDOUT: %.loc4_46.1: i32 = value_of_initializer %int.sadd [template = constants.%.5] +// CHECK:STDOUT: %.loc4_46.2: i32 = converted %int.sadd, %.loc4_46.1 [template = constants.%.5] +// CHECK:STDOUT: %int.convert_checked.loc4_33: init Core.IntLiteral = call %AsIntLiteral.ref(%.loc4_46.2) [template = constants.%.6] // CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32 [template = i32] // CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32, %.loc4_11.1 [template = i32] -// CHECK:STDOUT: %.loc4_33.1: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.4] -// CHECK:STDOUT: %.loc4_33.2: Core.IntLiteral = converted %int.convert_checked, %.loc4_33.1 [template = constants.%.4] -// CHECK:STDOUT: %.loc4_53: type = array_type %.loc4_33.2, i32 [template = constants.%.5] -// CHECK:STDOUT: %arr.var: ref %.5 = var arr -// CHECK:STDOUT: %arr: ref %.5 = bind_name arr, %arr.var +// CHECK:STDOUT: %.loc4_33.1: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4_33 [template = constants.%.6] +// CHECK:STDOUT: %.loc4_33.2: Core.IntLiteral = converted %int.convert_checked.loc4_33, %.loc4_33.1 [template = constants.%.6] +// CHECK:STDOUT: %.loc4_77: type = array_type %.loc4_33.2, i32 [template = constants.%.7] +// CHECK:STDOUT: %arr.var: ref %.7 = var arr +// CHECK:STDOUT: %arr: ref %.7 = bind_name arr, %arr.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; @@ -172,24 +212,35 @@ var arr: [i32; Core.AsIntLiteral(Core.TestAdd(1, 2))] = (1, 2, 3); // CHECK:STDOUT: // CHECK:STDOUT: fn @TestAdd(%a.param_patt: i32, %b.param_patt: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: +// CHECK:STDOUT: fn @AsI32(%a.param_patt: Core.IntLiteral) -> i32 = "int.convert_checked"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc4_58: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_61: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc4_64: i32 = int_value 3 [template = constants.%.3] -// CHECK:STDOUT: %.loc4_65.1: %tuple.type = tuple_literal (%.loc4_58, %.loc4_61, %.loc4_64) -// CHECK:STDOUT: %.loc4_65.2: i32 = int_value 0 [template = constants.%.7] -// CHECK:STDOUT: %.loc4_65.3: ref i32 = array_index file.%arr.var, %.loc4_65.2 -// CHECK:STDOUT: %.loc4_65.4: init i32 = initialize_from %.loc4_58 to %.loc4_65.3 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_65.5: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_65.6: ref i32 = array_index file.%arr.var, %.loc4_65.5 -// CHECK:STDOUT: %.loc4_65.7: init i32 = initialize_from %.loc4_61 to %.loc4_65.6 [template = constants.%.2] -// CHECK:STDOUT: %.loc4_65.8: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc4_65.9: ref i32 = array_index file.%arr.var, %.loc4_65.8 -// CHECK:STDOUT: %.loc4_65.10: init i32 = initialize_from %.loc4_64 to %.loc4_65.9 [template = constants.%.3] -// CHECK:STDOUT: %.loc4_65.11: init %.5 = array_init (%.loc4_65.4, %.loc4_65.7, %.loc4_65.10) to file.%arr.var [template = constants.%array] -// CHECK:STDOUT: %.loc4_66: init %.5 = converted %.loc4_65.1, %.loc4_65.11 [template = constants.%array] -// CHECK:STDOUT: assign file.%arr.var, %.loc4_66 +// CHECK:STDOUT: %Core.ref.loc4_82: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %AsI32.ref.loc4_86: %AsI32.type = name_ref AsI32, imports.%import_ref.4 [template = constants.%AsI32] +// CHECK:STDOUT: %.loc4_93: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %int.convert_checked.loc4_92: init i32 = call %AsI32.ref.loc4_86(%.loc4_93) [template = constants.%.2] +// CHECK:STDOUT: %Core.ref.loc4_97: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %AsI32.ref.loc4_101: %AsI32.type = name_ref AsI32, imports.%import_ref.4 [template = constants.%AsI32] +// CHECK:STDOUT: %.loc4_108: Core.IntLiteral = int_value 2 [template = constants.%.3] +// CHECK:STDOUT: %int.convert_checked.loc4_107: init i32 = call %AsI32.ref.loc4_101(%.loc4_108) [template = constants.%.4] +// CHECK:STDOUT: %Core.ref.loc4_112: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %AsI32.ref.loc4_116: %AsI32.type = name_ref AsI32, imports.%import_ref.4 [template = constants.%AsI32] +// CHECK:STDOUT: %.loc4_123: Core.IntLiteral = int_value 3 [template = constants.%.6] +// CHECK:STDOUT: %int.convert_checked.loc4_122: init i32 = call %AsI32.ref.loc4_116(%.loc4_123) [template = constants.%.5] +// CHECK:STDOUT: %.loc4_125.1: %tuple.type = tuple_literal (%int.convert_checked.loc4_92, %int.convert_checked.loc4_107, %int.convert_checked.loc4_122) +// CHECK:STDOUT: %.loc4_125.2: i32 = int_value 0 [template = constants.%.9] +// CHECK:STDOUT: %.loc4_125.3: ref i32 = array_index file.%arr.var, %.loc4_125.2 +// CHECK:STDOUT: %.loc4_125.4: init i32 = initialize_from %int.convert_checked.loc4_92 to %.loc4_125.3 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_125.5: i32 = int_value 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_125.6: ref i32 = array_index file.%arr.var, %.loc4_125.5 +// CHECK:STDOUT: %.loc4_125.7: init i32 = initialize_from %int.convert_checked.loc4_107 to %.loc4_125.6 [template = constants.%.4] +// CHECK:STDOUT: %.loc4_125.8: i32 = int_value 2 [template = constants.%.4] +// CHECK:STDOUT: %.loc4_125.9: ref i32 = array_index file.%arr.var, %.loc4_125.8 +// CHECK:STDOUT: %.loc4_125.10: init i32 = initialize_from %int.convert_checked.loc4_122 to %.loc4_125.9 [template = constants.%.5] +// CHECK:STDOUT: %.loc4_125.11: init %.7 = array_init (%.loc4_125.4, %.loc4_125.7, %.loc4_125.10) to file.%arr.var [template = constants.%array] +// CHECK:STDOUT: %.loc4_126: init %.7 = converted %.loc4_125.1, %.loc4_125.11 [template = constants.%array] +// CHECK:STDOUT: assign file.%arr.var, %.loc4_126 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/call/fail_param_count.carbon b/toolchain/check/testdata/function/call/fail_param_count.carbon index 6e7c235391108..c7c774cbc59c8 100644 --- a/toolchain/check/testdata/function/call/fail_param_count.carbon +++ b/toolchain/check/testdata/function/call/fail_param_count.carbon @@ -77,8 +77,8 @@ fn Main() { // CHECK:STDOUT: %Run2: %Run2.type = struct_value () [template] // CHECK:STDOUT: %Main.type: type = fn_type @Main [template] // CHECK:STDOUT: %Main: %Main.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %.2: i32 = int_value 0 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -147,17 +147,17 @@ fn Main() { // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Run0.ref.loc23: %Run0.type = name_ref Run0, file.%Run0.decl [template = constants.%Run0] -// CHECK:STDOUT: %.loc23: i32 = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc23: Core.IntLiteral = int_value 1 [template = constants.%.1] // CHECK:STDOUT: %Run0.ref.loc31: %Run0.type = name_ref Run0, file.%Run0.decl [template = constants.%Run0] -// CHECK:STDOUT: %.loc31_8: i32 = int_value 0 [template = constants.%.2] -// CHECK:STDOUT: %.loc31_11: i32 = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc31_8: Core.IntLiteral = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc31_11: Core.IntLiteral = int_value 1 [template = constants.%.1] // CHECK:STDOUT: %Run1.ref.loc40: %Run1.type = name_ref Run1, file.%Run1.decl [template = constants.%Run1] // CHECK:STDOUT: %Run1.ref.loc48: %Run1.type = name_ref Run1, file.%Run1.decl [template = constants.%Run1] -// CHECK:STDOUT: %.loc48_8: i32 = int_value 0 [template = constants.%.2] -// CHECK:STDOUT: %.loc48_11: i32 = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc48_8: Core.IntLiteral = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc48_11: Core.IntLiteral = int_value 1 [template = constants.%.1] // CHECK:STDOUT: %Run2.ref.loc57: %Run2.type = name_ref Run2, file.%Run2.decl [template = constants.%Run2] // CHECK:STDOUT: %Run2.ref.loc64: %Run2.type = name_ref Run2, file.%Run2.decl [template = constants.%Run2] -// CHECK:STDOUT: %.loc64: i32 = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc64: Core.IntLiteral = int_value 0 [template = constants.%.2] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/call/i32.carbon b/toolchain/check/testdata/function/call/i32.carbon index 1caa38462c25d..cba9ece2fdb7f 100644 --- a/toolchain/check/testdata/function/call/i32.carbon +++ b/toolchain/check/testdata/function/call/i32.carbon @@ -25,12 +25,19 @@ fn Main() { // CHECK:STDOUT: %Echo: %Echo.type = struct_value () [template] // CHECK:STDOUT: %Main.type: type = fn_type @Main [template] // CHECK:STDOUT: %Main: %Main.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -77,8 +84,13 @@ fn Main() { // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var // CHECK:STDOUT: %Echo.ref: %Echo.type = name_ref Echo, file.%Echo.decl [template = constants.%Echo] -// CHECK:STDOUT: %.loc16_21: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %Echo.call: init i32 = call %Echo.ref(%.loc16_21) +// CHECK:STDOUT: %.loc16_21.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc16_21.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc16_21.3: = bound_method %.loc16_21.1, %.loc16_21.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc16_21.3(%.loc16_21.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc16_21.4: i32 = value_of_initializer %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc16_21.5: i32 = converted %.loc16_21.1, %.loc16_21.4 [template = constants.%.27] +// CHECK:STDOUT: %Echo.call: init i32 = call %Echo.ref(%.loc16_21.5) // CHECK:STDOUT: assign %b.var, %Echo.call // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/call/more_param_ir.carbon b/toolchain/check/testdata/function/call/more_param_ir.carbon index 8d116b22b0699..513c44f50a14a 100644 --- a/toolchain/check/testdata/function/call/more_param_ir.carbon +++ b/toolchain/check/testdata/function/call/more_param_ir.carbon @@ -28,15 +28,25 @@ fn Main() { // CHECK:STDOUT: %Main: %Main.type = struct_value () [template] // CHECK:STDOUT: %tuple.type.1: type = tuple_type (type) [template] // CHECK:STDOUT: %tuple.type.2: type = tuple_type (i32) [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.1) [template] -// CHECK:STDOUT: %.2: i32 = int_value 0 [template] -// CHECK:STDOUT: %.3: i32 = int_value 6 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %tuple.type.3: type = tuple_type (Core.IntLiteral) [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 1 [template] +// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.27) [template] +// CHECK:STDOUT: %.28: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 6 [template] +// CHECK:STDOUT: %.30: = bound_method %.29, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 6 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -83,18 +93,27 @@ fn Main() { // CHECK:STDOUT: %.loc14_15.4: type = converted %.loc14_15.1, constants.%tuple.type.2 [template = constants.%tuple.type.2] // CHECK:STDOUT: %x.var: ref %tuple.type.2 = var x // CHECK:STDOUT: %x: ref %tuple.type.2 = bind_name x, %x.var -// CHECK:STDOUT: %.loc14_20: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc14_22.1: %tuple.type.2 = tuple_literal (%.loc14_20) -// CHECK:STDOUT: %.loc14_22.2: init %tuple.type.2 = tuple_init (%.loc14_20) to %x.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc14_23: init %tuple.type.2 = converted %.loc14_22.1, %.loc14_22.2 [template = constants.%tuple] +// CHECK:STDOUT: %.loc14_20: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc14_22.1: %tuple.type.3 = tuple_literal (%.loc14_20) +// CHECK:STDOUT: %.loc14_22.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc14_22.3: = bound_method %.loc14_20, %.loc14_22.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc14: init i32 = call %.loc14_22.3(%.loc14_20) [template = constants.%.27] +// CHECK:STDOUT: %.loc14_22.4: init i32 = converted %.loc14_20, %int.convert_checked.loc14 [template = constants.%.27] +// CHECK:STDOUT: %.loc14_22.5: init %tuple.type.2 = tuple_init (%.loc14_22.4) to %x.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc14_23: init %tuple.type.2 = converted %.loc14_22.1, %.loc14_22.5 [template = constants.%tuple] // CHECK:STDOUT: assign %x.var, %.loc14_23 // CHECK:STDOUT: %Foo.ref: %Foo.type = name_ref Foo, file.%Foo.decl [template = constants.%Foo] // CHECK:STDOUT: %x.ref: ref %tuple.type.2 = name_ref x, %x -// CHECK:STDOUT: %.loc16_9: i32 = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc16_9: Core.IntLiteral = int_value 0 [template = constants.%.28] // CHECK:STDOUT: %.loc16_8.1: ref i32 = tuple_access %x.ref, element0 -// CHECK:STDOUT: %.loc16_12: i32 = int_value 6 [template = constants.%.3] +// CHECK:STDOUT: %.loc16_12.1: Core.IntLiteral = int_value 6 [template = constants.%.29] // CHECK:STDOUT: %.loc16_8.2: i32 = bind_value %.loc16_8.1 -// CHECK:STDOUT: %Foo.call: init %empty_tuple.type = call %Foo.ref(%.loc16_8.2, %.loc16_12) +// CHECK:STDOUT: %.loc16_12.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc16_12.3: = bound_method %.loc16_12.1, %.loc16_12.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc16: init i32 = call %.loc16_12.3(%.loc16_12.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc16_12.4: i32 = value_of_initializer %int.convert_checked.loc16 [template = constants.%.31] +// CHECK:STDOUT: %.loc16_12.5: i32 = converted %.loc16_12.1, %.loc16_12.4 [template = constants.%.31] +// CHECK:STDOUT: %Foo.call: init %empty_tuple.type = call %Foo.ref(%.loc16_8.2, %.loc16_12.5) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/call/params_one.carbon b/toolchain/check/testdata/function/call/params_one.carbon index acd018deccdd1..fdfccac1c7bd5 100644 --- a/toolchain/check/testdata/function/call/params_one.carbon +++ b/toolchain/check/testdata/function/call/params_one.carbon @@ -24,12 +24,19 @@ fn Main() { // CHECK:STDOUT: %Foo: %Foo.type = struct_value () [template] // CHECK:STDOUT: %Main.type: type = fn_type @Main [template] // CHECK:STDOUT: %Main: %Main.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -63,8 +70,13 @@ fn Main() { // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Foo.ref: %Foo.type = name_ref Foo, file.%Foo.decl [template = constants.%Foo] -// CHECK:STDOUT: %.loc14: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %Foo.call: init %empty_tuple.type = call %Foo.ref(%.loc14) +// CHECK:STDOUT: %.loc14_7.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc14_7.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc14_7.3: = bound_method %.loc14_7.1, %.loc14_7.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc14_7.3(%.loc14_7.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc14_7.4: i32 = value_of_initializer %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc14_7.5: i32 = converted %.loc14_7.1, %.loc14_7.4 [template = constants.%.27] +// CHECK:STDOUT: %Foo.call: init %empty_tuple.type = call %Foo.ref(%.loc14_7.5) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/call/params_one_comma.carbon b/toolchain/check/testdata/function/call/params_one_comma.carbon index 236261fa6ba78..7d7e72db0b2bf 100644 --- a/toolchain/check/testdata/function/call/params_one_comma.carbon +++ b/toolchain/check/testdata/function/call/params_one_comma.carbon @@ -25,12 +25,19 @@ fn Main() { // CHECK:STDOUT: %Foo: %Foo.type = struct_value () [template] // CHECK:STDOUT: %Main.type: type = fn_type @Main [template] // CHECK:STDOUT: %Main: %Main.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -64,11 +71,21 @@ fn Main() { // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Foo.ref.loc14: %Foo.type = name_ref Foo, file.%Foo.decl [template = constants.%Foo] -// CHECK:STDOUT: %.loc14: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %Foo.call.loc14: init %empty_tuple.type = call %Foo.ref.loc14(%.loc14) +// CHECK:STDOUT: %.loc14_7.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc14_7.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc14_7.3: = bound_method %.loc14_7.1, %.loc14_7.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc14: init i32 = call %.loc14_7.3(%.loc14_7.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc14_7.4: i32 = value_of_initializer %int.convert_checked.loc14 [template = constants.%.27] +// CHECK:STDOUT: %.loc14_7.5: i32 = converted %.loc14_7.1, %.loc14_7.4 [template = constants.%.27] +// CHECK:STDOUT: %Foo.call.loc14: init %empty_tuple.type = call %Foo.ref.loc14(%.loc14_7.5) // CHECK:STDOUT: %Foo.ref.loc15: %Foo.type = name_ref Foo, file.%Foo.decl [template = constants.%Foo] -// CHECK:STDOUT: %.loc15: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %Foo.call.loc15: init %empty_tuple.type = call %Foo.ref.loc15(%.loc15) +// CHECK:STDOUT: %.loc15_7.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc15_7.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc15_7.3: = bound_method %.loc15_7.1, %.loc15_7.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc15: init i32 = call %.loc15_7.3(%.loc15_7.1) [template = constants.%.27] +// CHECK:STDOUT: %.loc15_7.4: i32 = value_of_initializer %int.convert_checked.loc15 [template = constants.%.27] +// CHECK:STDOUT: %.loc15_7.5: i32 = converted %.loc15_7.1, %.loc15_7.4 [template = constants.%.27] +// CHECK:STDOUT: %Foo.call.loc15: init %empty_tuple.type = call %Foo.ref.loc15(%.loc15_7.5) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/call/params_two.carbon b/toolchain/check/testdata/function/call/params_two.carbon index 56dfc60e0e9dd..9503bf4789da8 100644 --- a/toolchain/check/testdata/function/call/params_two.carbon +++ b/toolchain/check/testdata/function/call/params_two.carbon @@ -24,13 +24,22 @@ fn Main() { // CHECK:STDOUT: %Foo: %Foo.type = struct_value () [template] // CHECK:STDOUT: %Main.type: type = fn_type @Main [template] // CHECK:STDOUT: %Main: %Main.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %.2: i32 = int_value 2 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 2 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 1 [template] +// CHECK:STDOUT: %.29: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -71,9 +80,19 @@ fn Main() { // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Foo.ref: %Foo.type = name_ref Foo, file.%Foo.decl [template = constants.%Foo] -// CHECK:STDOUT: %.loc14_7: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc14_10: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: %Foo.call: init %empty_tuple.type = call %Foo.ref(%.loc14_7, %.loc14_10) +// CHECK:STDOUT: %.loc14_7.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc14_10.1: Core.IntLiteral = int_value 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc14_7.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc14_7.3: = bound_method %.loc14_7.1, %.loc14_7.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc14_7: init i32 = call %.loc14_7.3(%.loc14_7.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc14_7.4: i32 = value_of_initializer %int.convert_checked.loc14_7 [template = constants.%.28] +// CHECK:STDOUT: %.loc14_7.5: i32 = converted %.loc14_7.1, %.loc14_7.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc14_10.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc14_10.3: = bound_method %.loc14_10.1, %.loc14_10.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc14_10: init i32 = call %.loc14_10.3(%.loc14_10.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc14_10.4: i32 = value_of_initializer %int.convert_checked.loc14_10 [template = constants.%.30] +// CHECK:STDOUT: %.loc14_10.5: i32 = converted %.loc14_10.1, %.loc14_10.4 [template = constants.%.30] +// CHECK:STDOUT: %Foo.call: init %empty_tuple.type = call %Foo.ref(%.loc14_7.5, %.loc14_10.5) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/call/params_two_comma.carbon b/toolchain/check/testdata/function/call/params_two_comma.carbon index e624d0bb08388..8cd8d29820dfe 100644 --- a/toolchain/check/testdata/function/call/params_two_comma.carbon +++ b/toolchain/check/testdata/function/call/params_two_comma.carbon @@ -25,13 +25,22 @@ fn Main() { // CHECK:STDOUT: %Foo: %Foo.type = struct_value () [template] // CHECK:STDOUT: %Main.type: type = fn_type @Main [template] // CHECK:STDOUT: %Main: %Main.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %.2: i32 = int_value 2 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 2 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 1 [template] +// CHECK:STDOUT: %.29: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -72,13 +81,33 @@ fn Main() { // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Foo.ref.loc14: %Foo.type = name_ref Foo, file.%Foo.decl [template = constants.%Foo] -// CHECK:STDOUT: %.loc14_7: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc14_10: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: %Foo.call.loc14: init %empty_tuple.type = call %Foo.ref.loc14(%.loc14_7, %.loc14_10) +// CHECK:STDOUT: %.loc14_7.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc14_10.1: Core.IntLiteral = int_value 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc14_7.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc14_7.3: = bound_method %.loc14_7.1, %.loc14_7.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc14_7: init i32 = call %.loc14_7.3(%.loc14_7.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc14_7.4: i32 = value_of_initializer %int.convert_checked.loc14_7 [template = constants.%.28] +// CHECK:STDOUT: %.loc14_7.5: i32 = converted %.loc14_7.1, %.loc14_7.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc14_10.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc14_10.3: = bound_method %.loc14_10.1, %.loc14_10.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc14_10: init i32 = call %.loc14_10.3(%.loc14_10.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc14_10.4: i32 = value_of_initializer %int.convert_checked.loc14_10 [template = constants.%.30] +// CHECK:STDOUT: %.loc14_10.5: i32 = converted %.loc14_10.1, %.loc14_10.4 [template = constants.%.30] +// CHECK:STDOUT: %Foo.call.loc14: init %empty_tuple.type = call %Foo.ref.loc14(%.loc14_7.5, %.loc14_10.5) // CHECK:STDOUT: %Foo.ref.loc15: %Foo.type = name_ref Foo, file.%Foo.decl [template = constants.%Foo] -// CHECK:STDOUT: %.loc15_7: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc15_10: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: %Foo.call.loc15: init %empty_tuple.type = call %Foo.ref.loc15(%.loc15_7, %.loc15_10) +// CHECK:STDOUT: %.loc15_7.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc15_10.1: Core.IntLiteral = int_value 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_7.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc15_7.3: = bound_method %.loc15_7.1, %.loc15_7.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc15_7: init i32 = call %.loc15_7.3(%.loc15_7.1) [template = constants.%.28] +// CHECK:STDOUT: %.loc15_7.4: i32 = value_of_initializer %int.convert_checked.loc15_7 [template = constants.%.28] +// CHECK:STDOUT: %.loc15_7.5: i32 = converted %.loc15_7.1, %.loc15_7.4 [template = constants.%.28] +// CHECK:STDOUT: %.loc15_10.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc15_10.3: = bound_method %.loc15_10.1, %.loc15_10.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc15_10: init i32 = call %.loc15_10.3(%.loc15_10.1) [template = constants.%.30] +// CHECK:STDOUT: %.loc15_10.4: i32 = value_of_initializer %int.convert_checked.loc15_10 [template = constants.%.30] +// CHECK:STDOUT: %.loc15_10.5: i32 = converted %.loc15_10.1, %.loc15_10.4 [template = constants.%.30] +// CHECK:STDOUT: %Foo.call.loc15: init %empty_tuple.type = call %Foo.ref.loc15(%.loc15_7.5, %.loc15_10.5) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/declaration/import.carbon b/toolchain/check/testdata/function/declaration/import.carbon index fdd155a660b60..43620e73a09cb 100644 --- a/toolchain/check/testdata/function/declaration/import.carbon +++ b/toolchain/check/testdata/function/declaration/import.carbon @@ -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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = 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 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 %.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 %.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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = 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 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 %.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 %.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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = 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 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 %.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 %.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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = 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 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 %.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 %.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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = 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 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 %.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 %.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() diff --git a/toolchain/check/testdata/function/definition/import.carbon b/toolchain/check/testdata/function/definition/import.carbon index 2437ed65f9b35..1e2758feee5c7 100644 --- a/toolchain/check/testdata/function/definition/import.carbon +++ b/toolchain/check/testdata/function/definition/import.carbon @@ -123,7 +123,7 @@ fn D() {} // CHECK:STDOUT: %.1: 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: %.2: i32 = int_value 0 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 0 [template] // CHECK:STDOUT: %D.type: type = fn_type @D [template] // CHECK:STDOUT: %D: %D.type = struct_value () [template] // CHECK:STDOUT: } @@ -200,7 +200,7 @@ fn D() {} // CHECK:STDOUT: fn @C(%c.param_patt: %tuple.type.2) -> %.1 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %c.ref: %tuple.type.2 = name_ref c, %c -// CHECK:STDOUT: %.loc6_47: i32 = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc6_47: Core.IntLiteral = int_value 0 [template = constants.%.2] // CHECK:STDOUT: %.loc6_46: i32 = tuple_access %c.ref, element0 // CHECK:STDOUT: %.loc6_48: %.1 = struct_literal (%.loc6_46) // CHECK:STDOUT: %struct: %.1 = struct_value (%.loc6_46) @@ -245,12 +245,19 @@ fn D() {} // 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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = 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: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -260,6 +267,7 @@ fn D() {} // CHECK:STDOUT: %import_ref.4 = import_ref Main//fns, inst+65, unloaded // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int32 = %import_ref.5 +// CHECK:STDOUT: .ImplicitAs = %import_ref.6 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -290,16 +298,16 @@ fn D() {} // 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: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A(); // 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: fn @__global_init() { // CHECK:STDOUT: !entry: @@ -307,15 +315,25 @@ fn D() {} // 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 %.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 %.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: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/generic/deduce.carbon b/toolchain/check/testdata/function/generic/deduce.carbon index 2017e300dbe99..9a649bd38066e 100644 --- a/toolchain/check/testdata/function/generic/deduce.carbon +++ b/toolchain/check/testdata/function/generic/deduce.carbon @@ -771,16 +771,24 @@ fn CallImplicitNotDeducible() { // CHECK:STDOUT: %TupleParam: %TupleParam.type = struct_value () [template] // CHECK:STDOUT: %CallTupleParam.type: type = fn_type @CallTupleParam [template] // CHECK:STDOUT: %CallTupleParam: %CallTupleParam.type = struct_value () [template] -// CHECK:STDOUT: %.2: i32 = int_value 1 [template] -// CHECK:STDOUT: %.3: i32 = int_value 2 [template] -// CHECK:STDOUT: %tuple.type.3: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.4: = specific_function %TupleParam, @TupleParam(i32) [template] -// CHECK:STDOUT: %tuple: %tuple.type.3 = tuple_value (%.2, %.3) [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %tuple.type.3: type = tuple_type (Core.IntLiteral, Core.IntLiteral) [template] +// CHECK:STDOUT: %tuple.type.4: type = tuple_type (Core.IntLiteral, i32) [template] +// CHECK:STDOUT: %.4: = specific_function %TupleParam, @TupleParam(Core.IntLiteral) [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: %.29: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.30: = bound_method %.3, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 2 [template] +// CHECK:STDOUT: %tuple: %tuple.type.4 = tuple_value (%.2, %.31) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -829,13 +837,18 @@ fn CallImplicitNotDeducible() { // CHECK:STDOUT: fn @CallTupleParam() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %TupleParam.ref: %TupleParam.type = name_ref TupleParam, file.%TupleParam.decl [template = constants.%TupleParam] -// CHECK:STDOUT: %.loc7_15: i32 = int_value 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc7_18: i32 = int_value 2 [template = constants.%.3] +// CHECK:STDOUT: %.loc7_15: Core.IntLiteral = int_value 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc7_18: Core.IntLiteral = int_value 2 [template = constants.%.3] // CHECK:STDOUT: %.loc7_19.1: %tuple.type.3 = tuple_literal (%.loc7_15, %.loc7_18) -// CHECK:STDOUT: %.loc7_3: = specific_function %TupleParam.ref, @TupleParam(i32) [template = constants.%.4] -// CHECK:STDOUT: %tuple: %tuple.type.3 = tuple_value (%.loc7_15, %.loc7_18) [template = constants.%tuple] -// CHECK:STDOUT: %.loc7_19.2: %tuple.type.3 = converted %.loc7_19.1, %tuple [template = constants.%tuple] -// CHECK:STDOUT: %TupleParam.call: init %empty_tuple.type = call %.loc7_3(%.loc7_19.2) +// CHECK:STDOUT: %.loc7_3: = specific_function %TupleParam.ref, @TupleParam(Core.IntLiteral) [template = constants.%.4] +// CHECK:STDOUT: %.loc7_19.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc7_19.3: = bound_method %.loc7_18, %.loc7_19.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc7_19.3(%.loc7_18) [template = constants.%.31] +// CHECK:STDOUT: %.loc7_19.4: i32 = value_of_initializer %int.convert_checked [template = constants.%.31] +// CHECK:STDOUT: %.loc7_19.5: i32 = converted %.loc7_18, %.loc7_19.4 [template = constants.%.31] +// CHECK:STDOUT: %tuple: %tuple.type.4 = tuple_value (%.loc7_15, %.loc7_19.5) [template = constants.%tuple] +// CHECK:STDOUT: %.loc7_19.6: %tuple.type.4 = converted %.loc7_19.1, %tuple [template = constants.%tuple] +// CHECK:STDOUT: %TupleParam.call: init %empty_tuple.type = call %.loc7_3(%.loc7_19.6) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -845,10 +858,10 @@ fn CallImplicitNotDeducible() { // CHECK:STDOUT: %tuple.type => constants.%tuple.type.2 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @TupleParam(i32) { -// CHECK:STDOUT: %T.loc4_15.2 => i32 -// CHECK:STDOUT: %T.patt.loc4_15.2 => i32 -// CHECK:STDOUT: %tuple.type => constants.%tuple.type.3 +// CHECK:STDOUT: specific @TupleParam(Core.IntLiteral) { +// CHECK:STDOUT: %T.loc4_15.2 => Core.IntLiteral +// CHECK:STDOUT: %T.patt.loc4_15.2 => Core.IntLiteral +// CHECK:STDOUT: %tuple.type => constants.%tuple.type.4 // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: } @@ -866,16 +879,24 @@ fn CallImplicitNotDeducible() { // CHECK:STDOUT: %StructParam: %StructParam.type = struct_value () [template] // CHECK:STDOUT: %CallStructParam.type: type = fn_type @CallStructParam [template] // CHECK:STDOUT: %CallStructParam: %CallStructParam.type = struct_value () [template] -// CHECK:STDOUT: %.3: i32 = int_value 1 [template] -// CHECK:STDOUT: %.4: i32 = int_value 2 [template] -// CHECK:STDOUT: %.5: type = struct_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.6: = specific_function %StructParam, @StructParam(i32) [template] -// CHECK:STDOUT: %struct: %.5 = struct_value (%.3, %.4) [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.5: type = struct_type {.a: Core.IntLiteral, .b: Core.IntLiteral} [template] +// CHECK:STDOUT: %.6: type = struct_type {.a: Core.IntLiteral, .b: i32} [template] +// CHECK:STDOUT: %.7: = specific_function %StructParam, @StructParam(Core.IntLiteral) [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: %.32: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.33: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.34: i32 = int_value 2 [template] +// CHECK:STDOUT: %struct: %.6 = struct_value (%.3, %.34) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -923,13 +944,18 @@ fn CallImplicitNotDeducible() { // CHECK:STDOUT: fn @CallStructParam() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %StructParam.ref: %StructParam.type = name_ref StructParam, file.%StructParam.decl [template = constants.%StructParam] -// CHECK:STDOUT: %.loc7_21: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc7_29: i32 = int_value 2 [template = constants.%.4] +// CHECK:STDOUT: %.loc7_21: Core.IntLiteral = int_value 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc7_29: Core.IntLiteral = int_value 2 [template = constants.%.4] // CHECK:STDOUT: %.loc7_30.1: %.5 = struct_literal (%.loc7_21, %.loc7_29) -// CHECK:STDOUT: %.loc7_3: = specific_function %StructParam.ref, @StructParam(i32) [template = constants.%.6] -// CHECK:STDOUT: %struct: %.5 = struct_value (%.loc7_21, %.loc7_29) [template = constants.%struct] -// CHECK:STDOUT: %.loc7_30.2: %.5 = converted %.loc7_30.1, %struct [template = constants.%struct] -// CHECK:STDOUT: %StructParam.call: init %empty_tuple.type = call %.loc7_3(%.loc7_30.2) +// CHECK:STDOUT: %.loc7_3: = specific_function %StructParam.ref, @StructParam(Core.IntLiteral) [template = constants.%.7] +// CHECK:STDOUT: %.loc7_30.2: %Convert.type.2 = interface_witness_access constants.%.32, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc7_30.3: = bound_method %.loc7_29, %.loc7_30.2 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc7_30.3(%.loc7_29) [template = constants.%.34] +// CHECK:STDOUT: %.loc7_30.4: i32 = value_of_initializer %int.convert_checked [template = constants.%.34] +// CHECK:STDOUT: %.loc7_30.5: i32 = converted %.loc7_29, %.loc7_30.4 [template = constants.%.34] +// CHECK:STDOUT: %struct: %.6 = struct_value (%.loc7_21, %.loc7_30.5) [template = constants.%struct] +// CHECK:STDOUT: %.loc7_30.6: %.6 = converted %.loc7_30.1, %struct [template = constants.%struct] +// CHECK:STDOUT: %StructParam.call: init %empty_tuple.type = call %.loc7_3(%.loc7_30.6) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -939,10 +965,10 @@ fn CallImplicitNotDeducible() { // CHECK:STDOUT: %.loc4_44.2 => constants.%.1 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @StructParam(i32) { -// CHECK:STDOUT: %T.loc4_16.2 => i32 -// CHECK:STDOUT: %T.patt.loc4_16.2 => i32 -// CHECK:STDOUT: %.loc4_44.2 => constants.%.5 +// CHECK:STDOUT: specific @StructParam(Core.IntLiteral) { +// CHECK:STDOUT: %T.loc4_16.2 => Core.IntLiteral +// CHECK:STDOUT: %T.patt.loc4_16.2 => Core.IntLiteral +// CHECK:STDOUT: %.loc4_44.2 => constants.%.6 // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: } @@ -959,9 +985,9 @@ fn CallImplicitNotDeducible() { // CHECK:STDOUT: %BigStructParam: %BigStructParam.type = struct_value () [template] // CHECK:STDOUT: %CallBigStructParam.type: type = fn_type @CallBigStructParam [template] // CHECK:STDOUT: %CallBigStructParam: %CallBigStructParam.type = struct_value () [template] -// CHECK:STDOUT: %.3: i32 = int_value 3 [template] -// CHECK:STDOUT: %.4: i32 = int_value 4 [template] -// CHECK:STDOUT: %.5: type = struct_type {.c: i32, .d: i32} [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 4 [template] +// CHECK:STDOUT: %.5: type = struct_type {.c: Core.IntLiteral, .d: Core.IntLiteral} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -1017,8 +1043,8 @@ fn CallImplicitNotDeducible() { // CHECK:STDOUT: fn @CallBigStructParam() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %BigStructParam.ref: %BigStructParam.type = name_ref BigStructParam, file.%BigStructParam.decl [template = constants.%BigStructParam] -// CHECK:STDOUT: %.loc14_24: i32 = int_value 3 [template = constants.%.3] -// CHECK:STDOUT: %.loc14_32: i32 = int_value 4 [template = constants.%.4] +// CHECK:STDOUT: %.loc14_24: Core.IntLiteral = int_value 3 [template = constants.%.3] +// CHECK:STDOUT: %.loc14_32: Core.IntLiteral = int_value 4 [template = constants.%.4] // CHECK:STDOUT: %.loc14_33: %.5 = struct_literal (%.loc14_24, %.loc14_32) // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -1041,10 +1067,10 @@ fn CallImplicitNotDeducible() { // CHECK:STDOUT: %SmallStructParam: %SmallStructParam.type = struct_value () [template] // CHECK:STDOUT: %CallSmallStructParam.type: type = fn_type @CallSmallStructParam [template] // CHECK:STDOUT: %CallSmallStructParam: %CallSmallStructParam.type = struct_value () [template] -// CHECK:STDOUT: %.3: i32 = int_value 5 [template] -// CHECK:STDOUT: %.4: i32 = int_value 6 [template] -// CHECK:STDOUT: %.5: i32 = int_value 7 [template] -// CHECK:STDOUT: %.6: type = struct_type {.f: i32, .g: i32, .h: i32} [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 5 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 6 [template] +// CHECK:STDOUT: %.5: Core.IntLiteral = int_value 7 [template] +// CHECK:STDOUT: %.6: type = struct_type {.f: Core.IntLiteral, .g: Core.IntLiteral, .h: Core.IntLiteral} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -1097,9 +1123,9 @@ fn CallImplicitNotDeducible() { // CHECK:STDOUT: fn @CallSmallStructParam() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %SmallStructParam.ref: %SmallStructParam.type = name_ref SmallStructParam, file.%SmallStructParam.decl [template = constants.%SmallStructParam] -// CHECK:STDOUT: %.loc14_26: i32 = int_value 5 [template = constants.%.3] -// CHECK:STDOUT: %.loc14_34: i32 = int_value 6 [template = constants.%.4] -// CHECK:STDOUT: %.loc14_42: i32 = int_value 7 [template = constants.%.5] +// CHECK:STDOUT: %.loc14_26: Core.IntLiteral = int_value 5 [template = constants.%.3] +// CHECK:STDOUT: %.loc14_34: Core.IntLiteral = int_value 6 [template = constants.%.4] +// CHECK:STDOUT: %.loc14_42: Core.IntLiteral = int_value 7 [template = constants.%.5] // CHECK:STDOUT: %.loc14_43: %.6 = struct_literal (%.loc14_26, %.loc14_34, %.loc14_42) // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -1122,9 +1148,9 @@ fn CallImplicitNotDeducible() { // CHECK:STDOUT: %WrongNameStructParam: %WrongNameStructParam.type = struct_value () [template] // CHECK:STDOUT: %CallWrongNameStructParam.type: type = fn_type @CallWrongNameStructParam [template] // CHECK:STDOUT: %CallWrongNameStructParam: %CallWrongNameStructParam.type = struct_value () [template] -// CHECK:STDOUT: %.3: i32 = int_value 8 [template] -// CHECK:STDOUT: %.4: i32 = int_value 9 [template] -// CHECK:STDOUT: %.5: type = struct_type {.i: i32, .j: i32} [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 8 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 9 [template] +// CHECK:STDOUT: %.5: type = struct_type {.i: Core.IntLiteral, .j: Core.IntLiteral} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -1177,8 +1203,8 @@ fn CallImplicitNotDeducible() { // CHECK:STDOUT: fn @CallWrongNameStructParam() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %WrongNameStructParam.ref: %WrongNameStructParam.type = name_ref WrongNameStructParam, file.%WrongNameStructParam.decl [template = constants.%WrongNameStructParam] -// CHECK:STDOUT: %.loc14_30: i32 = int_value 8 [template = constants.%.3] -// CHECK:STDOUT: %.loc14_38: i32 = int_value 9 [template = constants.%.4] +// CHECK:STDOUT: %.loc14_30: Core.IntLiteral = int_value 8 [template = constants.%.3] +// CHECK:STDOUT: %.loc14_38: Core.IntLiteral = int_value 9 [template = constants.%.4] // CHECK:STDOUT: %.loc14_39: %.5 = struct_literal (%.loc14_30, %.loc14_38) // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -1201,9 +1227,9 @@ fn CallImplicitNotDeducible() { // CHECK:STDOUT: %WrongOrderStructParam: %WrongOrderStructParam.type = struct_value () [template] // CHECK:STDOUT: %CallWrongOrderStructParam.type: type = fn_type @CallWrongOrderStructParam [template] // CHECK:STDOUT: %CallWrongOrderStructParam: %CallWrongOrderStructParam.type = struct_value () [template] -// CHECK:STDOUT: %.3: i32 = int_value 11 [template] -// CHECK:STDOUT: %.4: i32 = int_value 10 [template] -// CHECK:STDOUT: %.5: type = struct_type {.second: i32, .first: i32} [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 11 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 10 [template] +// CHECK:STDOUT: %.5: type = struct_type {.second: Core.IntLiteral, .first: Core.IntLiteral} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -1256,8 +1282,8 @@ fn CallImplicitNotDeducible() { // CHECK:STDOUT: fn @CallWrongOrderStructParam() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %WrongOrderStructParam.ref: %WrongOrderStructParam.type = name_ref WrongOrderStructParam, file.%WrongOrderStructParam.decl [template = constants.%WrongOrderStructParam] -// CHECK:STDOUT: %.loc14_36: i32 = int_value 11 [template = constants.%.3] -// CHECK:STDOUT: %.loc14_49: i32 = int_value 10 [template = constants.%.4] +// CHECK:STDOUT: %.loc14_36: Core.IntLiteral = int_value 11 [template = constants.%.3] +// CHECK:STDOUT: %.loc14_49: Core.IntLiteral = int_value 10 [template = constants.%.4] // CHECK:STDOUT: %.loc14_51: %.5 = struct_literal (%.loc14_36, %.loc14_49) // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -1279,7 +1305,7 @@ fn CallImplicitNotDeducible() { // CHECK:STDOUT: %ImplicitNotDeducible: %ImplicitNotDeducible.type = struct_value () [template] // CHECK:STDOUT: %CallImplicitNotDeducible.type: type = fn_type @CallImplicitNotDeducible [template] // CHECK:STDOUT: %CallImplicitNotDeducible: %CallImplicitNotDeducible.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 42 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 42 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -1332,7 +1358,7 @@ fn CallImplicitNotDeducible() { // CHECK:STDOUT: fn @CallImplicitNotDeducible() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %ImplicitNotDeducible.ref: %ImplicitNotDeducible.type = name_ref ImplicitNotDeducible, file.%ImplicitNotDeducible.decl [template = constants.%ImplicitNotDeducible] -// CHECK:STDOUT: %.loc16: i32 = int_value 42 [template = constants.%.1] +// CHECK:STDOUT: %.loc16: Core.IntLiteral = int_value 42 [template = constants.%.1] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1352,9 +1378,9 @@ fn CallImplicitNotDeducible() { // CHECK:STDOUT: %ImplicitNotDeducible: %ImplicitNotDeducible.type = struct_value () [template] // CHECK:STDOUT: %CallImplicitNotDeducible.type: type = fn_type @CallImplicitNotDeducible [template] // CHECK:STDOUT: %CallImplicitNotDeducible: %CallImplicitNotDeducible.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 42 [template] -// CHECK:STDOUT: %.2: i32 = int_value 12 [template] -// CHECK:STDOUT: %.3: type = struct_type {.x: i32} [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 42 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 12 [template] +// CHECK:STDOUT: %.3: type = struct_type {.x: Core.IntLiteral} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -1406,8 +1432,8 @@ fn CallImplicitNotDeducible() { // CHECK:STDOUT: fn @CallImplicitNotDeducible() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %ImplicitNotDeducible.ref: %ImplicitNotDeducible.type = name_ref ImplicitNotDeducible, file.%ImplicitNotDeducible.decl [template = constants.%ImplicitNotDeducible] -// CHECK:STDOUT: %.loc13_24: i32 = int_value 42 [template = constants.%.1] -// CHECK:STDOUT: %.loc13_34: i32 = int_value 12 [template = constants.%.2] +// CHECK:STDOUT: %.loc13_24: Core.IntLiteral = int_value 42 [template = constants.%.1] +// CHECK:STDOUT: %.loc13_34: Core.IntLiteral = int_value 12 [template = constants.%.2] // CHECK:STDOUT: %.loc13_36: %.3 = struct_literal (%.loc13_34) // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/generic/resolve_used.carbon b/toolchain/check/testdata/function/generic/resolve_used.carbon index b135d27cfb128..391ad8477a91c 100644 --- a/toolchain/check/testdata/function/generic/resolve_used.carbon +++ b/toolchain/check/testdata/function/generic/resolve_used.carbon @@ -42,21 +42,14 @@ fn CallNegative() { // CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic] // CHECK:STDOUT: %CallNegative.type: type = fn_type @CallNegative [template] // CHECK:STDOUT: %CallNegative: %CallNegative.type = struct_value () [template] -// CHECK:STDOUT: %.2: i32 = int_value 0 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [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: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.26: = bound_method %.2, %Convert.15 [template] -// CHECK:STDOUT: %.27: Core.IntLiteral = int_value 0 [template] -// CHECK:STDOUT: %.28: = specific_function %ErrorIfNIsZero, @ErrorIfNIsZero(%.27) [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %.3: = specific_function %ErrorIfNIsZero, @ErrorIfNIsZero(%.2) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .IntLiteral = %import_ref.1 // CHECK:STDOUT: .Int = %import_ref.2 -// CHECK:STDOUT: .ImplicitAs = %import_ref.3 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -110,13 +103,8 @@ fn CallNegative() { // CHECK:STDOUT: fn @CallNegative() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %ErrorIfNIsZero.ref: %ErrorIfNIsZero.type = name_ref ErrorIfNIsZero, file.%ErrorIfNIsZero.decl [template = constants.%ErrorIfNIsZero] -// CHECK:STDOUT: %.loc16_18: i32 = int_value 0 [template = constants.%.2] -// CHECK:STDOUT: %.loc16_17.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc16_17.2: = bound_method %.loc16_18, %.loc16_17.1 [template = constants.%.26] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc16_17.2(%.loc16_18) [template = constants.%.27] -// CHECK:STDOUT: %.loc16_17.3: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.27] -// CHECK:STDOUT: %.loc16_17.4: Core.IntLiteral = converted %.loc16_18, %.loc16_17.3 [template = constants.%.27] -// CHECK:STDOUT: %.loc16_3: = specific_function %ErrorIfNIsZero.ref, @ErrorIfNIsZero(constants.%.27) [template = constants.%.28] +// CHECK:STDOUT: %.loc16_18: Core.IntLiteral = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc16_3: = specific_function %ErrorIfNIsZero.ref, @ErrorIfNIsZero(constants.%.2) [template = constants.%.3] // CHECK:STDOUT: %ErrorIfNIsZero.call: init %empty_tuple.type = call %.loc16_3() // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -126,9 +114,9 @@ fn CallNegative() { // CHECK:STDOUT: %N.patt.loc4_19.2 => constants.%N // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @ErrorIfNIsZero(constants.%.27) { -// CHECK:STDOUT: %N.loc4_19.2 => constants.%.27 -// CHECK:STDOUT: %N.patt.loc4_19.2 => constants.%.27 +// CHECK:STDOUT: specific @ErrorIfNIsZero(constants.%.2) { +// CHECK:STDOUT: %N.loc4_19.2 => constants.%.2 +// CHECK:STDOUT: %N.patt.loc4_19.2 => constants.%.2 // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %.loc12_18 => diff --git a/toolchain/check/testdata/function/generic/return_slot.carbon b/toolchain/check/testdata/function/generic/return_slot.carbon index 1dc0e9dd94780..702dfccdd0f1e 100644 --- a/toolchain/check/testdata/function/generic/return_slot.carbon +++ b/toolchain/check/testdata/function/generic/return_slot.carbon @@ -37,37 +37,30 @@ fn G() { // CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.4: i32 = int_value 100 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] -// CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template] -// CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template] -// CHECK:STDOUT: %.28: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.29: = bound_method %.4, %Convert.15 [template] -// CHECK:STDOUT: %.30: Core.IntLiteral = int_value 100 [template] -// CHECK:STDOUT: %.31: type = array_type %.30, i32 [template] -// CHECK:STDOUT: %.33: type = unbound_element_type %C, %.31 [template] -// CHECK:STDOUT: %.34: type = struct_type {.arr: %.31} [template] -// CHECK:STDOUT: %.35: = complete_type_witness %.34 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 100 [template] +// CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] +// CHECK:STDOUT: %.7: type = unbound_element_type %C, %.5 [template] +// CHECK:STDOUT: %.8: type = struct_type {.arr: %.5} [template] +// CHECK:STDOUT: %.9: = complete_type_witness %.8 [template] // CHECK:STDOUT: %G.type: type = fn_type @G [template] // CHECK:STDOUT: %G: %G.type = struct_value () [template] // CHECK:STDOUT: %Wrap.3: type = class_type @Wrap, @Wrap(i32) [template] // CHECK:STDOUT: %Make.type.2: type = fn_type @Make, @Wrap(i32) [template] // CHECK:STDOUT: %Make.2: %Make.type.2 = struct_value () [template] -// CHECK:STDOUT: %.37: = specific_function %Make.2, @Make(i32) [template] +// CHECK:STDOUT: %.11: = specific_function %Make.2, @Make(i32) [template] // CHECK:STDOUT: %Wrap.4: type = class_type @Wrap, @Wrap(%empty_tuple.type) [template] // CHECK:STDOUT: %Make.type.3: type = fn_type @Make, @Wrap(%empty_tuple.type) [template] // CHECK:STDOUT: %Make.3: %Make.type.3 = struct_value () [template] -// CHECK:STDOUT: %.38: = specific_function %Make.3, @Make(%empty_tuple.type) [template] +// CHECK:STDOUT: %.12: = specific_function %Make.3, @Make(%empty_tuple.type) [template] // CHECK:STDOUT: %Wrap.5: type = class_type @Wrap, @Wrap(%C) [template] // CHECK:STDOUT: %Make.type.4: type = fn_type @Make, @Wrap(%C) [template] // CHECK:STDOUT: %Make.4: %Make.type.4 = struct_value () [template] -// CHECK:STDOUT: %.41: = specific_function %Make.4, @Make(%C) [template] +// CHECK:STDOUT: %.15: = specific_function %Make.4, @Make(%C) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.2 +// CHECK:STDOUT: .Int32 = %import_ref // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -119,17 +112,12 @@ fn G() { // CHECK:STDOUT: // CHECK:STDOUT: class @C { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc15_26.1: i32 = int_value 100 [template = constants.%.4] +// CHECK:STDOUT: %.loc15_26: Core.IntLiteral = int_value 100 [template = constants.%.4] // CHECK:STDOUT: %.loc15_21.1: type = value_of_initializer %int.make_type_32 [template = i32] // CHECK:STDOUT: %.loc15_21.2: type = converted %int.make_type_32, %.loc15_21.1 [template = i32] -// CHECK:STDOUT: %.loc15_26.2: %Convert.type.2 = interface_witness_access constants.%.28, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc15_26.3: = bound_method %.loc15_26.1, %.loc15_26.2 [template = constants.%.29] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc15_26.3(%.loc15_26.1) [template = constants.%.30] -// CHECK:STDOUT: %.loc15_26.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.30] -// CHECK:STDOUT: %.loc15_26.5: Core.IntLiteral = converted %.loc15_26.1, %.loc15_26.4 [template = constants.%.30] -// CHECK:STDOUT: %.loc15_29: type = array_type %.loc15_26.5, i32 [template = constants.%.31] -// CHECK:STDOUT: %.loc15_18: %.33 = field_decl arr, element0 [template] -// CHECK:STDOUT: %.loc15_32: = complete_type_witness %.34 [template = constants.%.35] +// CHECK:STDOUT: %.loc15_29: type = array_type %.loc15_26, i32 [template = constants.%.5] +// CHECK:STDOUT: %.loc15_18: %.7 = field_decl arr, element0 [template] +// CHECK:STDOUT: %.loc15_32: = complete_type_witness %.8 [template = constants.%.9] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C @@ -170,7 +158,7 @@ fn G() { // CHECK:STDOUT: %Wrap.loc18: type = class_type @Wrap, @Wrap(i32) [template = constants.%Wrap.3] // CHECK:STDOUT: %.loc18_25.1: %Make.type.2 = specific_constant @Wrap.%Make.decl, @Wrap(i32) [template = constants.%Make.2] // CHECK:STDOUT: %Make.ref.loc18: %Make.type.2 = name_ref Make, %.loc18_25.1 [template = constants.%Make.2] -// CHECK:STDOUT: %.loc18_25.2: = specific_function %Make.ref.loc18, @Make(i32) [template = constants.%.37] +// CHECK:STDOUT: %.loc18_25.2: = specific_function %Make.ref.loc18, @Make(i32) [template = constants.%.11] // CHECK:STDOUT: %Make.call.loc18: init i32 = call %.loc18_25.2() // CHECK:STDOUT: assign %a.var, %Make.call.loc18 // CHECK:STDOUT: %.loc19_11.1: %empty_tuple.type = tuple_literal () @@ -183,7 +171,7 @@ fn G() { // CHECK:STDOUT: %Wrap.loc19: type = class_type @Wrap, @Wrap(constants.%empty_tuple.type) [template = constants.%Wrap.4] // CHECK:STDOUT: %.loc19_23.1: %Make.type.3 = specific_constant @Wrap.%Make.decl, @Wrap(constants.%empty_tuple.type) [template = constants.%Make.3] // CHECK:STDOUT: %Make.ref.loc19: %Make.type.3 = name_ref Make, %.loc19_23.1 [template = constants.%Make.3] -// CHECK:STDOUT: %.loc19_23.2: = specific_function %Make.ref.loc19, @Make(constants.%empty_tuple.type) [template = constants.%.38] +// CHECK:STDOUT: %.loc19_23.2: = specific_function %Make.ref.loc19, @Make(constants.%empty_tuple.type) [template = constants.%.12] // CHECK:STDOUT: %Make.call.loc19: init %empty_tuple.type = call %.loc19_23.2() // CHECK:STDOUT: assign %b.var, %Make.call.loc19 // CHECK:STDOUT: %C.ref.loc20_10: type = name_ref C, file.%C.decl [template = constants.%C] @@ -194,7 +182,7 @@ fn G() { // CHECK:STDOUT: %Wrap.loc20: type = class_type @Wrap, @Wrap(constants.%C) [template = constants.%Wrap.5] // CHECK:STDOUT: %.loc20_21.1: %Make.type.4 = specific_constant @Wrap.%Make.decl, @Wrap(constants.%C) [template = constants.%Make.4] // CHECK:STDOUT: %Make.ref.loc20: %Make.type.4 = name_ref Make, %.loc20_21.1 [template = constants.%Make.4] -// CHECK:STDOUT: %.loc20_21.2: = specific_function %Make.ref.loc20, @Make(constants.%C) [template = constants.%.41] +// CHECK:STDOUT: %.loc20_21.2: = specific_function %Make.ref.loc20, @Make(constants.%C) [template = constants.%.15] // CHECK:STDOUT: %.loc20_7: ref %C = splice_block %c.var {} // CHECK:STDOUT: %Make.call.loc20: init %C = call %.loc20_21.2() to %.loc20_7 // CHECK:STDOUT: assign %c.var, %Make.call.loc20 @@ -248,7 +236,7 @@ fn G() { // CHECK:STDOUT: !definition: // CHECK:STDOUT: %Make.type => constants.%Make.type.2 // CHECK:STDOUT: %Make => constants.%Make.2 -// CHECK:STDOUT: %.loc12_27.3 => constants.%.37 +// CHECK:STDOUT: %.loc12_27.3 => constants.%.11 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Wrap(constants.%empty_tuple.type) { @@ -266,7 +254,7 @@ fn G() { // CHECK:STDOUT: !definition: // CHECK:STDOUT: %Make.type => constants.%Make.type.3 // CHECK:STDOUT: %Make => constants.%Make.3 -// CHECK:STDOUT: %.loc12_27.3 => constants.%.38 +// CHECK:STDOUT: %.loc12_27.3 => constants.%.12 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Wrap(constants.%C) { @@ -284,6 +272,6 @@ fn G() { // CHECK:STDOUT: !definition: // CHECK:STDOUT: %Make.type => constants.%Make.type.4 // CHECK:STDOUT: %Make => constants.%Make.4 -// CHECK:STDOUT: %.loc12_27.3 => constants.%.41 +// CHECK:STDOUT: %.loc12_27.3 => constants.%.15 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/generic/undefined.carbon b/toolchain/check/testdata/function/generic/undefined.carbon index 64c38a8216a29..8e793ed73c2bc 100644 --- a/toolchain/check/testdata/function/generic/undefined.carbon +++ b/toolchain/check/testdata/function/generic/undefined.carbon @@ -17,7 +17,7 @@ fn Defined[T:! type](x: T) -> T { } fn CallDefined() -> i32 { - return Defined(0); + return Defined(0 as i32); } // --- call_defined_late.carbon @@ -27,7 +27,7 @@ library "[[@TEST_NAME]]"; fn Defined[T:! type](x: T) -> T; fn CallDefined() -> i32 { - return Defined(0); + return Defined(0 as i32); } fn Defined[T:! type](x: T) -> T { @@ -42,12 +42,12 @@ fn Undefined[T:! type](x: T) -> T; fn CallUndefined() -> i32 { // CHECK:STDERR: fail_call_undefined.carbon:[[@LINE+6]]:10: error: use of undefined generic function [MissingGenericFunctionDefinition] - // CHECK:STDERR: return Undefined(0); + // CHECK:STDERR: return Undefined(0 as i32); // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: fail_call_undefined.carbon:[[@LINE-6]]:1: note: generic function declared here [MissingGenericFunctionDefinitionHere] // CHECK:STDERR: fn Undefined[T:! type](x: T) -> T; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - return Undefined(0); + return Undefined(0 as i32); } // CHECK:STDOUT: --- call_defined.carbon @@ -61,13 +61,20 @@ fn CallUndefined() -> i32 { // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %CallDefined.type: type = fn_type @CallDefined [template] // CHECK:STDOUT: %CallDefined: %CallDefined.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] -// CHECK:STDOUT: %.2: = specific_function %Defined, @Defined(i32) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @As(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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 0 [template] +// CHECK:STDOUT: %.28: = specific_function %Defined, @Defined(i32) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .As = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -101,9 +108,9 @@ fn CallUndefined() -> i32 { // CHECK:STDOUT: %return.patt: i32 = return_slot_pattern // CHECK:STDOUT: %return.param_patt: i32 = out_param_pattern %return.patt, runtime_param0 // CHECK:STDOUT: } { -// CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc8_21.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc8_21.2: type = converted %int.make_type_32, %.loc8_21.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%Int32() [template = i32] +// CHECK:STDOUT: %.loc8_21.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] +// CHECK:STDOUT: %.loc8_21.2: type = converted %int.make_type_32.loc8, %.loc8_21.1 [template = i32] // CHECK:STDOUT: %return.param: ref i32 = out_param runtime_param0 // CHECK:STDOUT: %return: ref i32 = return_slot %return.param // CHECK:STDOUT: } @@ -125,12 +132,20 @@ fn CallUndefined() -> i32 { // CHECK:STDOUT: fn @CallDefined() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Defined.ref: %Defined.type = name_ref Defined, file.%Defined.decl [template = constants.%Defined] -// CHECK:STDOUT: %.loc9_18: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: %.loc9_10: = specific_function %Defined.ref, @Defined(i32) [template = constants.%.2] -// CHECK:STDOUT: %Defined.call: init i32 = call %.loc9_10(%.loc9_18) -// CHECK:STDOUT: %.loc9_20.1: i32 = value_of_initializer %Defined.call -// CHECK:STDOUT: %.loc9_20.2: i32 = converted %Defined.call, %.loc9_20.1 -// CHECK:STDOUT: return %.loc9_20.2 +// CHECK:STDOUT: %.loc9_18: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%Int32() [template = i32] +// CHECK:STDOUT: %.loc9_23.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] +// CHECK:STDOUT: %.loc9_23.2: type = converted %int.make_type_32.loc9, %.loc9_23.1 [template = i32] +// CHECK:STDOUT: %.loc9_20.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_20.2: = bound_method %.loc9_18, %.loc9_20.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc9_20.2(%.loc9_18) [template = constants.%.27] +// CHECK:STDOUT: %.loc9_20.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc9_20.4: i32 = converted %.loc9_18, %.loc9_20.3 [template = constants.%.27] +// CHECK:STDOUT: %.loc9_10: = specific_function %Defined.ref, @Defined(i32) [template = constants.%.28] +// CHECK:STDOUT: %Defined.call: init i32 = call %.loc9_10(%.loc9_20.4) +// CHECK:STDOUT: %.loc9_27.1: i32 = value_of_initializer %Defined.call +// CHECK:STDOUT: %.loc9_27.2: i32 = converted %Defined.call, %.loc9_27.1 +// CHECK:STDOUT: return %.loc9_27.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Defined(constants.%T) { @@ -156,13 +171,20 @@ fn CallUndefined() -> i32 { // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %CallDefined.type: type = fn_type @CallDefined [template] // CHECK:STDOUT: %CallDefined: %CallDefined.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] -// CHECK:STDOUT: %.2: = specific_function %Defined, @Defined(i32) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @As(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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 0 [template] +// CHECK:STDOUT: %.28: = specific_function %Defined, @Defined(i32) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .As = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -196,9 +218,9 @@ fn CallUndefined() -> i32 { // CHECK:STDOUT: %return.patt: i32 = return_slot_pattern // CHECK:STDOUT: %return.param_patt: i32 = out_param_pattern %return.patt, runtime_param0 // CHECK:STDOUT: } { -// CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc6_21.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc6_21.2: type = converted %int.make_type_32, %.loc6_21.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc6: init type = call constants.%Int32() [template = i32] +// CHECK:STDOUT: %.loc6_21.1: type = value_of_initializer %int.make_type_32.loc6 [template = i32] +// CHECK:STDOUT: %.loc6_21.2: type = converted %int.make_type_32.loc6, %.loc6_21.1 [template = i32] // CHECK:STDOUT: %return.param: ref i32 = out_param runtime_param0 // CHECK:STDOUT: %return: ref i32 = return_slot %return.param // CHECK:STDOUT: } @@ -237,12 +259,20 @@ fn CallUndefined() -> i32 { // CHECK:STDOUT: fn @CallDefined() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Defined.ref: %Defined.type = name_ref Defined, file.%Defined.decl.loc4 [template = constants.%Defined] -// CHECK:STDOUT: %.loc7_18: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: %.loc7_10: = specific_function %Defined.ref, @Defined(i32) [template = constants.%.2] -// CHECK:STDOUT: %Defined.call: init i32 = call %.loc7_10(%.loc7_18) -// CHECK:STDOUT: %.loc7_20.1: i32 = value_of_initializer %Defined.call -// CHECK:STDOUT: %.loc7_20.2: i32 = converted %Defined.call, %.loc7_20.1 -// CHECK:STDOUT: return %.loc7_20.2 +// CHECK:STDOUT: %.loc7_18: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%Int32() [template = i32] +// CHECK:STDOUT: %.loc7_23.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] +// CHECK:STDOUT: %.loc7_23.2: type = converted %int.make_type_32.loc7, %.loc7_23.1 [template = i32] +// CHECK:STDOUT: %.loc7_20.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc7_20.2: = bound_method %.loc7_18, %.loc7_20.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc7_20.2(%.loc7_18) [template = constants.%.27] +// CHECK:STDOUT: %.loc7_20.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc7_20.4: i32 = converted %.loc7_18, %.loc7_20.3 [template = constants.%.27] +// CHECK:STDOUT: %.loc7_10: = specific_function %Defined.ref, @Defined(i32) [template = constants.%.28] +// CHECK:STDOUT: %Defined.call: init i32 = call %.loc7_10(%.loc7_20.4) +// CHECK:STDOUT: %.loc7_27.1: i32 = value_of_initializer %Defined.call +// CHECK:STDOUT: %.loc7_27.2: i32 = converted %Defined.call, %.loc7_27.1 +// CHECK:STDOUT: return %.loc7_27.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Defined(constants.%T) { @@ -268,13 +298,20 @@ fn CallUndefined() -> i32 { // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %CallUndefined.type: type = fn_type @CallUndefined [template] // CHECK:STDOUT: %CallUndefined: %CallUndefined.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] -// CHECK:STDOUT: %.2: = specific_function %Undefined, @Undefined(i32) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @As(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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 0 [template] +// CHECK:STDOUT: %.28: = specific_function %Undefined, @Undefined(i32) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .As = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -308,9 +345,9 @@ fn CallUndefined() -> i32 { // CHECK:STDOUT: %return.patt: i32 = return_slot_pattern // CHECK:STDOUT: %return.param_patt: i32 = out_param_pattern %return.patt, runtime_param0 // CHECK:STDOUT: } { -// CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc6_23.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc6_23.2: type = converted %int.make_type_32, %.loc6_23.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc6: init type = call constants.%Int32() [template = i32] +// CHECK:STDOUT: %.loc6_23.1: type = value_of_initializer %int.make_type_32.loc6 [template = i32] +// CHECK:STDOUT: %.loc6_23.2: type = converted %int.make_type_32.loc6, %.loc6_23.1 [template = i32] // CHECK:STDOUT: %return.param: ref i32 = out_param runtime_param0 // CHECK:STDOUT: %return: ref i32 = return_slot %return.param // CHECK:STDOUT: } @@ -326,12 +363,20 @@ fn CallUndefined() -> i32 { // CHECK:STDOUT: fn @CallUndefined() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Undefined.ref: %Undefined.type = name_ref Undefined, file.%Undefined.decl [template = constants.%Undefined] -// CHECK:STDOUT: %.loc13_20: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: %.loc13_10: = specific_function %Undefined.ref, @Undefined(i32) [template = constants.%.2] -// CHECK:STDOUT: %Undefined.call: init i32 = call %.loc13_10(%.loc13_20) -// CHECK:STDOUT: %.loc13_22.1: i32 = value_of_initializer %Undefined.call -// CHECK:STDOUT: %.loc13_22.2: i32 = converted %Undefined.call, %.loc13_22.1 -// CHECK:STDOUT: return %.loc13_22.2 +// CHECK:STDOUT: %.loc13_20: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%Int32() [template = i32] +// CHECK:STDOUT: %.loc13_25.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_25.2: type = converted %int.make_type_32.loc13, %.loc13_25.1 [template = i32] +// CHECK:STDOUT: %.loc13_22.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_22.2: = bound_method %.loc13_20, %.loc13_22.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc13_22.2(%.loc13_20) [template = constants.%.27] +// CHECK:STDOUT: %.loc13_22.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc13_22.4: i32 = converted %.loc13_20, %.loc13_22.3 [template = constants.%.27] +// CHECK:STDOUT: %.loc13_10: = specific_function %Undefined.ref, @Undefined(i32) [template = constants.%.28] +// CHECK:STDOUT: %Undefined.call: init i32 = call %.loc13_10(%.loc13_22.4) +// CHECK:STDOUT: %.loc13_29.1: i32 = value_of_initializer %Undefined.call +// CHECK:STDOUT: %.loc13_29.2: i32 = converted %Undefined.call, %.loc13_29.1 +// CHECK:STDOUT: return %.loc13_29.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Undefined(constants.%T) { diff --git a/toolchain/check/testdata/global/simple_init.carbon b/toolchain/check/testdata/global/simple_init.carbon index c73e4d9ce407e..01ceb4ec10045 100644 --- a/toolchain/check/testdata/global/simple_init.carbon +++ b/toolchain/check/testdata/global/simple_init.carbon @@ -14,12 +14,19 @@ var a: i32 = 0; // CHECK:STDOUT: constants { // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -40,8 +47,12 @@ var a: i32 = 0; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: assign file.%a.var, %.loc10 +// CHECK:STDOUT: %.loc10_14: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc10_15.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc10_15.2: = bound_method %.loc10_14, %.loc10_15.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc10_15.2(%.loc10_14) [template = constants.%.27] +// CHECK:STDOUT: %.loc10_15.3: init i32 = converted %.loc10_14, %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: assign file.%a.var, %.loc10_15.3 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/global/simple_with_fun.carbon b/toolchain/check/testdata/global/simple_with_fun.carbon index 94554a6a6c33b..507072c54ec7f 100644 --- a/toolchain/check/testdata/global/simple_with_fun.carbon +++ b/toolchain/check/testdata/global/simple_with_fun.carbon @@ -21,12 +21,19 @@ var a: i32 = test_a(); // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %test_a.type: type = fn_type @test_a [template] // CHECK:STDOUT: %test_a: %test_a.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -58,8 +65,13 @@ var a: i32 = test_a(); // CHECK:STDOUT: // CHECK:STDOUT: fn @test_a() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc12: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: return %.loc12 +// CHECK:STDOUT: %.loc12_10: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc12_11.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_11.2: = bound_method %.loc12_10, %.loc12_11.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc12_11.2(%.loc12_10) [template = constants.%.27] +// CHECK:STDOUT: %.loc12_11.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc12_11.4: i32 = converted %.loc12_10, %.loc12_11.3 [template = constants.%.27] +// CHECK:STDOUT: return %.loc12_11.4 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { diff --git a/toolchain/check/testdata/if/fail_reachable_fallthrough.carbon b/toolchain/check/testdata/if/fail_reachable_fallthrough.carbon index 15cd998f08680..ef66a5355d056 100644 --- a/toolchain/check/testdata/if/fail_reachable_fallthrough.carbon +++ b/toolchain/check/testdata/if/fail_reachable_fallthrough.carbon @@ -48,10 +48,18 @@ fn If3(b: bool) -> i32 { // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %If1.type: type = fn_type @If1 [template] // CHECK:STDOUT: %If1: %If1.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 1 [template] // CHECK:STDOUT: %If2.type: type = fn_type @If2 [template] // CHECK:STDOUT: %If2: %If2.type = struct_value () [template] -// CHECK:STDOUT: %.2: i32 = int_value 2 [template] +// CHECK:STDOUT: %.28: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.29: = bound_method %.28, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 2 [template] // CHECK:STDOUT: %If3.type: type = fn_type @If3 [template] // CHECK:STDOUT: %If3: %If3.type = struct_value () [template] // CHECK:STDOUT: } @@ -60,6 +68,7 @@ fn If3(b: bool) -> i32 { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Bool = %import_ref.1 // CHECK:STDOUT: .Int32 = %import_ref.2 +// CHECK:STDOUT: .ImplicitAs = %import_ref.3 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -132,8 +141,13 @@ fn If3(b: bool) -> i32 { // CHECK:STDOUT: if %b.ref br !if.then else br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.then: -// CHECK:STDOUT: %.loc13: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: return %.loc13 +// CHECK:STDOUT: %.loc13_12: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc13_13.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_13.2: = bound_method %.loc13_12, %.loc13_13.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc13_13.2(%.loc13_12) [template = constants.%.27] +// CHECK:STDOUT: %.loc13_13.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc13_13.4: i32 = converted %.loc13_12, %.loc13_13.3 [template = constants.%.27] +// CHECK:STDOUT: return %.loc13_13.4 // CHECK:STDOUT: // CHECK:STDOUT: !if.else: // CHECK:STDOUT: br !if.done @@ -150,8 +164,13 @@ fn If3(b: bool) -> i32 { // CHECK:STDOUT: br !if.done // CHECK:STDOUT: // CHECK:STDOUT: !if.else: -// CHECK:STDOUT: %.loc25: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: return %.loc25 +// CHECK:STDOUT: %.loc25_12: Core.IntLiteral = int_value 2 [template = constants.%.28] +// CHECK:STDOUT: %.loc25_13.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc25_13.2: = bound_method %.loc25_12, %.loc25_13.1 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc25_13.2(%.loc25_12) [template = constants.%.30] +// CHECK:STDOUT: %.loc25_13.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.30] +// CHECK:STDOUT: %.loc25_13.4: i32 = converted %.loc25_12, %.loc25_13.3 [template = constants.%.30] +// CHECK:STDOUT: return %.loc25_13.4 // CHECK:STDOUT: // CHECK:STDOUT: !if.done: // CHECK:STDOUT: } @@ -162,8 +181,13 @@ fn If3(b: bool) -> i32 { // CHECK:STDOUT: if %b.ref br !if.then else br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.then: -// CHECK:STDOUT: %.loc35: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: return %.loc35 +// CHECK:STDOUT: %.loc35_12: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc35_13.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc35_13.2: = bound_method %.loc35_12, %.loc35_13.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc35_13.2(%.loc35_12) [template = constants.%.27] +// CHECK:STDOUT: %.loc35_13.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc35_13.4: i32 = converted %.loc35_12, %.loc35_13.3 [template = constants.%.27] +// CHECK:STDOUT: return %.loc35_13.4 // CHECK:STDOUT: // CHECK:STDOUT: !if.else: // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/if/fail_scope.carbon b/toolchain/check/testdata/if/fail_scope.carbon index ff8f765ff4150..bd501d34a6276 100644 --- a/toolchain/check/testdata/if/fail_scope.carbon +++ b/toolchain/check/testdata/if/fail_scope.carbon @@ -28,13 +28,20 @@ fn VarScope(b: bool) -> i32 { // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %VarScope.type: type = fn_type @VarScope [template] // CHECK:STDOUT: %VarScope: %VarScope.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 2 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 2 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Bool = %import_ref.1 // CHECK:STDOUT: .Int32 = %import_ref.2 +// CHECK:STDOUT: .ImplicitAs = %import_ref.3 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -76,8 +83,12 @@ fn VarScope(b: bool) -> i32 { // CHECK:STDOUT: %.loc13_12.2: type = converted %int.make_type_32.loc13, %.loc13_12.1 [template = i32] // CHECK:STDOUT: %n.var: ref i32 = var n // CHECK:STDOUT: %n: ref i32 = bind_name n, %n.var -// CHECK:STDOUT: %.loc13_18: i32 = int_value 2 [template = constants.%.1] -// CHECK:STDOUT: assign %n.var, %.loc13_18 +// CHECK:STDOUT: %.loc13_18: Core.IntLiteral = int_value 2 [template = constants.%.1] +// CHECK:STDOUT: %.loc13_19.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_19.2: = bound_method %.loc13_18, %.loc13_19.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc13_19.2(%.loc13_18) [template = constants.%.27] +// CHECK:STDOUT: %.loc13_19.3: init i32 = converted %.loc13_18, %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: assign %n.var, %.loc13_19.3 // CHECK:STDOUT: %n.ref.loc14: ref i32 = name_ref n, %n // CHECK:STDOUT: %.loc14: i32 = bind_value %n.ref.loc14 // CHECK:STDOUT: return %.loc14 diff --git a/toolchain/check/testdata/if/unreachable_fallthrough.carbon b/toolchain/check/testdata/if/unreachable_fallthrough.carbon index 1c8ec35cdae17..a0449ff2b530e 100644 --- a/toolchain/check/testdata/if/unreachable_fallthrough.carbon +++ b/toolchain/check/testdata/if/unreachable_fallthrough.carbon @@ -26,14 +26,23 @@ fn If(b: bool) -> i32 { // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %If.type: type = fn_type @If [template] // CHECK:STDOUT: %If: %If.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %.2: i32 = int_value 2 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 1 [template] +// CHECK:STDOUT: %.28: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.29: = bound_method %.28, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Bool = %import_ref.1 // CHECK:STDOUT: .Int32 = %import_ref.2 +// CHECK:STDOUT: .ImplicitAs = %import_ref.3 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -70,11 +79,21 @@ fn If(b: bool) -> i32 { // CHECK:STDOUT: if %b.ref br !if.then else br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.then: -// CHECK:STDOUT: %.loc13: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: return %.loc13 +// CHECK:STDOUT: %.loc13_12: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc13_13.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_13.2: = bound_method %.loc13_12, %.loc13_13.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc13: init i32 = call %.loc13_13.2(%.loc13_12) [template = constants.%.27] +// CHECK:STDOUT: %.loc13_13.3: i32 = value_of_initializer %int.convert_checked.loc13 [template = constants.%.27] +// CHECK:STDOUT: %.loc13_13.4: i32 = converted %.loc13_12, %.loc13_13.3 [template = constants.%.27] +// CHECK:STDOUT: return %.loc13_13.4 // CHECK:STDOUT: // CHECK:STDOUT: !if.else: -// CHECK:STDOUT: %.loc15: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: return %.loc15 +// CHECK:STDOUT: %.loc15_12: Core.IntLiteral = int_value 2 [template = constants.%.28] +// CHECK:STDOUT: %.loc15_13.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc15_13.2: = bound_method %.loc15_12, %.loc15_13.1 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc15: init i32 = call %.loc15_13.2(%.loc15_12) [template = constants.%.30] +// CHECK:STDOUT: %.loc15_13.3: i32 = value_of_initializer %int.convert_checked.loc15 [template = constants.%.30] +// CHECK:STDOUT: %.loc15_13.4: i32 = converted %.loc15_12, %.loc15_13.3 [template = constants.%.30] +// CHECK:STDOUT: return %.loc15_13.4 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/if_expr/basic.carbon b/toolchain/check/testdata/if_expr/basic.carbon index 8ce9e4cdf890b..1344df7efd738 100644 --- a/toolchain/check/testdata/if_expr/basic.carbon +++ b/toolchain/check/testdata/if_expr/basic.carbon @@ -22,17 +22,17 @@ fn F(b: bool, n: i32, m: i32) -> i32 { // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.2: type = array_type %.1, i32 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %tuple.type: type = tuple_type (Core.IntLiteral) [template] +// CHECK:STDOUT: %.5: i32 = int_value 0 [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: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] -// CHECK:STDOUT: %.27: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %.28: type = array_type %.27, i32 [template] -// CHECK:STDOUT: %.30: i32 = int_value 0 [template] -// CHECK:STDOUT: %tuple.type: type = tuple_type (i32) [template] -// CHECK:STDOUT: %array: %.28 = tuple_value (%.30) [template] +// CHECK:STDOUT: %.29: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.30: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %array: %.2 = tuple_value (%.5) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -87,37 +87,36 @@ fn F(b: bool, n: i32, m: i32) -> i32 { // CHECK:STDOUT: fn @F(%b.param_patt: bool, %n.param_patt: i32, %m.param_patt: i32) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc12_16.1: i32 = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc12_16: Core.IntLiteral = int_value 1 [template = constants.%.1] // CHECK:STDOUT: %.loc12_11.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] // CHECK:STDOUT: %.loc12_11.2: type = converted %int.make_type_32.loc12, %.loc12_11.1 [template = i32] -// CHECK:STDOUT: %.loc12_16.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc12_16.3: = bound_method %.loc12_16.1, %.loc12_16.2 [template = constants.%.26] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc12_16.3(%.loc12_16.1) [template = constants.%.27] -// CHECK:STDOUT: %.loc12_16.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.27] -// CHECK:STDOUT: %.loc12_16.5: Core.IntLiteral = converted %.loc12_16.1, %.loc12_16.4 [template = constants.%.27] -// CHECK:STDOUT: %.loc12_17: type = array_type %.loc12_16.5, i32 [template = constants.%.28] -// CHECK:STDOUT: %x.var: ref %.28 = var x -// CHECK:STDOUT: %x: ref %.28 = bind_name x, %x.var -// CHECK:STDOUT: %.loc12_22: i32 = int_value 0 [template = constants.%.30] +// CHECK:STDOUT: %.loc12_17: type = array_type %.loc12_16, i32 [template = constants.%.2] +// CHECK:STDOUT: %x.var: ref %.2 = var x +// CHECK:STDOUT: %x: ref %.2 = bind_name x, %x.var +// CHECK:STDOUT: %.loc12_22: Core.IntLiteral = int_value 0 [template = constants.%.4] // CHECK:STDOUT: %.loc12_24.1: %tuple.type = tuple_literal (%.loc12_22) -// CHECK:STDOUT: %.loc12_24.2: i32 = int_value 0 [template = constants.%.30] -// CHECK:STDOUT: %.loc12_24.3: ref i32 = array_index %x.var, %.loc12_24.2 -// CHECK:STDOUT: %.loc12_24.4: init i32 = initialize_from %.loc12_22 to %.loc12_24.3 [template = constants.%.30] -// CHECK:STDOUT: %.loc12_24.5: init %.28 = array_init (%.loc12_24.4) to %x.var [template = constants.%array] -// CHECK:STDOUT: %.loc12_25: init %.28 = converted %.loc12_24.1, %.loc12_24.5 [template = constants.%array] +// CHECK:STDOUT: %.loc12_24.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_24.3: = bound_method %.loc12_22, %.loc12_24.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc12_24.3(%.loc12_22) [template = constants.%.5] +// CHECK:STDOUT: %.loc12_24.4: init i32 = converted %.loc12_22, %int.convert_checked [template = constants.%.5] +// CHECK:STDOUT: %.loc12_24.5: i32 = int_value 0 [template = constants.%.5] +// CHECK:STDOUT: %.loc12_24.6: ref i32 = array_index %x.var, %.loc12_24.5 +// CHECK:STDOUT: %.loc12_24.7: init i32 = initialize_from %.loc12_24.4 to %.loc12_24.6 [template = constants.%.5] +// CHECK:STDOUT: %.loc12_24.8: init %.2 = array_init (%.loc12_24.7) to %x.var [template = constants.%array] +// CHECK:STDOUT: %.loc12_25: init %.2 = converted %.loc12_24.1, %.loc12_24.8 [template = constants.%array] // CHECK:STDOUT: assign %x.var, %.loc12_25 // CHECK:STDOUT: %b.ref: bool = name_ref b, %b // CHECK:STDOUT: if %b.ref br !if.expr.then else br !if.expr.else // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then: -// CHECK:STDOUT: %x.ref.loc13_20: ref %.28 = name_ref x, %x +// CHECK:STDOUT: %x.ref.loc13_20: ref %.2 = name_ref x, %x // CHECK:STDOUT: %m.ref: i32 = name_ref m, %m // CHECK:STDOUT: %.loc13_23.1: ref i32 = array_index %x.ref.loc13_20, %m.ref // CHECK:STDOUT: %.loc13_23.2: i32 = bind_value %.loc13_23.1 // CHECK:STDOUT: br !if.expr.result(%.loc13_23.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else: -// CHECK:STDOUT: %x.ref.loc13_30: ref %.28 = name_ref x, %x +// CHECK:STDOUT: %x.ref.loc13_30: ref %.2 = name_ref x, %x // CHECK:STDOUT: %n.ref: i32 = name_ref n, %n // CHECK:STDOUT: %.loc13_33.1: ref i32 = array_index %x.ref.loc13_30, %n.ref // CHECK:STDOUT: %.loc13_33.2: i32 = bind_value %.loc13_33.1 diff --git a/toolchain/check/testdata/if_expr/constant_condition.carbon b/toolchain/check/testdata/if_expr/constant_condition.carbon index 574ee36f58981..33cb3ca83b3ee 100644 --- a/toolchain/check/testdata/if_expr/constant_condition.carbon +++ b/toolchain/check/testdata/if_expr/constant_condition.carbon @@ -38,26 +38,35 @@ fn PartiallyConstant(t: type) -> i32 { // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %A.type: type = fn_type @A [template] // CHECK:STDOUT: %A: %A.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 1 [template] // CHECK:STDOUT: %B.type: type = fn_type @B [template] // CHECK:STDOUT: %B: %B.type = struct_value () [template] -// CHECK:STDOUT: %.2: i32 = int_value 2 [template] +// CHECK:STDOUT: %.28: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.29: = bound_method %.28, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 2 [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %.3: bool = bool_literal true [template] +// CHECK:STDOUT: %.31: bool = bool_literal true [template] // CHECK:STDOUT: %G.type: type = fn_type @G [template] // CHECK:STDOUT: %G: %G.type = struct_value () [template] -// CHECK:STDOUT: %.4: bool = bool_literal false [template] +// CHECK:STDOUT: %.32: bool = bool_literal false [template] // CHECK:STDOUT: %Constant.type: type = fn_type @Constant [template] // CHECK:STDOUT: %Constant: %Constant.type = struct_value () [template] -// CHECK:STDOUT: %.5: type = ptr_type i32 [template] +// CHECK:STDOUT: %.33: type = ptr_type i32 [template] // CHECK:STDOUT: %PartiallyConstant.type: type = fn_type @PartiallyConstant [template] // CHECK:STDOUT: %PartiallyConstant: %PartiallyConstant.type = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -142,19 +151,29 @@ fn PartiallyConstant(t: type) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @A() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_24: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: return %.loc11_24 +// CHECK:STDOUT: %.loc11_24: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_25.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_25.2: = bound_method %.loc11_24, %.loc11_25.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc11_25.2(%.loc11_24) [template = constants.%.27] +// CHECK:STDOUT: %.loc11_25.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc11_25.4: i32 = converted %.loc11_24, %.loc11_25.3 [template = constants.%.27] +// CHECK:STDOUT: return %.loc11_25.4 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @B() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc12_24: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: return %.loc12_24 +// CHECK:STDOUT: %.loc12_24: Core.IntLiteral = int_value 2 [template = constants.%.28] +// CHECK:STDOUT: %.loc12_25.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_25.2: = bound_method %.loc12_24, %.loc12_25.1 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc12_25.2(%.loc12_24) [template = constants.%.30] +// CHECK:STDOUT: %.loc12_25.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.30] +// CHECK:STDOUT: %.loc12_25.4: i32 = converted %.loc12_24, %.loc12_25.3 [template = constants.%.30] +// CHECK:STDOUT: return %.loc12_25.4 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_13: bool = bool_literal true [template = constants.%.3] +// CHECK:STDOUT: %.loc15_13: bool = bool_literal true [template = constants.%.31] // CHECK:STDOUT: if %.loc15_13 br !if.expr.then else br !if.expr.else // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then: @@ -178,7 +197,7 @@ fn PartiallyConstant(t: type) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc19_13: bool = bool_literal false [template = constants.%.4] +// CHECK:STDOUT: %.loc19_13: bool = bool_literal false [template = constants.%.32] // CHECK:STDOUT: if %.loc19_13 br !if.expr.then else br !if.expr.else // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then: @@ -202,7 +221,7 @@ fn PartiallyConstant(t: type) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @Constant() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc23_13: bool = bool_literal true [template = constants.%.3] +// CHECK:STDOUT: %.loc23_13: bool = bool_literal true [template = constants.%.31] // CHECK:STDOUT: if %.loc23_13 br !if.expr.then.loc23 else br !if.expr.else.loc23 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc23: @@ -215,16 +234,20 @@ fn PartiallyConstant(t: type) -> i32 { // CHECK:STDOUT: %int.make_type_32.loc23_32: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc23_35.1: type = value_of_initializer %int.make_type_32.loc23_32 [template = i32] // CHECK:STDOUT: %.loc23_35.2: type = converted %int.make_type_32.loc23_32, %.loc23_35.1 [template = i32] -// CHECK:STDOUT: %.loc23_35.3: type = ptr_type i32 [template = constants.%.5] +// CHECK:STDOUT: %.loc23_35.3: type = ptr_type i32 [template = constants.%.33] // CHECK:STDOUT: br !if.expr.result.loc23(%.loc23_35.3) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc23: // CHECK:STDOUT: %.loc23_10: type = block_arg !if.expr.result.loc23 [template = i32] // CHECK:STDOUT: %v.var: ref i32 = var v // CHECK:STDOUT: %v: ref i32 = bind_name v, %v.var -// CHECK:STDOUT: %.loc23_39: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: assign %v.var, %.loc23_39 -// CHECK:STDOUT: %.loc24_13: bool = bool_literal false [template = constants.%.4] +// CHECK:STDOUT: %.loc23_39: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc23_40.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc23_40.2: = bound_method %.loc23_39, %.loc23_40.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc23_40.2(%.loc23_39) [template = constants.%.27] +// CHECK:STDOUT: %.loc23_40.3: init i32 = converted %.loc23_39, %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: assign %v.var, %.loc23_40.3 +// CHECK:STDOUT: %.loc24_13: bool = bool_literal false [template = constants.%.32] // CHECK:STDOUT: if %.loc24_13 br !if.expr.then.loc24 else br !if.expr.else.loc24 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc24: @@ -237,18 +260,18 @@ fn PartiallyConstant(t: type) -> i32 { // CHECK:STDOUT: %int.make_type_32.loc24_33: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc24_36.1: type = value_of_initializer %int.make_type_32.loc24_33 [template = i32] // CHECK:STDOUT: %.loc24_36.2: type = converted %int.make_type_32.loc24_33, %.loc24_36.1 [template = i32] -// CHECK:STDOUT: %.loc24_36.3: type = ptr_type i32 [template = constants.%.5] +// CHECK:STDOUT: %.loc24_36.3: type = ptr_type i32 [template = constants.%.33] // CHECK:STDOUT: br !if.expr.result.loc24(%.loc24_36.3) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc24: -// CHECK:STDOUT: %.loc24_10: type = block_arg !if.expr.result.loc24 [template = constants.%.5] -// CHECK:STDOUT: %w.var: ref %.5 = var w -// CHECK:STDOUT: %w: ref %.5 = bind_name w, %w.var +// CHECK:STDOUT: %.loc24_10: type = block_arg !if.expr.result.loc24 [template = constants.%.33] +// CHECK:STDOUT: %w.var: ref %.33 = var w +// CHECK:STDOUT: %w: ref %.33 = bind_name w, %w.var // CHECK:STDOUT: %v.ref: ref i32 = name_ref v, %v -// CHECK:STDOUT: %.loc24_40: %.5 = addr_of %v.ref +// CHECK:STDOUT: %.loc24_40: %.33 = addr_of %v.ref // CHECK:STDOUT: assign %w.var, %.loc24_40 -// CHECK:STDOUT: %w.ref: ref %.5 = name_ref w, %w -// CHECK:STDOUT: %.loc25_11: %.5 = bind_value %w.ref +// CHECK:STDOUT: %w.ref: ref %.33 = name_ref w, %w +// CHECK:STDOUT: %.loc25_11: %.33 = bind_value %w.ref // CHECK:STDOUT: %.loc25_10.1: ref i32 = deref %.loc25_11 // CHECK:STDOUT: %.loc25_10.2: i32 = bind_value %.loc25_10.1 // CHECK:STDOUT: return %.loc25_10.2 @@ -256,7 +279,7 @@ fn PartiallyConstant(t: type) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @PartiallyConstant(%t.param_patt: type) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc29_13: bool = bool_literal true [template = constants.%.3] +// CHECK:STDOUT: %.loc29_13: bool = bool_literal true [template = constants.%.31] // CHECK:STDOUT: if %.loc29_13 br !if.expr.then.loc29 else br !if.expr.else.loc29 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc29: @@ -273,9 +296,13 @@ fn PartiallyConstant(t: type) -> i32 { // CHECK:STDOUT: %.loc29_10: type = block_arg !if.expr.result.loc29 [template = i32] // CHECK:STDOUT: %v.var: ref i32 = var v // CHECK:STDOUT: %v: ref i32 = bind_name v, %v.var -// CHECK:STDOUT: %.loc29_36: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: assign %v.var, %.loc29_36 -// CHECK:STDOUT: %.loc30_13: bool = bool_literal false [template = constants.%.4] +// CHECK:STDOUT: %.loc29_36: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc29_37.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc29_37.2: = bound_method %.loc29_36, %.loc29_37.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc29_37.2(%.loc29_36) [template = constants.%.27] +// CHECK:STDOUT: %.loc29_37.3: init i32 = converted %.loc29_36, %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: assign %v.var, %.loc29_37.3 +// CHECK:STDOUT: %.loc30_13: bool = bool_literal false [template = constants.%.32] // CHECK:STDOUT: if %.loc30_13 br !if.expr.then.loc30 else br !if.expr.else.loc30 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc30: @@ -286,18 +313,18 @@ fn PartiallyConstant(t: type) -> i32 { // CHECK:STDOUT: %int.make_type_32.loc30: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc30_34.1: type = value_of_initializer %int.make_type_32.loc30 [template = i32] // CHECK:STDOUT: %.loc30_34.2: type = converted %int.make_type_32.loc30, %.loc30_34.1 [template = i32] -// CHECK:STDOUT: %.loc30_34.3: type = ptr_type i32 [template = constants.%.5] +// CHECK:STDOUT: %.loc30_34.3: type = ptr_type i32 [template = constants.%.33] // CHECK:STDOUT: br !if.expr.result.loc30(%.loc30_34.3) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc30: -// CHECK:STDOUT: %.loc30_10: type = block_arg !if.expr.result.loc30 [template = constants.%.5] -// CHECK:STDOUT: %w.var: ref %.5 = var w -// CHECK:STDOUT: %w: ref %.5 = bind_name w, %w.var +// CHECK:STDOUT: %.loc30_10: type = block_arg !if.expr.result.loc30 [template = constants.%.33] +// CHECK:STDOUT: %w.var: ref %.33 = var w +// CHECK:STDOUT: %w: ref %.33 = bind_name w, %w.var // CHECK:STDOUT: %v.ref: ref i32 = name_ref v, %v -// CHECK:STDOUT: %.loc30_38: %.5 = addr_of %v.ref +// CHECK:STDOUT: %.loc30_38: %.33 = addr_of %v.ref // CHECK:STDOUT: assign %w.var, %.loc30_38 -// CHECK:STDOUT: %w.ref: ref %.5 = name_ref w, %w -// CHECK:STDOUT: %.loc31_11: %.5 = bind_value %w.ref +// CHECK:STDOUT: %w.ref: ref %.33 = name_ref w, %w +// CHECK:STDOUT: %.loc31_11: %.33 = bind_value %w.ref // CHECK:STDOUT: %.loc31_10.1: ref i32 = deref %.loc31_11 // CHECK:STDOUT: %.loc31_10.2: i32 = bind_value %.loc31_10.1 // CHECK:STDOUT: return %.loc31_10.2 diff --git a/toolchain/check/testdata/if_expr/control_flow.carbon b/toolchain/check/testdata/if_expr/control_flow.carbon index b99b67194da47..2ef2dc4785528 100644 --- a/toolchain/check/testdata/if_expr/control_flow.carbon +++ b/toolchain/check/testdata/if_expr/control_flow.carbon @@ -22,10 +22,18 @@ fn F(b: bool) -> i32 { // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %A.type: type = fn_type @A [template] // CHECK:STDOUT: %A: %A.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 1 [template] // CHECK:STDOUT: %B.type: type = fn_type @B [template] // CHECK:STDOUT: %B: %B.type = struct_value () [template] -// CHECK:STDOUT: %.2: i32 = int_value 2 [template] +// CHECK:STDOUT: %.28: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.29: = bound_method %.28, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 2 [template] // CHECK:STDOUT: %Bool.type: type = fn_type @Bool [template] // CHECK:STDOUT: %Bool: %Bool.type = struct_value () [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] @@ -35,7 +43,8 @@ fn F(b: bool) -> i32 { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int32 = %import_ref.1 -// CHECK:STDOUT: .Bool = %import_ref.2 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 +// CHECK:STDOUT: .Bool = %import_ref.51 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -90,14 +99,24 @@ fn F(b: bool) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @A() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_24: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: return %.loc11_24 +// CHECK:STDOUT: %.loc11_24: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_25.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_25.2: = bound_method %.loc11_24, %.loc11_25.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc11_25.2(%.loc11_24) [template = constants.%.27] +// CHECK:STDOUT: %.loc11_25.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc11_25.4: i32 = converted %.loc11_24, %.loc11_25.3 [template = constants.%.27] +// CHECK:STDOUT: return %.loc11_25.4 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @B() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc12_24: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: return %.loc12_24 +// CHECK:STDOUT: %.loc12_24: Core.IntLiteral = int_value 2 [template = constants.%.28] +// CHECK:STDOUT: %.loc12_25.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_25.2: = bound_method %.loc12_24, %.loc12_25.1 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc12_25.2(%.loc12_24) [template = constants.%.30] +// CHECK:STDOUT: %.loc12_25.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.30] +// CHECK:STDOUT: %.loc12_25.4: i32 = converted %.loc12_24, %.loc12_25.3 [template = constants.%.30] +// CHECK:STDOUT: return %.loc12_25.4 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%b.param_patt: bool) -> i32 { diff --git a/toolchain/check/testdata/if_expr/fail_not_in_function.carbon b/toolchain/check/testdata/if_expr/fail_not_in_function.carbon index b3aeddba608d1..3d4942899f69d 100644 --- a/toolchain/check/testdata/if_expr/fail_not_in_function.carbon +++ b/toolchain/check/testdata/if_expr/fail_not_in_function.carbon @@ -49,7 +49,8 @@ class C { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int32 = %import_ref.1 -// CHECK:STDOUT: .Float = %import_ref.2 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 +// CHECK:STDOUT: .Float = %import_ref.51 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -74,7 +75,7 @@ class C { // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C -// CHECK:STDOUT: .n = .inst+54.loc37_8 +// CHECK:STDOUT: .n = .inst+425.loc37_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { diff --git a/toolchain/check/testdata/if_expr/fail_partial_constant.carbon b/toolchain/check/testdata/if_expr/fail_partial_constant.carbon index 1ce945a011cdb..4c068c3190ef1 100644 --- a/toolchain/check/testdata/if_expr/fail_partial_constant.carbon +++ b/toolchain/check/testdata/if_expr/fail_partial_constant.carbon @@ -48,7 +48,7 @@ fn ChosenBranchIsNonConstant(t: type) { // CHECK:STDOUT: %ConditionIsNonConstant: %ConditionIsNonConstant.type = struct_value () [template] // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -99,7 +99,7 @@ fn ChosenBranchIsNonConstant(t: type) { // CHECK:STDOUT: %.loc12_10: type = block_arg !if.expr.result // CHECK:STDOUT: %v.var: ref = var v // CHECK:STDOUT: %v: ref = bind_name v, %v.var -// CHECK:STDOUT: %.loc12_35: i32 = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc12_35: Core.IntLiteral = int_value 1 [template = constants.%.1] // CHECK:STDOUT: assign %v.var, // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -112,7 +112,7 @@ fn ChosenBranchIsNonConstant(t: type) { // CHECK:STDOUT: %.1: bool = bool_literal true [template] // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.2: i32 = int_value 1 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 1 [template] // CHECK:STDOUT: %.3: bool = bool_literal false [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -158,7 +158,7 @@ fn ChosenBranchIsNonConstant(t: type) { // CHECK:STDOUT: %.loc9_10: type = block_arg !if.expr.result.loc9 // CHECK:STDOUT: %v.var: ref = var v // CHECK:STDOUT: %v: ref = bind_name v, %v.var -// CHECK:STDOUT: %.loc9_36: i32 = int_value 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc9_36: Core.IntLiteral = int_value 1 [template = constants.%.2] // CHECK:STDOUT: assign %v.var, // CHECK:STDOUT: %.loc13_13: bool = bool_literal false [template = constants.%.3] // CHECK:STDOUT: if %.loc13_13 br !if.expr.then.loc13 else br !if.expr.else.loc13 @@ -177,7 +177,7 @@ fn ChosenBranchIsNonConstant(t: type) { // CHECK:STDOUT: %.loc13_10: type = block_arg !if.expr.result.loc13 // CHECK:STDOUT: %w.var: ref = var w // CHECK:STDOUT: %w: ref = bind_name w, %w.var -// CHECK:STDOUT: %.loc13_37: i32 = int_value 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc13_37: Core.IntLiteral = int_value 1 [template = constants.%.2] // CHECK:STDOUT: assign %w.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/if_expr/nested.carbon b/toolchain/check/testdata/if_expr/nested.carbon index c89d653494bf6..77a7428686e8e 100644 --- a/toolchain/check/testdata/if_expr/nested.carbon +++ b/toolchain/check/testdata/if_expr/nested.carbon @@ -21,16 +21,29 @@ fn F(a: bool, b: bool, c: bool) -> i32 { // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %.2: i32 = int_value 2 [template] -// CHECK:STDOUT: %.3: i32 = int_value 3 [template] -// CHECK:STDOUT: %.4: i32 = int_value 4 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 1 [template] +// CHECK:STDOUT: %.28: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.29: = bound_method %.28, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 2 [template] +// CHECK:STDOUT: %.31: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.32: = bound_method %.31, %Convert.15 [template] +// CHECK:STDOUT: %.33: i32 = int_value 3 [template] +// CHECK:STDOUT: %.34: Core.IntLiteral = int_value 4 [template] +// CHECK:STDOUT: %.35: = bound_method %.34, %Convert.15 [template] +// CHECK:STDOUT: %.36: i32 = int_value 4 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Bool = %import_ref.1 // CHECK:STDOUT: .Int32 = %import_ref.2 +// CHECK:STDOUT: .ImplicitAs = %import_ref.3 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -85,12 +98,22 @@ fn F(a: bool, b: bool, c: bool) -> i32 { // CHECK:STDOUT: if %b.ref br !if.expr.then.loc12_20 else br !if.expr.else.loc12_20 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc12_20: -// CHECK:STDOUT: %.loc12_30: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: br !if.expr.result.loc12_20(%.loc12_30) +// CHECK:STDOUT: %.loc12_30: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc12_25.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_25.2: = bound_method %.loc12_30, %.loc12_25.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc12_25: init i32 = call %.loc12_25.2(%.loc12_30) [template = constants.%.27] +// CHECK:STDOUT: %.loc12_25.3: i32 = value_of_initializer %int.convert_checked.loc12_25 [template = constants.%.27] +// CHECK:STDOUT: %.loc12_25.4: i32 = converted %.loc12_30, %.loc12_25.3 [template = constants.%.27] +// CHECK:STDOUT: br !if.expr.result.loc12_20(%.loc12_25.4) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc12_20: -// CHECK:STDOUT: %.loc12_37: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: br !if.expr.result.loc12_20(%.loc12_37) +// CHECK:STDOUT: %.loc12_37: Core.IntLiteral = int_value 2 [template = constants.%.28] +// CHECK:STDOUT: %.loc12_32.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_32.2: = bound_method %.loc12_37, %.loc12_32.1 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc12_32: init i32 = call %.loc12_32.2(%.loc12_37) [template = constants.%.30] +// CHECK:STDOUT: %.loc12_32.3: i32 = value_of_initializer %int.convert_checked.loc12_32 [template = constants.%.30] +// CHECK:STDOUT: %.loc12_32.4: i32 = converted %.loc12_37, %.loc12_32.3 [template = constants.%.30] +// CHECK:STDOUT: br !if.expr.result.loc12_20(%.loc12_32.4) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc12_20: // CHECK:STDOUT: %.loc12_20: i32 = block_arg !if.expr.result.loc12_20 @@ -101,12 +124,22 @@ fn F(a: bool, b: bool, c: bool) -> i32 { // CHECK:STDOUT: if %c.ref br !if.expr.then.loc12_44 else br !if.expr.else.loc12_44 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc12_44: -// CHECK:STDOUT: %.loc12_54: i32 = int_value 3 [template = constants.%.3] -// CHECK:STDOUT: br !if.expr.result.loc12_44(%.loc12_54) +// CHECK:STDOUT: %.loc12_54: Core.IntLiteral = int_value 3 [template = constants.%.31] +// CHECK:STDOUT: %.loc12_49.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_49.2: = bound_method %.loc12_54, %.loc12_49.1 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc12_49: init i32 = call %.loc12_49.2(%.loc12_54) [template = constants.%.33] +// CHECK:STDOUT: %.loc12_49.3: i32 = value_of_initializer %int.convert_checked.loc12_49 [template = constants.%.33] +// CHECK:STDOUT: %.loc12_49.4: i32 = converted %.loc12_54, %.loc12_49.3 [template = constants.%.33] +// CHECK:STDOUT: br !if.expr.result.loc12_44(%.loc12_49.4) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc12_44: -// CHECK:STDOUT: %.loc12_61: i32 = int_value 4 [template = constants.%.4] -// CHECK:STDOUT: br !if.expr.result.loc12_44(%.loc12_61) +// CHECK:STDOUT: %.loc12_61: Core.IntLiteral = int_value 4 [template = constants.%.34] +// CHECK:STDOUT: %.loc12_56.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_56.2: = bound_method %.loc12_61, %.loc12_56.1 [template = constants.%.35] +// CHECK:STDOUT: %int.convert_checked.loc12_56: init i32 = call %.loc12_56.2(%.loc12_61) [template = constants.%.36] +// CHECK:STDOUT: %.loc12_56.3: i32 = value_of_initializer %int.convert_checked.loc12_56 [template = constants.%.36] +// CHECK:STDOUT: %.loc12_56.4: i32 = converted %.loc12_61, %.loc12_56.3 [template = constants.%.36] +// CHECK:STDOUT: br !if.expr.result.loc12_44(%.loc12_56.4) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc12_44: // CHECK:STDOUT: %.loc12_44: i32 = block_arg !if.expr.result.loc12_44 diff --git a/toolchain/check/testdata/if_expr/struct.carbon b/toolchain/check/testdata/if_expr/struct.carbon index 1ec98b2e07c50..5f50fdde08b26 100644 --- a/toolchain/check/testdata/if_expr/struct.carbon +++ b/toolchain/check/testdata/if_expr/struct.carbon @@ -28,15 +28,25 @@ fn F(cond: bool) { // CHECK:STDOUT: %Bool: %Bool.type = struct_value () [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %.3: i32 = int_value 1 [template] -// CHECK:STDOUT: %.4: i32 = int_value 2 [template] -// CHECK:STDOUT: %struct: %.1 = struct_value (%.3, %.4) [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.5: type = struct_type {.a: Core.IntLiteral, .b: Core.IntLiteral} [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: %.29: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.30: = bound_method %.3, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 1 [template] +// CHECK:STDOUT: %.32: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.33: i32 = int_value 2 [template] +// CHECK:STDOUT: %struct: %.1 = struct_value (%.31, %.33) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int32 = %import_ref.1 // CHECK:STDOUT: .Bool = %import_ref.2 +// CHECK:STDOUT: .ImplicitAs = %import_ref.3 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -88,15 +98,23 @@ fn F(cond: bool) { // CHECK:STDOUT: %.loc14_27: type = struct_type {.a: i32, .b: i32} [template = constants.%.1] // CHECK:STDOUT: %a.var: ref %.1 = var a // CHECK:STDOUT: %a: ref %.1 = bind_name a, %a.var -// CHECK:STDOUT: %.loc14_37: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc14_45: i32 = int_value 2 [template = constants.%.4] -// CHECK:STDOUT: %.loc14_46.1: %.1 = struct_literal (%.loc14_37, %.loc14_45) -// CHECK:STDOUT: %.loc14_46.2: ref i32 = struct_access %a.var, element0 -// CHECK:STDOUT: %.loc14_46.3: init i32 = initialize_from %.loc14_37 to %.loc14_46.2 [template = constants.%.3] -// CHECK:STDOUT: %.loc14_46.4: ref i32 = struct_access %a.var, element1 -// CHECK:STDOUT: %.loc14_46.5: init i32 = initialize_from %.loc14_45 to %.loc14_46.4 [template = constants.%.4] -// CHECK:STDOUT: %.loc14_46.6: init %.1 = struct_init (%.loc14_46.3, %.loc14_46.5) to %a.var [template = constants.%struct] -// CHECK:STDOUT: %.loc14_47: init %.1 = converted %.loc14_46.1, %.loc14_46.6 [template = constants.%struct] +// CHECK:STDOUT: %.loc14_37: Core.IntLiteral = int_value 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc14_45: Core.IntLiteral = int_value 2 [template = constants.%.4] +// CHECK:STDOUT: %.loc14_46.1: %.5 = struct_literal (%.loc14_37, %.loc14_45) +// CHECK:STDOUT: %.loc14_46.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc14_46.3: = bound_method %.loc14_37, %.loc14_46.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc14_46.1: init i32 = call %.loc14_46.3(%.loc14_37) [template = constants.%.31] +// CHECK:STDOUT: %.loc14_46.4: init i32 = converted %.loc14_37, %int.convert_checked.loc14_46.1 [template = constants.%.31] +// CHECK:STDOUT: %.loc14_46.5: ref i32 = struct_access %a.var, element0 +// CHECK:STDOUT: %.loc14_46.6: init i32 = initialize_from %.loc14_46.4 to %.loc14_46.5 [template = constants.%.31] +// CHECK:STDOUT: %.loc14_46.7: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc14_46.8: = bound_method %.loc14_45, %.loc14_46.7 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc14_46.2: init i32 = call %.loc14_46.8(%.loc14_45) [template = constants.%.33] +// CHECK:STDOUT: %.loc14_46.9: init i32 = converted %.loc14_45, %int.convert_checked.loc14_46.2 [template = constants.%.33] +// CHECK:STDOUT: %.loc14_46.10: ref i32 = struct_access %a.var, element1 +// CHECK:STDOUT: %.loc14_46.11: init i32 = initialize_from %.loc14_46.9 to %.loc14_46.10 [template = constants.%.33] +// CHECK:STDOUT: %.loc14_46.12: init %.1 = struct_init (%.loc14_46.6, %.loc14_46.11) to %a.var [template = constants.%struct] +// CHECK:STDOUT: %.loc14_47: init %.1 = converted %.loc14_46.1, %.loc14_46.12 [template = constants.%struct] // CHECK:STDOUT: assign %a.var, %.loc14_47 // CHECK:STDOUT: %G.ref: %G.type = name_ref G, file.%G.decl [template = constants.%G] // CHECK:STDOUT: %cond.ref: bool = name_ref cond, %cond diff --git a/toolchain/check/testdata/impl/extend_impl_generic.carbon b/toolchain/check/testdata/impl/extend_impl_generic.carbon index f97ea7a978c79..4a191258cab47 100644 --- a/toolchain/check/testdata/impl/extend_impl_generic.carbon +++ b/toolchain/check/testdata/impl/extend_impl_generic.carbon @@ -55,7 +55,7 @@ class X(U:! type) { // CHECK:STDOUT: %HasF.type.1: type = generic_interface_type @HasF [template] // CHECK:STDOUT: %HasF: %HasF.type.1 = struct_value () [template] // CHECK:STDOUT: %HasF.type.2: type = facet_type <@HasF, @HasF(%T)> [symbolic] -// CHECK:STDOUT: %Self: %HasF.type.2 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Self.1: %HasF.type.2 = bind_symbolic_name Self, 1 [symbolic] // CHECK:STDOUT: %F.type.1: type = fn_type @F.1, @HasF(%T) [symbolic] // CHECK:STDOUT: %F.1: %F.type.1 = struct_value () [symbolic] // CHECK:STDOUT: %.1: type = assoc_entity_type %HasF.type.2, %F.type.1 [symbolic] @@ -77,15 +77,23 @@ class X(U:! type) { // CHECK:STDOUT: %.8: = interface_witness (%F.3) [template] // CHECK:STDOUT: %.9: type = struct_type {} [template] // CHECK:STDOUT: %.10: = complete_type_witness %.9 [template] -// CHECK:STDOUT: %.12: i32 = int_value 2 [template] -// CHECK:STDOUT: %struct: %Param = struct_value (%.12) [template] +// CHECK:STDOUT: %.12: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.13: type = struct_type {.x: Core.IntLiteral} [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: %.37: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.38: = bound_method %.12, %Convert.15 [template] +// CHECK:STDOUT: %.39: i32 = int_value 2 [template] +// CHECK:STDOUT: %struct: %Param = struct_value (%.39) [template] // CHECK:STDOUT: %G.type: type = fn_type @G [template] // CHECK:STDOUT: %G: %G.type = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -125,14 +133,14 @@ class X(U:! type) { // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %HasF.type: type = facet_type <@HasF, @HasF(%T.loc4_16.2)> [symbolic = %HasF.type (constants.%HasF.type.2)] -// CHECK:STDOUT: %Self.2: %HasF.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] +// CHECK:STDOUT: %Self.2: %HasF.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self.1)] // CHECK:STDOUT: %F.type: type = fn_type @F.1, @HasF(%T.loc4_16.2) [symbolic = %F.type (constants.%F.type.1)] // CHECK:STDOUT: %F: @HasF.%F.type (%F.type.1) = struct_value () [symbolic = %F (constants.%F.1)] // CHECK:STDOUT: %.loc5_14.2: type = assoc_entity_type @HasF.%HasF.type (%HasF.type.2), @HasF.%F.type (%F.type.1) [symbolic = %.loc5_14.2 (constants.%.1)] // CHECK:STDOUT: %.loc5_14.3: @HasF.%.loc5_14.2 (%.1) = assoc_entity element0, %F.decl [symbolic = %.loc5_14.3 (constants.%.2)] // CHECK:STDOUT: // CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.1: @HasF.%HasF.type (%HasF.type.2) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] +// CHECK:STDOUT: %Self.1: @HasF.%HasF.type (%HasF.type.2) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self.1)] // CHECK:STDOUT: %F.decl: @HasF.%F.type (%F.type.1) = fn_decl @F.1 [symbolic = @HasF.%F (constants.%F.1)] { // CHECK:STDOUT: %return.patt: @F.1.%T (%T) = return_slot_pattern // CHECK:STDOUT: %return.param_patt: @F.1.%T (%T) = out_param_pattern %return.patt, runtime_param0 @@ -150,7 +158,7 @@ class X(U:! type) { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl: %Self.ref as %HasF.type { +// CHECK:STDOUT: impl @impl.1: %Self.ref as %HasF.type { // CHECK:STDOUT: %F.decl: %F.type.3 = fn_decl @F.2 [template = constants.%F.3] { // CHECK:STDOUT: %return.patt: %Param = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %Param = out_param_pattern %return.patt, runtime_param0 @@ -179,7 +187,7 @@ class X(U:! type) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: impl_decl @impl [template] {} { +// CHECK:STDOUT: impl_decl @impl.1 [template] {} { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [template = constants.%C] // CHECK:STDOUT: %HasF.ref: %HasF.type.1 = name_ref HasF, file.%HasF.decl [template = constants.%HasF] // CHECK:STDOUT: %Param.ref: type = name_ref Param, file.%Param.decl [template = constants.%Param] @@ -189,7 +197,7 @@ class X(U:! type) { // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C -// CHECK:STDOUT: extend @impl.%HasF.type +// CHECK:STDOUT: extend @impl.1.%HasF.type // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @F.1(@HasF.%T.loc4_16.1: type, @HasF.%Self.1: @HasF.%HasF.type (%HasF.type.2)) { @@ -200,12 +208,16 @@ class X(U:! type) { // CHECK:STDOUT: // CHECK:STDOUT: fn @F.2() -> %return: %Param { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_20: i32 = int_value 2 [template = constants.%.12] -// CHECK:STDOUT: %.loc15_21.1: %.4 = struct_literal (%.loc15_20) -// CHECK:STDOUT: %.loc15_21.2: ref i32 = class_element_access %return, element0 -// CHECK:STDOUT: %.loc15_21.3: init i32 = initialize_from %.loc15_20 to %.loc15_21.2 [template = constants.%.12] -// CHECK:STDOUT: %.loc15_21.4: init %Param = class_init (%.loc15_21.3), %return [template = constants.%struct] -// CHECK:STDOUT: %.loc15_22: init %Param = converted %.loc15_21.1, %.loc15_21.4 [template = constants.%struct] +// CHECK:STDOUT: %.loc15_20: Core.IntLiteral = int_value 2 [template = constants.%.12] +// CHECK:STDOUT: %.loc15_21.1: %.13 = struct_literal (%.loc15_20) +// CHECK:STDOUT: %.loc15_21.2: %Convert.type.2 = interface_witness_access constants.%.37, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc15_21.3: = bound_method %.loc15_20, %.loc15_21.2 [template = constants.%.38] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc15_21.3(%.loc15_20) [template = constants.%.39] +// CHECK:STDOUT: %.loc15_21.4: init i32 = converted %.loc15_20, %int.convert_checked [template = constants.%.39] +// CHECK:STDOUT: %.loc15_21.5: ref i32 = class_element_access %return, element0 +// CHECK:STDOUT: %.loc15_21.6: init i32 = initialize_from %.loc15_21.4 to %.loc15_21.5 [template = constants.%.39] +// CHECK:STDOUT: %.loc15_21.7: init %Param = class_init (%.loc15_21.6), %return [template = constants.%struct] +// CHECK:STDOUT: %.loc15_22: init %Param = converted %.loc15_21.1, %.loc15_21.7 [template = constants.%struct] // CHECK:STDOUT: return %.loc15_22 to %return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -249,7 +261,7 @@ class X(U:! type) { // CHECK:STDOUT: %T.patt.loc4_16.2 => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%T, constants.%Self) { +// CHECK:STDOUT: specific @F.1(constants.%T, constants.%Self.1) { // CHECK:STDOUT: %T => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: @@ -264,7 +276,7 @@ class X(U:! type) { // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %HasF.type => constants.%HasF.type.3 -// CHECK:STDOUT: %Self.2 => constants.%Self +// CHECK:STDOUT: %Self.2 => constants.%Self.1 // CHECK:STDOUT: %F.type => constants.%F.type.2 // CHECK:STDOUT: %F => constants.%F.2 // CHECK:STDOUT: %.loc5_14.2 => constants.%.6 diff --git a/toolchain/check/testdata/impl/fail_impl_bad_assoc_fn.carbon b/toolchain/check/testdata/impl/fail_impl_bad_assoc_fn.carbon index fd3352ddac89d..614e68fa533f0 100644 --- a/toolchain/check/testdata/impl/fail_impl_bad_assoc_fn.carbon +++ b/toolchain/check/testdata/impl/fail_impl_bad_assoc_fn.carbon @@ -276,41 +276,34 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %.8: type = struct_type {.x: %Self.3, .y: i32} [symbolic] // CHECK:STDOUT: %tuple.type.1: type = tuple_type (type, type) [template] // CHECK:STDOUT: %tuple.type.2: type = tuple_type (%.7, %.8) [symbolic] -// CHECK:STDOUT: %.9: i32 = int_value 4 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] -// CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template] -// CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template] -// CHECK:STDOUT: %.33: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.34: = bound_method %.9, %Convert.15 [template] -// CHECK:STDOUT: %.35: Core.IntLiteral = int_value 4 [template] -// CHECK:STDOUT: %.36: type = array_type %.35, %Self.3 [symbolic] +// CHECK:STDOUT: %.9: Core.IntLiteral = int_value 4 [template] +// CHECK:STDOUT: %.10: type = array_type %.9, %Self.3 [symbolic] // CHECK:STDOUT: %F.type.13: type = fn_type @F.13 [template] // CHECK:STDOUT: %F.14: %F.type.13 = struct_value () [template] -// CHECK:STDOUT: %.37: type = assoc_entity_type %SelfNested.type, %F.type.13 [template] -// CHECK:STDOUT: %.38: %.37 = assoc_entity element0, @SelfNested.%F.decl [template] +// CHECK:STDOUT: %.11: type = assoc_entity_type %SelfNested.type, %F.type.13 [template] +// CHECK:STDOUT: %.12: %.11 = assoc_entity element0, @SelfNested.%F.decl [template] // CHECK:STDOUT: %SelfNestedBadParam: type = class_type @SelfNestedBadParam [template] -// CHECK:STDOUT: %.39: type = ptr_type %SelfNestedBadParam [template] -// CHECK:STDOUT: %.40: type = struct_type {.x: i32, .y: i32} [template] -// CHECK:STDOUT: %tuple.type.3: type = tuple_type (%.39, %.40) [template] -// CHECK:STDOUT: %.41: type = array_type %.35, %SelfNestedBadParam [template] +// CHECK:STDOUT: %.13: type = ptr_type %SelfNestedBadParam [template] +// CHECK:STDOUT: %.14: type = struct_type {.x: i32, .y: i32} [template] +// CHECK:STDOUT: %tuple.type.3: type = tuple_type (%.13, %.14) [template] +// CHECK:STDOUT: %.15: type = array_type %.9, %SelfNestedBadParam [template] // CHECK:STDOUT: %F.type.14: type = fn_type @F.14 [template] // CHECK:STDOUT: %F.15: %F.type.14 = struct_value () [template] -// CHECK:STDOUT: %.42: type = struct_type {.x: %SelfNestedBadParam, .y: i32} [template] -// CHECK:STDOUT: %tuple.type.4: type = tuple_type (%.39, %.42) [template] +// CHECK:STDOUT: %.16: type = struct_type {.x: %SelfNestedBadParam, .y: i32} [template] +// CHECK:STDOUT: %tuple.type.4: type = tuple_type (%.13, %.16) [template] // CHECK:STDOUT: %SelfNestedBadReturnType: type = class_type @SelfNestedBadReturnType [template] -// CHECK:STDOUT: %.43: type = ptr_type %SelfNestedBadReturnType [template] -// CHECK:STDOUT: %.44: type = struct_type {.x: %SelfNestedBadReturnType, .y: i32} [template] -// CHECK:STDOUT: %tuple.type.5: type = tuple_type (%.43, %.44) [template] +// CHECK:STDOUT: %.17: type = ptr_type %SelfNestedBadReturnType [template] +// CHECK:STDOUT: %.18: type = struct_type {.x: %SelfNestedBadReturnType, .y: i32} [template] +// CHECK:STDOUT: %tuple.type.5: type = tuple_type (%.17, %.18) [template] // CHECK:STDOUT: %F.type.15: type = fn_type @F.15 [template] // CHECK:STDOUT: %F.16: %F.type.15 = struct_value () [template] -// CHECK:STDOUT: %.45: type = array_type %.35, %SelfNestedBadReturnType [template] +// CHECK:STDOUT: %.19: type = array_type %.9, %SelfNestedBadReturnType [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Bool = %import_ref.1 // CHECK:STDOUT: .Int32 = %import_ref.2 -// CHECK:STDOUT: .ImplicitAs = %import_ref.3 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -411,8 +404,8 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %F.decl: %F.type.13 = fn_decl @F.13 [template = constants.%F.14] { // CHECK:STDOUT: %x.patt: @F.13.%tuple.type (%tuple.type.2) = binding_pattern x // CHECK:STDOUT: %x.param_patt: @F.13.%tuple.type (%tuple.type.2) = value_param_pattern %x.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: @F.13.%.loc188_52.1 (%.36) = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: @F.13.%.loc188_52.1 (%.36) = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: @F.13.%.loc188_52.1 (%.10) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @F.13.%.loc188_52.1 (%.10) = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { // CHECK:STDOUT: %Self.ref.loc188_12: %SelfNested.type = name_ref Self, @SelfNested.%Self [symbolic = %Self (constants.%Self.3)] // CHECK:STDOUT: %.loc188_16.2: type = facet_type_access %Self.ref.loc188_12 [symbolic = %Self (constants.%Self.3)] @@ -428,21 +421,16 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %.loc188_38.1: %tuple.type.1 = tuple_literal (%.loc188_16.4, %.loc188_37.2) // CHECK:STDOUT: %.loc188_38.2: type = converted %.loc188_38.1, constants.%tuple.type.2 [symbolic = %tuple.type (constants.%tuple.type.2)] // CHECK:STDOUT: %Self.ref.loc188_45: %SelfNested.type = name_ref Self, @SelfNested.%Self [symbolic = %Self (constants.%Self.3)] -// CHECK:STDOUT: %.loc188_51.1: i32 = int_value 4 [template = constants.%.9] +// CHECK:STDOUT: %.loc188_51: Core.IntLiteral = int_value 4 [template = constants.%.9] // CHECK:STDOUT: %.loc188_45.1: type = facet_type_access %Self.ref.loc188_45 [symbolic = %Self (constants.%Self.3)] // CHECK:STDOUT: %.loc188_45.2: type = converted %Self.ref.loc188_45, %.loc188_45.1 [symbolic = %Self (constants.%Self.3)] -// CHECK:STDOUT: %.loc188_51.2: %Convert.type.2 = interface_witness_access constants.%.33, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc188_51.3: = bound_method %.loc188_51.1, %.loc188_51.2 [template = constants.%.34] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc188_51.3(%.loc188_51.1) [template = constants.%.35] -// CHECK:STDOUT: %.loc188_51.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.35] -// CHECK:STDOUT: %.loc188_51.5: Core.IntLiteral = converted %.loc188_51.1, %.loc188_51.4 [template = constants.%.35] -// CHECK:STDOUT: %.loc188_52.2: type = array_type %.loc188_51.5, %Self.3 [symbolic = %.loc188_52.1 (constants.%.36)] +// CHECK:STDOUT: %.loc188_52.2: type = array_type %.loc188_51, %Self.3 [symbolic = %.loc188_52.1 (constants.%.10)] // CHECK:STDOUT: %x.param: @F.13.%tuple.type (%tuple.type.2) = value_param runtime_param0 // CHECK:STDOUT: %x: @F.13.%tuple.type (%tuple.type.2) = bind_name x, %x.param -// CHECK:STDOUT: %return.param: ref @F.13.%.loc188_52.1 (%.36) = out_param runtime_param1 -// CHECK:STDOUT: %return: ref @F.13.%.loc188_52.1 (%.36) = return_slot %return.param +// CHECK:STDOUT: %return.param: ref @F.13.%.loc188_52.1 (%.10) = out_param runtime_param1 +// CHECK:STDOUT: %return: ref @F.13.%.loc188_52.1 (%.10) = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc188: %.37 = assoc_entity element0, %F.decl [template = constants.%.38] +// CHECK:STDOUT: %.loc188: %.11 = assoc_entity element0, %F.decl [template = constants.%.12] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self @@ -725,36 +713,31 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: witness = %.loc175 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl.26: %Self.ref as %SelfNested.ref { +// CHECK:STDOUT: impl @impl.14: %Self.ref as %SelfNested.ref { // CHECK:STDOUT: %F.decl: %F.type.14 = fn_decl @F.14 [template = constants.%F.15] { // CHECK:STDOUT: %x.patt: %tuple.type.3 = binding_pattern x // CHECK:STDOUT: %x.param_patt: %tuple.type.3 = value_param_pattern %x.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %.41 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %.41 = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: %.15 = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: %.15 = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { // CHECK:STDOUT: %SelfNestedBadParam.ref.loc200_14: type = name_ref SelfNestedBadParam, file.%SelfNestedBadParam.decl [template = constants.%SelfNestedBadParam] -// CHECK:STDOUT: %.loc200_32: type = ptr_type %SelfNestedBadParam [template = constants.%.39] +// CHECK:STDOUT: %.loc200_32: type = ptr_type %SelfNestedBadParam [template = constants.%.13] // CHECK:STDOUT: %int.make_type_32.loc200_40: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc200_40.1: type = value_of_initializer %int.make_type_32.loc200_40 [template = i32] // CHECK:STDOUT: %.loc200_40.2: type = converted %int.make_type_32.loc200_40, %.loc200_40.1 [template = i32] // CHECK:STDOUT: %int.make_type_32.loc200_49: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc200_49.1: type = value_of_initializer %int.make_type_32.loc200_49 [template = i32] // CHECK:STDOUT: %.loc200_49.2: type = converted %int.make_type_32.loc200_49, %.loc200_49.1 [template = i32] -// CHECK:STDOUT: %.loc200_52: type = struct_type {.x: i32, .y: i32} [template = constants.%.40] +// CHECK:STDOUT: %.loc200_52: type = struct_type {.x: i32, .y: i32} [template = constants.%.14] // CHECK:STDOUT: %.loc200_53.1: %tuple.type.1 = tuple_literal (%.loc200_32, %.loc200_52) // CHECK:STDOUT: %.loc200_53.2: type = converted %.loc200_53.1, constants.%tuple.type.3 [template = constants.%tuple.type.3] // CHECK:STDOUT: %SelfNestedBadParam.ref.loc200_60: type = name_ref SelfNestedBadParam, file.%SelfNestedBadParam.decl [template = constants.%SelfNestedBadParam] -// CHECK:STDOUT: %.loc200_80.1: i32 = int_value 4 [template = constants.%.9] -// CHECK:STDOUT: %.loc200_80.2: %Convert.type.2 = interface_witness_access constants.%.33, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc200_80.3: = bound_method %.loc200_80.1, %.loc200_80.2 [template = constants.%.34] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc200_80.3(%.loc200_80.1) [template = constants.%.35] -// CHECK:STDOUT: %.loc200_80.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.35] -// CHECK:STDOUT: %.loc200_80.5: Core.IntLiteral = converted %.loc200_80.1, %.loc200_80.4 [template = constants.%.35] -// CHECK:STDOUT: %.loc200_81: type = array_type %.loc200_80.5, %SelfNestedBadParam [template = constants.%.41] +// CHECK:STDOUT: %.loc200_80: Core.IntLiteral = int_value 4 [template = constants.%.9] +// CHECK:STDOUT: %.loc200_81: type = array_type %.loc200_80, %SelfNestedBadParam [template = constants.%.15] // CHECK:STDOUT: %x.param: %tuple.type.3 = value_param runtime_param0 // CHECK:STDOUT: %x: %tuple.type.3 = bind_name x, %x.param -// CHECK:STDOUT: %return.param: ref %.41 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %.41 = return_slot %return.param +// CHECK:STDOUT: %return.param: ref %.15 = out_param runtime_param1 +// CHECK:STDOUT: %return: ref %.15 = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: %.loc192: = interface_witness () [template = ] // CHECK:STDOUT: @@ -763,34 +746,29 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: witness = %.loc192 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl.27: %Self.ref as %SelfNested.ref { +// CHECK:STDOUT: impl @impl.15: %Self.ref as %SelfNested.ref { // CHECK:STDOUT: %F.decl: %F.type.15 = fn_decl @F.15 [template = constants.%F.16] { // CHECK:STDOUT: %x.patt: %tuple.type.5 = binding_pattern x // CHECK:STDOUT: %x.param_patt: %tuple.type.5 = value_param_pattern %x.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %.41 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %.41 = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: %.15 = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: %.15 = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { // CHECK:STDOUT: %SelfNestedBadReturnType.ref.loc212_14: type = name_ref SelfNestedBadReturnType, file.%SelfNestedBadReturnType.decl [template = constants.%SelfNestedBadReturnType] -// CHECK:STDOUT: %.loc212_37: type = ptr_type %SelfNestedBadReturnType [template = constants.%.43] +// CHECK:STDOUT: %.loc212_37: type = ptr_type %SelfNestedBadReturnType [template = constants.%.17] // CHECK:STDOUT: %SelfNestedBadReturnType.ref.loc212_45: type = name_ref SelfNestedBadReturnType, file.%SelfNestedBadReturnType.decl [template = constants.%SelfNestedBadReturnType] // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc212_74.1: type = value_of_initializer %int.make_type_32 [template = i32] // CHECK:STDOUT: %.loc212_74.2: type = converted %int.make_type_32, %.loc212_74.1 [template = i32] -// CHECK:STDOUT: %.loc212_77: type = struct_type {.x: %SelfNestedBadReturnType, .y: i32} [template = constants.%.44] +// CHECK:STDOUT: %.loc212_77: type = struct_type {.x: %SelfNestedBadReturnType, .y: i32} [template = constants.%.18] // CHECK:STDOUT: %.loc212_78.1: %tuple.type.1 = tuple_literal (%.loc212_37, %.loc212_77) // CHECK:STDOUT: %.loc212_78.2: type = converted %.loc212_78.1, constants.%tuple.type.5 [template = constants.%tuple.type.5] // CHECK:STDOUT: %SelfNestedBadParam.ref: type = name_ref SelfNestedBadParam, file.%SelfNestedBadParam.decl [template = constants.%SelfNestedBadParam] -// CHECK:STDOUT: %.loc212_105.1: i32 = int_value 4 [template = constants.%.9] -// CHECK:STDOUT: %.loc212_105.2: %Convert.type.2 = interface_witness_access constants.%.33, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc212_105.3: = bound_method %.loc212_105.1, %.loc212_105.2 [template = constants.%.34] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc212_105.3(%.loc212_105.1) [template = constants.%.35] -// CHECK:STDOUT: %.loc212_105.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.35] -// CHECK:STDOUT: %.loc212_105.5: Core.IntLiteral = converted %.loc212_105.1, %.loc212_105.4 [template = constants.%.35] -// CHECK:STDOUT: %.loc212_106: type = array_type %.loc212_105.5, %SelfNestedBadParam [template = constants.%.41] +// CHECK:STDOUT: %.loc212_105: Core.IntLiteral = int_value 4 [template = constants.%.9] +// CHECK:STDOUT: %.loc212_106: type = array_type %.loc212_105, %SelfNestedBadParam [template = constants.%.15] // CHECK:STDOUT: %x.param: %tuple.type.5 = value_param runtime_param0 // CHECK:STDOUT: %x: %tuple.type.5 = bind_name x, %x.param -// CHECK:STDOUT: %return.param: ref %.41 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %.41 = return_slot %return.param +// CHECK:STDOUT: %return.param: ref %.15 = out_param runtime_param1 +// CHECK:STDOUT: %return: ref %.15 = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: %.loc205: = interface_witness () [template = ] // CHECK:STDOUT: @@ -945,7 +923,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @SelfNestedBadParam { -// CHECK:STDOUT: impl_decl @impl.26 [template] {} { +// CHECK:STDOUT: impl_decl @impl.14 [template] {} { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%SelfNestedBadParam [template = constants.%SelfNestedBadParam] // CHECK:STDOUT: %SelfNested.ref: type = name_ref SelfNested, file.%SelfNested.decl [template = constants.%SelfNested.type] // CHECK:STDOUT: } @@ -956,7 +934,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @SelfNestedBadReturnType { -// CHECK:STDOUT: impl_decl @impl.27 [template] {} { +// CHECK:STDOUT: impl_decl @impl.15 [template] {} { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%SelfNestedBadReturnType [template = constants.%SelfNestedBadReturnType] // CHECK:STDOUT: %SelfNested.ref: type = name_ref SelfNested, file.%SelfNested.decl [template = constants.%SelfNested.type] // CHECK:STDOUT: } @@ -1003,14 +981,14 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %.loc188_16.1: type = ptr_type @F.13.%Self (%Self.3) [symbolic = %.loc188_16.1 (constants.%.7)] // CHECK:STDOUT: %.loc188_37.1: type = struct_type {.x: @F.13.%Self (%Self.3), .y: i32} [symbolic = %.loc188_37.1 (constants.%.8)] // CHECK:STDOUT: %tuple.type: type = tuple_type (@F.13.%.loc188_16.1 (%.7), @F.13.%.loc188_37.1 (%.8)) [symbolic = %tuple.type (constants.%tuple.type.2)] -// CHECK:STDOUT: %.loc188_52.1: type = array_type constants.%.35, @F.13.%Self (%Self.3) [symbolic = %.loc188_52.1 (constants.%.36)] +// CHECK:STDOUT: %.loc188_52.1: type = array_type constants.%.9, @F.13.%Self (%Self.3) [symbolic = %.loc188_52.1 (constants.%.10)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%x.param_patt: @F.13.%tuple.type (%tuple.type.2)) -> @F.13.%.loc188_52.1 (%.36); +// CHECK:STDOUT: fn(%x.param_patt: @F.13.%tuple.type (%tuple.type.2)) -> @F.13.%.loc188_52.1 (%.10); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.14(%x.param_patt: %tuple.type.3) -> %.41; +// CHECK:STDOUT: fn @F.14(%x.param_patt: %tuple.type.3) -> %.15; // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.15(%x.param_patt: %tuple.type.5) -> %.41; +// CHECK:STDOUT: fn @F.15(%x.param_patt: %tuple.type.5) -> %.15; // CHECK:STDOUT: // CHECK:STDOUT: specific @F.1(constants.%Self.1) {} // CHECK:STDOUT: @@ -1041,22 +1019,22 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %.loc188_16.1 => constants.%.7 // CHECK:STDOUT: %.loc188_37.1 => constants.%.8 // CHECK:STDOUT: %tuple.type => constants.%tuple.type.2 -// CHECK:STDOUT: %.loc188_52.1 => constants.%.36 +// CHECK:STDOUT: %.loc188_52.1 => constants.%.10 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @F.13(constants.%SelfNestedBadParam) { // CHECK:STDOUT: %Self => constants.%SelfNestedBadParam -// CHECK:STDOUT: %.loc188_16.1 => constants.%.39 -// CHECK:STDOUT: %.loc188_37.1 => constants.%.42 +// CHECK:STDOUT: %.loc188_16.1 => constants.%.13 +// CHECK:STDOUT: %.loc188_37.1 => constants.%.16 // CHECK:STDOUT: %tuple.type => constants.%tuple.type.4 -// CHECK:STDOUT: %.loc188_52.1 => constants.%.41 +// CHECK:STDOUT: %.loc188_52.1 => constants.%.15 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @F.13(constants.%SelfNestedBadReturnType) { // CHECK:STDOUT: %Self => constants.%SelfNestedBadReturnType -// CHECK:STDOUT: %.loc188_16.1 => constants.%.43 -// CHECK:STDOUT: %.loc188_37.1 => constants.%.44 +// CHECK:STDOUT: %.loc188_16.1 => constants.%.17 +// CHECK:STDOUT: %.loc188_37.1 => constants.%.18 // CHECK:STDOUT: %tuple.type => constants.%tuple.type.5 -// CHECK:STDOUT: %.loc188_52.1 => constants.%.45 +// CHECK:STDOUT: %.loc188_52.1 => constants.%.19 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/no_prelude/generic_redeclaration.carbon b/toolchain/check/testdata/impl/no_prelude/generic_redeclaration.carbon index 21ffc953405c7..89e811a52db78 100644 --- a/toolchain/check/testdata/impl/no_prelude/generic_redeclaration.carbon +++ b/toolchain/check/testdata/impl/no_prelude/generic_redeclaration.carbon @@ -447,7 +447,7 @@ impl (C, C).0 as I {} // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %.1: = interface_witness () [template] // CHECK:STDOUT: %tuple.type: type = tuple_type (type, type) [template] -// CHECK:STDOUT: %.2: i32 = int_value 0 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 0 [template] // CHECK:STDOUT: %tuple: %tuple.type = tuple_value (%C, %C) [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -466,7 +466,7 @@ impl (C, C).0 as I {} // CHECK:STDOUT: %C.ref.loc14_7: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %C.ref.loc14_10: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %.loc14_11.1: %tuple.type = tuple_literal (%C.ref.loc14_7, %C.ref.loc14_10) -// CHECK:STDOUT: %.loc14_13: i32 = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc14_13: Core.IntLiteral = int_value 0 [template = constants.%.2] // CHECK:STDOUT: %tuple: %tuple.type = tuple_value (%C.ref.loc14_7, %C.ref.loc14_10) [template = constants.%tuple] // CHECK:STDOUT: %.loc14_11.2: %tuple.type = converted %.loc14_11.1, %tuple [template = constants.%tuple] // CHECK:STDOUT: %.loc14_12: type = tuple_access %.loc14_11.2, element0 [template = constants.%C] diff --git a/toolchain/check/testdata/index/array_element_access.carbon b/toolchain/check/testdata/index/array_element_access.carbon index 0dde3a0bfa26e..6a84ca2e19d81 100644 --- a/toolchain/check/testdata/index/array_element_access.carbon +++ b/toolchain/check/testdata/index/array_element_access.carbon @@ -18,20 +18,26 @@ var d: i32 = a[b]; // CHECK:STDOUT: constants { // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 2 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.2: type = array_type %.1, i32 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 12 [template] +// CHECK:STDOUT: %.5: Core.IntLiteral = int_value 24 [template] +// CHECK:STDOUT: %tuple.type: type = tuple_type (Core.IntLiteral, Core.IntLiteral) [template] +// CHECK:STDOUT: %.6: i32 = int_value 0 [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: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] -// CHECK:STDOUT: %.27: Core.IntLiteral = int_value 2 [template] -// CHECK:STDOUT: %.28: type = array_type %.27, i32 [template] -// CHECK:STDOUT: %.30: i32 = int_value 12 [template] -// CHECK:STDOUT: %.31: i32 = int_value 24 [template] -// CHECK:STDOUT: %tuple.type: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.32: i32 = int_value 0 [template] +// CHECK:STDOUT: %.30: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.31: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.32: i32 = int_value 12 [template] // CHECK:STDOUT: %.33: i32 = int_value 1 [template] -// CHECK:STDOUT: %array: %.28 = tuple_value (%.30, %.31) [template] +// CHECK:STDOUT: %.34: = bound_method %.5, %Convert.15 [template] +// CHECK:STDOUT: %.35: i32 = int_value 24 [template] +// CHECK:STDOUT: %array: %.2 = tuple_value (%.32, %.35) [template] +// CHECK:STDOUT: %.36: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.37: = bound_method %.36, %Convert.15 [template] +// CHECK:STDOUT: %.38: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %.39: = bound_method %.38, %Convert.15 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -53,17 +59,12 @@ var d: i32 = a[b]; // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc11_14.1: i32 = int_value 2 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_14: Core.IntLiteral = int_value 2 [template = constants.%.1] // CHECK:STDOUT: %.loc11_9.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] // CHECK:STDOUT: %.loc11_9.2: type = converted %int.make_type_32.loc11, %.loc11_9.1 [template = i32] -// CHECK:STDOUT: %.loc11_14.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc11_14.3: = bound_method %.loc11_14.1, %.loc11_14.2 [template = constants.%.26] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc11_14.3(%.loc11_14.1) [template = constants.%.27] -// CHECK:STDOUT: %.loc11_14.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.27] -// CHECK:STDOUT: %.loc11_14.5: Core.IntLiteral = converted %.loc11_14.1, %.loc11_14.4 [template = constants.%.27] -// CHECK:STDOUT: %.loc11_15: type = array_type %.loc11_14.5, i32 [template = constants.%.28] -// CHECK:STDOUT: %a.var: ref %.28 = var a -// CHECK:STDOUT: %a: ref %.28 = bind_name a, %a.var +// CHECK:STDOUT: %.loc11_15: type = array_type %.loc11_14, i32 [template = constants.%.2] +// CHECK:STDOUT: %a.var: ref %.2 = var a +// CHECK:STDOUT: %a: ref %.2 = bind_name a, %a.var // CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc12_8.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] // CHECK:STDOUT: %.loc12_8.2: type = converted %int.make_type_32.loc12, %.loc12_8.1 [template = i32] @@ -83,26 +84,43 @@ var d: i32 = a[b]; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_20: i32 = int_value 12 [template = constants.%.30] -// CHECK:STDOUT: %.loc11_24: i32 = int_value 24 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_20: Core.IntLiteral = int_value 12 [template = constants.%.4] +// CHECK:STDOUT: %.loc11_24: Core.IntLiteral = int_value 24 [template = constants.%.5] // CHECK:STDOUT: %.loc11_26.1: %tuple.type = tuple_literal (%.loc11_20, %.loc11_24) -// CHECK:STDOUT: %.loc11_26.2: i32 = int_value 0 [template = constants.%.32] -// CHECK:STDOUT: %.loc11_26.3: ref i32 = array_index file.%a.var, %.loc11_26.2 -// CHECK:STDOUT: %.loc11_26.4: init i32 = initialize_from %.loc11_20 to %.loc11_26.3 [template = constants.%.30] -// CHECK:STDOUT: %.loc11_26.5: i32 = int_value 1 [template = constants.%.33] +// CHECK:STDOUT: %.loc11_26.2: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_26.3: = bound_method %.loc11_20, %.loc11_26.2 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc11_26.1: init i32 = call %.loc11_26.3(%.loc11_20) [template = constants.%.32] +// CHECK:STDOUT: %.loc11_26.4: init i32 = converted %.loc11_20, %int.convert_checked.loc11_26.1 [template = constants.%.32] +// CHECK:STDOUT: %.loc11_26.5: i32 = int_value 0 [template = constants.%.6] // CHECK:STDOUT: %.loc11_26.6: ref i32 = array_index file.%a.var, %.loc11_26.5 -// CHECK:STDOUT: %.loc11_26.7: init i32 = initialize_from %.loc11_24 to %.loc11_26.6 [template = constants.%.31] -// CHECK:STDOUT: %.loc11_26.8: init %.28 = array_init (%.loc11_26.4, %.loc11_26.7) to file.%a.var [template = constants.%array] -// CHECK:STDOUT: %.loc11_27: init %.28 = converted %.loc11_26.1, %.loc11_26.8 [template = constants.%array] +// CHECK:STDOUT: %.loc11_26.7: init i32 = initialize_from %.loc11_26.4 to %.loc11_26.6 [template = constants.%.32] +// CHECK:STDOUT: %.loc11_26.8: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_26.9: = bound_method %.loc11_24, %.loc11_26.8 [template = constants.%.34] +// CHECK:STDOUT: %int.convert_checked.loc11_26.2: init i32 = call %.loc11_26.9(%.loc11_24) [template = constants.%.35] +// CHECK:STDOUT: %.loc11_26.10: init i32 = converted %.loc11_24, %int.convert_checked.loc11_26.2 [template = constants.%.35] +// CHECK:STDOUT: %.loc11_26.11: i32 = int_value 1 [template = constants.%.33] +// CHECK:STDOUT: %.loc11_26.12: ref i32 = array_index file.%a.var, %.loc11_26.11 +// CHECK:STDOUT: %.loc11_26.13: init i32 = initialize_from %.loc11_26.10 to %.loc11_26.12 [template = constants.%.35] +// CHECK:STDOUT: %.loc11_26.14: init %.2 = array_init (%.loc11_26.7, %.loc11_26.13) to file.%a.var [template = constants.%array] +// CHECK:STDOUT: %.loc11_27: init %.2 = converted %.loc11_26.1, %.loc11_26.14 [template = constants.%array] // CHECK:STDOUT: assign file.%a.var, %.loc11_27 -// CHECK:STDOUT: %.loc12: i32 = int_value 1 [template = constants.%.33] -// CHECK:STDOUT: assign file.%b.var, %.loc12 -// CHECK:STDOUT: %a.ref.loc13: ref %.28 = name_ref a, file.%a -// CHECK:STDOUT: %.loc13_16: i32 = int_value 0 [template = constants.%.32] -// CHECK:STDOUT: %.loc13_17.1: ref i32 = array_index %a.ref.loc13, %.loc13_16 +// CHECK:STDOUT: %.loc12_14: Core.IntLiteral = int_value 1 [template = constants.%.36] +// CHECK:STDOUT: %.loc12_15.1: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_15.2: = bound_method %.loc12_14, %.loc12_15.1 [template = constants.%.37] +// CHECK:STDOUT: %int.convert_checked.loc12: init i32 = call %.loc12_15.2(%.loc12_14) [template = constants.%.33] +// CHECK:STDOUT: %.loc12_15.3: init i32 = converted %.loc12_14, %int.convert_checked.loc12 [template = constants.%.33] +// CHECK:STDOUT: assign file.%b.var, %.loc12_15.3 +// CHECK:STDOUT: %a.ref.loc13: ref %.2 = name_ref a, file.%a +// CHECK:STDOUT: %.loc13_16.1: Core.IntLiteral = int_value 0 [template = constants.%.38] +// CHECK:STDOUT: %.loc13_16.2: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_16.3: = bound_method %.loc13_16.1, %.loc13_16.2 [template = constants.%.39] +// CHECK:STDOUT: %int.convert_checked.loc13: init i32 = call %.loc13_16.3(%.loc13_16.1) [template = constants.%.6] +// CHECK:STDOUT: %.loc13_16.4: i32 = value_of_initializer %int.convert_checked.loc13 [template = constants.%.6] +// CHECK:STDOUT: %.loc13_16.5: i32 = converted %.loc13_16.1, %.loc13_16.4 [template = constants.%.6] +// CHECK:STDOUT: %.loc13_17.1: ref i32 = array_index %a.ref.loc13, %.loc13_16.5 // CHECK:STDOUT: %.loc13_17.2: i32 = bind_value %.loc13_17.1 // CHECK:STDOUT: assign file.%c.var, %.loc13_17.2 -// CHECK:STDOUT: %a.ref.loc14: ref %.28 = name_ref a, file.%a +// CHECK:STDOUT: %a.ref.loc14: ref %.2 = name_ref a, file.%a // CHECK:STDOUT: %b.ref: ref i32 = name_ref b, file.%b // CHECK:STDOUT: %.loc14_16: i32 = bind_value %b.ref // CHECK:STDOUT: %.loc14_17.1: ref i32 = array_index %a.ref.loc14, %.loc14_16 diff --git a/toolchain/check/testdata/index/expr_category.carbon b/toolchain/check/testdata/index/expr_category.carbon index b17fbe02dad03..358c5245d0b88 100644 --- a/toolchain/check/testdata/index/expr_category.carbon +++ b/toolchain/check/testdata/index/expr_category.carbon @@ -33,25 +33,33 @@ fn ValueBinding(b: [i32; 3]) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 3 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [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: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] -// CHECK:STDOUT: %.27: Core.IntLiteral = int_value 3 [template] -// CHECK:STDOUT: %.28: type = array_type %.27, i32 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.2: type = array_type %.1, i32 [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] // CHECK:STDOUT: %G.type: type = fn_type @G [template] // CHECK:STDOUT: %G: %G.type = struct_value () [template] -// CHECK:STDOUT: %.30: i32 = int_value 1 [template] -// CHECK:STDOUT: %.31: i32 = int_value 2 [template] -// CHECK:STDOUT: %tuple.type: type = tuple_type (i32, i32, i32) [template] -// CHECK:STDOUT: %.32: i32 = int_value 0 [template] -// CHECK:STDOUT: %array: %.28 = tuple_value (%.30, %.31, %.1) [template] -// CHECK:STDOUT: %.33: type = ptr_type i32 [template] -// CHECK:STDOUT: %.34: i32 = int_value 4 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.5: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %tuple.type: type = tuple_type (Core.IntLiteral, Core.IntLiteral, Core.IntLiteral) [template] +// CHECK:STDOUT: %.6: i32 = int_value 0 [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: %.30: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.31: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.32: i32 = int_value 1 [template] +// CHECK:STDOUT: %.33: = bound_method %.5, %Convert.15 [template] +// CHECK:STDOUT: %.34: i32 = int_value 2 [template] +// CHECK:STDOUT: %.35: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.36: i32 = int_value 3 [template] +// CHECK:STDOUT: %array: %.2 = tuple_value (%.32, %.34, %.36) [template] +// CHECK:STDOUT: %.37: type = ptr_type i32 [template] +// CHECK:STDOUT: %.38: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %.39: = bound_method %.38, %Convert.15 [template] +// CHECK:STDOUT: %.40: Core.IntLiteral = int_value 4 [template] +// CHECK:STDOUT: %.41: = bound_method %.40, %Convert.15 [template] +// CHECK:STDOUT: %.42: i32 = int_value 4 [template] // CHECK:STDOUT: %ValueBinding.type: type = fn_type @ValueBinding [template] // CHECK:STDOUT: %ValueBinding: %ValueBinding.type = struct_value () [template] // CHECK:STDOUT: } @@ -74,153 +82,181 @@ fn ValueBinding(b: [i32; 3]) { // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] { -// CHECK:STDOUT: %return.patt: %.28 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %.28 = out_param_pattern %return.patt, runtime_param0 +// CHECK:STDOUT: %return.patt: %.2 = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: %.2 = out_param_pattern %return.patt, runtime_param0 // CHECK:STDOUT: } { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc11_17.1: i32 = int_value 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_17: Core.IntLiteral = int_value 3 [template = constants.%.1] // CHECK:STDOUT: %.loc11_12.1: type = value_of_initializer %int.make_type_32 [template = i32] // CHECK:STDOUT: %.loc11_12.2: type = converted %int.make_type_32, %.loc11_12.1 [template = i32] -// CHECK:STDOUT: %.loc11_17.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc11_17.3: = bound_method %.loc11_17.1, %.loc11_17.2 [template = constants.%.26] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc11_17.3(%.loc11_17.1) [template = constants.%.27] -// CHECK:STDOUT: %.loc11_17.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.27] -// CHECK:STDOUT: %.loc11_17.5: Core.IntLiteral = converted %.loc11_17.1, %.loc11_17.4 [template = constants.%.27] -// CHECK:STDOUT: %.loc11_18: type = array_type %.loc11_17.5, i32 [template = constants.%.28] -// CHECK:STDOUT: %return.param: ref %.28 = out_param runtime_param0 -// CHECK:STDOUT: %return: ref %.28 = return_slot %return.param +// CHECK:STDOUT: %.loc11_18: type = array_type %.loc11_17, i32 [template = constants.%.2] +// CHECK:STDOUT: %return.param: ref %.2 = out_param runtime_param0 +// CHECK:STDOUT: %return: ref %.2 = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] { -// CHECK:STDOUT: %b.patt: %.28 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %.28 = value_param_pattern %b.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: %.2 = binding_pattern b +// CHECK:STDOUT: %b.param_patt: %.2 = value_param_pattern %b.patt, runtime_param0 // CHECK:STDOUT: } { // CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc13_15.1: i32 = int_value 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc13_15: Core.IntLiteral = int_value 3 [template = constants.%.1] // CHECK:STDOUT: %.loc13_10.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] // CHECK:STDOUT: %.loc13_10.2: type = converted %int.make_type_32.loc13, %.loc13_10.1 [template = i32] -// CHECK:STDOUT: %.loc13_15.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc13_15.3: = bound_method %.loc13_15.1, %.loc13_15.2 [template = constants.%.26] -// CHECK:STDOUT: %int.convert_checked.loc13: init Core.IntLiteral = call %.loc13_15.3(%.loc13_15.1) [template = constants.%.27] -// CHECK:STDOUT: %.loc13_15.4: Core.IntLiteral = value_of_initializer %int.convert_checked.loc13 [template = constants.%.27] -// CHECK:STDOUT: %.loc13_15.5: Core.IntLiteral = converted %.loc13_15.1, %.loc13_15.4 [template = constants.%.27] -// CHECK:STDOUT: %.loc13_16: type = array_type %.loc13_15.5, i32 [template = constants.%.28] -// CHECK:STDOUT: %b.param: %.28 = value_param runtime_param0 -// CHECK:STDOUT: %b: %.28 = bind_name b, %b.param +// CHECK:STDOUT: %.loc13_16: type = array_type %.loc13_15, i32 [template = constants.%.2] +// CHECK:STDOUT: %b.param: %.2 = value_param runtime_param0 +// CHECK:STDOUT: %b: %.2 = bind_name b, %b.param // CHECK:STDOUT: } // CHECK:STDOUT: %ValueBinding.decl: %ValueBinding.type = fn_decl @ValueBinding [template = constants.%ValueBinding] { -// CHECK:STDOUT: %b.patt: %.28 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %.28 = value_param_pattern %b.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: %.2 = binding_pattern b +// CHECK:STDOUT: %b.param_patt: %.2 = value_param_pattern %b.patt, runtime_param0 // CHECK:STDOUT: } { // CHECK:STDOUT: %int.make_type_32.loc21: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc21_26.1: i32 = int_value 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc21_26: Core.IntLiteral = int_value 3 [template = constants.%.1] // CHECK:STDOUT: %.loc21_21.1: type = value_of_initializer %int.make_type_32.loc21 [template = i32] // CHECK:STDOUT: %.loc21_21.2: type = converted %int.make_type_32.loc21, %.loc21_21.1 [template = i32] -// CHECK:STDOUT: %.loc21_26.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc21_26.3: = bound_method %.loc21_26.1, %.loc21_26.2 [template = constants.%.26] -// CHECK:STDOUT: %int.convert_checked.loc21: init Core.IntLiteral = call %.loc21_26.3(%.loc21_26.1) [template = constants.%.27] -// CHECK:STDOUT: %.loc21_26.4: Core.IntLiteral = value_of_initializer %int.convert_checked.loc21 [template = constants.%.27] -// CHECK:STDOUT: %.loc21_26.5: Core.IntLiteral = converted %.loc21_26.1, %.loc21_26.4 [template = constants.%.27] -// CHECK:STDOUT: %.loc21_27: type = array_type %.loc21_26.5, i32 [template = constants.%.28] -// CHECK:STDOUT: %b.param: %.28 = value_param runtime_param0 -// CHECK:STDOUT: %b: %.28 = bind_name b, %b.param +// CHECK:STDOUT: %.loc21_27: type = array_type %.loc21_26, i32 [template = constants.%.2] +// CHECK:STDOUT: %b.param: %.2 = value_param runtime_param0 +// CHECK:STDOUT: %b: %.2 = bind_name b, %b.param // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F() -> %.28; +// CHECK:STDOUT: fn @F() -> %.2; // CHECK:STDOUT: -// CHECK:STDOUT: fn @G(%b.param_patt: %.28) { +// CHECK:STDOUT: fn @G(%b.param_patt: %.2) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int.make_type_32.loc14: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc14_16.1: i32 = int_value 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc14_16: Core.IntLiteral = int_value 3 [template = constants.%.1] // CHECK:STDOUT: %.loc14_11.1: type = value_of_initializer %int.make_type_32.loc14 [template = i32] // CHECK:STDOUT: %.loc14_11.2: type = converted %int.make_type_32.loc14, %.loc14_11.1 [template = i32] -// CHECK:STDOUT: %.loc14_16.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc14_16.3: = bound_method %.loc14_16.1, %.loc14_16.2 [template = constants.%.26] -// CHECK:STDOUT: %int.convert_checked.loc14: init Core.IntLiteral = call %.loc14_16.3(%.loc14_16.1) [template = constants.%.27] -// CHECK:STDOUT: %.loc14_16.4: Core.IntLiteral = value_of_initializer %int.convert_checked.loc14 [template = constants.%.27] -// CHECK:STDOUT: %.loc14_16.5: Core.IntLiteral = converted %.loc14_16.1, %.loc14_16.4 [template = constants.%.27] -// CHECK:STDOUT: %.loc14_17: type = array_type %.loc14_16.5, i32 [template = constants.%.28] -// CHECK:STDOUT: %a.var: ref %.28 = var a -// CHECK:STDOUT: %a: ref %.28 = bind_name a, %a.var -// CHECK:STDOUT: %.loc14_22: i32 = int_value 1 [template = constants.%.30] -// CHECK:STDOUT: %.loc14_25: i32 = int_value 2 [template = constants.%.31] -// CHECK:STDOUT: %.loc14_28: i32 = int_value 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc14_17: type = array_type %.loc14_16, i32 [template = constants.%.2] +// CHECK:STDOUT: %a.var: ref %.2 = var a +// CHECK:STDOUT: %a: ref %.2 = bind_name a, %a.var +// CHECK:STDOUT: %.loc14_22: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc14_25: Core.IntLiteral = int_value 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc14_28: Core.IntLiteral = int_value 3 [template = constants.%.1] // CHECK:STDOUT: %.loc14_29.1: %tuple.type = tuple_literal (%.loc14_22, %.loc14_25, %.loc14_28) -// CHECK:STDOUT: %.loc14_29.2: i32 = int_value 0 [template = constants.%.32] -// CHECK:STDOUT: %.loc14_29.3: ref i32 = array_index %a.var, %.loc14_29.2 -// CHECK:STDOUT: %.loc14_29.4: init i32 = initialize_from %.loc14_22 to %.loc14_29.3 [template = constants.%.30] -// CHECK:STDOUT: %.loc14_29.5: i32 = int_value 1 [template = constants.%.30] +// CHECK:STDOUT: %.loc14_29.2: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc14_29.3: = bound_method %.loc14_22, %.loc14_29.2 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc14_29.1: init i32 = call %.loc14_29.3(%.loc14_22) [template = constants.%.32] +// CHECK:STDOUT: %.loc14_29.4: init i32 = converted %.loc14_22, %int.convert_checked.loc14_29.1 [template = constants.%.32] +// CHECK:STDOUT: %.loc14_29.5: i32 = int_value 0 [template = constants.%.6] // CHECK:STDOUT: %.loc14_29.6: ref i32 = array_index %a.var, %.loc14_29.5 -// CHECK:STDOUT: %.loc14_29.7: init i32 = initialize_from %.loc14_25 to %.loc14_29.6 [template = constants.%.31] -// CHECK:STDOUT: %.loc14_29.8: i32 = int_value 2 [template = constants.%.31] -// CHECK:STDOUT: %.loc14_29.9: ref i32 = array_index %a.var, %.loc14_29.8 -// CHECK:STDOUT: %.loc14_29.10: init i32 = initialize_from %.loc14_28 to %.loc14_29.9 [template = constants.%.1] -// CHECK:STDOUT: %.loc14_29.11: init %.28 = array_init (%.loc14_29.4, %.loc14_29.7, %.loc14_29.10) to %a.var [template = constants.%array] -// CHECK:STDOUT: %.loc14_30: init %.28 = converted %.loc14_29.1, %.loc14_29.11 [template = constants.%array] +// CHECK:STDOUT: %.loc14_29.7: init i32 = initialize_from %.loc14_29.4 to %.loc14_29.6 [template = constants.%.32] +// CHECK:STDOUT: %.loc14_29.8: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc14_29.9: = bound_method %.loc14_25, %.loc14_29.8 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc14_29.2: init i32 = call %.loc14_29.9(%.loc14_25) [template = constants.%.34] +// CHECK:STDOUT: %.loc14_29.10: init i32 = converted %.loc14_25, %int.convert_checked.loc14_29.2 [template = constants.%.34] +// CHECK:STDOUT: %.loc14_29.11: i32 = int_value 1 [template = constants.%.32] +// CHECK:STDOUT: %.loc14_29.12: ref i32 = array_index %a.var, %.loc14_29.11 +// CHECK:STDOUT: %.loc14_29.13: init i32 = initialize_from %.loc14_29.10 to %.loc14_29.12 [template = constants.%.34] +// CHECK:STDOUT: %.loc14_29.14: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc14_29.15: = bound_method %.loc14_28, %.loc14_29.14 [template = constants.%.35] +// CHECK:STDOUT: %int.convert_checked.loc14_29.3: init i32 = call %.loc14_29.15(%.loc14_28) [template = constants.%.36] +// CHECK:STDOUT: %.loc14_29.16: init i32 = converted %.loc14_28, %int.convert_checked.loc14_29.3 [template = constants.%.36] +// CHECK:STDOUT: %.loc14_29.17: i32 = int_value 2 [template = constants.%.34] +// CHECK:STDOUT: %.loc14_29.18: ref i32 = array_index %a.var, %.loc14_29.17 +// CHECK:STDOUT: %.loc14_29.19: init i32 = initialize_from %.loc14_29.16 to %.loc14_29.18 [template = constants.%.36] +// CHECK:STDOUT: %.loc14_29.20: init %.2 = array_init (%.loc14_29.7, %.loc14_29.13, %.loc14_29.19) to %a.var [template = constants.%array] +// CHECK:STDOUT: %.loc14_30: init %.2 = converted %.loc14_29.1, %.loc14_29.20 [template = constants.%array] // CHECK:STDOUT: assign %a.var, %.loc14_30 // CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc17_14.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] // CHECK:STDOUT: %.loc17_14.2: type = converted %int.make_type_32.loc17, %.loc17_14.1 [template = i32] -// CHECK:STDOUT: %.loc17_14.3: type = ptr_type i32 [template = constants.%.33] -// CHECK:STDOUT: %pa.var: ref %.33 = var pa -// CHECK:STDOUT: %pa: ref %.33 = bind_name pa, %pa.var -// CHECK:STDOUT: %a.ref.loc17: ref %.28 = name_ref a, %a -// CHECK:STDOUT: %.loc17_21: i32 = int_value 0 [template = constants.%.32] -// CHECK:STDOUT: %.loc17_22: ref i32 = array_index %a.ref.loc17, %.loc17_21 -// CHECK:STDOUT: %.loc17_18: %.33 = addr_of %.loc17_22 +// CHECK:STDOUT: %.loc17_14.3: type = ptr_type i32 [template = constants.%.37] +// CHECK:STDOUT: %pa.var: ref %.37 = var pa +// CHECK:STDOUT: %pa: ref %.37 = bind_name pa, %pa.var +// CHECK:STDOUT: %a.ref.loc17: ref %.2 = name_ref a, %a +// CHECK:STDOUT: %.loc17_21.1: Core.IntLiteral = int_value 0 [template = constants.%.38] +// CHECK:STDOUT: %.loc17_21.2: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc17_21.3: = bound_method %.loc17_21.1, %.loc17_21.2 [template = constants.%.39] +// CHECK:STDOUT: %int.convert_checked.loc17: init i32 = call %.loc17_21.3(%.loc17_21.1) [template = constants.%.6] +// CHECK:STDOUT: %.loc17_21.4: i32 = value_of_initializer %int.convert_checked.loc17 [template = constants.%.6] +// CHECK:STDOUT: %.loc17_21.5: i32 = converted %.loc17_21.1, %.loc17_21.4 [template = constants.%.6] +// CHECK:STDOUT: %.loc17_22: ref i32 = array_index %a.ref.loc17, %.loc17_21.5 +// CHECK:STDOUT: %.loc17_18: %.37 = addr_of %.loc17_22 // CHECK:STDOUT: assign %pa.var, %.loc17_18 -// CHECK:STDOUT: %a.ref.loc18: ref %.28 = name_ref a, %a -// CHECK:STDOUT: %.loc18_5: i32 = int_value 0 [template = constants.%.32] -// CHECK:STDOUT: %.loc18_6: ref i32 = array_index %a.ref.loc18, %.loc18_5 -// CHECK:STDOUT: %.loc18_10: i32 = int_value 4 [template = constants.%.34] -// CHECK:STDOUT: assign %.loc18_6, %.loc18_10 +// CHECK:STDOUT: %a.ref.loc18: ref %.2 = name_ref a, %a +// CHECK:STDOUT: %.loc18_5.1: Core.IntLiteral = int_value 0 [template = constants.%.38] +// CHECK:STDOUT: %.loc18_5.2: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc18_5.3: = bound_method %.loc18_5.1, %.loc18_5.2 [template = constants.%.39] +// CHECK:STDOUT: %int.convert_checked.loc18_5: init i32 = call %.loc18_5.3(%.loc18_5.1) [template = constants.%.6] +// CHECK:STDOUT: %.loc18_5.4: i32 = value_of_initializer %int.convert_checked.loc18_5 [template = constants.%.6] +// CHECK:STDOUT: %.loc18_5.5: i32 = converted %.loc18_5.1, %.loc18_5.4 [template = constants.%.6] +// CHECK:STDOUT: %.loc18_6: ref i32 = array_index %a.ref.loc18, %.loc18_5.5 +// CHECK:STDOUT: %.loc18_10: Core.IntLiteral = int_value 4 [template = constants.%.40] +// CHECK:STDOUT: %.loc18_8.1: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc18_8.2: = bound_method %.loc18_10, %.loc18_8.1 [template = constants.%.41] +// CHECK:STDOUT: %int.convert_checked.loc18_8: init i32 = call %.loc18_8.2(%.loc18_10) [template = constants.%.42] +// CHECK:STDOUT: %.loc18_8.3: init i32 = converted %.loc18_10, %int.convert_checked.loc18_8 [template = constants.%.42] +// CHECK:STDOUT: assign %.loc18_6, %.loc18_8.3 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @ValueBinding(%b.param_patt: %.28) { +// CHECK:STDOUT: fn @ValueBinding(%b.param_patt: %.2) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int.make_type_32.loc22: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc22_16.1: i32 = int_value 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc22_16: Core.IntLiteral = int_value 3 [template = constants.%.1] // CHECK:STDOUT: %.loc22_11.1: type = value_of_initializer %int.make_type_32.loc22 [template = i32] // CHECK:STDOUT: %.loc22_11.2: type = converted %int.make_type_32.loc22, %.loc22_11.1 [template = i32] -// CHECK:STDOUT: %.loc22_16.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc22_16.3: = bound_method %.loc22_16.1, %.loc22_16.2 [template = constants.%.26] -// CHECK:STDOUT: %int.convert_checked.loc22: init Core.IntLiteral = call %.loc22_16.3(%.loc22_16.1) [template = constants.%.27] -// CHECK:STDOUT: %.loc22_16.4: Core.IntLiteral = value_of_initializer %int.convert_checked.loc22 [template = constants.%.27] -// CHECK:STDOUT: %.loc22_16.5: Core.IntLiteral = converted %.loc22_16.1, %.loc22_16.4 [template = constants.%.27] -// CHECK:STDOUT: %.loc22_17: type = array_type %.loc22_16.5, i32 [template = constants.%.28] -// CHECK:STDOUT: %a.var: ref %.28 = var a -// CHECK:STDOUT: %a: ref %.28 = bind_name a, %a.var -// CHECK:STDOUT: %.loc22_22: i32 = int_value 1 [template = constants.%.30] -// CHECK:STDOUT: %.loc22_25: i32 = int_value 2 [template = constants.%.31] -// CHECK:STDOUT: %.loc22_28: i32 = int_value 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc22_17: type = array_type %.loc22_16, i32 [template = constants.%.2] +// CHECK:STDOUT: %a.var: ref %.2 = var a +// CHECK:STDOUT: %a: ref %.2 = bind_name a, %a.var +// CHECK:STDOUT: %.loc22_22: Core.IntLiteral = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc22_25: Core.IntLiteral = int_value 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc22_28: Core.IntLiteral = int_value 3 [template = constants.%.1] // CHECK:STDOUT: %.loc22_29.1: %tuple.type = tuple_literal (%.loc22_22, %.loc22_25, %.loc22_28) -// CHECK:STDOUT: %.loc22_29.2: i32 = int_value 0 [template = constants.%.32] -// CHECK:STDOUT: %.loc22_29.3: ref i32 = array_index %a.var, %.loc22_29.2 -// CHECK:STDOUT: %.loc22_29.4: init i32 = initialize_from %.loc22_22 to %.loc22_29.3 [template = constants.%.30] -// CHECK:STDOUT: %.loc22_29.5: i32 = int_value 1 [template = constants.%.30] +// CHECK:STDOUT: %.loc22_29.2: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc22_29.3: = bound_method %.loc22_22, %.loc22_29.2 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc22_29.1: init i32 = call %.loc22_29.3(%.loc22_22) [template = constants.%.32] +// CHECK:STDOUT: %.loc22_29.4: init i32 = converted %.loc22_22, %int.convert_checked.loc22_29.1 [template = constants.%.32] +// CHECK:STDOUT: %.loc22_29.5: i32 = int_value 0 [template = constants.%.6] // CHECK:STDOUT: %.loc22_29.6: ref i32 = array_index %a.var, %.loc22_29.5 -// CHECK:STDOUT: %.loc22_29.7: init i32 = initialize_from %.loc22_25 to %.loc22_29.6 [template = constants.%.31] -// CHECK:STDOUT: %.loc22_29.8: i32 = int_value 2 [template = constants.%.31] -// CHECK:STDOUT: %.loc22_29.9: ref i32 = array_index %a.var, %.loc22_29.8 -// CHECK:STDOUT: %.loc22_29.10: init i32 = initialize_from %.loc22_28 to %.loc22_29.9 [template = constants.%.1] -// CHECK:STDOUT: %.loc22_29.11: init %.28 = array_init (%.loc22_29.4, %.loc22_29.7, %.loc22_29.10) to %a.var [template = constants.%array] -// CHECK:STDOUT: %.loc22_30: init %.28 = converted %.loc22_29.1, %.loc22_29.11 [template = constants.%array] +// CHECK:STDOUT: %.loc22_29.7: init i32 = initialize_from %.loc22_29.4 to %.loc22_29.6 [template = constants.%.32] +// CHECK:STDOUT: %.loc22_29.8: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc22_29.9: = bound_method %.loc22_25, %.loc22_29.8 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc22_29.2: init i32 = call %.loc22_29.9(%.loc22_25) [template = constants.%.34] +// CHECK:STDOUT: %.loc22_29.10: init i32 = converted %.loc22_25, %int.convert_checked.loc22_29.2 [template = constants.%.34] +// CHECK:STDOUT: %.loc22_29.11: i32 = int_value 1 [template = constants.%.32] +// CHECK:STDOUT: %.loc22_29.12: ref i32 = array_index %a.var, %.loc22_29.11 +// CHECK:STDOUT: %.loc22_29.13: init i32 = initialize_from %.loc22_29.10 to %.loc22_29.12 [template = constants.%.34] +// CHECK:STDOUT: %.loc22_29.14: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc22_29.15: = bound_method %.loc22_28, %.loc22_29.14 [template = constants.%.35] +// CHECK:STDOUT: %int.convert_checked.loc22_29.3: init i32 = call %.loc22_29.15(%.loc22_28) [template = constants.%.36] +// CHECK:STDOUT: %.loc22_29.16: init i32 = converted %.loc22_28, %int.convert_checked.loc22_29.3 [template = constants.%.36] +// CHECK:STDOUT: %.loc22_29.17: i32 = int_value 2 [template = constants.%.34] +// CHECK:STDOUT: %.loc22_29.18: ref i32 = array_index %a.var, %.loc22_29.17 +// CHECK:STDOUT: %.loc22_29.19: init i32 = initialize_from %.loc22_29.16 to %.loc22_29.18 [template = constants.%.36] +// CHECK:STDOUT: %.loc22_29.20: init %.2 = array_init (%.loc22_29.7, %.loc22_29.13, %.loc22_29.19) to %a.var [template = constants.%array] +// CHECK:STDOUT: %.loc22_30: init %.2 = converted %.loc22_29.1, %.loc22_29.20 [template = constants.%array] // CHECK:STDOUT: assign %a.var, %.loc22_30 -// CHECK:STDOUT: %a.ref: ref %.28 = name_ref a, %a -// CHECK:STDOUT: %.loc26_5: i32 = int_value 0 [template = constants.%.32] -// CHECK:STDOUT: %.loc26_6: ref i32 = array_index %a.ref, %.loc26_5 -// CHECK:STDOUT: %b.ref: %.28 = name_ref b, %b -// CHECK:STDOUT: %.loc27_5: i32 = int_value 0 [template = constants.%.32] -// CHECK:STDOUT: %.loc27_6.1: ref %.28 = value_as_ref %b.ref -// CHECK:STDOUT: %.loc27_6.2: ref i32 = array_index %.loc27_6.1, %.loc27_5 +// CHECK:STDOUT: %a.ref: ref %.2 = name_ref a, %a +// CHECK:STDOUT: %.loc26_5.1: Core.IntLiteral = int_value 0 [template = constants.%.38] +// CHECK:STDOUT: %.loc26_5.2: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc26_5.3: = bound_method %.loc26_5.1, %.loc26_5.2 [template = constants.%.39] +// CHECK:STDOUT: %int.convert_checked.loc26: init i32 = call %.loc26_5.3(%.loc26_5.1) [template = constants.%.6] +// CHECK:STDOUT: %.loc26_5.4: i32 = value_of_initializer %int.convert_checked.loc26 [template = constants.%.6] +// CHECK:STDOUT: %.loc26_5.5: i32 = converted %.loc26_5.1, %.loc26_5.4 [template = constants.%.6] +// CHECK:STDOUT: %.loc26_6: ref i32 = array_index %a.ref, %.loc26_5.5 +// CHECK:STDOUT: %b.ref: %.2 = name_ref b, %b +// CHECK:STDOUT: %.loc27_5.1: Core.IntLiteral = int_value 0 [template = constants.%.38] +// CHECK:STDOUT: %.loc27_5.2: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc27_5.3: = bound_method %.loc27_5.1, %.loc27_5.2 [template = constants.%.39] +// CHECK:STDOUT: %int.convert_checked.loc27: init i32 = call %.loc27_5.3(%.loc27_5.1) [template = constants.%.6] +// CHECK:STDOUT: %.loc27_5.4: i32 = value_of_initializer %int.convert_checked.loc27 [template = constants.%.6] +// CHECK:STDOUT: %.loc27_5.5: i32 = converted %.loc27_5.1, %.loc27_5.4 [template = constants.%.6] +// CHECK:STDOUT: %.loc27_6.1: ref %.2 = value_as_ref %b.ref +// CHECK:STDOUT: %.loc27_6.2: ref i32 = array_index %.loc27_6.1, %.loc27_5.5 // CHECK:STDOUT: %.loc27_6.3: i32 = bind_value %.loc27_6.2 // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [template = constants.%F] -// CHECK:STDOUT: %.loc28_4.1: ref %.28 = temporary_storage -// CHECK:STDOUT: %F.call: init %.28 = call %F.ref() to %.loc28_4.1 -// CHECK:STDOUT: %.loc28_7: i32 = int_value 0 [template = constants.%.32] -// CHECK:STDOUT: %.loc28_4.2: ref %.28 = temporary %.loc28_4.1, %F.call -// CHECK:STDOUT: %.loc28_8.1: ref i32 = array_index %.loc28_4.2, %.loc28_7 +// CHECK:STDOUT: %.loc28_4.1: ref %.2 = temporary_storage +// CHECK:STDOUT: %F.call: init %.2 = call %F.ref() to %.loc28_4.1 +// CHECK:STDOUT: %.loc28_7.1: Core.IntLiteral = int_value 0 [template = constants.%.38] +// CHECK:STDOUT: %.loc28_4.2: ref %.2 = temporary %.loc28_4.1, %F.call +// CHECK:STDOUT: %.loc28_7.2: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc28_7.3: = bound_method %.loc28_7.1, %.loc28_7.2 [template = constants.%.39] +// CHECK:STDOUT: %int.convert_checked.loc28: init i32 = call %.loc28_7.3(%.loc28_7.1) [template = constants.%.6] +// CHECK:STDOUT: %.loc28_7.4: i32 = value_of_initializer %int.convert_checked.loc28 [template = constants.%.6] +// CHECK:STDOUT: %.loc28_7.5: i32 = converted %.loc28_7.1, %.loc28_7.4 [template = constants.%.6] +// CHECK:STDOUT: %.loc28_8.1: ref i32 = array_index %.loc28_4.2, %.loc28_7.5 // CHECK:STDOUT: %.loc28_8.2: i32 = bind_value %.loc28_8.1 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/index/fail_array_large_index.carbon b/toolchain/check/testdata/index/fail_array_large_index.carbon index fe55e327bc492..78dcb75e2c0e7 100644 --- a/toolchain/check/testdata/index/fail_array_large_index.carbon +++ b/toolchain/check/testdata/index/fail_array_large_index.carbon @@ -26,19 +26,23 @@ var c: i32 = a[0x7FFF_FFFF]; // CHECK:STDOUT: constants { // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.2: type = array_type %.1, i32 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 12 [template] +// CHECK:STDOUT: %tuple.type: type = tuple_type (Core.IntLiteral) [template] +// CHECK:STDOUT: %.5: i32 = int_value 0 [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: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] -// CHECK:STDOUT: %.27: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %.28: type = array_type %.27, i32 [template] -// CHECK:STDOUT: %.30: i32 = int_value 12 [template] -// CHECK:STDOUT: %tuple.type: type = tuple_type (i32) [template] -// CHECK:STDOUT: %.31: i32 = int_value 0 [template] -// CHECK:STDOUT: %array: %.28 = tuple_value (%.30) [template] -// CHECK:STDOUT: %.32: i32 = int_value 2147483647 [template] +// CHECK:STDOUT: %.29: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.30: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 12 [template] +// CHECK:STDOUT: %array: %.2 = tuple_value (%.31) [template] +// CHECK:STDOUT: %.32: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.33: i32 = int_value 1 [template] +// CHECK:STDOUT: %.34: Core.IntLiteral = int_value 2147483647 [template] +// CHECK:STDOUT: %.35: = bound_method %.34, %Convert.15 [template] +// CHECK:STDOUT: %.36: i32 = int_value 2147483647 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -59,17 +63,12 @@ var c: i32 = a[0x7FFF_FFFF]; // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc11_14.1: i32 = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_14: Core.IntLiteral = int_value 1 [template = constants.%.1] // CHECK:STDOUT: %.loc11_9.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] // CHECK:STDOUT: %.loc11_9.2: type = converted %int.make_type_32.loc11, %.loc11_9.1 [template = i32] -// CHECK:STDOUT: %.loc11_14.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc11_14.3: = bound_method %.loc11_14.1, %.loc11_14.2 [template = constants.%.26] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc11_14.3(%.loc11_14.1) [template = constants.%.27] -// CHECK:STDOUT: %.loc11_14.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.27] -// CHECK:STDOUT: %.loc11_14.5: Core.IntLiteral = converted %.loc11_14.1, %.loc11_14.4 [template = constants.%.27] -// CHECK:STDOUT: %.loc11_15: type = array_type %.loc11_14.5, i32 [template = constants.%.28] -// CHECK:STDOUT: %a.var: ref %.28 = var a -// CHECK:STDOUT: %a: ref %.28 = bind_name a, %a.var +// CHECK:STDOUT: %.loc11_15: type = array_type %.loc11_14, i32 [template = constants.%.2] +// CHECK:STDOUT: %a.var: ref %.2 = var a +// CHECK:STDOUT: %a: ref %.2 = bind_name a, %a.var // CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc17_8.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] // CHECK:STDOUT: %.loc17_8.2: type = converted %int.make_type_32.loc17, %.loc17_8.1 [template = i32] @@ -84,22 +83,36 @@ var c: i32 = a[0x7FFF_FFFF]; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_20: i32 = int_value 12 [template = constants.%.30] +// CHECK:STDOUT: %.loc11_20: Core.IntLiteral = int_value 12 [template = constants.%.4] // CHECK:STDOUT: %.loc11_23.1: %tuple.type = tuple_literal (%.loc11_20) -// CHECK:STDOUT: %.loc11_23.2: i32 = int_value 0 [template = constants.%.31] -// CHECK:STDOUT: %.loc11_23.3: ref i32 = array_index file.%a.var, %.loc11_23.2 -// CHECK:STDOUT: %.loc11_23.4: init i32 = initialize_from %.loc11_20 to %.loc11_23.3 [template = constants.%.30] -// CHECK:STDOUT: %.loc11_23.5: init %.28 = array_init (%.loc11_23.4) to file.%a.var [template = constants.%array] -// CHECK:STDOUT: %.loc11_24: init %.28 = converted %.loc11_23.1, %.loc11_23.5 [template = constants.%array] +// CHECK:STDOUT: %.loc11_23.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_23.3: = bound_method %.loc11_20, %.loc11_23.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc11: init i32 = call %.loc11_23.3(%.loc11_20) [template = constants.%.31] +// CHECK:STDOUT: %.loc11_23.4: init i32 = converted %.loc11_20, %int.convert_checked.loc11 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_23.5: i32 = int_value 0 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_23.6: ref i32 = array_index file.%a.var, %.loc11_23.5 +// CHECK:STDOUT: %.loc11_23.7: init i32 = initialize_from %.loc11_23.4 to %.loc11_23.6 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_23.8: init %.2 = array_init (%.loc11_23.7) to file.%a.var [template = constants.%array] +// CHECK:STDOUT: %.loc11_24: init %.2 = converted %.loc11_23.1, %.loc11_23.8 [template = constants.%array] // CHECK:STDOUT: assign file.%a.var, %.loc11_24 -// CHECK:STDOUT: %a.ref.loc17: ref %.28 = name_ref a, file.%a -// CHECK:STDOUT: %.loc17_16: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc17_17.1: ref i32 = array_index %a.ref.loc17, %.loc17_16 [template = ] +// CHECK:STDOUT: %a.ref.loc17: ref %.2 = name_ref a, file.%a +// CHECK:STDOUT: %.loc17_16.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc17_16.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc17_16.3: = bound_method %.loc17_16.1, %.loc17_16.2 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc17: init i32 = call %.loc17_16.3(%.loc17_16.1) [template = constants.%.33] +// CHECK:STDOUT: %.loc17_16.4: i32 = value_of_initializer %int.convert_checked.loc17 [template = constants.%.33] +// CHECK:STDOUT: %.loc17_16.5: i32 = converted %.loc17_16.1, %.loc17_16.4 [template = constants.%.33] +// CHECK:STDOUT: %.loc17_17.1: ref i32 = array_index %a.ref.loc17, %.loc17_16.5 [template = ] // CHECK:STDOUT: %.loc17_17.2: i32 = bind_value %.loc17_17.1 // CHECK:STDOUT: assign file.%b.var, %.loc17_17.2 -// CHECK:STDOUT: %a.ref.loc22: ref %.28 = name_ref a, file.%a -// CHECK:STDOUT: %.loc22_16: i32 = int_value 2147483647 [template = constants.%.32] -// CHECK:STDOUT: %.loc22_27.1: ref i32 = array_index %a.ref.loc22, %.loc22_16 [template = ] +// CHECK:STDOUT: %a.ref.loc22: ref %.2 = name_ref a, file.%a +// CHECK:STDOUT: %.loc22_16.1: Core.IntLiteral = int_value 2147483647 [template = constants.%.34] +// CHECK:STDOUT: %.loc22_16.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc22_16.3: = bound_method %.loc22_16.1, %.loc22_16.2 [template = constants.%.35] +// CHECK:STDOUT: %int.convert_checked.loc22: init i32 = call %.loc22_16.3(%.loc22_16.1) [template = constants.%.36] +// CHECK:STDOUT: %.loc22_16.4: i32 = value_of_initializer %int.convert_checked.loc22 [template = constants.%.36] +// CHECK:STDOUT: %.loc22_16.5: i32 = converted %.loc22_16.1, %.loc22_16.4 [template = constants.%.36] +// CHECK:STDOUT: %.loc22_27.1: ref i32 = array_index %a.ref.loc22, %.loc22_16.5 [template = ] // CHECK:STDOUT: %.loc22_27.2: i32 = bind_value %.loc22_27.1 // CHECK:STDOUT: assign file.%c.var, %.loc22_27.2 // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/index/fail_array_non_int_indexing.carbon b/toolchain/check/testdata/index/fail_array_non_int_indexing.carbon index 2736a04ab5207..f06db8d1dcd04 100644 --- a/toolchain/check/testdata/index/fail_array_non_int_indexing.carbon +++ b/toolchain/check/testdata/index/fail_array_non_int_indexing.carbon @@ -22,18 +22,18 @@ var b: i32 = a[2.6]; // CHECK:STDOUT: constants { // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.2: type = array_type %.1, i32 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 12 [template] +// CHECK:STDOUT: %tuple.type: type = tuple_type (Core.IntLiteral) [template] +// CHECK:STDOUT: %.5: i32 = int_value 0 [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: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] -// CHECK:STDOUT: %.27: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %.28: type = array_type %.27, i32 [template] -// CHECK:STDOUT: %.30: i32 = int_value 12 [template] -// CHECK:STDOUT: %tuple.type: type = tuple_type (i32) [template] -// CHECK:STDOUT: %.31: i32 = int_value 0 [template] -// CHECK:STDOUT: %array: %.28 = tuple_value (%.30) [template] +// CHECK:STDOUT: %.29: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.30: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 12 [template] +// CHECK:STDOUT: %array: %.2 = tuple_value (%.31) [template] // CHECK:STDOUT: %.32: f64 = float_literal 2.6000000000000001 [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -54,17 +54,12 @@ var b: i32 = a[2.6]; // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc11_14.1: i32 = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_14: Core.IntLiteral = int_value 1 [template = constants.%.1] // CHECK:STDOUT: %.loc11_9.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] // CHECK:STDOUT: %.loc11_9.2: type = converted %int.make_type_32.loc11, %.loc11_9.1 [template = i32] -// CHECK:STDOUT: %.loc11_14.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc11_14.3: = bound_method %.loc11_14.1, %.loc11_14.2 [template = constants.%.26] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc11_14.3(%.loc11_14.1) [template = constants.%.27] -// CHECK:STDOUT: %.loc11_14.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.27] -// CHECK:STDOUT: %.loc11_14.5: Core.IntLiteral = converted %.loc11_14.1, %.loc11_14.4 [template = constants.%.27] -// CHECK:STDOUT: %.loc11_15: type = array_type %.loc11_14.5, i32 [template = constants.%.28] -// CHECK:STDOUT: %a.var: ref %.28 = var a -// CHECK:STDOUT: %a: ref %.28 = bind_name a, %a.var +// CHECK:STDOUT: %.loc11_15: type = array_type %.loc11_14, i32 [template = constants.%.2] +// CHECK:STDOUT: %a.var: ref %.2 = var a +// CHECK:STDOUT: %a: ref %.2 = bind_name a, %a.var // CHECK:STDOUT: %int.make_type_32.loc18: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc18_8.1: type = value_of_initializer %int.make_type_32.loc18 [template = i32] // CHECK:STDOUT: %.loc18_8.2: type = converted %int.make_type_32.loc18, %.loc18_8.1 [template = i32] @@ -74,15 +69,19 @@ var b: i32 = a[2.6]; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_20: i32 = int_value 12 [template = constants.%.30] +// CHECK:STDOUT: %.loc11_20: Core.IntLiteral = int_value 12 [template = constants.%.4] // CHECK:STDOUT: %.loc11_23.1: %tuple.type = tuple_literal (%.loc11_20) -// CHECK:STDOUT: %.loc11_23.2: i32 = int_value 0 [template = constants.%.31] -// CHECK:STDOUT: %.loc11_23.3: ref i32 = array_index file.%a.var, %.loc11_23.2 -// CHECK:STDOUT: %.loc11_23.4: init i32 = initialize_from %.loc11_20 to %.loc11_23.3 [template = constants.%.30] -// CHECK:STDOUT: %.loc11_23.5: init %.28 = array_init (%.loc11_23.4) to file.%a.var [template = constants.%array] -// CHECK:STDOUT: %.loc11_24: init %.28 = converted %.loc11_23.1, %.loc11_23.5 [template = constants.%array] +// CHECK:STDOUT: %.loc11_23.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_23.3: = bound_method %.loc11_20, %.loc11_23.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc11_23.3(%.loc11_20) [template = constants.%.31] +// CHECK:STDOUT: %.loc11_23.4: init i32 = converted %.loc11_20, %int.convert_checked [template = constants.%.31] +// CHECK:STDOUT: %.loc11_23.5: i32 = int_value 0 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_23.6: ref i32 = array_index file.%a.var, %.loc11_23.5 +// CHECK:STDOUT: %.loc11_23.7: init i32 = initialize_from %.loc11_23.4 to %.loc11_23.6 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_23.8: init %.2 = array_init (%.loc11_23.7) to file.%a.var [template = constants.%array] +// CHECK:STDOUT: %.loc11_24: init %.2 = converted %.loc11_23.1, %.loc11_23.8 [template = constants.%array] // CHECK:STDOUT: assign file.%a.var, %.loc11_24 -// CHECK:STDOUT: %a.ref: ref %.28 = name_ref a, file.%a +// CHECK:STDOUT: %a.ref: ref %.2 = name_ref a, file.%a // CHECK:STDOUT: %.loc18_16.1: f64 = float_literal 2.6000000000000001 [template = constants.%.32] // CHECK:STDOUT: %.loc18_16.2: i32 = converted %.loc18_16.1, [template = ] // CHECK:STDOUT: %.loc18_19.1: ref i32 = array_index %a.ref, [template = ] diff --git a/toolchain/check/testdata/index/fail_array_out_of_bound_access.carbon b/toolchain/check/testdata/index/fail_array_out_of_bound_access.carbon index 0a8868e113995..e54dd8f0b3ab7 100644 --- a/toolchain/check/testdata/index/fail_array_out_of_bound_access.carbon +++ b/toolchain/check/testdata/index/fail_array_out_of_bound_access.carbon @@ -19,18 +19,20 @@ var b: i32 = a[1]; // CHECK:STDOUT: constants { // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.2: type = array_type %.1, i32 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 12 [template] +// CHECK:STDOUT: %tuple.type: type = tuple_type (Core.IntLiteral) [template] +// CHECK:STDOUT: %.5: i32 = int_value 0 [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: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] -// CHECK:STDOUT: %.27: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %.28: type = array_type %.27, i32 [template] -// CHECK:STDOUT: %.30: i32 = int_value 12 [template] -// CHECK:STDOUT: %tuple.type: type = tuple_type (i32) [template] -// CHECK:STDOUT: %.31: i32 = int_value 0 [template] -// CHECK:STDOUT: %array: %.28 = tuple_value (%.30) [template] +// CHECK:STDOUT: %.29: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.30: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 12 [template] +// CHECK:STDOUT: %array: %.2 = tuple_value (%.31) [template] +// CHECK:STDOUT: %.32: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.33: i32 = int_value 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -50,17 +52,12 @@ var b: i32 = a[1]; // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc11_14.1: i32 = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_14: Core.IntLiteral = int_value 1 [template = constants.%.1] // CHECK:STDOUT: %.loc11_9.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] // CHECK:STDOUT: %.loc11_9.2: type = converted %int.make_type_32.loc11, %.loc11_9.1 [template = i32] -// CHECK:STDOUT: %.loc11_14.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc11_14.3: = bound_method %.loc11_14.1, %.loc11_14.2 [template = constants.%.26] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc11_14.3(%.loc11_14.1) [template = constants.%.27] -// CHECK:STDOUT: %.loc11_14.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.27] -// CHECK:STDOUT: %.loc11_14.5: Core.IntLiteral = converted %.loc11_14.1, %.loc11_14.4 [template = constants.%.27] -// CHECK:STDOUT: %.loc11_15: type = array_type %.loc11_14.5, i32 [template = constants.%.28] -// CHECK:STDOUT: %a.var: ref %.28 = var a -// CHECK:STDOUT: %a: ref %.28 = bind_name a, %a.var +// CHECK:STDOUT: %.loc11_15: type = array_type %.loc11_14, i32 [template = constants.%.2] +// CHECK:STDOUT: %a.var: ref %.2 = var a +// CHECK:STDOUT: %a: ref %.2 = bind_name a, %a.var // CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc15_8.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] // CHECK:STDOUT: %.loc15_8.2: type = converted %int.make_type_32.loc15, %.loc15_8.1 [template = i32] @@ -70,17 +67,26 @@ var b: i32 = a[1]; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_20: i32 = int_value 12 [template = constants.%.30] +// CHECK:STDOUT: %.loc11_20: Core.IntLiteral = int_value 12 [template = constants.%.4] // CHECK:STDOUT: %.loc11_23.1: %tuple.type = tuple_literal (%.loc11_20) -// CHECK:STDOUT: %.loc11_23.2: i32 = int_value 0 [template = constants.%.31] -// CHECK:STDOUT: %.loc11_23.3: ref i32 = array_index file.%a.var, %.loc11_23.2 -// CHECK:STDOUT: %.loc11_23.4: init i32 = initialize_from %.loc11_20 to %.loc11_23.3 [template = constants.%.30] -// CHECK:STDOUT: %.loc11_23.5: init %.28 = array_init (%.loc11_23.4) to file.%a.var [template = constants.%array] -// CHECK:STDOUT: %.loc11_24: init %.28 = converted %.loc11_23.1, %.loc11_23.5 [template = constants.%array] +// CHECK:STDOUT: %.loc11_23.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_23.3: = bound_method %.loc11_20, %.loc11_23.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc11: init i32 = call %.loc11_23.3(%.loc11_20) [template = constants.%.31] +// CHECK:STDOUT: %.loc11_23.4: init i32 = converted %.loc11_20, %int.convert_checked.loc11 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_23.5: i32 = int_value 0 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_23.6: ref i32 = array_index file.%a.var, %.loc11_23.5 +// CHECK:STDOUT: %.loc11_23.7: init i32 = initialize_from %.loc11_23.4 to %.loc11_23.6 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_23.8: init %.2 = array_init (%.loc11_23.7) to file.%a.var [template = constants.%array] +// CHECK:STDOUT: %.loc11_24: init %.2 = converted %.loc11_23.1, %.loc11_23.8 [template = constants.%array] // CHECK:STDOUT: assign file.%a.var, %.loc11_24 -// CHECK:STDOUT: %a.ref: ref %.28 = name_ref a, file.%a -// CHECK:STDOUT: %.loc15_16: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc15_17.1: ref i32 = array_index %a.ref, %.loc15_16 [template = ] +// CHECK:STDOUT: %a.ref: ref %.2 = name_ref a, file.%a +// CHECK:STDOUT: %.loc15_16.1: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc15_16.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc15_16.3: = bound_method %.loc15_16.1, %.loc15_16.2 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc15: init i32 = call %.loc15_16.3(%.loc15_16.1) [template = constants.%.33] +// CHECK:STDOUT: %.loc15_16.4: i32 = value_of_initializer %int.convert_checked.loc15 [template = constants.%.33] +// CHECK:STDOUT: %.loc15_16.5: i32 = converted %.loc15_16.1, %.loc15_16.4 [template = constants.%.33] +// CHECK:STDOUT: %.loc15_17.1: ref i32 = array_index %a.ref, %.loc15_16.5 [template = ] // CHECK:STDOUT: %.loc15_17.2: i32 = bind_value %.loc15_17.1 // CHECK:STDOUT: assign file.%b.var, %.loc15_17.2 // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/index/fail_expr_category.carbon b/toolchain/check/testdata/index/fail_expr_category.carbon index d22095d9c90b5..165f05a021534 100644 --- a/toolchain/check/testdata/index/fail_expr_category.carbon +++ b/toolchain/check/testdata/index/fail_expr_category.carbon @@ -41,21 +41,23 @@ fn G(b: [i32; 3]) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 3 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [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: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] -// CHECK:STDOUT: %.27: Core.IntLiteral = int_value 3 [template] -// CHECK:STDOUT: %.28: type = array_type %.27, i32 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.2: type = array_type %.1, i32 [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] // CHECK:STDOUT: %G.type: type = fn_type @G [template] // CHECK:STDOUT: %G: %G.type = struct_value () [template] -// CHECK:STDOUT: %.30: type = ptr_type i32 [template] +// CHECK:STDOUT: %.4: type = ptr_type i32 [template] +// CHECK:STDOUT: %.5: Core.IntLiteral = int_value 0 [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: %.29: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.30: = bound_method %.5, %Convert.15 [template] // CHECK:STDOUT: %.31: i32 = int_value 0 [template] -// CHECK:STDOUT: %.32: i32 = int_value 4 [template] +// CHECK:STDOUT: %.32: Core.IntLiteral = int_value 4 [template] +// CHECK:STDOUT: %.33: = bound_method %.32, %Convert.15 [template] +// CHECK:STDOUT: %.34: i32 = int_value 4 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -75,89 +77,107 @@ fn G(b: [i32; 3]) { // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] { -// CHECK:STDOUT: %return.patt: %.28 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %.28 = out_param_pattern %return.patt, runtime_param0 +// CHECK:STDOUT: %return.patt: %.2 = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: %.2 = out_param_pattern %return.patt, runtime_param0 // CHECK:STDOUT: } { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc11_17.1: i32 = int_value 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_17: Core.IntLiteral = int_value 3 [template = constants.%.1] // CHECK:STDOUT: %.loc11_12.1: type = value_of_initializer %int.make_type_32 [template = i32] // CHECK:STDOUT: %.loc11_12.2: type = converted %int.make_type_32, %.loc11_12.1 [template = i32] -// CHECK:STDOUT: %.loc11_17.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc11_17.3: = bound_method %.loc11_17.1, %.loc11_17.2 [template = constants.%.26] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc11_17.3(%.loc11_17.1) [template = constants.%.27] -// CHECK:STDOUT: %.loc11_17.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.27] -// CHECK:STDOUT: %.loc11_17.5: Core.IntLiteral = converted %.loc11_17.1, %.loc11_17.4 [template = constants.%.27] -// CHECK:STDOUT: %.loc11_18: type = array_type %.loc11_17.5, i32 [template = constants.%.28] -// CHECK:STDOUT: %return.param: ref %.28 = out_param runtime_param0 -// CHECK:STDOUT: %return: ref %.28 = return_slot %return.param +// CHECK:STDOUT: %.loc11_18: type = array_type %.loc11_17, i32 [template = constants.%.2] +// CHECK:STDOUT: %return.param: ref %.2 = out_param runtime_param0 +// CHECK:STDOUT: %return: ref %.2 = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] { -// CHECK:STDOUT: %b.patt: %.28 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %.28 = value_param_pattern %b.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: %.2 = binding_pattern b +// CHECK:STDOUT: %b.param_patt: %.2 = value_param_pattern %b.patt, runtime_param0 // CHECK:STDOUT: } { // CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc13_15.1: i32 = int_value 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc13_15: Core.IntLiteral = int_value 3 [template = constants.%.1] // CHECK:STDOUT: %.loc13_10.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] // CHECK:STDOUT: %.loc13_10.2: type = converted %int.make_type_32.loc13, %.loc13_10.1 [template = i32] -// CHECK:STDOUT: %.loc13_15.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc13_15.3: = bound_method %.loc13_15.1, %.loc13_15.2 [template = constants.%.26] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc13_15.3(%.loc13_15.1) [template = constants.%.27] -// CHECK:STDOUT: %.loc13_15.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.27] -// CHECK:STDOUT: %.loc13_15.5: Core.IntLiteral = converted %.loc13_15.1, %.loc13_15.4 [template = constants.%.27] -// CHECK:STDOUT: %.loc13_16: type = array_type %.loc13_15.5, i32 [template = constants.%.28] -// CHECK:STDOUT: %b.param: %.28 = value_param runtime_param0 -// CHECK:STDOUT: %b: %.28 = bind_name b, %b.param +// CHECK:STDOUT: %.loc13_16: type = array_type %.loc13_15, i32 [template = constants.%.2] +// CHECK:STDOUT: %b.param: %.2 = value_param runtime_param0 +// CHECK:STDOUT: %b: %.2 = bind_name b, %b.param // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F() -> %.28; +// CHECK:STDOUT: fn @F() -> %.2; // CHECK:STDOUT: -// CHECK:STDOUT: fn @G(%b.param_patt: %.28) { +// CHECK:STDOUT: fn @G(%b.param_patt: %.2) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int.make_type_32.loc19: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc19_14.1: type = value_of_initializer %int.make_type_32.loc19 [template = i32] // CHECK:STDOUT: %.loc19_14.2: type = converted %int.make_type_32.loc19, %.loc19_14.1 [template = i32] -// CHECK:STDOUT: %.loc19_14.3: type = ptr_type i32 [template = constants.%.30] -// CHECK:STDOUT: %pb.var: ref %.30 = var pb -// CHECK:STDOUT: %pb: ref %.30 = bind_name pb, %pb.var -// CHECK:STDOUT: %b.ref.loc19: %.28 = name_ref b, %b -// CHECK:STDOUT: %.loc19_21: i32 = int_value 0 [template = constants.%.31] -// CHECK:STDOUT: %.loc19_22.1: ref %.28 = value_as_ref %b.ref.loc19 -// CHECK:STDOUT: %.loc19_22.2: ref i32 = array_index %.loc19_22.1, %.loc19_21 +// CHECK:STDOUT: %.loc19_14.3: type = ptr_type i32 [template = constants.%.4] +// CHECK:STDOUT: %pb.var: ref %.4 = var pb +// CHECK:STDOUT: %pb: ref %.4 = bind_name pb, %pb.var +// CHECK:STDOUT: %b.ref.loc19: %.2 = name_ref b, %b +// CHECK:STDOUT: %.loc19_21.1: Core.IntLiteral = int_value 0 [template = constants.%.5] +// CHECK:STDOUT: %.loc19_21.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc19_21.3: = bound_method %.loc19_21.1, %.loc19_21.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc19: init i32 = call %.loc19_21.3(%.loc19_21.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc19_21.4: i32 = value_of_initializer %int.convert_checked.loc19 [template = constants.%.31] +// CHECK:STDOUT: %.loc19_21.5: i32 = converted %.loc19_21.1, %.loc19_21.4 [template = constants.%.31] +// CHECK:STDOUT: %.loc19_22.1: ref %.2 = value_as_ref %b.ref.loc19 +// CHECK:STDOUT: %.loc19_22.2: ref i32 = array_index %.loc19_22.1, %.loc19_21.5 // CHECK:STDOUT: %.loc19_22.3: i32 = bind_value %.loc19_22.2 -// CHECK:STDOUT: %.loc19_18: %.30 = addr_of [template = ] +// CHECK:STDOUT: %.loc19_18: %.4 = addr_of [template = ] // CHECK:STDOUT: assign %pb.var, %.loc19_18 -// CHECK:STDOUT: %b.ref.loc24: %.28 = name_ref b, %b -// CHECK:STDOUT: %.loc24_5: i32 = int_value 0 [template = constants.%.31] -// CHECK:STDOUT: %.loc24_6.1: ref %.28 = value_as_ref %b.ref.loc24 -// CHECK:STDOUT: %.loc24_6.2: ref i32 = array_index %.loc24_6.1, %.loc24_5 +// CHECK:STDOUT: %b.ref.loc24: %.2 = name_ref b, %b +// CHECK:STDOUT: %.loc24_5.1: Core.IntLiteral = int_value 0 [template = constants.%.5] +// CHECK:STDOUT: %.loc24_5.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc24_5.3: = bound_method %.loc24_5.1, %.loc24_5.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc24_5: init i32 = call %.loc24_5.3(%.loc24_5.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc24_5.4: i32 = value_of_initializer %int.convert_checked.loc24_5 [template = constants.%.31] +// CHECK:STDOUT: %.loc24_5.5: i32 = converted %.loc24_5.1, %.loc24_5.4 [template = constants.%.31] +// CHECK:STDOUT: %.loc24_6.1: ref %.2 = value_as_ref %b.ref.loc24 +// CHECK:STDOUT: %.loc24_6.2: ref i32 = array_index %.loc24_6.1, %.loc24_5.5 // CHECK:STDOUT: %.loc24_6.3: i32 = bind_value %.loc24_6.2 -// CHECK:STDOUT: %.loc24_10: i32 = int_value 4 [template = constants.%.32] -// CHECK:STDOUT: assign %.loc24_6.3, %.loc24_10 +// CHECK:STDOUT: %.loc24_10: Core.IntLiteral = int_value 4 [template = constants.%.32] +// CHECK:STDOUT: %.loc24_8.1: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc24_8.2: = bound_method %.loc24_10, %.loc24_8.1 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc24_8: init i32 = call %.loc24_8.2(%.loc24_10) [template = constants.%.34] +// CHECK:STDOUT: %.loc24_8.3: init i32 = converted %.loc24_10, %int.convert_checked.loc24_8 [template = constants.%.34] +// CHECK:STDOUT: assign %.loc24_6.3, %.loc24_8.3 // CHECK:STDOUT: %int.make_type_32.loc32: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc32_14.1: type = value_of_initializer %int.make_type_32.loc32 [template = i32] // CHECK:STDOUT: %.loc32_14.2: type = converted %int.make_type_32.loc32, %.loc32_14.1 [template = i32] -// CHECK:STDOUT: %.loc32_14.3: type = ptr_type i32 [template = constants.%.30] -// CHECK:STDOUT: %pf.var: ref %.30 = var pf -// CHECK:STDOUT: %pf: ref %.30 = bind_name pf, %pf.var +// CHECK:STDOUT: %.loc32_14.3: type = ptr_type i32 [template = constants.%.4] +// CHECK:STDOUT: %pf.var: ref %.4 = var pf +// CHECK:STDOUT: %pf: ref %.4 = bind_name pf, %pf.var // CHECK:STDOUT: %F.ref.loc32: %F.type = name_ref F, file.%F.decl [template = constants.%F] -// CHECK:STDOUT: %.loc32_20.1: ref %.28 = temporary_storage -// CHECK:STDOUT: %F.call.loc32: init %.28 = call %F.ref.loc32() to %.loc32_20.1 -// CHECK:STDOUT: %.loc32_23: i32 = int_value 0 [template = constants.%.31] -// CHECK:STDOUT: %.loc32_20.2: ref %.28 = temporary %.loc32_20.1, %F.call.loc32 -// CHECK:STDOUT: %.loc32_24.1: ref i32 = array_index %.loc32_20.2, %.loc32_23 +// CHECK:STDOUT: %.loc32_20.1: ref %.2 = temporary_storage +// CHECK:STDOUT: %F.call.loc32: init %.2 = call %F.ref.loc32() to %.loc32_20.1 +// CHECK:STDOUT: %.loc32_23.1: Core.IntLiteral = int_value 0 [template = constants.%.5] +// CHECK:STDOUT: %.loc32_20.2: ref %.2 = temporary %.loc32_20.1, %F.call.loc32 +// CHECK:STDOUT: %.loc32_23.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc32_23.3: = bound_method %.loc32_23.1, %.loc32_23.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc32: init i32 = call %.loc32_23.3(%.loc32_23.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc32_23.4: i32 = value_of_initializer %int.convert_checked.loc32 [template = constants.%.31] +// CHECK:STDOUT: %.loc32_23.5: i32 = converted %.loc32_23.1, %.loc32_23.4 [template = constants.%.31] +// CHECK:STDOUT: %.loc32_24.1: ref i32 = array_index %.loc32_20.2, %.loc32_23.5 // CHECK:STDOUT: %.loc32_24.2: i32 = bind_value %.loc32_24.1 -// CHECK:STDOUT: %.loc32_18: %.30 = addr_of [template = ] +// CHECK:STDOUT: %.loc32_18: %.4 = addr_of [template = ] // CHECK:STDOUT: assign %pf.var, %.loc32_18 // CHECK:STDOUT: %F.ref.loc36: %F.type = name_ref F, file.%F.decl [template = constants.%F] -// CHECK:STDOUT: %.loc36_4.1: ref %.28 = temporary_storage -// CHECK:STDOUT: %F.call.loc36: init %.28 = call %F.ref.loc36() to %.loc36_4.1 -// CHECK:STDOUT: %.loc36_7: i32 = int_value 0 [template = constants.%.31] -// CHECK:STDOUT: %.loc36_4.2: ref %.28 = temporary %.loc36_4.1, %F.call.loc36 -// CHECK:STDOUT: %.loc36_8.1: ref i32 = array_index %.loc36_4.2, %.loc36_7 +// CHECK:STDOUT: %.loc36_4.1: ref %.2 = temporary_storage +// CHECK:STDOUT: %F.call.loc36: init %.2 = call %F.ref.loc36() to %.loc36_4.1 +// CHECK:STDOUT: %.loc36_7.1: Core.IntLiteral = int_value 0 [template = constants.%.5] +// CHECK:STDOUT: %.loc36_4.2: ref %.2 = temporary %.loc36_4.1, %F.call.loc36 +// CHECK:STDOUT: %.loc36_7.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc36_7.3: = bound_method %.loc36_7.1, %.loc36_7.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc36_7: init i32 = call %.loc36_7.3(%.loc36_7.1) [template = constants.%.31] +// CHECK:STDOUT: %.loc36_7.4: i32 = value_of_initializer %int.convert_checked.loc36_7 [template = constants.%.31] +// CHECK:STDOUT: %.loc36_7.5: i32 = converted %.loc36_7.1, %.loc36_7.4 [template = constants.%.31] +// CHECK:STDOUT: %.loc36_8.1: ref i32 = array_index %.loc36_4.2, %.loc36_7.5 // CHECK:STDOUT: %.loc36_8.2: i32 = bind_value %.loc36_8.1 -// CHECK:STDOUT: %.loc36_12: i32 = int_value 4 [template = constants.%.32] -// CHECK:STDOUT: assign %.loc36_8.2, %.loc36_12 +// CHECK:STDOUT: %.loc36_12: Core.IntLiteral = int_value 4 [template = constants.%.32] +// CHECK:STDOUT: %.loc36_10.1: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc36_10.2: = bound_method %.loc36_12, %.loc36_10.1 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc36_10: init i32 = call %.loc36_10.2(%.loc36_12) [template = constants.%.34] +// CHECK:STDOUT: %.loc36_10.3: init i32 = converted %.loc36_12, %int.convert_checked.loc36_10 [template = constants.%.34] +// CHECK:STDOUT: assign %.loc36_8.2, %.loc36_10.3 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/index/fail_invalid_base.carbon b/toolchain/check/testdata/index/fail_invalid_base.carbon index b8bc0c328a1da..51ea0400f509c 100644 --- a/toolchain/check/testdata/index/fail_invalid_base.carbon +++ b/toolchain/check/testdata/index/fail_invalid_base.carbon @@ -22,7 +22,7 @@ fn F(); // CHECK:STDERR: var b: i32 = F[1]; -// CHECK:STDERR: fail_invalid_base.carbon:[[@LINE+4]]:14: error: type `{.a: i32, .b: i32}` does not support indexing [TypeNotIndexable] +// CHECK:STDERR: fail_invalid_base.carbon:[[@LINE+4]]:14: error: type `{.a: Core.IntLiteral, .b: Core.IntLiteral}` does not support indexing [TypeNotIndexable] // CHECK:STDERR: var c: i32 = {.a = 1, .b = 2}[0]; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -38,13 +38,14 @@ var d: i32 = {.a: i32, .b: i32}[0]; // CHECK:STDOUT: constants { // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %.2: i32 = int_value 1 [template] -// CHECK:STDOUT: %.3: i32 = int_value 2 [template] -// CHECK:STDOUT: %.4: type = struct_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.4: type = struct_type {.a: Core.IntLiteral, .b: Core.IntLiteral} [template] // CHECK:STDOUT: %struct: %.4 = struct_value (%.2, %.3) [template] +// CHECK:STDOUT: %.8: type = struct_type {.a: i32, .b: i32} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -96,15 +97,15 @@ var d: i32 = {.a: i32, .b: i32}[0]; // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %N.ref: = name_ref N, file.%N [template = file.%N] -// CHECK:STDOUT: %.loc16: i32 = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc16: Core.IntLiteral = int_value 0 [template = constants.%.1] // CHECK:STDOUT: assign file.%a.var, // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [template = constants.%F] -// CHECK:STDOUT: %.loc23: i32 = int_value 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc23: Core.IntLiteral = int_value 1 [template = constants.%.2] // CHECK:STDOUT: assign file.%b.var, -// CHECK:STDOUT: %.loc29_20: i32 = int_value 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc29_28: i32 = int_value 2 [template = constants.%.3] +// CHECK:STDOUT: %.loc29_20: Core.IntLiteral = int_value 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc29_28: Core.IntLiteral = int_value 2 [template = constants.%.3] // CHECK:STDOUT: %.loc29_29.1: %.4 = struct_literal (%.loc29_20, %.loc29_28) -// CHECK:STDOUT: %.loc29_31: i32 = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc29_31: Core.IntLiteral = int_value 0 [template = constants.%.1] // CHECK:STDOUT: %struct: %.4 = struct_value (%.loc29_20, %.loc29_28) [template = constants.%struct] // CHECK:STDOUT: %.loc29_29.2: %.4 = converted %.loc29_29.1, %struct [template = constants.%struct] // CHECK:STDOUT: assign file.%c.var, @@ -114,8 +115,8 @@ var d: i32 = {.a: i32, .b: i32}[0]; // CHECK:STDOUT: %int.make_type_32.loc34_28: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc34_28.1: type = value_of_initializer %int.make_type_32.loc34_28 [template = i32] // CHECK:STDOUT: %.loc34_28.2: type = converted %int.make_type_32.loc34_28, %.loc34_28.1 [template = i32] -// CHECK:STDOUT: %.loc34_31: type = struct_type {.a: i32, .b: i32} [template = constants.%.4] -// CHECK:STDOUT: %.loc34_33: i32 = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc34_31: type = struct_type {.a: i32, .b: i32} [template = constants.%.8] +// CHECK:STDOUT: %.loc34_33: Core.IntLiteral = int_value 0 [template = constants.%.1] // CHECK:STDOUT: assign file.%d.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/index/fail_name_not_found.carbon b/toolchain/check/testdata/index/fail_name_not_found.carbon index 81d87fd50e9d2..2de0dd00316dd 100644 --- a/toolchain/check/testdata/index/fail_name_not_found.carbon +++ b/toolchain/check/testdata/index/fail_name_not_found.carbon @@ -22,7 +22,7 @@ fn Main() { // CHECK:STDOUT: %Main: %Main.type = struct_value () [template] // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -50,7 +50,7 @@ fn Main() { // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var // CHECK:STDOUT: %a.ref: = name_ref a, [template = ] -// CHECK:STDOUT: %.loc15_18: i32 = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc15_18: Core.IntLiteral = int_value 0 [template = constants.%.1] // CHECK:STDOUT: assign %b.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/index/fail_negative_indexing.carbon b/toolchain/check/testdata/index/fail_negative_indexing.carbon index c21abc2148706..7f7b8476f0ee5 100644 --- a/toolchain/check/testdata/index/fail_negative_indexing.carbon +++ b/toolchain/check/testdata/index/fail_negative_indexing.carbon @@ -9,7 +9,7 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/index/fail_negative_indexing.carbon var c: [i32; 2] = (42, 42); -// CHECK:STDERR: fail_negative_indexing.carbon:[[@LINE+3]]:16: error: cannot access member of interface `Negate` in type `i32` that does not implement that interface [MissingImplInMemberAccess] +// CHECK:STDERR: fail_negative_indexing.carbon:[[@LINE+3]]:16: error: cannot access member of interface `Negate` in type `Core.IntLiteral` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: var d: i32 = c[-10]; // CHECK:STDERR: ^~~ var d: i32 = c[-10]; @@ -20,20 +20,20 @@ var d: i32 = c[-10]; // CHECK:STDOUT: constants { // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 2 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.2: type = array_type %.1, i32 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 42 [template] +// CHECK:STDOUT: %tuple.type: type = tuple_type (Core.IntLiteral, Core.IntLiteral) [template] +// CHECK:STDOUT: %.5: i32 = int_value 0 [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: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] -// CHECK:STDOUT: %.27: Core.IntLiteral = int_value 2 [template] -// CHECK:STDOUT: %.28: type = array_type %.27, i32 [template] -// CHECK:STDOUT: %.30: i32 = int_value 42 [template] -// CHECK:STDOUT: %tuple.type: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.31: i32 = int_value 0 [template] +// CHECK:STDOUT: %.29: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.30: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 42 [template] // CHECK:STDOUT: %.32: i32 = int_value 1 [template] -// CHECK:STDOUT: %array: %.28 = tuple_value (%.30, %.30) [template] -// CHECK:STDOUT: %.33: i32 = int_value 10 [template] +// CHECK:STDOUT: %array: %.2 = tuple_value (%.31, %.31) [template] +// CHECK:STDOUT: %.33: Core.IntLiteral = int_value 10 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -54,17 +54,12 @@ var d: i32 = c[-10]; // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc11_14.1: i32 = int_value 2 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_14: Core.IntLiteral = int_value 2 [template = constants.%.1] // CHECK:STDOUT: %.loc11_9.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] // CHECK:STDOUT: %.loc11_9.2: type = converted %int.make_type_32.loc11, %.loc11_9.1 [template = i32] -// CHECK:STDOUT: %.loc11_14.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc11_14.3: = bound_method %.loc11_14.1, %.loc11_14.2 [template = constants.%.26] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc11_14.3(%.loc11_14.1) [template = constants.%.27] -// CHECK:STDOUT: %.loc11_14.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.27] -// CHECK:STDOUT: %.loc11_14.5: Core.IntLiteral = converted %.loc11_14.1, %.loc11_14.4 [template = constants.%.27] -// CHECK:STDOUT: %.loc11_15: type = array_type %.loc11_14.5, i32 [template = constants.%.28] -// CHECK:STDOUT: %c.var: ref %.28 = var c -// CHECK:STDOUT: %c: ref %.28 = bind_name c, %c.var +// CHECK:STDOUT: %.loc11_15: type = array_type %.loc11_14, i32 [template = constants.%.2] +// CHECK:STDOUT: %c.var: ref %.2 = var c +// CHECK:STDOUT: %c: ref %.2 = bind_name c, %c.var // CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc15_8.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] // CHECK:STDOUT: %.loc15_8.2: type = converted %int.make_type_32.loc15, %.loc15_8.1 [template = i32] @@ -74,20 +69,28 @@ var d: i32 = c[-10]; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_20: i32 = int_value 42 [template = constants.%.30] -// CHECK:STDOUT: %.loc11_24: i32 = int_value 42 [template = constants.%.30] +// CHECK:STDOUT: %.loc11_20: Core.IntLiteral = int_value 42 [template = constants.%.4] +// CHECK:STDOUT: %.loc11_24: Core.IntLiteral = int_value 42 [template = constants.%.4] // CHECK:STDOUT: %.loc11_26.1: %tuple.type = tuple_literal (%.loc11_20, %.loc11_24) -// CHECK:STDOUT: %.loc11_26.2: i32 = int_value 0 [template = constants.%.31] -// CHECK:STDOUT: %.loc11_26.3: ref i32 = array_index file.%c.var, %.loc11_26.2 -// CHECK:STDOUT: %.loc11_26.4: init i32 = initialize_from %.loc11_20 to %.loc11_26.3 [template = constants.%.30] -// CHECK:STDOUT: %.loc11_26.5: i32 = int_value 1 [template = constants.%.32] +// CHECK:STDOUT: %.loc11_26.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_26.3: = bound_method %.loc11_20, %.loc11_26.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc11_26.1: init i32 = call %.loc11_26.3(%.loc11_20) [template = constants.%.31] +// CHECK:STDOUT: %.loc11_26.4: init i32 = converted %.loc11_20, %int.convert_checked.loc11_26.1 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_26.5: i32 = int_value 0 [template = constants.%.5] // CHECK:STDOUT: %.loc11_26.6: ref i32 = array_index file.%c.var, %.loc11_26.5 -// CHECK:STDOUT: %.loc11_26.7: init i32 = initialize_from %.loc11_24 to %.loc11_26.6 [template = constants.%.30] -// CHECK:STDOUT: %.loc11_26.8: init %.28 = array_init (%.loc11_26.4, %.loc11_26.7) to file.%c.var [template = constants.%array] -// CHECK:STDOUT: %.loc11_27: init %.28 = converted %.loc11_26.1, %.loc11_26.8 [template = constants.%array] +// CHECK:STDOUT: %.loc11_26.7: init i32 = initialize_from %.loc11_26.4 to %.loc11_26.6 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_26.8: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_26.9: = bound_method %.loc11_24, %.loc11_26.8 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc11_26.2: init i32 = call %.loc11_26.9(%.loc11_24) [template = constants.%.31] +// CHECK:STDOUT: %.loc11_26.10: init i32 = converted %.loc11_24, %int.convert_checked.loc11_26.2 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_26.11: i32 = int_value 1 [template = constants.%.32] +// CHECK:STDOUT: %.loc11_26.12: ref i32 = array_index file.%c.var, %.loc11_26.11 +// CHECK:STDOUT: %.loc11_26.13: init i32 = initialize_from %.loc11_26.10 to %.loc11_26.12 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_26.14: init %.2 = array_init (%.loc11_26.7, %.loc11_26.13) to file.%c.var [template = constants.%array] +// CHECK:STDOUT: %.loc11_27: init %.2 = converted %.loc11_26.1, %.loc11_26.14 [template = constants.%array] // CHECK:STDOUT: assign file.%c.var, %.loc11_27 -// CHECK:STDOUT: %c.ref: ref %.28 = name_ref c, file.%c -// CHECK:STDOUT: %.loc15_17: i32 = int_value 10 [template = constants.%.33] +// CHECK:STDOUT: %c.ref: ref %.2 = name_ref c, file.%c +// CHECK:STDOUT: %.loc15_17: Core.IntLiteral = int_value 10 [template = constants.%.33] // CHECK:STDOUT: %.loc15_19.1: ref i32 = array_index %c.ref, [template = ] // CHECK:STDOUT: %.loc15_19.2: i32 = bind_value %.loc15_19.1 // CHECK:STDOUT: assign file.%d.var, %.loc15_19.2 diff --git a/toolchain/check/testdata/index/fail_non_tuple_access.carbon b/toolchain/check/testdata/index/fail_non_tuple_access.carbon index e15962bc0e36a..2f91b680fa06b 100644 --- a/toolchain/check/testdata/index/fail_non_tuple_access.carbon +++ b/toolchain/check/testdata/index/fail_non_tuple_access.carbon @@ -9,7 +9,7 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/index/fail_non_tuple_access.carbon fn Main() { - // CHECK:STDERR: fail_non_tuple_access.carbon:[[@LINE+3]]:3: error: type `i32` does not support indexing [TypeNotIndexable] + // CHECK:STDERR: fail_non_tuple_access.carbon:[[@LINE+3]]:3: error: type `Core.IntLiteral` does not support indexing [TypeNotIndexable] // CHECK:STDERR: 0[1]; // CHECK:STDERR: ^~~~ 0[1]; @@ -20,8 +20,8 @@ fn Main() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %Main.type: type = fn_type @Main [template] // CHECK:STDOUT: %Main: %Main.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] -// CHECK:STDOUT: %.2: i32 = int_value 1 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -43,8 +43,8 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_3: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: %.loc15_5: i32 = int_value 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_3: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc15_5: Core.IntLiteral = int_value 1 [template = constants.%.2] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/fail_assoc_const_bad_default.carbon b/toolchain/check/testdata/interface/fail_assoc_const_bad_default.carbon index e31b635156c2e..35f2deaf6b75a 100644 --- a/toolchain/check/testdata/interface/fail_assoc_const_bad_default.carbon +++ b/toolchain/check/testdata/interface/fail_assoc_const_bad_default.carbon @@ -9,10 +9,10 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/fail_assoc_const_bad_default.carbon interface I { - // CHECK:STDERR: fail_assoc_const_bad_default.carbon:[[@LINE+6]]:3: error: cannot implicitly convert from `i32` to `type` [ImplicitAsConversionFailure] + // CHECK:STDERR: fail_assoc_const_bad_default.carbon:[[@LINE+6]]:3: error: cannot implicitly convert from `Core.IntLiteral` to `type` [ImplicitAsConversionFailure] // CHECK:STDERR: let T:! type = 42; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_assoc_const_bad_default.carbon:[[@LINE+3]]:3: note: type `i32` does not implement interface `ImplicitAs(type)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_assoc_const_bad_default.carbon:[[@LINE+3]]:3: note: type `Core.IntLiteral` does not implement interface `ImplicitAs(type)` [MissingImplInMemberAccessNote] // CHECK:STDERR: let T:! type = 42; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ let T:! type = 42; @@ -23,7 +23,7 @@ interface I { // CHECK:STDOUT: constants { // CHECK:STDOUT: %I.type: type = facet_type <@I> [template] // CHECK:STDOUT: %Self.1: %I.type = bind_symbolic_name Self, 0 [symbolic] -// CHECK:STDOUT: %.1: i32 = int_value 42 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 42 [template] // CHECK:STDOUT: %.27: type = assoc_entity_type %I.type, type [template] // CHECK:STDOUT: %.28: %.27 = assoc_entity element0, @I.%T [template] // CHECK:STDOUT: } @@ -47,7 +47,7 @@ interface I { // CHECK:STDOUT: // CHECK:STDOUT: interface @I { // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.1] -// CHECK:STDOUT: %.loc18_18: i32 = int_value 42 [template = constants.%.1] +// CHECK:STDOUT: %.loc18_18: Core.IntLiteral = int_value 42 [template = constants.%.1] // CHECK:STDOUT: %.loc18_20.1: type = converted %.loc18_18, [template = ] // CHECK:STDOUT: %T: type = assoc_const_decl T [template] // CHECK:STDOUT: %.loc18_20.2: %.27 = assoc_entity element0, %T [template = constants.%.28] diff --git a/toolchain/check/testdata/interface/fail_todo_assoc_const_default.carbon b/toolchain/check/testdata/interface/fail_todo_assoc_const_default.carbon index 9107e8cc1610b..3c5a036503d90 100644 --- a/toolchain/check/testdata/interface/fail_todo_assoc_const_default.carbon +++ b/toolchain/check/testdata/interface/fail_todo_assoc_const_default.carbon @@ -24,21 +24,28 @@ interface I { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %I.type: type = facet_type <@I> [template] -// CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self.1: %I.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %tuple.type.1: type = tuple_type (type, type) [template] // CHECK:STDOUT: %tuple.type.2: type = tuple_type (i32, i32) [template] // CHECK:STDOUT: %.1: type = assoc_entity_type %I.type, type [template] // CHECK:STDOUT: %.2: %.1 = assoc_entity element0, @I.%T [template] -// CHECK:STDOUT: %.3: i32 = int_value 42 [template] -// CHECK:STDOUT: %.4: type = assoc_entity_type %I.type, i32 [template] -// CHECK:STDOUT: %.5: %.4 = assoc_entity element1, @I.%N [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 42 [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: %.27: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.28: = bound_method %.3, %Convert.15 [template] +// CHECK:STDOUT: %.29: i32 = int_value 42 [template] +// CHECK:STDOUT: %.30: type = assoc_entity_type %I.type, i32 [template] +// CHECK:STDOUT: %.31: %.30 = assoc_entity element1, @I.%N [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -54,7 +61,7 @@ interface I { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { -// CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] +// CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.1] // CHECK:STDOUT: %int.make_type_32.loc16_27: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %int.make_type_32.loc16_32: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc16_35: %tuple.type.1 = tuple_literal (%int.make_type_32.loc16_27, %int.make_type_32.loc16_32) @@ -68,14 +75,19 @@ interface I { // CHECK:STDOUT: %int.make_type_32.loc20: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc20_19.1: type = value_of_initializer %int.make_type_32.loc20 [template = i32] // CHECK:STDOUT: %.loc20_19.2: type = converted %int.make_type_32.loc20, %.loc20_19.1 [template = i32] -// CHECK:STDOUT: %.loc20_25: i32 = int_value 42 [template = constants.%.3] +// CHECK:STDOUT: %.loc20_25: Core.IntLiteral = int_value 42 [template = constants.%.3] +// CHECK:STDOUT: %.loc20_27.1: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc20_27.2: = bound_method %.loc20_25, %.loc20_27.1 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc20_27.2(%.loc20_25) [template = constants.%.29] +// CHECK:STDOUT: %.loc20_27.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.29] +// CHECK:STDOUT: %.loc20_27.4: i32 = converted %.loc20_25, %.loc20_27.3 [template = constants.%.29] // CHECK:STDOUT: %N: i32 = assoc_const_decl N [template] -// CHECK:STDOUT: %.loc20_27: %.4 = assoc_entity element1, %N [template = constants.%.5] +// CHECK:STDOUT: %.loc20_27.5: %.30 = assoc_entity element1, %N [template = constants.%.31] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .T = %.loc16_36.6 -// CHECK:STDOUT: .N = %.loc20_27 +// CHECK:STDOUT: .N = %.loc20_27.5 // CHECK:STDOUT: witness = (%T, %N) // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/todo_define_not_default.carbon b/toolchain/check/testdata/interface/todo_define_not_default.carbon index 781989647c700..32040d83d8a2b 100644 --- a/toolchain/check/testdata/interface/todo_define_not_default.carbon +++ b/toolchain/check/testdata/interface/todo_define_not_default.carbon @@ -23,7 +23,7 @@ interface I { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %I.type: type = facet_type <@I> [template] -// CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self.1: %I.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] // CHECK:STDOUT: %.1: type = assoc_entity_type %I.type, %F.type [template] @@ -38,14 +38,21 @@ interface I { // CHECK:STDOUT: %tuple.type.2: type = tuple_type (i32, i32) [template] // CHECK:STDOUT: %.5: type = assoc_entity_type %I.type, type [template] // CHECK:STDOUT: %.6: %.5 = assoc_entity element2, @I.%T [template] -// CHECK:STDOUT: %.7: i32 = int_value 42 [template] -// CHECK:STDOUT: %.8: type = assoc_entity_type %I.type, i32 [template] -// CHECK:STDOUT: %.9: %.8 = assoc_entity element3, @I.%N [template] +// CHECK:STDOUT: %.7: Core.IntLiteral = int_value 42 [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: %.31: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.32: = bound_method %.7, %Convert.15 [template] +// CHECK:STDOUT: %.33: i32 = int_value 42 [template] +// CHECK:STDOUT: %.34: type = assoc_entity_type %I.type, i32 [template] +// CHECK:STDOUT: %.35: %.34 = assoc_entity element3, @I.%N [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -61,7 +68,7 @@ interface I { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { -// CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] +// CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.1] // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {} // CHECK:STDOUT: %.loc13: %.1 = assoc_entity element0, %F.decl [template = constants.%.2] // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] { @@ -102,16 +109,21 @@ interface I { // CHECK:STDOUT: %int.make_type_32.loc19: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc19_11.1: type = value_of_initializer %int.make_type_32.loc19 [template = i32] // CHECK:STDOUT: %.loc19_11.2: type = converted %int.make_type_32.loc19, %.loc19_11.1 [template = i32] -// CHECK:STDOUT: %.loc19_17: i32 = int_value 42 [template = constants.%.7] +// CHECK:STDOUT: %.loc19_17: Core.IntLiteral = int_value 42 [template = constants.%.7] +// CHECK:STDOUT: %.loc19_19.1: %Convert.type.2 = interface_witness_access constants.%.31, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc19_19.2: = bound_method %.loc19_17, %.loc19_19.1 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc19_19.2(%.loc19_17) [template = constants.%.33] +// CHECK:STDOUT: %.loc19_19.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.33] +// CHECK:STDOUT: %.loc19_19.4: i32 = converted %.loc19_17, %.loc19_19.3 [template = constants.%.33] // CHECK:STDOUT: %N: i32 = assoc_const_decl N [template] -// CHECK:STDOUT: %.loc19_19: %.8 = assoc_entity element3, %N [template = constants.%.9] +// CHECK:STDOUT: %.loc19_19.5: %.34 = assoc_entity element3, %N [template = constants.%.35] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .F = %.loc13 // CHECK:STDOUT: .G = %.loc14 // CHECK:STDOUT: .T = %.loc18_28.6 -// CHECK:STDOUT: .N = %.loc19_19 +// CHECK:STDOUT: .N = %.loc19_19.5 // CHECK:STDOUT: witness = (%F.decl, %G.decl, %T, %N) // CHECK:STDOUT: } // CHECK:STDOUT: @@ -130,7 +142,7 @@ interface I { // CHECK:STDOUT: fn(%a.param_patt: i32, %b.param_patt: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F(constants.%Self) {} +// CHECK:STDOUT: specific @F(constants.%Self.1) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @G(constants.%Self) {} +// CHECK:STDOUT: specific @G(constants.%Self.1) {} // CHECK:STDOUT: diff --git a/toolchain/check/testdata/ir/duplicate_name_same_line.carbon b/toolchain/check/testdata/ir/duplicate_name_same_line.carbon index b4a4e84ec7d4a..91f34b1ef33e9 100644 --- a/toolchain/check/testdata/ir/duplicate_name_same_line.carbon +++ b/toolchain/check/testdata/ir/duplicate_name_same_line.carbon @@ -18,13 +18,22 @@ fn A() { if (true) { var n: i32 = 1; } if (true) { var n: i32 = 2; } } // CHECK:STDOUT: %.1: bool = bool_literal true [template] // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.2: i32 = int_value 1 [template] -// CHECK:STDOUT: %.3: i32 = int_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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 1 [template] +// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.30: = bound_method %.29, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -50,8 +59,12 @@ fn A() { if (true) { var n: i32 = 1; } if (true) { var n: i32 = 2; } } // CHECK:STDOUT: %.loc11_29.2: type = converted %int.make_type_32.loc11_29, %.loc11_29.1 [template = i32] // CHECK:STDOUT: %n.var.loc11_26: ref i32 = var n // CHECK:STDOUT: %n.loc11_26: ref i32 = bind_name n, %n.var.loc11_26 -// CHECK:STDOUT: %.loc11_35: i32 = int_value 1 [template = constants.%.2] -// CHECK:STDOUT: assign %n.var.loc11_26, %.loc11_35 +// CHECK:STDOUT: %.loc11_35: Core.IntLiteral = int_value 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_36.1: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_36.2: = bound_method %.loc11_35, %.loc11_36.1 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc11_36: init i32 = call %.loc11_36.2(%.loc11_35) [template = constants.%.28] +// CHECK:STDOUT: %.loc11_36.3: init i32 = converted %.loc11_35, %int.convert_checked.loc11_36 [template = constants.%.28] +// CHECK:STDOUT: assign %n.var.loc11_26, %.loc11_36.3 // CHECK:STDOUT: br !if.else.loc11_18 // CHECK:STDOUT: // CHECK:STDOUT: !if.else.loc11_18: @@ -64,8 +77,12 @@ fn A() { if (true) { var n: i32 = 1; } if (true) { var n: i32 = 2; } } // CHECK:STDOUT: %.loc11_59.2: type = converted %int.make_type_32.loc11_59, %.loc11_59.1 [template = i32] // CHECK:STDOUT: %n.var.loc11_56: ref i32 = var n // CHECK:STDOUT: %n.loc11_56: ref i32 = bind_name n, %n.var.loc11_56 -// CHECK:STDOUT: %.loc11_65: i32 = int_value 2 [template = constants.%.3] -// CHECK:STDOUT: assign %n.var.loc11_56, %.loc11_65 +// CHECK:STDOUT: %.loc11_65: Core.IntLiteral = int_value 2 [template = constants.%.29] +// CHECK:STDOUT: %.loc11_66.1: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_66.2: = bound_method %.loc11_65, %.loc11_66.1 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc11_66: init i32 = call %.loc11_66.2(%.loc11_65) [template = constants.%.31] +// CHECK:STDOUT: %.loc11_66.3: init i32 = converted %.loc11_65, %int.convert_checked.loc11_66 [template = constants.%.31] +// CHECK:STDOUT: assign %n.var.loc11_56, %.loc11_66.3 // CHECK:STDOUT: br !if.else.loc11_48 // CHECK:STDOUT: // CHECK:STDOUT: !if.else.loc11_48: diff --git a/toolchain/check/testdata/let/compile_time_bindings.carbon b/toolchain/check/testdata/let/compile_time_bindings.carbon index 90546c98f1c75..4136342c58378 100644 --- a/toolchain/check/testdata/let/compile_time_bindings.carbon +++ b/toolchain/check/testdata/let/compile_time_bindings.carbon @@ -529,13 +529,20 @@ impl i32 as Empty { // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 0 [template] // CHECK:STDOUT: %Zero: i32 = bind_symbolic_name Zero, 0 [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -564,8 +571,13 @@ impl i32 as Empty { // CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc5_14.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] // CHECK:STDOUT: %.loc5_14.2: type = converted %int.make_type_32.loc5, %.loc5_14.1 [template = i32] -// CHECK:STDOUT: %.loc5_20: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: %Zero: i32 = bind_symbolic_name Zero, 0, %.loc5_20 [symbolic = constants.%Zero] +// CHECK:STDOUT: %.loc5_20: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc5_21.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc5_21.2: = bound_method %.loc5_20, %.loc5_21.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc5_21.2(%.loc5_20) [template = constants.%.27] +// CHECK:STDOUT: %.loc5_21.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc5_21.4: i32 = converted %.loc5_20, %.loc5_21.3 [template = constants.%.27] +// CHECK:STDOUT: %Zero: i32 = bind_symbolic_name Zero, 0, %.loc5_21.4 [symbolic = constants.%Zero] // CHECK:STDOUT: %Zero.ref: i32 = name_ref Zero, %Zero [symbolic = constants.%Zero] // CHECK:STDOUT: return %Zero.ref // CHECK:STDOUT: } @@ -578,14 +590,23 @@ impl i32 as Empty { // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] // CHECK:STDOUT: %.1: bool = bool_literal true [template] -// CHECK:STDOUT: %.2: i32 = int_value 0 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 0 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 0 [template] // CHECK:STDOUT: %Zero: i32 = bind_symbolic_name Zero, 0 [symbolic] -// CHECK:STDOUT: %.3: i32 = int_value 1 [template] +// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.30: = bound_method %.29, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -618,14 +639,24 @@ impl i32 as Empty { // CHECK:STDOUT: %int.make_type_32.loc6: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc6_16.1: type = value_of_initializer %int.make_type_32.loc6 [template = i32] // CHECK:STDOUT: %.loc6_16.2: type = converted %int.make_type_32.loc6, %.loc6_16.1 [template = i32] -// CHECK:STDOUT: %.loc6_22: i32 = int_value 0 [template = constants.%.2] -// CHECK:STDOUT: %Zero: i32 = bind_symbolic_name Zero, 0, %.loc6_22 [symbolic = constants.%Zero] +// CHECK:STDOUT: %.loc6_22: Core.IntLiteral = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc6_23.1: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc6_23.2: = bound_method %.loc6_22, %.loc6_23.1 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc6: init i32 = call %.loc6_23.2(%.loc6_22) [template = constants.%.28] +// CHECK:STDOUT: %.loc6_23.3: i32 = value_of_initializer %int.convert_checked.loc6 [template = constants.%.28] +// CHECK:STDOUT: %.loc6_23.4: i32 = converted %.loc6_22, %.loc6_23.3 [template = constants.%.28] +// CHECK:STDOUT: %Zero: i32 = bind_symbolic_name Zero, 0, %.loc6_23.4 [symbolic = constants.%Zero] // CHECK:STDOUT: %Zero.ref: i32 = name_ref Zero, %Zero [symbolic = constants.%Zero] // CHECK:STDOUT: return %Zero.ref // CHECK:STDOUT: // CHECK:STDOUT: !if.else: -// CHECK:STDOUT: %.loc9: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: return %.loc9 +// CHECK:STDOUT: %.loc9_10: Core.IntLiteral = int_value 1 [template = constants.%.29] +// CHECK:STDOUT: %.loc9_11.1: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_11.2: = bound_method %.loc9_10, %.loc9_11.1 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc9: init i32 = call %.loc9_11.2(%.loc9_10) [template = constants.%.31] +// CHECK:STDOUT: %.loc9_11.3: i32 = value_of_initializer %int.convert_checked.loc9 [template = constants.%.31] +// CHECK:STDOUT: %.loc9_11.4: i32 = converted %.loc9_10, %.loc9_11.3 [template = constants.%.31] +// CHECK:STDOUT: return %.loc9_11.4 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_return_in_interface.carbon @@ -794,16 +825,23 @@ impl i32 as Empty { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Empty.type: type = facet_type <@Empty> [template] -// CHECK:STDOUT: %Self: %Empty.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self.1: %Empty.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] -// CHECK:STDOUT: %.2: = interface_witness () [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 0 [template] +// CHECK:STDOUT: %.28: = interface_witness () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -816,7 +854,7 @@ impl i32 as Empty { // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %Empty.decl: type = interface_decl @Empty [template = constants.%Empty.type] {} {} -// CHECK:STDOUT: impl_decl @impl [template] {} { +// CHECK:STDOUT: impl_decl @impl.1 [template] {} { // CHECK:STDOUT: %int.make_type_32.loc6: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc6_6.1: type = value_of_initializer %int.make_type_32.loc6 [template = i32] // CHECK:STDOUT: %.loc6_6.2: type = converted %int.make_type_32.loc6, %.loc6_6.1 [template = i32] @@ -825,20 +863,25 @@ impl i32 as Empty { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Empty { -// CHECK:STDOUT: %Self: %Empty.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] +// CHECK:STDOUT: %Self: %Empty.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.1] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: witness = () // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl: %.loc6_6.2 as %Empty.ref { +// CHECK:STDOUT: impl @impl.1: %.loc6_6.2 as %Empty.ref { // CHECK:STDOUT: %int.make_type_32.loc10: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc10_14.1: type = value_of_initializer %int.make_type_32.loc10 [template = i32] // CHECK:STDOUT: %.loc10_14.2: type = converted %int.make_type_32.loc10, %.loc10_14.1 [template = i32] -// CHECK:STDOUT: %.loc10_20: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: %Zero: i32 = bind_name Zero, %.loc10_20 -// CHECK:STDOUT: %.loc6_19: = interface_witness () [template = constants.%.2] +// CHECK:STDOUT: %.loc10_20: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc10_21.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc10_21.2: = bound_method %.loc10_20, %.loc10_21.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc10_21.2(%.loc10_20) [template = constants.%.27] +// CHECK:STDOUT: %.loc10_21.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc10_21.4: i32 = converted %.loc10_20, %.loc10_21.3 [template = constants.%.27] +// CHECK:STDOUT: %Zero: i32 = bind_name Zero, %.loc10_21.4 +// CHECK:STDOUT: %.loc6_19: = interface_witness () [template = constants.%.28] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Zero = %Zero diff --git a/toolchain/check/testdata/let/convert.carbon b/toolchain/check/testdata/let/convert.carbon index f9cbe85656056..43ee059ef1e4f 100644 --- a/toolchain/check/testdata/let/convert.carbon +++ b/toolchain/check/testdata/let/convert.carbon @@ -24,15 +24,27 @@ fn F() -> i32 { // CHECK:STDOUT: %F: %F.type = struct_value () [template] // CHECK:STDOUT: %tuple.type.1: type = tuple_type (type, type, type) [template] // CHECK:STDOUT: %tuple.type.2: type = tuple_type (i32, i32, i32) [template] -// CHECK:STDOUT: %.2: i32 = int_value 1 [template] -// CHECK:STDOUT: %.3: i32 = int_value 2 [template] -// CHECK:STDOUT: %.4: i32 = int_value 3 [template] -// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.2, %.3, %.4) [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %tuple.type.3: type = tuple_type (Core.IntLiteral, Core.IntLiteral, Core.IntLiteral) [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: %.28: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.29: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 1 [template] +// CHECK:STDOUT: %.31: = bound_method %.3, %Convert.15 [template] +// CHECK:STDOUT: %.32: i32 = int_value 2 [template] +// CHECK:STDOUT: %.33: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.34: i32 = int_value 3 [template] +// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.30, %.32, %.34) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -71,18 +83,30 @@ fn F() -> i32 { // CHECK:STDOUT: %.loc12_24.8: type = converted %.loc12_24.1, constants.%tuple.type.2 [template = constants.%tuple.type.2] // CHECK:STDOUT: %v.var: ref %tuple.type.2 = var v // CHECK:STDOUT: %v: ref %tuple.type.2 = bind_name v, %v.var -// CHECK:STDOUT: %.loc12_29: i32 = int_value 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc12_32: i32 = int_value 2 [template = constants.%.3] -// CHECK:STDOUT: %.loc12_35: i32 = int_value 3 [template = constants.%.4] -// CHECK:STDOUT: %.loc12_36.1: %tuple.type.2 = tuple_literal (%.loc12_29, %.loc12_32, %.loc12_35) -// CHECK:STDOUT: %.loc12_36.2: ref i32 = tuple_access %v.var, element0 -// CHECK:STDOUT: %.loc12_36.3: init i32 = initialize_from %.loc12_29 to %.loc12_36.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc12_36.4: ref i32 = tuple_access %v.var, element1 -// CHECK:STDOUT: %.loc12_36.5: init i32 = initialize_from %.loc12_32 to %.loc12_36.4 [template = constants.%.3] -// CHECK:STDOUT: %.loc12_36.6: ref i32 = tuple_access %v.var, element2 -// CHECK:STDOUT: %.loc12_36.7: init i32 = initialize_from %.loc12_35 to %.loc12_36.6 [template = constants.%.4] -// CHECK:STDOUT: %.loc12_36.8: init %tuple.type.2 = tuple_init (%.loc12_36.3, %.loc12_36.5, %.loc12_36.7) to %v.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc12_37: init %tuple.type.2 = converted %.loc12_36.1, %.loc12_36.8 [template = constants.%tuple] +// CHECK:STDOUT: %.loc12_29: Core.IntLiteral = int_value 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc12_32: Core.IntLiteral = int_value 2 [template = constants.%.3] +// CHECK:STDOUT: %.loc12_35: Core.IntLiteral = int_value 3 [template = constants.%.4] +// CHECK:STDOUT: %.loc12_36.1: %tuple.type.3 = tuple_literal (%.loc12_29, %.loc12_32, %.loc12_35) +// CHECK:STDOUT: %.loc12_36.2: %Convert.type.2 = interface_witness_access constants.%.28, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_36.3: = bound_method %.loc12_29, %.loc12_36.2 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc12_36.1: init i32 = call %.loc12_36.3(%.loc12_29) [template = constants.%.30] +// CHECK:STDOUT: %.loc12_36.4: init i32 = converted %.loc12_29, %int.convert_checked.loc12_36.1 [template = constants.%.30] +// CHECK:STDOUT: %.loc12_36.5: ref i32 = tuple_access %v.var, element0 +// CHECK:STDOUT: %.loc12_36.6: init i32 = initialize_from %.loc12_36.4 to %.loc12_36.5 [template = constants.%.30] +// CHECK:STDOUT: %.loc12_36.7: %Convert.type.2 = interface_witness_access constants.%.28, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_36.8: = bound_method %.loc12_32, %.loc12_36.7 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc12_36.2: init i32 = call %.loc12_36.8(%.loc12_32) [template = constants.%.32] +// CHECK:STDOUT: %.loc12_36.9: init i32 = converted %.loc12_32, %int.convert_checked.loc12_36.2 [template = constants.%.32] +// CHECK:STDOUT: %.loc12_36.10: ref i32 = tuple_access %v.var, element1 +// CHECK:STDOUT: %.loc12_36.11: init i32 = initialize_from %.loc12_36.9 to %.loc12_36.10 [template = constants.%.32] +// CHECK:STDOUT: %.loc12_36.12: %Convert.type.2 = interface_witness_access constants.%.28, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_36.13: = bound_method %.loc12_35, %.loc12_36.12 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc12_36.3: init i32 = call %.loc12_36.13(%.loc12_35) [template = constants.%.34] +// CHECK:STDOUT: %.loc12_36.14: init i32 = converted %.loc12_35, %int.convert_checked.loc12_36.3 [template = constants.%.34] +// CHECK:STDOUT: %.loc12_36.15: ref i32 = tuple_access %v.var, element2 +// CHECK:STDOUT: %.loc12_36.16: init i32 = initialize_from %.loc12_36.14 to %.loc12_36.15 [template = constants.%.34] +// CHECK:STDOUT: %.loc12_36.17: init %tuple.type.2 = tuple_init (%.loc12_36.6, %.loc12_36.11, %.loc12_36.16) to %v.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc12_37: init %tuple.type.2 = converted %.loc12_36.1, %.loc12_36.17 [template = constants.%tuple] // CHECK:STDOUT: assign %v.var, %.loc12_37 // CHECK:STDOUT: %int.make_type_32.loc14_11: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %int.make_type_32.loc14_16: init type = call constants.%Int32() [template = i32] @@ -106,7 +130,7 @@ fn F() -> i32 { // CHECK:STDOUT: %.loc14_29: %tuple.type.2 = converted %v.ref, %tuple // CHECK:STDOUT: %w: %tuple.type.2 = bind_name w, %.loc14_29 // CHECK:STDOUT: %w.ref: %tuple.type.2 = name_ref w, %w -// CHECK:STDOUT: %.loc15_12: i32 = int_value 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_12: Core.IntLiteral = int_value 1 [template = constants.%.2] // CHECK:STDOUT: %.loc15_11: i32 = tuple_access %w.ref, element1 // CHECK:STDOUT: return %.loc15_11 // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/let/fail_duplicate_decl.carbon b/toolchain/check/testdata/let/fail_duplicate_decl.carbon index 3867d48101320..05de0137c8061 100644 --- a/toolchain/check/testdata/let/fail_duplicate_decl.carbon +++ b/toolchain/check/testdata/let/fail_duplicate_decl.carbon @@ -26,13 +26,22 @@ fn F() { // CHECK:STDOUT: %F: %F.type = struct_value () [template] // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %.2: i32 = int_value 2 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 1 [template] +// CHECK:STDOUT: %.28: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.29: = bound_method %.28, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -52,13 +61,23 @@ fn F() { // CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] // CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32.loc12, %.loc12_10.1 [template = i32] -// CHECK:STDOUT: %.loc12_16: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %a.loc12: i32 = bind_name a, %.loc12_16 +// CHECK:STDOUT: %.loc12_16: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc12_17.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_17.2: = bound_method %.loc12_16, %.loc12_17.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc12: init i32 = call %.loc12_17.2(%.loc12_16) [template = constants.%.27] +// CHECK:STDOUT: %.loc12_17.3: i32 = value_of_initializer %int.convert_checked.loc12 [template = constants.%.27] +// CHECK:STDOUT: %.loc12_17.4: i32 = converted %.loc12_16, %.loc12_17.3 [template = constants.%.27] +// CHECK:STDOUT: %a.loc12: i32 = bind_name a, %.loc12_17.4 // CHECK:STDOUT: %int.make_type_32.loc19: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc19_10.1: type = value_of_initializer %int.make_type_32.loc19 [template = i32] // CHECK:STDOUT: %.loc19_10.2: type = converted %int.make_type_32.loc19, %.loc19_10.1 [template = i32] -// CHECK:STDOUT: %.loc19_16: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: %a.loc19: i32 = bind_name a, %.loc19_16 +// CHECK:STDOUT: %.loc19_16: Core.IntLiteral = int_value 2 [template = constants.%.28] +// CHECK:STDOUT: %.loc19_17.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc19_17.2: = bound_method %.loc19_16, %.loc19_17.1 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc19: init i32 = call %.loc19_17.2(%.loc19_16) [template = constants.%.30] +// CHECK:STDOUT: %.loc19_17.3: i32 = value_of_initializer %int.convert_checked.loc19 [template = constants.%.30] +// CHECK:STDOUT: %.loc19_17.4: i32 = converted %.loc19_16, %.loc19_17.3 [template = constants.%.30] +// CHECK:STDOUT: %a.loc19: i32 = bind_name a, %.loc19_17.4 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/let/fail_generic.carbon b/toolchain/check/testdata/let/fail_generic.carbon index f48fbb929520b..9c30d50cafc33 100644 --- a/toolchain/check/testdata/let/fail_generic.carbon +++ b/toolchain/check/testdata/let/fail_generic.carbon @@ -11,10 +11,10 @@ // TODO: Should this be valid? fn F(a: i32) -> i32 { let T:! type = i32; - // CHECK:STDERR: fail_generic.carbon:[[@LINE+7]]:3: error: cannot implicitly convert from `i32` to `T` [ImplicitAsConversionFailure] + // CHECK:STDERR: fail_generic.carbon:[[@LINE+7]]:3: error: cannot implicitly convert from `Core.IntLiteral` to `T` [ImplicitAsConversionFailure] // CHECK:STDERR: let x: T = 5; // CHECK:STDERR: ^~~~~~~~~~~~~ - // CHECK:STDERR: fail_generic.carbon:[[@LINE+4]]:3: note: type `i32` does not implement interface `ImplicitAs(T)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_generic.carbon:[[@LINE+4]]:3: note: type `Core.IntLiteral` does not implement interface `ImplicitAs(T)` [MissingImplInMemberAccessNote] // CHECK:STDERR: let x: T = 5; // CHECK:STDERR: ^~~~~~~~~~~~~ // CHECK:STDERR: @@ -36,7 +36,7 @@ fn F(a: i32) -> i32 { // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] -// CHECK:STDOUT: %.1: i32 = int_value 5 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 5 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -80,7 +80,7 @@ fn F(a: i32) -> i32 { // CHECK:STDOUT: %.loc13_21.2: type = converted %int.make_type_32.loc13, %.loc13_21.1 [template = i32] // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0, %.loc13_21.2 [symbolic = constants.%T] // CHECK:STDOUT: %T.ref: type = name_ref T, %T [symbolic = constants.%T] -// CHECK:STDOUT: %.loc21_14: i32 = int_value 5 [template = constants.%.1] +// CHECK:STDOUT: %.loc21_14: Core.IntLiteral = int_value 5 [template = constants.%.1] // CHECK:STDOUT: %.loc21_15: %T = converted %.loc21_14, [template = ] // CHECK:STDOUT: %x: %T = bind_name x, // CHECK:STDOUT: %x.ref: %T = name_ref x, %x diff --git a/toolchain/check/testdata/let/fail_generic_import.carbon b/toolchain/check/testdata/let/fail_generic_import.carbon index 2703a9bcf1cc6..25ab3b5aba612 100644 --- a/toolchain/check/testdata/let/fail_generic_import.carbon +++ b/toolchain/check/testdata/let/fail_generic_import.carbon @@ -63,7 +63,7 @@ let a: T = 0; // CHECK:STDOUT: --- fail_implicit.impl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -88,7 +88,7 @@ let a: T = 0; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: i32 = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc8: Core.IntLiteral = int_value 0 [template = constants.%.1] // CHECK:STDOUT: %a: = bind_name a, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/let/fail_modifiers.carbon b/toolchain/check/testdata/let/fail_modifiers.carbon index 656a4d981868b..be6d805baf5de 100644 --- a/toolchain/check/testdata/let/fail_modifiers.carbon +++ b/toolchain/check/testdata/let/fail_modifiers.carbon @@ -88,12 +88,19 @@ protected protected let i: i32 = 1; // CHECK:STDOUT: constants { // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -140,22 +147,62 @@ protected protected let i: i32 = 1; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %b: i32 = bind_name b, %.loc15 -// CHECK:STDOUT: %.loc21: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %c: i32 = bind_name c, %.loc21 -// CHECK:STDOUT: %.loc27: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %d: i32 = bind_name d, %.loc27 -// CHECK:STDOUT: %.loc33: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %e: i32 = bind_name e, %.loc33 -// CHECK:STDOUT: %.loc46: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %f: i32 = bind_name f, %.loc46 -// CHECK:STDOUT: %.loc59: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %g: i32 = bind_name g, %.loc59 -// CHECK:STDOUT: %.loc72: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %h: i32 = bind_name h, %.loc72 -// CHECK:STDOUT: %.loc84: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %i: i32 = bind_name i, %.loc84 +// CHECK:STDOUT: %.loc15_24: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc15_25.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc15_25.2: = bound_method %.loc15_24, %.loc15_25.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc15: init i32 = call %.loc15_25.2(%.loc15_24) [template = constants.%.27] +// CHECK:STDOUT: %.loc15_25.3: i32 = value_of_initializer %int.convert_checked.loc15 [template = constants.%.27] +// CHECK:STDOUT: %.loc15_25.4: i32 = converted %.loc15_24, %.loc15_25.3 [template = constants.%.27] +// CHECK:STDOUT: %b: i32 = bind_name b, %.loc15_25.4 +// CHECK:STDOUT: %.loc21_22: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc21_23.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc21_23.2: = bound_method %.loc21_22, %.loc21_23.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc21: init i32 = call %.loc21_23.2(%.loc21_22) [template = constants.%.27] +// CHECK:STDOUT: %.loc21_23.3: i32 = value_of_initializer %int.convert_checked.loc21 [template = constants.%.27] +// CHECK:STDOUT: %.loc21_23.4: i32 = converted %.loc21_22, %.loc21_23.3 [template = constants.%.27] +// CHECK:STDOUT: %c: i32 = bind_name c, %.loc21_23.4 +// CHECK:STDOUT: %.loc27_20: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc27_21.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc27_21.2: = bound_method %.loc27_20, %.loc27_21.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc27: init i32 = call %.loc27_21.2(%.loc27_20) [template = constants.%.27] +// CHECK:STDOUT: %.loc27_21.3: i32 = value_of_initializer %int.convert_checked.loc27 [template = constants.%.27] +// CHECK:STDOUT: %.loc27_21.4: i32 = converted %.loc27_20, %.loc27_21.3 [template = constants.%.27] +// CHECK:STDOUT: %d: i32 = bind_name d, %.loc27_21.4 +// CHECK:STDOUT: %.loc33_22: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc33_23.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc33_23.2: = bound_method %.loc33_22, %.loc33_23.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc33: init i32 = call %.loc33_23.2(%.loc33_22) [template = constants.%.27] +// CHECK:STDOUT: %.loc33_23.3: i32 = value_of_initializer %int.convert_checked.loc33 [template = constants.%.27] +// CHECK:STDOUT: %.loc33_23.4: i32 = converted %.loc33_22, %.loc33_23.3 [template = constants.%.27] +// CHECK:STDOUT: %e: i32 = bind_name e, %.loc33_23.4 +// CHECK:STDOUT: %.loc46_28: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc46_29.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc46_29.2: = bound_method %.loc46_28, %.loc46_29.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc46: init i32 = call %.loc46_29.2(%.loc46_28) [template = constants.%.27] +// CHECK:STDOUT: %.loc46_29.3: i32 = value_of_initializer %int.convert_checked.loc46 [template = constants.%.27] +// CHECK:STDOUT: %.loc46_29.4: i32 = converted %.loc46_28, %.loc46_29.3 [template = constants.%.27] +// CHECK:STDOUT: %f: i32 = bind_name f, %.loc46_29.4 +// CHECK:STDOUT: %.loc59_30: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc59_31.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc59_31.2: = bound_method %.loc59_30, %.loc59_31.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc59: init i32 = call %.loc59_31.2(%.loc59_30) [template = constants.%.27] +// CHECK:STDOUT: %.loc59_31.3: i32 = value_of_initializer %int.convert_checked.loc59 [template = constants.%.27] +// CHECK:STDOUT: %.loc59_31.4: i32 = converted %.loc59_30, %.loc59_31.3 [template = constants.%.27] +// CHECK:STDOUT: %g: i32 = bind_name g, %.loc59_31.4 +// CHECK:STDOUT: %.loc72_32: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc72_33.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc72_33.2: = bound_method %.loc72_32, %.loc72_33.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc72: init i32 = call %.loc72_33.2(%.loc72_32) [template = constants.%.27] +// CHECK:STDOUT: %.loc72_33.3: i32 = value_of_initializer %int.convert_checked.loc72 [template = constants.%.27] +// CHECK:STDOUT: %.loc72_33.4: i32 = converted %.loc72_32, %.loc72_33.3 [template = constants.%.27] +// CHECK:STDOUT: %h: i32 = bind_name h, %.loc72_33.4 +// CHECK:STDOUT: %.loc84_34: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc84_35.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc84_35.2: = bound_method %.loc84_34, %.loc84_35.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc84: init i32 = call %.loc84_35.2(%.loc84_34) [template = constants.%.27] +// CHECK:STDOUT: %.loc84_35.3: i32 = value_of_initializer %int.convert_checked.loc84 [template = constants.%.27] +// CHECK:STDOUT: %.loc84_35.4: i32 = converted %.loc84_34, %.loc84_35.3 [template = constants.%.27] +// CHECK:STDOUT: %i: i32 = bind_name i, %.loc84_35.4 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/let/global.carbon b/toolchain/check/testdata/let/global.carbon index 896d6c0f20891..176348866c521 100644 --- a/toolchain/check/testdata/let/global.carbon +++ b/toolchain/check/testdata/let/global.carbon @@ -17,14 +17,21 @@ fn F() -> i32 { return n; } // CHECK:STDOUT: constants { // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 1 [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -60,8 +67,13 @@ fn F() -> i32 { return n; } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %n: i32 = bind_name n, %.loc11 +// CHECK:STDOUT: %.loc11_14: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_15.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_15.2: = bound_method %.loc11_14, %.loc11_15.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc11_15.2(%.loc11_14) [template = constants.%.27] +// CHECK:STDOUT: %.loc11_15.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc11_15.4: i32 = converted %.loc11_14, %.loc11_15.3 [template = constants.%.27] +// CHECK:STDOUT: %n: i32 = bind_name n, %.loc11_15.4 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/let/shadowed_decl.carbon b/toolchain/check/testdata/let/shadowed_decl.carbon index 6cafb8845e870..abdce43ea47a5 100644 --- a/toolchain/check/testdata/let/shadowed_decl.carbon +++ b/toolchain/check/testdata/let/shadowed_decl.carbon @@ -21,12 +21,19 @@ fn F(a: i32) -> i32 { // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -62,8 +69,13 @@ fn F(a: i32) -> i32 { // CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] // CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32.loc12, %.loc12_10.1 [template = i32] -// CHECK:STDOUT: %.loc12_16: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %a.loc12: i32 = bind_name a, %.loc12_16 +// CHECK:STDOUT: %.loc12_16: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc12_17.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_17.2: = bound_method %.loc12_16, %.loc12_17.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc12_17.2(%.loc12_16) [template = constants.%.27] +// CHECK:STDOUT: %.loc12_17.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc12_17.4: i32 = converted %.loc12_16, %.loc12_17.3 [template = constants.%.27] +// CHECK:STDOUT: %a.loc12: i32 = bind_name a, %.loc12_17.4 // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a.loc12 // CHECK:STDOUT: return %a.ref // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/namespace/add_to_import.carbon b/toolchain/check/testdata/namespace/add_to_import.carbon index dfe210a439ddf..d893f396ae67e 100644 --- a/toolchain/check/testdata/namespace/add_to_import.carbon +++ b/toolchain/check/testdata/namespace/add_to_import.carbon @@ -47,7 +47,13 @@ var a: i32 = NS.A(); // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %A.type: type = fn_type @A [template] // CHECK:STDOUT: %A: %A.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -57,6 +63,7 @@ var a: i32 = NS.A(); // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int32 = %import_ref.2 +// CHECK:STDOUT: .ImplicitAs = %import_ref.3 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -90,8 +97,13 @@ var a: i32 = NS.A(); // CHECK:STDOUT: // CHECK:STDOUT: fn @A() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc4_27: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: return %.loc4_27 +// CHECK:STDOUT: %.loc4_27: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc4_28.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_28.2: = bound_method %.loc4_27, %.loc4_28.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc4_28.2(%.loc4_27) [template = constants.%.27] +// CHECK:STDOUT: %.loc4_28.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc4_28.4: i32 = converted %.loc4_27, %.loc4_28.3 [template = constants.%.27] +// CHECK:STDOUT: return %.loc4_28.4 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { diff --git a/toolchain/check/testdata/namespace/alias.carbon b/toolchain/check/testdata/namespace/alias.carbon index a2bf276851317..95c5b273090d7 100644 --- a/toolchain/check/testdata/namespace/alias.carbon +++ b/toolchain/check/testdata/namespace/alias.carbon @@ -27,7 +27,13 @@ fn D() -> i32 { return C(); } // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %A.type: type = fn_type @A [template] // CHECK:STDOUT: %A: %A.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 0 [template] // CHECK:STDOUT: %B.type: type = fn_type @B [template] // CHECK:STDOUT: %B: %B.type = struct_value () [template] // CHECK:STDOUT: %D.type: type = fn_type @D [template] @@ -36,7 +42,8 @@ fn D() -> i32 { return C(); } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -94,8 +101,13 @@ fn D() -> i32 { return C(); } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_27: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: return %.loc15_27 +// CHECK:STDOUT: %.loc15_27: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc15_28.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc15_28.2: = bound_method %.loc15_27, %.loc15_28.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc15_28.2(%.loc15_27) [template = constants.%.27] +// CHECK:STDOUT: %.loc15_28.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc15_28.4: i32 = converted %.loc15_27, %.loc15_28.3 [template = constants.%.27] +// CHECK:STDOUT: return %.loc15_28.4 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @B() -> i32 { diff --git a/toolchain/check/testdata/namespace/fail_decl_in_alias.carbon b/toolchain/check/testdata/namespace/fail_decl_in_alias.carbon index ff6adfaa83a19..d2c7cc15c3baf 100644 --- a/toolchain/check/testdata/namespace/fail_decl_in_alias.carbon +++ b/toolchain/check/testdata/namespace/fail_decl_in_alias.carbon @@ -28,12 +28,19 @@ fn ns.A() -> i32 { return 0; } // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %.type: type = fn_type @.1 [template] // CHECK:STDOUT: %.1: %.type = struct_value () [template] -// CHECK:STDOUT: %.2: i32 = int_value 0 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 0 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -63,7 +70,12 @@ fn ns.A() -> i32 { return 0; } // CHECK:STDOUT: // CHECK:STDOUT: fn @.1() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc22_27: i32 = int_value 0 [template = constants.%.2] -// CHECK:STDOUT: return %.loc22_27 +// CHECK:STDOUT: %.loc22_27: Core.IntLiteral = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc22_28.1: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc22_28.2: = bound_method %.loc22_27, %.loc22_28.1 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc22_28.2(%.loc22_27) [template = constants.%.28] +// CHECK:STDOUT: %.loc22_28.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.28] +// CHECK:STDOUT: %.loc22_28.4: i32 = converted %.loc22_27, %.loc22_28.3 [template = constants.%.28] +// CHECK:STDOUT: return %.loc22_28.4 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/namespace/shadow.carbon b/toolchain/check/testdata/namespace/shadow.carbon index ee09fa171edfd..258cbb6b9b3fe 100644 --- a/toolchain/check/testdata/namespace/shadow.carbon +++ b/toolchain/check/testdata/namespace/shadow.carbon @@ -40,12 +40,19 @@ fn N.M.B() -> i32 { // CHECK:STDOUT: %B.type: type = fn_type @B [template] // CHECK:STDOUT: %B: %B.type = struct_value () [template] // CHECK:STDOUT: %.1: bool = bool_literal true [template] -// CHECK:STDOUT: %.2: i32 = int_value 0 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 0 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -96,14 +103,23 @@ fn N.M.B() -> i32 { // CHECK:STDOUT: %.loc22_12.2: type = converted %int.make_type_32.loc22, %.loc22_12.1 [template = i32] // CHECK:STDOUT: %A.var: ref i32 = var A // CHECK:STDOUT: %A: ref i32 = bind_name A, %A.var -// CHECK:STDOUT: %.loc22_18: i32 = int_value 0 [template = constants.%.2] -// CHECK:STDOUT: assign %A.var, %.loc22_18 +// CHECK:STDOUT: %.loc22_18: Core.IntLiteral = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc22_19.1: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc22_19.2: = bound_method %.loc22_18, %.loc22_19.1 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc22: init i32 = call %.loc22_19.2(%.loc22_18) [template = constants.%.28] +// CHECK:STDOUT: %.loc22_19.3: init i32 = converted %.loc22_18, %int.convert_checked.loc22 [template = constants.%.28] +// CHECK:STDOUT: assign %A.var, %.loc22_19.3 // CHECK:STDOUT: %A.ref.loc25: ref i32 = name_ref A, %A // CHECK:STDOUT: %.loc25: i32 = bind_value %A.ref.loc25 // CHECK:STDOUT: return %.loc25 // CHECK:STDOUT: // CHECK:STDOUT: !if.else: -// CHECK:STDOUT: %.loc27: i32 = int_value 0 [template = constants.%.2] -// CHECK:STDOUT: return %.loc27 +// CHECK:STDOUT: %.loc27_10: Core.IntLiteral = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc27_11.1: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc27_11.2: = bound_method %.loc27_10, %.loc27_11.1 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc27: init i32 = call %.loc27_11.2(%.loc27_10) [template = constants.%.28] +// CHECK:STDOUT: %.loc27_11.3: i32 = value_of_initializer %int.convert_checked.loc27 [template = constants.%.28] +// CHECK:STDOUT: %.loc27_11.4: i32 = converted %.loc27_10, %.loc27_11.3 [template = constants.%.28] +// CHECK:STDOUT: return %.loc27_11.4 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/builtin/assignment.carbon b/toolchain/check/testdata/operators/builtin/assignment.carbon index 9f29299c1803e..43938e15e9b2b 100644 --- a/toolchain/check/testdata/operators/builtin/assignment.carbon +++ b/toolchain/check/testdata/operators/builtin/assignment.carbon @@ -33,27 +33,50 @@ fn Main() { // CHECK:STDOUT: %Main: %Main.type = struct_value () [template] // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 12 [template] -// CHECK:STDOUT: %.2: i32 = int_value 9 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 12 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 12 [template] +// CHECK:STDOUT: %.28: Core.IntLiteral = int_value 9 [template] +// CHECK:STDOUT: %.29: = bound_method %.28, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 9 [template] // CHECK:STDOUT: %tuple.type.1: type = tuple_type (type, type) [template] // CHECK:STDOUT: %tuple.type.2: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.4: i32 = int_value 1 [template] -// CHECK:STDOUT: %.5: i32 = int_value 2 [template] -// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.4, %.5) [template] -// CHECK:STDOUT: %.6: i32 = int_value 0 [template] -// CHECK:STDOUT: %.7: i32 = int_value 3 [template] -// CHECK:STDOUT: %.8: i32 = int_value 4 [template] -// CHECK:STDOUT: %.9: type = struct_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %struct: %.9 = struct_value (%.4, %.5) [template] -// CHECK:STDOUT: %.11: type = ptr_type i32 [template] -// CHECK:STDOUT: %.12: i32 = int_value 5 [template] -// CHECK:STDOUT: %.13: bool = bool_literal true [template] -// CHECK:STDOUT: %.14: i32 = int_value 10 [template] +// CHECK:STDOUT: %.32: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.33: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %tuple.type.3: type = tuple_type (Core.IntLiteral, Core.IntLiteral) [template] +// CHECK:STDOUT: %.34: = bound_method %.32, %Convert.15 [template] +// CHECK:STDOUT: %.35: i32 = int_value 1 [template] +// CHECK:STDOUT: %.36: = bound_method %.33, %Convert.15 [template] +// CHECK:STDOUT: %.37: i32 = int_value 2 [template] +// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.35, %.37) [template] +// CHECK:STDOUT: %.38: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %.39: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.40: = bound_method %.39, %Convert.15 [template] +// CHECK:STDOUT: %.41: i32 = int_value 3 [template] +// CHECK:STDOUT: %.42: Core.IntLiteral = int_value 4 [template] +// CHECK:STDOUT: %.43: = bound_method %.42, %Convert.15 [template] +// CHECK:STDOUT: %.44: i32 = int_value 4 [template] +// CHECK:STDOUT: %.45: type = struct_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.47: type = struct_type {.a: Core.IntLiteral, .b: Core.IntLiteral} [template] +// CHECK:STDOUT: %struct: %.45 = struct_value (%.35, %.37) [template] +// CHECK:STDOUT: %.48: type = ptr_type i32 [template] +// CHECK:STDOUT: %.49: Core.IntLiteral = int_value 5 [template] +// CHECK:STDOUT: %.50: = bound_method %.49, %Convert.15 [template] +// CHECK:STDOUT: %.51: i32 = int_value 5 [template] +// CHECK:STDOUT: %.52: bool = bool_literal true [template] +// CHECK:STDOUT: %.53: Core.IntLiteral = int_value 10 [template] +// CHECK:STDOUT: %.54: = bound_method %.53, %Convert.15 [template] +// CHECK:STDOUT: %.55: i32 = int_value 10 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -75,11 +98,19 @@ fn Main() { // CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32.loc12, %.loc12_10.1 [template = i32] // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var -// CHECK:STDOUT: %.loc12_16: i32 = int_value 12 [template = constants.%.1] -// CHECK:STDOUT: assign %a.var, %.loc12_16 +// CHECK:STDOUT: %.loc12_16: Core.IntLiteral = int_value 12 [template = constants.%.1] +// CHECK:STDOUT: %.loc12_18.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_18.2: = bound_method %.loc12_16, %.loc12_18.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc12: init i32 = call %.loc12_18.2(%.loc12_16) [template = constants.%.27] +// CHECK:STDOUT: %.loc12_18.3: init i32 = converted %.loc12_16, %int.convert_checked.loc12 [template = constants.%.27] +// CHECK:STDOUT: assign %a.var, %.loc12_18.3 // CHECK:STDOUT: %a.ref.loc13: ref i32 = name_ref a, %a -// CHECK:STDOUT: %.loc13: i32 = int_value 9 [template = constants.%.2] -// CHECK:STDOUT: assign %a.ref.loc13, %.loc13 +// CHECK:STDOUT: %.loc13_7: Core.IntLiteral = int_value 9 [template = constants.%.28] +// CHECK:STDOUT: %.loc13_5.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_5.2: = bound_method %.loc13_7, %.loc13_5.1 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked.loc13: init i32 = call %.loc13_5.2(%.loc13_7) [template = constants.%.30] +// CHECK:STDOUT: %.loc13_5.3: init i32 = converted %.loc13_7, %int.convert_checked.loc13 [template = constants.%.30] +// CHECK:STDOUT: assign %a.ref.loc13, %.loc13_5.3 // CHECK:STDOUT: %int.make_type_32.loc15_11: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %int.make_type_32.loc15_16: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc15_19.1: %tuple.type.1 = tuple_literal (%int.make_type_32.loc15_11, %int.make_type_32.loc15_16) @@ -90,85 +121,125 @@ fn Main() { // CHECK:STDOUT: %.loc15_19.6: type = converted %.loc15_19.1, constants.%tuple.type.2 [template = constants.%tuple.type.2] // CHECK:STDOUT: %b.var: ref %tuple.type.2 = var b // CHECK:STDOUT: %b: ref %tuple.type.2 = bind_name b, %b.var -// CHECK:STDOUT: %.loc15_24: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc15_27: i32 = int_value 2 [template = constants.%.5] -// CHECK:STDOUT: %.loc15_28.1: %tuple.type.2 = tuple_literal (%.loc15_24, %.loc15_27) -// CHECK:STDOUT: %.loc15_28.2: ref i32 = tuple_access %b.var, element0 -// CHECK:STDOUT: %.loc15_28.3: init i32 = initialize_from %.loc15_24 to %.loc15_28.2 [template = constants.%.4] -// CHECK:STDOUT: %.loc15_28.4: ref i32 = tuple_access %b.var, element1 -// CHECK:STDOUT: %.loc15_28.5: init i32 = initialize_from %.loc15_27 to %.loc15_28.4 [template = constants.%.5] -// CHECK:STDOUT: %.loc15_28.6: init %tuple.type.2 = tuple_init (%.loc15_28.3, %.loc15_28.5) to %b.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc15_29: init %tuple.type.2 = converted %.loc15_28.1, %.loc15_28.6 [template = constants.%tuple] +// CHECK:STDOUT: %.loc15_24: Core.IntLiteral = int_value 1 [template = constants.%.32] +// CHECK:STDOUT: %.loc15_27: Core.IntLiteral = int_value 2 [template = constants.%.33] +// CHECK:STDOUT: %.loc15_28.1: %tuple.type.3 = tuple_literal (%.loc15_24, %.loc15_27) +// CHECK:STDOUT: %.loc15_28.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc15_28.3: = bound_method %.loc15_24, %.loc15_28.2 [template = constants.%.34] +// CHECK:STDOUT: %int.convert_checked.loc15_28.1: init i32 = call %.loc15_28.3(%.loc15_24) [template = constants.%.35] +// CHECK:STDOUT: %.loc15_28.4: init i32 = converted %.loc15_24, %int.convert_checked.loc15_28.1 [template = constants.%.35] +// CHECK:STDOUT: %.loc15_28.5: ref i32 = tuple_access %b.var, element0 +// CHECK:STDOUT: %.loc15_28.6: init i32 = initialize_from %.loc15_28.4 to %.loc15_28.5 [template = constants.%.35] +// CHECK:STDOUT: %.loc15_28.7: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc15_28.8: = bound_method %.loc15_27, %.loc15_28.7 [template = constants.%.36] +// CHECK:STDOUT: %int.convert_checked.loc15_28.2: init i32 = call %.loc15_28.8(%.loc15_27) [template = constants.%.37] +// CHECK:STDOUT: %.loc15_28.9: init i32 = converted %.loc15_27, %int.convert_checked.loc15_28.2 [template = constants.%.37] +// CHECK:STDOUT: %.loc15_28.10: ref i32 = tuple_access %b.var, element1 +// CHECK:STDOUT: %.loc15_28.11: init i32 = initialize_from %.loc15_28.9 to %.loc15_28.10 [template = constants.%.37] +// CHECK:STDOUT: %.loc15_28.12: init %tuple.type.2 = tuple_init (%.loc15_28.6, %.loc15_28.11) to %b.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc15_29: init %tuple.type.2 = converted %.loc15_28.1, %.loc15_28.12 [template = constants.%tuple] // CHECK:STDOUT: assign %b.var, %.loc15_29 // CHECK:STDOUT: %b.ref.loc16: ref %tuple.type.2 = name_ref b, %b -// CHECK:STDOUT: %.loc16_5: i32 = int_value 0 [template = constants.%.6] +// CHECK:STDOUT: %.loc16_5: Core.IntLiteral = int_value 0 [template = constants.%.38] // CHECK:STDOUT: %.loc16_4: ref i32 = tuple_access %b.ref.loc16, element0 -// CHECK:STDOUT: %.loc16_9: i32 = int_value 3 [template = constants.%.7] -// CHECK:STDOUT: assign %.loc16_4, %.loc16_9 +// CHECK:STDOUT: %.loc16_9: Core.IntLiteral = int_value 3 [template = constants.%.39] +// CHECK:STDOUT: %.loc16_7.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc16_7.2: = bound_method %.loc16_9, %.loc16_7.1 [template = constants.%.40] +// CHECK:STDOUT: %int.convert_checked.loc16: init i32 = call %.loc16_7.2(%.loc16_9) [template = constants.%.41] +// CHECK:STDOUT: %.loc16_7.3: init i32 = converted %.loc16_9, %int.convert_checked.loc16 [template = constants.%.41] +// CHECK:STDOUT: assign %.loc16_4, %.loc16_7.3 // CHECK:STDOUT: %b.ref.loc17: ref %tuple.type.2 = name_ref b, %b -// CHECK:STDOUT: %.loc17_5: i32 = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc17_5: Core.IntLiteral = int_value 1 [template = constants.%.32] // CHECK:STDOUT: %.loc17_4: ref i32 = tuple_access %b.ref.loc17, element1 -// CHECK:STDOUT: %.loc17_9: i32 = int_value 4 [template = constants.%.8] -// CHECK:STDOUT: assign %.loc17_4, %.loc17_9 +// CHECK:STDOUT: %.loc17_9: Core.IntLiteral = int_value 4 [template = constants.%.42] +// CHECK:STDOUT: %.loc17_7.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc17_7.2: = bound_method %.loc17_9, %.loc17_7.1 [template = constants.%.43] +// CHECK:STDOUT: %int.convert_checked.loc17: init i32 = call %.loc17_7.2(%.loc17_9) [template = constants.%.44] +// CHECK:STDOUT: %.loc17_7.3: init i32 = converted %.loc17_9, %int.convert_checked.loc17 [template = constants.%.44] +// CHECK:STDOUT: assign %.loc17_4, %.loc17_7.3 // CHECK:STDOUT: %int.make_type_32.loc19_15: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc19_15.1: type = value_of_initializer %int.make_type_32.loc19_15 [template = i32] // CHECK:STDOUT: %.loc19_15.2: type = converted %int.make_type_32.loc19_15, %.loc19_15.1 [template = i32] // CHECK:STDOUT: %int.make_type_32.loc19_24: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc19_24.1: type = value_of_initializer %int.make_type_32.loc19_24 [template = i32] // CHECK:STDOUT: %.loc19_24.2: type = converted %int.make_type_32.loc19_24, %.loc19_24.1 [template = i32] -// CHECK:STDOUT: %.loc19_27: type = struct_type {.a: i32, .b: i32} [template = constants.%.9] -// CHECK:STDOUT: %c.var: ref %.9 = var c -// CHECK:STDOUT: %c: ref %.9 = bind_name c, %c.var -// CHECK:STDOUT: %.loc19_37: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc19_45: i32 = int_value 2 [template = constants.%.5] -// CHECK:STDOUT: %.loc19_46.1: %.9 = struct_literal (%.loc19_37, %.loc19_45) -// CHECK:STDOUT: %.loc19_46.2: ref i32 = struct_access %c.var, element0 -// CHECK:STDOUT: %.loc19_46.3: init i32 = initialize_from %.loc19_37 to %.loc19_46.2 [template = constants.%.4] -// CHECK:STDOUT: %.loc19_46.4: ref i32 = struct_access %c.var, element1 -// CHECK:STDOUT: %.loc19_46.5: init i32 = initialize_from %.loc19_45 to %.loc19_46.4 [template = constants.%.5] -// CHECK:STDOUT: %.loc19_46.6: init %.9 = struct_init (%.loc19_46.3, %.loc19_46.5) to %c.var [template = constants.%struct] -// CHECK:STDOUT: %.loc19_47: init %.9 = converted %.loc19_46.1, %.loc19_46.6 [template = constants.%struct] +// CHECK:STDOUT: %.loc19_27: type = struct_type {.a: i32, .b: i32} [template = constants.%.45] +// CHECK:STDOUT: %c.var: ref %.45 = var c +// CHECK:STDOUT: %c: ref %.45 = bind_name c, %c.var +// CHECK:STDOUT: %.loc19_37: Core.IntLiteral = int_value 1 [template = constants.%.32] +// CHECK:STDOUT: %.loc19_45: Core.IntLiteral = int_value 2 [template = constants.%.33] +// CHECK:STDOUT: %.loc19_46.1: %.47 = struct_literal (%.loc19_37, %.loc19_45) +// CHECK:STDOUT: %.loc19_46.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc19_46.3: = bound_method %.loc19_37, %.loc19_46.2 [template = constants.%.34] +// CHECK:STDOUT: %int.convert_checked.loc19_46.1: init i32 = call %.loc19_46.3(%.loc19_37) [template = constants.%.35] +// CHECK:STDOUT: %.loc19_46.4: init i32 = converted %.loc19_37, %int.convert_checked.loc19_46.1 [template = constants.%.35] +// CHECK:STDOUT: %.loc19_46.5: ref i32 = struct_access %c.var, element0 +// CHECK:STDOUT: %.loc19_46.6: init i32 = initialize_from %.loc19_46.4 to %.loc19_46.5 [template = constants.%.35] +// CHECK:STDOUT: %.loc19_46.7: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc19_46.8: = bound_method %.loc19_45, %.loc19_46.7 [template = constants.%.36] +// CHECK:STDOUT: %int.convert_checked.loc19_46.2: init i32 = call %.loc19_46.8(%.loc19_45) [template = constants.%.37] +// CHECK:STDOUT: %.loc19_46.9: init i32 = converted %.loc19_45, %int.convert_checked.loc19_46.2 [template = constants.%.37] +// CHECK:STDOUT: %.loc19_46.10: ref i32 = struct_access %c.var, element1 +// CHECK:STDOUT: %.loc19_46.11: init i32 = initialize_from %.loc19_46.9 to %.loc19_46.10 [template = constants.%.37] +// CHECK:STDOUT: %.loc19_46.12: init %.45 = struct_init (%.loc19_46.6, %.loc19_46.11) to %c.var [template = constants.%struct] +// CHECK:STDOUT: %.loc19_47: init %.45 = converted %.loc19_46.1, %.loc19_46.12 [template = constants.%struct] // CHECK:STDOUT: assign %c.var, %.loc19_47 -// CHECK:STDOUT: %c.ref.loc20: ref %.9 = name_ref c, %c +// CHECK:STDOUT: %c.ref.loc20: ref %.45 = name_ref c, %c // CHECK:STDOUT: %.loc20_4: ref i32 = struct_access %c.ref.loc20, element0 -// CHECK:STDOUT: %.loc20_9: i32 = int_value 3 [template = constants.%.7] -// CHECK:STDOUT: assign %.loc20_4, %.loc20_9 -// CHECK:STDOUT: %c.ref.loc21: ref %.9 = name_ref c, %c +// CHECK:STDOUT: %.loc20_9: Core.IntLiteral = int_value 3 [template = constants.%.39] +// CHECK:STDOUT: %.loc20_7.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc20_7.2: = bound_method %.loc20_9, %.loc20_7.1 [template = constants.%.40] +// CHECK:STDOUT: %int.convert_checked.loc20: init i32 = call %.loc20_7.2(%.loc20_9) [template = constants.%.41] +// CHECK:STDOUT: %.loc20_7.3: init i32 = converted %.loc20_9, %int.convert_checked.loc20 [template = constants.%.41] +// CHECK:STDOUT: assign %.loc20_4, %.loc20_7.3 +// CHECK:STDOUT: %c.ref.loc21: ref %.45 = name_ref c, %c // CHECK:STDOUT: %.loc21_4: ref i32 = struct_access %c.ref.loc21, element1 -// CHECK:STDOUT: %.loc21_9: i32 = int_value 4 [template = constants.%.8] -// CHECK:STDOUT: assign %.loc21_4, %.loc21_9 +// CHECK:STDOUT: %.loc21_9: Core.IntLiteral = int_value 4 [template = constants.%.42] +// CHECK:STDOUT: %.loc21_7.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc21_7.2: = bound_method %.loc21_9, %.loc21_7.1 [template = constants.%.43] +// CHECK:STDOUT: %int.convert_checked.loc21: init i32 = call %.loc21_7.2(%.loc21_9) [template = constants.%.44] +// CHECK:STDOUT: %.loc21_7.3: init i32 = converted %.loc21_9, %int.convert_checked.loc21 [template = constants.%.44] +// CHECK:STDOUT: assign %.loc21_4, %.loc21_7.3 // CHECK:STDOUT: %int.make_type_32.loc23: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc23_13.1: type = value_of_initializer %int.make_type_32.loc23 [template = i32] // CHECK:STDOUT: %.loc23_13.2: type = converted %int.make_type_32.loc23, %.loc23_13.1 [template = i32] -// CHECK:STDOUT: %.loc23_13.3: type = ptr_type i32 [template = constants.%.11] -// CHECK:STDOUT: %p.var: ref %.11 = var p -// CHECK:STDOUT: %p: ref %.11 = bind_name p, %p.var +// CHECK:STDOUT: %.loc23_13.3: type = ptr_type i32 [template = constants.%.48] +// CHECK:STDOUT: %p.var: ref %.48 = var p +// CHECK:STDOUT: %p: ref %.48 = bind_name p, %p.var // CHECK:STDOUT: %a.ref.loc23: ref i32 = name_ref a, %a -// CHECK:STDOUT: %.loc23_17: %.11 = addr_of %a.ref.loc23 +// CHECK:STDOUT: %.loc23_17: %.48 = addr_of %a.ref.loc23 // CHECK:STDOUT: assign %p.var, %.loc23_17 -// CHECK:STDOUT: %p.ref.loc24: ref %.11 = name_ref p, %p -// CHECK:STDOUT: %.loc24_4: %.11 = bind_value %p.ref.loc24 +// CHECK:STDOUT: %p.ref.loc24: ref %.48 = name_ref p, %p +// CHECK:STDOUT: %.loc24_4: %.48 = bind_value %p.ref.loc24 // CHECK:STDOUT: %.loc24_3: ref i32 = deref %.loc24_4 -// CHECK:STDOUT: %.loc24_8: i32 = int_value 5 [template = constants.%.12] -// CHECK:STDOUT: assign %.loc24_3, %.loc24_8 -// CHECK:STDOUT: %.loc26_8: bool = bool_literal true [template = constants.%.13] +// CHECK:STDOUT: %.loc24_8: Core.IntLiteral = int_value 5 [template = constants.%.49] +// CHECK:STDOUT: %.loc24_6.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc24_6.2: = bound_method %.loc24_8, %.loc24_6.1 [template = constants.%.50] +// CHECK:STDOUT: %int.convert_checked.loc24: init i32 = call %.loc24_6.2(%.loc24_8) [template = constants.%.51] +// CHECK:STDOUT: %.loc24_6.3: init i32 = converted %.loc24_8, %int.convert_checked.loc24 [template = constants.%.51] +// CHECK:STDOUT: assign %.loc24_3, %.loc24_6.3 +// CHECK:STDOUT: %.loc26_8: bool = bool_literal true [template = constants.%.52] // CHECK:STDOUT: if %.loc26_8 br !if.expr.then else br !if.expr.else // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then: -// CHECK:STDOUT: %p.ref.loc26: ref %.11 = name_ref p, %p -// CHECK:STDOUT: %.loc26_18: %.11 = bind_value %p.ref.loc26 +// CHECK:STDOUT: %p.ref.loc26: ref %.48 = name_ref p, %p +// CHECK:STDOUT: %.loc26_18: %.48 = bind_value %p.ref.loc26 // CHECK:STDOUT: br !if.expr.result(%.loc26_18) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else: // CHECK:STDOUT: %a.ref.loc26: ref i32 = name_ref a, %a -// CHECK:STDOUT: %.loc26_25: %.11 = addr_of %a.ref.loc26 +// CHECK:STDOUT: %.loc26_25: %.48 = addr_of %a.ref.loc26 // CHECK:STDOUT: br !if.expr.result(%.loc26_25) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result: -// CHECK:STDOUT: %.loc26_5: %.11 = block_arg !if.expr.result +// CHECK:STDOUT: %.loc26_5: %.48 = block_arg !if.expr.result // CHECK:STDOUT: %.loc26_3: ref i32 = deref %.loc26_5 -// CHECK:STDOUT: %.loc26_31: i32 = int_value 10 [template = constants.%.14] -// CHECK:STDOUT: assign %.loc26_3, %.loc26_31 +// CHECK:STDOUT: %.loc26_31: Core.IntLiteral = int_value 10 [template = constants.%.53] +// CHECK:STDOUT: %.loc26_29.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc26_29.2: = bound_method %.loc26_31, %.loc26_29.1 [template = constants.%.54] +// CHECK:STDOUT: %int.convert_checked.loc26: init i32 = call %.loc26_29.2(%.loc26_31) [template = constants.%.55] +// CHECK:STDOUT: %.loc26_29.3: init i32 = converted %.loc26_31, %int.convert_checked.loc26 [template = constants.%.55] +// CHECK:STDOUT: assign %.loc26_3, %.loc26_29.3 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/builtin/fail_assignment_to_error.carbon b/toolchain/check/testdata/operators/builtin/fail_assignment_to_error.carbon index ee4738f249f9f..b40950b13eb1b 100644 --- a/toolchain/check/testdata/operators/builtin/fail_assignment_to_error.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_assignment_to_error.carbon @@ -25,7 +25,7 @@ fn Main() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %Main.type: type = fn_type @Main [template] // CHECK:STDOUT: %Main: %Main.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 42 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 42 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -47,11 +47,11 @@ fn Main() { // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %undeclared.ref: = name_ref undeclared, [template = ] -// CHECK:STDOUT: %.loc16: i32 = int_value 42 [template = constants.%.1] +// CHECK:STDOUT: %.loc16: Core.IntLiteral = int_value 42 [template = constants.%.1] // CHECK:STDOUT: assign %undeclared.ref, // CHECK:STDOUT: %also_undeclared.ref: = name_ref also_undeclared, [template = ] // CHECK:STDOUT: %.loc20_3: ref = deref -// CHECK:STDOUT: %.loc20_22: i32 = int_value 42 [template = constants.%.1] +// CHECK:STDOUT: %.loc20_22: Core.IntLiteral = int_value 42 [template = constants.%.1] // CHECK:STDOUT: assign %.loc20_3, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/operators/builtin/fail_assignment_to_non_assignable.carbon b/toolchain/check/testdata/operators/builtin/fail_assignment_to_non_assignable.carbon index 7909203aa60ae..3796f55ef4fc2 100644 --- a/toolchain/check/testdata/operators/builtin/fail_assignment_to_non_assignable.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_assignment_to_non_assignable.carbon @@ -65,25 +65,42 @@ fn Main() { // CHECK:STDOUT: %F: %F.type = struct_value () [template] // CHECK:STDOUT: %Main.type: type = fn_type @Main [template] // CHECK:STDOUT: %Main: %Main.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %.2: i32 = int_value 2 [template] -// CHECK:STDOUT: %tuple.type: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.3: i32 = int_value 3 [template] -// CHECK:STDOUT: %.4: i32 = int_value 4 [template] -// CHECK:STDOUT: %tuple.1: %tuple.type = tuple_value (%.3, %.4) [template] -// CHECK:STDOUT: %tuple.2: %tuple.type = tuple_value (%.1, %.2) [template] -// CHECK:STDOUT: %.6: i32 = int_value 0 [template] -// CHECK:STDOUT: %.7: type = ptr_type i32 [template] -// CHECK:STDOUT: %.8: type = struct_type {.x: i32, .y: i32} [template] -// CHECK:STDOUT: %struct.1: %.8 = struct_value (%.3, %.4) [template] -// CHECK:STDOUT: %struct.2: %.8 = struct_value (%.1, %.2) [template] -// CHECK:STDOUT: %.10: bool = bool_literal true [template] -// CHECK:STDOUT: %.11: i32 = int_value 10 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 2 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 1 [template] +// CHECK:STDOUT: %tuple.type.1: type = tuple_type (Core.IntLiteral, Core.IntLiteral) [template] +// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.30: Core.IntLiteral = int_value 4 [template] +// CHECK:STDOUT: %tuple.1: %tuple.type.1 = tuple_value (%.29, %.30) [template] +// CHECK:STDOUT: %tuple.2: %tuple.type.1 = tuple_value (%.1, %.2) [template] +// CHECK:STDOUT: %.32: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %.33: = bound_method %.32, %Convert.15 [template] +// CHECK:STDOUT: %.34: i32 = int_value 0 [template] +// CHECK:STDOUT: %tuple.type.2: type = tuple_type (i32, i32) [template] +// CHECK:STDOUT: %.36: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.37: i32 = int_value 2 [template] +// CHECK:STDOUT: %tuple.3: %tuple.type.2 = tuple_value (%.28, %.37) [template] +// CHECK:STDOUT: %.38: type = ptr_type i32 [template] +// CHECK:STDOUT: %.39: type = struct_type {.x: Core.IntLiteral, .y: Core.IntLiteral} [template] +// CHECK:STDOUT: %struct.1: %.39 = struct_value (%.29, %.30) [template] +// CHECK:STDOUT: %struct.2: %.39 = struct_value (%.1, %.2) [template] +// CHECK:STDOUT: %.41: bool = bool_literal true [template] +// CHECK:STDOUT: %.42: = bound_method %.29, %Convert.15 [template] +// CHECK:STDOUT: %.43: i32 = int_value 3 [template] +// CHECK:STDOUT: %.44: Core.IntLiteral = int_value 10 [template] +// CHECK:STDOUT: %.45: = bound_method %.44, %Convert.15 [template] +// CHECK:STDOUT: %.46: i32 = int_value 10 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -113,94 +130,124 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc18_3: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc18_7: i32 = int_value 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc18_3: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc18_7: Core.IntLiteral = int_value 2 [template = constants.%.2] // CHECK:STDOUT: assign %.loc18_3, %.loc18_7 // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [template = constants.%F] // CHECK:STDOUT: %F.call: init i32 = call %F.ref() -// CHECK:STDOUT: %.loc23: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: assign %F.call, %.loc23 -// CHECK:STDOUT: %.loc28_4: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc28_7: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc28_8.1: %tuple.type = tuple_literal (%.loc28_4, %.loc28_7) -// CHECK:STDOUT: %.loc28_13: i32 = int_value 3 [template = constants.%.3] -// CHECK:STDOUT: %.loc28_16: i32 = int_value 4 [template = constants.%.4] -// CHECK:STDOUT: %.loc28_17.1: %tuple.type = tuple_literal (%.loc28_13, %.loc28_16) -// CHECK:STDOUT: %.loc28_17.2: i32 = tuple_access %.loc28_8.1, element0 -// CHECK:STDOUT: %.loc28_17.3: init i32 = initialize_from %.loc28_13 to %.loc28_17.2 [template = constants.%.3] -// CHECK:STDOUT: %.loc28_17.4: i32 = tuple_access %.loc28_8.1, element1 -// CHECK:STDOUT: %.loc28_17.5: init i32 = initialize_from %.loc28_16 to %.loc28_17.4 [template = constants.%.4] -// CHECK:STDOUT: %.loc28_17.6: init %tuple.type = tuple_init (%.loc28_17.3, %.loc28_17.5) to %.loc28_8.1 [template = constants.%tuple.1] -// CHECK:STDOUT: %.loc28_10: init %tuple.type = converted %.loc28_17.1, %.loc28_17.6 [template = constants.%tuple.1] +// CHECK:STDOUT: %.loc23_9: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc23_7.1: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc23_7.2: = bound_method %.loc23_9, %.loc23_7.1 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc23: init i32 = call %.loc23_7.2(%.loc23_9) [template = constants.%.28] +// CHECK:STDOUT: %.loc23_7.3: init i32 = converted %.loc23_9, %int.convert_checked.loc23 [template = constants.%.28] +// CHECK:STDOUT: assign %F.call, %.loc23_7.3 +// CHECK:STDOUT: %.loc28_4: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc28_7: Core.IntLiteral = int_value 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc28_8.1: %tuple.type.1 = tuple_literal (%.loc28_4, %.loc28_7) +// CHECK:STDOUT: %.loc28_13: Core.IntLiteral = int_value 3 [template = constants.%.29] +// CHECK:STDOUT: %.loc28_16: Core.IntLiteral = int_value 4 [template = constants.%.30] +// CHECK:STDOUT: %.loc28_17.1: %tuple.type.1 = tuple_literal (%.loc28_13, %.loc28_16) +// CHECK:STDOUT: %.loc28_17.2: Core.IntLiteral = tuple_access %.loc28_8.1, element0 +// CHECK:STDOUT: %.loc28_17.3: init Core.IntLiteral = initialize_from %.loc28_13 to %.loc28_17.2 [template = constants.%.29] +// CHECK:STDOUT: %.loc28_17.4: Core.IntLiteral = tuple_access %.loc28_8.1, element1 +// CHECK:STDOUT: %.loc28_17.5: init Core.IntLiteral = initialize_from %.loc28_16 to %.loc28_17.4 [template = constants.%.30] +// CHECK:STDOUT: %.loc28_17.6: init %tuple.type.1 = tuple_init (%.loc28_17.3, %.loc28_17.5) to %.loc28_8.1 [template = constants.%tuple.1] +// CHECK:STDOUT: %.loc28_10: init %tuple.type.1 = converted %.loc28_17.1, %.loc28_17.6 [template = constants.%tuple.1] // CHECK:STDOUT: assign %.loc28_8.1, %.loc28_10 -// CHECK:STDOUT: %tuple.loc28: %tuple.type = tuple_value (%.loc28_4, %.loc28_7) [template = constants.%tuple.2] -// CHECK:STDOUT: %.loc28_8.2: %tuple.type = converted %.loc28_8.1, %tuple.loc28 [template = constants.%tuple.2] +// CHECK:STDOUT: %tuple.loc28: %tuple.type.1 = tuple_value (%.loc28_4, %.loc28_7) [template = constants.%tuple.2] +// CHECK:STDOUT: %.loc28_8.2: %tuple.type.1 = converted %.loc28_8.1, %tuple.loc28 [template = constants.%tuple.2] // CHECK:STDOUT: %int.make_type_32.loc29: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc29_10.1: type = value_of_initializer %int.make_type_32.loc29 [template = i32] // CHECK:STDOUT: %.loc29_10.2: type = converted %int.make_type_32.loc29, %.loc29_10.1 [template = i32] // CHECK:STDOUT: %n.var: ref i32 = var n // CHECK:STDOUT: %n: ref i32 = bind_name n, %n.var -// CHECK:STDOUT: %.loc29_16: i32 = int_value 0 [template = constants.%.6] -// CHECK:STDOUT: assign %n.var, %.loc29_16 +// CHECK:STDOUT: %.loc29_16: Core.IntLiteral = int_value 0 [template = constants.%.32] +// CHECK:STDOUT: %.loc29_17.1: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc29_17.2: = bound_method %.loc29_16, %.loc29_17.1 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc29: init i32 = call %.loc29_17.2(%.loc29_16) [template = constants.%.34] +// CHECK:STDOUT: %.loc29_17.3: init i32 = converted %.loc29_16, %int.convert_checked.loc29 [template = constants.%.34] +// CHECK:STDOUT: assign %n.var, %.loc29_17.3 // CHECK:STDOUT: %n.ref.loc34_4: ref i32 = name_ref n, %n // CHECK:STDOUT: %n.ref.loc34_7: ref i32 = name_ref n, %n -// CHECK:STDOUT: %.loc34_8.1: %tuple.type = tuple_literal (%n.ref.loc34_4, %n.ref.loc34_7) -// CHECK:STDOUT: %.loc34_13: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc34_16: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc34_17.1: %tuple.type = tuple_literal (%.loc34_13, %.loc34_16) -// CHECK:STDOUT: %.loc34_17.2: i32 = tuple_access %.loc34_8.1, element0 -// CHECK:STDOUT: %.loc34_17.3: init i32 = initialize_from %.loc34_13 to %.loc34_17.2 [template = constants.%.1] -// CHECK:STDOUT: %.loc34_17.4: i32 = tuple_access %.loc34_8.1, element1 -// CHECK:STDOUT: %.loc34_17.5: init i32 = initialize_from %.loc34_16 to %.loc34_17.4 [template = constants.%.2] -// CHECK:STDOUT: %.loc34_17.6: init %tuple.type = tuple_init (%.loc34_17.3, %.loc34_17.5) to %.loc34_8.1 [template = constants.%tuple.2] -// CHECK:STDOUT: %.loc34_10: init %tuple.type = converted %.loc34_17.1, %.loc34_17.6 [template = constants.%tuple.2] +// CHECK:STDOUT: %.loc34_8.1: %tuple.type.2 = tuple_literal (%n.ref.loc34_4, %n.ref.loc34_7) +// CHECK:STDOUT: %.loc34_13: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc34_16: Core.IntLiteral = int_value 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc34_17.1: %tuple.type.1 = tuple_literal (%.loc34_13, %.loc34_16) +// CHECK:STDOUT: %.loc34_17.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc34_17.3: = bound_method %.loc34_13, %.loc34_17.2 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc34_17.1: init i32 = call %.loc34_17.3(%.loc34_13) [template = constants.%.28] +// CHECK:STDOUT: %.loc34_17.4: init i32 = converted %.loc34_13, %int.convert_checked.loc34_17.1 [template = constants.%.28] +// CHECK:STDOUT: %.loc34_17.5: i32 = tuple_access %.loc34_8.1, element0 +// CHECK:STDOUT: %.loc34_17.6: init i32 = initialize_from %.loc34_17.4 to %.loc34_17.5 [template = constants.%.28] +// CHECK:STDOUT: %.loc34_17.7: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc34_17.8: = bound_method %.loc34_16, %.loc34_17.7 [template = constants.%.36] +// CHECK:STDOUT: %int.convert_checked.loc34_17.2: init i32 = call %.loc34_17.8(%.loc34_16) [template = constants.%.37] +// CHECK:STDOUT: %.loc34_17.9: init i32 = converted %.loc34_16, %int.convert_checked.loc34_17.2 [template = constants.%.37] +// CHECK:STDOUT: %.loc34_17.10: i32 = tuple_access %.loc34_8.1, element1 +// CHECK:STDOUT: %.loc34_17.11: init i32 = initialize_from %.loc34_17.9 to %.loc34_17.10 [template = constants.%.37] +// CHECK:STDOUT: %.loc34_17.12: init %tuple.type.2 = tuple_init (%.loc34_17.6, %.loc34_17.11) to %.loc34_8.1 [template = constants.%tuple.3] +// CHECK:STDOUT: %.loc34_10: init %tuple.type.2 = converted %.loc34_17.1, %.loc34_17.12 [template = constants.%tuple.3] // CHECK:STDOUT: assign %.loc34_8.1, %.loc34_10 // CHECK:STDOUT: %.loc34_4: i32 = bind_value %n.ref.loc34_4 // CHECK:STDOUT: %.loc34_7: i32 = bind_value %n.ref.loc34_7 -// CHECK:STDOUT: %tuple.loc34: %tuple.type = tuple_value (%.loc34_4, %.loc34_7) -// CHECK:STDOUT: %.loc34_8.2: %tuple.type = converted %.loc34_8.1, %tuple.loc34 +// CHECK:STDOUT: %tuple.loc34: %tuple.type.2 = tuple_value (%.loc34_4, %.loc34_7) +// CHECK:STDOUT: %.loc34_8.2: %tuple.type.2 = converted %.loc34_8.1, %tuple.loc34 // CHECK:STDOUT: %int.make_type_32.loc39_3: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %int.make_type_32.loc39_9: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc39_12.1: type = value_of_initializer %int.make_type_32.loc39_9 [template = i32] // CHECK:STDOUT: %.loc39_12.2: type = converted %int.make_type_32.loc39_9, %.loc39_12.1 [template = i32] -// CHECK:STDOUT: %.loc39_12.3: type = ptr_type i32 [template = constants.%.7] +// CHECK:STDOUT: %.loc39_12.3: type = ptr_type i32 [template = constants.%.38] // CHECK:STDOUT: assign %int.make_type_32.loc39_3, %.loc39_12.3 -// CHECK:STDOUT: %.loc44_9: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc44_17: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc44_18.1: %.8 = struct_literal (%.loc44_9, %.loc44_17) -// CHECK:STDOUT: %.loc44_28: i32 = int_value 3 [template = constants.%.3] -// CHECK:STDOUT: %.loc44_36: i32 = int_value 4 [template = constants.%.4] -// CHECK:STDOUT: %.loc44_37.1: %.8 = struct_literal (%.loc44_28, %.loc44_36) -// CHECK:STDOUT: %.loc44_37.2: i32 = struct_access %.loc44_18.1, element0 -// CHECK:STDOUT: %.loc44_37.3: init i32 = initialize_from %.loc44_28 to %.loc44_37.2 [template = constants.%.3] -// CHECK:STDOUT: %.loc44_37.4: i32 = struct_access %.loc44_18.1, element1 -// CHECK:STDOUT: %.loc44_37.5: init i32 = initialize_from %.loc44_36 to %.loc44_37.4 [template = constants.%.4] -// CHECK:STDOUT: %.loc44_37.6: init %.8 = struct_init (%.loc44_37.3, %.loc44_37.5) to %.loc44_18.1 [template = constants.%struct.1] -// CHECK:STDOUT: %.loc44_20: init %.8 = converted %.loc44_37.1, %.loc44_37.6 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc44_9: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc44_17: Core.IntLiteral = int_value 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc44_18.1: %.39 = struct_literal (%.loc44_9, %.loc44_17) +// CHECK:STDOUT: %.loc44_28: Core.IntLiteral = int_value 3 [template = constants.%.29] +// CHECK:STDOUT: %.loc44_36: Core.IntLiteral = int_value 4 [template = constants.%.30] +// CHECK:STDOUT: %.loc44_37.1: %.39 = struct_literal (%.loc44_28, %.loc44_36) +// CHECK:STDOUT: %.loc44_37.2: Core.IntLiteral = struct_access %.loc44_18.1, element0 +// CHECK:STDOUT: %.loc44_37.3: init Core.IntLiteral = initialize_from %.loc44_28 to %.loc44_37.2 [template = constants.%.29] +// CHECK:STDOUT: %.loc44_37.4: Core.IntLiteral = struct_access %.loc44_18.1, element1 +// CHECK:STDOUT: %.loc44_37.5: init Core.IntLiteral = initialize_from %.loc44_36 to %.loc44_37.4 [template = constants.%.30] +// CHECK:STDOUT: %.loc44_37.6: init %.39 = struct_init (%.loc44_37.3, %.loc44_37.5) to %.loc44_18.1 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc44_20: init %.39 = converted %.loc44_37.1, %.loc44_37.6 [template = constants.%struct.1] // CHECK:STDOUT: assign %.loc44_18.1, %.loc44_20 -// CHECK:STDOUT: %struct: %.8 = struct_value (%.loc44_9, %.loc44_17) [template = constants.%struct.2] -// CHECK:STDOUT: %.loc44_18.2: %.8 = converted %.loc44_18.1, %struct [template = constants.%struct.2] -// CHECK:STDOUT: %.loc49_7: bool = bool_literal true [template = constants.%.10] +// CHECK:STDOUT: %struct: %.39 = struct_value (%.loc44_9, %.loc44_17) [template = constants.%struct.2] +// CHECK:STDOUT: %.loc44_18.2: %.39 = converted %.loc44_18.1, %struct [template = constants.%struct.2] +// CHECK:STDOUT: %.loc49_7: bool = bool_literal true [template = constants.%.41] // CHECK:STDOUT: if %.loc49_7 br !if.expr.then.loc49 else br !if.expr.else.loc49 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc49: -// CHECK:STDOUT: %.loc49_17: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: br !if.expr.result.loc49(%.loc49_17) +// CHECK:STDOUT: %.loc49_17: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc49_12.1: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc49_12.2: = bound_method %.loc49_17, %.loc49_12.1 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc49_12: init i32 = call %.loc49_12.2(%.loc49_17) [template = constants.%.28] +// CHECK:STDOUT: %.loc49_12.3: i32 = value_of_initializer %int.convert_checked.loc49_12 [template = constants.%.28] +// CHECK:STDOUT: %.loc49_12.4: i32 = converted %.loc49_17, %.loc49_12.3 [template = constants.%.28] +// CHECK:STDOUT: br !if.expr.result.loc49(%.loc49_12.4) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc49: -// CHECK:STDOUT: %.loc49_24: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: br !if.expr.result.loc49(%.loc49_24) +// CHECK:STDOUT: %.loc49_24: Core.IntLiteral = int_value 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc49_19.1: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc49_19.2: = bound_method %.loc49_24, %.loc49_19.1 [template = constants.%.36] +// CHECK:STDOUT: %int.convert_checked.loc49_19: init i32 = call %.loc49_19.2(%.loc49_24) [template = constants.%.37] +// CHECK:STDOUT: %.loc49_19.3: i32 = value_of_initializer %int.convert_checked.loc49_19 [template = constants.%.37] +// CHECK:STDOUT: %.loc49_19.4: i32 = converted %.loc49_24, %.loc49_19.3 [template = constants.%.37] +// CHECK:STDOUT: br !if.expr.result.loc49(%.loc49_19.4) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc49: -// CHECK:STDOUT: %.loc49_4: i32 = block_arg !if.expr.result.loc49 [template = constants.%.1] -// CHECK:STDOUT: %.loc49_29: i32 = int_value 3 [template = constants.%.3] -// CHECK:STDOUT: assign %.loc49_4, %.loc49_29 +// CHECK:STDOUT: %.loc49_4: i32 = block_arg !if.expr.result.loc49 [template = constants.%.28] +// CHECK:STDOUT: %.loc49_29: Core.IntLiteral = int_value 3 [template = constants.%.29] +// CHECK:STDOUT: %.loc49_27.1: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc49_27.2: = bound_method %.loc49_29, %.loc49_27.1 [template = constants.%.42] +// CHECK:STDOUT: %int.convert_checked.loc49_27: init i32 = call %.loc49_27.2(%.loc49_29) [template = constants.%.43] +// CHECK:STDOUT: %.loc49_27.3: init i32 = converted %.loc49_29, %int.convert_checked.loc49_27 [template = constants.%.43] +// CHECK:STDOUT: assign %.loc49_4, %.loc49_27.3 // CHECK:STDOUT: %int.make_type_32.loc52: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc52_10.1: type = value_of_initializer %int.make_type_32.loc52 [template = i32] // CHECK:STDOUT: %.loc52_10.2: type = converted %int.make_type_32.loc52, %.loc52_10.1 [template = i32] // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var -// CHECK:STDOUT: %.loc56_7: bool = bool_literal true [template = constants.%.10] +// CHECK:STDOUT: %.loc56_7: bool = bool_literal true [template = constants.%.41] // CHECK:STDOUT: if %.loc56_7 br !if.expr.then.loc56 else br !if.expr.else.loc56 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc56: @@ -215,8 +262,12 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc56: // CHECK:STDOUT: %.loc56_4: i32 = block_arg !if.expr.result.loc56 -// CHECK:STDOUT: %.loc56_29: i32 = int_value 10 [template = constants.%.11] -// CHECK:STDOUT: assign %.loc56_4, %.loc56_29 +// CHECK:STDOUT: %.loc56_29: Core.IntLiteral = int_value 10 [template = constants.%.44] +// CHECK:STDOUT: %.loc56_27.1: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc56_27.2: = bound_method %.loc56_29, %.loc56_27.1 [template = constants.%.45] +// CHECK:STDOUT: %int.convert_checked.loc56: init i32 = call %.loc56_27.2(%.loc56_29) [template = constants.%.46] +// CHECK:STDOUT: %.loc56_27.3: init i32 = converted %.loc56_29, %int.convert_checked.loc56 [template = constants.%.46] +// CHECK:STDOUT: assign %.loc56_4, %.loc56_27.3 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/builtin/fail_redundant_compound_access.carbon b/toolchain/check/testdata/operators/builtin/fail_redundant_compound_access.carbon index eaeec18616fe0..ca05cd91165b0 100644 --- a/toolchain/check/testdata/operators/builtin/fail_redundant_compound_access.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_redundant_compound_access.carbon @@ -30,15 +30,24 @@ fn Main() { // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 0 [template] // CHECK:STDOUT: %Main.type: type = fn_type @Main [template] // CHECK:STDOUT: %Main: %Main.type = struct_value () [template] -// CHECK:STDOUT: %.2: i32 = int_value 3 [template] +// CHECK:STDOUT: %.28: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.29: = bound_method %.28, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 3 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -66,8 +75,13 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_24: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: return %.loc11_24 +// CHECK:STDOUT: %.loc11_24: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_25.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_25.2: = bound_method %.loc11_24, %.loc11_25.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc11_25.2(%.loc11_24) [template = constants.%.27] +// CHECK:STDOUT: %.loc11_25.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc11_25.4: i32 = converted %.loc11_24, %.loc11_25.3 [template = constants.%.27] +// CHECK:STDOUT: return %.loc11_25.4 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { @@ -77,8 +91,12 @@ fn Main() { // CHECK:STDOUT: %.loc14_10.2: type = converted %int.make_type_32, %.loc14_10.1 [template = i32] // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var -// CHECK:STDOUT: %.loc14_16: i32 = int_value 3 [template = constants.%.2] -// CHECK:STDOUT: assign %a.var, %.loc14_16 +// CHECK:STDOUT: %.loc14_16: Core.IntLiteral = int_value 3 [template = constants.%.28] +// CHECK:STDOUT: %.loc14_17.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc14_17.2: = bound_method %.loc14_16, %.loc14_17.1 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc14_17.2(%.loc14_16) [template = constants.%.30] +// CHECK:STDOUT: %.loc14_17.3: init i32 = converted %.loc14_16, %int.convert_checked [template = constants.%.30] +// CHECK:STDOUT: assign %a.var, %.loc14_17.3 // CHECK:STDOUT: %a.ref.loc19_3: ref i32 = name_ref a, %a // CHECK:STDOUT: %a.ref.loc19_7: ref i32 = name_ref a, %a // CHECK:STDOUT: %a.ref.loc19_10: ref i32 = name_ref a, %a diff --git a/toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon b/toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon index 470f64318b56b..83b7b33334067 100644 --- a/toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon @@ -9,10 +9,10 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon fn Main() { - // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+6]]:17: error: cannot implicitly convert from `i32` to `bool` [ImplicitAsConversionFailure] + // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+6]]:17: error: cannot implicitly convert from `Core.IntLiteral` to `bool` [ImplicitAsConversionFailure] // CHECK:STDERR: var x: bool = not 12; // CHECK:STDERR: ^~~~~~ - // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+3]]:17: note: type `i32` does not implement interface `ImplicitAs(bool)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+3]]:17: note: type `Core.IntLiteral` does not implement interface `ImplicitAs(bool)` [MissingImplInMemberAccessNote] // CHECK:STDERR: var x: bool = not 12; // CHECK:STDERR: ^~~~~~ var x: bool = not 12; @@ -25,7 +25,7 @@ fn Main() { // CHECK:STDOUT: %Main: %Main.type = struct_value () [template] // CHECK:STDOUT: %Bool.type: type = fn_type @Bool [template] // CHECK:STDOUT: %Bool: %Bool.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 12 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 12 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -53,7 +53,7 @@ fn Main() { // CHECK:STDOUT: %.loc18_10.2: type = converted %bool.make_type, %.loc18_10.1 [template = bool] // CHECK:STDOUT: %x.var: ref bool = var x // CHECK:STDOUT: %x: ref bool = bind_name x, %x.var -// CHECK:STDOUT: %.loc18_21: i32 = int_value 12 [template = constants.%.1] +// CHECK:STDOUT: %.loc18_21: Core.IntLiteral = int_value 12 [template = constants.%.1] // CHECK:STDOUT: %.loc18_17.1: bool = converted %.loc18_21, [template = ] // CHECK:STDOUT: %.loc18_17.2: = not [template = ] // CHECK:STDOUT: assign %x.var, diff --git a/toolchain/check/testdata/operators/builtin/fail_type_mismatch_assignment.carbon b/toolchain/check/testdata/operators/builtin/fail_type_mismatch_assignment.carbon index beb12424b79cf..7fdd6aedf38a5 100644 --- a/toolchain/check/testdata/operators/builtin/fail_type_mismatch_assignment.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_type_mismatch_assignment.carbon @@ -26,8 +26,14 @@ fn Main() { // CHECK:STDOUT: %Main: %Main.type = struct_value () [template] // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 3 [template] -// CHECK:STDOUT: %.2: f64 = float_literal 5.6000000000000005 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 3 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 3 [template] +// CHECK:STDOUT: %.28: f64 = float_literal 5.6000000000000005 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -55,10 +61,14 @@ fn Main() { // CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32, %.loc12_10.1 [template = i32] // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var -// CHECK:STDOUT: %.loc12_16: i32 = int_value 3 [template = constants.%.1] -// CHECK:STDOUT: assign %a.var, %.loc12_16 +// CHECK:STDOUT: %.loc12_16: Core.IntLiteral = int_value 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc12_17.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_17.2: = bound_method %.loc12_16, %.loc12_17.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc12_17.2(%.loc12_16) [template = constants.%.27] +// CHECK:STDOUT: %.loc12_17.3: init i32 = converted %.loc12_16, %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: assign %a.var, %.loc12_17.3 // CHECK:STDOUT: %a.ref: ref i32 = name_ref a, %a -// CHECK:STDOUT: %.loc19_7: f64 = float_literal 5.6000000000000005 [template = constants.%.2] +// CHECK:STDOUT: %.loc19_7: f64 = float_literal 5.6000000000000005 [template = constants.%.28] // CHECK:STDOUT: %.loc19_5: i32 = converted %.loc19_7, [template = ] // CHECK:STDOUT: assign %a.ref, // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon b/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon index fb990f7c9f230..3a18a45769548 100644 --- a/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon @@ -11,7 +11,7 @@ fn Main() -> i32 { // The following line has two mismatches, but after the first, it shouldn't // keep erroring. - // CHECK:STDERR: fail_type_mismatch_once.carbon:[[@LINE+7]]:10: error: cannot access member of interface `Add` in type `i32` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: fail_type_mismatch_once.carbon:[[@LINE+7]]:10: error: cannot access member of interface `Add` in type `Core.IntLiteral` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: return 12 + 3.4 + 12; // CHECK:STDERR: ^~~~~~~~ // CHECK:STDERR: @@ -28,7 +28,7 @@ fn Main() -> i32 { // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %Main.type: type = fn_type @Main [template] // CHECK:STDOUT: %Main: %Main.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 12 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 12 [template] // CHECK:STDOUT: %.2: f64 = float_literal 3.4000000000000004 [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -61,9 +61,9 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc21_10: i32 = int_value 12 [template = constants.%.1] +// CHECK:STDOUT: %.loc21_10: Core.IntLiteral = int_value 12 [template = constants.%.1] // CHECK:STDOUT: %.loc21_15: f64 = float_literal 3.4000000000000004 [template = constants.%.2] -// CHECK:STDOUT: %.loc21_21: i32 = int_value 12 [template = constants.%.1] +// CHECK:STDOUT: %.loc21_21: Core.IntLiteral = int_value 12 [template = constants.%.1] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon b/toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon index 832b1ffcaa21a..bf60b2e2b6c46 100644 --- a/toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon @@ -9,7 +9,7 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon fn Main() -> i32 { - // CHECK:STDERR: fail_unimplemented_op.carbon:[[@LINE+3]]:10: error: cannot access member of interface `Add` in type `i32` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: fail_unimplemented_op.carbon:[[@LINE+3]]:10: error: cannot access member of interface `Add` in type `Core.IntLiteral` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: return 12 + 34; // CHECK:STDERR: ^~~~~~~ return 12 + 34; @@ -22,8 +22,8 @@ fn Main() -> i32 { // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %Main.type: type = fn_type @Main [template] // CHECK:STDOUT: %Main: %Main.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 12 [template] -// CHECK:STDOUT: %.2: i32 = int_value 34 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 12 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 34 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -55,8 +55,8 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_10: i32 = int_value 12 [template = constants.%.1] -// CHECK:STDOUT: %.loc15_15: i32 = int_value 34 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_10: Core.IntLiteral = int_value 12 [template = constants.%.1] +// CHECK:STDOUT: %.loc15_15: Core.IntLiteral = int_value 34 [template = constants.%.2] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/index.carbon b/toolchain/check/testdata/operators/overloaded/index.carbon index 0b6d16ad0f012..35f46a6b2b3ef 100644 --- a/toolchain/check/testdata/operators/overloaded/index.carbon +++ b/toolchain/check/testdata/operators/overloaded/index.carbon @@ -54,10 +54,10 @@ impl C as Core.IndexWith(SubscriptType, ElementType) { } let c: C = {}; -// CHECK:STDERR: fail_invalid_subscript_type.carbon:[[@LINE+7]]:22: error: cannot implicitly convert from `i32` to `SubscriptType` [ImplicitAsConversionFailure] +// CHECK:STDERR: fail_invalid_subscript_type.carbon:[[@LINE+7]]:22: error: cannot implicitly convert from `Core.IntLiteral` to `SubscriptType` [ImplicitAsConversionFailure] // CHECK:STDERR: let x: ElementType = c[0]; // CHECK:STDERR: ^~~~ -// CHECK:STDERR: fail_invalid_subscript_type.carbon:[[@LINE+4]]:22: note: type `i32` does not implement interface `ImplicitAs(SubscriptType)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_invalid_subscript_type.carbon:[[@LINE+4]]:22: note: type `Core.IntLiteral` does not implement interface `ImplicitAs(SubscriptType)` [MissingImplInMemberAccessNote] // CHECK:STDERR: let x: ElementType = c[0]; // CHECK:STDERR: ^~~~ // CHECK:STDERR: @@ -229,16 +229,28 @@ let x: i32 = c[0]; // CHECK:STDOUT: %At.2: %At.type.2 = struct_value () [template] // CHECK:STDOUT: %At.type.3: type = fn_type @At.1, @IndexWith(i32, i32) [template] // CHECK:STDOUT: %.5: = interface_witness (%At.2) [template] -// CHECK:STDOUT: %.7: i32 = int_value 0 [template] -// CHECK:STDOUT: %.8: i32 = int_value 1 [template] -// CHECK:STDOUT: %.9: i32 = int_value 5 [template] -// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.8, %.9) [template] +// CHECK:STDOUT: %.7: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %.8: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.9: Core.IntLiteral = int_value 5 [template] +// CHECK:STDOUT: %tuple.type.3: type = tuple_type (Core.IntLiteral, Core.IntLiteral) [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: %.33: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.34: = bound_method %.8, %Convert.15 [template] +// CHECK:STDOUT: %.35: i32 = int_value 1 [template] +// CHECK:STDOUT: %.36: = bound_method %.9, %Convert.15 [template] +// CHECK:STDOUT: %.37: i32 = int_value 5 [template] +// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.35, %.37) [template] +// CHECK:STDOUT: %.38: = bound_method %.7, %Convert.15 [template] +// CHECK:STDOUT: %.39: i32 = int_value 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int32 = %import_ref.1 // CHECK:STDOUT: .IndexWith = %import_ref.2 +// CHECK:STDOUT: .ImplicitAs = %import_ref.7 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -252,7 +264,7 @@ let x: i32 = c[0]; // CHECK:STDOUT: .e = @__global_init.%e // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: impl_decl @impl [template] {} { +// CHECK:STDOUT: impl_decl @impl.1 [template] {} { // CHECK:STDOUT: %int.make_type_32.loc4_7: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %int.make_type_32.loc4_12: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc4_15.1: %tuple.type.1 = tuple_literal (%int.make_type_32.loc4_7, %int.make_type_32.loc4_12) @@ -284,7 +296,7 @@ let x: i32 = c[0]; // CHECK:STDOUT: %.loc11_8.2: type = converted %int.make_type_32.loc11, %.loc11_8.1 [template = i32] // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl: %.loc4_15.6 as %IndexWith.type { +// CHECK:STDOUT: impl @impl.1: %.loc4_15.6 as %IndexWith.type { // CHECK:STDOUT: %At.decl: %At.type.2 = fn_decl @At.2 [template = constants.%At.2] { // CHECK:STDOUT: %self.patt: %tuple.type.2 = binding_pattern self // CHECK:STDOUT: %self.param_patt: %tuple.type.2 = value_param_pattern %self.patt, runtime_param0 @@ -293,7 +305,7 @@ let x: i32 = c[0]; // CHECK:STDOUT: %return.patt: i32 = return_slot_pattern // CHECK:STDOUT: %return.param_patt: i32 = out_param_pattern %return.patt, runtime_param2 // CHECK:STDOUT: } { -// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.%.loc4_15.6 [template = constants.%tuple.type.2] +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.1.%.loc4_15.6 [template = constants.%tuple.type.2] // CHECK:STDOUT: %int.make_type_32.loc5_32: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc5_32.1: type = value_of_initializer %int.make_type_32.loc5_32 [template = i32] // CHECK:STDOUT: %.loc5_32.2: type = converted %int.make_type_32.loc5_32, %.loc5_32.1 [template = i32] @@ -317,24 +329,39 @@ let x: i32 = c[0]; // CHECK:STDOUT: fn @At.2[%self.param_patt: %tuple.type.2](%subscript.param_patt: i32) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %self.ref: %tuple.type.2 = name_ref self, %self -// CHECK:STDOUT: %.loc6_17: i32 = int_value 0 [template = constants.%.7] +// CHECK:STDOUT: %.loc6_17: Core.IntLiteral = int_value 0 [template = constants.%.7] // CHECK:STDOUT: %.loc6_16: i32 = tuple_access %self.ref, element0 // CHECK:STDOUT: return %.loc6_16 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10_22: i32 = int_value 1 [template = constants.%.8] -// CHECK:STDOUT: %.loc10_25: i32 = int_value 5 [template = constants.%.9] -// CHECK:STDOUT: %.loc10_26: %tuple.type.2 = tuple_literal (%.loc10_22, %.loc10_25) -// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.loc10_22, %.loc10_25) [template = constants.%tuple] -// CHECK:STDOUT: %.loc10_27: %tuple.type.2 = converted %.loc10_26, %tuple [template = constants.%tuple] +// CHECK:STDOUT: %.loc10_22: Core.IntLiteral = int_value 1 [template = constants.%.8] +// CHECK:STDOUT: %.loc10_25: Core.IntLiteral = int_value 5 [template = constants.%.9] +// CHECK:STDOUT: %.loc10_26.1: %tuple.type.3 = tuple_literal (%.loc10_22, %.loc10_25) +// CHECK:STDOUT: %.loc10_26.2: %Convert.type.2 = interface_witness_access constants.%.33, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc10_26.3: = bound_method %.loc10_22, %.loc10_26.2 [template = constants.%.34] +// CHECK:STDOUT: %int.convert_checked.loc10_26.1: init i32 = call %.loc10_26.3(%.loc10_22) [template = constants.%.35] +// CHECK:STDOUT: %.loc10_26.4: i32 = value_of_initializer %int.convert_checked.loc10_26.1 [template = constants.%.35] +// CHECK:STDOUT: %.loc10_26.5: i32 = converted %.loc10_22, %.loc10_26.4 [template = constants.%.35] +// CHECK:STDOUT: %.loc10_26.6: %Convert.type.2 = interface_witness_access constants.%.33, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc10_26.7: = bound_method %.loc10_25, %.loc10_26.6 [template = constants.%.36] +// CHECK:STDOUT: %int.convert_checked.loc10_26.2: init i32 = call %.loc10_26.7(%.loc10_25) [template = constants.%.37] +// CHECK:STDOUT: %.loc10_26.8: i32 = value_of_initializer %int.convert_checked.loc10_26.2 [template = constants.%.37] +// CHECK:STDOUT: %.loc10_26.9: i32 = converted %.loc10_25, %.loc10_26.8 [template = constants.%.37] +// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.loc10_26.5, %.loc10_26.9) [template = constants.%tuple] +// CHECK:STDOUT: %.loc10_27: %tuple.type.2 = converted %.loc10_26.1, %tuple [template = constants.%tuple] // CHECK:STDOUT: %s: %tuple.type.2 = bind_name s, %.loc10_27 // CHECK:STDOUT: %s.ref: %tuple.type.2 = name_ref s, %s -// CHECK:STDOUT: %.loc11_16: i32 = int_value 0 [template = constants.%.7] -// CHECK:STDOUT: %.loc11_17.1: %At.type.3 = interface_witness_access constants.%.5, element0 [template = constants.%At.2] -// CHECK:STDOUT: %.loc11_17.2: = bound_method %s.ref, %.loc11_17.1 -// CHECK:STDOUT: %At.call: init i32 = call %.loc11_17.2(%s.ref, %.loc11_16) +// CHECK:STDOUT: %.loc11_16: Core.IntLiteral = int_value 0 [template = constants.%.7] +// CHECK:STDOUT: %.loc11_17.1: %Convert.type.2 = interface_witness_access constants.%.33, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_17.2: = bound_method %.loc11_16, %.loc11_17.1 [template = constants.%.38] +// CHECK:STDOUT: %int.convert_checked.loc11: init i32 = call %.loc11_17.2(%.loc11_16) [template = constants.%.39] +// CHECK:STDOUT: %.loc11_17.3: i32 = value_of_initializer %int.convert_checked.loc11 [template = constants.%.39] +// CHECK:STDOUT: %.loc11_17.4: i32 = converted %.loc11_16, %.loc11_17.3 [template = constants.%.39] +// CHECK:STDOUT: %.loc11_17.5: %At.type.3 = interface_witness_access constants.%.5, element0 [template = constants.%At.2] +// CHECK:STDOUT: %.loc11_17.6: = bound_method %s.ref, %.loc11_17.5 +// CHECK:STDOUT: %At.call: init i32 = call %.loc11_17.6(%s.ref, %.loc11_17.4) // CHECK:STDOUT: %.loc11_18.1: i32 = value_of_initializer %At.call // CHECK:STDOUT: %.loc11_18.2: i32 = converted %At.call, %.loc11_18.1 // CHECK:STDOUT: %e: i32 = bind_name e, %.loc11_18.2 @@ -358,7 +385,7 @@ let x: i32 = c[0]; // CHECK:STDOUT: %.7: = interface_witness (%At.2) [template] // CHECK:STDOUT: %struct.1: %ElementType.1 = struct_value () [template] // CHECK:STDOUT: %struct.2: %C = struct_value () [template] -// CHECK:STDOUT: %.9: i32 = int_value 0 [template] +// CHECK:STDOUT: %.9: Core.IntLiteral = int_value 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -461,7 +488,7 @@ let x: i32 = c[0]; // CHECK:STDOUT: %.loc14_14.2: %C = bind_value %.loc14_14.1 // CHECK:STDOUT: %c: %C = bind_name c, %.loc14_14.2 // CHECK:STDOUT: %c.ref: %C = name_ref c, %c -// CHECK:STDOUT: %.loc22_24: i32 = int_value 0 [template = constants.%.9] +// CHECK:STDOUT: %.loc22_24: Core.IntLiteral = int_value 0 [template = constants.%.9] // CHECK:STDOUT: %.loc22_25.1: %SubscriptType.1 = converted %.loc22_24, [template = ] // CHECK:STDOUT: %.loc22_25.2: %At.type.3 = interface_witness_access constants.%.7, element0 [template = constants.%At.2] // CHECK:STDOUT: %.loc22_25.3: = bound_method %c.ref, %.loc22_25.2 @@ -482,7 +509,7 @@ let x: i32 = c[0]; // CHECK:STDOUT: %struct: %C = struct_value () [template] // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.4: i32 = int_value 0 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -526,7 +553,7 @@ let x: i32 = c[0]; // CHECK:STDOUT: %.loc6_14.2: %C = bind_value %.loc6_14.1 // CHECK:STDOUT: %c: %C = bind_name c, %.loc6_14.2 // CHECK:STDOUT: %c.ref: %C = name_ref c, %c -// CHECK:STDOUT: %.loc10: i32 = int_value 0 [template = constants.%.4] +// CHECK:STDOUT: %.loc10: Core.IntLiteral = int_value 0 [template = constants.%.4] // CHECK:STDOUT: %x: i32 = bind_name x, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/operators/overloaded/no_prelude/index.carbon b/toolchain/check/testdata/operators/overloaded/no_prelude/index.carbon index 9deba730b25a8..5c09a7eee94bb 100644 --- a/toolchain/check/testdata/operators/overloaded/no_prelude/index.carbon +++ b/toolchain/check/testdata/operators/overloaded/no_prelude/index.carbon @@ -14,7 +14,7 @@ library "[[@TEST_NAME]]"; namespace Core; class Core.IndexWith {} -// CHECK:STDERR: fail_wrong_index_with.carbon:[[@LINE+4]]:10: error: type `i32` does not support indexing [TypeNotIndexable] +// CHECK:STDERR: fail_wrong_index_with.carbon:[[@LINE+4]]:10: error: type `Core.IntLiteral` does not support indexing [TypeNotIndexable] // CHECK:STDERR: fn F() { 0[1]; } // CHECK:STDERR: ^~~~ // CHECK:STDERR: @@ -28,7 +28,7 @@ library "[[@TEST_NAME]]"; // CHECK:STDERR: fn F() { 0[1]; } // CHECK:STDERR: ^~~~ // CHECK:STDERR: -// CHECK:STDERR: fail_missing_index_with.carbon:[[@LINE+3]]:10: error: type `i32` does not support indexing [TypeNotIndexable] +// CHECK:STDERR: fail_missing_index_with.carbon:[[@LINE+3]]:10: error: type `Core.IntLiteral` does not support indexing [TypeNotIndexable] // CHECK:STDERR: fn F() { 0[1]; } // CHECK:STDERR: ^~~~ fn F() { 0[1]; } @@ -58,8 +58,8 @@ fn F() { ()[()]; } // CHECK:STDOUT: %.2: = complete_type_witness %.1 [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %.3: i32 = int_value 0 [template] -// CHECK:STDOUT: %.4: i32 = int_value 1 [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -83,8 +83,8 @@ fn F() { ()[()]; } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10_10: i32 = int_value 0 [template = constants.%.3] -// CHECK:STDOUT: %.loc10_12: i32 = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_10: Core.IntLiteral = int_value 0 [template = constants.%.3] +// CHECK:STDOUT: %.loc10_12: Core.IntLiteral = int_value 1 [template = constants.%.4] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -93,8 +93,8 @@ fn F() { ()[()]; } // CHECK:STDOUT: constants { // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] -// CHECK:STDOUT: %.2: i32 = int_value 1 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -106,8 +106,8 @@ fn F() { ()[()]; } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_10: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: %.loc11_12: i32 = int_value 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_10: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_12: Core.IntLiteral = int_value 1 [template = constants.%.2] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/package_expr/syntax.carbon b/toolchain/check/testdata/package_expr/syntax.carbon index a184db027f3e6..d6d68e18ac0d7 100644 --- a/toolchain/check/testdata/package_expr/syntax.carbon +++ b/toolchain/check/testdata/package_expr/syntax.carbon @@ -46,12 +46,19 @@ fn Main() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -78,8 +85,12 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc4: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: assign file.%x.var, %.loc4 +// CHECK:STDOUT: %.loc4_14: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc4_15.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_15.2: = bound_method %.loc4_14, %.loc4_15.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc4_15.2(%.loc4_14) [template = constants.%.27] +// CHECK:STDOUT: %.loc4_15.3: init i32 = converted %.loc4_14, %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: assign file.%x.var, %.loc4_15.3 // CHECK:STDOUT: %package.ref: = name_ref package, package [template = package] // CHECK:STDOUT: %x.ref: ref i32 = name_ref x, file.%x // CHECK:STDOUT: %.loc5: i32 = bind_value %x.ref @@ -92,15 +103,24 @@ fn Main() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 0 [template] // CHECK:STDOUT: %Main.type: type = fn_type @Main [template] // CHECK:STDOUT: %Main: %Main.type = struct_value () [template] -// CHECK:STDOUT: %.2: i32 = int_value 1 [template] +// CHECK:STDOUT: %.28: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.29: = bound_method %.28, %Convert.15 [template] +// CHECK:STDOUT: %.30: i32 = int_value 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -128,8 +148,12 @@ fn Main() { // CHECK:STDOUT: %.loc7_10.2: type = converted %int.make_type_32.loc7, %.loc7_10.1 [template = i32] // CHECK:STDOUT: %x.var: ref i32 = var x // CHECK:STDOUT: %x: ref i32 = bind_name x, %x.var -// CHECK:STDOUT: %.loc7_16: i32 = int_value 1 [template = constants.%.2] -// CHECK:STDOUT: assign %x.var, %.loc7_16 +// CHECK:STDOUT: %.loc7_16: Core.IntLiteral = int_value 1 [template = constants.%.28] +// CHECK:STDOUT: %.loc7_17.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc7_17.2: = bound_method %.loc7_16, %.loc7_17.1 [template = constants.%.29] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc7_17.2(%.loc7_16) [template = constants.%.30] +// CHECK:STDOUT: %.loc7_17.3: init i32 = converted %.loc7_16, %int.convert_checked [template = constants.%.30] +// CHECK:STDOUT: assign %x.var, %.loc7_17.3 // CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc9_10.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] // CHECK:STDOUT: %.loc9_10.2: type = converted %int.make_type_32.loc9, %.loc9_10.1 [template = i32] @@ -144,8 +168,12 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc4: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: assign file.%x.var, %.loc4 +// CHECK:STDOUT: %.loc4_14: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc4_15.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_15.2: = bound_method %.loc4_14, %.loc4_15.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc4_15.2(%.loc4_14) [template = constants.%.27] +// CHECK:STDOUT: %.loc4_15.3: init i32 = converted %.loc4_14, %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: assign file.%x.var, %.loc4_15.3 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/packages/implicit_imports_prelude.carbon b/toolchain/check/testdata/packages/implicit_imports_prelude.carbon index 9b733893c79b6..53a489cf4c4b2 100644 --- a/toolchain/check/testdata/packages/implicit_imports_prelude.carbon +++ b/toolchain/check/testdata/packages/implicit_imports_prelude.carbon @@ -27,12 +27,19 @@ var b: i32 = a; // CHECK:STDOUT: constants { // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -53,14 +60,86 @@ var b: i32 = a; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc4: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: assign file.%a.var, %.loc4 +// CHECK:STDOUT: %.loc4_14: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc4_15.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_15.2: = bound_method %.loc4_14, %.loc4_15.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc4_15.2(%.loc4_14) [template = constants.%.27] +// CHECK:STDOUT: %.loc4_15.3: init i32 = converted %.loc4_14, %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: assign file.%a.var, %.loc4_15.3 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- lib.impl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.2: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic] +// CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2) = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.3: type = facet_type <@ImplicitAs, @ImplicitAs(i32)> [template] +// CHECK:STDOUT: %Self.2: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Convert.type.1: type = fn_type @Convert.1, @ImplicitAs(%Dest) [symbolic] +// CHECK:STDOUT: %Convert.1: %Convert.type.1 = struct_value () [symbolic] +// CHECK:STDOUT: %.1: type = assoc_entity_type %ImplicitAs.type.2, %Convert.type.1 [symbolic] +// CHECK:STDOUT: %.2: %.1 = assoc_entity element0, imports.%import_ref.8 [symbolic] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(i32) [template] +// CHECK:STDOUT: %Convert.2: %Convert.type.2 = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type %ImplicitAs.type.3, %Convert.type.2 [template] +// CHECK:STDOUT: %.4: %.3 = assoc_entity element0, imports.%import_ref.9 [template] +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic] +// CHECK:STDOUT: %.5: type = int_type signed, %N [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.4: type = facet_type <@ImplicitAs, @ImplicitAs(%.5)> [symbolic] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.3: type = fn_type @Convert.2, @impl.2(%N) [symbolic] +// CHECK:STDOUT: %Convert.3: %Convert.type.3 = struct_value () [symbolic] +// CHECK:STDOUT: %.6: = interface_witness (%Convert.3) [symbolic] +// CHECK:STDOUT: %.7: type = int_type unsigned, %N [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.5: type = facet_type <@ImplicitAs, @ImplicitAs(%.7)> [symbolic] +// CHECK:STDOUT: %Convert.type.4: type = fn_type @Convert.3, @impl.3(%N) [symbolic] +// CHECK:STDOUT: %Convert.4: %Convert.type.4 = struct_value () [symbolic] +// CHECK:STDOUT: %.8: = interface_witness (%Convert.4) [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.6: type = facet_type <@ImplicitAs, @ImplicitAs(Core.IntLiteral)> [template] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %Convert.5: %Convert.type.5 = struct_value () [template] +// CHECK:STDOUT: %.9: type = assoc_entity_type %ImplicitAs.type.6, %Convert.type.5 [template] +// CHECK:STDOUT: %.10: %.9 = assoc_entity element0, imports.%import_ref.19 [template] +// CHECK:STDOUT: %Convert.type.6: type = fn_type @Convert.4, @impl.5(%N) [symbolic] +// CHECK:STDOUT: %Convert.6: %Convert.type.6 = struct_value () [symbolic] +// CHECK:STDOUT: %.11: = interface_witness (%Convert.6) [symbolic] +// CHECK:STDOUT: %Convert.type.7: type = fn_type @Convert.5, @impl.6(%N) [symbolic] +// CHECK:STDOUT: %Convert.7: %Convert.type.7 = struct_value () [symbolic] +// CHECK:STDOUT: %.12: = interface_witness (%Convert.7) [symbolic] +// CHECK:STDOUT: %As.type.2: type = facet_type <@As, @As(%Dest)> [symbolic] +// CHECK:STDOUT: %Self.3: @As.%As.type (%As.type.2) = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %As.type.3: type = facet_type <@As, @As(i32)> [template] +// CHECK:STDOUT: %Self.4: %As.type.2 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Convert.type.8: type = fn_type @Convert.6, @As(%Dest) [symbolic] +// CHECK:STDOUT: %Convert.8: %Convert.type.8 = struct_value () [symbolic] +// CHECK:STDOUT: %.13: type = assoc_entity_type %As.type.2, %Convert.type.8 [symbolic] +// CHECK:STDOUT: %.14: %.13 = assoc_entity element0, imports.%import_ref.32 [symbolic] +// CHECK:STDOUT: %Convert.type.9: type = fn_type @Convert.6, @As(i32) [template] +// CHECK:STDOUT: %Convert.9: %Convert.type.9 = struct_value () [template] +// CHECK:STDOUT: %.15: type = assoc_entity_type %As.type.3, %Convert.type.9 [template] +// CHECK:STDOUT: %.16: %.15 = assoc_entity element0, imports.%import_ref.33 [template] +// CHECK:STDOUT: %As.type.4: type = facet_type <@As, @As(%.5)> [symbolic] +// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.7, @impl.8(%N) [symbolic] +// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [symbolic] +// CHECK:STDOUT: %.17: = interface_witness (%Convert.10) [symbolic] +// CHECK:STDOUT: %As.type.5: type = facet_type <@As, @As(%.7)> [symbolic] +// CHECK:STDOUT: %Convert.type.11: type = fn_type @Convert.8, @impl.9(%N) [symbolic] +// CHECK:STDOUT: %Convert.11: %Convert.type.11 = struct_value () [symbolic] +// CHECK:STDOUT: %.18: = interface_witness (%Convert.11) [symbolic] +// CHECK:STDOUT: %As.type.6: type = facet_type <@As, @As(Core.IntLiteral)> [template] +// CHECK:STDOUT: %Convert.type.12: type = fn_type @Convert.6, @As(Core.IntLiteral) [template] +// CHECK:STDOUT: %Convert.12: %Convert.type.12 = struct_value () [template] +// CHECK:STDOUT: %.19: type = assoc_entity_type %As.type.6, %Convert.type.12 [template] +// CHECK:STDOUT: %.20: %.19 = assoc_entity element0, imports.%import_ref.43 [template] +// CHECK:STDOUT: %Convert.type.13: type = fn_type @Convert.9, @impl.11(%N) [symbolic] +// CHECK:STDOUT: %Convert.13: %Convert.type.13 = struct_value () [symbolic] +// CHECK:STDOUT: %.21: = interface_witness (%Convert.13) [symbolic] +// CHECK:STDOUT: %Convert.type.14: type = fn_type @Convert.10, @impl.12(%N) [symbolic] +// CHECK:STDOUT: %Convert.14: %Convert.type.14 = struct_value () [symbolic] +// CHECK:STDOUT: %.22: = interface_witness (%Convert.14) [symbolic] // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: } @@ -68,10 +147,54 @@ var b: i32 = a; // CHECK:STDOUT: imports { // CHECK:STDOUT: %import_ref.1: ref i32 = import_ref Main//lib, inst+15, loaded // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref.2 +// CHECK:STDOUT: .Int32 = %import_ref.50 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.2 = import_ref Main//lib, inst+30, unloaded +// CHECK:STDOUT: %import_ref.3 = import_ref Main//lib, inst+31, unloaded +// CHECK:STDOUT: %import_ref.4 = import_ref Main//lib, inst+32, unloaded +// CHECK:STDOUT: %import_ref.5: type = import_ref Main//lib, inst+66, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.6: type = import_ref Main//lib, inst+67, loaded [template = constants.%ImplicitAs.type.3] +// CHECK:STDOUT: %import_ref.7 = import_ref Main//lib, inst+68, unloaded +// CHECK:STDOUT: %import_ref.8 = import_ref Main//lib, inst+47, unloaded +// CHECK:STDOUT: %import_ref.10: type = import_ref Main//lib, inst+78, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.11: type = import_ref Main//lib, inst+79, loaded [symbolic = @impl.2.%ImplicitAs.type (constants.%ImplicitAs.type.4)] +// CHECK:STDOUT: %import_ref.12 = import_ref Main//lib, inst+80, unloaded +// CHECK:STDOUT: %import_ref.13: type = import_ref Main//lib, inst+108, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.14: type = import_ref Main//lib, inst+109, loaded [symbolic = @impl.3.%ImplicitAs.type (constants.%ImplicitAs.type.5)] +// CHECK:STDOUT: %import_ref.15 = import_ref Main//lib, inst+110, unloaded +// CHECK:STDOUT: %import_ref.16: type = import_ref Main//lib, inst+133, loaded [template = i32] +// CHECK:STDOUT: %import_ref.17: type = import_ref Main//lib, inst+134, loaded [template = constants.%ImplicitAs.type.6] +// CHECK:STDOUT: %import_ref.18 = import_ref Main//lib, inst+135, unloaded +// CHECK:STDOUT: %import_ref.20: type = import_ref Main//lib, inst+146, loaded [symbolic = @impl.5.%.1 (constants.%.5)] +// CHECK:STDOUT: %import_ref.21: type = import_ref Main//lib, inst+147, loaded [template = constants.%ImplicitAs.type.6] +// CHECK:STDOUT: %import_ref.22 = import_ref Main//lib, inst+148, unloaded +// CHECK:STDOUT: %import_ref.23: type = import_ref Main//lib, inst+173, loaded [symbolic = @impl.6.%.1 (constants.%.7)] +// CHECK:STDOUT: %import_ref.24: type = import_ref Main//lib, inst+174, loaded [template = constants.%ImplicitAs.type.6] +// CHECK:STDOUT: %import_ref.25 = import_ref Main//lib, inst+175, unloaded +// CHECK:STDOUT: %import_ref.26 = import_ref Main//lib, inst+205, unloaded +// CHECK:STDOUT: %import_ref.27 = import_ref Main//lib, inst+206, unloaded +// CHECK:STDOUT: %import_ref.28 = import_ref Main//lib, inst+207, unloaded +// CHECK:STDOUT: %import_ref.29: type = import_ref Main//lib, inst+209, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.30: type = import_ref Main//lib, inst+210, loaded [template = constants.%As.type.3] +// CHECK:STDOUT: %import_ref.31 = import_ref Main//lib, inst+211, unloaded +// CHECK:STDOUT: %import_ref.32 = import_ref Main//lib, inst+226, unloaded +// CHECK:STDOUT: %import_ref.34: type = import_ref Main//lib, inst+248, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.35: type = import_ref Main//lib, inst+249, loaded [symbolic = @impl.8.%As.type (constants.%As.type.4)] +// CHECK:STDOUT: %import_ref.36 = import_ref Main//lib, inst+250, unloaded +// CHECK:STDOUT: %import_ref.37: type = import_ref Main//lib, inst+277, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.38: type = import_ref Main//lib, inst+278, loaded [symbolic = @impl.9.%As.type (constants.%As.type.5)] +// CHECK:STDOUT: %import_ref.39 = import_ref Main//lib, inst+279, unloaded +// CHECK:STDOUT: %import_ref.40: type = import_ref Main//lib, inst+302, loaded [template = i32] +// CHECK:STDOUT: %import_ref.41: type = import_ref Main//lib, inst+303, loaded [template = constants.%As.type.6] +// CHECK:STDOUT: %import_ref.42 = import_ref Main//lib, inst+304, unloaded +// CHECK:STDOUT: %import_ref.44: type = import_ref Main//lib, inst+315, loaded [symbolic = @impl.11.%.1 (constants.%.5)] +// CHECK:STDOUT: %import_ref.45: type = import_ref Main//lib, inst+316, loaded [template = constants.%As.type.6] +// CHECK:STDOUT: %import_ref.46 = import_ref Main//lib, inst+317, unloaded +// CHECK:STDOUT: %import_ref.47: type = import_ref Main//lib, inst+342, loaded [symbolic = @impl.12.%.1 (constants.%.7)] +// CHECK:STDOUT: %import_ref.48: type = import_ref Main//lib, inst+343, loaded [template = constants.%As.type.6] +// CHECK:STDOUT: %import_ref.49 = import_ref Main//lib, inst+344, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -90,6 +213,286 @@ var b: i32 = a; // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(constants.%Dest: type) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)] +// CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.1, @ImplicitAs(%Dest) [symbolic = %Convert.type (constants.%Convert.type.1)] +// CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.1) = struct_value () [symbolic = %Convert (constants.%Convert.1)] +// CHECK:STDOUT: %.1: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2), @ImplicitAs.%Convert.type (%Convert.type.1) [symbolic = %.1 (constants.%.1)] +// CHECK:STDOUT: %.2: @ImplicitAs.%.1 (%.1) = assoc_entity element0, imports.%import_ref.8 [symbolic = %.2 (constants.%.2)] +// CHECK:STDOUT: +// CHECK:STDOUT: interface { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%import_ref.2 +// CHECK:STDOUT: .Convert = imports.%import_ref.3 +// CHECK:STDOUT: witness = (imports.%import_ref.4) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @As(constants.%Dest: type) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest)> [symbolic = %As.type (constants.%As.type.2)] +// CHECK:STDOUT: %Self: %As.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.4)] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.6, @As(%Dest) [symbolic = %Convert.type (constants.%Convert.type.8)] +// CHECK:STDOUT: %Convert: @As.%Convert.type (%Convert.type.8) = struct_value () [symbolic = %Convert (constants.%Convert.8)] +// CHECK:STDOUT: %.1: type = assoc_entity_type @As.%As.type (%As.type.2), @As.%Convert.type (%Convert.type.8) [symbolic = %.1 (constants.%.13)] +// CHECK:STDOUT: %.2: @As.%.1 (%.13) = assoc_entity element0, imports.%import_ref.32 [symbolic = %.2 (constants.%.14)] +// CHECK:STDOUT: +// CHECK:STDOUT: interface { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%import_ref.26 +// CHECK:STDOUT: .Convert = imports.%import_ref.27 +// CHECK:STDOUT: witness = (imports.%import_ref.28) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.1: imports.%import_ref.5 as imports.%import_ref.6 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.2(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%.1)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.4)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.2, @impl.2(%N) [symbolic = %Convert.type (constants.%Convert.type.3)] +// CHECK:STDOUT: %Convert: @impl.2.%Convert.type (%Convert.type.3) = struct_value () [symbolic = %Convert (constants.%Convert.3)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.6)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.10 as imports.%import_ref.11 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.12 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.3(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%.1)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.3, @impl.3(%N) [symbolic = %Convert.type (constants.%Convert.type.4)] +// CHECK:STDOUT: %Convert: @impl.3.%Convert.type (%Convert.type.4) = struct_value () [symbolic = %Convert (constants.%Convert.4)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.8)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.13 as imports.%import_ref.14 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.15 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.4: imports.%import_ref.16 as imports.%import_ref.17 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.18 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.5(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.4, @impl.5(%N) [symbolic = %Convert.type (constants.%Convert.type.6)] +// CHECK:STDOUT: %Convert: @impl.5.%Convert.type (%Convert.type.6) = struct_value () [symbolic = %Convert (constants.%Convert.6)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.11)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.20 as imports.%import_ref.21 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.22 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.6(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.5, @impl.6(%N) [symbolic = %Convert.type (constants.%Convert.type.7)] +// CHECK:STDOUT: %Convert: @impl.6.%Convert.type (%Convert.type.7) = struct_value () [symbolic = %Convert (constants.%Convert.7)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.12)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.23 as imports.%import_ref.24 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.25 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.7: imports.%import_ref.29 as imports.%import_ref.30 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.31 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.8(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%.1)> [symbolic = %As.type (constants.%As.type.4)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.7, @impl.8(%N) [symbolic = %Convert.type (constants.%Convert.type.10)] +// CHECK:STDOUT: %Convert: @impl.8.%Convert.type (%Convert.type.10) = struct_value () [symbolic = %Convert (constants.%Convert.10)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.17)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.34 as imports.%import_ref.35 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.36 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.9(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%.1)> [symbolic = %As.type (constants.%As.type.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.8, @impl.9(%N) [symbolic = %Convert.type (constants.%Convert.type.11)] +// CHECK:STDOUT: %Convert: @impl.9.%Convert.type (%Convert.type.11) = struct_value () [symbolic = %Convert (constants.%Convert.11)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.18)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.37 as imports.%import_ref.38 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.39 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.10: imports.%import_ref.40 as imports.%import_ref.41 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.42 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.11(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.9, @impl.11(%N) [symbolic = %Convert.type (constants.%Convert.type.13)] +// CHECK:STDOUT: %Convert: @impl.11.%Convert.type (%Convert.type.13) = struct_value () [symbolic = %Convert (constants.%Convert.13)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.21)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.44 as imports.%import_ref.45 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.46 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.12(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.10, @impl.12(%N) [symbolic = %Convert.type (constants.%Convert.type.14)] +// CHECK:STDOUT: %Convert: @impl.12.%Convert.type (%Convert.type.14) = struct_value () [symbolic = %Convert (constants.%Convert.14)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.22)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.47 as imports.%import_ref.48 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.49 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.1(constants.%Dest: type, constants.%Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2)) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)] +// CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.1.%Self (%Self.2)]() -> @Convert.1.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.2(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.2.%.1 (%.5) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.3(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.3.%.1 (%.7) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.4(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.4.%.1 (%.5)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.5(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.5.%.1 (%.7)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.6(constants.%Dest: type, constants.%Self.3: @As.%As.type (%As.type.2)) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest)> [symbolic = %As.type (constants.%As.type.2)] +// CHECK:STDOUT: %Self: %As.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.4)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.6.%Self (%Self.4)]() -> @Convert.6.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.7(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.7.%.1 (%.5) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.8(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.8.%.1 (%.7) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.9(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.9.%.1 (%.5)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.10(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.10.%.1 (%.7)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: ref i32 = name_ref a, imports.%import_ref.1 @@ -98,3 +501,281 @@ var b: i32 = a; // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(i32) { +// CHECK:STDOUT: %Dest => i32 +// CHECK:STDOUT: %Dest.patt => i32 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3 +// CHECK:STDOUT: %Self => constants.%Self.2 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.2 +// CHECK:STDOUT: %Convert => constants.%Convert.2 +// CHECK:STDOUT: %.1 => constants.%.3 +// CHECK:STDOUT: %.2 => constants.%.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@Convert.1.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.1(constants.%Dest, constants.%Self.1) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.2 +// CHECK:STDOUT: %Self => constants.%Self.1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%.5) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@impl.2.%.1) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.2(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.2(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.2(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%.7) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@impl.3.%.1) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.3(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.3(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.3(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(Core.IntLiteral) { +// CHECK:STDOUT: %Dest => Core.IntLiteral +// CHECK:STDOUT: %Dest.patt => Core.IntLiteral +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.6 +// CHECK:STDOUT: %Self => constants.%Self.2 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.5 +// CHECK:STDOUT: %Convert => constants.%Convert.5 +// CHECK:STDOUT: %.1 => constants.%.9 +// CHECK:STDOUT: %.2 => constants.%.10 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.5(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.5(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.4(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.6(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.6(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.5(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(i32) { +// CHECK:STDOUT: %Dest => i32 +// CHECK:STDOUT: %Dest.patt => i32 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type => constants.%As.type.3 +// CHECK:STDOUT: %Self => constants.%Self.4 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.9 +// CHECK:STDOUT: %Convert => constants.%Convert.9 +// CHECK:STDOUT: %.1 => constants.%.15 +// CHECK:STDOUT: %.2 => constants.%.16 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(@Convert.6.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.6(constants.%Dest, constants.%Self.3) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %As.type => constants.%As.type.2 +// CHECK:STDOUT: %Self => constants.%Self.3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%.5) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(@impl.8.%.1) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.8(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %As.type => constants.%As.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.8(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %As.type => constants.%As.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.7(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%.7) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(@impl.9.%.1) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.9(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %As.type => constants.%As.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.9(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %As.type => constants.%As.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.8(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(Core.IntLiteral) { +// CHECK:STDOUT: %Dest => Core.IntLiteral +// CHECK:STDOUT: %Dest.patt => Core.IntLiteral +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type => constants.%As.type.6 +// CHECK:STDOUT: %Self => constants.%Self.4 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.12 +// CHECK:STDOUT: %Convert => constants.%Convert.12 +// CHECK:STDOUT: %.1 => constants.%.19 +// CHECK:STDOUT: %.2 => constants.%.20 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.11(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.11(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.9(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.12(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.12(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.10(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/pointer/address_of_deref.carbon b/toolchain/check/testdata/pointer/address_of_deref.carbon index 2079aa6208661..c30c84b30235f 100644 --- a/toolchain/check/testdata/pointer/address_of_deref.carbon +++ b/toolchain/check/testdata/pointer/address_of_deref.carbon @@ -20,13 +20,20 @@ fn F() -> i32 { // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] -// CHECK:STDOUT: %.2: type = ptr_type i32 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 0 [template] +// CHECK:STDOUT: %.28: type = ptr_type i32 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -57,12 +64,16 @@ fn F() -> i32 { // CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32.loc12, %.loc12_10.1 [template = i32] // CHECK:STDOUT: %n.var: ref i32 = var n // CHECK:STDOUT: %n: ref i32 = bind_name n, %n.var -// CHECK:STDOUT: %.loc12_16: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: assign %n.var, %.loc12_16 +// CHECK:STDOUT: %.loc12_16: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc12_17.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_17.2: = bound_method %.loc12_16, %.loc12_17.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc12_17.2(%.loc12_16) [template = constants.%.27] +// CHECK:STDOUT: %.loc12_17.3: init i32 = converted %.loc12_16, %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: assign %n.var, %.loc12_17.3 // CHECK:STDOUT: %n.ref: ref i32 = name_ref n, %n -// CHECK:STDOUT: %.loc13_13: %.2 = addr_of %n.ref +// CHECK:STDOUT: %.loc13_13: %.28 = addr_of %n.ref // CHECK:STDOUT: %.loc13_12: ref i32 = deref %.loc13_13 -// CHECK:STDOUT: %.loc13_11: %.2 = addr_of %.loc13_12 +// CHECK:STDOUT: %.loc13_11: %.28 = addr_of %.loc13_12 // CHECK:STDOUT: %.loc13_10.1: ref i32 = deref %.loc13_11 // CHECK:STDOUT: %.loc13_10.2: i32 = bind_value %.loc13_10.1 // CHECK:STDOUT: return %.loc13_10.2 diff --git a/toolchain/check/testdata/pointer/address_of_lvalue.carbon b/toolchain/check/testdata/pointer/address_of_lvalue.carbon index 9e4d281b9cc46..2eca427d6cb37 100644 --- a/toolchain/check/testdata/pointer/address_of_lvalue.carbon +++ b/toolchain/check/testdata/pointer/address_of_lvalue.carbon @@ -29,19 +29,30 @@ fn F() { // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %.1: type = struct_type {.a: i32, .b: i32} [template] // CHECK:STDOUT: %.2: type = ptr_type %.1 [template] -// CHECK:STDOUT: %.3: i32 = int_value 1 [template] -// CHECK:STDOUT: %.4: i32 = int_value 2 [template] -// CHECK:STDOUT: %struct: %.1 = struct_value (%.3, %.4) [template] -// CHECK:STDOUT: %.5: type = ptr_type i32 [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.5: type = struct_type {.a: Core.IntLiteral, .b: Core.IntLiteral} [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: %.29: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.30: = bound_method %.3, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 1 [template] +// CHECK:STDOUT: %.32: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.33: i32 = int_value 2 [template] +// CHECK:STDOUT: %struct: %.1 = struct_value (%.31, %.33) [template] +// CHECK:STDOUT: %.34: type = ptr_type i32 [template] // CHECK:STDOUT: %tuple.type.1: type = tuple_type (type, type) [template] // CHECK:STDOUT: %tuple.type.2: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.3, %.4) [template] -// CHECK:STDOUT: %.7: i32 = int_value 0 [template] +// CHECK:STDOUT: %tuple.type.3: type = tuple_type (Core.IntLiteral, Core.IntLiteral) [template] +// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.31, %.33) [template] +// CHECK:STDOUT: %.36: Core.IntLiteral = int_value 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -67,15 +78,23 @@ fn F() { // CHECK:STDOUT: %.loc12_27: type = struct_type {.a: i32, .b: i32} [template = constants.%.1] // CHECK:STDOUT: %s.var: ref %.1 = var s // CHECK:STDOUT: %s: ref %.1 = bind_name s, %s.var -// CHECK:STDOUT: %.loc12_37: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc12_45: i32 = int_value 2 [template = constants.%.4] -// CHECK:STDOUT: %.loc12_46.1: %.1 = struct_literal (%.loc12_37, %.loc12_45) -// CHECK:STDOUT: %.loc12_46.2: ref i32 = struct_access %s.var, element0 -// CHECK:STDOUT: %.loc12_46.3: init i32 = initialize_from %.loc12_37 to %.loc12_46.2 [template = constants.%.3] -// CHECK:STDOUT: %.loc12_46.4: ref i32 = struct_access %s.var, element1 -// CHECK:STDOUT: %.loc12_46.5: init i32 = initialize_from %.loc12_45 to %.loc12_46.4 [template = constants.%.4] -// CHECK:STDOUT: %.loc12_46.6: init %.1 = struct_init (%.loc12_46.3, %.loc12_46.5) to %s.var [template = constants.%struct] -// CHECK:STDOUT: %.loc12_47: init %.1 = converted %.loc12_46.1, %.loc12_46.6 [template = constants.%struct] +// CHECK:STDOUT: %.loc12_37: Core.IntLiteral = int_value 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc12_45: Core.IntLiteral = int_value 2 [template = constants.%.4] +// CHECK:STDOUT: %.loc12_46.1: %.5 = struct_literal (%.loc12_37, %.loc12_45) +// CHECK:STDOUT: %.loc12_46.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_46.3: = bound_method %.loc12_37, %.loc12_46.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc12_46.1: init i32 = call %.loc12_46.3(%.loc12_37) [template = constants.%.31] +// CHECK:STDOUT: %.loc12_46.4: init i32 = converted %.loc12_37, %int.convert_checked.loc12_46.1 [template = constants.%.31] +// CHECK:STDOUT: %.loc12_46.5: ref i32 = struct_access %s.var, element0 +// CHECK:STDOUT: %.loc12_46.6: init i32 = initialize_from %.loc12_46.4 to %.loc12_46.5 [template = constants.%.31] +// CHECK:STDOUT: %.loc12_46.7: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_46.8: = bound_method %.loc12_45, %.loc12_46.7 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc12_46.2: init i32 = call %.loc12_46.8(%.loc12_45) [template = constants.%.33] +// CHECK:STDOUT: %.loc12_46.9: init i32 = converted %.loc12_45, %int.convert_checked.loc12_46.2 [template = constants.%.33] +// CHECK:STDOUT: %.loc12_46.10: ref i32 = struct_access %s.var, element1 +// CHECK:STDOUT: %.loc12_46.11: init i32 = initialize_from %.loc12_46.9 to %.loc12_46.10 [template = constants.%.33] +// CHECK:STDOUT: %.loc12_46.12: init %.1 = struct_init (%.loc12_46.6, %.loc12_46.11) to %s.var [template = constants.%struct] +// CHECK:STDOUT: %.loc12_47: init %.1 = converted %.loc12_46.1, %.loc12_46.12 [template = constants.%struct] // CHECK:STDOUT: assign %s.var, %.loc12_47 // CHECK:STDOUT: %int.make_type_32.loc14_15: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc14_15.1: type = value_of_initializer %int.make_type_32.loc14_15 [template = i32] @@ -93,22 +112,22 @@ fn F() { // CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc15_13.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] // CHECK:STDOUT: %.loc15_13.2: type = converted %int.make_type_32.loc15, %.loc15_13.1 [template = i32] -// CHECK:STDOUT: %.loc15_13.3: type = ptr_type i32 [template = constants.%.5] -// CHECK:STDOUT: %q.var: ref %.5 = var q -// CHECK:STDOUT: %q: ref %.5 = bind_name q, %q.var +// CHECK:STDOUT: %.loc15_13.3: type = ptr_type i32 [template = constants.%.34] +// CHECK:STDOUT: %q.var: ref %.34 = var q +// CHECK:STDOUT: %q: ref %.34 = bind_name q, %q.var // CHECK:STDOUT: %s.ref.loc15: ref %.1 = name_ref s, %s // CHECK:STDOUT: %.loc15_19: ref i32 = struct_access %s.ref.loc15, element0 -// CHECK:STDOUT: %.loc15_17: %.5 = addr_of %.loc15_19 +// CHECK:STDOUT: %.loc15_17: %.34 = addr_of %.loc15_19 // CHECK:STDOUT: assign %q.var, %.loc15_17 // CHECK:STDOUT: %int.make_type_32.loc16: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc16_13.1: type = value_of_initializer %int.make_type_32.loc16 [template = i32] // CHECK:STDOUT: %.loc16_13.2: type = converted %int.make_type_32.loc16, %.loc16_13.1 [template = i32] -// CHECK:STDOUT: %.loc16_13.3: type = ptr_type i32 [template = constants.%.5] -// CHECK:STDOUT: %r.var: ref %.5 = var r -// CHECK:STDOUT: %r: ref %.5 = bind_name r, %r.var +// CHECK:STDOUT: %.loc16_13.3: type = ptr_type i32 [template = constants.%.34] +// CHECK:STDOUT: %r.var: ref %.34 = var r +// CHECK:STDOUT: %r: ref %.34 = bind_name r, %r.var // CHECK:STDOUT: %s.ref.loc16: ref %.1 = name_ref s, %s // CHECK:STDOUT: %.loc16_19: ref i32 = struct_access %s.ref.loc16, element1 -// CHECK:STDOUT: %.loc16_17: %.5 = addr_of %.loc16_19 +// CHECK:STDOUT: %.loc16_17: %.34 = addr_of %.loc16_19 // CHECK:STDOUT: assign %r.var, %.loc16_17 // CHECK:STDOUT: %int.make_type_32.loc18_11: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %int.make_type_32.loc18_16: init type = call constants.%Int32() [template = i32] @@ -120,37 +139,45 @@ fn F() { // CHECK:STDOUT: %.loc18_19.6: type = converted %.loc18_19.1, constants.%tuple.type.2 [template = constants.%tuple.type.2] // CHECK:STDOUT: %t.var: ref %tuple.type.2 = var t // CHECK:STDOUT: %t: ref %tuple.type.2 = bind_name t, %t.var -// CHECK:STDOUT: %.loc18_24: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc18_27: i32 = int_value 2 [template = constants.%.4] -// CHECK:STDOUT: %.loc18_28.1: %tuple.type.2 = tuple_literal (%.loc18_24, %.loc18_27) -// CHECK:STDOUT: %.loc18_28.2: ref i32 = tuple_access %t.var, element0 -// CHECK:STDOUT: %.loc18_28.3: init i32 = initialize_from %.loc18_24 to %.loc18_28.2 [template = constants.%.3] -// CHECK:STDOUT: %.loc18_28.4: ref i32 = tuple_access %t.var, element1 -// CHECK:STDOUT: %.loc18_28.5: init i32 = initialize_from %.loc18_27 to %.loc18_28.4 [template = constants.%.4] -// CHECK:STDOUT: %.loc18_28.6: init %tuple.type.2 = tuple_init (%.loc18_28.3, %.loc18_28.5) to %t.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc18_29: init %tuple.type.2 = converted %.loc18_28.1, %.loc18_28.6 [template = constants.%tuple] +// CHECK:STDOUT: %.loc18_24: Core.IntLiteral = int_value 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc18_27: Core.IntLiteral = int_value 2 [template = constants.%.4] +// CHECK:STDOUT: %.loc18_28.1: %tuple.type.3 = tuple_literal (%.loc18_24, %.loc18_27) +// CHECK:STDOUT: %.loc18_28.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc18_28.3: = bound_method %.loc18_24, %.loc18_28.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc18_28.1: init i32 = call %.loc18_28.3(%.loc18_24) [template = constants.%.31] +// CHECK:STDOUT: %.loc18_28.4: init i32 = converted %.loc18_24, %int.convert_checked.loc18_28.1 [template = constants.%.31] +// CHECK:STDOUT: %.loc18_28.5: ref i32 = tuple_access %t.var, element0 +// CHECK:STDOUT: %.loc18_28.6: init i32 = initialize_from %.loc18_28.4 to %.loc18_28.5 [template = constants.%.31] +// CHECK:STDOUT: %.loc18_28.7: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc18_28.8: = bound_method %.loc18_27, %.loc18_28.7 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc18_28.2: init i32 = call %.loc18_28.8(%.loc18_27) [template = constants.%.33] +// CHECK:STDOUT: %.loc18_28.9: init i32 = converted %.loc18_27, %int.convert_checked.loc18_28.2 [template = constants.%.33] +// CHECK:STDOUT: %.loc18_28.10: ref i32 = tuple_access %t.var, element1 +// CHECK:STDOUT: %.loc18_28.11: init i32 = initialize_from %.loc18_28.9 to %.loc18_28.10 [template = constants.%.33] +// CHECK:STDOUT: %.loc18_28.12: init %tuple.type.2 = tuple_init (%.loc18_28.6, %.loc18_28.11) to %t.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc18_29: init %tuple.type.2 = converted %.loc18_28.1, %.loc18_28.12 [template = constants.%tuple] // CHECK:STDOUT: assign %t.var, %.loc18_29 // CHECK:STDOUT: %int.make_type_32.loc19: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc19_14.1: type = value_of_initializer %int.make_type_32.loc19 [template = i32] // CHECK:STDOUT: %.loc19_14.2: type = converted %int.make_type_32.loc19, %.loc19_14.1 [template = i32] -// CHECK:STDOUT: %.loc19_14.3: type = ptr_type i32 [template = constants.%.5] -// CHECK:STDOUT: %t0.var: ref %.5 = var t0 -// CHECK:STDOUT: %t0: ref %.5 = bind_name t0, %t0.var +// CHECK:STDOUT: %.loc19_14.3: type = ptr_type i32 [template = constants.%.34] +// CHECK:STDOUT: %t0.var: ref %.34 = var t0 +// CHECK:STDOUT: %t0: ref %.34 = bind_name t0, %t0.var // CHECK:STDOUT: %t.ref.loc19: ref %tuple.type.2 = name_ref t, %t -// CHECK:STDOUT: %.loc19_21: i32 = int_value 0 [template = constants.%.7] +// CHECK:STDOUT: %.loc19_21: Core.IntLiteral = int_value 0 [template = constants.%.36] // CHECK:STDOUT: %.loc19_20: ref i32 = tuple_access %t.ref.loc19, element0 -// CHECK:STDOUT: %.loc19_18: %.5 = addr_of %.loc19_20 +// CHECK:STDOUT: %.loc19_18: %.34 = addr_of %.loc19_20 // CHECK:STDOUT: assign %t0.var, %.loc19_18 // CHECK:STDOUT: %int.make_type_32.loc20: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc20_14.1: type = value_of_initializer %int.make_type_32.loc20 [template = i32] // CHECK:STDOUT: %.loc20_14.2: type = converted %int.make_type_32.loc20, %.loc20_14.1 [template = i32] -// CHECK:STDOUT: %.loc20_14.3: type = ptr_type i32 [template = constants.%.5] -// CHECK:STDOUT: %t1.var: ref %.5 = var t1 -// CHECK:STDOUT: %t1: ref %.5 = bind_name t1, %t1.var +// CHECK:STDOUT: %.loc20_14.3: type = ptr_type i32 [template = constants.%.34] +// CHECK:STDOUT: %t1.var: ref %.34 = var t1 +// CHECK:STDOUT: %t1: ref %.34 = bind_name t1, %t1.var // CHECK:STDOUT: %t.ref.loc20: ref %tuple.type.2 = name_ref t, %t -// CHECK:STDOUT: %.loc20_21: i32 = int_value 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc20_21: Core.IntLiteral = int_value 1 [template = constants.%.3] // CHECK:STDOUT: %.loc20_20: ref i32 = tuple_access %t.ref.loc20, element1 -// CHECK:STDOUT: %.loc20_18: %.5 = addr_of %.loc20_20 +// CHECK:STDOUT: %.loc20_18: %.34 = addr_of %.loc20_20 // CHECK:STDOUT: assign %t1.var, %.loc20_18 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/pointer/basic.carbon b/toolchain/check/testdata/pointer/basic.carbon index a79f0fab82b61..2e4ba05d23e12 100644 --- a/toolchain/check/testdata/pointer/basic.carbon +++ b/toolchain/check/testdata/pointer/basic.carbon @@ -22,13 +22,20 @@ fn F() -> i32 { // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] -// CHECK:STDOUT: %.2: type = ptr_type i32 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 0 [template] +// CHECK:STDOUT: %.28: type = ptr_type i32 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -59,19 +66,23 @@ fn F() -> i32 { // CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32.loc12, %.loc12_10.1 [template = i32] // CHECK:STDOUT: %n.var: ref i32 = var n // CHECK:STDOUT: %n: ref i32 = bind_name n, %n.var -// CHECK:STDOUT: %.loc12_16: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: assign %n.var, %.loc12_16 +// CHECK:STDOUT: %.loc12_16: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc12_17.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_17.2: = bound_method %.loc12_16, %.loc12_17.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc12_17.2(%.loc12_16) [template = constants.%.27] +// CHECK:STDOUT: %.loc12_17.3: init i32 = converted %.loc12_16, %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: assign %n.var, %.loc12_17.3 // CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc13_13.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] // CHECK:STDOUT: %.loc13_13.2: type = converted %int.make_type_32.loc13, %.loc13_13.1 [template = i32] -// CHECK:STDOUT: %.loc13_13.3: type = ptr_type i32 [template = constants.%.2] -// CHECK:STDOUT: %p.var: ref %.2 = var p -// CHECK:STDOUT: %p: ref %.2 = bind_name p, %p.var +// CHECK:STDOUT: %.loc13_13.3: type = ptr_type i32 [template = constants.%.28] +// CHECK:STDOUT: %p.var: ref %.28 = var p +// CHECK:STDOUT: %p: ref %.28 = bind_name p, %p.var // CHECK:STDOUT: %n.ref: ref i32 = name_ref n, %n -// CHECK:STDOUT: %.loc13_17: %.2 = addr_of %n.ref +// CHECK:STDOUT: %.loc13_17: %.28 = addr_of %n.ref // CHECK:STDOUT: assign %p.var, %.loc13_17 -// CHECK:STDOUT: %p.ref: ref %.2 = name_ref p, %p -// CHECK:STDOUT: %.loc15_11: %.2 = bind_value %p.ref +// CHECK:STDOUT: %p.ref: ref %.28 = name_ref p, %p +// CHECK:STDOUT: %.loc15_11: %.28 = bind_value %p.ref // CHECK:STDOUT: %.loc15_10.1: ref i32 = deref %.loc15_11 // CHECK:STDOUT: %.loc15_10.2: i32 = bind_value %.loc15_10.1 // CHECK:STDOUT: return %.loc15_10.2 diff --git a/toolchain/check/testdata/pointer/fail_address_of_value.carbon b/toolchain/check/testdata/pointer/fail_address_of_value.carbon index c4b1b5bce4c56..b806cdb5a547e 100644 --- a/toolchain/check/testdata/pointer/fail_address_of_value.carbon +++ b/toolchain/check/testdata/pointer/fail_address_of_value.carbon @@ -111,30 +111,32 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: %H: %H.type = struct_value () [template] // CHECK:STDOUT: %AddressOfLiteral.type: type = fn_type @AddressOfLiteral [template] // CHECK:STDOUT: %AddressOfLiteral: %AddressOfLiteral.type = struct_value () [template] -// CHECK:STDOUT: %.2: i32 = int_value 0 [template] -// CHECK:STDOUT: %.3: type = ptr_type i32 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %.3: type = ptr_type Core.IntLiteral [template] // CHECK:STDOUT: %.4: bool = bool_literal true [template] // CHECK:STDOUT: %.5: type = ptr_type bool [template] // CHECK:STDOUT: %.6: f64 = float_literal 1 [template] // CHECK:STDOUT: %.7: type = ptr_type f64 [template] // CHECK:STDOUT: %.8: type = ptr_type String [template] // CHECK:STDOUT: %.9: String = string_literal "Hello" [template] -// CHECK:STDOUT: %.10: i32 = int_value 1 [template] -// CHECK:STDOUT: %.11: i32 = int_value 2 [template] -// CHECK:STDOUT: %tuple.type: type = tuple_type (i32, i32) [template] +// CHECK:STDOUT: %.10: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.11: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %tuple.type: type = tuple_type (Core.IntLiteral, Core.IntLiteral) [template] // CHECK:STDOUT: %.12: type = ptr_type %tuple.type [template] -// CHECK:STDOUT: %.13: i32 = int_value 5 [template] -// CHECK:STDOUT: %.14: type = ptr_type %.1 [template] +// CHECK:STDOUT: %.13: Core.IntLiteral = int_value 5 [template] +// CHECK:STDOUT: %.14: type = struct_type {.a: Core.IntLiteral} [template] +// CHECK:STDOUT: %.15: type = ptr_type %.14 [template] // CHECK:STDOUT: %AddressOfOperator.type: type = fn_type @AddressOfOperator [template] // CHECK:STDOUT: %AddressOfOperator: %AddressOfOperator.type = struct_value () [template] -// CHECK:STDOUT: %.15: bool = bool_literal false [template] +// CHECK:STDOUT: %.16: bool = bool_literal false [template] +// CHECK:STDOUT: %.17: type = ptr_type i32 [template] // CHECK:STDOUT: %AddressOfCall.type: type = fn_type @AddressOfCall [template] // CHECK:STDOUT: %AddressOfCall: %AddressOfCall.type = struct_value () [template] // CHECK:STDOUT: %AddressOfType.type: type = fn_type @AddressOfType [template] // CHECK:STDOUT: %AddressOfType: %AddressOfType.type = struct_value () [template] -// CHECK:STDOUT: %.16: type = ptr_type type [template] -// CHECK:STDOUT: %.17: type = const_type i32 [template] -// CHECK:STDOUT: %.18: type = ptr_type %.17 [template] +// CHECK:STDOUT: %.18: type = ptr_type type [template] +// CHECK:STDOUT: %.19: type = const_type i32 [template] +// CHECK:STDOUT: %.20: type = ptr_type %.19 [template] // CHECK:STDOUT: %AddressOfTupleElementValue.type: type = fn_type @AddressOfTupleElementValue [template] // CHECK:STDOUT: %AddressOfTupleElementValue: %AddressOfTupleElementValue.type = struct_value () [template] // CHECK:STDOUT: %tuple: %tuple.type = tuple_value (%.10, %.11) [template] @@ -207,7 +209,7 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: // CHECK:STDOUT: fn @AddressOfLiteral() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc20_4: i32 = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc20_4: Core.IntLiteral = int_value 0 [template = constants.%.2] // CHECK:STDOUT: %.loc20_3: %.3 = addr_of [template = ] // CHECK:STDOUT: %.loc25_4: bool = bool_literal true [template = constants.%.4] // CHECK:STDOUT: %.loc25_3: %.5 = addr_of [template = ] @@ -215,37 +217,37 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: %.loc30_3: %.7 = addr_of [template = ] // CHECK:STDOUT: %.loc35_4: String = string_literal "Hello" [template = constants.%.9] // CHECK:STDOUT: %.loc35_3: %.8 = addr_of [template = ] -// CHECK:STDOUT: %.loc40_5: i32 = int_value 1 [template = constants.%.10] -// CHECK:STDOUT: %.loc40_8: i32 = int_value 2 [template = constants.%.11] +// CHECK:STDOUT: %.loc40_5: Core.IntLiteral = int_value 1 [template = constants.%.10] +// CHECK:STDOUT: %.loc40_8: Core.IntLiteral = int_value 2 [template = constants.%.11] // CHECK:STDOUT: %.loc40_9: %tuple.type = tuple_literal (%.loc40_5, %.loc40_8) // CHECK:STDOUT: %.loc40_3: %.12 = addr_of [template = ] -// CHECK:STDOUT: %.loc45_10: i32 = int_value 5 [template = constants.%.13] -// CHECK:STDOUT: %.loc45_11: %.1 = struct_literal (%.loc45_10) -// CHECK:STDOUT: %.loc45_3: %.14 = addr_of [template = ] +// CHECK:STDOUT: %.loc45_10: Core.IntLiteral = int_value 5 [template = constants.%.13] +// CHECK:STDOUT: %.loc45_11: %.14 = struct_literal (%.loc45_10) +// CHECK:STDOUT: %.loc45_3: %.15 = addr_of [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @AddressOfOperator() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc53_5: bool = bool_literal true [template = constants.%.4] -// CHECK:STDOUT: %.loc53_10.1: bool = bool_literal false [template = constants.%.15] +// CHECK:STDOUT: %.loc53_10.1: bool = bool_literal false [template = constants.%.16] // CHECK:STDOUT: if %.loc53_5 br !and.rhs else br !and.result(%.loc53_10.1) // CHECK:STDOUT: // CHECK:STDOUT: !and.rhs: -// CHECK:STDOUT: %.loc53_14: bool = bool_literal false [template = constants.%.15] +// CHECK:STDOUT: %.loc53_14: bool = bool_literal false [template = constants.%.16] // CHECK:STDOUT: br !and.result(%.loc53_14) // CHECK:STDOUT: // CHECK:STDOUT: !and.result: -// CHECK:STDOUT: %.loc53_10.2: bool = block_arg !and.result [template = constants.%.15] +// CHECK:STDOUT: %.loc53_10.2: bool = block_arg !and.result [template = constants.%.16] // CHECK:STDOUT: %.loc53_3: %.5 = addr_of [template = ] // CHECK:STDOUT: %H.ref: %H.type = name_ref H, file.%H.decl [template = constants.%H] // CHECK:STDOUT: %H.call: init %.1 = call %H.ref() // CHECK:STDOUT: %.loc58_5.1: ref %.1 = temporary_storage // CHECK:STDOUT: %.loc58_5.2: ref %.1 = temporary %.loc58_5.1, %H.call // CHECK:STDOUT: %.loc58_7: ref i32 = struct_access %.loc58_5.2, element0 -// CHECK:STDOUT: %.loc58_3: %.3 = addr_of [template = ] +// CHECK:STDOUT: %.loc58_3: %.17 = addr_of [template = ] // CHECK:STDOUT: %.loc63_9: bool = bool_literal true [template = constants.%.4] -// CHECK:STDOUT: %.loc63_5: bool = not %.loc63_9 [template = constants.%.15] +// CHECK:STDOUT: %.loc63_5: bool = not %.loc63_9 [template = constants.%.16] // CHECK:STDOUT: %.loc63_3: %.5 = addr_of [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -254,32 +256,32 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %G.ref: %G.type = name_ref G, file.%G.decl [template = constants.%G] // CHECK:STDOUT: %G.call: init i32 = call %G.ref() -// CHECK:STDOUT: %.loc71: %.3 = addr_of [template = ] +// CHECK:STDOUT: %.loc71: %.17 = addr_of [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @AddressOfType() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int.make_type_32.loc79: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc79: %.16 = addr_of [template = ] +// CHECK:STDOUT: %.loc79: %.18 = addr_of [template = ] // CHECK:STDOUT: %int.make_type_32.loc84: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc84_5.1: type = value_of_initializer %int.make_type_32.loc84 [template = i32] // CHECK:STDOUT: %.loc84_5.2: type = converted %int.make_type_32.loc84, %.loc84_5.1 [template = i32] -// CHECK:STDOUT: %.loc84_5.3: type = const_type i32 [template = constants.%.17] -// CHECK:STDOUT: %.loc84_14: type = ptr_type %.17 [template = constants.%.18] -// CHECK:STDOUT: %.loc84_3: %.16 = addr_of [template = ] +// CHECK:STDOUT: %.loc84_5.3: type = const_type i32 [template = constants.%.19] +// CHECK:STDOUT: %.loc84_14: type = ptr_type %.19 [template = constants.%.20] +// CHECK:STDOUT: %.loc84_3: %.18 = addr_of [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @AddressOfTupleElementValue() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc92_6: i32 = int_value 1 [template = constants.%.10] -// CHECK:STDOUT: %.loc92_9: i32 = int_value 2 [template = constants.%.11] +// CHECK:STDOUT: %.loc92_6: Core.IntLiteral = int_value 1 [template = constants.%.10] +// CHECK:STDOUT: %.loc92_9: Core.IntLiteral = int_value 2 [template = constants.%.11] // CHECK:STDOUT: %.loc92_10.1: %tuple.type = tuple_literal (%.loc92_6, %.loc92_9) -// CHECK:STDOUT: %.loc92_12: i32 = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc92_12: Core.IntLiteral = int_value 0 [template = constants.%.2] // CHECK:STDOUT: %tuple: %tuple.type = tuple_value (%.loc92_6, %.loc92_9) [template = constants.%tuple] // CHECK:STDOUT: %.loc92_10.2: %tuple.type = converted %.loc92_10.1, %tuple [template = constants.%tuple] -// CHECK:STDOUT: %.loc92_11: i32 = tuple_access %.loc92_10.2, element0 [template = constants.%.10] +// CHECK:STDOUT: %.loc92_11: Core.IntLiteral = tuple_access %.loc92_10.2, element0 [template = constants.%.10] // CHECK:STDOUT: %.loc92_3: %.3 = addr_of [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -289,11 +291,11 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: %int.make_type_32.loc99: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc99_22.1: type = value_of_initializer %int.make_type_32.loc99 [template = i32] // CHECK:STDOUT: %.loc99_22.2: type = converted %int.make_type_32.loc99, %.loc99_22.1 [template = i32] -// CHECK:STDOUT: %.loc99_22.3: type = ptr_type i32 [template = constants.%.3] -// CHECK:STDOUT: %param_addr.var: ref %.3 = var param_addr -// CHECK:STDOUT: %param_addr: ref %.3 = bind_name param_addr, %param_addr.var +// CHECK:STDOUT: %.loc99_22.3: type = ptr_type i32 [template = constants.%.17] +// CHECK:STDOUT: %param_addr.var: ref %.17 = var param_addr +// CHECK:STDOUT: %param_addr: ref %.17 = bind_name param_addr, %param_addr.var // CHECK:STDOUT: %param.ref: i32 = name_ref param, %param -// CHECK:STDOUT: %.loc99_26: %.3 = addr_of [template = ] +// CHECK:STDOUT: %.loc99_26: %.17 = addr_of [template = ] // CHECK:STDOUT: assign %param_addr.var, %.loc99_26 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/pointer/import.carbon b/toolchain/check/testdata/pointer/import.carbon index 14f110c64629d..9fae4f0875cf4 100644 --- a/toolchain/check/testdata/pointer/import.carbon +++ b/toolchain/check/testdata/pointer/import.carbon @@ -26,13 +26,20 @@ var a: i32* = a_ref; // CHECK:STDOUT: constants { // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] -// CHECK:STDOUT: %.2: type = ptr_type i32 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 0 [template] +// CHECK:STDOUT: %.28: type = ptr_type i32 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -53,17 +60,21 @@ var a: i32* = a_ref; // CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc5_15.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32] // CHECK:STDOUT: %.loc5_15.2: type = converted %int.make_type_32.loc5, %.loc5_15.1 [template = i32] -// CHECK:STDOUT: %.loc5_15.3: type = ptr_type i32 [template = constants.%.2] -// CHECK:STDOUT: %a_ref.var: ref %.2 = var a_ref -// CHECK:STDOUT: %a_ref: ref %.2 = bind_name a_ref, %a_ref.var +// CHECK:STDOUT: %.loc5_15.3: type = ptr_type i32 [template = constants.%.28] +// CHECK:STDOUT: %a_ref.var: ref %.28 = var a_ref +// CHECK:STDOUT: %a_ref: ref %.28 = bind_name a_ref, %a_ref.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc4: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: assign file.%a_orig.var, %.loc4 +// CHECK:STDOUT: %.loc4_19: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc4_20.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_20.2: = bound_method %.loc4_19, %.loc4_20.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc4_20.2(%.loc4_19) [template = constants.%.27] +// CHECK:STDOUT: %.loc4_20.3: init i32 = converted %.loc4_19, %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: assign file.%a_orig.var, %.loc4_20.3 // CHECK:STDOUT: %a_orig.ref: ref i32 = name_ref a_orig, file.%a_orig -// CHECK:STDOUT: %.loc5: %.2 = addr_of %a_orig.ref +// CHECK:STDOUT: %.loc5: %.28 = addr_of %a_orig.ref // CHECK:STDOUT: assign file.%a_ref.var, %.loc5 // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -71,19 +82,131 @@ var a: i32* = a_ref; // CHECK:STDOUT: --- implicit.impl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.2: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic] +// CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2) = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.3: type = facet_type <@ImplicitAs, @ImplicitAs(i32)> [template] +// CHECK:STDOUT: %Self.2: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Convert.type.1: type = fn_type @Convert.1, @ImplicitAs(%Dest) [symbolic] +// CHECK:STDOUT: %Convert.1: %Convert.type.1 = struct_value () [symbolic] +// CHECK:STDOUT: %.1: type = assoc_entity_type %ImplicitAs.type.2, %Convert.type.1 [symbolic] +// CHECK:STDOUT: %.2: %.1 = assoc_entity element0, imports.%import_ref.9 [symbolic] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(i32) [template] +// CHECK:STDOUT: %Convert.2: %Convert.type.2 = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type %ImplicitAs.type.3, %Convert.type.2 [template] +// CHECK:STDOUT: %.4: %.3 = assoc_entity element0, imports.%import_ref.10 [template] +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic] +// CHECK:STDOUT: %.5: type = int_type signed, %N [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.4: type = facet_type <@ImplicitAs, @ImplicitAs(%.5)> [symbolic] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.3: type = fn_type @Convert.2, @impl.2(%N) [symbolic] +// CHECK:STDOUT: %Convert.3: %Convert.type.3 = struct_value () [symbolic] +// CHECK:STDOUT: %.6: = interface_witness (%Convert.3) [symbolic] +// CHECK:STDOUT: %.7: type = int_type unsigned, %N [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.5: type = facet_type <@ImplicitAs, @ImplicitAs(%.7)> [symbolic] +// CHECK:STDOUT: %Convert.type.4: type = fn_type @Convert.3, @impl.3(%N) [symbolic] +// CHECK:STDOUT: %Convert.4: %Convert.type.4 = struct_value () [symbolic] +// CHECK:STDOUT: %.8: = interface_witness (%Convert.4) [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.6: type = facet_type <@ImplicitAs, @ImplicitAs(Core.IntLiteral)> [template] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %Convert.5: %Convert.type.5 = struct_value () [template] +// CHECK:STDOUT: %.9: type = assoc_entity_type %ImplicitAs.type.6, %Convert.type.5 [template] +// CHECK:STDOUT: %.10: %.9 = assoc_entity element0, imports.%import_ref.20 [template] +// CHECK:STDOUT: %Convert.type.6: type = fn_type @Convert.4, @impl.5(%N) [symbolic] +// CHECK:STDOUT: %Convert.6: %Convert.type.6 = struct_value () [symbolic] +// CHECK:STDOUT: %.11: = interface_witness (%Convert.6) [symbolic] +// CHECK:STDOUT: %Convert.type.7: type = fn_type @Convert.5, @impl.6(%N) [symbolic] +// CHECK:STDOUT: %Convert.7: %Convert.type.7 = struct_value () [symbolic] +// CHECK:STDOUT: %.12: = interface_witness (%Convert.7) [symbolic] +// CHECK:STDOUT: %As.type.2: type = facet_type <@As, @As(%Dest)> [symbolic] +// CHECK:STDOUT: %Self.3: @As.%As.type (%As.type.2) = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %As.type.3: type = facet_type <@As, @As(i32)> [template] +// CHECK:STDOUT: %Self.4: %As.type.2 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Convert.type.8: type = fn_type @Convert.6, @As(%Dest) [symbolic] +// CHECK:STDOUT: %Convert.8: %Convert.type.8 = struct_value () [symbolic] +// CHECK:STDOUT: %.13: type = assoc_entity_type %As.type.2, %Convert.type.8 [symbolic] +// CHECK:STDOUT: %.14: %.13 = assoc_entity element0, imports.%import_ref.33 [symbolic] +// CHECK:STDOUT: %Convert.type.9: type = fn_type @Convert.6, @As(i32) [template] +// CHECK:STDOUT: %Convert.9: %Convert.type.9 = struct_value () [template] +// CHECK:STDOUT: %.15: type = assoc_entity_type %As.type.3, %Convert.type.9 [template] +// CHECK:STDOUT: %.16: %.15 = assoc_entity element0, imports.%import_ref.34 [template] +// CHECK:STDOUT: %As.type.4: type = facet_type <@As, @As(%.5)> [symbolic] +// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.7, @impl.8(%N) [symbolic] +// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [symbolic] +// CHECK:STDOUT: %.17: = interface_witness (%Convert.10) [symbolic] +// CHECK:STDOUT: %As.type.5: type = facet_type <@As, @As(%.7)> [symbolic] +// CHECK:STDOUT: %Convert.type.11: type = fn_type @Convert.8, @impl.9(%N) [symbolic] +// CHECK:STDOUT: %Convert.11: %Convert.type.11 = struct_value () [symbolic] +// CHECK:STDOUT: %.18: = interface_witness (%Convert.11) [symbolic] +// CHECK:STDOUT: %As.type.6: type = facet_type <@As, @As(Core.IntLiteral)> [template] +// CHECK:STDOUT: %Convert.type.12: type = fn_type @Convert.6, @As(Core.IntLiteral) [template] +// CHECK:STDOUT: %Convert.12: %Convert.type.12 = struct_value () [template] +// CHECK:STDOUT: %.19: type = assoc_entity_type %As.type.6, %Convert.type.12 [template] +// CHECK:STDOUT: %.20: %.19 = assoc_entity element0, imports.%import_ref.44 [template] +// CHECK:STDOUT: %Convert.type.13: type = fn_type @Convert.9, @impl.11(%N) [symbolic] +// CHECK:STDOUT: %Convert.13: %Convert.type.13 = struct_value () [symbolic] +// CHECK:STDOUT: %.21: = interface_witness (%Convert.13) [symbolic] +// CHECK:STDOUT: %Convert.type.14: type = fn_type @Convert.10, @impl.12(%N) [symbolic] +// CHECK:STDOUT: %Convert.14: %Convert.type.14 = struct_value () [symbolic] +// CHECK:STDOUT: %.22: = interface_witness (%Convert.14) [symbolic] // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: type = ptr_type i32 [template] +// CHECK:STDOUT: %.23: type = ptr_type i32 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %import_ref.1 = import_ref Implicit//default, inst+15, unloaded -// CHECK:STDOUT: %import_ref.2: ref %.1 = import_ref Implicit//default, inst+25, loaded +// CHECK:STDOUT: %import_ref.2: ref %.23 = import_ref Implicit//default, inst+388, loaded // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref.3 +// CHECK:STDOUT: .Int32 = %import_ref.51 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.3 = import_ref Implicit//default, inst+30, unloaded +// CHECK:STDOUT: %import_ref.4 = import_ref Implicit//default, inst+31, unloaded +// CHECK:STDOUT: %import_ref.5 = import_ref Implicit//default, inst+32, unloaded +// CHECK:STDOUT: %import_ref.6: type = import_ref Implicit//default, inst+66, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.7: type = import_ref Implicit//default, inst+67, loaded [template = constants.%ImplicitAs.type.3] +// CHECK:STDOUT: %import_ref.8 = import_ref Implicit//default, inst+68, unloaded +// CHECK:STDOUT: %import_ref.9 = import_ref Implicit//default, inst+47, unloaded +// CHECK:STDOUT: %import_ref.11: type = import_ref Implicit//default, inst+78, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.12: type = import_ref Implicit//default, inst+79, loaded [symbolic = @impl.2.%ImplicitAs.type (constants.%ImplicitAs.type.4)] +// CHECK:STDOUT: %import_ref.13 = import_ref Implicit//default, inst+80, unloaded +// CHECK:STDOUT: %import_ref.14: type = import_ref Implicit//default, inst+108, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.15: type = import_ref Implicit//default, inst+109, loaded [symbolic = @impl.3.%ImplicitAs.type (constants.%ImplicitAs.type.5)] +// CHECK:STDOUT: %import_ref.16 = import_ref Implicit//default, inst+110, unloaded +// CHECK:STDOUT: %import_ref.17: type = import_ref Implicit//default, inst+133, loaded [template = i32] +// CHECK:STDOUT: %import_ref.18: type = import_ref Implicit//default, inst+134, loaded [template = constants.%ImplicitAs.type.6] +// CHECK:STDOUT: %import_ref.19 = import_ref Implicit//default, inst+135, unloaded +// CHECK:STDOUT: %import_ref.21: type = import_ref Implicit//default, inst+146, loaded [symbolic = @impl.5.%.1 (constants.%.5)] +// CHECK:STDOUT: %import_ref.22: type = import_ref Implicit//default, inst+147, loaded [template = constants.%ImplicitAs.type.6] +// CHECK:STDOUT: %import_ref.23 = import_ref Implicit//default, inst+148, unloaded +// CHECK:STDOUT: %import_ref.24: type = import_ref Implicit//default, inst+173, loaded [symbolic = @impl.6.%.1 (constants.%.7)] +// CHECK:STDOUT: %import_ref.25: type = import_ref Implicit//default, inst+174, loaded [template = constants.%ImplicitAs.type.6] +// CHECK:STDOUT: %import_ref.26 = import_ref Implicit//default, inst+175, unloaded +// CHECK:STDOUT: %import_ref.27 = import_ref Implicit//default, inst+205, unloaded +// CHECK:STDOUT: %import_ref.28 = import_ref Implicit//default, inst+206, unloaded +// CHECK:STDOUT: %import_ref.29 = import_ref Implicit//default, inst+207, unloaded +// CHECK:STDOUT: %import_ref.30: type = import_ref Implicit//default, inst+209, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.31: type = import_ref Implicit//default, inst+210, loaded [template = constants.%As.type.3] +// CHECK:STDOUT: %import_ref.32 = import_ref Implicit//default, inst+211, unloaded +// CHECK:STDOUT: %import_ref.33 = import_ref Implicit//default, inst+226, unloaded +// CHECK:STDOUT: %import_ref.35: type = import_ref Implicit//default, inst+248, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.36: type = import_ref Implicit//default, inst+249, loaded [symbolic = @impl.8.%As.type (constants.%As.type.4)] +// CHECK:STDOUT: %import_ref.37 = import_ref Implicit//default, inst+250, unloaded +// CHECK:STDOUT: %import_ref.38: type = import_ref Implicit//default, inst+277, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.39: type = import_ref Implicit//default, inst+278, loaded [symbolic = @impl.9.%As.type (constants.%As.type.5)] +// CHECK:STDOUT: %import_ref.40 = import_ref Implicit//default, inst+279, unloaded +// CHECK:STDOUT: %import_ref.41: type = import_ref Implicit//default, inst+302, loaded [template = i32] +// CHECK:STDOUT: %import_ref.42: type = import_ref Implicit//default, inst+303, loaded [template = constants.%As.type.6] +// CHECK:STDOUT: %import_ref.43 = import_ref Implicit//default, inst+304, unloaded +// CHECK:STDOUT: %import_ref.45: type = import_ref Implicit//default, inst+315, loaded [symbolic = @impl.11.%.1 (constants.%.5)] +// CHECK:STDOUT: %import_ref.46: type = import_ref Implicit//default, inst+316, loaded [template = constants.%As.type.6] +// CHECK:STDOUT: %import_ref.47 = import_ref Implicit//default, inst+317, unloaded +// CHECK:STDOUT: %import_ref.48: type = import_ref Implicit//default, inst+342, loaded [symbolic = @impl.12.%.1 (constants.%.7)] +// CHECK:STDOUT: %import_ref.49: type = import_ref Implicit//default, inst+343, loaded [template = constants.%As.type.6] +// CHECK:STDOUT: %import_ref.50 = import_ref Implicit//default, inst+344, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -99,16 +222,574 @@ var a: i32* = a_ref; // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc4_11.1: type = value_of_initializer %int.make_type_32 [template = i32] // CHECK:STDOUT: %.loc4_11.2: type = converted %int.make_type_32, %.loc4_11.1 [template = i32] -// CHECK:STDOUT: %.loc4_11.3: type = ptr_type i32 [template = constants.%.1] -// CHECK:STDOUT: %a.var: ref %.1 = var a -// CHECK:STDOUT: %a: ref %.1 = bind_name a, %a.var +// CHECK:STDOUT: %.loc4_11.3: type = ptr_type i32 [template = constants.%.23] +// CHECK:STDOUT: %a.var: ref %.23 = var a +// CHECK:STDOUT: %a: ref %.23 = bind_name a, %a.var +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(constants.%Dest: type) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)] +// CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.1, @ImplicitAs(%Dest) [symbolic = %Convert.type (constants.%Convert.type.1)] +// CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.1) = struct_value () [symbolic = %Convert (constants.%Convert.1)] +// CHECK:STDOUT: %.1: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2), @ImplicitAs.%Convert.type (%Convert.type.1) [symbolic = %.1 (constants.%.1)] +// CHECK:STDOUT: %.2: @ImplicitAs.%.1 (%.1) = assoc_entity element0, imports.%import_ref.9 [symbolic = %.2 (constants.%.2)] +// CHECK:STDOUT: +// CHECK:STDOUT: interface { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%import_ref.3 +// CHECK:STDOUT: .Convert = imports.%import_ref.4 +// CHECK:STDOUT: witness = (imports.%import_ref.5) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @As(constants.%Dest: type) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest)> [symbolic = %As.type (constants.%As.type.2)] +// CHECK:STDOUT: %Self: %As.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.4)] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.6, @As(%Dest) [symbolic = %Convert.type (constants.%Convert.type.8)] +// CHECK:STDOUT: %Convert: @As.%Convert.type (%Convert.type.8) = struct_value () [symbolic = %Convert (constants.%Convert.8)] +// CHECK:STDOUT: %.1: type = assoc_entity_type @As.%As.type (%As.type.2), @As.%Convert.type (%Convert.type.8) [symbolic = %.1 (constants.%.13)] +// CHECK:STDOUT: %.2: @As.%.1 (%.13) = assoc_entity element0, imports.%import_ref.33 [symbolic = %.2 (constants.%.14)] +// CHECK:STDOUT: +// CHECK:STDOUT: interface { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%import_ref.27 +// CHECK:STDOUT: .Convert = imports.%import_ref.28 +// CHECK:STDOUT: witness = (imports.%import_ref.29) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.1: imports.%import_ref.6 as imports.%import_ref.7 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.8 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.2(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%.1)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.4)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.2, @impl.2(%N) [symbolic = %Convert.type (constants.%Convert.type.3)] +// CHECK:STDOUT: %Convert: @impl.2.%Convert.type (%Convert.type.3) = struct_value () [symbolic = %Convert (constants.%Convert.3)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.6)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.11 as imports.%import_ref.12 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.13 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.3(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%.1)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.3, @impl.3(%N) [symbolic = %Convert.type (constants.%Convert.type.4)] +// CHECK:STDOUT: %Convert: @impl.3.%Convert.type (%Convert.type.4) = struct_value () [symbolic = %Convert (constants.%Convert.4)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.8)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.14 as imports.%import_ref.15 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.16 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.4: imports.%import_ref.17 as imports.%import_ref.18 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.19 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.5(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.4, @impl.5(%N) [symbolic = %Convert.type (constants.%Convert.type.6)] +// CHECK:STDOUT: %Convert: @impl.5.%Convert.type (%Convert.type.6) = struct_value () [symbolic = %Convert (constants.%Convert.6)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.11)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.21 as imports.%import_ref.22 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.23 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.6(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.5, @impl.6(%N) [symbolic = %Convert.type (constants.%Convert.type.7)] +// CHECK:STDOUT: %Convert: @impl.6.%Convert.type (%Convert.type.7) = struct_value () [symbolic = %Convert (constants.%Convert.7)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.12)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.24 as imports.%import_ref.25 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.26 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.7: imports.%import_ref.30 as imports.%import_ref.31 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.32 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.8(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%.1)> [symbolic = %As.type (constants.%As.type.4)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.7, @impl.8(%N) [symbolic = %Convert.type (constants.%Convert.type.10)] +// CHECK:STDOUT: %Convert: @impl.8.%Convert.type (%Convert.type.10) = struct_value () [symbolic = %Convert (constants.%Convert.10)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.17)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.35 as imports.%import_ref.36 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.37 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.9(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%.1)> [symbolic = %As.type (constants.%As.type.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.8, @impl.9(%N) [symbolic = %Convert.type (constants.%Convert.type.11)] +// CHECK:STDOUT: %Convert: @impl.9.%Convert.type (%Convert.type.11) = struct_value () [symbolic = %Convert (constants.%Convert.11)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.18)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.38 as imports.%import_ref.39 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.40 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.10: imports.%import_ref.41 as imports.%import_ref.42 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.43 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.11(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.9, @impl.11(%N) [symbolic = %Convert.type (constants.%Convert.type.13)] +// CHECK:STDOUT: %Convert: @impl.11.%Convert.type (%Convert.type.13) = struct_value () [symbolic = %Convert (constants.%Convert.13)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.21)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.45 as imports.%import_ref.46 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.47 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.12(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.10, @impl.12(%N) [symbolic = %Convert.type (constants.%Convert.type.14)] +// CHECK:STDOUT: %Convert: @impl.12.%Convert.type (%Convert.type.14) = struct_value () [symbolic = %Convert (constants.%Convert.14)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.22)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.48 as imports.%import_ref.49 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.50 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.1(constants.%Dest: type, constants.%Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2)) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)] +// CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.1.%Self (%Self.2)]() -> @Convert.1.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.2(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.2.%.1 (%.5) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.3(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.3.%.1 (%.7) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.4(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.4.%.1 (%.5)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.5(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.5.%.1 (%.7)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.6(constants.%Dest: type, constants.%Self.3: @As.%As.type (%As.type.2)) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest)> [symbolic = %As.type (constants.%As.type.2)] +// CHECK:STDOUT: %Self: %As.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.4)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.6.%Self (%Self.4)]() -> @Convert.6.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.7(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.7.%.1 (%.5) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.8(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.8.%.1 (%.7) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.9(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.9.%.1 (%.5)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.10(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.10.%.1 (%.7)]() -> Core.IntLiteral = "int.convert_checked"; // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %a_ref.ref: ref %.1 = name_ref a_ref, imports.%import_ref.2 -// CHECK:STDOUT: %.loc4: %.1 = bind_value %a_ref.ref +// CHECK:STDOUT: %a_ref.ref: ref %.23 = name_ref a_ref, imports.%import_ref.2 +// CHECK:STDOUT: %.loc4: %.23 = bind_value %a_ref.ref // CHECK:STDOUT: assign file.%a.var, %.loc4 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(i32) { +// CHECK:STDOUT: %Dest => i32 +// CHECK:STDOUT: %Dest.patt => i32 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3 +// CHECK:STDOUT: %Self => constants.%Self.2 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.2 +// CHECK:STDOUT: %Convert => constants.%Convert.2 +// CHECK:STDOUT: %.1 => constants.%.3 +// CHECK:STDOUT: %.2 => constants.%.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@Convert.1.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.1(constants.%Dest, constants.%Self.1) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.2 +// CHECK:STDOUT: %Self => constants.%Self.1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%.5) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@impl.2.%.1) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.2(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.2(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.2(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%.7) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@impl.3.%.1) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.3(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.3(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.3(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(Core.IntLiteral) { +// CHECK:STDOUT: %Dest => Core.IntLiteral +// CHECK:STDOUT: %Dest.patt => Core.IntLiteral +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.6 +// CHECK:STDOUT: %Self => constants.%Self.2 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.5 +// CHECK:STDOUT: %Convert => constants.%Convert.5 +// CHECK:STDOUT: %.1 => constants.%.9 +// CHECK:STDOUT: %.2 => constants.%.10 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.5(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.5(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.4(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.6(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.6(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.5(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(i32) { +// CHECK:STDOUT: %Dest => i32 +// CHECK:STDOUT: %Dest.patt => i32 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type => constants.%As.type.3 +// CHECK:STDOUT: %Self => constants.%Self.4 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.9 +// CHECK:STDOUT: %Convert => constants.%Convert.9 +// CHECK:STDOUT: %.1 => constants.%.15 +// CHECK:STDOUT: %.2 => constants.%.16 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(@Convert.6.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.6(constants.%Dest, constants.%Self.3) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %As.type => constants.%As.type.2 +// CHECK:STDOUT: %Self => constants.%Self.3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%.5) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(@impl.8.%.1) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.8(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %As.type => constants.%As.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.8(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %As.type => constants.%As.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.7(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%.7) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(@impl.9.%.1) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.9(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %As.type => constants.%As.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.9(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %As.type => constants.%As.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.8(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(Core.IntLiteral) { +// CHECK:STDOUT: %Dest => Core.IntLiteral +// CHECK:STDOUT: %Dest.patt => Core.IntLiteral +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type => constants.%As.type.6 +// CHECK:STDOUT: %Self => constants.%Self.4 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.12 +// CHECK:STDOUT: %Convert => constants.%Convert.12 +// CHECK:STDOUT: %.1 => constants.%.19 +// CHECK:STDOUT: %.2 => constants.%.20 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.11(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.11(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.9(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.12(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.12(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.10(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/code_after_return.carbon b/toolchain/check/testdata/return/code_after_return.carbon index 3abd71d072c92..77d255dc00b0a 100644 --- a/toolchain/check/testdata/return/code_after_return.carbon +++ b/toolchain/check/testdata/return/code_after_return.carbon @@ -22,7 +22,8 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/return/code_after_return_value.carbon b/toolchain/check/testdata/return/code_after_return_value.carbon index dce36eb5b6bee..303c122be965f 100644 --- a/toolchain/check/testdata/return/code_after_return_value.carbon +++ b/toolchain/check/testdata/return/code_after_return_value.carbon @@ -29,13 +29,20 @@ fn F(b: bool) -> i32 { // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Bool = %import_ref.1 // CHECK:STDOUT: .Int32 = %import_ref.2 +// CHECK:STDOUT: .ImplicitAs = %import_ref.3 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -68,7 +75,12 @@ fn F(b: bool) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%b.param_patt: bool) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc12: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: return %.loc12 +// CHECK:STDOUT: %.loc12_10: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc12_11.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_11.2: = bound_method %.loc12_10, %.loc12_11.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc12_11.2(%.loc12_10) [template = constants.%.27] +// CHECK:STDOUT: %.loc12_11.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc12_11.4: i32 = converted %.loc12_10, %.loc12_11.3 [template = constants.%.27] +// CHECK:STDOUT: return %.loc12_11.4 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_call_in_type.carbon b/toolchain/check/testdata/return/fail_call_in_type.carbon index 1ce8318382ad1..fe3deb107cb6f 100644 --- a/toolchain/check/testdata/return/fail_call_in_type.carbon +++ b/toolchain/check/testdata/return/fail_call_in_type.carbon @@ -25,7 +25,7 @@ fn Six() -> ReturnType() { return 6; } // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %Six.type: type = fn_type @Six [template] // CHECK:STDOUT: %Six: %Six.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 6 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 6 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -73,7 +73,7 @@ fn Six() -> ReturnType() { return 6; } // CHECK:STDOUT: // CHECK:STDOUT: fn @Six() -> { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc17_35: i32 = int_value 6 [template = constants.%.1] +// CHECK:STDOUT: %.loc17_35: Core.IntLiteral = int_value 6 [template = constants.%.1] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_let_in_type.carbon b/toolchain/check/testdata/return/fail_let_in_type.carbon index b07d655b0ad32..9c7511e4c745a 100644 --- a/toolchain/check/testdata/return/fail_let_in_type.carbon +++ b/toolchain/check/testdata/return/fail_let_in_type.carbon @@ -41,20 +41,20 @@ fn FirstPerfectNumber() -> z { return 6; } // CHECK:STDOUT: --- fail_let_in_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_value 6 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 6 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file {} // CHECK:STDOUT: // CHECK:STDOUT: fn @Six() -> { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc16: i32 = int_value 6 [template = constants.%.1] +// CHECK:STDOUT: %.loc16: Core.IntLiteral = int_value 6 [template = constants.%.1] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @HalfDozen() -> { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc28: i32 = int_value 6 [template = constants.%.1] +// CHECK:STDOUT: %.loc28: Core.IntLiteral = int_value 6 [template = constants.%.1] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_return_with_returned_var.carbon b/toolchain/check/testdata/return/fail_return_with_returned_var.carbon index 11e59c883752f..6d2e511f8e526 100644 --- a/toolchain/check/testdata/return/fail_return_with_returned_var.carbon +++ b/toolchain/check/testdata/return/fail_return_with_returned_var.carbon @@ -39,21 +39,33 @@ fn G() -> C { // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] -// CHECK:STDOUT: %.2: i32 = int_value 1 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 0 [template] +// CHECK:STDOUT: %.28: Core.IntLiteral = int_value 1 [template] // CHECK:STDOUT: %C: type = class_type @C [template] -// CHECK:STDOUT: %.3: type = unbound_element_type %C, i32 [template] -// CHECK:STDOUT: %.4: type = struct_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.5: = complete_type_witness %.4 [template] +// CHECK:STDOUT: %.29: type = unbound_element_type %C, i32 [template] +// CHECK:STDOUT: %.30: type = struct_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.31: = complete_type_witness %.30 [template] // CHECK:STDOUT: %G.type: type = fn_type @G [template] // CHECK:STDOUT: %G: %G.type = struct_value () [template] -// CHECK:STDOUT: %.7: i32 = int_value 2 [template] -// CHECK:STDOUT: %struct: %C = struct_value (%.2, %.7) [template] +// CHECK:STDOUT: %.33: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.34: type = struct_type {.a: Core.IntLiteral, .b: Core.IntLiteral} [template] +// CHECK:STDOUT: %.35: = bound_method %.28, %Convert.15 [template] +// CHECK:STDOUT: %.36: i32 = int_value 1 [template] +// CHECK:STDOUT: %.37: = bound_method %.33, %Convert.15 [template] +// CHECK:STDOUT: %.38: i32 = int_value 2 [template] +// CHECK:STDOUT: %struct: %C = struct_value (%.36, %.38) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -92,12 +104,12 @@ fn G() -> C { // CHECK:STDOUT: %int.make_type_32.loc23_18: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc23_18.1: type = value_of_initializer %int.make_type_32.loc23_18 [template = i32] // CHECK:STDOUT: %.loc23_18.2: type = converted %int.make_type_32.loc23_18, %.loc23_18.1 [template = i32] -// CHECK:STDOUT: %.loc23_16: %.3 = field_decl a, element0 [template] +// CHECK:STDOUT: %.loc23_16: %.29 = field_decl a, element0 [template] // CHECK:STDOUT: %int.make_type_32.loc23_30: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc23_30.1: type = value_of_initializer %int.make_type_32.loc23_30 [template = i32] // CHECK:STDOUT: %.loc23_30.2: type = converted %int.make_type_32.loc23_30, %.loc23_30.1 [template = i32] -// CHECK:STDOUT: %.loc23_28: %.3 = field_decl b, element1 [template] -// CHECK:STDOUT: %.loc23_35: = complete_type_witness %.4 [template = constants.%.5] +// CHECK:STDOUT: %.loc23_28: %.29 = field_decl b, element1 [template] +// CHECK:STDOUT: %.loc23_35: = complete_type_witness %.30 [template = constants.%.31] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C @@ -112,9 +124,13 @@ fn G() -> C { // CHECK:STDOUT: %.loc12_19.2: type = converted %int.make_type_32.loc12, %.loc12_19.1 [template = i32] // CHECK:STDOUT: %v.var: ref i32 = var v // CHECK:STDOUT: %v: ref i32 = bind_name v, %v.var -// CHECK:STDOUT: %.loc12_25: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: assign %v.var, %.loc12_25 -// CHECK:STDOUT: %.loc20: i32 = int_value 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc12_25: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc12_26.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_26.2: = bound_method %.loc12_25, %.loc12_26.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc12_26.2(%.loc12_25) [template = constants.%.27] +// CHECK:STDOUT: %.loc12_26.3: init i32 = converted %.loc12_25, %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: assign %v.var, %.loc12_26.3 +// CHECK:STDOUT: %.loc20: Core.IntLiteral = int_value 1 [template = constants.%.28] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -122,15 +138,23 @@ fn G() -> C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.ref.loc25: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %c: ref %C = bind_name c, %return -// CHECK:STDOUT: %.loc25_29: i32 = int_value 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc25_37: i32 = int_value 2 [template = constants.%.7] -// CHECK:STDOUT: %.loc25_38.1: %.4 = struct_literal (%.loc25_29, %.loc25_37) -// CHECK:STDOUT: %.loc25_38.2: ref i32 = class_element_access %return, element0 -// CHECK:STDOUT: %.loc25_38.3: init i32 = initialize_from %.loc25_29 to %.loc25_38.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc25_38.4: ref i32 = class_element_access %return, element1 -// CHECK:STDOUT: %.loc25_38.5: init i32 = initialize_from %.loc25_37 to %.loc25_38.4 [template = constants.%.7] -// CHECK:STDOUT: %.loc25_38.6: init %C = class_init (%.loc25_38.3, %.loc25_38.5), %return [template = constants.%struct] -// CHECK:STDOUT: %.loc25_39: init %C = converted %.loc25_38.1, %.loc25_38.6 [template = constants.%struct] +// CHECK:STDOUT: %.loc25_29: Core.IntLiteral = int_value 1 [template = constants.%.28] +// CHECK:STDOUT: %.loc25_37: Core.IntLiteral = int_value 2 [template = constants.%.33] +// CHECK:STDOUT: %.loc25_38.1: %.34 = struct_literal (%.loc25_29, %.loc25_37) +// CHECK:STDOUT: %.loc25_38.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc25_38.3: = bound_method %.loc25_29, %.loc25_38.2 [template = constants.%.35] +// CHECK:STDOUT: %int.convert_checked.loc25_38.1: init i32 = call %.loc25_38.3(%.loc25_29) [template = constants.%.36] +// CHECK:STDOUT: %.loc25_38.4: init i32 = converted %.loc25_29, %int.convert_checked.loc25_38.1 [template = constants.%.36] +// CHECK:STDOUT: %.loc25_38.5: ref i32 = class_element_access %return, element0 +// CHECK:STDOUT: %.loc25_38.6: init i32 = initialize_from %.loc25_38.4 to %.loc25_38.5 [template = constants.%.36] +// CHECK:STDOUT: %.loc25_38.7: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc25_38.8: = bound_method %.loc25_37, %.loc25_38.7 [template = constants.%.37] +// CHECK:STDOUT: %int.convert_checked.loc25_38.2: init i32 = call %.loc25_38.8(%.loc25_37) [template = constants.%.38] +// CHECK:STDOUT: %.loc25_38.9: init i32 = converted %.loc25_37, %int.convert_checked.loc25_38.2 [template = constants.%.38] +// CHECK:STDOUT: %.loc25_38.10: ref i32 = class_element_access %return, element1 +// CHECK:STDOUT: %.loc25_38.11: init i32 = initialize_from %.loc25_38.9 to %.loc25_38.10 [template = constants.%.38] +// CHECK:STDOUT: %.loc25_38.12: init %C = class_init (%.loc25_38.6, %.loc25_38.11), %return [template = constants.%struct] +// CHECK:STDOUT: %.loc25_39: init %C = converted %.loc25_38.1, %.loc25_38.12 [template = constants.%struct] // CHECK:STDOUT: assign %return, %.loc25_39 // CHECK:STDOUT: %c.ref: ref %C = name_ref c, %c // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/return/fail_returned_var_shadow.carbon b/toolchain/check/testdata/return/fail_returned_var_shadow.carbon index 7757ab58da492..b93d0ca8b8146 100644 --- a/toolchain/check/testdata/return/fail_returned_var_shadow.carbon +++ b/toolchain/check/testdata/return/fail_returned_var_shadow.carbon @@ -47,15 +47,24 @@ fn DifferentScopes() -> i32 { // CHECK:STDOUT: %SameScope.type: type = fn_type @SameScope [template] // CHECK:STDOUT: %SameScope: %SameScope.type = struct_value () [template] // CHECK:STDOUT: %.1: bool = bool_literal true [template] -// CHECK:STDOUT: %.2: i32 = int_value 0 [template] -// CHECK:STDOUT: %.3: i32 = int_value 1 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 0 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 0 [template] +// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.30: = bound_method %.29, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 1 [template] // CHECK:STDOUT: %DifferentScopes.type: type = fn_type @DifferentScopes [template] // CHECK:STDOUT: %DifferentScopes: %DifferentScopes.type = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -101,20 +110,33 @@ fn DifferentScopes() -> i32 { // CHECK:STDOUT: %.loc13_21.2: type = converted %int.make_type_32.loc13, %.loc13_21.1 [template = i32] // CHECK:STDOUT: %v.var: ref i32 = var v // CHECK:STDOUT: %v: ref i32 = bind_name v, %v.var -// CHECK:STDOUT: %.loc13_27: i32 = int_value 0 [template = constants.%.2] -// CHECK:STDOUT: assign %v.var, %.loc13_27 +// CHECK:STDOUT: %.loc13_27: Core.IntLiteral = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc13_28.1: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_28.2: = bound_method %.loc13_27, %.loc13_28.1 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc13: init i32 = call %.loc13_28.2(%.loc13_27) [template = constants.%.28] +// CHECK:STDOUT: %.loc13_28.3: init i32 = converted %.loc13_27, %int.convert_checked.loc13 [template = constants.%.28] +// CHECK:STDOUT: assign %v.var, %.loc13_28.3 // CHECK:STDOUT: %int.make_type_32.loc21: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc21_21.1: type = value_of_initializer %int.make_type_32.loc21 [template = i32] // CHECK:STDOUT: %.loc21_21.2: type = converted %int.make_type_32.loc21, %.loc21_21.1 [template = i32] // CHECK:STDOUT: %w.var: ref i32 = var w // CHECK:STDOUT: %w: ref i32 = bind_name w, %w.var -// CHECK:STDOUT: %.loc21_27: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: assign %w.var, %.loc21_27 +// CHECK:STDOUT: %.loc21_27: Core.IntLiteral = int_value 1 [template = constants.%.29] +// CHECK:STDOUT: %.loc21_28.1: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc21_28.2: = bound_method %.loc21_27, %.loc21_28.1 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc21: init i32 = call %.loc21_28.2(%.loc21_27) [template = constants.%.31] +// CHECK:STDOUT: %.loc21_28.3: init i32 = converted %.loc21_27, %int.convert_checked.loc21 [template = constants.%.31] +// CHECK:STDOUT: assign %w.var, %.loc21_28.3 // CHECK:STDOUT: br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.else: -// CHECK:STDOUT: %.loc23: i32 = int_value 0 [template = constants.%.2] -// CHECK:STDOUT: return %.loc23 +// CHECK:STDOUT: %.loc23_10: Core.IntLiteral = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc23_11.1: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc23_11.2: = bound_method %.loc23_10, %.loc23_11.1 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc23: init i32 = call %.loc23_11.2(%.loc23_10) [template = constants.%.28] +// CHECK:STDOUT: %.loc23_11.3: i32 = value_of_initializer %int.convert_checked.loc23 [template = constants.%.28] +// CHECK:STDOUT: %.loc23_11.4: i32 = converted %.loc23_10, %.loc23_11.3 [template = constants.%.28] +// CHECK:STDOUT: return %.loc23_11.4 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @DifferentScopes() -> i32 { @@ -128,8 +150,12 @@ fn DifferentScopes() -> i32 { // CHECK:STDOUT: %.loc28_21.2: type = converted %int.make_type_32.loc28, %.loc28_21.1 [template = i32] // CHECK:STDOUT: %v.var: ref i32 = var v // CHECK:STDOUT: %v: ref i32 = bind_name v, %v.var -// CHECK:STDOUT: %.loc28_27: i32 = int_value 0 [template = constants.%.2] -// CHECK:STDOUT: assign %v.var, %.loc28_27 +// CHECK:STDOUT: %.loc28_27: Core.IntLiteral = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc28_28.1: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc28_28.2: = bound_method %.loc28_27, %.loc28_28.1 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc28: init i32 = call %.loc28_28.2(%.loc28_27) [template = constants.%.28] +// CHECK:STDOUT: %.loc28_28.3: init i32 = converted %.loc28_27, %int.convert_checked.loc28 [template = constants.%.28] +// CHECK:STDOUT: assign %v.var, %.loc28_28.3 // CHECK:STDOUT: %.loc29: bool = bool_literal true [template = constants.%.1] // CHECK:STDOUT: if %.loc29 br !if.then.loc29 else br !if.else.loc29 // CHECK:STDOUT: @@ -139,15 +165,24 @@ fn DifferentScopes() -> i32 { // CHECK:STDOUT: %.loc36_23.2: type = converted %int.make_type_32.loc36, %.loc36_23.1 [template = i32] // CHECK:STDOUT: %w.var: ref i32 = var w // CHECK:STDOUT: %w: ref i32 = bind_name w, %w.var -// CHECK:STDOUT: %.loc36_29: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: assign %w.var, %.loc36_29 +// CHECK:STDOUT: %.loc36_29: Core.IntLiteral = int_value 1 [template = constants.%.29] +// CHECK:STDOUT: %.loc36_30.1: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc36_30.2: = bound_method %.loc36_29, %.loc36_30.1 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc36: init i32 = call %.loc36_30.2(%.loc36_29) [template = constants.%.31] +// CHECK:STDOUT: %.loc36_30.3: init i32 = converted %.loc36_29, %int.convert_checked.loc36 [template = constants.%.31] +// CHECK:STDOUT: assign %w.var, %.loc36_30.3 // CHECK:STDOUT: br !if.else.loc29 // CHECK:STDOUT: // CHECK:STDOUT: !if.else.loc29: // CHECK:STDOUT: br !if.else.loc27 // CHECK:STDOUT: // CHECK:STDOUT: !if.else.loc27: -// CHECK:STDOUT: %.loc39: i32 = int_value 0 [template = constants.%.2] -// CHECK:STDOUT: return %.loc39 +// CHECK:STDOUT: %.loc39_10: Core.IntLiteral = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc39_11.1: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc39_11.2: = bound_method %.loc39_10, %.loc39_11.1 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc39: init i32 = call %.loc39_11.2(%.loc39_10) [template = constants.%.28] +// CHECK:STDOUT: %.loc39_11.3: i32 = value_of_initializer %int.convert_checked.loc39 [template = constants.%.28] +// CHECK:STDOUT: %.loc39_11.4: i32 = converted %.loc39_10, %.loc39_11.3 [template = constants.%.28] +// CHECK:STDOUT: return %.loc39_11.4 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_value_disallowed.carbon b/toolchain/check/testdata/return/fail_value_disallowed.carbon index df2ce832da816..cad3aa0a56a55 100644 --- a/toolchain/check/testdata/return/fail_value_disallowed.carbon +++ b/toolchain/check/testdata/return/fail_value_disallowed.carbon @@ -23,7 +23,7 @@ fn Main() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %Main.type: type = fn_type @Main [template] // CHECK:STDOUT: %Main: %Main.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -44,7 +44,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc18: i32 = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc18: Core.IntLiteral = int_value 0 [template = constants.%.1] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_var_in_type.carbon b/toolchain/check/testdata/return/fail_var_in_type.carbon index 7a2d5be416ecc..502cec8468065 100644 --- a/toolchain/check/testdata/return/fail_var_in_type.carbon +++ b/toolchain/check/testdata/return/fail_var_in_type.carbon @@ -21,7 +21,7 @@ fn Six() -> x { return 6; } // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %Six.type: type = fn_type @Six [template] // CHECK:STDOUT: %Six: %Six.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 6 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 6 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -54,7 +54,7 @@ fn Six() -> x { return 6; } // CHECK:STDOUT: // CHECK:STDOUT: fn @Six() -> { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_24: i32 = int_value 6 [template = constants.%.1] +// CHECK:STDOUT: %.loc15_24: Core.IntLiteral = int_value 6 [template = constants.%.1] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/no_prelude/import_convert_function.carbon b/toolchain/check/testdata/return/no_prelude/import_convert_function.carbon index 335f987e211a2..b63f62f5d3fb5 100644 --- a/toolchain/check/testdata/return/no_prelude/import_convert_function.carbon +++ b/toolchain/check/testdata/return/no_prelude/import_convert_function.carbon @@ -15,10 +15,16 @@ package Core; fn Int32() -> type = "int.make_type_32"; +fn IntLiteral() -> type = "int_literal.make_type"; + interface ImplicitAs(T:! type) { fn Convert[self: Self]() -> T; } +impl IntLiteral() as ImplicitAs(i32) { + fn Convert[self: Self]() -> i32 = "int.convert_checked"; +} + // --- library.carbon package P library "[[@TEST_NAME]]"; @@ -62,21 +68,32 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: constants { // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] +// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] +// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic] // CHECK:STDOUT: %ImplicitAs.type.1: type = generic_interface_type @ImplicitAs [template] // CHECK:STDOUT: %ImplicitAs: %ImplicitAs.type.1 = struct_value () [template] // CHECK:STDOUT: %ImplicitAs.type.2: type = facet_type <@ImplicitAs, @ImplicitAs(%T)> [symbolic] // CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic] -// CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%T) [symbolic] -// CHECK:STDOUT: %Convert: %Convert.type = struct_value () [symbolic] -// CHECK:STDOUT: %.1: type = assoc_entity_type %ImplicitAs.type.2, %Convert.type [symbolic] +// CHECK:STDOUT: %Convert.type.1: type = fn_type @Convert.1, @ImplicitAs(%T) [symbolic] +// CHECK:STDOUT: %Convert.1: %Convert.type.1 = struct_value () [symbolic] +// CHECK:STDOUT: %.1: type = assoc_entity_type %ImplicitAs.type.2, %Convert.type.1 [symbolic] // CHECK:STDOUT: %.2: %.1 = assoc_entity element0, @ImplicitAs.%Convert.decl [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.3: type = facet_type <@ImplicitAs, @ImplicitAs(i32)> [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.2 [template] +// CHECK:STDOUT: %Convert.2: %Convert.type.2 = struct_value () [template] +// CHECK:STDOUT: %Convert.type.3: type = fn_type @Convert.1, @ImplicitAs(i32) [template] +// CHECK:STDOUT: %Convert.3: %Convert.type.3 = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type %ImplicitAs.type.3, %Convert.type.3 [template] +// CHECK:STDOUT: %.4: %.3 = assoc_entity element0, @ImplicitAs.%Convert.decl [template] +// CHECK:STDOUT: %.5: = interface_witness (%Convert.2) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Int32 = %Int32.decl +// CHECK:STDOUT: .IntLiteral = %IntLiteral.decl // CHECK:STDOUT: .ImplicitAs = %ImplicitAs.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Int32.decl: %Int32.type = fn_decl @Int32 [template = constants.%Int32] { @@ -86,83 +103,147 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: %return.param: ref type = out_param runtime_param0 // CHECK:STDOUT: %return: ref type = return_slot %return.param // CHECK:STDOUT: } +// CHECK:STDOUT: %IntLiteral.decl: %IntLiteral.type = fn_decl @IntLiteral [template = constants.%IntLiteral] { +// CHECK:STDOUT: %return.patt: type = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: type = out_param_pattern %return.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %return.param: ref type = out_param runtime_param0 +// CHECK:STDOUT: %return: ref type = return_slot %return.param +// CHECK:STDOUT: } // CHECK:STDOUT: %ImplicitAs.decl: %ImplicitAs.type.1 = interface_decl @ImplicitAs [template = constants.%ImplicitAs] { -// CHECK:STDOUT: %T.patt.loc7_22.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc7_22.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc7_22.1, runtime_param [symbolic = %T.patt.loc7_22.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.patt.loc9_22.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc9_22.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc9_22.1, runtime_param [symbolic = %T.patt.loc9_22.2 (constants.%T.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %T.param: type = value_param runtime_param -// CHECK:STDOUT: %T.loc7_22.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc7_22.2 (constants.%T)] +// CHECK:STDOUT: %T.loc9_22.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc9_22.2 (constants.%T)] +// CHECK:STDOUT: } +// CHECK:STDOUT: impl_decl @impl [template] {} { +// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, file.%IntLiteral.decl [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc13_17.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc13_17.2: type = converted %int_literal.make_type, %.loc13_17.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %ImplicitAs.ref: %ImplicitAs.type.1 = name_ref ImplicitAs, file.%ImplicitAs.decl [template = constants.%ImplicitAs] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] +// CHECK:STDOUT: %.loc13_32.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc13_32.2: type = converted %int.make_type_32, %.loc13_32.1 [template = i32] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(i32)> [template = constants.%ImplicitAs.type.3] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @ImplicitAs(%T.loc7_22.1: type) { -// CHECK:STDOUT: %T.loc7_22.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc7_22.2 (constants.%T)] -// CHECK:STDOUT: %T.patt.loc7_22.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc7_22.2 (constants.%T.patt)] +// CHECK:STDOUT: generic interface @ImplicitAs(%T.loc9_22.1: type) { +// CHECK:STDOUT: %T.loc9_22.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc9_22.2 (constants.%T)] +// CHECK:STDOUT: %T.patt.loc9_22.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc9_22.2 (constants.%T.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%T.loc7_22.2)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%T.loc9_22.2)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)] // CHECK:STDOUT: %Self.2: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] -// CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%T.loc7_22.2) [symbolic = %Convert.type (constants.%Convert.type)] -// CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type) = struct_value () [symbolic = %Convert (constants.%Convert)] -// CHECK:STDOUT: %.loc8_32.2: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2), @ImplicitAs.%Convert.type (%Convert.type) [symbolic = %.loc8_32.2 (constants.%.1)] -// CHECK:STDOUT: %.loc8_32.3: @ImplicitAs.%.loc8_32.2 (%.1) = assoc_entity element0, %Convert.decl [symbolic = %.loc8_32.3 (constants.%.2)] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.1, @ImplicitAs(%T.loc9_22.2) [symbolic = %Convert.type (constants.%Convert.type.1)] +// CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.1) = struct_value () [symbolic = %Convert (constants.%Convert.1)] +// CHECK:STDOUT: %.loc10_32.2: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2), @ImplicitAs.%Convert.type (%Convert.type.1) [symbolic = %.loc10_32.2 (constants.%.1)] +// CHECK:STDOUT: %.loc10_32.3: @ImplicitAs.%.loc10_32.2 (%.1) = assoc_entity element0, %Convert.decl [symbolic = %.loc10_32.3 (constants.%.2)] // CHECK:STDOUT: // CHECK:STDOUT: interface { // CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] -// CHECK:STDOUT: %Convert.decl: @ImplicitAs.%Convert.type (%Convert.type) = fn_decl @Convert [symbolic = @ImplicitAs.%Convert (constants.%Convert)] { -// CHECK:STDOUT: %self.patt: @Convert.%Self (%Self) = binding_pattern self -// CHECK:STDOUT: %self.param_patt: @Convert.%Self (%Self) = value_param_pattern %self.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: @Convert.%T (%T) = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: @Convert.%T (%T) = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: %Convert.decl: @ImplicitAs.%Convert.type (%Convert.type.1) = fn_decl @Convert.1 [symbolic = @ImplicitAs.%Convert (constants.%Convert.1)] { +// CHECK:STDOUT: %self.patt: @Convert.1.%Self (%Self) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.1.%Self (%Self) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: %return.patt: @Convert.1.%T (%T) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Convert.1.%T (%T) = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc8_20.1: @Convert.%ImplicitAs.type (%ImplicitAs.type.2) = specific_constant @ImplicitAs.%Self.1, @ImplicitAs(constants.%T) [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.ref: @Convert.%ImplicitAs.type (%ImplicitAs.type.2) = name_ref Self, %.loc8_20.1 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %.loc8_20.2: type = facet_type_access %Self.ref [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %.loc8_20.3: type = converted %Self.ref, %.loc8_20.2 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %T.ref: type = name_ref T, @ImplicitAs.%T.loc7_22.1 [symbolic = %T (constants.%T)] -// CHECK:STDOUT: %self.param: @Convert.%Self (%Self) = value_param runtime_param0 -// CHECK:STDOUT: %self: @Convert.%Self (%Self) = bind_name self, %self.param -// CHECK:STDOUT: %return.param: ref @Convert.%T (%T) = out_param runtime_param1 -// CHECK:STDOUT: %return: ref @Convert.%T (%T) = return_slot %return.param +// CHECK:STDOUT: %.loc10_20.1: @Convert.1.%ImplicitAs.type (%ImplicitAs.type.2) = specific_constant @ImplicitAs.%Self.1, @ImplicitAs(constants.%T) [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.ref: @Convert.1.%ImplicitAs.type (%ImplicitAs.type.2) = name_ref Self, %.loc10_20.1 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %.loc10_20.2: type = facet_type_access %Self.ref [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %.loc10_20.3: type = converted %Self.ref, %.loc10_20.2 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %T.ref: type = name_ref T, @ImplicitAs.%T.loc9_22.1 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %self.param: @Convert.1.%Self (%Self) = value_param runtime_param0 +// CHECK:STDOUT: %self: @Convert.1.%Self (%Self) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.1.%T (%T) = out_param runtime_param1 +// CHECK:STDOUT: %return: ref @Convert.1.%T (%T) = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8_32.1: @ImplicitAs.%.loc8_32.2 (%.1) = assoc_entity element0, %Convert.decl [symbolic = %.loc8_32.3 (constants.%.2)] +// CHECK:STDOUT: %.loc10_32.1: @ImplicitAs.%.loc10_32.2 (%.1) = assoc_entity element0, %Convert.decl [symbolic = %.loc10_32.3 (constants.%.2)] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self.1 -// CHECK:STDOUT: .Convert = %.loc8_32.1 +// CHECK:STDOUT: .Convert = %.loc10_32.1 // CHECK:STDOUT: witness = (%Convert.decl) // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: impl @impl: %.loc13_17.2 as %ImplicitAs.type { +// CHECK:STDOUT: %Convert.decl: %Convert.type.2 = fn_decl @Convert.2 [template = constants.%Convert.2] { +// CHECK:STDOUT: %self.patt: Core.IntLiteral = binding_pattern self +// CHECK:STDOUT: %self.param_patt: Core.IntLiteral = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: %return.patt: i32 = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: i32 = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.%.loc13_17.2 [template = Core.IntLiteral] +// CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32] +// CHECK:STDOUT: %.loc14_31.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc14_31.2: type = converted %int.make_type_32, %.loc14_31.1 [template = i32] +// CHECK:STDOUT: %self.param: Core.IntLiteral = value_param runtime_param0 +// CHECK:STDOUT: %self: Core.IntLiteral = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref i32 = out_param runtime_param1 +// CHECK:STDOUT: %return: ref i32 = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %.loc13_38: = interface_witness (%Convert.decl) [template = constants.%.5] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Convert = %Convert.decl +// CHECK:STDOUT: witness = %.loc13_38 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Convert(@ImplicitAs.%T.loc7_22.1: type, @ImplicitAs.%Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2)) { +// CHECK:STDOUT: fn @IntLiteral() -> type = "int_literal.make_type"; +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.1(@ImplicitAs.%T.loc9_22.1: type, @ImplicitAs.%Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2)) { // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] // CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%T)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)] // CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)] // CHECK:STDOUT: -// CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self (%Self)]() -> @Convert.%T (%T); +// CHECK:STDOUT: fn[%self.param_patt: @Convert.1.%Self (%Self)]() -> @Convert.1.%T (%T); // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Convert.2[%self.param_patt: Core.IntLiteral]() -> i32 = "int.convert_checked"; +// CHECK:STDOUT: // CHECK:STDOUT: specific @ImplicitAs(constants.%T) { -// CHECK:STDOUT: %T.loc7_22.2 => constants.%T -// CHECK:STDOUT: %T.patt.loc7_22.2 => constants.%T +// CHECK:STDOUT: %T.loc9_22.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc9_22.2 => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(@Convert.%T) { -// CHECK:STDOUT: %T.loc7_22.2 => constants.%T -// CHECK:STDOUT: %T.patt.loc7_22.2 => constants.%T +// CHECK:STDOUT: specific @ImplicitAs(@Convert.1.%T) { +// CHECK:STDOUT: %T.loc9_22.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc9_22.2 => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Convert(constants.%T, constants.%Self) { +// CHECK:STDOUT: specific @Convert.1(constants.%T, constants.%Self) { // CHECK:STDOUT: %T => constants.%T // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.2 // CHECK:STDOUT: %Self => constants.%Self // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(%T.loc7_22.2) { -// CHECK:STDOUT: %T.loc7_22.2 => constants.%T -// CHECK:STDOUT: %T.patt.loc7_22.2 => constants.%T +// CHECK:STDOUT: specific @ImplicitAs(%T.loc9_22.2) { +// CHECK:STDOUT: %T.loc9_22.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc9_22.2 => constants.%T +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(i32) { +// CHECK:STDOUT: %T.loc9_22.2 => i32 +// CHECK:STDOUT: %T.patt.loc9_22.2 => i32 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3 +// CHECK:STDOUT: %Self.2 => constants.%Self +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.3 +// CHECK:STDOUT: %Convert => constants.%Convert.3 +// CHECK:STDOUT: %.loc10_32.2 => constants.%.3 +// CHECK:STDOUT: %.loc10_32.3 => constants.%.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.1(i32, Core.IntLiteral) { +// CHECK:STDOUT: %T => i32 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3 +// CHECK:STDOUT: %Self => Core.IntLiteral // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- library.carbon @@ -183,9 +264,8 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: %.5: = complete_type_witness %.4 [template] // CHECK:STDOUT: %Make.type: type = fn_type @Make [template] // CHECK:STDOUT: %Make: %Make.type = struct_value () [template] -// CHECK:STDOUT: %.7: i32 = int_value 0 [template] -// CHECK:STDOUT: %struct: %D = struct_value (%.7, %.7) [template] -// CHECK:STDOUT: %C.3: type = class_type @C, @C(%.7) [template] +// CHECK:STDOUT: %.7: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %.8: type = struct_type {.n: Core.IntLiteral, .m: Core.IntLiteral} [template] // CHECK:STDOUT: %ImplicitAs.type.1: type = generic_interface_type @ImplicitAs [template] // CHECK:STDOUT: %ImplicitAs: %ImplicitAs.type.1 = struct_value () [template] // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] @@ -195,51 +275,78 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: %Self.2: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic] // CHECK:STDOUT: %Convert.type.1: type = fn_type @Convert.1, @ImplicitAs(%T) [symbolic] // CHECK:STDOUT: %Convert.1: %Convert.type.1 = struct_value () [symbolic] -// CHECK:STDOUT: %.8: type = assoc_entity_type %ImplicitAs.type.2, %Convert.type.1 [symbolic] -// CHECK:STDOUT: %.9: %.8 = assoc_entity element0, imports.%import_ref.6 [symbolic] -// CHECK:STDOUT: %ImplicitAs.type.3: type = facet_type <@ImplicitAs, @ImplicitAs(%D)> [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.2 [template] +// CHECK:STDOUT: %.9: type = assoc_entity_type %ImplicitAs.type.2, %Convert.type.1 [symbolic] +// CHECK:STDOUT: %.10: %.9 = assoc_entity element0, imports.%import_ref.6 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.3: type = facet_type <@ImplicitAs, @ImplicitAs(i32)> [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(i32) [template] // CHECK:STDOUT: %Convert.2: %Convert.type.2 = struct_value () [template] -// CHECK:STDOUT: %Convert.type.3: type = fn_type @Convert.1, @ImplicitAs(%D) [template] +// CHECK:STDOUT: %.11: type = assoc_entity_type %ImplicitAs.type.3, %Convert.type.2 [template] +// CHECK:STDOUT: %.12: %.11 = assoc_entity element0, imports.%import_ref.6 [template] +// CHECK:STDOUT: %.13: %.9 = assoc_entity element0, imports.%import_ref.7 [symbolic] +// CHECK:STDOUT: %Convert.type.3: type = fn_type @Convert.2 [template] // CHECK:STDOUT: %Convert.3: %Convert.type.3 = struct_value () [template] -// CHECK:STDOUT: %.10: type = assoc_entity_type %ImplicitAs.type.3, %Convert.type.3 [template] -// CHECK:STDOUT: %.11: %.10 = assoc_entity element0, imports.%import_ref.6 [template] -// CHECK:STDOUT: %.12: = interface_witness (%Convert.2) [template] -// CHECK:STDOUT: %.14: i32 = int_value 1 [template] -// CHECK:STDOUT: %C.4: type = class_type @C, @C(%.14) [template] +// CHECK:STDOUT: %.14: = interface_witness (%Convert.3) [template] +// CHECK:STDOUT: %.15: = bound_method %.7, %Convert.3 [template] +// CHECK:STDOUT: %.16: i32 = int_value 0 [template] +// CHECK:STDOUT: %struct: %D = struct_value (%.16, %.16) [template] +// CHECK:STDOUT: %C.3: type = class_type @C, @C(%.16) [template] +// CHECK:STDOUT: %ImplicitAs.type.4: type = facet_type <@ImplicitAs, @ImplicitAs(%D)> [template] // CHECK:STDOUT: %Convert.type.4: type = fn_type @Convert.3 [template] // CHECK:STDOUT: %Convert.4: %Convert.type.4 = struct_value () [template] -// CHECK:STDOUT: %.15: = interface_witness (%Convert.4) [template] -// CHECK:STDOUT: %.16: i32 = int_value 2 [template] -// CHECK:STDOUT: %C.5: type = class_type @C, @C(%.16) [template] -// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.4 [template] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @ImplicitAs(%D) [template] // CHECK:STDOUT: %Convert.5: %Convert.type.5 = struct_value () [template] -// CHECK:STDOUT: %.17: = interface_witness (%Convert.5) [template] -// CHECK:STDOUT: %.18: i32 = int_value 3 [template] -// CHECK:STDOUT: %C.6: type = class_type @C, @C(%.18) [template] -// CHECK:STDOUT: %Convert.type.6: type = fn_type @Convert.5 [template] +// CHECK:STDOUT: %.17: type = assoc_entity_type %ImplicitAs.type.4, %Convert.type.5 [template] +// CHECK:STDOUT: %.18: %.17 = assoc_entity element0, imports.%import_ref.6 [template] +// CHECK:STDOUT: %.19: = interface_witness (%Convert.4) [template] +// CHECK:STDOUT: %.21: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.22: = bound_method %.21, %Convert.3 [template] +// CHECK:STDOUT: %.23: i32 = int_value 1 [template] +// CHECK:STDOUT: %C.4: type = class_type @C, @C(%.23) [template] +// CHECK:STDOUT: %Convert.type.6: type = fn_type @Convert.4 [template] // CHECK:STDOUT: %Convert.6: %Convert.type.6 = struct_value () [template] -// CHECK:STDOUT: %.19: = interface_witness (%Convert.6) [template] -// CHECK:STDOUT: %.20: i32 = int_value 4 [template] -// CHECK:STDOUT: %C.7: type = class_type @C, @C(%.20) [template] -// CHECK:STDOUT: %Convert.type.7: type = fn_type @Convert.6 [template] +// CHECK:STDOUT: %.24: = interface_witness (%Convert.6) [template] +// CHECK:STDOUT: %.25: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.26: = bound_method %.25, %Convert.3 [template] +// CHECK:STDOUT: %.27: i32 = int_value 2 [template] +// CHECK:STDOUT: %C.5: type = class_type @C, @C(%.27) [template] +// CHECK:STDOUT: %Convert.type.7: type = fn_type @Convert.5 [template] // CHECK:STDOUT: %Convert.7: %Convert.type.7 = struct_value () [template] -// CHECK:STDOUT: %.21: = interface_witness (%Convert.7) [template] -// CHECK:STDOUT: %.22: i32 = int_value 5 [template] -// CHECK:STDOUT: %C.8: type = class_type @C, @C(%.22) [template] -// CHECK:STDOUT: %Convert.type.8: type = fn_type @Convert.7 [template] +// CHECK:STDOUT: %.28: = interface_witness (%Convert.7) [template] +// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.30: = bound_method %.29, %Convert.3 [template] +// CHECK:STDOUT: %.31: i32 = int_value 3 [template] +// CHECK:STDOUT: %C.6: type = class_type @C, @C(%.31) [template] +// CHECK:STDOUT: %Convert.type.8: type = fn_type @Convert.6 [template] // CHECK:STDOUT: %Convert.8: %Convert.type.8 = struct_value () [template] -// CHECK:STDOUT: %.23: = interface_witness (%Convert.8) [template] -// CHECK:STDOUT: %.24: i32 = int_value 6 [template] -// CHECK:STDOUT: %C.9: type = class_type @C, @C(%.24) [template] -// CHECK:STDOUT: %Convert.type.9: type = fn_type @Convert.8 [template] +// CHECK:STDOUT: %.32: = interface_witness (%Convert.8) [template] +// CHECK:STDOUT: %.33: Core.IntLiteral = int_value 4 [template] +// CHECK:STDOUT: %.34: = bound_method %.33, %Convert.3 [template] +// CHECK:STDOUT: %.35: i32 = int_value 4 [template] +// CHECK:STDOUT: %C.7: type = class_type @C, @C(%.35) [template] +// CHECK:STDOUT: %Convert.type.9: type = fn_type @Convert.7 [template] // CHECK:STDOUT: %Convert.9: %Convert.type.9 = struct_value () [template] -// CHECK:STDOUT: %.25: = interface_witness (%Convert.9) [template] -// CHECK:STDOUT: %.26: i32 = int_value 7 [template] -// CHECK:STDOUT: %C.10: type = class_type @C, @C(%.26) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.9 [template] +// CHECK:STDOUT: %.36: = interface_witness (%Convert.9) [template] +// CHECK:STDOUT: %.37: Core.IntLiteral = int_value 5 [template] +// CHECK:STDOUT: %.38: = bound_method %.37, %Convert.3 [template] +// CHECK:STDOUT: %.39: i32 = int_value 5 [template] +// CHECK:STDOUT: %C.8: type = class_type @C, @C(%.39) [template] +// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.8 [template] // CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %.27: = interface_witness (%Convert.10) [template] +// CHECK:STDOUT: %.40: = interface_witness (%Convert.10) [template] +// CHECK:STDOUT: %.41: Core.IntLiteral = int_value 6 [template] +// CHECK:STDOUT: %.42: = bound_method %.41, %Convert.3 [template] +// CHECK:STDOUT: %.43: i32 = int_value 6 [template] +// CHECK:STDOUT: %C.9: type = class_type @C, @C(%.43) [template] +// CHECK:STDOUT: %Convert.type.11: type = fn_type @Convert.9 [template] +// CHECK:STDOUT: %Convert.11: %Convert.type.11 = struct_value () [template] +// CHECK:STDOUT: %.44: = interface_witness (%Convert.11) [template] +// CHECK:STDOUT: %.45: Core.IntLiteral = int_value 7 [template] +// CHECK:STDOUT: %.46: = bound_method %.45, %Convert.3 [template] +// CHECK:STDOUT: %.47: i32 = int_value 7 [template] +// CHECK:STDOUT: %C.10: type = class_type @C, @C(%.47) [template] +// CHECK:STDOUT: %Convert.type.12: type = fn_type @Convert.10 [template] +// CHECK:STDOUT: %Convert.12: %Convert.type.12 = struct_value () [template] +// CHECK:STDOUT: %.48: = interface_witness (%Convert.12) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -248,11 +355,14 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//default // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.2: %ImplicitAs.type.1 = import_ref Core//default, inst+15, loaded [template = constants.%ImplicitAs] -// CHECK:STDOUT: %import_ref.3 = import_ref Core//default, inst+21, unloaded -// CHECK:STDOUT: %import_ref.4 = import_ref Core//default, inst+43, unloaded -// CHECK:STDOUT: %import_ref.5: @ImplicitAs.%Convert.type (%Convert.type.1) = import_ref Core//default, inst+36, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.1)] -// CHECK:STDOUT: %import_ref.6 = import_ref Core//default, inst+36, unloaded +// CHECK:STDOUT: %import_ref.2: %ImplicitAs.type.1 = import_ref Core//default, inst+22, loaded [template = constants.%ImplicitAs] +// CHECK:STDOUT: %import_ref.3 = import_ref Core//default, inst+28, unloaded +// CHECK:STDOUT: %import_ref.4: @ImplicitAs.%.1 (%.9) = import_ref Core//default, inst+50, loaded [symbolic = @ImplicitAs.%.2 (constants.%.13)] +// CHECK:STDOUT: %import_ref.5: @ImplicitAs.%Convert.type (%Convert.type.1) = import_ref Core//default, inst+43, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.1)] +// CHECK:STDOUT: %import_ref.6 = import_ref Core//default, inst+43, unloaded +// CHECK:STDOUT: %import_ref.8: type = import_ref Core//default, inst+61, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.9: type = import_ref Core//default, inst+66, loaded [template = constants.%ImplicitAs.type.3] +// CHECK:STDOUT: %import_ref.10: = import_ref Core//default, inst+88, loaded [template = constants.%.14] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -282,77 +392,117 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: %return.param: ref %D = out_param runtime_param0 // CHECK:STDOUT: %return: ref %D = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: impl_decl @impl.1 [template] {} { -// CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [template = constants.%C.1] -// CHECK:STDOUT: %.loc10_8: i32 = int_value 0 [template = constants.%.7] -// CHECK:STDOUT: %C: type = class_type @C, @C(constants.%.7) [template = constants.%C.3] -// CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] -// CHECK:STDOUT: %ImplicitAs.ref: %ImplicitAs.type.1 = name_ref ImplicitAs, imports.%import_ref.2 [template = constants.%ImplicitAs] -// CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [template = constants.%D] -// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(constants.%D)> [template = constants.%ImplicitAs.type.3] -// CHECK:STDOUT: } // CHECK:STDOUT: impl_decl @impl.2 [template] {} { // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [template = constants.%C.1] -// CHECK:STDOUT: %.loc11_8: i32 = int_value 1 [template = constants.%.14] -// CHECK:STDOUT: %C: type = class_type @C, @C(constants.%.14) [template = constants.%C.4] +// CHECK:STDOUT: %.loc10_8: Core.IntLiteral = int_value 0 [template = constants.%.7] +// CHECK:STDOUT: %.loc10_7.1: %Convert.type.2 = interface_witness_access constants.%.14, element0 [template = constants.%Convert.3] +// CHECK:STDOUT: %.loc10_7.2: = bound_method %.loc10_8, %.loc10_7.1 [template = constants.%.15] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc10_7.2(%.loc10_8) [template = constants.%.16] +// CHECK:STDOUT: %.loc10_7.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.16] +// CHECK:STDOUT: %.loc10_7.4: i32 = converted %.loc10_8, %.loc10_7.3 [template = constants.%.16] +// CHECK:STDOUT: %C: type = class_type @C, @C(constants.%.16) [template = constants.%C.3] // CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] // CHECK:STDOUT: %ImplicitAs.ref: %ImplicitAs.type.1 = name_ref ImplicitAs, imports.%import_ref.2 [template = constants.%ImplicitAs] // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [template = constants.%D] -// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(constants.%D)> [template = constants.%ImplicitAs.type.3] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(constants.%D)> [template = constants.%ImplicitAs.type.4] // CHECK:STDOUT: } // CHECK:STDOUT: impl_decl @impl.3 [template] {} { // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [template = constants.%C.1] -// CHECK:STDOUT: %.loc12_8: i32 = int_value 2 [template = constants.%.16] -// CHECK:STDOUT: %C: type = class_type @C, @C(constants.%.16) [template = constants.%C.5] +// CHECK:STDOUT: %.loc11_8: Core.IntLiteral = int_value 1 [template = constants.%.21] +// CHECK:STDOUT: %.loc11_7.1: %Convert.type.2 = interface_witness_access constants.%.14, element0 [template = constants.%Convert.3] +// CHECK:STDOUT: %.loc11_7.2: = bound_method %.loc11_8, %.loc11_7.1 [template = constants.%.22] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc11_7.2(%.loc11_8) [template = constants.%.23] +// CHECK:STDOUT: %.loc11_7.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.23] +// CHECK:STDOUT: %.loc11_7.4: i32 = converted %.loc11_8, %.loc11_7.3 [template = constants.%.23] +// CHECK:STDOUT: %C: type = class_type @C, @C(constants.%.23) [template = constants.%C.4] // CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] // CHECK:STDOUT: %ImplicitAs.ref: %ImplicitAs.type.1 = name_ref ImplicitAs, imports.%import_ref.2 [template = constants.%ImplicitAs] // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [template = constants.%D] -// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(constants.%D)> [template = constants.%ImplicitAs.type.3] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(constants.%D)> [template = constants.%ImplicitAs.type.4] // CHECK:STDOUT: } // CHECK:STDOUT: impl_decl @impl.4 [template] {} { // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [template = constants.%C.1] -// CHECK:STDOUT: %.loc13_8: i32 = int_value 3 [template = constants.%.18] -// CHECK:STDOUT: %C: type = class_type @C, @C(constants.%.18) [template = constants.%C.6] +// CHECK:STDOUT: %.loc12_8: Core.IntLiteral = int_value 2 [template = constants.%.25] +// CHECK:STDOUT: %.loc12_7.1: %Convert.type.2 = interface_witness_access constants.%.14, element0 [template = constants.%Convert.3] +// CHECK:STDOUT: %.loc12_7.2: = bound_method %.loc12_8, %.loc12_7.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc12_7.2(%.loc12_8) [template = constants.%.27] +// CHECK:STDOUT: %.loc12_7.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc12_7.4: i32 = converted %.loc12_8, %.loc12_7.3 [template = constants.%.27] +// CHECK:STDOUT: %C: type = class_type @C, @C(constants.%.27) [template = constants.%C.5] // CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] // CHECK:STDOUT: %ImplicitAs.ref: %ImplicitAs.type.1 = name_ref ImplicitAs, imports.%import_ref.2 [template = constants.%ImplicitAs] // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [template = constants.%D] -// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(constants.%D)> [template = constants.%ImplicitAs.type.3] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(constants.%D)> [template = constants.%ImplicitAs.type.4] // CHECK:STDOUT: } // CHECK:STDOUT: impl_decl @impl.5 [template] {} { // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [template = constants.%C.1] -// CHECK:STDOUT: %.loc14_8: i32 = int_value 4 [template = constants.%.20] -// CHECK:STDOUT: %C: type = class_type @C, @C(constants.%.20) [template = constants.%C.7] +// CHECK:STDOUT: %.loc13_8: Core.IntLiteral = int_value 3 [template = constants.%.29] +// CHECK:STDOUT: %.loc13_7.1: %Convert.type.2 = interface_witness_access constants.%.14, element0 [template = constants.%Convert.3] +// CHECK:STDOUT: %.loc13_7.2: = bound_method %.loc13_8, %.loc13_7.1 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc13_7.2(%.loc13_8) [template = constants.%.31] +// CHECK:STDOUT: %.loc13_7.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.31] +// CHECK:STDOUT: %.loc13_7.4: i32 = converted %.loc13_8, %.loc13_7.3 [template = constants.%.31] +// CHECK:STDOUT: %C: type = class_type @C, @C(constants.%.31) [template = constants.%C.6] // CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] // CHECK:STDOUT: %ImplicitAs.ref: %ImplicitAs.type.1 = name_ref ImplicitAs, imports.%import_ref.2 [template = constants.%ImplicitAs] // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [template = constants.%D] -// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(constants.%D)> [template = constants.%ImplicitAs.type.3] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(constants.%D)> [template = constants.%ImplicitAs.type.4] // CHECK:STDOUT: } // CHECK:STDOUT: impl_decl @impl.6 [template] {} { // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [template = constants.%C.1] -// CHECK:STDOUT: %.loc15_8: i32 = int_value 5 [template = constants.%.22] -// CHECK:STDOUT: %C: type = class_type @C, @C(constants.%.22) [template = constants.%C.8] +// CHECK:STDOUT: %.loc14_8: Core.IntLiteral = int_value 4 [template = constants.%.33] +// CHECK:STDOUT: %.loc14_7.1: %Convert.type.2 = interface_witness_access constants.%.14, element0 [template = constants.%Convert.3] +// CHECK:STDOUT: %.loc14_7.2: = bound_method %.loc14_8, %.loc14_7.1 [template = constants.%.34] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc14_7.2(%.loc14_8) [template = constants.%.35] +// CHECK:STDOUT: %.loc14_7.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.35] +// CHECK:STDOUT: %.loc14_7.4: i32 = converted %.loc14_8, %.loc14_7.3 [template = constants.%.35] +// CHECK:STDOUT: %C: type = class_type @C, @C(constants.%.35) [template = constants.%C.7] // CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] // CHECK:STDOUT: %ImplicitAs.ref: %ImplicitAs.type.1 = name_ref ImplicitAs, imports.%import_ref.2 [template = constants.%ImplicitAs] // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [template = constants.%D] -// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(constants.%D)> [template = constants.%ImplicitAs.type.3] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(constants.%D)> [template = constants.%ImplicitAs.type.4] // CHECK:STDOUT: } // CHECK:STDOUT: impl_decl @impl.7 [template] {} { // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [template = constants.%C.1] -// CHECK:STDOUT: %.loc16_8: i32 = int_value 6 [template = constants.%.24] -// CHECK:STDOUT: %C: type = class_type @C, @C(constants.%.24) [template = constants.%C.9] +// CHECK:STDOUT: %.loc15_8: Core.IntLiteral = int_value 5 [template = constants.%.37] +// CHECK:STDOUT: %.loc15_7.1: %Convert.type.2 = interface_witness_access constants.%.14, element0 [template = constants.%Convert.3] +// CHECK:STDOUT: %.loc15_7.2: = bound_method %.loc15_8, %.loc15_7.1 [template = constants.%.38] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc15_7.2(%.loc15_8) [template = constants.%.39] +// CHECK:STDOUT: %.loc15_7.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.39] +// CHECK:STDOUT: %.loc15_7.4: i32 = converted %.loc15_8, %.loc15_7.3 [template = constants.%.39] +// CHECK:STDOUT: %C: type = class_type @C, @C(constants.%.39) [template = constants.%C.8] // CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] // CHECK:STDOUT: %ImplicitAs.ref: %ImplicitAs.type.1 = name_ref ImplicitAs, imports.%import_ref.2 [template = constants.%ImplicitAs] // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [template = constants.%D] -// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(constants.%D)> [template = constants.%ImplicitAs.type.3] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(constants.%D)> [template = constants.%ImplicitAs.type.4] // CHECK:STDOUT: } // CHECK:STDOUT: impl_decl @impl.8 [template] {} { // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [template = constants.%C.1] -// CHECK:STDOUT: %.loc17_8: i32 = int_value 7 [template = constants.%.26] -// CHECK:STDOUT: %C: type = class_type @C, @C(constants.%.26) [template = constants.%C.10] +// CHECK:STDOUT: %.loc16_8: Core.IntLiteral = int_value 6 [template = constants.%.41] +// CHECK:STDOUT: %.loc16_7.1: %Convert.type.2 = interface_witness_access constants.%.14, element0 [template = constants.%Convert.3] +// CHECK:STDOUT: %.loc16_7.2: = bound_method %.loc16_8, %.loc16_7.1 [template = constants.%.42] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc16_7.2(%.loc16_8) [template = constants.%.43] +// CHECK:STDOUT: %.loc16_7.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.43] +// CHECK:STDOUT: %.loc16_7.4: i32 = converted %.loc16_8, %.loc16_7.3 [template = constants.%.43] +// CHECK:STDOUT: %C: type = class_type @C, @C(constants.%.43) [template = constants.%C.9] +// CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %ImplicitAs.ref: %ImplicitAs.type.1 = name_ref ImplicitAs, imports.%import_ref.2 [template = constants.%ImplicitAs] +// CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [template = constants.%D] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(constants.%D)> [template = constants.%ImplicitAs.type.4] +// CHECK:STDOUT: } +// CHECK:STDOUT: impl_decl @impl.9 [template] {} { +// CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [template = constants.%C.1] +// CHECK:STDOUT: %.loc17_8: Core.IntLiteral = int_value 7 [template = constants.%.45] +// CHECK:STDOUT: %.loc17_7.1: %Convert.type.2 = interface_witness_access constants.%.14, element0 [template = constants.%Convert.3] +// CHECK:STDOUT: %.loc17_7.2: = bound_method %.loc17_8, %.loc17_7.1 [template = constants.%.46] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc17_7.2(%.loc17_8) [template = constants.%.47] +// CHECK:STDOUT: %.loc17_7.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.47] +// CHECK:STDOUT: %.loc17_7.4: i32 = converted %.loc17_8, %.loc17_7.3 [template = constants.%.47] +// CHECK:STDOUT: %C: type = class_type @C, @C(constants.%.47) [template = constants.%C.10] // CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] // CHECK:STDOUT: %ImplicitAs.ref: %ImplicitAs.type.1 = name_ref ImplicitAs, imports.%import_ref.2 [template = constants.%ImplicitAs] // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [template = constants.%D] -// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(constants.%D)> [template = constants.%ImplicitAs.type.3] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(constants.%D)> [template = constants.%ImplicitAs.type.4] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -365,8 +515,8 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)] // CHECK:STDOUT: %Convert.type: type = fn_type @Convert.1, @ImplicitAs(%T) [symbolic = %Convert.type (constants.%Convert.type.1)] // CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.1) = struct_value () [symbolic = %Convert (constants.%Convert.1)] -// CHECK:STDOUT: %.1: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2), @ImplicitAs.%Convert.type (%Convert.type.1) [symbolic = %.1 (constants.%.8)] -// CHECK:STDOUT: %.2: @ImplicitAs.%.1 (%.8) = assoc_entity element0, imports.%import_ref.6 [symbolic = %.2 (constants.%.9)] +// CHECK:STDOUT: %.1: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2), @ImplicitAs.%Convert.type (%Convert.type.1) [symbolic = %.1 (constants.%.9)] +// CHECK:STDOUT: %.2: @ImplicitAs.%.1 (%.9) = assoc_entity element0, imports.%import_ref.6 [symbolic = %.2 (constants.%.10)] // CHECK:STDOUT: // CHECK:STDOUT: interface { // CHECK:STDOUT: !members: @@ -376,168 +526,173 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl.1: %C as %ImplicitAs.type { -// CHECK:STDOUT: %Convert.decl: %Convert.type.2 = fn_decl @Convert.2 [template = constants.%Convert.2] { +// CHECK:STDOUT: impl @impl.1: imports.%import_ref.8 as imports.%import_ref.9 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.10 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.2: %C as %ImplicitAs.type { +// CHECK:STDOUT: %Convert.decl: %Convert.type.4 = fn_decl @Convert.3 [template = constants.%Convert.4] { // CHECK:STDOUT: %self.patt: %C.3 = binding_pattern self // CHECK:STDOUT: %self.param_patt: %C.3 = value_param_pattern %self.patt, runtime_param0 // CHECK:STDOUT: %return.patt: %D = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %D = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { -// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.1.%C [template = constants.%C.3] +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.2.%C [template = constants.%C.3] // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [template = constants.%D] // CHECK:STDOUT: %self.param: %C.3 = value_param runtime_param0 // CHECK:STDOUT: %self: %C.3 = bind_name self, %self.param // CHECK:STDOUT: %return.param: ref %D = out_param runtime_param1 // CHECK:STDOUT: %return: ref %D = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc10_33: = interface_witness (%Convert.decl) [template = constants.%.12] +// CHECK:STDOUT: %.loc10_33: = interface_witness (%Convert.decl) [template = constants.%.19] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Convert = %Convert.decl // CHECK:STDOUT: witness = %.loc10_33 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl.2: %C as %ImplicitAs.type { -// CHECK:STDOUT: %Convert.decl: %Convert.type.4 = fn_decl @Convert.3 [template = constants.%Convert.4] { +// CHECK:STDOUT: impl @impl.3: %C as %ImplicitAs.type { +// CHECK:STDOUT: %Convert.decl: %Convert.type.6 = fn_decl @Convert.4 [template = constants.%Convert.6] { // CHECK:STDOUT: %self.patt: %C.4 = binding_pattern self // CHECK:STDOUT: %self.param_patt: %C.4 = value_param_pattern %self.patt, runtime_param0 // CHECK:STDOUT: %return.patt: %D = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %D = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { -// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.2.%C [template = constants.%C.4] +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.3.%C [template = constants.%C.4] // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [template = constants.%D] // CHECK:STDOUT: %self.param: %C.4 = value_param runtime_param0 // CHECK:STDOUT: %self: %C.4 = bind_name self, %self.param // CHECK:STDOUT: %return.param: ref %D = out_param runtime_param1 // CHECK:STDOUT: %return: ref %D = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc11_33: = interface_witness (%Convert.decl) [template = constants.%.15] +// CHECK:STDOUT: %.loc11_33: = interface_witness (%Convert.decl) [template = constants.%.24] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Convert = %Convert.decl // CHECK:STDOUT: witness = %.loc11_33 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl.3: %C as %ImplicitAs.type { -// CHECK:STDOUT: %Convert.decl: %Convert.type.5 = fn_decl @Convert.4 [template = constants.%Convert.5] { +// CHECK:STDOUT: impl @impl.4: %C as %ImplicitAs.type { +// CHECK:STDOUT: %Convert.decl: %Convert.type.7 = fn_decl @Convert.5 [template = constants.%Convert.7] { // CHECK:STDOUT: %self.patt: %C.5 = binding_pattern self // CHECK:STDOUT: %self.param_patt: %C.5 = value_param_pattern %self.patt, runtime_param0 // CHECK:STDOUT: %return.patt: %D = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %D = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { -// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.3.%C [template = constants.%C.5] +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.4.%C [template = constants.%C.5] // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [template = constants.%D] // CHECK:STDOUT: %self.param: %C.5 = value_param runtime_param0 // CHECK:STDOUT: %self: %C.5 = bind_name self, %self.param // CHECK:STDOUT: %return.param: ref %D = out_param runtime_param1 // CHECK:STDOUT: %return: ref %D = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc12_33: = interface_witness (%Convert.decl) [template = constants.%.17] +// CHECK:STDOUT: %.loc12_33: = interface_witness (%Convert.decl) [template = constants.%.28] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Convert = %Convert.decl // CHECK:STDOUT: witness = %.loc12_33 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl.4: %C as %ImplicitAs.type { -// CHECK:STDOUT: %Convert.decl: %Convert.type.6 = fn_decl @Convert.5 [template = constants.%Convert.6] { +// CHECK:STDOUT: impl @impl.5: %C as %ImplicitAs.type { +// CHECK:STDOUT: %Convert.decl: %Convert.type.8 = fn_decl @Convert.6 [template = constants.%Convert.8] { // CHECK:STDOUT: %self.patt: %C.6 = binding_pattern self // CHECK:STDOUT: %self.param_patt: %C.6 = value_param_pattern %self.patt, runtime_param0 // CHECK:STDOUT: %return.patt: %D = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %D = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { -// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.4.%C [template = constants.%C.6] +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.5.%C [template = constants.%C.6] // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [template = constants.%D] // CHECK:STDOUT: %self.param: %C.6 = value_param runtime_param0 // CHECK:STDOUT: %self: %C.6 = bind_name self, %self.param // CHECK:STDOUT: %return.param: ref %D = out_param runtime_param1 // CHECK:STDOUT: %return: ref %D = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc13_33: = interface_witness (%Convert.decl) [template = constants.%.19] +// CHECK:STDOUT: %.loc13_33: = interface_witness (%Convert.decl) [template = constants.%.32] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Convert = %Convert.decl // CHECK:STDOUT: witness = %.loc13_33 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl.5: %C as %ImplicitAs.type { -// CHECK:STDOUT: %Convert.decl: %Convert.type.7 = fn_decl @Convert.6 [template = constants.%Convert.7] { +// CHECK:STDOUT: impl @impl.6: %C as %ImplicitAs.type { +// CHECK:STDOUT: %Convert.decl: %Convert.type.9 = fn_decl @Convert.7 [template = constants.%Convert.9] { // CHECK:STDOUT: %self.patt: %C.7 = binding_pattern self // CHECK:STDOUT: %self.param_patt: %C.7 = value_param_pattern %self.patt, runtime_param0 // CHECK:STDOUT: %return.patt: %D = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %D = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { -// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.5.%C [template = constants.%C.7] +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.6.%C [template = constants.%C.7] // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [template = constants.%D] // CHECK:STDOUT: %self.param: %C.7 = value_param runtime_param0 // CHECK:STDOUT: %self: %C.7 = bind_name self, %self.param // CHECK:STDOUT: %return.param: ref %D = out_param runtime_param1 // CHECK:STDOUT: %return: ref %D = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc14_33: = interface_witness (%Convert.decl) [template = constants.%.21] +// CHECK:STDOUT: %.loc14_33: = interface_witness (%Convert.decl) [template = constants.%.36] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Convert = %Convert.decl // CHECK:STDOUT: witness = %.loc14_33 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl.6: %C as %ImplicitAs.type { -// CHECK:STDOUT: %Convert.decl: %Convert.type.8 = fn_decl @Convert.7 [template = constants.%Convert.8] { +// CHECK:STDOUT: impl @impl.7: %C as %ImplicitAs.type { +// CHECK:STDOUT: %Convert.decl: %Convert.type.10 = fn_decl @Convert.8 [template = constants.%Convert.10] { // CHECK:STDOUT: %self.patt: %C.8 = binding_pattern self // CHECK:STDOUT: %self.param_patt: %C.8 = value_param_pattern %self.patt, runtime_param0 // CHECK:STDOUT: %return.patt: %D = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %D = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { -// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.6.%C [template = constants.%C.8] +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.7.%C [template = constants.%C.8] // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [template = constants.%D] // CHECK:STDOUT: %self.param: %C.8 = value_param runtime_param0 // CHECK:STDOUT: %self: %C.8 = bind_name self, %self.param // CHECK:STDOUT: %return.param: ref %D = out_param runtime_param1 // CHECK:STDOUT: %return: ref %D = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc15_33: = interface_witness (%Convert.decl) [template = constants.%.23] +// CHECK:STDOUT: %.loc15_33: = interface_witness (%Convert.decl) [template = constants.%.40] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Convert = %Convert.decl // CHECK:STDOUT: witness = %.loc15_33 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl.7: %C as %ImplicitAs.type { -// CHECK:STDOUT: %Convert.decl: %Convert.type.9 = fn_decl @Convert.8 [template = constants.%Convert.9] { +// CHECK:STDOUT: impl @impl.8: %C as %ImplicitAs.type { +// CHECK:STDOUT: %Convert.decl: %Convert.type.11 = fn_decl @Convert.9 [template = constants.%Convert.11] { // CHECK:STDOUT: %self.patt: %C.9 = binding_pattern self // CHECK:STDOUT: %self.param_patt: %C.9 = value_param_pattern %self.patt, runtime_param0 // CHECK:STDOUT: %return.patt: %D = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %D = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { -// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.7.%C [template = constants.%C.9] +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.8.%C [template = constants.%C.9] // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [template = constants.%D] // CHECK:STDOUT: %self.param: %C.9 = value_param runtime_param0 // CHECK:STDOUT: %self: %C.9 = bind_name self, %self.param // CHECK:STDOUT: %return.param: ref %D = out_param runtime_param1 // CHECK:STDOUT: %return: ref %D = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc16_33: = interface_witness (%Convert.decl) [template = constants.%.25] +// CHECK:STDOUT: %.loc16_33: = interface_witness (%Convert.decl) [template = constants.%.44] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Convert = %Convert.decl // CHECK:STDOUT: witness = %.loc16_33 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl.8: %C as %ImplicitAs.type { -// CHECK:STDOUT: %Convert.decl: %Convert.type.10 = fn_decl @Convert.9 [template = constants.%Convert.10] { +// CHECK:STDOUT: impl @impl.9: %C as %ImplicitAs.type { +// CHECK:STDOUT: %Convert.decl: %Convert.type.12 = fn_decl @Convert.10 [template = constants.%Convert.12] { // CHECK:STDOUT: %self.patt: %C.10 = binding_pattern self // CHECK:STDOUT: %self.param_patt: %C.10 = value_param_pattern %self.patt, runtime_param0 // CHECK:STDOUT: %return.patt: %D = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %D = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { -// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.8.%C [template = constants.%C.10] +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.9.%C [template = constants.%C.10] // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [template = constants.%D] // CHECK:STDOUT: %self.param: %C.10 = value_param runtime_param0 // CHECK:STDOUT: %self: %C.10 = bind_name self, %self.param // CHECK:STDOUT: %return.param: ref %D = out_param runtime_param1 // CHECK:STDOUT: %return: ref %D = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc17_33: = interface_witness (%Convert.decl) [template = constants.%.27] +// CHECK:STDOUT: %.loc17_33: = interface_witness (%Convert.decl) [template = constants.%.48] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Convert = %Convert.decl @@ -579,15 +734,23 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: // CHECK:STDOUT: fn @Make() -> %return: %D { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8_31: i32 = int_value 0 [template = constants.%.7] -// CHECK:STDOUT: %.loc8_39: i32 = int_value 0 [template = constants.%.7] -// CHECK:STDOUT: %.loc8_40.1: %.4 = struct_literal (%.loc8_31, %.loc8_39) -// CHECK:STDOUT: %.loc8_40.2: ref i32 = class_element_access %return, element0 -// CHECK:STDOUT: %.loc8_40.3: init i32 = initialize_from %.loc8_31 to %.loc8_40.2 [template = constants.%.7] -// CHECK:STDOUT: %.loc8_40.4: ref i32 = class_element_access %return, element1 -// CHECK:STDOUT: %.loc8_40.5: init i32 = initialize_from %.loc8_39 to %.loc8_40.4 [template = constants.%.7] -// CHECK:STDOUT: %.loc8_40.6: init %D = class_init (%.loc8_40.3, %.loc8_40.5), %return [template = constants.%struct] -// CHECK:STDOUT: %.loc8_41: init %D = converted %.loc8_40.1, %.loc8_40.6 [template = constants.%struct] +// CHECK:STDOUT: %.loc8_31: Core.IntLiteral = int_value 0 [template = constants.%.7] +// CHECK:STDOUT: %.loc8_39: Core.IntLiteral = int_value 0 [template = constants.%.7] +// CHECK:STDOUT: %.loc8_40.1: %.8 = struct_literal (%.loc8_31, %.loc8_39) +// CHECK:STDOUT: %.loc8_40.2: %Convert.type.2 = interface_witness_access constants.%.14, element0 [template = constants.%Convert.3] +// CHECK:STDOUT: %.loc8_40.3: = bound_method %.loc8_31, %.loc8_40.2 [template = constants.%.15] +// CHECK:STDOUT: %int.convert_checked.loc8_40.1: init i32 = call %.loc8_40.3(%.loc8_31) [template = constants.%.16] +// CHECK:STDOUT: %.loc8_40.4: init i32 = converted %.loc8_31, %int.convert_checked.loc8_40.1 [template = constants.%.16] +// CHECK:STDOUT: %.loc8_40.5: ref i32 = class_element_access %return, element0 +// CHECK:STDOUT: %.loc8_40.6: init i32 = initialize_from %.loc8_40.4 to %.loc8_40.5 [template = constants.%.16] +// CHECK:STDOUT: %.loc8_40.7: %Convert.type.2 = interface_witness_access constants.%.14, element0 [template = constants.%Convert.3] +// CHECK:STDOUT: %.loc8_40.8: = bound_method %.loc8_39, %.loc8_40.7 [template = constants.%.15] +// CHECK:STDOUT: %int.convert_checked.loc8_40.2: init i32 = call %.loc8_40.8(%.loc8_39) [template = constants.%.16] +// CHECK:STDOUT: %.loc8_40.9: init i32 = converted %.loc8_39, %int.convert_checked.loc8_40.2 [template = constants.%.16] +// CHECK:STDOUT: %.loc8_40.10: ref i32 = class_element_access %return, element1 +// CHECK:STDOUT: %.loc8_40.11: init i32 = initialize_from %.loc8_40.9 to %.loc8_40.10 [template = constants.%.16] +// CHECK:STDOUT: %.loc8_40.12: init %D = class_init (%.loc8_40.6, %.loc8_40.11), %return [template = constants.%struct] +// CHECK:STDOUT: %.loc8_41: init %D = converted %.loc8_40.1, %.loc8_40.12 [template = constants.%struct] // CHECK:STDOUT: return %.loc8_41 to %return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -599,7 +762,9 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: fn[%self.param_patt: @Convert.1.%Self (%Self.2)]() -> @Convert.1.%T (%T); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Convert.2[%self.param_patt: %C.3]() -> %return: %D { +// CHECK:STDOUT: fn @Convert.2[%self.param_patt: Core.IntLiteral]() -> i32 = "int.convert_checked"; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Convert.3[%self.param_patt: %C.3]() -> %return: %D { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Make.ref: %Make.type = name_ref Make, file.%Make.decl [template = constants.%Make] // CHECK:STDOUT: %.loc10: ref %D = splice_block %return {} @@ -607,7 +772,7 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: return %Make.call to %return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Convert.3[%self.param_patt: %C.4]() -> %return: %D { +// CHECK:STDOUT: fn @Convert.4[%self.param_patt: %C.4]() -> %return: %D { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Make.ref: %Make.type = name_ref Make, file.%Make.decl [template = constants.%Make] // CHECK:STDOUT: %.loc11: ref %D = splice_block %return {} @@ -615,7 +780,7 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: return %Make.call to %return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Convert.4[%self.param_patt: %C.5]() -> %return: %D { +// CHECK:STDOUT: fn @Convert.5[%self.param_patt: %C.5]() -> %return: %D { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Make.ref: %Make.type = name_ref Make, file.%Make.decl [template = constants.%Make] // CHECK:STDOUT: %.loc12: ref %D = splice_block %return {} @@ -623,7 +788,7 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: return %Make.call to %return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Convert.5[%self.param_patt: %C.6]() -> %return: %D { +// CHECK:STDOUT: fn @Convert.6[%self.param_patt: %C.6]() -> %return: %D { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Make.ref: %Make.type = name_ref Make, file.%Make.decl [template = constants.%Make] // CHECK:STDOUT: %.loc13: ref %D = splice_block %return {} @@ -631,7 +796,7 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: return %Make.call to %return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Convert.6[%self.param_patt: %C.7]() -> %return: %D { +// CHECK:STDOUT: fn @Convert.7[%self.param_patt: %C.7]() -> %return: %D { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Make.ref: %Make.type = name_ref Make, file.%Make.decl [template = constants.%Make] // CHECK:STDOUT: %.loc14: ref %D = splice_block %return {} @@ -639,7 +804,7 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: return %Make.call to %return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Convert.7[%self.param_patt: %C.8]() -> %return: %D { +// CHECK:STDOUT: fn @Convert.8[%self.param_patt: %C.8]() -> %return: %D { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Make.ref: %Make.type = name_ref Make, file.%Make.decl [template = constants.%Make] // CHECK:STDOUT: %.loc15: ref %D = splice_block %return {} @@ -647,7 +812,7 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: return %Make.call to %return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Convert.8[%self.param_patt: %C.9]() -> %return: %D { +// CHECK:STDOUT: fn @Convert.9[%self.param_patt: %C.9]() -> %return: %D { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Make.ref: %Make.type = name_ref Make, file.%Make.decl [template = constants.%Make] // CHECK:STDOUT: %.loc16: ref %D = splice_block %return {} @@ -655,7 +820,7 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: return %Make.call to %return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Convert.9[%self.param_patt: %C.10]() -> %return: %D { +// CHECK:STDOUT: fn @Convert.10[%self.param_patt: %C.10]() -> %return: %D { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Make.ref: %Make.type = name_ref Make, file.%Make.decl [template = constants.%Make] // CHECK:STDOUT: %.loc17: ref %D = splice_block %return {} @@ -668,13 +833,6 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: %N.patt.loc6_9.2 => constants.%N // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @C(constants.%.7) { -// CHECK:STDOUT: %N.loc6_9.2 => constants.%.7 -// CHECK:STDOUT: %N.patt.loc6_9.2 => constants.%.7 -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: specific @ImplicitAs(constants.%T) { // CHECK:STDOUT: %T => constants.%T // CHECK:STDOUT: %T.patt => constants.%T @@ -696,113 +854,133 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: %Self => constants.%Self.1 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(i32) { +// CHECK:STDOUT: %T => i32 +// CHECK:STDOUT: %T.patt => i32 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3 +// CHECK:STDOUT: %Self => constants.%Self.2 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.2 +// CHECK:STDOUT: %Convert => constants.%Convert.2 +// CHECK:STDOUT: %.1 => constants.%.11 +// CHECK:STDOUT: %.2 => constants.%.12 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @C(constants.%.16) { +// CHECK:STDOUT: %N.loc6_9.2 => constants.%.16 +// CHECK:STDOUT: %N.patt.loc6_9.2 => constants.%.16 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: specific @ImplicitAs(constants.%D) { // CHECK:STDOUT: %T => constants.%D // CHECK:STDOUT: %T.patt => constants.%D // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.4 // CHECK:STDOUT: %Self => constants.%Self.2 -// CHECK:STDOUT: %Convert.type => constants.%Convert.type.3 -// CHECK:STDOUT: %Convert => constants.%Convert.3 -// CHECK:STDOUT: %.1 => constants.%.10 -// CHECK:STDOUT: %.2 => constants.%.11 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.5 +// CHECK:STDOUT: %Convert => constants.%Convert.5 +// CHECK:STDOUT: %.1 => constants.%.17 +// CHECK:STDOUT: %.2 => constants.%.18 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Convert.1(constants.%D, constants.%C.3) { // CHECK:STDOUT: %T => constants.%D -// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.4 // CHECK:STDOUT: %Self => constants.%C.3 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @C(constants.%.14) { -// CHECK:STDOUT: %N.loc6_9.2 => constants.%.14 -// CHECK:STDOUT: %N.patt.loc6_9.2 => constants.%.14 +// CHECK:STDOUT: specific @C(constants.%.23) { +// CHECK:STDOUT: %N.loc6_9.2 => constants.%.23 +// CHECK:STDOUT: %N.patt.loc6_9.2 => constants.%.23 // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Convert.1(constants.%D, constants.%C.4) { // CHECK:STDOUT: %T => constants.%D -// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.4 // CHECK:STDOUT: %Self => constants.%C.4 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @C(constants.%.16) { -// CHECK:STDOUT: %N.loc6_9.2 => constants.%.16 -// CHECK:STDOUT: %N.patt.loc6_9.2 => constants.%.16 +// CHECK:STDOUT: specific @C(constants.%.27) { +// CHECK:STDOUT: %N.loc6_9.2 => constants.%.27 +// CHECK:STDOUT: %N.patt.loc6_9.2 => constants.%.27 // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Convert.1(constants.%D, constants.%C.5) { // CHECK:STDOUT: %T => constants.%D -// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.4 // CHECK:STDOUT: %Self => constants.%C.5 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @C(constants.%.18) { -// CHECK:STDOUT: %N.loc6_9.2 => constants.%.18 -// CHECK:STDOUT: %N.patt.loc6_9.2 => constants.%.18 +// CHECK:STDOUT: specific @C(constants.%.31) { +// CHECK:STDOUT: %N.loc6_9.2 => constants.%.31 +// CHECK:STDOUT: %N.patt.loc6_9.2 => constants.%.31 // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Convert.1(constants.%D, constants.%C.6) { // CHECK:STDOUT: %T => constants.%D -// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.4 // CHECK:STDOUT: %Self => constants.%C.6 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @C(constants.%.20) { -// CHECK:STDOUT: %N.loc6_9.2 => constants.%.20 -// CHECK:STDOUT: %N.patt.loc6_9.2 => constants.%.20 +// CHECK:STDOUT: specific @C(constants.%.35) { +// CHECK:STDOUT: %N.loc6_9.2 => constants.%.35 +// CHECK:STDOUT: %N.patt.loc6_9.2 => constants.%.35 // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Convert.1(constants.%D, constants.%C.7) { // CHECK:STDOUT: %T => constants.%D -// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.4 // CHECK:STDOUT: %Self => constants.%C.7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @C(constants.%.22) { -// CHECK:STDOUT: %N.loc6_9.2 => constants.%.22 -// CHECK:STDOUT: %N.patt.loc6_9.2 => constants.%.22 +// CHECK:STDOUT: specific @C(constants.%.39) { +// CHECK:STDOUT: %N.loc6_9.2 => constants.%.39 +// CHECK:STDOUT: %N.patt.loc6_9.2 => constants.%.39 // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Convert.1(constants.%D, constants.%C.8) { // CHECK:STDOUT: %T => constants.%D -// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.4 // CHECK:STDOUT: %Self => constants.%C.8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @C(constants.%.24) { -// CHECK:STDOUT: %N.loc6_9.2 => constants.%.24 -// CHECK:STDOUT: %N.patt.loc6_9.2 => constants.%.24 +// CHECK:STDOUT: specific @C(constants.%.43) { +// CHECK:STDOUT: %N.loc6_9.2 => constants.%.43 +// CHECK:STDOUT: %N.patt.loc6_9.2 => constants.%.43 // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Convert.1(constants.%D, constants.%C.9) { // CHECK:STDOUT: %T => constants.%D -// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.4 // CHECK:STDOUT: %Self => constants.%C.9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @C(constants.%.26) { -// CHECK:STDOUT: %N.loc6_9.2 => constants.%.26 -// CHECK:STDOUT: %N.patt.loc6_9.2 => constants.%.26 +// CHECK:STDOUT: specific @C(constants.%.47) { +// CHECK:STDOUT: %N.loc6_9.2 => constants.%.47 +// CHECK:STDOUT: %N.patt.loc6_9.2 => constants.%.47 // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Convert.1(constants.%D, constants.%C.10) { // CHECK:STDOUT: %T => constants.%D -// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.4 // CHECK:STDOUT: %Self => constants.%C.10 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -820,9 +998,7 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: %C.1: %C.type = struct_value () [template] // CHECK:STDOUT: %N: i32 = bind_symbolic_name N, 0 [symbolic] // CHECK:STDOUT: %N.patt: i32 = symbolic_binding_pattern N, 0 [symbolic] -// CHECK:STDOUT: %.7: i32 = int_value 0 [template] -// CHECK:STDOUT: %C.3: type = class_type @C, @C(%.7) [template] -// CHECK:STDOUT: %struct.1: %C.3 = struct_value () [template] +// CHECK:STDOUT: %.7: Core.IntLiteral = int_value 0 [template] // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] // CHECK:STDOUT: %ImplicitAs.type.2: type = facet_type <@ImplicitAs, @ImplicitAs(%T)> [symbolic] // CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2) = bind_symbolic_name Self, 1 [symbolic] @@ -830,59 +1006,85 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: %Self.2: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic] // CHECK:STDOUT: %Convert.type.1: type = fn_type @Convert.1, @ImplicitAs(%T) [symbolic] // CHECK:STDOUT: %Convert.1: %Convert.type.1 = struct_value () [symbolic] -// CHECK:STDOUT: %.9: type = assoc_entity_type %ImplicitAs.type.2, %Convert.type.1 [symbolic] -// CHECK:STDOUT: %.10: %.9 = assoc_entity element0, imports.%import_ref.12 [symbolic] -// CHECK:STDOUT: %ImplicitAs.type.3: type = facet_type <@ImplicitAs, @ImplicitAs(%D)> [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%D) [template] +// CHECK:STDOUT: %.8: type = assoc_entity_type %ImplicitAs.type.2, %Convert.type.1 [symbolic] +// CHECK:STDOUT: %.9: %.8 = assoc_entity element0, imports.%import_ref.12 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.3: type = facet_type <@ImplicitAs, @ImplicitAs(i32)> [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(i32) [template] // CHECK:STDOUT: %Convert.2: %Convert.type.2 = struct_value () [template] -// CHECK:STDOUT: %.11: type = assoc_entity_type %ImplicitAs.type.3, %Convert.type.2 [template] -// CHECK:STDOUT: %.12: %.11 = assoc_entity element0, imports.%import_ref.12 [template] -// CHECK:STDOUT: %.13: %.9 = assoc_entity element0, imports.%import_ref.13 [symbolic] -// CHECK:STDOUT: %.14: i32 = int_value 1 [template] -// CHECK:STDOUT: %C.4: type = class_type @C, @C(%.14) [template] -// CHECK:STDOUT: %.15: i32 = int_value 2 [template] -// CHECK:STDOUT: %C.5: type = class_type @C, @C(%.15) [template] -// CHECK:STDOUT: %.16: i32 = int_value 3 [template] -// CHECK:STDOUT: %C.6: type = class_type @C, @C(%.16) [template] -// CHECK:STDOUT: %.17: i32 = int_value 4 [template] -// CHECK:STDOUT: %C.7: type = class_type @C, @C(%.17) [template] -// CHECK:STDOUT: %.18: i32 = int_value 5 [template] -// CHECK:STDOUT: %C.8: type = class_type @C, @C(%.18) [template] -// CHECK:STDOUT: %.19: i32 = int_value 6 [template] -// CHECK:STDOUT: %C.9: type = class_type @C, @C(%.19) [template] -// CHECK:STDOUT: %.20: i32 = int_value 7 [template] -// CHECK:STDOUT: %C.10: type = class_type @C, @C(%.20) [template] +// CHECK:STDOUT: %.10: type = assoc_entity_type %ImplicitAs.type.3, %Convert.type.2 [template] +// CHECK:STDOUT: %.11: %.10 = assoc_entity element0, imports.%import_ref.12 [template] +// CHECK:STDOUT: %.12: %.8 = assoc_entity element0, imports.%import_ref.13 [symbolic] // CHECK:STDOUT: %Convert.type.3: type = fn_type @Convert.2 [template] // CHECK:STDOUT: %Convert.3: %Convert.type.3 = struct_value () [template] -// CHECK:STDOUT: %.21: = interface_witness (%Convert.3) [template] -// CHECK:STDOUT: %struct.2: %C.4 = struct_value () [template] -// CHECK:STDOUT: %Convert.type.4: type = fn_type @Convert.3 [template] +// CHECK:STDOUT: %.13: = interface_witness (%Convert.3) [template] +// CHECK:STDOUT: %.14: = bound_method %.7, %Convert.3 [template] +// CHECK:STDOUT: %.15: i32 = int_value 0 [template] +// CHECK:STDOUT: %C.3: type = class_type @C, @C(%.15) [template] +// CHECK:STDOUT: %struct.1: %C.3 = struct_value () [template] +// CHECK:STDOUT: %ImplicitAs.type.4: type = facet_type <@ImplicitAs, @ImplicitAs(%D)> [template] +// CHECK:STDOUT: %Convert.type.4: type = fn_type @Convert.1, @ImplicitAs(%D) [template] // CHECK:STDOUT: %Convert.4: %Convert.type.4 = struct_value () [template] -// CHECK:STDOUT: %.22: = interface_witness (%Convert.4) [template] -// CHECK:STDOUT: %struct.3: %C.5 = struct_value () [template] -// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.4 [template] +// CHECK:STDOUT: %.17: type = assoc_entity_type %ImplicitAs.type.4, %Convert.type.4 [template] +// CHECK:STDOUT: %.18: %.17 = assoc_entity element0, imports.%import_ref.12 [template] +// CHECK:STDOUT: %.19: i32 = int_value 1 [template] +// CHECK:STDOUT: %C.4: type = class_type @C, @C(%.19) [template] +// CHECK:STDOUT: %.20: i32 = int_value 2 [template] +// CHECK:STDOUT: %C.5: type = class_type @C, @C(%.20) [template] +// CHECK:STDOUT: %.21: i32 = int_value 3 [template] +// CHECK:STDOUT: %C.6: type = class_type @C, @C(%.21) [template] +// CHECK:STDOUT: %.22: i32 = int_value 4 [template] +// CHECK:STDOUT: %C.7: type = class_type @C, @C(%.22) [template] +// CHECK:STDOUT: %.23: i32 = int_value 5 [template] +// CHECK:STDOUT: %C.8: type = class_type @C, @C(%.23) [template] +// CHECK:STDOUT: %.24: i32 = int_value 6 [template] +// CHECK:STDOUT: %C.9: type = class_type @C, @C(%.24) [template] +// CHECK:STDOUT: %.25: i32 = int_value 7 [template] +// CHECK:STDOUT: %C.10: type = class_type @C, @C(%.25) [template] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.3 [template] // CHECK:STDOUT: %Convert.5: %Convert.type.5 = struct_value () [template] -// CHECK:STDOUT: %.23: = interface_witness (%Convert.5) [template] -// CHECK:STDOUT: %struct.4: %C.6 = struct_value () [template] -// CHECK:STDOUT: %Convert.type.6: type = fn_type @Convert.5 [template] +// CHECK:STDOUT: %.26: = interface_witness (%Convert.5) [template] +// CHECK:STDOUT: %.27: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.28: = bound_method %.27, %Convert.3 [template] +// CHECK:STDOUT: %struct.2: %C.4 = struct_value () [template] +// CHECK:STDOUT: %Convert.type.6: type = fn_type @Convert.4 [template] // CHECK:STDOUT: %Convert.6: %Convert.type.6 = struct_value () [template] -// CHECK:STDOUT: %.24: = interface_witness (%Convert.6) [template] -// CHECK:STDOUT: %struct.5: %C.7 = struct_value () [template] -// CHECK:STDOUT: %Convert.type.7: type = fn_type @Convert.6 [template] +// CHECK:STDOUT: %.29: = interface_witness (%Convert.6) [template] +// CHECK:STDOUT: %.30: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.31: = bound_method %.30, %Convert.3 [template] +// CHECK:STDOUT: %struct.3: %C.5 = struct_value () [template] +// CHECK:STDOUT: %Convert.type.7: type = fn_type @Convert.5 [template] // CHECK:STDOUT: %Convert.7: %Convert.type.7 = struct_value () [template] -// CHECK:STDOUT: %.25: = interface_witness (%Convert.7) [template] -// CHECK:STDOUT: %struct.6: %C.8 = struct_value () [template] -// CHECK:STDOUT: %Convert.type.8: type = fn_type @Convert.7 [template] +// CHECK:STDOUT: %.32: = interface_witness (%Convert.7) [template] +// CHECK:STDOUT: %.33: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.34: = bound_method %.33, %Convert.3 [template] +// CHECK:STDOUT: %struct.4: %C.6 = struct_value () [template] +// CHECK:STDOUT: %Convert.type.8: type = fn_type @Convert.6 [template] // CHECK:STDOUT: %Convert.8: %Convert.type.8 = struct_value () [template] -// CHECK:STDOUT: %.26: = interface_witness (%Convert.8) [template] -// CHECK:STDOUT: %struct.7: %C.9 = struct_value () [template] -// CHECK:STDOUT: %Convert.type.9: type = fn_type @Convert.8 [template] +// CHECK:STDOUT: %.35: = interface_witness (%Convert.8) [template] +// CHECK:STDOUT: %.36: Core.IntLiteral = int_value 4 [template] +// CHECK:STDOUT: %.37: = bound_method %.36, %Convert.3 [template] +// CHECK:STDOUT: %struct.5: %C.7 = struct_value () [template] +// CHECK:STDOUT: %Convert.type.9: type = fn_type @Convert.7 [template] // CHECK:STDOUT: %Convert.9: %Convert.type.9 = struct_value () [template] -// CHECK:STDOUT: %.27: = interface_witness (%Convert.9) [template] -// CHECK:STDOUT: %struct.8: %C.10 = struct_value () [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.9 [template] +// CHECK:STDOUT: %.38: = interface_witness (%Convert.9) [template] +// CHECK:STDOUT: %.39: Core.IntLiteral = int_value 5 [template] +// CHECK:STDOUT: %.40: = bound_method %.39, %Convert.3 [template] +// CHECK:STDOUT: %struct.6: %C.8 = struct_value () [template] +// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.8 [template] // CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %.28: = interface_witness (%Convert.10) [template] +// CHECK:STDOUT: %.41: = interface_witness (%Convert.10) [template] +// CHECK:STDOUT: %.42: Core.IntLiteral = int_value 6 [template] +// CHECK:STDOUT: %.43: = bound_method %.42, %Convert.3 [template] +// CHECK:STDOUT: %struct.7: %C.9 = struct_value () [template] +// CHECK:STDOUT: %Convert.type.11: type = fn_type @Convert.9 [template] +// CHECK:STDOUT: %Convert.11: %Convert.type.11 = struct_value () [template] +// CHECK:STDOUT: %.44: = interface_witness (%Convert.11) [template] +// CHECK:STDOUT: %.45: Core.IntLiteral = int_value 7 [template] +// CHECK:STDOUT: %.46: = bound_method %.45, %Convert.3 [template] +// CHECK:STDOUT: %struct.8: %C.10 = struct_value () [template] +// CHECK:STDOUT: %Convert.type.12: type = fn_type @Convert.10 [template] +// CHECK:STDOUT: %Convert.12: %Convert.type.12 = struct_value () [template] +// CHECK:STDOUT: %.47: = interface_witness (%Convert.12) [template] // CHECK:STDOUT: %Make.type: type = fn_type @Make [template] // CHECK:STDOUT: %Make: %Make.type = struct_value () [template] // CHECK:STDOUT: } @@ -891,7 +1093,7 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: %P: = namespace file.%P.import, [template] { // CHECK:STDOUT: .D = %import_ref.2 // CHECK:STDOUT: .C = %import_ref.6 -// CHECK:STDOUT: .Make = %import_ref.38 +// CHECK:STDOUT: .Make = %import_ref.41 // CHECK:STDOUT: import P//library // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { @@ -905,35 +1107,38 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: %import_ref.5 = import_ref P//library, inst+39, unloaded // CHECK:STDOUT: %import_ref.6: %C.type = import_ref P//library, inst+20, loaded [template = constants.%C.1] // CHECK:STDOUT: %import_ref.7 = import_ref P//library, inst+25, unloaded -// CHECK:STDOUT: %import_ref.9 = import_ref Core//default, inst+21, unloaded -// CHECK:STDOUT: %import_ref.10: @ImplicitAs.%.1 (%.9) = import_ref Core//default, inst+43, loaded [symbolic = @ImplicitAs.%.2 (constants.%.13)] -// CHECK:STDOUT: %import_ref.11 = import_ref Core//default, inst+36, unloaded -// CHECK:STDOUT: %import_ref.12 = import_ref Core//default, inst+36, unloaded -// CHECK:STDOUT: %import_ref.14: type = import_ref P//library, inst+66, loaded [template = constants.%C.3] -// CHECK:STDOUT: %import_ref.15: type = import_ref P//library, inst+111, loaded [template = constants.%ImplicitAs.type.3] -// CHECK:STDOUT: %import_ref.16: = import_ref P//library, inst+131, loaded [template = constants.%.21] -// CHECK:STDOUT: %import_ref.17: type = import_ref P//library, inst+141, loaded [template = constants.%C.4] -// CHECK:STDOUT: %import_ref.18: type = import_ref P//library, inst+146, loaded [template = constants.%ImplicitAs.type.3] -// CHECK:STDOUT: %import_ref.19: = import_ref P//library, inst+161, loaded [template = constants.%.22] -// CHECK:STDOUT: %import_ref.20: type = import_ref P//library, inst+170, loaded [template = constants.%C.5] -// CHECK:STDOUT: %import_ref.21: type = import_ref P//library, inst+175, loaded [template = constants.%ImplicitAs.type.3] -// CHECK:STDOUT: %import_ref.22: = import_ref P//library, inst+190, loaded [template = constants.%.23] -// CHECK:STDOUT: %import_ref.23: type = import_ref P//library, inst+199, loaded [template = constants.%C.6] -// CHECK:STDOUT: %import_ref.24: type = import_ref P//library, inst+204, loaded [template = constants.%ImplicitAs.type.3] -// CHECK:STDOUT: %import_ref.25: = import_ref P//library, inst+219, loaded [template = constants.%.24] -// CHECK:STDOUT: %import_ref.26: type = import_ref P//library, inst+228, loaded [template = constants.%C.7] -// CHECK:STDOUT: %import_ref.27: type = import_ref P//library, inst+233, loaded [template = constants.%ImplicitAs.type.3] -// CHECK:STDOUT: %import_ref.28: = import_ref P//library, inst+248, loaded [template = constants.%.25] -// CHECK:STDOUT: %import_ref.29: type = import_ref P//library, inst+257, loaded [template = constants.%C.8] -// CHECK:STDOUT: %import_ref.30: type = import_ref P//library, inst+262, loaded [template = constants.%ImplicitAs.type.3] -// CHECK:STDOUT: %import_ref.31: = import_ref P//library, inst+277, loaded [template = constants.%.26] -// CHECK:STDOUT: %import_ref.32: type = import_ref P//library, inst+286, loaded [template = constants.%C.9] -// CHECK:STDOUT: %import_ref.33: type = import_ref P//library, inst+291, loaded [template = constants.%ImplicitAs.type.3] -// CHECK:STDOUT: %import_ref.34: = import_ref P//library, inst+306, loaded [template = constants.%.27] -// CHECK:STDOUT: %import_ref.35: type = import_ref P//library, inst+315, loaded [template = constants.%C.10] -// CHECK:STDOUT: %import_ref.36: type = import_ref P//library, inst+320, loaded [template = constants.%ImplicitAs.type.3] -// CHECK:STDOUT: %import_ref.37: = import_ref P//library, inst+335, loaded [template = constants.%.28] -// CHECK:STDOUT: %import_ref.38: %Make.type = import_ref P//library, inst+48, loaded [template = constants.%Make] +// CHECK:STDOUT: %import_ref.9 = import_ref Core//default, inst+28, unloaded +// CHECK:STDOUT: %import_ref.10: @ImplicitAs.%.1 (%.8) = import_ref Core//default, inst+50, loaded [symbolic = @ImplicitAs.%.2 (constants.%.12)] +// CHECK:STDOUT: %import_ref.11 = import_ref Core//default, inst+43, unloaded +// CHECK:STDOUT: %import_ref.12 = import_ref Core//default, inst+43, unloaded +// CHECK:STDOUT: %import_ref.14: type = import_ref Core//default, inst+61, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.15: type = import_ref Core//default, inst+66, loaded [template = constants.%ImplicitAs.type.3] +// CHECK:STDOUT: %import_ref.16: = import_ref Core//default, inst+88, loaded [template = constants.%.13] +// CHECK:STDOUT: %import_ref.17: type = import_ref P//library, inst+144, loaded [template = constants.%C.3] +// CHECK:STDOUT: %import_ref.18: type = import_ref P//library, inst+149, loaded [template = constants.%ImplicitAs.type.4] +// CHECK:STDOUT: %import_ref.19: = import_ref P//library, inst+169, loaded [template = constants.%.26] +// CHECK:STDOUT: %import_ref.20: type = import_ref P//library, inst+186, loaded [template = constants.%C.4] +// CHECK:STDOUT: %import_ref.21: type = import_ref P//library, inst+191, loaded [template = constants.%ImplicitAs.type.4] +// CHECK:STDOUT: %import_ref.22: = import_ref P//library, inst+206, loaded [template = constants.%.29] +// CHECK:STDOUT: %import_ref.23: type = import_ref P//library, inst+222, loaded [template = constants.%C.5] +// CHECK:STDOUT: %import_ref.24: type = import_ref P//library, inst+227, loaded [template = constants.%ImplicitAs.type.4] +// CHECK:STDOUT: %import_ref.25: = import_ref P//library, inst+242, loaded [template = constants.%.32] +// CHECK:STDOUT: %import_ref.26: type = import_ref P//library, inst+258, loaded [template = constants.%C.6] +// CHECK:STDOUT: %import_ref.27: type = import_ref P//library, inst+263, loaded [template = constants.%ImplicitAs.type.4] +// CHECK:STDOUT: %import_ref.28: = import_ref P//library, inst+278, loaded [template = constants.%.35] +// CHECK:STDOUT: %import_ref.29: type = import_ref P//library, inst+294, loaded [template = constants.%C.7] +// CHECK:STDOUT: %import_ref.30: type = import_ref P//library, inst+299, loaded [template = constants.%ImplicitAs.type.4] +// CHECK:STDOUT: %import_ref.31: = import_ref P//library, inst+314, loaded [template = constants.%.38] +// CHECK:STDOUT: %import_ref.32: type = import_ref P//library, inst+330, loaded [template = constants.%C.8] +// CHECK:STDOUT: %import_ref.33: type = import_ref P//library, inst+335, loaded [template = constants.%ImplicitAs.type.4] +// CHECK:STDOUT: %import_ref.34: = import_ref P//library, inst+350, loaded [template = constants.%.41] +// CHECK:STDOUT: %import_ref.35: type = import_ref P//library, inst+366, loaded [template = constants.%C.9] +// CHECK:STDOUT: %import_ref.36: type = import_ref P//library, inst+371, loaded [template = constants.%ImplicitAs.type.4] +// CHECK:STDOUT: %import_ref.37: = import_ref P//library, inst+386, loaded [template = constants.%.44] +// CHECK:STDOUT: %import_ref.38: type = import_ref P//library, inst+402, loaded [template = constants.%C.10] +// CHECK:STDOUT: %import_ref.39: type = import_ref P//library, inst+407, loaded [template = constants.%ImplicitAs.type.4] +// CHECK:STDOUT: %import_ref.40: = import_ref P//library, inst+422, loaded [template = constants.%.47] +// CHECK:STDOUT: %import_ref.41: %Make.type = import_ref P//library, inst+48, loaded [template = constants.%Make] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -971,8 +1176,8 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)] // CHECK:STDOUT: %Convert.type: type = fn_type @Convert.1, @ImplicitAs(%T) [symbolic = %Convert.type (constants.%Convert.type.1)] // CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.1) = struct_value () [symbolic = %Convert (constants.%Convert.1)] -// CHECK:STDOUT: %.1: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2), @ImplicitAs.%Convert.type (%Convert.type.1) [symbolic = %.1 (constants.%.9)] -// CHECK:STDOUT: %.2: @ImplicitAs.%.1 (%.9) = assoc_entity element0, imports.%import_ref.12 [symbolic = %.2 (constants.%.10)] +// CHECK:STDOUT: %.1: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2), @ImplicitAs.%Convert.type (%Convert.type.1) [symbolic = %.1 (constants.%.8)] +// CHECK:STDOUT: %.2: @ImplicitAs.%.1 (%.8) = assoc_entity element0, imports.%import_ref.12 [symbolic = %.2 (constants.%.9)] // CHECK:STDOUT: // CHECK:STDOUT: interface { // CHECK:STDOUT: !members: @@ -1022,6 +1227,11 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: witness = imports.%import_ref.37 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.9: imports.%import_ref.38 as imports.%import_ref.39 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.40 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: class @D { // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = imports.%import_ref.3 @@ -1052,13 +1262,18 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: %.loc8_24.1: %.5 = struct_literal () // CHECK:STDOUT: %P.ref.loc8: = name_ref P, imports.%P [template = imports.%P] // CHECK:STDOUT: %C.ref.loc8: %C.type = name_ref C, imports.%import_ref.6 [template = constants.%C.1] -// CHECK:STDOUT: %.loc8_33: i32 = int_value 0 [template = constants.%.7] -// CHECK:STDOUT: %C.loc8: type = class_type @C, @C(constants.%.7) [template = constants.%C.3] +// CHECK:STDOUT: %.loc8_33: Core.IntLiteral = int_value 0 [template = constants.%.7] +// CHECK:STDOUT: %.loc8_32.1: %Convert.type.2 = interface_witness_access constants.%.13, element0 [template = constants.%Convert.3] +// CHECK:STDOUT: %.loc8_32.2: = bound_method %.loc8_33, %.loc8_32.1 [template = constants.%.14] +// CHECK:STDOUT: %int.convert_checked.loc8: init i32 = call %.loc8_32.2(%.loc8_33) [template = constants.%.15] +// CHECK:STDOUT: %.loc8_32.3: i32 = value_of_initializer %int.convert_checked.loc8 [template = constants.%.15] +// CHECK:STDOUT: %.loc8_32.4: i32 = converted %.loc8_33, %.loc8_32.3 [template = constants.%.15] +// CHECK:STDOUT: %C.loc8: type = class_type @C, @C(constants.%.15) [template = constants.%C.3] // CHECK:STDOUT: %.loc8_24.2: ref %C.3 = temporary_storage // CHECK:STDOUT: %.loc8_24.3: init %C.3 = class_init (), %.loc8_24.2 [template = constants.%struct.1] // CHECK:STDOUT: %.loc8_24.4: ref %C.3 = temporary %.loc8_24.2, %.loc8_24.3 // CHECK:STDOUT: %.loc8_26.1: ref %C.3 = converted %.loc8_24.1, %.loc8_24.4 -// CHECK:STDOUT: %.loc8_35.1: %Convert.type.2 = interface_witness_access constants.%.21, element0 [template = constants.%Convert.3] +// CHECK:STDOUT: %.loc8_35.1: %Convert.type.4 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.5] // CHECK:STDOUT: %.loc8_35.2: = bound_method %.loc8_26.1, %.loc8_35.1 // CHECK:STDOUT: %.loc8_35.3: ref %D = temporary_storage // CHECK:STDOUT: %.loc8_26.2: %C.3 = bind_value %.loc8_26.1 @@ -1074,13 +1289,18 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: %.loc9_24.1: %.5 = struct_literal () // CHECK:STDOUT: %P.ref.loc9: = name_ref P, imports.%P [template = imports.%P] // CHECK:STDOUT: %C.ref.loc9: %C.type = name_ref C, imports.%import_ref.6 [template = constants.%C.1] -// CHECK:STDOUT: %.loc9_33: i32 = int_value 1 [template = constants.%.14] -// CHECK:STDOUT: %C.loc9: type = class_type @C, @C(constants.%.14) [template = constants.%C.4] +// CHECK:STDOUT: %.loc9_33: Core.IntLiteral = int_value 1 [template = constants.%.27] +// CHECK:STDOUT: %.loc9_32.1: %Convert.type.2 = interface_witness_access constants.%.13, element0 [template = constants.%Convert.3] +// CHECK:STDOUT: %.loc9_32.2: = bound_method %.loc9_33, %.loc9_32.1 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked.loc9: init i32 = call %.loc9_32.2(%.loc9_33) [template = constants.%.19] +// CHECK:STDOUT: %.loc9_32.3: i32 = value_of_initializer %int.convert_checked.loc9 [template = constants.%.19] +// CHECK:STDOUT: %.loc9_32.4: i32 = converted %.loc9_33, %.loc9_32.3 [template = constants.%.19] +// CHECK:STDOUT: %C.loc9: type = class_type @C, @C(constants.%.19) [template = constants.%C.4] // CHECK:STDOUT: %.loc9_24.2: ref %C.4 = temporary_storage // CHECK:STDOUT: %.loc9_24.3: init %C.4 = class_init (), %.loc9_24.2 [template = constants.%struct.2] // CHECK:STDOUT: %.loc9_24.4: ref %C.4 = temporary %.loc9_24.2, %.loc9_24.3 // CHECK:STDOUT: %.loc9_26.1: ref %C.4 = converted %.loc9_24.1, %.loc9_24.4 -// CHECK:STDOUT: %.loc9_35.1: %Convert.type.2 = interface_witness_access constants.%.22, element0 [template = constants.%Convert.4] +// CHECK:STDOUT: %.loc9_35.1: %Convert.type.4 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.6] // CHECK:STDOUT: %.loc9_35.2: = bound_method %.loc9_26.1, %.loc9_35.1 // CHECK:STDOUT: %.loc9_35.3: ref %D = temporary_storage // CHECK:STDOUT: %.loc9_26.2: %C.4 = bind_value %.loc9_26.1 @@ -1096,13 +1316,18 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: %.loc10_24.1: %.5 = struct_literal () // CHECK:STDOUT: %P.ref.loc10: = name_ref P, imports.%P [template = imports.%P] // CHECK:STDOUT: %C.ref.loc10: %C.type = name_ref C, imports.%import_ref.6 [template = constants.%C.1] -// CHECK:STDOUT: %.loc10_33: i32 = int_value 2 [template = constants.%.15] -// CHECK:STDOUT: %C.loc10: type = class_type @C, @C(constants.%.15) [template = constants.%C.5] +// CHECK:STDOUT: %.loc10_33: Core.IntLiteral = int_value 2 [template = constants.%.30] +// CHECK:STDOUT: %.loc10_32.1: %Convert.type.2 = interface_witness_access constants.%.13, element0 [template = constants.%Convert.3] +// CHECK:STDOUT: %.loc10_32.2: = bound_method %.loc10_33, %.loc10_32.1 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked.loc10: init i32 = call %.loc10_32.2(%.loc10_33) [template = constants.%.20] +// CHECK:STDOUT: %.loc10_32.3: i32 = value_of_initializer %int.convert_checked.loc10 [template = constants.%.20] +// CHECK:STDOUT: %.loc10_32.4: i32 = converted %.loc10_33, %.loc10_32.3 [template = constants.%.20] +// CHECK:STDOUT: %C.loc10: type = class_type @C, @C(constants.%.20) [template = constants.%C.5] // CHECK:STDOUT: %.loc10_24.2: ref %C.5 = temporary_storage // CHECK:STDOUT: %.loc10_24.3: init %C.5 = class_init (), %.loc10_24.2 [template = constants.%struct.3] // CHECK:STDOUT: %.loc10_24.4: ref %C.5 = temporary %.loc10_24.2, %.loc10_24.3 // CHECK:STDOUT: %.loc10_26.1: ref %C.5 = converted %.loc10_24.1, %.loc10_24.4 -// CHECK:STDOUT: %.loc10_35.1: %Convert.type.2 = interface_witness_access constants.%.23, element0 [template = constants.%Convert.5] +// CHECK:STDOUT: %.loc10_35.1: %Convert.type.4 = interface_witness_access constants.%.32, element0 [template = constants.%Convert.7] // CHECK:STDOUT: %.loc10_35.2: = bound_method %.loc10_26.1, %.loc10_35.1 // CHECK:STDOUT: %.loc10_35.3: ref %D = temporary_storage // CHECK:STDOUT: %.loc10_26.2: %C.5 = bind_value %.loc10_26.1 @@ -1118,13 +1343,18 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: %.loc11_24.1: %.5 = struct_literal () // CHECK:STDOUT: %P.ref.loc11: = name_ref P, imports.%P [template = imports.%P] // CHECK:STDOUT: %C.ref.loc11: %C.type = name_ref C, imports.%import_ref.6 [template = constants.%C.1] -// CHECK:STDOUT: %.loc11_33: i32 = int_value 3 [template = constants.%.16] -// CHECK:STDOUT: %C.loc11: type = class_type @C, @C(constants.%.16) [template = constants.%C.6] +// CHECK:STDOUT: %.loc11_33: Core.IntLiteral = int_value 3 [template = constants.%.33] +// CHECK:STDOUT: %.loc11_32.1: %Convert.type.2 = interface_witness_access constants.%.13, element0 [template = constants.%Convert.3] +// CHECK:STDOUT: %.loc11_32.2: = bound_method %.loc11_33, %.loc11_32.1 [template = constants.%.34] +// CHECK:STDOUT: %int.convert_checked.loc11: init i32 = call %.loc11_32.2(%.loc11_33) [template = constants.%.21] +// CHECK:STDOUT: %.loc11_32.3: i32 = value_of_initializer %int.convert_checked.loc11 [template = constants.%.21] +// CHECK:STDOUT: %.loc11_32.4: i32 = converted %.loc11_33, %.loc11_32.3 [template = constants.%.21] +// CHECK:STDOUT: %C.loc11: type = class_type @C, @C(constants.%.21) [template = constants.%C.6] // CHECK:STDOUT: %.loc11_24.2: ref %C.6 = temporary_storage // CHECK:STDOUT: %.loc11_24.3: init %C.6 = class_init (), %.loc11_24.2 [template = constants.%struct.4] // CHECK:STDOUT: %.loc11_24.4: ref %C.6 = temporary %.loc11_24.2, %.loc11_24.3 // CHECK:STDOUT: %.loc11_26.1: ref %C.6 = converted %.loc11_24.1, %.loc11_24.4 -// CHECK:STDOUT: %.loc11_35.1: %Convert.type.2 = interface_witness_access constants.%.24, element0 [template = constants.%Convert.6] +// CHECK:STDOUT: %.loc11_35.1: %Convert.type.4 = interface_witness_access constants.%.35, element0 [template = constants.%Convert.8] // CHECK:STDOUT: %.loc11_35.2: = bound_method %.loc11_26.1, %.loc11_35.1 // CHECK:STDOUT: %.loc11_35.3: ref %D = temporary_storage // CHECK:STDOUT: %.loc11_26.2: %C.6 = bind_value %.loc11_26.1 @@ -1140,13 +1370,18 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: %.loc12_24.1: %.5 = struct_literal () // CHECK:STDOUT: %P.ref.loc12: = name_ref P, imports.%P [template = imports.%P] // CHECK:STDOUT: %C.ref.loc12: %C.type = name_ref C, imports.%import_ref.6 [template = constants.%C.1] -// CHECK:STDOUT: %.loc12_33: i32 = int_value 4 [template = constants.%.17] -// CHECK:STDOUT: %C.loc12: type = class_type @C, @C(constants.%.17) [template = constants.%C.7] +// CHECK:STDOUT: %.loc12_33: Core.IntLiteral = int_value 4 [template = constants.%.36] +// CHECK:STDOUT: %.loc12_32.1: %Convert.type.2 = interface_witness_access constants.%.13, element0 [template = constants.%Convert.3] +// CHECK:STDOUT: %.loc12_32.2: = bound_method %.loc12_33, %.loc12_32.1 [template = constants.%.37] +// CHECK:STDOUT: %int.convert_checked.loc12: init i32 = call %.loc12_32.2(%.loc12_33) [template = constants.%.22] +// CHECK:STDOUT: %.loc12_32.3: i32 = value_of_initializer %int.convert_checked.loc12 [template = constants.%.22] +// CHECK:STDOUT: %.loc12_32.4: i32 = converted %.loc12_33, %.loc12_32.3 [template = constants.%.22] +// CHECK:STDOUT: %C.loc12: type = class_type @C, @C(constants.%.22) [template = constants.%C.7] // CHECK:STDOUT: %.loc12_24.2: ref %C.7 = temporary_storage // CHECK:STDOUT: %.loc12_24.3: init %C.7 = class_init (), %.loc12_24.2 [template = constants.%struct.5] // CHECK:STDOUT: %.loc12_24.4: ref %C.7 = temporary %.loc12_24.2, %.loc12_24.3 // CHECK:STDOUT: %.loc12_26.1: ref %C.7 = converted %.loc12_24.1, %.loc12_24.4 -// CHECK:STDOUT: %.loc12_35.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.7] +// CHECK:STDOUT: %.loc12_35.1: %Convert.type.4 = interface_witness_access constants.%.38, element0 [template = constants.%Convert.9] // CHECK:STDOUT: %.loc12_35.2: = bound_method %.loc12_26.1, %.loc12_35.1 // CHECK:STDOUT: %.loc12_35.3: ref %D = temporary_storage // CHECK:STDOUT: %.loc12_26.2: %C.7 = bind_value %.loc12_26.1 @@ -1162,13 +1397,18 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: %.loc13_24.1: %.5 = struct_literal () // CHECK:STDOUT: %P.ref.loc13: = name_ref P, imports.%P [template = imports.%P] // CHECK:STDOUT: %C.ref.loc13: %C.type = name_ref C, imports.%import_ref.6 [template = constants.%C.1] -// CHECK:STDOUT: %.loc13_33: i32 = int_value 5 [template = constants.%.18] -// CHECK:STDOUT: %C.loc13: type = class_type @C, @C(constants.%.18) [template = constants.%C.8] +// CHECK:STDOUT: %.loc13_33: Core.IntLiteral = int_value 5 [template = constants.%.39] +// CHECK:STDOUT: %.loc13_32.1: %Convert.type.2 = interface_witness_access constants.%.13, element0 [template = constants.%Convert.3] +// CHECK:STDOUT: %.loc13_32.2: = bound_method %.loc13_33, %.loc13_32.1 [template = constants.%.40] +// CHECK:STDOUT: %int.convert_checked.loc13: init i32 = call %.loc13_32.2(%.loc13_33) [template = constants.%.23] +// CHECK:STDOUT: %.loc13_32.3: i32 = value_of_initializer %int.convert_checked.loc13 [template = constants.%.23] +// CHECK:STDOUT: %.loc13_32.4: i32 = converted %.loc13_33, %.loc13_32.3 [template = constants.%.23] +// CHECK:STDOUT: %C.loc13: type = class_type @C, @C(constants.%.23) [template = constants.%C.8] // CHECK:STDOUT: %.loc13_24.2: ref %C.8 = temporary_storage // CHECK:STDOUT: %.loc13_24.3: init %C.8 = class_init (), %.loc13_24.2 [template = constants.%struct.6] // CHECK:STDOUT: %.loc13_24.4: ref %C.8 = temporary %.loc13_24.2, %.loc13_24.3 // CHECK:STDOUT: %.loc13_26.1: ref %C.8 = converted %.loc13_24.1, %.loc13_24.4 -// CHECK:STDOUT: %.loc13_35.1: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.8] +// CHECK:STDOUT: %.loc13_35.1: %Convert.type.4 = interface_witness_access constants.%.41, element0 [template = constants.%Convert.10] // CHECK:STDOUT: %.loc13_35.2: = bound_method %.loc13_26.1, %.loc13_35.1 // CHECK:STDOUT: %.loc13_35.3: ref %D = temporary_storage // CHECK:STDOUT: %.loc13_26.2: %C.8 = bind_value %.loc13_26.1 @@ -1184,13 +1424,18 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: %.loc14_24.1: %.5 = struct_literal () // CHECK:STDOUT: %P.ref.loc14: = name_ref P, imports.%P [template = imports.%P] // CHECK:STDOUT: %C.ref.loc14: %C.type = name_ref C, imports.%import_ref.6 [template = constants.%C.1] -// CHECK:STDOUT: %.loc14_33: i32 = int_value 6 [template = constants.%.19] -// CHECK:STDOUT: %C.loc14: type = class_type @C, @C(constants.%.19) [template = constants.%C.9] +// CHECK:STDOUT: %.loc14_33: Core.IntLiteral = int_value 6 [template = constants.%.42] +// CHECK:STDOUT: %.loc14_32.1: %Convert.type.2 = interface_witness_access constants.%.13, element0 [template = constants.%Convert.3] +// CHECK:STDOUT: %.loc14_32.2: = bound_method %.loc14_33, %.loc14_32.1 [template = constants.%.43] +// CHECK:STDOUT: %int.convert_checked.loc14: init i32 = call %.loc14_32.2(%.loc14_33) [template = constants.%.24] +// CHECK:STDOUT: %.loc14_32.3: i32 = value_of_initializer %int.convert_checked.loc14 [template = constants.%.24] +// CHECK:STDOUT: %.loc14_32.4: i32 = converted %.loc14_33, %.loc14_32.3 [template = constants.%.24] +// CHECK:STDOUT: %C.loc14: type = class_type @C, @C(constants.%.24) [template = constants.%C.9] // CHECK:STDOUT: %.loc14_24.2: ref %C.9 = temporary_storage // CHECK:STDOUT: %.loc14_24.3: init %C.9 = class_init (), %.loc14_24.2 [template = constants.%struct.7] // CHECK:STDOUT: %.loc14_24.4: ref %C.9 = temporary %.loc14_24.2, %.loc14_24.3 // CHECK:STDOUT: %.loc14_26.1: ref %C.9 = converted %.loc14_24.1, %.loc14_24.4 -// CHECK:STDOUT: %.loc14_35.1: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.9] +// CHECK:STDOUT: %.loc14_35.1: %Convert.type.4 = interface_witness_access constants.%.44, element0 [template = constants.%Convert.11] // CHECK:STDOUT: %.loc14_35.2: = bound_method %.loc14_26.1, %.loc14_35.1 // CHECK:STDOUT: %.loc14_35.3: ref %D = temporary_storage // CHECK:STDOUT: %.loc14_26.2: %C.9 = bind_value %.loc14_26.1 @@ -1206,13 +1451,18 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: %.loc15_24.1: %.5 = struct_literal () // CHECK:STDOUT: %P.ref.loc15: = name_ref P, imports.%P [template = imports.%P] // CHECK:STDOUT: %C.ref.loc15: %C.type = name_ref C, imports.%import_ref.6 [template = constants.%C.1] -// CHECK:STDOUT: %.loc15_33: i32 = int_value 7 [template = constants.%.20] -// CHECK:STDOUT: %C.loc15: type = class_type @C, @C(constants.%.20) [template = constants.%C.10] +// CHECK:STDOUT: %.loc15_33: Core.IntLiteral = int_value 7 [template = constants.%.45] +// CHECK:STDOUT: %.loc15_32.1: %Convert.type.2 = interface_witness_access constants.%.13, element0 [template = constants.%Convert.3] +// CHECK:STDOUT: %.loc15_32.2: = bound_method %.loc15_33, %.loc15_32.1 [template = constants.%.46] +// CHECK:STDOUT: %int.convert_checked.loc15: init i32 = call %.loc15_32.2(%.loc15_33) [template = constants.%.25] +// CHECK:STDOUT: %.loc15_32.3: i32 = value_of_initializer %int.convert_checked.loc15 [template = constants.%.25] +// CHECK:STDOUT: %.loc15_32.4: i32 = converted %.loc15_33, %.loc15_32.3 [template = constants.%.25] +// CHECK:STDOUT: %C.loc15: type = class_type @C, @C(constants.%.25) [template = constants.%C.10] // CHECK:STDOUT: %.loc15_24.2: ref %C.10 = temporary_storage // CHECK:STDOUT: %.loc15_24.3: init %C.10 = class_init (), %.loc15_24.2 [template = constants.%struct.8] // CHECK:STDOUT: %.loc15_24.4: ref %C.10 = temporary %.loc15_24.2, %.loc15_24.3 // CHECK:STDOUT: %.loc15_26.1: ref %C.10 = converted %.loc15_24.1, %.loc15_24.4 -// CHECK:STDOUT: %.loc15_35.1: %Convert.type.2 = interface_witness_access constants.%.28, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %.loc15_35.1: %Convert.type.4 = interface_witness_access constants.%.47, element0 [template = constants.%Convert.12] // CHECK:STDOUT: %.loc15_35.2: = bound_method %.loc15_26.1, %.loc15_35.1 // CHECK:STDOUT: %.loc15_35.3: ref %D = temporary_storage // CHECK:STDOUT: %.loc15_26.2: %C.10 = bind_value %.loc15_26.1 @@ -1222,7 +1472,7 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: // CHECK:STDOUT: !if.else.loc15: // CHECK:STDOUT: %P.ref.loc16: = name_ref P, imports.%P [template = imports.%P] -// CHECK:STDOUT: %Make.ref: %Make.type = name_ref Make, imports.%import_ref.38 [template = constants.%Make] +// CHECK:STDOUT: %Make.ref: %Make.type = name_ref Make, imports.%import_ref.41 [template = constants.%Make] // CHECK:STDOUT: %.loc7_15.2: ref %D = splice_block %return {} // CHECK:STDOUT: %Make.call: init %D = call %Make.ref() to %.loc7_15.2 // CHECK:STDOUT: return %Make.call to %return @@ -1236,21 +1486,23 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: fn[%self.param_patt: @Convert.1.%Self (%Self.2)]() -> @Convert.1.%T (%T); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Convert.2[%self.param_patt: %C.3]() -> %D; +// CHECK:STDOUT: fn @Convert.2[%self.param_patt: Core.IntLiteral]() -> i32 = "int.convert_checked"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Convert.3[%self.param_patt: %C.4]() -> %D; +// CHECK:STDOUT: fn @Convert.3[%self.param_patt: %C.3]() -> %D; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Convert.4[%self.param_patt: %C.5]() -> %D; +// CHECK:STDOUT: fn @Convert.4[%self.param_patt: %C.4]() -> %D; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Convert.5[%self.param_patt: %C.6]() -> %D; +// CHECK:STDOUT: fn @Convert.5[%self.param_patt: %C.5]() -> %D; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Convert.6[%self.param_patt: %C.7]() -> %D; +// CHECK:STDOUT: fn @Convert.6[%self.param_patt: %C.6]() -> %D; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Convert.7[%self.param_patt: %C.8]() -> %D; +// CHECK:STDOUT: fn @Convert.7[%self.param_patt: %C.7]() -> %D; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Convert.8[%self.param_patt: %C.9]() -> %D; +// CHECK:STDOUT: fn @Convert.8[%self.param_patt: %C.8]() -> %D; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Convert.9[%self.param_patt: %C.10]() -> %D; +// CHECK:STDOUT: fn @Convert.9[%self.param_patt: %C.9]() -> %D; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Convert.10[%self.param_patt: %C.10]() -> %D; // CHECK:STDOUT: // CHECK:STDOUT: fn @Make() -> %D; // CHECK:STDOUT: @@ -1259,13 +1511,6 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: %N.patt => constants.%N // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @C(constants.%.7) { -// CHECK:STDOUT: %N => constants.%.7 -// CHECK:STDOUT: %N.patt => constants.%.7 -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: specific @ImplicitAs(constants.%T) { // CHECK:STDOUT: %T => constants.%T // CHECK:STDOUT: %T.patt => constants.%T @@ -1287,64 +1532,84 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: %Self => constants.%Self.1 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(constants.%D) { -// CHECK:STDOUT: %T => constants.%D -// CHECK:STDOUT: %T.patt => constants.%D +// CHECK:STDOUT: specific @ImplicitAs(i32) { +// CHECK:STDOUT: %T => i32 +// CHECK:STDOUT: %T.patt => i32 // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3 // CHECK:STDOUT: %Self => constants.%Self.2 // CHECK:STDOUT: %Convert.type => constants.%Convert.type.2 // CHECK:STDOUT: %Convert => constants.%Convert.2 -// CHECK:STDOUT: %.1 => constants.%.11 -// CHECK:STDOUT: %.2 => constants.%.12 +// CHECK:STDOUT: %.1 => constants.%.10 +// CHECK:STDOUT: %.2 => constants.%.11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @C(constants.%.14) { -// CHECK:STDOUT: %N => constants.%.14 -// CHECK:STDOUT: %N.patt => constants.%.14 +// CHECK:STDOUT: specific @C(constants.%.15) { +// CHECK:STDOUT: %N => constants.%.15 +// CHECK:STDOUT: %N.patt => constants.%.15 // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @C(constants.%.15) { -// CHECK:STDOUT: %N => constants.%.15 -// CHECK:STDOUT: %N.patt => constants.%.15 +// CHECK:STDOUT: specific @ImplicitAs(constants.%D) { +// CHECK:STDOUT: %T => constants.%D +// CHECK:STDOUT: %T.patt => constants.%D // CHECK:STDOUT: // CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.4 +// CHECK:STDOUT: %Self => constants.%Self.2 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.4 +// CHECK:STDOUT: %Convert => constants.%Convert.4 +// CHECK:STDOUT: %.1 => constants.%.17 +// CHECK:STDOUT: %.2 => constants.%.18 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @C(constants.%.16) { -// CHECK:STDOUT: %N => constants.%.16 -// CHECK:STDOUT: %N.patt => constants.%.16 +// CHECK:STDOUT: specific @C(constants.%.19) { +// CHECK:STDOUT: %N => constants.%.19 +// CHECK:STDOUT: %N.patt => constants.%.19 // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @C(constants.%.17) { -// CHECK:STDOUT: %N => constants.%.17 -// CHECK:STDOUT: %N.patt => constants.%.17 +// CHECK:STDOUT: specific @C(constants.%.20) { +// CHECK:STDOUT: %N => constants.%.20 +// CHECK:STDOUT: %N.patt => constants.%.20 // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @C(constants.%.18) { -// CHECK:STDOUT: %N => constants.%.18 -// CHECK:STDOUT: %N.patt => constants.%.18 +// CHECK:STDOUT: specific @C(constants.%.21) { +// CHECK:STDOUT: %N => constants.%.21 +// CHECK:STDOUT: %N.patt => constants.%.21 // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @C(constants.%.19) { -// CHECK:STDOUT: %N => constants.%.19 -// CHECK:STDOUT: %N.patt => constants.%.19 +// CHECK:STDOUT: specific @C(constants.%.22) { +// CHECK:STDOUT: %N => constants.%.22 +// CHECK:STDOUT: %N.patt => constants.%.22 // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @C(constants.%.20) { -// CHECK:STDOUT: %N => constants.%.20 -// CHECK:STDOUT: %N.patt => constants.%.20 +// CHECK:STDOUT: specific @C(constants.%.23) { +// CHECK:STDOUT: %N => constants.%.23 +// CHECK:STDOUT: %N.patt => constants.%.23 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @C(constants.%.24) { +// CHECK:STDOUT: %N => constants.%.24 +// CHECK:STDOUT: %N.patt => constants.%.24 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @C(constants.%.25) { +// CHECK:STDOUT: %N => constants.%.25 +// CHECK:STDOUT: %N.patt => constants.%.25 // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/return/returned_var.carbon b/toolchain/check/testdata/return/returned_var.carbon index 11ca897d57f6d..2478082e712eb 100644 --- a/toolchain/check/testdata/return/returned_var.carbon +++ b/toolchain/check/testdata/return/returned_var.carbon @@ -34,17 +34,29 @@ fn G() -> i32 { // CHECK:STDOUT: %.3: = complete_type_witness %.2 [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %.5: i32 = int_value 1 [template] -// CHECK:STDOUT: %.6: i32 = int_value 2 [template] -// CHECK:STDOUT: %struct: %C = struct_value (%.5, %.6) [template] +// CHECK:STDOUT: %.5: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.6: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.7: type = struct_type {.a: Core.IntLiteral, .b: Core.IntLiteral} [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: %.31: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.32: = bound_method %.5, %Convert.15 [template] +// CHECK:STDOUT: %.33: i32 = int_value 1 [template] +// CHECK:STDOUT: %.34: = bound_method %.6, %Convert.15 [template] +// CHECK:STDOUT: %.35: i32 = int_value 2 [template] +// CHECK:STDOUT: %struct: %C = struct_value (%.33, %.35) [template] // CHECK:STDOUT: %G.type: type = fn_type @G [template] // CHECK:STDOUT: %G: %G.type = struct_value () [template] -// CHECK:STDOUT: %.7: i32 = int_value 0 [template] +// CHECK:STDOUT: %.36: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %.37: = bound_method %.36, %Convert.15 [template] +// CHECK:STDOUT: %.38: i32 = int_value 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -100,15 +112,23 @@ fn G() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.ref.loc17: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %result: ref %C = bind_name result, %return -// CHECK:STDOUT: %.loc17_34: i32 = int_value 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc17_42: i32 = int_value 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc17_43.1: %.2 = struct_literal (%.loc17_34, %.loc17_42) -// CHECK:STDOUT: %.loc17_43.2: ref i32 = class_element_access %return, element0 -// CHECK:STDOUT: %.loc17_43.3: init i32 = initialize_from %.loc17_34 to %.loc17_43.2 [template = constants.%.5] -// CHECK:STDOUT: %.loc17_43.4: ref i32 = class_element_access %return, element1 -// CHECK:STDOUT: %.loc17_43.5: init i32 = initialize_from %.loc17_42 to %.loc17_43.4 [template = constants.%.6] -// CHECK:STDOUT: %.loc17_43.6: init %C = class_init (%.loc17_43.3, %.loc17_43.5), %return [template = constants.%struct] -// CHECK:STDOUT: %.loc17_44: init %C = converted %.loc17_43.1, %.loc17_43.6 [template = constants.%struct] +// CHECK:STDOUT: %.loc17_34: Core.IntLiteral = int_value 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc17_42: Core.IntLiteral = int_value 2 [template = constants.%.6] +// CHECK:STDOUT: %.loc17_43.1: %.7 = struct_literal (%.loc17_34, %.loc17_42) +// CHECK:STDOUT: %.loc17_43.2: %Convert.type.2 = interface_witness_access constants.%.31, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc17_43.3: = bound_method %.loc17_34, %.loc17_43.2 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc17_43.1: init i32 = call %.loc17_43.3(%.loc17_34) [template = constants.%.33] +// CHECK:STDOUT: %.loc17_43.4: init i32 = converted %.loc17_34, %int.convert_checked.loc17_43.1 [template = constants.%.33] +// CHECK:STDOUT: %.loc17_43.5: ref i32 = class_element_access %return, element0 +// CHECK:STDOUT: %.loc17_43.6: init i32 = initialize_from %.loc17_43.4 to %.loc17_43.5 [template = constants.%.33] +// CHECK:STDOUT: %.loc17_43.7: %Convert.type.2 = interface_witness_access constants.%.31, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc17_43.8: = bound_method %.loc17_42, %.loc17_43.7 [template = constants.%.34] +// CHECK:STDOUT: %int.convert_checked.loc17_43.2: init i32 = call %.loc17_43.8(%.loc17_42) [template = constants.%.35] +// CHECK:STDOUT: %.loc17_43.9: init i32 = converted %.loc17_42, %int.convert_checked.loc17_43.2 [template = constants.%.35] +// CHECK:STDOUT: %.loc17_43.10: ref i32 = class_element_access %return, element1 +// CHECK:STDOUT: %.loc17_43.11: init i32 = initialize_from %.loc17_43.9 to %.loc17_43.10 [template = constants.%.35] +// CHECK:STDOUT: %.loc17_43.12: init %C = class_init (%.loc17_43.6, %.loc17_43.11), %return [template = constants.%struct] +// CHECK:STDOUT: %.loc17_44: init %C = converted %.loc17_43.1, %.loc17_43.12 [template = constants.%struct] // CHECK:STDOUT: assign %return, %.loc17_44 // CHECK:STDOUT: return %result to %return // CHECK:STDOUT: } @@ -120,8 +140,12 @@ fn G() -> i32 { // CHECK:STDOUT: %.loc22_24.2: type = converted %int.make_type_32.loc22, %.loc22_24.1 [template = i32] // CHECK:STDOUT: %result.var: ref i32 = var result // CHECK:STDOUT: %result: ref i32 = bind_name result, %result.var -// CHECK:STDOUT: %.loc22_30: i32 = int_value 0 [template = constants.%.7] -// CHECK:STDOUT: assign %result.var, %.loc22_30 +// CHECK:STDOUT: %.loc22_30: Core.IntLiteral = int_value 0 [template = constants.%.36] +// CHECK:STDOUT: %.loc22_31.1: %Convert.type.2 = interface_witness_access constants.%.31, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc22_31.2: = bound_method %.loc22_30, %.loc22_31.1 [template = constants.%.37] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc22_31.2(%.loc22_30) [template = constants.%.38] +// CHECK:STDOUT: %.loc22_31.3: init i32 = converted %.loc22_30, %int.convert_checked [template = constants.%.38] +// CHECK:STDOUT: assign %result.var, %.loc22_31.3 // CHECK:STDOUT: %.loc22_16: i32 = bind_value %result // CHECK:STDOUT: return %.loc22_16 // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/return/returned_var_scope.carbon b/toolchain/check/testdata/return/returned_var_scope.carbon index 3e7dc5d7fd9a3..c5247484ec19d 100644 --- a/toolchain/check/testdata/return/returned_var_scope.carbon +++ b/toolchain/check/testdata/return/returned_var_scope.carbon @@ -35,8 +35,16 @@ fn EnclosingButAfter(b: bool) -> i32 { // CHECK:STDOUT: %UnrelatedScopes.type: type = fn_type @UnrelatedScopes [template] // CHECK:STDOUT: %UnrelatedScopes: %UnrelatedScopes.type = struct_value () [template] // CHECK:STDOUT: %.1: bool = bool_literal true [template] -// CHECK:STDOUT: %.2: i32 = int_value 0 [template] -// CHECK:STDOUT: %.3: i32 = int_value 1 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 0 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.27: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.28: i32 = int_value 0 [template] +// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.30: = bound_method %.29, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 1 [template] // CHECK:STDOUT: %Bool.type: type = fn_type @Bool [template] // CHECK:STDOUT: %Bool: %Bool.type = struct_value () [template] // CHECK:STDOUT: %EnclosingButAfter.type: type = fn_type @EnclosingButAfter [template] @@ -46,7 +54,8 @@ fn EnclosingButAfter(b: bool) -> i32 { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int32 = %import_ref.1 -// CHECK:STDOUT: .Bool = %import_ref.2 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 +// CHECK:STDOUT: .Bool = %import_ref.51 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -99,8 +108,12 @@ fn EnclosingButAfter(b: bool) -> i32 { // CHECK:STDOUT: %.loc13_21.2: type = converted %int.make_type_32.loc13, %.loc13_21.1 [template = i32] // CHECK:STDOUT: %v.var: ref i32 = var v // CHECK:STDOUT: %v: ref i32 = bind_name v, %v.var -// CHECK:STDOUT: %.loc13_27: i32 = int_value 0 [template = constants.%.2] -// CHECK:STDOUT: assign %v.var, %.loc13_27 +// CHECK:STDOUT: %.loc13_27: Core.IntLiteral = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc13_28.1: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_28.2: = bound_method %.loc13_27, %.loc13_28.1 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc13: init i32 = call %.loc13_28.2(%.loc13_27) [template = constants.%.28] +// CHECK:STDOUT: %.loc13_28.3: init i32 = converted %.loc13_27, %int.convert_checked.loc13 [template = constants.%.28] +// CHECK:STDOUT: assign %v.var, %.loc13_28.3 // CHECK:STDOUT: br !if.else.loc12 // CHECK:STDOUT: // CHECK:STDOUT: !if.else.loc12: @@ -113,13 +126,22 @@ fn EnclosingButAfter(b: bool) -> i32 { // CHECK:STDOUT: %.loc16_21.2: type = converted %int.make_type_32.loc16, %.loc16_21.1 [template = i32] // CHECK:STDOUT: %w.var: ref i32 = var w // CHECK:STDOUT: %w: ref i32 = bind_name w, %w.var -// CHECK:STDOUT: %.loc16_27: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: assign %w.var, %.loc16_27 +// CHECK:STDOUT: %.loc16_27: Core.IntLiteral = int_value 1 [template = constants.%.29] +// CHECK:STDOUT: %.loc16_28.1: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc16_28.2: = bound_method %.loc16_27, %.loc16_28.1 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc16: init i32 = call %.loc16_28.2(%.loc16_27) [template = constants.%.31] +// CHECK:STDOUT: %.loc16_28.3: init i32 = converted %.loc16_27, %int.convert_checked.loc16 [template = constants.%.31] +// CHECK:STDOUT: assign %w.var, %.loc16_28.3 // CHECK:STDOUT: br !if.else.loc15 // CHECK:STDOUT: // CHECK:STDOUT: !if.else.loc15: -// CHECK:STDOUT: %.loc18: i32 = int_value 0 [template = constants.%.2] -// CHECK:STDOUT: return %.loc18 +// CHECK:STDOUT: %.loc18_10: Core.IntLiteral = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc18_11.1: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc18_11.2: = bound_method %.loc18_10, %.loc18_11.1 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc18: init i32 = call %.loc18_11.2(%.loc18_10) [template = constants.%.28] +// CHECK:STDOUT: %.loc18_11.3: i32 = value_of_initializer %int.convert_checked.loc18 [template = constants.%.28] +// CHECK:STDOUT: %.loc18_11.4: i32 = converted %.loc18_10, %.loc18_11.3 [template = constants.%.28] +// CHECK:STDOUT: return %.loc18_11.4 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @EnclosingButAfter(%b.param_patt: bool) -> i32 { @@ -133,8 +155,12 @@ fn EnclosingButAfter(b: bool) -> i32 { // CHECK:STDOUT: %.loc23_21.2: type = converted %int.make_type_32.loc23, %.loc23_21.1 [template = i32] // CHECK:STDOUT: %v.var: ref i32 = var v // CHECK:STDOUT: %v: ref i32 = bind_name v, %v.var -// CHECK:STDOUT: %.loc23_27: i32 = int_value 0 [template = constants.%.2] -// CHECK:STDOUT: assign %v.var, %.loc23_27 +// CHECK:STDOUT: %.loc23_27: Core.IntLiteral = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc23_28.1: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc23_28.2: = bound_method %.loc23_27, %.loc23_28.1 [template = constants.%.27] +// CHECK:STDOUT: %int.convert_checked.loc23: init i32 = call %.loc23_28.2(%.loc23_27) [template = constants.%.28] +// CHECK:STDOUT: %.loc23_28.3: init i32 = converted %.loc23_27, %int.convert_checked.loc23 [template = constants.%.28] +// CHECK:STDOUT: assign %v.var, %.loc23_28.3 // CHECK:STDOUT: %.loc23_18: i32 = bind_value %v // CHECK:STDOUT: return %.loc23_18 // CHECK:STDOUT: @@ -144,8 +170,12 @@ fn EnclosingButAfter(b: bool) -> i32 { // CHECK:STDOUT: %.loc26_19.2: type = converted %int.make_type_32.loc26, %.loc26_19.1 [template = i32] // CHECK:STDOUT: %w.var: ref i32 = var w // CHECK:STDOUT: %w: ref i32 = bind_name w, %w.var -// CHECK:STDOUT: %.loc26_25: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: assign %w.var, %.loc26_25 +// CHECK:STDOUT: %.loc26_25: Core.IntLiteral = int_value 1 [template = constants.%.29] +// CHECK:STDOUT: %.loc26_26.1: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc26_26.2: = bound_method %.loc26_25, %.loc26_26.1 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc26: init i32 = call %.loc26_26.2(%.loc26_25) [template = constants.%.31] +// CHECK:STDOUT: %.loc26_26.3: init i32 = converted %.loc26_25, %int.convert_checked.loc26 [template = constants.%.31] +// CHECK:STDOUT: assign %w.var, %.loc26_26.3 // CHECK:STDOUT: %.loc26_16: i32 = bind_value %w // CHECK:STDOUT: return %.loc26_16 // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/return/struct.carbon b/toolchain/check/testdata/return/struct.carbon index bafef4f3227e1..b00c14b44c068 100644 --- a/toolchain/check/testdata/return/struct.carbon +++ b/toolchain/check/testdata/return/struct.carbon @@ -20,13 +20,21 @@ fn Main() -> {.a: i32} { // CHECK:STDOUT: %.1: type = struct_type {.a: i32} [template] // CHECK:STDOUT: %Main.type: type = fn_type @Main [template] // CHECK:STDOUT: %Main: %Main.type = struct_value () [template] -// CHECK:STDOUT: %.2: i32 = int_value 3 [template] -// CHECK:STDOUT: %struct: %.1 = struct_value (%.2) [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.3: type = struct_type {.a: Core.IntLiteral} [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: %.27: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.28: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.29: i32 = int_value 3 [template] +// CHECK:STDOUT: %struct: %.1 = struct_value (%.29) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -53,10 +61,15 @@ fn Main() -> {.a: i32} { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> %.1 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc12_16: i32 = int_value 3 [template = constants.%.2] -// CHECK:STDOUT: %.loc12_17: %.1 = struct_literal (%.loc12_16) -// CHECK:STDOUT: %struct: %.1 = struct_value (%.loc12_16) [template = constants.%struct] -// CHECK:STDOUT: %.loc12_18: %.1 = converted %.loc12_17, %struct [template = constants.%struct] +// CHECK:STDOUT: %.loc12_16: Core.IntLiteral = int_value 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc12_17.1: %.3 = struct_literal (%.loc12_16) +// CHECK:STDOUT: %.loc12_17.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_17.3: = bound_method %.loc12_16, %.loc12_17.2 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc12_17.3(%.loc12_16) [template = constants.%.29] +// CHECK:STDOUT: %.loc12_17.4: i32 = value_of_initializer %int.convert_checked [template = constants.%.29] +// CHECK:STDOUT: %.loc12_17.5: i32 = converted %.loc12_16, %.loc12_17.4 [template = constants.%.29] +// CHECK:STDOUT: %struct: %.1 = struct_value (%.loc12_17.5) [template = constants.%struct] +// CHECK:STDOUT: %.loc12_18: %.1 = converted %.loc12_17.1, %struct [template = constants.%struct] // CHECK:STDOUT: return %.loc12_18 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/tuple.carbon b/toolchain/check/testdata/return/tuple.carbon index 2241716fb0d07..4067f94249096 100644 --- a/toolchain/check/testdata/return/tuple.carbon +++ b/toolchain/check/testdata/return/tuple.carbon @@ -22,14 +22,24 @@ fn Main() -> (i32, i32) { // CHECK:STDOUT: %tuple.type.2: type = tuple_type (i32, i32) [template] // CHECK:STDOUT: %Main.type: type = fn_type @Main [template] // CHECK:STDOUT: %Main: %Main.type = struct_value () [template] -// CHECK:STDOUT: %.2: i32 = int_value 15 [template] -// CHECK:STDOUT: %.3: i32 = int_value 35 [template] -// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.2, %.3) [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 15 [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 35 [template] +// CHECK:STDOUT: %tuple.type.3: type = tuple_type (Core.IntLiteral, Core.IntLiteral) [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: %.27: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.28: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.29: i32 = int_value 15 [template] +// CHECK:STDOUT: %.30: = bound_method %.3, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 35 [template] +// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.29, %.31) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -60,15 +70,23 @@ fn Main() -> (i32, i32) { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> %return: %tuple.type.2 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc13_11: i32 = int_value 15 [template = constants.%.2] -// CHECK:STDOUT: %.loc13_15: i32 = int_value 35 [template = constants.%.3] -// CHECK:STDOUT: %.loc13_17.1: %tuple.type.2 = tuple_literal (%.loc13_11, %.loc13_15) -// CHECK:STDOUT: %.loc13_17.2: ref i32 = tuple_access %return, element0 -// CHECK:STDOUT: %.loc13_17.3: init i32 = initialize_from %.loc13_11 to %.loc13_17.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc13_17.4: ref i32 = tuple_access %return, element1 -// CHECK:STDOUT: %.loc13_17.5: init i32 = initialize_from %.loc13_15 to %.loc13_17.4 [template = constants.%.3] -// CHECK:STDOUT: %.loc13_17.6: init %tuple.type.2 = tuple_init (%.loc13_17.3, %.loc13_17.5) to %return [template = constants.%tuple] -// CHECK:STDOUT: %.loc13_18: init %tuple.type.2 = converted %.loc13_17.1, %.loc13_17.6 [template = constants.%tuple] +// CHECK:STDOUT: %.loc13_11: Core.IntLiteral = int_value 15 [template = constants.%.2] +// CHECK:STDOUT: %.loc13_15: Core.IntLiteral = int_value 35 [template = constants.%.3] +// CHECK:STDOUT: %.loc13_17.1: %tuple.type.3 = tuple_literal (%.loc13_11, %.loc13_15) +// CHECK:STDOUT: %.loc13_17.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_17.3: = bound_method %.loc13_11, %.loc13_17.2 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked.loc13_17.1: init i32 = call %.loc13_17.3(%.loc13_11) [template = constants.%.29] +// CHECK:STDOUT: %.loc13_17.4: init i32 = converted %.loc13_11, %int.convert_checked.loc13_17.1 [template = constants.%.29] +// CHECK:STDOUT: %.loc13_17.5: ref i32 = tuple_access %return, element0 +// CHECK:STDOUT: %.loc13_17.6: init i32 = initialize_from %.loc13_17.4 to %.loc13_17.5 [template = constants.%.29] +// CHECK:STDOUT: %.loc13_17.7: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc13_17.8: = bound_method %.loc13_15, %.loc13_17.7 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc13_17.2: init i32 = call %.loc13_17.8(%.loc13_15) [template = constants.%.31] +// CHECK:STDOUT: %.loc13_17.9: init i32 = converted %.loc13_15, %int.convert_checked.loc13_17.2 [template = constants.%.31] +// CHECK:STDOUT: %.loc13_17.10: ref i32 = tuple_access %return, element1 +// CHECK:STDOUT: %.loc13_17.11: init i32 = initialize_from %.loc13_17.9 to %.loc13_17.10 [template = constants.%.31] +// CHECK:STDOUT: %.loc13_17.12: init %tuple.type.2 = tuple_init (%.loc13_17.6, %.loc13_17.11) to %return [template = constants.%tuple] +// CHECK:STDOUT: %.loc13_18: init %tuple.type.2 = converted %.loc13_17.1, %.loc13_17.12 [template = constants.%tuple] // CHECK:STDOUT: return %.loc13_18 to %return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/value.carbon b/toolchain/check/testdata/return/value.carbon index 7c7850db7b023..2adbe58545225 100644 --- a/toolchain/check/testdata/return/value.carbon +++ b/toolchain/check/testdata/return/value.carbon @@ -19,12 +19,19 @@ fn Main() -> i32 { // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %Main.type: type = fn_type @Main [template] // CHECK:STDOUT: %Main: %Main.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -50,7 +57,12 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc12: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: return %.loc12 +// CHECK:STDOUT: %.loc12_10: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc12_11.1: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_11.2: = bound_method %.loc12_10, %.loc12_11.1 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc12_11.2(%.loc12_10) [template = constants.%.27] +// CHECK:STDOUT: %.loc12_11.3: i32 = value_of_initializer %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc12_11.4: i32 = converted %.loc12_10, %.loc12_11.3 [template = constants.%.27] +// CHECK:STDOUT: return %.loc12_11.4 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/struct/fail_assign_to_empty.carbon b/toolchain/check/testdata/struct/fail_assign_to_empty.carbon index 92e379f7d6ad8..84f04e61f5a6b 100644 --- a/toolchain/check/testdata/struct/fail_assign_to_empty.carbon +++ b/toolchain/check/testdata/struct/fail_assign_to_empty.carbon @@ -17,8 +17,8 @@ var x: {} = {.a = 1}; // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = struct_type {} [template] -// CHECK:STDOUT: %.2: i32 = int_value 1 [template] -// CHECK:STDOUT: %.3: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.3: type = struct_type {.a: Core.IntLiteral} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -42,7 +42,7 @@ var x: {} = {.a = 1}; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc14_19: i32 = int_value 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc14_19: Core.IntLiteral = int_value 1 [template = constants.%.2] // CHECK:STDOUT: %.loc14_20: %.3 = struct_literal (%.loc14_19) // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/struct/fail_duplicate_name.carbon b/toolchain/check/testdata/struct/fail_duplicate_name.carbon index 7fa55aad429b9..34bacc81a2718 100644 --- a/toolchain/check/testdata/struct/fail_duplicate_name.carbon +++ b/toolchain/check/testdata/struct/fail_duplicate_name.carbon @@ -59,12 +59,13 @@ var y: {.b: i32, .c: i32} = {.b = 3, .b = 4}; // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %.2: type = struct_type {.a: i32} [template] -// CHECK:STDOUT: %.3: i32 = int_value 2 [template] -// CHECK:STDOUT: %.4: type = struct_type {.b: i32, .c: i32} [template] -// CHECK:STDOUT: %.6: i32 = int_value 3 [template] -// CHECK:STDOUT: %.7: i32 = int_value 4 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.2: type = struct_type {.a: Core.IntLiteral} [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.4: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %.5: type = struct_type {.b: i32, .c: i32} [template] +// CHECK:STDOUT: %.7: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.8: Core.IntLiteral = int_value 4 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -119,35 +120,35 @@ var y: {.b: i32, .c: i32} = {.b = 3, .b = 4}; // CHECK:STDOUT: %int.make_type_32.loc45: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc45_13.1: type = value_of_initializer %int.make_type_32.loc45 [template = i32] // CHECK:STDOUT: %.loc45_13.2: type = converted %int.make_type_32.loc45, %.loc45_13.1 [template = i32] -// CHECK:STDOUT: %.loc45_16: type = struct_type {.a: i32} [template = constants.%.2] -// CHECK:STDOUT: %x.var: ref %.2 = var x -// CHECK:STDOUT: %x: ref %.2 = bind_name x, %x.var +// CHECK:STDOUT: %.loc45_16: type = struct_type {.a: i32} [template = constants.%.4] +// CHECK:STDOUT: %x.var: ref %.4 = var x +// CHECK:STDOUT: %x: ref %.4 = bind_name x, %x.var // CHECK:STDOUT: %int.make_type_32.loc53_13: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc53_13.1: type = value_of_initializer %int.make_type_32.loc53_13 [template = i32] // CHECK:STDOUT: %.loc53_13.2: type = converted %int.make_type_32.loc53_13, %.loc53_13.1 [template = i32] // CHECK:STDOUT: %int.make_type_32.loc53_22: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc53_22.1: type = value_of_initializer %int.make_type_32.loc53_22 [template = i32] // CHECK:STDOUT: %.loc53_22.2: type = converted %int.make_type_32.loc53_22, %.loc53_22.1 [template = i32] -// CHECK:STDOUT: %.loc53_25: type = struct_type {.b: i32, .c: i32} [template = constants.%.4] -// CHECK:STDOUT: %y.var: ref %.4 = var y -// CHECK:STDOUT: %y: ref %.4 = bind_name y, %y.var +// CHECK:STDOUT: %.loc53_25: type = struct_type {.b: i32, .c: i32} [template = constants.%.5] +// CHECK:STDOUT: %y.var: ref %.5 = var y +// CHECK:STDOUT: %y: ref %.5 = bind_name y, %y.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> ; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc27_35: i32 = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc27_35: Core.IntLiteral = int_value 1 [template = constants.%.1] // CHECK:STDOUT: %.loc27_36: %.2 = struct_literal (%.loc27_35) // CHECK:STDOUT: %v: = bind_name v, -// CHECK:STDOUT: %.loc36_22: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc36_32: i32 = int_value 2 [template = constants.%.3] +// CHECK:STDOUT: %.loc36_22: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc36_32: Core.IntLiteral = int_value 2 [template = constants.%.3] // CHECK:STDOUT: %w: i32 = bind_name w, -// CHECK:STDOUT: %.loc45_26: i32 = int_value 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc45_34: i32 = int_value 2 [template = constants.%.3] +// CHECK:STDOUT: %.loc45_26: Core.IntLiteral = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc45_34: Core.IntLiteral = int_value 2 [template = constants.%.3] // CHECK:STDOUT: assign file.%x.var, -// CHECK:STDOUT: %.loc53_35: i32 = int_value 3 [template = constants.%.6] -// CHECK:STDOUT: %.loc53_43: i32 = int_value 4 [template = constants.%.7] +// CHECK:STDOUT: %.loc53_35: Core.IntLiteral = int_value 3 [template = constants.%.7] +// CHECK:STDOUT: %.loc53_43: Core.IntLiteral = int_value 4 [template = constants.%.8] // CHECK:STDOUT: assign file.%y.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/fail_field_name_mismatch.carbon b/toolchain/check/testdata/struct/fail_field_name_mismatch.carbon index 2b01c027478c6..df3088274a853 100644 --- a/toolchain/check/testdata/struct/fail_field_name_mismatch.carbon +++ b/toolchain/check/testdata/struct/fail_field_name_mismatch.carbon @@ -25,8 +25,9 @@ var y: {.b: i32} = x; // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %.1: type = struct_type {.a: i32} [template] -// CHECK:STDOUT: %.2: i32 = int_value 1 [template] -// CHECK:STDOUT: %.3: type = struct_type {.b: i32} [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.3: type = struct_type {.b: Core.IntLiteral} [template] +// CHECK:STDOUT: %.4: type = struct_type {.b: i32} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -53,14 +54,14 @@ var y: {.b: i32} = x; // CHECK:STDOUT: %int.make_type_32.loc20: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc20_13.1: type = value_of_initializer %int.make_type_32.loc20 [template = i32] // CHECK:STDOUT: %.loc20_13.2: type = converted %int.make_type_32.loc20, %.loc20_13.1 [template = i32] -// CHECK:STDOUT: %.loc20_16: type = struct_type {.b: i32} [template = constants.%.3] -// CHECK:STDOUT: %y.var: ref %.3 = var y -// CHECK:STDOUT: %y: ref %.3 = bind_name y, %y.var +// CHECK:STDOUT: %.loc20_16: type = struct_type {.b: i32} [template = constants.%.4] +// CHECK:STDOUT: %y.var: ref %.4 = var y +// CHECK:STDOUT: %y: ref %.4 = bind_name y, %y.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_26: i32 = int_value 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_26: Core.IntLiteral = int_value 1 [template = constants.%.2] // CHECK:STDOUT: %.loc15_27: %.3 = struct_literal (%.loc15_26) // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: %x.ref: ref %.1 = name_ref x, file.%x diff --git a/toolchain/check/testdata/struct/fail_non_member_access.carbon b/toolchain/check/testdata/struct/fail_non_member_access.carbon index b4340c15e85e2..391d3b5452208 100644 --- a/toolchain/check/testdata/struct/fail_non_member_access.carbon +++ b/toolchain/check/testdata/struct/fail_non_member_access.carbon @@ -20,13 +20,21 @@ var y: i32 = x.b; // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %.1: type = struct_type {.a: i32} [template] -// CHECK:STDOUT: %.2: i32 = int_value 4 [template] -// CHECK:STDOUT: %struct: %.1 = struct_value (%.2) [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 4 [template] +// CHECK:STDOUT: %.3: type = struct_type {.a: Core.IntLiteral} [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: %.27: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.28: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.29: i32 = int_value 4 [template] +// CHECK:STDOUT: %struct: %.1 = struct_value (%.29) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -54,10 +62,14 @@ var y: i32 = x.b; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_26: i32 = int_value 4 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_27.1: %.1 = struct_literal (%.loc11_26) -// CHECK:STDOUT: %.loc11_27.2: init %.1 = struct_init (%.loc11_26) to file.%x.var [template = constants.%struct] -// CHECK:STDOUT: %.loc11_28: init %.1 = converted %.loc11_27.1, %.loc11_27.2 [template = constants.%struct] +// CHECK:STDOUT: %.loc11_26: Core.IntLiteral = int_value 4 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_27.1: %.3 = struct_literal (%.loc11_26) +// CHECK:STDOUT: %.loc11_27.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_27.3: = bound_method %.loc11_26, %.loc11_27.2 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc11_27.3(%.loc11_26) [template = constants.%.29] +// CHECK:STDOUT: %.loc11_27.4: init i32 = converted %.loc11_26, %int.convert_checked [template = constants.%.29] +// CHECK:STDOUT: %.loc11_27.5: init %.1 = struct_init (%.loc11_27.4) to file.%x.var [template = constants.%struct] +// CHECK:STDOUT: %.loc11_28: init %.1 = converted %.loc11_27.1, %.loc11_27.5 [template = constants.%struct] // CHECK:STDOUT: assign file.%x.var, %.loc11_28 // CHECK:STDOUT: %x.ref: ref %.1 = name_ref x, file.%x // CHECK:STDOUT: assign file.%y.var, diff --git a/toolchain/check/testdata/struct/fail_too_few_values.carbon b/toolchain/check/testdata/struct/fail_too_few_values.carbon index 5eafd67a11caa..08620a960b0ee 100644 --- a/toolchain/check/testdata/struct/fail_too_few_values.carbon +++ b/toolchain/check/testdata/struct/fail_too_few_values.carbon @@ -19,8 +19,8 @@ var x: {.a: i32, .b: i32} = {.a = 1}; // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %.1: type = struct_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.3: i32 = int_value 1 [template] -// CHECK:STDOUT: %.4: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.4: type = struct_type {.a: Core.IntLiteral} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -50,7 +50,7 @@ var x: {.a: i32, .b: i32} = {.a = 1}; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc14_35: i32 = int_value 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc14_35: Core.IntLiteral = int_value 1 [template = constants.%.3] // CHECK:STDOUT: %.loc14_36: %.4 = struct_literal (%.loc14_35) // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/struct/fail_value_as_type.carbon b/toolchain/check/testdata/struct/fail_value_as_type.carbon index 9e5e7cb00995b..00c70a09533d8 100644 --- a/toolchain/check/testdata/struct/fail_value_as_type.carbon +++ b/toolchain/check/testdata/struct/fail_value_as_type.carbon @@ -8,10 +8,10 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_value_as_type.carbon -// CHECK:STDERR: fail_value_as_type.carbon:[[@LINE+6]]:8: error: cannot implicitly convert from `{.a: i32}` to `type` [ImplicitAsConversionFailure] +// CHECK:STDERR: fail_value_as_type.carbon:[[@LINE+6]]:8: error: cannot implicitly convert from `{.a: Core.IntLiteral}` to `type` [ImplicitAsConversionFailure] // CHECK:STDERR: var x: {.a = 1}; // CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_value_as_type.carbon:[[@LINE+3]]:8: note: type `{.a: i32}` does not implement interface `ImplicitAs(type)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_value_as_type.carbon:[[@LINE+3]]:8: note: type `{.a: Core.IntLiteral}` does not implement interface `ImplicitAs(type)` [MissingImplInMemberAccessNote] // CHECK:STDERR: var x: {.a = 1}; // CHECK:STDERR: ^~~~~~~~ var x: {.a = 1}; @@ -19,8 +19,8 @@ var x: {.a = 1}; // CHECK:STDOUT: --- fail_value_as_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %.2: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.2: type = struct_type {.a: Core.IntLiteral} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -37,7 +37,7 @@ var x: {.a = 1}; // CHECK:STDOUT: .x = %x // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %.loc17_14: i32 = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc17_14: Core.IntLiteral = int_value 1 [template = constants.%.1] // CHECK:STDOUT: %.loc17_15.1: %.2 = struct_literal (%.loc17_14) // CHECK:STDOUT: %.loc17_15.2: type = converted %.loc17_15.1, [template = ] // CHECK:STDOUT: %x.var: ref = var x diff --git a/toolchain/check/testdata/struct/import.carbon b/toolchain/check/testdata/struct/import.carbon index 662fe7c19463c..60e6e87df5e16 100644 --- a/toolchain/check/testdata/struct/import.carbon +++ b/toolchain/check/testdata/struct/import.carbon @@ -43,10 +43,10 @@ var c_bad: C({.c = 1, .d = 2}) = F(); // --- fail_bad_value.impl.carbon impl package Implicit; -// CHECK:STDERR: fail_bad_value.impl.carbon:[[@LINE+6]]:1: error: cannot implicitly convert from `C()` to `C()` [ImplicitAsConversionFailure] +// CHECK:STDERR: fail_bad_value.impl.carbon:[[@LINE+6]]:1: error: cannot implicitly convert from `C()` to `C()` [ImplicitAsConversionFailure] // CHECK:STDERR: var c_bad: C({.a = 3, .b = 4}) = F(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_bad_value.impl.carbon:[[@LINE+3]]:1: note: type `C()` does not implement interface `ImplicitAs(C())` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_bad_value.impl.carbon:[[@LINE+3]]:1: note: type `C()` does not implement interface `ImplicitAs(C())` [MissingImplInMemberAccessNote] // CHECK:STDERR: var c_bad: C({.a = 3, .b = 4}) = F(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var c_bad: C({.a = 3, .b = 4}) = F(); @@ -57,26 +57,41 @@ var c_bad: C({.a = 3, .b = 4}) = F(); // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %.1: type = struct_type {.a: i32} [template] -// CHECK:STDOUT: %.2: i32 = int_value 0 [template] -// CHECK:STDOUT: %struct.1: %.1 = struct_value (%.2) [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %.3: type = struct_type {.a: Core.IntLiteral} [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: %.27: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.28: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.29: i32 = int_value 0 [template] +// CHECK:STDOUT: %struct.1: %.1 = struct_value (%.29) [template] // CHECK:STDOUT: %tuple.type.1: type = tuple_type (type) [template] // CHECK:STDOUT: %tuple.type.2: type = tuple_type (i32) [template] -// CHECK:STDOUT: %.3: type = struct_type {.b: i32, .c: %tuple.type.2} [template] -// CHECK:STDOUT: %.4: type = struct_type {.a: %.3, .d: i32} [template] -// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.2) [template] -// CHECK:STDOUT: %struct.2: %.3 = struct_value (%.2, %tuple) [template] -// CHECK:STDOUT: %struct.3: %.4 = struct_value (%struct.2, %.2) [template] -// CHECK:STDOUT: %.8: type = struct_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %S: %.8 = bind_symbolic_name S, 0 [symbolic] -// CHECK:STDOUT: %S.patt: %.8 = symbolic_binding_pattern S, 0 [symbolic] +// CHECK:STDOUT: %.30: type = struct_type {.b: i32, .c: %tuple.type.2} [template] +// CHECK:STDOUT: %.31: type = struct_type {.a: %.30, .d: i32} [template] +// CHECK:STDOUT: %tuple.type.3: type = tuple_type (Core.IntLiteral) [template] +// CHECK:STDOUT: %.35: type = struct_type {.b: Core.IntLiteral, .c: %tuple.type.3} [template] +// CHECK:STDOUT: %.36: type = struct_type {.a: %.35, .d: Core.IntLiteral} [template] +// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.29) [template] +// CHECK:STDOUT: %struct.2: %.30 = struct_value (%.29, %tuple) [template] +// CHECK:STDOUT: %struct.3: %.31 = struct_value (%struct.2, %.29) [template] +// CHECK:STDOUT: %.37: type = struct_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %S: %.37 = bind_symbolic_name S, 0 [symbolic] +// CHECK:STDOUT: %S.patt: %.37 = symbolic_binding_pattern S, 0 [symbolic] // CHECK:STDOUT: %C.type: type = generic_class_type @C [template] // CHECK:STDOUT: %C.1: %C.type = struct_value () [template] // CHECK:STDOUT: %C.2: type = class_type @C, @C(%S) [symbolic] -// CHECK:STDOUT: %.9: type = struct_type {} [template] -// CHECK:STDOUT: %.10: = complete_type_witness %.9 [template] -// CHECK:STDOUT: %.11: i32 = int_value 1 [template] -// CHECK:STDOUT: %.12: i32 = int_value 2 [template] -// CHECK:STDOUT: %struct.4: %.8 = struct_value (%.11, %.12) [template] +// CHECK:STDOUT: %.38: type = struct_type {} [template] +// CHECK:STDOUT: %.39: = complete_type_witness %.38 [template] +// CHECK:STDOUT: %.40: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.41: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.42: type = struct_type {.a: Core.IntLiteral, .b: Core.IntLiteral} [template] +// CHECK:STDOUT: %.44: = bound_method %.40, %Convert.15 [template] +// CHECK:STDOUT: %.45: i32 = int_value 1 [template] +// CHECK:STDOUT: %.46: = bound_method %.41, %Convert.15 [template] +// CHECK:STDOUT: %.47: i32 = int_value 2 [template] +// CHECK:STDOUT: %struct.4: %.37 = struct_value (%.45, %.47) [template] // CHECK:STDOUT: %C.3: type = class_type @C, @C(%struct.4) [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] @@ -84,7 +99,8 @@ var c_bad: C({.a = 3, .b = 4}) = F(); // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -113,16 +129,16 @@ var c_bad: C({.a = 3, .b = 4}) = F(); // CHECK:STDOUT: %.loc5_36.2: type = value_of_initializer %int.make_type_32.loc5_32 [template = i32] // CHECK:STDOUT: %.loc5_36.3: type = converted %int.make_type_32.loc5_32, %.loc5_36.2 [template = i32] // CHECK:STDOUT: %.loc5_36.4: type = converted %.loc5_36.1, constants.%tuple.type.2 [template = constants.%tuple.type.2] -// CHECK:STDOUT: %.loc5_37: type = struct_type {.b: i32, .c: %tuple.type.2} [template = constants.%.3] +// CHECK:STDOUT: %.loc5_37: type = struct_type {.b: i32, .c: %tuple.type.2} [template = constants.%.30] // CHECK:STDOUT: %int.make_type_32.loc5_44: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc5_44.1: type = value_of_initializer %int.make_type_32.loc5_44 [template = i32] // CHECK:STDOUT: %.loc5_44.2: type = converted %int.make_type_32.loc5_44, %.loc5_44.1 [template = i32] -// CHECK:STDOUT: %.loc5_47: type = struct_type {.a: %.3, .d: i32} [template = constants.%.4] -// CHECK:STDOUT: %b_ref.var: ref %.4 = var b_ref -// CHECK:STDOUT: %b_ref: ref %.4 = bind_name b_ref, %b_ref.var +// CHECK:STDOUT: %.loc5_47: type = struct_type {.a: %.30, .d: i32} [template = constants.%.31] +// CHECK:STDOUT: %b_ref.var: ref %.31 = var b_ref +// CHECK:STDOUT: %b_ref: ref %.31 = bind_name b_ref, %b_ref.var // CHECK:STDOUT: %C.decl: %C.type = class_decl @C [template = constants.%C.1] { -// CHECK:STDOUT: %S.patt.loc8_9.1: %.8 = symbolic_binding_pattern S, 0 [symbolic = %S.patt.loc8_9.2 (constants.%S.patt)] -// CHECK:STDOUT: %S.param_patt: %.8 = value_param_pattern %S.patt.loc8_9.1, runtime_param [symbolic = %S.patt.loc8_9.2 (constants.%S.patt)] +// CHECK:STDOUT: %S.patt.loc8_9.1: %.37 = symbolic_binding_pattern S, 0 [symbolic = %S.patt.loc8_9.2 (constants.%S.patt)] +// CHECK:STDOUT: %S.param_patt: %.37 = value_param_pattern %S.patt.loc8_9.1, runtime_param [symbolic = %S.patt.loc8_9.2 (constants.%S.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %int.make_type_32.loc8_18: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc8_18.1: type = value_of_initializer %int.make_type_32.loc8_18 [template = i32] @@ -130,34 +146,44 @@ var c_bad: C({.a = 3, .b = 4}) = F(); // CHECK:STDOUT: %int.make_type_32.loc8_27: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc8_27.1: type = value_of_initializer %int.make_type_32.loc8_27 [template = i32] // CHECK:STDOUT: %.loc8_27.2: type = converted %int.make_type_32.loc8_27, %.loc8_27.1 [template = i32] -// CHECK:STDOUT: %.loc8_30: type = struct_type {.a: i32, .b: i32} [template = constants.%.8] -// CHECK:STDOUT: %S.param: %.8 = value_param runtime_param -// CHECK:STDOUT: %S.loc8_9.1: %.8 = bind_symbolic_name S, 0, %S.param [symbolic = %S.loc8_9.2 (constants.%S)] +// CHECK:STDOUT: %.loc8_30: type = struct_type {.a: i32, .b: i32} [template = constants.%.37] +// CHECK:STDOUT: %S.param: %.37 = value_param runtime_param +// CHECK:STDOUT: %S.loc8_9.1: %.37 = bind_symbolic_name S, 0, %S.param [symbolic = %S.loc8_9.2 (constants.%S)] // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] { // CHECK:STDOUT: %return.patt: %C.3 = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %C.3 = out_param_pattern %return.patt, runtime_param0 // CHECK:STDOUT: } { // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [template = constants.%C.1] -// CHECK:STDOUT: %.loc9_19: i32 = int_value 1 [template = constants.%.11] -// CHECK:STDOUT: %.loc9_27: i32 = int_value 2 [template = constants.%.12] -// CHECK:STDOUT: %.loc9_28: %.8 = struct_literal (%.loc9_19, %.loc9_27) -// CHECK:STDOUT: %struct: %.8 = struct_value (%.loc9_19, %.loc9_27) [template = constants.%struct.4] -// CHECK:STDOUT: %.loc9_12: %.8 = converted %.loc9_28, %struct [template = constants.%struct.4] +// CHECK:STDOUT: %.loc9_19: Core.IntLiteral = int_value 1 [template = constants.%.40] +// CHECK:STDOUT: %.loc9_27: Core.IntLiteral = int_value 2 [template = constants.%.41] +// CHECK:STDOUT: %.loc9_28.1: %.42 = struct_literal (%.loc9_19, %.loc9_27) +// CHECK:STDOUT: %.loc9_28.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_28.3: = bound_method %.loc9_19, %.loc9_28.2 [template = constants.%.44] +// CHECK:STDOUT: %int.convert_checked.loc9_28.1: init i32 = call %.loc9_28.3(%.loc9_19) [template = constants.%.45] +// CHECK:STDOUT: %.loc9_28.4: i32 = value_of_initializer %int.convert_checked.loc9_28.1 [template = constants.%.45] +// CHECK:STDOUT: %.loc9_28.5: i32 = converted %.loc9_19, %.loc9_28.4 [template = constants.%.45] +// CHECK:STDOUT: %.loc9_28.6: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_28.7: = bound_method %.loc9_27, %.loc9_28.6 [template = constants.%.46] +// CHECK:STDOUT: %int.convert_checked.loc9_28.2: init i32 = call %.loc9_28.7(%.loc9_27) [template = constants.%.47] +// CHECK:STDOUT: %.loc9_28.8: i32 = value_of_initializer %int.convert_checked.loc9_28.2 [template = constants.%.47] +// CHECK:STDOUT: %.loc9_28.9: i32 = converted %.loc9_27, %.loc9_28.8 [template = constants.%.47] +// CHECK:STDOUT: %struct: %.37 = struct_value (%.loc9_28.5, %.loc9_28.9) [template = constants.%struct.4] +// CHECK:STDOUT: %.loc9_12: %.37 = converted %.loc9_28.1, %struct [template = constants.%struct.4] // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%struct.4) [template = constants.%C.3] // CHECK:STDOUT: %return.param: ref %C.3 = out_param runtime_param0 // CHECK:STDOUT: %return: ref %C.3 = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @C(%S.loc8_9.1: %.8) { -// CHECK:STDOUT: %S.loc8_9.2: %.8 = bind_symbolic_name S, 0 [symbolic = %S.loc8_9.2 (constants.%S)] -// CHECK:STDOUT: %S.patt.loc8_9.2: %.8 = symbolic_binding_pattern S, 0 [symbolic = %S.patt.loc8_9.2 (constants.%S.patt)] +// CHECK:STDOUT: generic class @C(%S.loc8_9.1: %.37) { +// CHECK:STDOUT: %S.loc8_9.2: %.37 = bind_symbolic_name S, 0 [symbolic = %S.loc8_9.2 (constants.%S)] +// CHECK:STDOUT: %S.patt.loc8_9.2: %.37 = symbolic_binding_pattern S, 0 [symbolic = %S.patt.loc8_9.2 (constants.%S.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: // CHECK:STDOUT: class { -// CHECK:STDOUT: %.loc8_34: = complete_type_witness %.9 [template = constants.%.10] +// CHECK:STDOUT: %.loc8_34: = complete_type_witness %.38 [template = constants.%.39] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C.2 @@ -168,30 +194,46 @@ var c_bad: C({.a = 3, .b = 4}) = F(); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc4_30: i32 = int_value 0 [template = constants.%.2] -// CHECK:STDOUT: %.loc4_31.1: %.1 = struct_literal (%.loc4_30) -// CHECK:STDOUT: %.loc4_31.2: init %.1 = struct_init (%.loc4_30) to file.%a_ref.var [template = constants.%struct.1] -// CHECK:STDOUT: %.loc4_32: init %.1 = converted %.loc4_31.1, %.loc4_31.2 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc4_30: Core.IntLiteral = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_31.1: %.3 = struct_literal (%.loc4_30) +// CHECK:STDOUT: %.loc4_31.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_31.3: = bound_method %.loc4_30, %.loc4_31.2 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked.loc4: init i32 = call %.loc4_31.3(%.loc4_30) [template = constants.%.29] +// CHECK:STDOUT: %.loc4_31.4: init i32 = converted %.loc4_30, %int.convert_checked.loc4 [template = constants.%.29] +// CHECK:STDOUT: %.loc4_31.5: init %.1 = struct_init (%.loc4_31.4) to file.%a_ref.var [template = constants.%struct.1] +// CHECK:STDOUT: %.loc4_32: init %.1 = converted %.loc4_31.1, %.loc4_31.5 [template = constants.%struct.1] // CHECK:STDOUT: assign file.%a_ref.var, %.loc4_32 -// CHECK:STDOUT: %.loc6_17: i32 = int_value 0 [template = constants.%.2] -// CHECK:STDOUT: %.loc6_26: i32 = int_value 0 [template = constants.%.2] -// CHECK:STDOUT: %.loc6_28.1: %tuple.type.2 = tuple_literal (%.loc6_26) -// CHECK:STDOUT: %.loc6_29.1: %.3 = struct_literal (%.loc6_17, %.loc6_28.1) -// CHECK:STDOUT: %.loc6_37: i32 = int_value 0 [template = constants.%.2] -// CHECK:STDOUT: %.loc6_38.1: %.4 = struct_literal (%.loc6_29.1, %.loc6_37) -// CHECK:STDOUT: %.loc6_38.2: ref %.3 = struct_access file.%b_ref.var, element0 -// CHECK:STDOUT: %.loc6_29.2: ref i32 = struct_access %.loc6_38.2, element0 -// CHECK:STDOUT: %.loc6_29.3: init i32 = initialize_from %.loc6_17 to %.loc6_29.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc6_29.4: ref %tuple.type.2 = struct_access %.loc6_38.2, element1 -// CHECK:STDOUT: %.loc6_28.2: init %tuple.type.2 = tuple_init (%.loc6_26) to %.loc6_29.4 [template = constants.%tuple] -// CHECK:STDOUT: %.loc6_29.5: init %tuple.type.2 = converted %.loc6_28.1, %.loc6_28.2 [template = constants.%tuple] -// CHECK:STDOUT: %.loc6_29.6: init %tuple.type.2 = initialize_from %.loc6_29.5 to %.loc6_29.4 [template = constants.%tuple] -// CHECK:STDOUT: %.loc6_29.7: init %.3 = struct_init (%.loc6_29.3, %.loc6_29.6) to %.loc6_38.2 [template = constants.%struct.2] -// CHECK:STDOUT: %.loc6_38.3: init %.3 = converted %.loc6_29.1, %.loc6_29.7 [template = constants.%struct.2] -// CHECK:STDOUT: %.loc6_38.4: ref i32 = struct_access file.%b_ref.var, element1 -// CHECK:STDOUT: %.loc6_38.5: init i32 = initialize_from %.loc6_37 to %.loc6_38.4 [template = constants.%.2] -// CHECK:STDOUT: %.loc6_38.6: init %.4 = struct_init (%.loc6_38.3, %.loc6_38.5) to file.%b_ref.var [template = constants.%struct.3] -// CHECK:STDOUT: %.loc6_39: init %.4 = converted %.loc6_38.1, %.loc6_38.6 [template = constants.%struct.3] +// CHECK:STDOUT: %.loc6_17: Core.IntLiteral = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc6_26: Core.IntLiteral = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc6_28.1: %tuple.type.3 = tuple_literal (%.loc6_26) +// CHECK:STDOUT: %.loc6_29.1: %.35 = struct_literal (%.loc6_17, %.loc6_28.1) +// CHECK:STDOUT: %.loc6_37: Core.IntLiteral = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc6_38.1: %.36 = struct_literal (%.loc6_29.1, %.loc6_37) +// CHECK:STDOUT: %.loc6_29.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc6_29.3: = bound_method %.loc6_17, %.loc6_29.2 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked.loc6_29: init i32 = call %.loc6_29.3(%.loc6_17) [template = constants.%.29] +// CHECK:STDOUT: %.loc6_29.4: init i32 = converted %.loc6_17, %int.convert_checked.loc6_29 [template = constants.%.29] +// CHECK:STDOUT: %.loc6_38.2: ref %.30 = struct_access file.%b_ref.var, element0 +// CHECK:STDOUT: %.loc6_29.5: ref i32 = struct_access %.loc6_38.2, element0 +// CHECK:STDOUT: %.loc6_29.6: init i32 = initialize_from %.loc6_29.4 to %.loc6_29.5 [template = constants.%.29] +// CHECK:STDOUT: %.loc6_28.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc6_28.3: = bound_method %.loc6_26, %.loc6_28.2 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked.loc6_28: init i32 = call %.loc6_28.3(%.loc6_26) [template = constants.%.29] +// CHECK:STDOUT: %.loc6_28.4: init i32 = converted %.loc6_26, %int.convert_checked.loc6_28 [template = constants.%.29] +// CHECK:STDOUT: %.loc6_29.7: ref %tuple.type.2 = struct_access %.loc6_38.2, element1 +// CHECK:STDOUT: %.loc6_28.5: init %tuple.type.2 = tuple_init (%.loc6_28.4) to %.loc6_29.7 [template = constants.%tuple] +// CHECK:STDOUT: %.loc6_29.8: init %tuple.type.2 = converted %.loc6_28.1, %.loc6_28.5 [template = constants.%tuple] +// CHECK:STDOUT: %.loc6_29.9: init %tuple.type.2 = initialize_from %.loc6_29.8 to %.loc6_29.7 [template = constants.%tuple] +// CHECK:STDOUT: %.loc6_29.10: init %.30 = struct_init (%.loc6_29.6, %.loc6_29.9) to %.loc6_38.2 [template = constants.%struct.2] +// CHECK:STDOUT: %.loc6_38.3: init %.30 = converted %.loc6_29.1, %.loc6_29.10 [template = constants.%struct.2] +// CHECK:STDOUT: %.loc6_38.4: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc6_38.5: = bound_method %.loc6_37, %.loc6_38.4 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked.loc6_38: init i32 = call %.loc6_38.5(%.loc6_37) [template = constants.%.29] +// CHECK:STDOUT: %.loc6_38.6: init i32 = converted %.loc6_37, %int.convert_checked.loc6_38 [template = constants.%.29] +// CHECK:STDOUT: %.loc6_38.7: ref i32 = struct_access file.%b_ref.var, element1 +// CHECK:STDOUT: %.loc6_38.8: init i32 = initialize_from %.loc6_38.6 to %.loc6_38.7 [template = constants.%.29] +// CHECK:STDOUT: %.loc6_38.9: init %.31 = struct_init (%.loc6_38.3, %.loc6_38.8) to file.%b_ref.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc6_39: init %.31 = converted %.loc6_38.1, %.loc6_38.9 [template = constants.%struct.3] // CHECK:STDOUT: assign file.%b_ref.var, %.loc6_39 // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -209,37 +251,159 @@ var c_bad: C({.a = 3, .b = 4}) = F(); // CHECK:STDOUT: --- implicit.impl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.2: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic] +// CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2) = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.3: type = facet_type <@ImplicitAs, @ImplicitAs(i32)> [template] +// CHECK:STDOUT: %Self.2: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Convert.type.1: type = fn_type @Convert.1, @ImplicitAs(%Dest) [symbolic] +// CHECK:STDOUT: %Convert.1: %Convert.type.1 = struct_value () [symbolic] +// CHECK:STDOUT: %.1: type = assoc_entity_type %ImplicitAs.type.2, %Convert.type.1 [symbolic] +// CHECK:STDOUT: %.2: %.1 = assoc_entity element0, imports.%import_ref.11 [symbolic] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(i32) [template] +// CHECK:STDOUT: %Convert.2: %Convert.type.2 = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type %ImplicitAs.type.3, %Convert.type.2 [template] +// CHECK:STDOUT: %.4: %.3 = assoc_entity element0, imports.%import_ref.12 [template] +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic] +// CHECK:STDOUT: %.5: type = int_type signed, %N [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.4: type = facet_type <@ImplicitAs, @ImplicitAs(%.5)> [symbolic] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.3: type = fn_type @Convert.2, @impl.2(%N) [symbolic] +// CHECK:STDOUT: %Convert.3: %Convert.type.3 = struct_value () [symbolic] +// CHECK:STDOUT: %.6: = interface_witness (%Convert.3) [symbolic] +// CHECK:STDOUT: %.7: type = int_type unsigned, %N [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.5: type = facet_type <@ImplicitAs, @ImplicitAs(%.7)> [symbolic] +// CHECK:STDOUT: %Convert.type.4: type = fn_type @Convert.3, @impl.3(%N) [symbolic] +// CHECK:STDOUT: %Convert.4: %Convert.type.4 = struct_value () [symbolic] +// CHECK:STDOUT: %.8: = interface_witness (%Convert.4) [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.6: type = facet_type <@ImplicitAs, @ImplicitAs(Core.IntLiteral)> [template] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %Convert.5: %Convert.type.5 = struct_value () [template] +// CHECK:STDOUT: %.9: type = assoc_entity_type %ImplicitAs.type.6, %Convert.type.5 [template] +// CHECK:STDOUT: %.10: %.9 = assoc_entity element0, imports.%import_ref.22 [template] +// CHECK:STDOUT: %Convert.type.6: type = fn_type @Convert.4, @impl.5(%N) [symbolic] +// CHECK:STDOUT: %Convert.6: %Convert.type.6 = struct_value () [symbolic] +// CHECK:STDOUT: %.11: = interface_witness (%Convert.6) [symbolic] +// CHECK:STDOUT: %Convert.type.7: type = fn_type @Convert.5, @impl.6(%N) [symbolic] +// CHECK:STDOUT: %Convert.7: %Convert.type.7 = struct_value () [symbolic] +// CHECK:STDOUT: %.12: = interface_witness (%Convert.7) [symbolic] +// CHECK:STDOUT: %As.type.2: type = facet_type <@As, @As(%Dest)> [symbolic] +// CHECK:STDOUT: %Self.3: @As.%As.type (%As.type.2) = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %As.type.3: type = facet_type <@As, @As(i32)> [template] +// CHECK:STDOUT: %Self.4: %As.type.2 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Convert.type.8: type = fn_type @Convert.6, @As(%Dest) [symbolic] +// CHECK:STDOUT: %Convert.8: %Convert.type.8 = struct_value () [symbolic] +// CHECK:STDOUT: %.13: type = assoc_entity_type %As.type.2, %Convert.type.8 [symbolic] +// CHECK:STDOUT: %.14: %.13 = assoc_entity element0, imports.%import_ref.35 [symbolic] +// CHECK:STDOUT: %Convert.type.9: type = fn_type @Convert.6, @As(i32) [template] +// CHECK:STDOUT: %Convert.9: %Convert.type.9 = struct_value () [template] +// CHECK:STDOUT: %.15: type = assoc_entity_type %As.type.3, %Convert.type.9 [template] +// CHECK:STDOUT: %.16: %.15 = assoc_entity element0, imports.%import_ref.36 [template] +// CHECK:STDOUT: %As.type.4: type = facet_type <@As, @As(%.5)> [symbolic] +// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.7, @impl.8(%N) [symbolic] +// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [symbolic] +// CHECK:STDOUT: %.17: = interface_witness (%Convert.10) [symbolic] +// CHECK:STDOUT: %As.type.5: type = facet_type <@As, @As(%.7)> [symbolic] +// CHECK:STDOUT: %Convert.type.11: type = fn_type @Convert.8, @impl.9(%N) [symbolic] +// CHECK:STDOUT: %Convert.11: %Convert.type.11 = struct_value () [symbolic] +// CHECK:STDOUT: %.18: = interface_witness (%Convert.11) [symbolic] +// CHECK:STDOUT: %As.type.6: type = facet_type <@As, @As(Core.IntLiteral)> [template] +// CHECK:STDOUT: %Convert.type.12: type = fn_type @Convert.6, @As(Core.IntLiteral) [template] +// CHECK:STDOUT: %Convert.12: %Convert.type.12 = struct_value () [template] +// CHECK:STDOUT: %.19: type = assoc_entity_type %As.type.6, %Convert.type.12 [template] +// CHECK:STDOUT: %.20: %.19 = assoc_entity element0, imports.%import_ref.46 [template] +// CHECK:STDOUT: %Convert.type.13: type = fn_type @Convert.9, @impl.11(%N) [symbolic] +// CHECK:STDOUT: %Convert.13: %Convert.type.13 = struct_value () [symbolic] +// CHECK:STDOUT: %.21: = interface_witness (%Convert.13) [symbolic] +// CHECK:STDOUT: %Convert.type.14: type = fn_type @Convert.10, @impl.12(%N) [symbolic] +// CHECK:STDOUT: %Convert.14: %Convert.type.14 = struct_value () [symbolic] +// CHECK:STDOUT: %.22: = interface_witness (%Convert.14) [symbolic] // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.1: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %.23: type = struct_type {.a: i32} [template] // CHECK:STDOUT: %tuple.type.1: type = tuple_type (type) [template] // CHECK:STDOUT: %tuple.type.2: type = tuple_type (i32) [template] -// CHECK:STDOUT: %.2: type = struct_type {.b: i32, .c: %tuple.type.2} [template] -// CHECK:STDOUT: %.3: type = struct_type {.a: %.2, .d: i32} [template] +// CHECK:STDOUT: %.24: type = struct_type {.b: i32, .c: %tuple.type.2} [template] +// CHECK:STDOUT: %.25: type = struct_type {.a: %.24, .d: i32} [template] // CHECK:STDOUT: %C.type: type = generic_class_type @C [template] // CHECK:STDOUT: %C.1: %C.type = struct_value () [template] -// CHECK:STDOUT: %.9: type = struct_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %S: %.9 = bind_symbolic_name S, 0 [symbolic] -// CHECK:STDOUT: %S.patt: %.9 = symbolic_binding_pattern S, 0 [symbolic] -// CHECK:STDOUT: %.10: i32 = int_value 1 [template] -// CHECK:STDOUT: %.11: i32 = int_value 2 [template] -// CHECK:STDOUT: %struct: %.9 = struct_value (%.10, %.11) [template] +// CHECK:STDOUT: %.31: type = struct_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %S: %.31 = bind_symbolic_name S, 0 [symbolic] +// CHECK:STDOUT: %S.patt: %.31 = symbolic_binding_pattern S, 0 [symbolic] +// CHECK:STDOUT: %.32: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.33: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.34: type = struct_type {.a: Core.IntLiteral, .b: Core.IntLiteral} [template] +// CHECK:STDOUT: %.36: %.1 = assoc_entity element0, imports.%import_ref.56 [symbolic] +// CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template] +// CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template] +// CHECK:STDOUT: %.37: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.38: = bound_method %.32, %Convert.15 [template] +// CHECK:STDOUT: %.39: i32 = int_value 1 [template] +// CHECK:STDOUT: %.40: = bound_method %.33, %Convert.15 [template] +// CHECK:STDOUT: %.41: i32 = int_value 2 [template] +// CHECK:STDOUT: %struct: %.31 = struct_value (%.39, %.41) [template] // CHECK:STDOUT: %C.3: type = class_type @C, @C(%struct) [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { -// CHECK:STDOUT: %import_ref.1: ref %.1 = import_ref Implicit//default, inst+17, loaded -// CHECK:STDOUT: %import_ref.2: ref %.3 = import_ref Implicit//default, inst+47, loaded -// CHECK:STDOUT: %import_ref.3: %C.type = import_ref Implicit//default, inst+86, loaded [template = constants.%C.1] -// CHECK:STDOUT: %import_ref.4: %F.type = import_ref Implicit//default, inst+111, loaded [template = constants.%F] +// CHECK:STDOUT: %import_ref.1: ref %.23 = import_ref Implicit//default, inst+17, loaded +// CHECK:STDOUT: %import_ref.2: ref %.25 = import_ref Implicit//default, inst+411, loaded +// CHECK:STDOUT: %import_ref.3: %C.type = import_ref Implicit//default, inst+465, loaded [template = constants.%C.1] +// CHECK:STDOUT: %import_ref.4: %F.type = import_ref Implicit//default, inst+505, loaded [template = constants.%F] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref.5 +// CHECK:STDOUT: .Int32 = %import_ref.53 +// CHECK:STDOUT: .ImplicitAs = %import_ref.55 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.6 = import_ref Implicit//default, inst+91, unloaded +// CHECK:STDOUT: %import_ref.5 = import_ref Implicit//default, inst+35, unloaded +// CHECK:STDOUT: %import_ref.6: @ImplicitAs.%.1 (%.1) = import_ref Implicit//default, inst+36, loaded [symbolic = @ImplicitAs.%.2 (constants.%.36)] +// CHECK:STDOUT: %import_ref.7 = import_ref Implicit//default, inst+37, unloaded +// CHECK:STDOUT: %import_ref.8: type = import_ref Implicit//default, inst+71, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.9: type = import_ref Implicit//default, inst+72, loaded [template = constants.%ImplicitAs.type.3] +// CHECK:STDOUT: %import_ref.10: = import_ref Implicit//default, inst+73, loaded [template = constants.%.37] +// CHECK:STDOUT: %import_ref.11 = import_ref Implicit//default, inst+52, unloaded +// CHECK:STDOUT: %import_ref.13: type = import_ref Implicit//default, inst+83, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.14: type = import_ref Implicit//default, inst+84, loaded [symbolic = @impl.2.%ImplicitAs.type (constants.%ImplicitAs.type.4)] +// CHECK:STDOUT: %import_ref.15 = import_ref Implicit//default, inst+85, unloaded +// CHECK:STDOUT: %import_ref.16: type = import_ref Implicit//default, inst+113, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.17: type = import_ref Implicit//default, inst+114, loaded [symbolic = @impl.3.%ImplicitAs.type (constants.%ImplicitAs.type.5)] +// CHECK:STDOUT: %import_ref.18 = import_ref Implicit//default, inst+115, unloaded +// CHECK:STDOUT: %import_ref.19: type = import_ref Implicit//default, inst+138, loaded [template = i32] +// CHECK:STDOUT: %import_ref.20: type = import_ref Implicit//default, inst+139, loaded [template = constants.%ImplicitAs.type.6] +// CHECK:STDOUT: %import_ref.21 = import_ref Implicit//default, inst+140, unloaded +// CHECK:STDOUT: %import_ref.23: type = import_ref Implicit//default, inst+151, loaded [symbolic = @impl.5.%.1 (constants.%.5)] +// CHECK:STDOUT: %import_ref.24: type = import_ref Implicit//default, inst+152, loaded [template = constants.%ImplicitAs.type.6] +// CHECK:STDOUT: %import_ref.25 = import_ref Implicit//default, inst+153, unloaded +// CHECK:STDOUT: %import_ref.26: type = import_ref Implicit//default, inst+178, loaded [symbolic = @impl.6.%.1 (constants.%.7)] +// CHECK:STDOUT: %import_ref.27: type = import_ref Implicit//default, inst+179, loaded [template = constants.%ImplicitAs.type.6] +// CHECK:STDOUT: %import_ref.28 = import_ref Implicit//default, inst+180, unloaded +// CHECK:STDOUT: %import_ref.29 = import_ref Implicit//default, inst+210, unloaded +// CHECK:STDOUT: %import_ref.30 = import_ref Implicit//default, inst+211, unloaded +// CHECK:STDOUT: %import_ref.31 = import_ref Implicit//default, inst+212, unloaded +// CHECK:STDOUT: %import_ref.32: type = import_ref Implicit//default, inst+214, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.33: type = import_ref Implicit//default, inst+215, loaded [template = constants.%As.type.3] +// CHECK:STDOUT: %import_ref.34 = import_ref Implicit//default, inst+216, unloaded +// CHECK:STDOUT: %import_ref.35 = import_ref Implicit//default, inst+231, unloaded +// CHECK:STDOUT: %import_ref.37: type = import_ref Implicit//default, inst+253, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.38: type = import_ref Implicit//default, inst+254, loaded [symbolic = @impl.8.%As.type (constants.%As.type.4)] +// CHECK:STDOUT: %import_ref.39 = import_ref Implicit//default, inst+255, unloaded +// CHECK:STDOUT: %import_ref.40: type = import_ref Implicit//default, inst+282, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.41: type = import_ref Implicit//default, inst+283, loaded [symbolic = @impl.9.%As.type (constants.%As.type.5)] +// CHECK:STDOUT: %import_ref.42 = import_ref Implicit//default, inst+284, unloaded +// CHECK:STDOUT: %import_ref.43: type = import_ref Implicit//default, inst+307, loaded [template = i32] +// CHECK:STDOUT: %import_ref.44: type = import_ref Implicit//default, inst+308, loaded [template = constants.%As.type.6] +// CHECK:STDOUT: %import_ref.45 = import_ref Implicit//default, inst+309, unloaded +// CHECK:STDOUT: %import_ref.47: type = import_ref Implicit//default, inst+320, loaded [symbolic = @impl.11.%.1 (constants.%.5)] +// CHECK:STDOUT: %import_ref.48: type = import_ref Implicit//default, inst+321, loaded [template = constants.%As.type.6] +// CHECK:STDOUT: %import_ref.49 = import_ref Implicit//default, inst+322, unloaded +// CHECK:STDOUT: %import_ref.50: type = import_ref Implicit//default, inst+347, loaded [symbolic = @impl.12.%.1 (constants.%.7)] +// CHECK:STDOUT: %import_ref.51: type = import_ref Implicit//default, inst+348, loaded [template = constants.%As.type.6] +// CHECK:STDOUT: %import_ref.52 = import_ref Implicit//default, inst+349, unloaded +// CHECK:STDOUT: %import_ref.54 = import_ref Implicit//default, inst+470, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -259,9 +423,9 @@ var c_bad: C({.a = 3, .b = 4}) = F(); // CHECK:STDOUT: %int.make_type_32.loc4: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc4_13.1: type = value_of_initializer %int.make_type_32.loc4 [template = i32] // CHECK:STDOUT: %.loc4_13.2: type = converted %int.make_type_32.loc4, %.loc4_13.1 [template = i32] -// CHECK:STDOUT: %.loc4_16: type = struct_type {.a: i32} [template = constants.%.1] -// CHECK:STDOUT: %a.var: ref %.1 = var a -// CHECK:STDOUT: %a: ref %.1 = bind_name a, %a.var +// CHECK:STDOUT: %.loc4_16: type = struct_type {.a: i32} [template = constants.%.23] +// CHECK:STDOUT: %a.var: ref %.23 = var a +// CHECK:STDOUT: %a: ref %.23 = bind_name a, %a.var // CHECK:STDOUT: %int.make_type_32.loc5_18: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc5_18.1: type = value_of_initializer %int.make_type_32.loc5_18 [template = i32] // CHECK:STDOUT: %.loc5_18.2: type = converted %int.make_type_32.loc5_18, %.loc5_18.1 [template = i32] @@ -270,51 +434,343 @@ var c_bad: C({.a = 3, .b = 4}) = F(); // CHECK:STDOUT: %.loc5_32.2: type = value_of_initializer %int.make_type_32.loc5_28 [template = i32] // CHECK:STDOUT: %.loc5_32.3: type = converted %int.make_type_32.loc5_28, %.loc5_32.2 [template = i32] // CHECK:STDOUT: %.loc5_32.4: type = converted %.loc5_32.1, constants.%tuple.type.2 [template = constants.%tuple.type.2] -// CHECK:STDOUT: %.loc5_33: type = struct_type {.b: i32, .c: %tuple.type.2} [template = constants.%.2] +// CHECK:STDOUT: %.loc5_33: type = struct_type {.b: i32, .c: %tuple.type.2} [template = constants.%.24] // CHECK:STDOUT: %int.make_type_32.loc5_40: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc5_40.1: type = value_of_initializer %int.make_type_32.loc5_40 [template = i32] // CHECK:STDOUT: %.loc5_40.2: type = converted %int.make_type_32.loc5_40, %.loc5_40.1 [template = i32] -// CHECK:STDOUT: %.loc5_43: type = struct_type {.a: %.2, .d: i32} [template = constants.%.3] -// CHECK:STDOUT: %b.var: ref %.3 = var b -// CHECK:STDOUT: %b: ref %.3 = bind_name b, %b.var +// CHECK:STDOUT: %.loc5_43: type = struct_type {.a: %.24, .d: i32} [template = constants.%.25] +// CHECK:STDOUT: %b.var: ref %.25 = var b +// CHECK:STDOUT: %b: ref %.25 = bind_name b, %b.var // CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%import_ref.3 [template = constants.%C.1] -// CHECK:STDOUT: %.loc6_16: i32 = int_value 1 [template = constants.%.10] -// CHECK:STDOUT: %.loc6_24: i32 = int_value 2 [template = constants.%.11] -// CHECK:STDOUT: %.loc6_25: %.9 = struct_literal (%.loc6_16, %.loc6_24) -// CHECK:STDOUT: %struct: %.9 = struct_value (%.loc6_16, %.loc6_24) [template = constants.%struct] -// CHECK:STDOUT: %.loc6_9: %.9 = converted %.loc6_25, %struct [template = constants.%struct] +// CHECK:STDOUT: %.loc6_16: Core.IntLiteral = int_value 1 [template = constants.%.32] +// CHECK:STDOUT: %.loc6_24: Core.IntLiteral = int_value 2 [template = constants.%.33] +// CHECK:STDOUT: %.loc6_25.1: %.34 = struct_literal (%.loc6_16, %.loc6_24) +// CHECK:STDOUT: %.loc6_25.2: %Convert.type.2 = interface_witness_access constants.%.37, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc6_25.3: = bound_method %.loc6_16, %.loc6_25.2 [template = constants.%.38] +// CHECK:STDOUT: %int.convert_checked.loc6_25.1: init i32 = call %.loc6_25.3(%.loc6_16) [template = constants.%.39] +// CHECK:STDOUT: %.loc6_25.4: i32 = value_of_initializer %int.convert_checked.loc6_25.1 [template = constants.%.39] +// CHECK:STDOUT: %.loc6_25.5: i32 = converted %.loc6_16, %.loc6_25.4 [template = constants.%.39] +// CHECK:STDOUT: %.loc6_25.6: %Convert.type.2 = interface_witness_access constants.%.37, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc6_25.7: = bound_method %.loc6_24, %.loc6_25.6 [template = constants.%.40] +// CHECK:STDOUT: %int.convert_checked.loc6_25.2: init i32 = call %.loc6_25.7(%.loc6_24) [template = constants.%.41] +// CHECK:STDOUT: %.loc6_25.8: i32 = value_of_initializer %int.convert_checked.loc6_25.2 [template = constants.%.41] +// CHECK:STDOUT: %.loc6_25.9: i32 = converted %.loc6_24, %.loc6_25.8 [template = constants.%.41] +// CHECK:STDOUT: %struct: %.31 = struct_value (%.loc6_25.5, %.loc6_25.9) [template = constants.%struct] +// CHECK:STDOUT: %.loc6_9: %.31 = converted %.loc6_25.1, %struct [template = constants.%struct] // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%struct) [template = constants.%C.3] // CHECK:STDOUT: %c.var: ref %C.3 = var c // CHECK:STDOUT: %c: ref %C.3 = bind_name c, %c.var // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @C(constants.%S: %.9) { -// CHECK:STDOUT: %S: %.9 = bind_symbolic_name S, 0 [symbolic = %S (constants.%S)] -// CHECK:STDOUT: %S.patt: %.9 = symbolic_binding_pattern S, 0 [symbolic = %S.patt (constants.%S.patt)] +// CHECK:STDOUT: generic interface @ImplicitAs(constants.%Dest: type) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)] +// CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.1, @ImplicitAs(%Dest) [symbolic = %Convert.type (constants.%Convert.type.1)] +// CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.1) = struct_value () [symbolic = %Convert (constants.%Convert.1)] +// CHECK:STDOUT: %.1: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2), @ImplicitAs.%Convert.type (%Convert.type.1) [symbolic = %.1 (constants.%.1)] +// CHECK:STDOUT: %.2: @ImplicitAs.%.1 (%.1) = assoc_entity element0, imports.%import_ref.11 [symbolic = %.2 (constants.%.2)] +// CHECK:STDOUT: +// CHECK:STDOUT: interface { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%import_ref.5 +// CHECK:STDOUT: .Convert = imports.%import_ref.6 +// CHECK:STDOUT: witness = (imports.%import_ref.7) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @As(constants.%Dest: type) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest)> [symbolic = %As.type (constants.%As.type.2)] +// CHECK:STDOUT: %Self: %As.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.4)] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.6, @As(%Dest) [symbolic = %Convert.type (constants.%Convert.type.8)] +// CHECK:STDOUT: %Convert: @As.%Convert.type (%Convert.type.8) = struct_value () [symbolic = %Convert (constants.%Convert.8)] +// CHECK:STDOUT: %.1: type = assoc_entity_type @As.%As.type (%As.type.2), @As.%Convert.type (%Convert.type.8) [symbolic = %.1 (constants.%.13)] +// CHECK:STDOUT: %.2: @As.%.1 (%.13) = assoc_entity element0, imports.%import_ref.35 [symbolic = %.2 (constants.%.14)] +// CHECK:STDOUT: +// CHECK:STDOUT: interface { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%import_ref.29 +// CHECK:STDOUT: .Convert = imports.%import_ref.30 +// CHECK:STDOUT: witness = (imports.%import_ref.31) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.1: imports.%import_ref.8 as imports.%import_ref.9 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.10 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.2(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%.1)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.4)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.2, @impl.2(%N) [symbolic = %Convert.type (constants.%Convert.type.3)] +// CHECK:STDOUT: %Convert: @impl.2.%Convert.type (%Convert.type.3) = struct_value () [symbolic = %Convert (constants.%Convert.3)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.6)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.13 as imports.%import_ref.14 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.15 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.3(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%.1)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.3, @impl.3(%N) [symbolic = %Convert.type (constants.%Convert.type.4)] +// CHECK:STDOUT: %Convert: @impl.3.%Convert.type (%Convert.type.4) = struct_value () [symbolic = %Convert (constants.%Convert.4)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.8)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.16 as imports.%import_ref.17 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.18 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.4: imports.%import_ref.19 as imports.%import_ref.20 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.21 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.5(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.4, @impl.5(%N) [symbolic = %Convert.type (constants.%Convert.type.6)] +// CHECK:STDOUT: %Convert: @impl.5.%Convert.type (%Convert.type.6) = struct_value () [symbolic = %Convert (constants.%Convert.6)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.11)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.23 as imports.%import_ref.24 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.25 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.6(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.5, @impl.6(%N) [symbolic = %Convert.type (constants.%Convert.type.7)] +// CHECK:STDOUT: %Convert: @impl.6.%Convert.type (%Convert.type.7) = struct_value () [symbolic = %Convert (constants.%Convert.7)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.12)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.26 as imports.%import_ref.27 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.28 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.7: imports.%import_ref.32 as imports.%import_ref.33 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.34 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.8(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%.1)> [symbolic = %As.type (constants.%As.type.4)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.7, @impl.8(%N) [symbolic = %Convert.type (constants.%Convert.type.10)] +// CHECK:STDOUT: %Convert: @impl.8.%Convert.type (%Convert.type.10) = struct_value () [symbolic = %Convert (constants.%Convert.10)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.17)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.37 as imports.%import_ref.38 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.39 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.9(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%.1)> [symbolic = %As.type (constants.%As.type.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.8, @impl.9(%N) [symbolic = %Convert.type (constants.%Convert.type.11)] +// CHECK:STDOUT: %Convert: @impl.9.%Convert.type (%Convert.type.11) = struct_value () [symbolic = %Convert (constants.%Convert.11)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.18)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.40 as imports.%import_ref.41 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.42 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.10: imports.%import_ref.43 as imports.%import_ref.44 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.45 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.11(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.9, @impl.11(%N) [symbolic = %Convert.type (constants.%Convert.type.13)] +// CHECK:STDOUT: %Convert: @impl.11.%Convert.type (%Convert.type.13) = struct_value () [symbolic = %Convert (constants.%Convert.13)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.21)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.47 as imports.%import_ref.48 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.49 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.12(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.10, @impl.12(%N) [symbolic = %Convert.type (constants.%Convert.type.14)] +// CHECK:STDOUT: %Convert: @impl.12.%Convert.type (%Convert.type.14) = struct_value () [symbolic = %Convert (constants.%Convert.14)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.22)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.50 as imports.%import_ref.51 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.52 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic class @C(constants.%S: %.31) { +// CHECK:STDOUT: %S: %.31 = bind_symbolic_name S, 0 [symbolic = %S (constants.%S)] +// CHECK:STDOUT: %S.patt: %.31 = symbolic_binding_pattern S, 0 [symbolic = %S.patt (constants.%S.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: // CHECK:STDOUT: class { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = imports.%import_ref.6 +// CHECK:STDOUT: .Self = imports.%import_ref.54 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.1(constants.%Dest: type, constants.%Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2)) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)] +// CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.1.%Self (%Self.2)]() -> @Convert.1.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.2(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.2.%.1 (%.5) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.3(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.3.%.1 (%.7) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.4(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.4.%.1 (%.5)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.5(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.5.%.1 (%.7)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.6(constants.%Dest: type, constants.%Self.3: @As.%As.type (%As.type.2)) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest)> [symbolic = %As.type (constants.%As.type.2)] +// CHECK:STDOUT: %Self: %As.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.4)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.6.%Self (%Self.4)]() -> @Convert.6.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.7(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.7.%.1 (%.5) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.8(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.8.%.1 (%.7) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.9(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.9.%.1 (%.5)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.10(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.10.%.1 (%.7)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Convert.11[%self.param_patt: Core.IntLiteral]() -> i32 = "int.convert_checked"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> %C.3; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %a_ref.ref: ref %.1 = name_ref a_ref, imports.%import_ref.1 +// CHECK:STDOUT: %a_ref.ref: ref %.23 = name_ref a_ref, imports.%import_ref.1 // CHECK:STDOUT: %.loc4_20.1: ref i32 = struct_access %a_ref.ref, element0 // CHECK:STDOUT: %.loc4_20.2: i32 = bind_value %.loc4_20.1 -// CHECK:STDOUT: %.loc4_20.3: init %.1 = struct_init (%.loc4_20.2) to file.%a.var -// CHECK:STDOUT: %.loc4_25: init %.1 = converted %a_ref.ref, %.loc4_20.3 +// CHECK:STDOUT: %.loc4_20.3: init %.23 = struct_init (%.loc4_20.2) to file.%a.var +// CHECK:STDOUT: %.loc4_25: init %.23 = converted %a_ref.ref, %.loc4_20.3 // CHECK:STDOUT: assign file.%a.var, %.loc4_25 -// CHECK:STDOUT: %b_ref.ref: ref %.3 = name_ref b_ref, imports.%import_ref.2 -// CHECK:STDOUT: %.loc5_47.1: ref %.2 = struct_access %b_ref.ref, element0 +// CHECK:STDOUT: %b_ref.ref: ref %.25 = name_ref b_ref, imports.%import_ref.2 +// CHECK:STDOUT: %.loc5_47.1: ref %.24 = struct_access %b_ref.ref, element0 // CHECK:STDOUT: %.loc5_47.2: ref i32 = struct_access %.loc5_47.1, element0 // CHECK:STDOUT: %.loc5_47.3: i32 = bind_value %.loc5_47.2 -// CHECK:STDOUT: %.loc5_47.4: ref %.2 = struct_access file.%b.var, element0 +// CHECK:STDOUT: %.loc5_47.4: ref %.24 = struct_access file.%b.var, element0 // CHECK:STDOUT: %.loc5_47.5: ref i32 = struct_access %.loc5_47.4, element0 // CHECK:STDOUT: %.loc5_47.6: init i32 = initialize_from %.loc5_47.3 to %.loc5_47.5 // CHECK:STDOUT: %.loc5_47.7: ref %tuple.type.2 = struct_access %.loc5_47.1, element1 @@ -324,14 +780,14 @@ var c_bad: C({.a = 3, .b = 4}) = F(); // CHECK:STDOUT: %.loc5_47.11: init %tuple.type.2 = tuple_init (%.loc5_47.9) to %.loc5_47.10 // CHECK:STDOUT: %.loc5_47.12: init %tuple.type.2 = converted %.loc5_47.7, %.loc5_47.11 // CHECK:STDOUT: %.loc5_47.13: init %tuple.type.2 = initialize_from %.loc5_47.12 to %.loc5_47.10 -// CHECK:STDOUT: %.loc5_47.14: init %.2 = struct_init (%.loc5_47.6, %.loc5_47.13) to %.loc5_47.4 -// CHECK:STDOUT: %.loc5_47.15: init %.2 = converted %.loc5_47.1, %.loc5_47.14 +// CHECK:STDOUT: %.loc5_47.14: init %.24 = struct_init (%.loc5_47.6, %.loc5_47.13) to %.loc5_47.4 +// CHECK:STDOUT: %.loc5_47.15: init %.24 = converted %.loc5_47.1, %.loc5_47.14 // CHECK:STDOUT: %.loc5_47.16: ref i32 = struct_access %b_ref.ref, element1 // CHECK:STDOUT: %.loc5_47.17: i32 = bind_value %.loc5_47.16 // CHECK:STDOUT: %.loc5_47.18: ref i32 = struct_access file.%b.var, element1 // CHECK:STDOUT: %.loc5_47.19: init i32 = initialize_from %.loc5_47.17 to %.loc5_47.18 -// CHECK:STDOUT: %.loc5_47.20: init %.3 = struct_init (%.loc5_47.15, %.loc5_47.19) to file.%b.var -// CHECK:STDOUT: %.loc5_52: init %.3 = converted %b_ref.ref, %.loc5_47.20 +// CHECK:STDOUT: %.loc5_47.20: init %.25 = struct_init (%.loc5_47.15, %.loc5_47.19) to file.%b.var +// CHECK:STDOUT: %.loc5_52: init %.25 = converted %b_ref.ref, %.loc5_47.20 // CHECK:STDOUT: assign file.%b.var, %.loc5_52 // CHECK:STDOUT: %F.ref: %F.type = name_ref F, imports.%import_ref.4 [template = constants.%F] // CHECK:STDOUT: %.loc6: ref %C.3 = splice_block file.%c.var {} @@ -340,6 +796,284 @@ var c_bad: C({.a = 3, .b = 4}) = F(); // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(i32) { +// CHECK:STDOUT: %Dest => i32 +// CHECK:STDOUT: %Dest.patt => i32 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3 +// CHECK:STDOUT: %Self => constants.%Self.2 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.2 +// CHECK:STDOUT: %Convert => constants.%Convert.2 +// CHECK:STDOUT: %.1 => constants.%.3 +// CHECK:STDOUT: %.2 => constants.%.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@Convert.1.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.1(constants.%Dest, constants.%Self.1) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.2 +// CHECK:STDOUT: %Self => constants.%Self.1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%.5) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@impl.2.%.1) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.2(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.2(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.2(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%.7) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@impl.3.%.1) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.3(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.3(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.3(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(Core.IntLiteral) { +// CHECK:STDOUT: %Dest => Core.IntLiteral +// CHECK:STDOUT: %Dest.patt => Core.IntLiteral +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.6 +// CHECK:STDOUT: %Self => constants.%Self.2 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.5 +// CHECK:STDOUT: %Convert => constants.%Convert.5 +// CHECK:STDOUT: %.1 => constants.%.9 +// CHECK:STDOUT: %.2 => constants.%.10 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.5(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.5(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.4(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.6(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.6(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.5(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(i32) { +// CHECK:STDOUT: %Dest => i32 +// CHECK:STDOUT: %Dest.patt => i32 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type => constants.%As.type.3 +// CHECK:STDOUT: %Self => constants.%Self.4 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.9 +// CHECK:STDOUT: %Convert => constants.%Convert.9 +// CHECK:STDOUT: %.1 => constants.%.15 +// CHECK:STDOUT: %.2 => constants.%.16 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(@Convert.6.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.6(constants.%Dest, constants.%Self.3) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %As.type => constants.%As.type.2 +// CHECK:STDOUT: %Self => constants.%Self.3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%.5) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(@impl.8.%.1) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.8(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %As.type => constants.%As.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.8(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %As.type => constants.%As.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.7(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%.7) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(@impl.9.%.1) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.9(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %As.type => constants.%As.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.9(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %As.type => constants.%As.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.8(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(Core.IntLiteral) { +// CHECK:STDOUT: %Dest => Core.IntLiteral +// CHECK:STDOUT: %Dest.patt => Core.IntLiteral +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type => constants.%As.type.6 +// CHECK:STDOUT: %Self => constants.%Self.4 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.12 +// CHECK:STDOUT: %Convert => constants.%Convert.12 +// CHECK:STDOUT: %.1 => constants.%.19 +// CHECK:STDOUT: %.2 => constants.%.20 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.11(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.11(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.9(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.12(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.12(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.10(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: specific @C(constants.%S) { // CHECK:STDOUT: %S => constants.%S // CHECK:STDOUT: %S.patt => constants.%S @@ -355,30 +1089,144 @@ var c_bad: C({.a = 3, .b = 4}) = F(); // CHECK:STDOUT: --- fail_bad_type.impl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.2: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic] +// CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2) = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.3: type = facet_type <@ImplicitAs, @ImplicitAs(i32)> [template] +// CHECK:STDOUT: %Self.2: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Convert.type.1: type = fn_type @Convert.1, @ImplicitAs(%Dest) [symbolic] +// CHECK:STDOUT: %Convert.1: %Convert.type.1 = struct_value () [symbolic] +// CHECK:STDOUT: %.1: type = assoc_entity_type %ImplicitAs.type.2, %Convert.type.1 [symbolic] +// CHECK:STDOUT: %.2: %.1 = assoc_entity element0, imports.%import_ref.11 [symbolic] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(i32) [template] +// CHECK:STDOUT: %Convert.2: %Convert.type.2 = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type %ImplicitAs.type.3, %Convert.type.2 [template] +// CHECK:STDOUT: %.4: %.3 = assoc_entity element0, imports.%import_ref.12 [template] +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic] +// CHECK:STDOUT: %.5: type = int_type signed, %N [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.4: type = facet_type <@ImplicitAs, @ImplicitAs(%.5)> [symbolic] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.3: type = fn_type @Convert.2, @impl.2(%N) [symbolic] +// CHECK:STDOUT: %Convert.3: %Convert.type.3 = struct_value () [symbolic] +// CHECK:STDOUT: %.6: = interface_witness (%Convert.3) [symbolic] +// CHECK:STDOUT: %.7: type = int_type unsigned, %N [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.5: type = facet_type <@ImplicitAs, @ImplicitAs(%.7)> [symbolic] +// CHECK:STDOUT: %Convert.type.4: type = fn_type @Convert.3, @impl.3(%N) [symbolic] +// CHECK:STDOUT: %Convert.4: %Convert.type.4 = struct_value () [symbolic] +// CHECK:STDOUT: %.8: = interface_witness (%Convert.4) [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.6: type = facet_type <@ImplicitAs, @ImplicitAs(Core.IntLiteral)> [template] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %Convert.5: %Convert.type.5 = struct_value () [template] +// CHECK:STDOUT: %.9: type = assoc_entity_type %ImplicitAs.type.6, %Convert.type.5 [template] +// CHECK:STDOUT: %.10: %.9 = assoc_entity element0, imports.%import_ref.22 [template] +// CHECK:STDOUT: %Convert.type.6: type = fn_type @Convert.4, @impl.5(%N) [symbolic] +// CHECK:STDOUT: %Convert.6: %Convert.type.6 = struct_value () [symbolic] +// CHECK:STDOUT: %.11: = interface_witness (%Convert.6) [symbolic] +// CHECK:STDOUT: %Convert.type.7: type = fn_type @Convert.5, @impl.6(%N) [symbolic] +// CHECK:STDOUT: %Convert.7: %Convert.type.7 = struct_value () [symbolic] +// CHECK:STDOUT: %.12: = interface_witness (%Convert.7) [symbolic] +// CHECK:STDOUT: %As.type.2: type = facet_type <@As, @As(%Dest)> [symbolic] +// CHECK:STDOUT: %Self.3: @As.%As.type (%As.type.2) = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %As.type.3: type = facet_type <@As, @As(i32)> [template] +// CHECK:STDOUT: %Self.4: %As.type.2 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Convert.type.8: type = fn_type @Convert.6, @As(%Dest) [symbolic] +// CHECK:STDOUT: %Convert.8: %Convert.type.8 = struct_value () [symbolic] +// CHECK:STDOUT: %.13: type = assoc_entity_type %As.type.2, %Convert.type.8 [symbolic] +// CHECK:STDOUT: %.14: %.13 = assoc_entity element0, imports.%import_ref.35 [symbolic] +// CHECK:STDOUT: %Convert.type.9: type = fn_type @Convert.6, @As(i32) [template] +// CHECK:STDOUT: %Convert.9: %Convert.type.9 = struct_value () [template] +// CHECK:STDOUT: %.15: type = assoc_entity_type %As.type.3, %Convert.type.9 [template] +// CHECK:STDOUT: %.16: %.15 = assoc_entity element0, imports.%import_ref.36 [template] +// CHECK:STDOUT: %As.type.4: type = facet_type <@As, @As(%.5)> [symbolic] +// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.7, @impl.8(%N) [symbolic] +// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [symbolic] +// CHECK:STDOUT: %.17: = interface_witness (%Convert.10) [symbolic] +// CHECK:STDOUT: %As.type.5: type = facet_type <@As, @As(%.7)> [symbolic] +// CHECK:STDOUT: %Convert.type.11: type = fn_type @Convert.8, @impl.9(%N) [symbolic] +// CHECK:STDOUT: %Convert.11: %Convert.type.11 = struct_value () [symbolic] +// CHECK:STDOUT: %.18: = interface_witness (%Convert.11) [symbolic] +// CHECK:STDOUT: %As.type.6: type = facet_type <@As, @As(Core.IntLiteral)> [template] +// CHECK:STDOUT: %Convert.type.12: type = fn_type @Convert.6, @As(Core.IntLiteral) [template] +// CHECK:STDOUT: %Convert.12: %Convert.type.12 = struct_value () [template] +// CHECK:STDOUT: %.19: type = assoc_entity_type %As.type.6, %Convert.type.12 [template] +// CHECK:STDOUT: %.20: %.19 = assoc_entity element0, imports.%import_ref.46 [template] +// CHECK:STDOUT: %Convert.type.13: type = fn_type @Convert.9, @impl.11(%N) [symbolic] +// CHECK:STDOUT: %Convert.13: %Convert.type.13 = struct_value () [symbolic] +// CHECK:STDOUT: %.21: = interface_witness (%Convert.13) [symbolic] +// CHECK:STDOUT: %Convert.type.14: type = fn_type @Convert.10, @impl.12(%N) [symbolic] +// CHECK:STDOUT: %Convert.14: %Convert.type.14 = struct_value () [symbolic] +// CHECK:STDOUT: %.22: = interface_witness (%Convert.14) [symbolic] // CHECK:STDOUT: %C.type: type = generic_class_type @C [template] // CHECK:STDOUT: %C.1: %C.type = struct_value () [template] -// CHECK:STDOUT: %.3: type = struct_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %S: %.3 = bind_symbolic_name S, 0 [symbolic] -// CHECK:STDOUT: %S.patt: %.3 = symbolic_binding_pattern S, 0 [symbolic] -// CHECK:STDOUT: %.4: i32 = int_value 1 [template] -// CHECK:STDOUT: %.5: i32 = int_value 2 [template] -// CHECK:STDOUT: %.6: type = struct_type {.c: i32, .d: i32} [template] +// CHECK:STDOUT: %.25: type = struct_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %S: %.25 = bind_symbolic_name S, 0 [symbolic] +// CHECK:STDOUT: %S.patt: %.25 = symbolic_binding_pattern S, 0 [symbolic] +// CHECK:STDOUT: %.26: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.27: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.28: type = struct_type {.c: Core.IntLiteral, .d: Core.IntLiteral} [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %struct: %.3 = struct_value (%.4, %.5) [template] +// CHECK:STDOUT: %.30: i32 = int_value 2 [template] +// CHECK:STDOUT: %.31: i32 = int_value 1 [template] +// CHECK:STDOUT: %struct: %.25 = struct_value (%.31, %.30) [template] // CHECK:STDOUT: %C.3: type = class_type @C, @C(%struct) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %import_ref.1 = import_ref Implicit//default, inst+17, unloaded -// CHECK:STDOUT: %import_ref.2 = import_ref Implicit//default, inst+47, unloaded -// CHECK:STDOUT: %import_ref.3: %C.type = import_ref Implicit//default, inst+86, loaded [template = constants.%C.1] -// CHECK:STDOUT: %import_ref.4: %F.type = import_ref Implicit//default, inst+111, loaded [template = constants.%F] +// CHECK:STDOUT: %import_ref.2 = import_ref Implicit//default, inst+411, unloaded +// CHECK:STDOUT: %import_ref.3: %C.type = import_ref Implicit//default, inst+465, loaded [template = constants.%C.1] +// CHECK:STDOUT: %import_ref.4: %F.type = import_ref Implicit//default, inst+505, loaded [template = constants.%F] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.5 = import_ref Implicit//default, inst+91, unloaded +// CHECK:STDOUT: %import_ref.5 = import_ref Implicit//default, inst+35, unloaded +// CHECK:STDOUT: %import_ref.6 = import_ref Implicit//default, inst+36, unloaded +// CHECK:STDOUT: %import_ref.7 = import_ref Implicit//default, inst+37, unloaded +// CHECK:STDOUT: %import_ref.8: type = import_ref Implicit//default, inst+71, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.9: type = import_ref Implicit//default, inst+72, loaded [template = constants.%ImplicitAs.type.3] +// CHECK:STDOUT: %import_ref.10 = import_ref Implicit//default, inst+73, unloaded +// CHECK:STDOUT: %import_ref.11 = import_ref Implicit//default, inst+52, unloaded +// CHECK:STDOUT: %import_ref.13: type = import_ref Implicit//default, inst+83, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.14: type = import_ref Implicit//default, inst+84, loaded [symbolic = @impl.2.%ImplicitAs.type (constants.%ImplicitAs.type.4)] +// CHECK:STDOUT: %import_ref.15 = import_ref Implicit//default, inst+85, unloaded +// CHECK:STDOUT: %import_ref.16: type = import_ref Implicit//default, inst+113, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.17: type = import_ref Implicit//default, inst+114, loaded [symbolic = @impl.3.%ImplicitAs.type (constants.%ImplicitAs.type.5)] +// CHECK:STDOUT: %import_ref.18 = import_ref Implicit//default, inst+115, unloaded +// CHECK:STDOUT: %import_ref.19: type = import_ref Implicit//default, inst+138, loaded [template = i32] +// CHECK:STDOUT: %import_ref.20: type = import_ref Implicit//default, inst+139, loaded [template = constants.%ImplicitAs.type.6] +// CHECK:STDOUT: %import_ref.21 = import_ref Implicit//default, inst+140, unloaded +// CHECK:STDOUT: %import_ref.23: type = import_ref Implicit//default, inst+151, loaded [symbolic = @impl.5.%.1 (constants.%.5)] +// CHECK:STDOUT: %import_ref.24: type = import_ref Implicit//default, inst+152, loaded [template = constants.%ImplicitAs.type.6] +// CHECK:STDOUT: %import_ref.25 = import_ref Implicit//default, inst+153, unloaded +// CHECK:STDOUT: %import_ref.26: type = import_ref Implicit//default, inst+178, loaded [symbolic = @impl.6.%.1 (constants.%.7)] +// CHECK:STDOUT: %import_ref.27: type = import_ref Implicit//default, inst+179, loaded [template = constants.%ImplicitAs.type.6] +// CHECK:STDOUT: %import_ref.28 = import_ref Implicit//default, inst+180, unloaded +// CHECK:STDOUT: %import_ref.29 = import_ref Implicit//default, inst+210, unloaded +// CHECK:STDOUT: %import_ref.30 = import_ref Implicit//default, inst+211, unloaded +// CHECK:STDOUT: %import_ref.31 = import_ref Implicit//default, inst+212, unloaded +// CHECK:STDOUT: %import_ref.32: type = import_ref Implicit//default, inst+214, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.33: type = import_ref Implicit//default, inst+215, loaded [template = constants.%As.type.3] +// CHECK:STDOUT: %import_ref.34 = import_ref Implicit//default, inst+216, unloaded +// CHECK:STDOUT: %import_ref.35 = import_ref Implicit//default, inst+231, unloaded +// CHECK:STDOUT: %import_ref.37: type = import_ref Implicit//default, inst+253, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.38: type = import_ref Implicit//default, inst+254, loaded [symbolic = @impl.8.%As.type (constants.%As.type.4)] +// CHECK:STDOUT: %import_ref.39 = import_ref Implicit//default, inst+255, unloaded +// CHECK:STDOUT: %import_ref.40: type = import_ref Implicit//default, inst+282, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.41: type = import_ref Implicit//default, inst+283, loaded [symbolic = @impl.9.%As.type (constants.%As.type.5)] +// CHECK:STDOUT: %import_ref.42 = import_ref Implicit//default, inst+284, unloaded +// CHECK:STDOUT: %import_ref.43: type = import_ref Implicit//default, inst+307, loaded [template = i32] +// CHECK:STDOUT: %import_ref.44: type = import_ref Implicit//default, inst+308, loaded [template = constants.%As.type.6] +// CHECK:STDOUT: %import_ref.45 = import_ref Implicit//default, inst+309, unloaded +// CHECK:STDOUT: %import_ref.47: type = import_ref Implicit//default, inst+320, loaded [symbolic = @impl.11.%.1 (constants.%.5)] +// CHECK:STDOUT: %import_ref.48: type = import_ref Implicit//default, inst+321, loaded [template = constants.%As.type.6] +// CHECK:STDOUT: %import_ref.49 = import_ref Implicit//default, inst+322, unloaded +// CHECK:STDOUT: %import_ref.50: type = import_ref Implicit//default, inst+347, loaded [symbolic = @impl.12.%.1 (constants.%.7)] +// CHECK:STDOUT: %import_ref.51: type = import_ref Implicit//default, inst+348, loaded [template = constants.%As.type.6] +// CHECK:STDOUT: %import_ref.52 = import_ref Implicit//default, inst+349, unloaded +// CHECK:STDOUT: %import_ref.53 = import_ref Implicit//default, inst+470, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -394,79 +1242,763 @@ var c_bad: C({.a = 3, .b = 4}) = F(); // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%import_ref.3 [template = constants.%C.1] -// CHECK:STDOUT: %.loc11_20: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc11_28: i32 = int_value 2 [template = constants.%.5] -// CHECK:STDOUT: %.loc11_29: %.6 = struct_literal (%.loc11_20, %.loc11_28) +// CHECK:STDOUT: %.loc11_20: Core.IntLiteral = int_value 1 [template = constants.%.26] +// CHECK:STDOUT: %.loc11_28: Core.IntLiteral = int_value 2 [template = constants.%.27] +// CHECK:STDOUT: %.loc11_29: %.28 = struct_literal (%.loc11_20, %.loc11_28) // CHECK:STDOUT: %c_bad.var: ref = var c_bad // CHECK:STDOUT: %c_bad: ref = bind_name c_bad, %c_bad.var // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @C(constants.%S: %.3) { -// CHECK:STDOUT: %S: %.3 = bind_symbolic_name S, 0 [symbolic = %S (constants.%S)] -// CHECK:STDOUT: %S.patt: %.3 = symbolic_binding_pattern S, 0 [symbolic = %S.patt (constants.%S.patt)] +// CHECK:STDOUT: generic interface @ImplicitAs(constants.%Dest: type) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)] +// CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.1, @ImplicitAs(%Dest) [symbolic = %Convert.type (constants.%Convert.type.1)] +// CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.1) = struct_value () [symbolic = %Convert (constants.%Convert.1)] +// CHECK:STDOUT: %.1: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2), @ImplicitAs.%Convert.type (%Convert.type.1) [symbolic = %.1 (constants.%.1)] +// CHECK:STDOUT: %.2: @ImplicitAs.%.1 (%.1) = assoc_entity element0, imports.%import_ref.11 [symbolic = %.2 (constants.%.2)] // CHECK:STDOUT: -// CHECK:STDOUT: class { +// CHECK:STDOUT: interface { // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = imports.%import_ref.5 +// CHECK:STDOUT: .Convert = imports.%import_ref.6 +// CHECK:STDOUT: witness = (imports.%import_ref.7) // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F() -> %C.3; +// CHECK:STDOUT: generic interface @As(constants.%Dest: type) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)] // CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: %F.type = name_ref F, imports.%import_ref.4 [template = constants.%F] -// CHECK:STDOUT: %.loc11: ref %C.3 = temporary_storage -// CHECK:STDOUT: %F.call: init %C.3 = call %F.ref() to %.loc11 -// CHECK:STDOUT: assign file.%c_bad.var, -// CHECK:STDOUT: return +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest)> [symbolic = %As.type (constants.%As.type.2)] +// CHECK:STDOUT: %Self: %As.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.4)] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.6, @As(%Dest) [symbolic = %Convert.type (constants.%Convert.type.8)] +// CHECK:STDOUT: %Convert: @As.%Convert.type (%Convert.type.8) = struct_value () [symbolic = %Convert (constants.%Convert.8)] +// CHECK:STDOUT: %.1: type = assoc_entity_type @As.%As.type (%As.type.2), @As.%Convert.type (%Convert.type.8) [symbolic = %.1 (constants.%.13)] +// CHECK:STDOUT: %.2: @As.%.1 (%.13) = assoc_entity element0, imports.%import_ref.35 [symbolic = %.2 (constants.%.14)] +// CHECK:STDOUT: +// CHECK:STDOUT: interface { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%import_ref.29 +// CHECK:STDOUT: .Convert = imports.%import_ref.30 +// CHECK:STDOUT: witness = (imports.%import_ref.31) +// CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @C(constants.%S) { -// CHECK:STDOUT: %S => constants.%S -// CHECK:STDOUT: %S.patt => constants.%S +// CHECK:STDOUT: impl @impl.1: imports.%import_ref.8 as imports.%import_ref.9 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.10 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @C(constants.%struct) { -// CHECK:STDOUT: %S => constants.%struct -// CHECK:STDOUT: %S.patt => constants.%struct +// CHECK:STDOUT: generic impl @impl.2(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%.1)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.4)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.2, @impl.2(%N) [symbolic = %Convert.type (constants.%Convert.type.3)] +// CHECK:STDOUT: %Convert: @impl.2.%Convert.type (%Convert.type.3) = struct_value () [symbolic = %Convert (constants.%Convert.3)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.6)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.13 as imports.%import_ref.14 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.15 +// CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: --- fail_bad_value.impl.carbon +// CHECK:STDOUT: generic impl @impl.3(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%.1)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.5)] // CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %C.type: type = generic_class_type @C [template] -// CHECK:STDOUT: %C.1: %C.type = struct_value () [template] -// CHECK:STDOUT: %.3: type = struct_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %S: %.3 = bind_symbolic_name S, 0 [symbolic] -// CHECK:STDOUT: %S.patt: %.3 = symbolic_binding_pattern S, 0 [symbolic] -// CHECK:STDOUT: %.4: i32 = int_value 3 [template] -// CHECK:STDOUT: %.5: i32 = int_value 4 [template] -// CHECK:STDOUT: %struct.1: %.3 = struct_value (%.4, %.5) [template] -// CHECK:STDOUT: %C.3: type = class_type @C, @C(%struct.1) [template] -// CHECK:STDOUT: %F.type: type = fn_type @F [template] -// CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %.8: i32 = int_value 2 [template] -// CHECK:STDOUT: %.9: i32 = int_value 1 [template] -// CHECK:STDOUT: %struct.2: %.3 = struct_value (%.9, %.8) [template] -// CHECK:STDOUT: %C.4: type = class_type @C, @C(%struct.2) [template] -// CHECK:STDOUT: } +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.3, @impl.3(%N) [symbolic = %Convert.type (constants.%Convert.type.4)] +// CHECK:STDOUT: %Convert: @impl.3.%Convert.type (%Convert.type.4) = struct_value () [symbolic = %Convert (constants.%Convert.4)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.8)] // CHECK:STDOUT: -// CHECK:STDOUT: imports { +// CHECK:STDOUT: impl: imports.%import_ref.16 as imports.%import_ref.17 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.18 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.4: imports.%import_ref.19 as imports.%import_ref.20 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.21 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.5(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.4, @impl.5(%N) [symbolic = %Convert.type (constants.%Convert.type.6)] +// CHECK:STDOUT: %Convert: @impl.5.%Convert.type (%Convert.type.6) = struct_value () [symbolic = %Convert (constants.%Convert.6)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.11)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.23 as imports.%import_ref.24 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.25 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.6(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.5, @impl.6(%N) [symbolic = %Convert.type (constants.%Convert.type.7)] +// CHECK:STDOUT: %Convert: @impl.6.%Convert.type (%Convert.type.7) = struct_value () [symbolic = %Convert (constants.%Convert.7)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.12)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.26 as imports.%import_ref.27 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.28 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.7: imports.%import_ref.32 as imports.%import_ref.33 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.34 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.8(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%.1)> [symbolic = %As.type (constants.%As.type.4)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.7, @impl.8(%N) [symbolic = %Convert.type (constants.%Convert.type.10)] +// CHECK:STDOUT: %Convert: @impl.8.%Convert.type (%Convert.type.10) = struct_value () [symbolic = %Convert (constants.%Convert.10)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.17)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.37 as imports.%import_ref.38 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.39 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.9(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%.1)> [symbolic = %As.type (constants.%As.type.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.8, @impl.9(%N) [symbolic = %Convert.type (constants.%Convert.type.11)] +// CHECK:STDOUT: %Convert: @impl.9.%Convert.type (%Convert.type.11) = struct_value () [symbolic = %Convert (constants.%Convert.11)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.18)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.40 as imports.%import_ref.41 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.42 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.10: imports.%import_ref.43 as imports.%import_ref.44 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.45 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.11(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.9, @impl.11(%N) [symbolic = %Convert.type (constants.%Convert.type.13)] +// CHECK:STDOUT: %Convert: @impl.11.%Convert.type (%Convert.type.13) = struct_value () [symbolic = %Convert (constants.%Convert.13)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.21)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.47 as imports.%import_ref.48 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.49 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.12(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.10, @impl.12(%N) [symbolic = %Convert.type (constants.%Convert.type.14)] +// CHECK:STDOUT: %Convert: @impl.12.%Convert.type (%Convert.type.14) = struct_value () [symbolic = %Convert (constants.%Convert.14)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.22)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.50 as imports.%import_ref.51 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.52 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic class @C(constants.%S: %.25) { +// CHECK:STDOUT: %S: %.25 = bind_symbolic_name S, 0 [symbolic = %S (constants.%S)] +// CHECK:STDOUT: %S.patt: %.25 = symbolic_binding_pattern S, 0 [symbolic = %S.patt (constants.%S.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: class { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%import_ref.53 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.1(constants.%Dest: type, constants.%Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2)) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)] +// CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.1.%Self (%Self.2)]() -> @Convert.1.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.2(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.2.%.1 (%.5) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.3(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.3.%.1 (%.7) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.4(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.4.%.1 (%.5)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.5(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.5.%.1 (%.7)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.6(constants.%Dest: type, constants.%Self.3: @As.%As.type (%As.type.2)) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest)> [symbolic = %As.type (constants.%As.type.2)] +// CHECK:STDOUT: %Self: %As.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.4)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.6.%Self (%Self.4)]() -> @Convert.6.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.7(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.7.%.1 (%.5) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.8(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.8.%.1 (%.7) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.9(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.9.%.1 (%.5)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.10(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.10.%.1 (%.7)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() -> %C.3; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @__global_init() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %F.ref: %F.type = name_ref F, imports.%import_ref.4 [template = constants.%F] +// CHECK:STDOUT: %.loc11: ref %C.3 = temporary_storage +// CHECK:STDOUT: %F.call: init %C.3 = call %F.ref() to %.loc11 +// CHECK:STDOUT: assign file.%c_bad.var, +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(i32) { +// CHECK:STDOUT: %Dest => i32 +// CHECK:STDOUT: %Dest.patt => i32 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3 +// CHECK:STDOUT: %Self => constants.%Self.2 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.2 +// CHECK:STDOUT: %Convert => constants.%Convert.2 +// CHECK:STDOUT: %.1 => constants.%.3 +// CHECK:STDOUT: %.2 => constants.%.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@Convert.1.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.1(constants.%Dest, constants.%Self.1) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.2 +// CHECK:STDOUT: %Self => constants.%Self.1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%.5) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@impl.2.%.1) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.2(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.2(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.2(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%.7) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@impl.3.%.1) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.3(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.3(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.3(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(Core.IntLiteral) { +// CHECK:STDOUT: %Dest => Core.IntLiteral +// CHECK:STDOUT: %Dest.patt => Core.IntLiteral +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.6 +// CHECK:STDOUT: %Self => constants.%Self.2 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.5 +// CHECK:STDOUT: %Convert => constants.%Convert.5 +// CHECK:STDOUT: %.1 => constants.%.9 +// CHECK:STDOUT: %.2 => constants.%.10 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.5(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.5(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.4(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.6(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.6(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.5(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(i32) { +// CHECK:STDOUT: %Dest => i32 +// CHECK:STDOUT: %Dest.patt => i32 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type => constants.%As.type.3 +// CHECK:STDOUT: %Self => constants.%Self.4 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.9 +// CHECK:STDOUT: %Convert => constants.%Convert.9 +// CHECK:STDOUT: %.1 => constants.%.15 +// CHECK:STDOUT: %.2 => constants.%.16 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(@Convert.6.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.6(constants.%Dest, constants.%Self.3) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %As.type => constants.%As.type.2 +// CHECK:STDOUT: %Self => constants.%Self.3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%.5) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(@impl.8.%.1) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.8(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %As.type => constants.%As.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.8(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %As.type => constants.%As.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.7(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%.7) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(@impl.9.%.1) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.9(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %As.type => constants.%As.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.9(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %As.type => constants.%As.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.8(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(Core.IntLiteral) { +// CHECK:STDOUT: %Dest => Core.IntLiteral +// CHECK:STDOUT: %Dest.patt => Core.IntLiteral +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type => constants.%As.type.6 +// CHECK:STDOUT: %Self => constants.%Self.4 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.12 +// CHECK:STDOUT: %Convert => constants.%Convert.12 +// CHECK:STDOUT: %.1 => constants.%.19 +// CHECK:STDOUT: %.2 => constants.%.20 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.11(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.11(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.9(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.12(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.12(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.10(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @C(constants.%S) { +// CHECK:STDOUT: %S => constants.%S +// CHECK:STDOUT: %S.patt => constants.%S +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @C(constants.%struct) { +// CHECK:STDOUT: %S => constants.%struct +// CHECK:STDOUT: %S.patt => constants.%struct +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- fail_bad_value.impl.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.2: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic] +// CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2) = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.3: type = facet_type <@ImplicitAs, @ImplicitAs(i32)> [template] +// CHECK:STDOUT: %Self.2: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Convert.type.1: type = fn_type @Convert.1, @ImplicitAs(%Dest) [symbolic] +// CHECK:STDOUT: %Convert.1: %Convert.type.1 = struct_value () [symbolic] +// CHECK:STDOUT: %.1: type = assoc_entity_type %ImplicitAs.type.2, %Convert.type.1 [symbolic] +// CHECK:STDOUT: %.2: %.1 = assoc_entity element0, imports.%import_ref.11 [symbolic] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(i32) [template] +// CHECK:STDOUT: %Convert.2: %Convert.type.2 = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type %ImplicitAs.type.3, %Convert.type.2 [template] +// CHECK:STDOUT: %.4: %.3 = assoc_entity element0, imports.%import_ref.12 [template] +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic] +// CHECK:STDOUT: %.5: type = int_type signed, %N [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.4: type = facet_type <@ImplicitAs, @ImplicitAs(%.5)> [symbolic] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.3: type = fn_type @Convert.2, @impl.2(%N) [symbolic] +// CHECK:STDOUT: %Convert.3: %Convert.type.3 = struct_value () [symbolic] +// CHECK:STDOUT: %.6: = interface_witness (%Convert.3) [symbolic] +// CHECK:STDOUT: %.7: type = int_type unsigned, %N [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.5: type = facet_type <@ImplicitAs, @ImplicitAs(%.7)> [symbolic] +// CHECK:STDOUT: %Convert.type.4: type = fn_type @Convert.3, @impl.3(%N) [symbolic] +// CHECK:STDOUT: %Convert.4: %Convert.type.4 = struct_value () [symbolic] +// CHECK:STDOUT: %.8: = interface_witness (%Convert.4) [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.6: type = facet_type <@ImplicitAs, @ImplicitAs(Core.IntLiteral)> [template] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %Convert.5: %Convert.type.5 = struct_value () [template] +// CHECK:STDOUT: %.9: type = assoc_entity_type %ImplicitAs.type.6, %Convert.type.5 [template] +// CHECK:STDOUT: %.10: %.9 = assoc_entity element0, imports.%import_ref.22 [template] +// CHECK:STDOUT: %Convert.type.6: type = fn_type @Convert.4, @impl.5(%N) [symbolic] +// CHECK:STDOUT: %Convert.6: %Convert.type.6 = struct_value () [symbolic] +// CHECK:STDOUT: %.11: = interface_witness (%Convert.6) [symbolic] +// CHECK:STDOUT: %Convert.type.7: type = fn_type @Convert.5, @impl.6(%N) [symbolic] +// CHECK:STDOUT: %Convert.7: %Convert.type.7 = struct_value () [symbolic] +// CHECK:STDOUT: %.12: = interface_witness (%Convert.7) [symbolic] +// CHECK:STDOUT: %As.type.2: type = facet_type <@As, @As(%Dest)> [symbolic] +// CHECK:STDOUT: %Self.3: @As.%As.type (%As.type.2) = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %As.type.3: type = facet_type <@As, @As(i32)> [template] +// CHECK:STDOUT: %Self.4: %As.type.2 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Convert.type.8: type = fn_type @Convert.6, @As(%Dest) [symbolic] +// CHECK:STDOUT: %Convert.8: %Convert.type.8 = struct_value () [symbolic] +// CHECK:STDOUT: %.13: type = assoc_entity_type %As.type.2, %Convert.type.8 [symbolic] +// CHECK:STDOUT: %.14: %.13 = assoc_entity element0, imports.%import_ref.35 [symbolic] +// CHECK:STDOUT: %Convert.type.9: type = fn_type @Convert.6, @As(i32) [template] +// CHECK:STDOUT: %Convert.9: %Convert.type.9 = struct_value () [template] +// CHECK:STDOUT: %.15: type = assoc_entity_type %As.type.3, %Convert.type.9 [template] +// CHECK:STDOUT: %.16: %.15 = assoc_entity element0, imports.%import_ref.36 [template] +// CHECK:STDOUT: %As.type.4: type = facet_type <@As, @As(%.5)> [symbolic] +// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.7, @impl.8(%N) [symbolic] +// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [symbolic] +// CHECK:STDOUT: %.17: = interface_witness (%Convert.10) [symbolic] +// CHECK:STDOUT: %As.type.5: type = facet_type <@As, @As(%.7)> [symbolic] +// CHECK:STDOUT: %Convert.type.11: type = fn_type @Convert.8, @impl.9(%N) [symbolic] +// CHECK:STDOUT: %Convert.11: %Convert.type.11 = struct_value () [symbolic] +// CHECK:STDOUT: %.18: = interface_witness (%Convert.11) [symbolic] +// CHECK:STDOUT: %As.type.6: type = facet_type <@As, @As(Core.IntLiteral)> [template] +// CHECK:STDOUT: %Convert.type.12: type = fn_type @Convert.6, @As(Core.IntLiteral) [template] +// CHECK:STDOUT: %Convert.12: %Convert.type.12 = struct_value () [template] +// CHECK:STDOUT: %.19: type = assoc_entity_type %As.type.6, %Convert.type.12 [template] +// CHECK:STDOUT: %.20: %.19 = assoc_entity element0, imports.%import_ref.46 [template] +// CHECK:STDOUT: %Convert.type.13: type = fn_type @Convert.9, @impl.11(%N) [symbolic] +// CHECK:STDOUT: %Convert.13: %Convert.type.13 = struct_value () [symbolic] +// CHECK:STDOUT: %.21: = interface_witness (%Convert.13) [symbolic] +// CHECK:STDOUT: %Convert.type.14: type = fn_type @Convert.10, @impl.12(%N) [symbolic] +// CHECK:STDOUT: %Convert.14: %Convert.type.14 = struct_value () [symbolic] +// CHECK:STDOUT: %.22: = interface_witness (%Convert.14) [symbolic] +// CHECK:STDOUT: %C.type: type = generic_class_type @C [template] +// CHECK:STDOUT: %C.1: %C.type = struct_value () [template] +// CHECK:STDOUT: %.25: type = struct_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %S: %.25 = bind_symbolic_name S, 0 [symbolic] +// CHECK:STDOUT: %S.patt: %.25 = symbolic_binding_pattern S, 0 [symbolic] +// CHECK:STDOUT: %.26: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.27: Core.IntLiteral = int_value 4 [template] +// CHECK:STDOUT: %.28: type = struct_type {.a: Core.IntLiteral, .b: Core.IntLiteral} [template] +// CHECK:STDOUT: %.30: %.1 = assoc_entity element0, imports.%import_ref.55 [symbolic] +// CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template] +// CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template] +// CHECK:STDOUT: %.31: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.32: = bound_method %.26, %Convert.15 [template] +// CHECK:STDOUT: %.33: i32 = int_value 3 [template] +// CHECK:STDOUT: %.34: = bound_method %.27, %Convert.15 [template] +// CHECK:STDOUT: %.35: i32 = int_value 4 [template] +// CHECK:STDOUT: %struct.1: %.25 = struct_value (%.33, %.35) [template] +// CHECK:STDOUT: %C.3: type = class_type @C, @C(%struct.1) [template] +// CHECK:STDOUT: %F.type: type = fn_type @F [template] +// CHECK:STDOUT: %F: %F.type = struct_value () [template] +// CHECK:STDOUT: %.37: i32 = int_value 2 [template] +// CHECK:STDOUT: %.38: i32 = int_value 1 [template] +// CHECK:STDOUT: %struct.2: %.25 = struct_value (%.38, %.37) [template] +// CHECK:STDOUT: %C.4: type = class_type @C, @C(%struct.2) [template] +// CHECK:STDOUT: %ImplicitAs.type.7: type = facet_type <@ImplicitAs, @ImplicitAs(%C.3)> [template] +// CHECK:STDOUT: %Convert.type.16: type = fn_type @Convert.1, @ImplicitAs(%C.3) [template] +// CHECK:STDOUT: %Convert.16: %Convert.type.16 = struct_value () [template] +// CHECK:STDOUT: %.39: type = assoc_entity_type %ImplicitAs.type.7, %Convert.type.16 [template] +// CHECK:STDOUT: %.40: %.39 = assoc_entity element0, imports.%import_ref.11 [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { // CHECK:STDOUT: %import_ref.1 = import_ref Implicit//default, inst+17, unloaded -// CHECK:STDOUT: %import_ref.2 = import_ref Implicit//default, inst+47, unloaded -// CHECK:STDOUT: %import_ref.3: %C.type = import_ref Implicit//default, inst+86, loaded [template = constants.%C.1] -// CHECK:STDOUT: %import_ref.4: %F.type = import_ref Implicit//default, inst+111, loaded [template = constants.%F] +// CHECK:STDOUT: %import_ref.2 = import_ref Implicit//default, inst+411, unloaded +// CHECK:STDOUT: %import_ref.3: %C.type = import_ref Implicit//default, inst+465, loaded [template = constants.%C.1] +// CHECK:STDOUT: %import_ref.4: %F.type = import_ref Implicit//default, inst+505, loaded [template = constants.%F] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .ImplicitAs = %import_ref.6 +// CHECK:STDOUT: .ImplicitAs = %import_ref.54 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.5 = import_ref Implicit//default, inst+91, unloaded +// CHECK:STDOUT: %import_ref.5 = import_ref Implicit//default, inst+35, unloaded +// CHECK:STDOUT: %import_ref.6: @ImplicitAs.%.1 (%.1) = import_ref Implicit//default, inst+36, loaded [symbolic = @ImplicitAs.%.2 (constants.%.30)] +// CHECK:STDOUT: %import_ref.7 = import_ref Implicit//default, inst+37, unloaded +// CHECK:STDOUT: %import_ref.8: type = import_ref Implicit//default, inst+71, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.9: type = import_ref Implicit//default, inst+72, loaded [template = constants.%ImplicitAs.type.3] +// CHECK:STDOUT: %import_ref.10: = import_ref Implicit//default, inst+73, loaded [template = constants.%.31] +// CHECK:STDOUT: %import_ref.11 = import_ref Implicit//default, inst+52, unloaded +// CHECK:STDOUT: %import_ref.13: type = import_ref Implicit//default, inst+83, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.14: type = import_ref Implicit//default, inst+84, loaded [symbolic = @impl.2.%ImplicitAs.type (constants.%ImplicitAs.type.4)] +// CHECK:STDOUT: %import_ref.15 = import_ref Implicit//default, inst+85, unloaded +// CHECK:STDOUT: %import_ref.16: type = import_ref Implicit//default, inst+113, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.17: type = import_ref Implicit//default, inst+114, loaded [symbolic = @impl.3.%ImplicitAs.type (constants.%ImplicitAs.type.5)] +// CHECK:STDOUT: %import_ref.18 = import_ref Implicit//default, inst+115, unloaded +// CHECK:STDOUT: %import_ref.19: type = import_ref Implicit//default, inst+138, loaded [template = i32] +// CHECK:STDOUT: %import_ref.20: type = import_ref Implicit//default, inst+139, loaded [template = constants.%ImplicitAs.type.6] +// CHECK:STDOUT: %import_ref.21 = import_ref Implicit//default, inst+140, unloaded +// CHECK:STDOUT: %import_ref.23: type = import_ref Implicit//default, inst+151, loaded [symbolic = @impl.5.%.1 (constants.%.5)] +// CHECK:STDOUT: %import_ref.24: type = import_ref Implicit//default, inst+152, loaded [template = constants.%ImplicitAs.type.6] +// CHECK:STDOUT: %import_ref.25 = import_ref Implicit//default, inst+153, unloaded +// CHECK:STDOUT: %import_ref.26: type = import_ref Implicit//default, inst+178, loaded [symbolic = @impl.6.%.1 (constants.%.7)] +// CHECK:STDOUT: %import_ref.27: type = import_ref Implicit//default, inst+179, loaded [template = constants.%ImplicitAs.type.6] +// CHECK:STDOUT: %import_ref.28 = import_ref Implicit//default, inst+180, unloaded +// CHECK:STDOUT: %import_ref.29 = import_ref Implicit//default, inst+210, unloaded +// CHECK:STDOUT: %import_ref.30 = import_ref Implicit//default, inst+211, unloaded +// CHECK:STDOUT: %import_ref.31 = import_ref Implicit//default, inst+212, unloaded +// CHECK:STDOUT: %import_ref.32: type = import_ref Implicit//default, inst+214, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.33: type = import_ref Implicit//default, inst+215, loaded [template = constants.%As.type.3] +// CHECK:STDOUT: %import_ref.34 = import_ref Implicit//default, inst+216, unloaded +// CHECK:STDOUT: %import_ref.35 = import_ref Implicit//default, inst+231, unloaded +// CHECK:STDOUT: %import_ref.37: type = import_ref Implicit//default, inst+253, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.38: type = import_ref Implicit//default, inst+254, loaded [symbolic = @impl.8.%As.type (constants.%As.type.4)] +// CHECK:STDOUT: %import_ref.39 = import_ref Implicit//default, inst+255, unloaded +// CHECK:STDOUT: %import_ref.40: type = import_ref Implicit//default, inst+282, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.41: type = import_ref Implicit//default, inst+283, loaded [symbolic = @impl.9.%As.type (constants.%As.type.5)] +// CHECK:STDOUT: %import_ref.42 = import_ref Implicit//default, inst+284, unloaded +// CHECK:STDOUT: %import_ref.43: type = import_ref Implicit//default, inst+307, loaded [template = i32] +// CHECK:STDOUT: %import_ref.44: type = import_ref Implicit//default, inst+308, loaded [template = constants.%As.type.6] +// CHECK:STDOUT: %import_ref.45 = import_ref Implicit//default, inst+309, unloaded +// CHECK:STDOUT: %import_ref.47: type = import_ref Implicit//default, inst+320, loaded [symbolic = @impl.11.%.1 (constants.%.5)] +// CHECK:STDOUT: %import_ref.48: type = import_ref Implicit//default, inst+321, loaded [template = constants.%As.type.6] +// CHECK:STDOUT: %import_ref.49 = import_ref Implicit//default, inst+322, unloaded +// CHECK:STDOUT: %import_ref.50: type = import_ref Implicit//default, inst+347, loaded [symbolic = @impl.12.%.1 (constants.%.7)] +// CHECK:STDOUT: %import_ref.51: type = import_ref Implicit//default, inst+348, loaded [template = constants.%As.type.6] +// CHECK:STDOUT: %import_ref.52 = import_ref Implicit//default, inst+349, unloaded +// CHECK:STDOUT: %import_ref.53 = import_ref Implicit//default, inst+470, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -482,28 +2014,320 @@ var c_bad: C({.a = 3, .b = 4}) = F(); // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%import_ref.3 [template = constants.%C.1] -// CHECK:STDOUT: %.loc9_20: i32 = int_value 3 [template = constants.%.4] -// CHECK:STDOUT: %.loc9_28: i32 = int_value 4 [template = constants.%.5] -// CHECK:STDOUT: %.loc9_29: %.3 = struct_literal (%.loc9_20, %.loc9_28) -// CHECK:STDOUT: %struct: %.3 = struct_value (%.loc9_20, %.loc9_28) [template = constants.%struct.1] -// CHECK:STDOUT: %.loc9_13: %.3 = converted %.loc9_29, %struct [template = constants.%struct.1] +// CHECK:STDOUT: %.loc9_20: Core.IntLiteral = int_value 3 [template = constants.%.26] +// CHECK:STDOUT: %.loc9_28: Core.IntLiteral = int_value 4 [template = constants.%.27] +// CHECK:STDOUT: %.loc9_29.1: %.28 = struct_literal (%.loc9_20, %.loc9_28) +// CHECK:STDOUT: %.loc9_29.2: %Convert.type.2 = interface_witness_access constants.%.31, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_29.3: = bound_method %.loc9_20, %.loc9_29.2 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc9_29.1: init i32 = call %.loc9_29.3(%.loc9_20) [template = constants.%.33] +// CHECK:STDOUT: %.loc9_29.4: i32 = value_of_initializer %int.convert_checked.loc9_29.1 [template = constants.%.33] +// CHECK:STDOUT: %.loc9_29.5: i32 = converted %.loc9_20, %.loc9_29.4 [template = constants.%.33] +// CHECK:STDOUT: %.loc9_29.6: %Convert.type.2 = interface_witness_access constants.%.31, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_29.7: = bound_method %.loc9_28, %.loc9_29.6 [template = constants.%.34] +// CHECK:STDOUT: %int.convert_checked.loc9_29.2: init i32 = call %.loc9_29.7(%.loc9_28) [template = constants.%.35] +// CHECK:STDOUT: %.loc9_29.8: i32 = value_of_initializer %int.convert_checked.loc9_29.2 [template = constants.%.35] +// CHECK:STDOUT: %.loc9_29.9: i32 = converted %.loc9_28, %.loc9_29.8 [template = constants.%.35] +// CHECK:STDOUT: %struct: %.25 = struct_value (%.loc9_29.5, %.loc9_29.9) [template = constants.%struct.1] +// CHECK:STDOUT: %.loc9_13: %.25 = converted %.loc9_29.1, %struct [template = constants.%struct.1] // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%struct.1) [template = constants.%C.3] // CHECK:STDOUT: %c_bad.var: ref %C.3 = var c_bad // CHECK:STDOUT: %c_bad: ref %C.3 = bind_name c_bad, %c_bad.var // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @C(constants.%S: %.3) { -// CHECK:STDOUT: %S: %.3 = bind_symbolic_name S, 0 [symbolic = %S (constants.%S)] -// CHECK:STDOUT: %S.patt: %.3 = symbolic_binding_pattern S, 0 [symbolic = %S.patt (constants.%S.patt)] +// CHECK:STDOUT: generic interface @ImplicitAs(constants.%Dest: type) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)] +// CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.1, @ImplicitAs(%Dest) [symbolic = %Convert.type (constants.%Convert.type.1)] +// CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.1) = struct_value () [symbolic = %Convert (constants.%Convert.1)] +// CHECK:STDOUT: %.1: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2), @ImplicitAs.%Convert.type (%Convert.type.1) [symbolic = %.1 (constants.%.1)] +// CHECK:STDOUT: %.2: @ImplicitAs.%.1 (%.1) = assoc_entity element0, imports.%import_ref.11 [symbolic = %.2 (constants.%.2)] // CHECK:STDOUT: -// CHECK:STDOUT: class { +// CHECK:STDOUT: interface { // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = imports.%import_ref.5 +// CHECK:STDOUT: .Convert = imports.%import_ref.6 +// CHECK:STDOUT: witness = (imports.%import_ref.7) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @As(constants.%Dest: type) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest)> [symbolic = %As.type (constants.%As.type.2)] +// CHECK:STDOUT: %Self: %As.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.4)] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.6, @As(%Dest) [symbolic = %Convert.type (constants.%Convert.type.8)] +// CHECK:STDOUT: %Convert: @As.%Convert.type (%Convert.type.8) = struct_value () [symbolic = %Convert (constants.%Convert.8)] +// CHECK:STDOUT: %.1: type = assoc_entity_type @As.%As.type (%As.type.2), @As.%Convert.type (%Convert.type.8) [symbolic = %.1 (constants.%.13)] +// CHECK:STDOUT: %.2: @As.%.1 (%.13) = assoc_entity element0, imports.%import_ref.35 [symbolic = %.2 (constants.%.14)] +// CHECK:STDOUT: +// CHECK:STDOUT: interface { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%import_ref.29 +// CHECK:STDOUT: .Convert = imports.%import_ref.30 +// CHECK:STDOUT: witness = (imports.%import_ref.31) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.1: imports.%import_ref.8 as imports.%import_ref.9 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.10 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.2(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%.1)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.4)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.2, @impl.2(%N) [symbolic = %Convert.type (constants.%Convert.type.3)] +// CHECK:STDOUT: %Convert: @impl.2.%Convert.type (%Convert.type.3) = struct_value () [symbolic = %Convert (constants.%Convert.3)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.6)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.13 as imports.%import_ref.14 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.15 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.3(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%.1)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.3, @impl.3(%N) [symbolic = %Convert.type (constants.%Convert.type.4)] +// CHECK:STDOUT: %Convert: @impl.3.%Convert.type (%Convert.type.4) = struct_value () [symbolic = %Convert (constants.%Convert.4)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.8)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.16 as imports.%import_ref.17 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.18 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.4: imports.%import_ref.19 as imports.%import_ref.20 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.21 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.5(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.4, @impl.5(%N) [symbolic = %Convert.type (constants.%Convert.type.6)] +// CHECK:STDOUT: %Convert: @impl.5.%Convert.type (%Convert.type.6) = struct_value () [symbolic = %Convert (constants.%Convert.6)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.11)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.23 as imports.%import_ref.24 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.25 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.6(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.5, @impl.6(%N) [symbolic = %Convert.type (constants.%Convert.type.7)] +// CHECK:STDOUT: %Convert: @impl.6.%Convert.type (%Convert.type.7) = struct_value () [symbolic = %Convert (constants.%Convert.7)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.12)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.26 as imports.%import_ref.27 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.28 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.7: imports.%import_ref.32 as imports.%import_ref.33 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.34 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.8(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%.1)> [symbolic = %As.type (constants.%As.type.4)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.7, @impl.8(%N) [symbolic = %Convert.type (constants.%Convert.type.10)] +// CHECK:STDOUT: %Convert: @impl.8.%Convert.type (%Convert.type.10) = struct_value () [symbolic = %Convert (constants.%Convert.10)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.17)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.37 as imports.%import_ref.38 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.39 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.9(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%.1)> [symbolic = %As.type (constants.%As.type.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.8, @impl.9(%N) [symbolic = %Convert.type (constants.%Convert.type.11)] +// CHECK:STDOUT: %Convert: @impl.9.%Convert.type (%Convert.type.11) = struct_value () [symbolic = %Convert (constants.%Convert.11)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.18)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.40 as imports.%import_ref.41 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.42 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.10: imports.%import_ref.43 as imports.%import_ref.44 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.45 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.11(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.9, @impl.11(%N) [symbolic = %Convert.type (constants.%Convert.type.13)] +// CHECK:STDOUT: %Convert: @impl.11.%Convert.type (%Convert.type.13) = struct_value () [symbolic = %Convert (constants.%Convert.13)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.21)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.47 as imports.%import_ref.48 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.49 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.12(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.10, @impl.12(%N) [symbolic = %Convert.type (constants.%Convert.type.14)] +// CHECK:STDOUT: %Convert: @impl.12.%Convert.type (%Convert.type.14) = struct_value () [symbolic = %Convert (constants.%Convert.14)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.22)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.50 as imports.%import_ref.51 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.52 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic class @C(constants.%S: %.25) { +// CHECK:STDOUT: %S: %.25 = bind_symbolic_name S, 0 [symbolic = %S (constants.%S)] +// CHECK:STDOUT: %S.patt: %.25 = symbolic_binding_pattern S, 0 [symbolic = %S.patt (constants.%S.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: class { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%import_ref.53 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.1(constants.%Dest: type, constants.%Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2)) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)] +// CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.1.%Self (%Self.2)]() -> @Convert.1.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.2(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.2.%.1 (%.5) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.3(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.3.%.1 (%.7) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.4(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.4.%.1 (%.5)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.5(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.5.%.1 (%.7)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.6(constants.%Dest: type, constants.%Self.3: @As.%As.type (%As.type.2)) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest)> [symbolic = %As.type (constants.%As.type.2)] +// CHECK:STDOUT: %Self: %As.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.4)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.6.%Self (%Self.4)]() -> @Convert.6.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.7(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.7.%.1 (%.5) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.8(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.8.%.1 (%.7) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.9(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.9.%.1 (%.5)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.10(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.10.%.1 (%.7)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Convert.11[%self.param_patt: Core.IntLiteral]() -> i32 = "int.convert_checked"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> %C.4; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { @@ -516,6 +2340,284 @@ var c_bad: C({.a = 3, .b = 4}) = F(); // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(i32) { +// CHECK:STDOUT: %Dest => i32 +// CHECK:STDOUT: %Dest.patt => i32 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3 +// CHECK:STDOUT: %Self => constants.%Self.2 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.2 +// CHECK:STDOUT: %Convert => constants.%Convert.2 +// CHECK:STDOUT: %.1 => constants.%.3 +// CHECK:STDOUT: %.2 => constants.%.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@Convert.1.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.1(constants.%Dest, constants.%Self.1) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.2 +// CHECK:STDOUT: %Self => constants.%Self.1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%.5) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@impl.2.%.1) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.2(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.2(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.2(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%.7) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@impl.3.%.1) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.3(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.3(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.3(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(Core.IntLiteral) { +// CHECK:STDOUT: %Dest => Core.IntLiteral +// CHECK:STDOUT: %Dest.patt => Core.IntLiteral +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.6 +// CHECK:STDOUT: %Self => constants.%Self.2 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.5 +// CHECK:STDOUT: %Convert => constants.%Convert.5 +// CHECK:STDOUT: %.1 => constants.%.9 +// CHECK:STDOUT: %.2 => constants.%.10 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.5(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.5(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.4(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.6(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.6(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.5(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(i32) { +// CHECK:STDOUT: %Dest => i32 +// CHECK:STDOUT: %Dest.patt => i32 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type => constants.%As.type.3 +// CHECK:STDOUT: %Self => constants.%Self.4 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.9 +// CHECK:STDOUT: %Convert => constants.%Convert.9 +// CHECK:STDOUT: %.1 => constants.%.15 +// CHECK:STDOUT: %.2 => constants.%.16 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(@Convert.6.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.6(constants.%Dest, constants.%Self.3) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %As.type => constants.%As.type.2 +// CHECK:STDOUT: %Self => constants.%Self.3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%.5) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(@impl.8.%.1) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.8(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %As.type => constants.%As.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.8(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %As.type => constants.%As.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.7(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%.7) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(@impl.9.%.1) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.9(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %As.type => constants.%As.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.9(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %As.type => constants.%As.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.8(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(Core.IntLiteral) { +// CHECK:STDOUT: %Dest => Core.IntLiteral +// CHECK:STDOUT: %Dest.patt => Core.IntLiteral +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type => constants.%As.type.6 +// CHECK:STDOUT: %Self => constants.%Self.4 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.12 +// CHECK:STDOUT: %Convert => constants.%Convert.12 +// CHECK:STDOUT: %.1 => constants.%.19 +// CHECK:STDOUT: %.2 => constants.%.20 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.11(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.11(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.9(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.12(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.12(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.10(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: specific @C(constants.%S) { // CHECK:STDOUT: %S => constants.%S // CHECK:STDOUT: %S.patt => constants.%S @@ -535,3 +2637,16 @@ var c_bad: C({.a = 3, .b = 4}) = F(); // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%C.3) { +// CHECK:STDOUT: %Dest => constants.%C.3 +// CHECK:STDOUT: %Dest.patt => constants.%C.3 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.7 +// CHECK:STDOUT: %Self => constants.%Self.2 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.16 +// CHECK:STDOUT: %Convert => constants.%Convert.16 +// CHECK:STDOUT: %.1 => constants.%.39 +// CHECK:STDOUT: %.2 => constants.%.40 +// CHECK:STDOUT: } +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/struct/literal_member_access.carbon b/toolchain/check/testdata/struct/literal_member_access.carbon index 37c345610abeb..fa68046e74863 100644 --- a/toolchain/check/testdata/struct/literal_member_access.carbon +++ b/toolchain/check/testdata/struct/literal_member_access.carbon @@ -24,9 +24,9 @@ fn F() -> i32 { // CHECK:STDOUT: %G: %G.type = struct_value () [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %.2: i32 = int_value 1 [template] -// CHECK:STDOUT: %.4: i32 = int_value 3 [template] -// CHECK:STDOUT: %.5: type = struct_type {.a: i32, .b: %.1, .c: i32} [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.5: type = struct_type {.a: Core.IntLiteral, .b: %.1, .c: Core.IntLiteral} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -77,11 +77,11 @@ fn F() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc14_16: i32 = int_value 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc14_16: Core.IntLiteral = int_value 1 [template = constants.%.2] // CHECK:STDOUT: %G.ref: %G.type = name_ref G, file.%G.decl [template = constants.%G] // CHECK:STDOUT: %.loc14_25.1: ref %.1 = temporary_storage // CHECK:STDOUT: %G.call: init %.1 = call %G.ref() to %.loc14_25.1 -// CHECK:STDOUT: %.loc14_34: i32 = int_value 3 [template = constants.%.4] +// CHECK:STDOUT: %.loc14_34: Core.IntLiteral = int_value 3 [template = constants.%.4] // CHECK:STDOUT: %.loc14_35.1: %.5 = struct_literal (%.loc14_16, %G.call, %.loc14_34) // CHECK:STDOUT: %.loc14_25.2: ref %.1 = temporary %.loc14_25.1, %G.call // CHECK:STDOUT: %.loc14_25.3: ref i32 = struct_access %.loc14_25.2, element0 diff --git a/toolchain/check/testdata/struct/member_access.carbon b/toolchain/check/testdata/struct/member_access.carbon index 6ef0d7ae0cf02..edb4cf00dbb71 100644 --- a/toolchain/check/testdata/struct/member_access.carbon +++ b/toolchain/check/testdata/struct/member_access.carbon @@ -22,14 +22,22 @@ var z: i32 = y; // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %.2: type = struct_type {.a: f64, .b: i32} [template] // CHECK:STDOUT: %.4: f64 = float_literal 0 [template] -// CHECK:STDOUT: %.5: i32 = int_value 1 [template] -// CHECK:STDOUT: %struct: %.2 = struct_value (%.4, %.5) [template] +// CHECK:STDOUT: %.5: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.6: type = struct_type {.a: f64, .b: Core.IntLiteral} [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: %.30: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.31: = bound_method %.5, %Convert.15 [template] +// CHECK:STDOUT: %.32: i32 = int_value 1 [template] +// CHECK:STDOUT: %struct: %.2 = struct_value (%.4, %.32) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Float = %import_ref.1 // CHECK:STDOUT: .Int32 = %import_ref.2 +// CHECK:STDOUT: .ImplicitAs = %import_ref.3 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -68,14 +76,18 @@ var z: i32 = y; // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc11_35: f64 = float_literal 0 [template = constants.%.4] -// CHECK:STDOUT: %.loc11_45: i32 = int_value 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc11_46.1: %.2 = struct_literal (%.loc11_35, %.loc11_45) +// CHECK:STDOUT: %.loc11_45: Core.IntLiteral = int_value 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_46.1: %.6 = struct_literal (%.loc11_35, %.loc11_45) // CHECK:STDOUT: %.loc11_46.2: ref f64 = struct_access file.%x.var, element0 // CHECK:STDOUT: %.loc11_46.3: init f64 = initialize_from %.loc11_35 to %.loc11_46.2 [template = constants.%.4] -// CHECK:STDOUT: %.loc11_46.4: ref i32 = struct_access file.%x.var, element1 -// CHECK:STDOUT: %.loc11_46.5: init i32 = initialize_from %.loc11_45 to %.loc11_46.4 [template = constants.%.5] -// CHECK:STDOUT: %.loc11_46.6: init %.2 = struct_init (%.loc11_46.3, %.loc11_46.5) to file.%x.var [template = constants.%struct] -// CHECK:STDOUT: %.loc11_47: init %.2 = converted %.loc11_46.1, %.loc11_46.6 [template = constants.%struct] +// CHECK:STDOUT: %.loc11_46.4: %Convert.type.2 = interface_witness_access constants.%.30, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_46.5: = bound_method %.loc11_45, %.loc11_46.4 [template = constants.%.31] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc11_46.5(%.loc11_45) [template = constants.%.32] +// CHECK:STDOUT: %.loc11_46.6: init i32 = converted %.loc11_45, %int.convert_checked [template = constants.%.32] +// CHECK:STDOUT: %.loc11_46.7: ref i32 = struct_access file.%x.var, element1 +// CHECK:STDOUT: %.loc11_46.8: init i32 = initialize_from %.loc11_46.6 to %.loc11_46.7 [template = constants.%.32] +// CHECK:STDOUT: %.loc11_46.9: init %.2 = struct_init (%.loc11_46.3, %.loc11_46.8) to file.%x.var [template = constants.%struct] +// CHECK:STDOUT: %.loc11_47: init %.2 = converted %.loc11_46.1, %.loc11_46.9 [template = constants.%struct] // CHECK:STDOUT: assign file.%x.var, %.loc11_47 // CHECK:STDOUT: %x.ref: ref %.2 = name_ref x, file.%x // CHECK:STDOUT: %.loc12_15.1: ref i32 = struct_access %x.ref, element1 diff --git a/toolchain/check/testdata/struct/one_entry.carbon b/toolchain/check/testdata/struct/one_entry.carbon index 842fb65486858..bd012ba4e4326 100644 --- a/toolchain/check/testdata/struct/one_entry.carbon +++ b/toolchain/check/testdata/struct/one_entry.carbon @@ -17,13 +17,21 @@ var y: {.a: i32} = x; // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %.1: type = struct_type {.a: i32} [template] -// CHECK:STDOUT: %.2: i32 = int_value 4 [template] -// CHECK:STDOUT: %struct: %.1 = struct_value (%.2) [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 4 [template] +// CHECK:STDOUT: %.3: type = struct_type {.a: Core.IntLiteral} [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: %.27: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.28: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.29: i32 = int_value 4 [template] +// CHECK:STDOUT: %struct: %.1 = struct_value (%.29) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -52,10 +60,14 @@ var y: {.a: i32} = x; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_26: i32 = int_value 4 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_27.1: %.1 = struct_literal (%.loc11_26) -// CHECK:STDOUT: %.loc11_27.2: init %.1 = struct_init (%.loc11_26) to file.%x.var [template = constants.%struct] -// CHECK:STDOUT: %.loc11_28: init %.1 = converted %.loc11_27.1, %.loc11_27.2 [template = constants.%struct] +// CHECK:STDOUT: %.loc11_26: Core.IntLiteral = int_value 4 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_27.1: %.3 = struct_literal (%.loc11_26) +// CHECK:STDOUT: %.loc11_27.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_27.3: = bound_method %.loc11_26, %.loc11_27.2 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc11_27.3(%.loc11_26) [template = constants.%.29] +// CHECK:STDOUT: %.loc11_27.4: init i32 = converted %.loc11_26, %int.convert_checked [template = constants.%.29] +// CHECK:STDOUT: %.loc11_27.5: init %.1 = struct_init (%.loc11_27.4) to file.%x.var [template = constants.%struct] +// CHECK:STDOUT: %.loc11_28: init %.1 = converted %.loc11_27.1, %.loc11_27.5 [template = constants.%struct] // CHECK:STDOUT: assign file.%x.var, %.loc11_28 // CHECK:STDOUT: %x.ref: ref %.1 = name_ref x, file.%x // CHECK:STDOUT: %.loc12_20.1: ref i32 = struct_access %x.ref, element0 diff --git a/toolchain/check/testdata/struct/tuple_as_element.carbon b/toolchain/check/testdata/struct/tuple_as_element.carbon index bb441db9eeaad..da8421a7e2a0c 100644 --- a/toolchain/check/testdata/struct/tuple_as_element.carbon +++ b/toolchain/check/testdata/struct/tuple_as_element.carbon @@ -19,15 +19,26 @@ var y: {.a: i32, .b: (i32,)} = x; // CHECK:STDOUT: %tuple.type.1: type = tuple_type (type) [template] // CHECK:STDOUT: %tuple.type.2: type = tuple_type (i32) [template] // CHECK:STDOUT: %.1: type = struct_type {.a: i32, .b: %tuple.type.2} [template] -// CHECK:STDOUT: %.3: i32 = int_value 1 [template] -// CHECK:STDOUT: %.4: i32 = int_value 2 [template] -// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.4) [template] -// CHECK:STDOUT: %struct: %.1 = struct_value (%.3, %tuple) [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %tuple.type.3: type = tuple_type (Core.IntLiteral) [template] +// CHECK:STDOUT: %.5: type = struct_type {.a: Core.IntLiteral, .b: %tuple.type.3} [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: %.29: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.30: = bound_method %.3, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 1 [template] +// CHECK:STDOUT: %.32: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.33: i32 = int_value 2 [template] +// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.33) [template] +// CHECK:STDOUT: %struct: %.1 = struct_value (%.31, %tuple) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -66,18 +77,26 @@ var y: {.a: i32, .b: (i32,)} = x; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_38: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc11_47: i32 = int_value 2 [template = constants.%.4] -// CHECK:STDOUT: %.loc11_49.1: %tuple.type.2 = tuple_literal (%.loc11_47) -// CHECK:STDOUT: %.loc11_50.1: %.1 = struct_literal (%.loc11_38, %.loc11_49.1) -// CHECK:STDOUT: %.loc11_50.2: ref i32 = struct_access file.%x.var, element0 -// CHECK:STDOUT: %.loc11_50.3: init i32 = initialize_from %.loc11_38 to %.loc11_50.2 [template = constants.%.3] -// CHECK:STDOUT: %.loc11_50.4: ref %tuple.type.2 = struct_access file.%x.var, element1 -// CHECK:STDOUT: %.loc11_49.2: init %tuple.type.2 = tuple_init (%.loc11_47) to %.loc11_50.4 [template = constants.%tuple] -// CHECK:STDOUT: %.loc11_50.5: init %tuple.type.2 = converted %.loc11_49.1, %.loc11_49.2 [template = constants.%tuple] -// CHECK:STDOUT: %.loc11_50.6: init %tuple.type.2 = initialize_from %.loc11_50.5 to %.loc11_50.4 [template = constants.%tuple] -// CHECK:STDOUT: %.loc11_50.7: init %.1 = struct_init (%.loc11_50.3, %.loc11_50.6) to file.%x.var [template = constants.%struct] -// CHECK:STDOUT: %.loc11_51: init %.1 = converted %.loc11_50.1, %.loc11_50.7 [template = constants.%struct] +// CHECK:STDOUT: %.loc11_38: Core.IntLiteral = int_value 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc11_47: Core.IntLiteral = int_value 2 [template = constants.%.4] +// CHECK:STDOUT: %.loc11_49.1: %tuple.type.3 = tuple_literal (%.loc11_47) +// CHECK:STDOUT: %.loc11_50.1: %.5 = struct_literal (%.loc11_38, %.loc11_49.1) +// CHECK:STDOUT: %.loc11_50.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_50.3: = bound_method %.loc11_38, %.loc11_50.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc11_50: init i32 = call %.loc11_50.3(%.loc11_38) [template = constants.%.31] +// CHECK:STDOUT: %.loc11_50.4: init i32 = converted %.loc11_38, %int.convert_checked.loc11_50 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_50.5: ref i32 = struct_access file.%x.var, element0 +// CHECK:STDOUT: %.loc11_50.6: init i32 = initialize_from %.loc11_50.4 to %.loc11_50.5 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_49.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_49.3: = bound_method %.loc11_47, %.loc11_49.2 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc11_49: init i32 = call %.loc11_49.3(%.loc11_47) [template = constants.%.33] +// CHECK:STDOUT: %.loc11_49.4: init i32 = converted %.loc11_47, %int.convert_checked.loc11_49 [template = constants.%.33] +// CHECK:STDOUT: %.loc11_50.7: ref %tuple.type.2 = struct_access file.%x.var, element1 +// CHECK:STDOUT: %.loc11_49.5: init %tuple.type.2 = tuple_init (%.loc11_49.4) to %.loc11_50.7 [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_50.8: init %tuple.type.2 = converted %.loc11_49.1, %.loc11_49.5 [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_50.9: init %tuple.type.2 = initialize_from %.loc11_50.8 to %.loc11_50.7 [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_50.10: init %.1 = struct_init (%.loc11_50.6, %.loc11_50.9) to file.%x.var [template = constants.%struct] +// CHECK:STDOUT: %.loc11_51: init %.1 = converted %.loc11_50.1, %.loc11_50.10 [template = constants.%struct] // CHECK:STDOUT: assign file.%x.var, %.loc11_51 // CHECK:STDOUT: %x.ref: ref %.1 = name_ref x, file.%x // CHECK:STDOUT: %.loc12_32.1: ref i32 = struct_access %x.ref, element0 diff --git a/toolchain/check/testdata/struct/two_entries.carbon b/toolchain/check/testdata/struct/two_entries.carbon index 5ec06730b0b64..9cbbe99ae47b5 100644 --- a/toolchain/check/testdata/struct/two_entries.carbon +++ b/toolchain/check/testdata/struct/two_entries.carbon @@ -20,14 +20,24 @@ var y: {.a: i32, .b: i32} = x; // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %.1: type = struct_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.3: i32 = int_value 1 [template] -// CHECK:STDOUT: %.4: i32 = int_value 2 [template] -// CHECK:STDOUT: %struct: %.1 = struct_value (%.3, %.4) [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.5: type = struct_type {.a: Core.IntLiteral, .b: Core.IntLiteral} [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: %.29: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.30: = bound_method %.3, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 1 [template] +// CHECK:STDOUT: %.32: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.33: i32 = int_value 2 [template] +// CHECK:STDOUT: %struct: %.1 = struct_value (%.31, %.33) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -78,23 +88,41 @@ var y: {.a: i32, .b: i32} = x; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_35: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc11_43: i32 = int_value 2 [template = constants.%.4] -// CHECK:STDOUT: %.loc11_44: %.1 = struct_literal (%.loc11_35, %.loc11_43) -// CHECK:STDOUT: %struct: %.1 = struct_value (%.loc11_35, %.loc11_43) [template = constants.%struct] -// CHECK:STDOUT: %.loc11_45: %.1 = converted %.loc11_44, %struct [template = constants.%struct] +// CHECK:STDOUT: %.loc11_35: Core.IntLiteral = int_value 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc11_43: Core.IntLiteral = int_value 2 [template = constants.%.4] +// CHECK:STDOUT: %.loc11_44.1: %.5 = struct_literal (%.loc11_35, %.loc11_43) +// CHECK:STDOUT: %.loc11_44.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_44.3: = bound_method %.loc11_35, %.loc11_44.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc11_44.1: init i32 = call %.loc11_44.3(%.loc11_35) [template = constants.%.31] +// CHECK:STDOUT: %.loc11_44.4: i32 = value_of_initializer %int.convert_checked.loc11_44.1 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_44.5: i32 = converted %.loc11_35, %.loc11_44.4 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_44.6: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_44.7: = bound_method %.loc11_43, %.loc11_44.6 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc11_44.2: init i32 = call %.loc11_44.7(%.loc11_43) [template = constants.%.33] +// CHECK:STDOUT: %.loc11_44.8: i32 = value_of_initializer %int.convert_checked.loc11_44.2 [template = constants.%.33] +// CHECK:STDOUT: %.loc11_44.9: i32 = converted %.loc11_43, %.loc11_44.8 [template = constants.%.33] +// CHECK:STDOUT: %struct: %.1 = struct_value (%.loc11_44.5, %.loc11_44.9) [template = constants.%struct] +// CHECK:STDOUT: %.loc11_45: %.1 = converted %.loc11_44.1, %struct [template = constants.%struct] // CHECK:STDOUT: %v: %.1 = bind_name v, %.loc11_45 // CHECK:STDOUT: %v.ref: %.1 = name_ref v, %v // CHECK:STDOUT: %w: %.1 = bind_name w, %v.ref -// CHECK:STDOUT: %.loc14_35: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc14_43: i32 = int_value 2 [template = constants.%.4] -// CHECK:STDOUT: %.loc14_44.1: %.1 = struct_literal (%.loc14_35, %.loc14_43) -// CHECK:STDOUT: %.loc14_44.2: ref i32 = struct_access file.%x.var, element0 -// CHECK:STDOUT: %.loc14_44.3: init i32 = initialize_from %.loc14_35 to %.loc14_44.2 [template = constants.%.3] -// CHECK:STDOUT: %.loc14_44.4: ref i32 = struct_access file.%x.var, element1 -// CHECK:STDOUT: %.loc14_44.5: init i32 = initialize_from %.loc14_43 to %.loc14_44.4 [template = constants.%.4] -// CHECK:STDOUT: %.loc14_44.6: init %.1 = struct_init (%.loc14_44.3, %.loc14_44.5) to file.%x.var [template = constants.%struct] -// CHECK:STDOUT: %.loc14_45: init %.1 = converted %.loc14_44.1, %.loc14_44.6 [template = constants.%struct] +// CHECK:STDOUT: %.loc14_35: Core.IntLiteral = int_value 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc14_43: Core.IntLiteral = int_value 2 [template = constants.%.4] +// CHECK:STDOUT: %.loc14_44.1: %.5 = struct_literal (%.loc14_35, %.loc14_43) +// CHECK:STDOUT: %.loc14_44.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc14_44.3: = bound_method %.loc14_35, %.loc14_44.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc14_44.1: init i32 = call %.loc14_44.3(%.loc14_35) [template = constants.%.31] +// CHECK:STDOUT: %.loc14_44.4: init i32 = converted %.loc14_35, %int.convert_checked.loc14_44.1 [template = constants.%.31] +// CHECK:STDOUT: %.loc14_44.5: ref i32 = struct_access file.%x.var, element0 +// CHECK:STDOUT: %.loc14_44.6: init i32 = initialize_from %.loc14_44.4 to %.loc14_44.5 [template = constants.%.31] +// CHECK:STDOUT: %.loc14_44.7: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc14_44.8: = bound_method %.loc14_43, %.loc14_44.7 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc14_44.2: init i32 = call %.loc14_44.8(%.loc14_43) [template = constants.%.33] +// CHECK:STDOUT: %.loc14_44.9: init i32 = converted %.loc14_43, %int.convert_checked.loc14_44.2 [template = constants.%.33] +// CHECK:STDOUT: %.loc14_44.10: ref i32 = struct_access file.%x.var, element1 +// CHECK:STDOUT: %.loc14_44.11: init i32 = initialize_from %.loc14_44.9 to %.loc14_44.10 [template = constants.%.33] +// CHECK:STDOUT: %.loc14_44.12: init %.1 = struct_init (%.loc14_44.6, %.loc14_44.11) to file.%x.var [template = constants.%struct] +// CHECK:STDOUT: %.loc14_45: init %.1 = converted %.loc14_44.1, %.loc14_44.12 [template = constants.%struct] // CHECK:STDOUT: assign file.%x.var, %.loc14_45 // CHECK:STDOUT: %x.ref: ref %.1 = name_ref x, file.%x // CHECK:STDOUT: %.loc15_29.1: ref i32 = struct_access %x.ref, element0 diff --git a/toolchain/check/testdata/tuple/access/element_access.carbon b/toolchain/check/testdata/tuple/access/element_access.carbon index 4e46f9b82fb11..d01fe14d16310 100644 --- a/toolchain/check/testdata/tuple/access/element_access.carbon +++ b/toolchain/check/testdata/tuple/access/element_access.carbon @@ -19,14 +19,22 @@ var c: i32 = b.0; // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %tuple.type.1: type = tuple_type (type) [template] // CHECK:STDOUT: %tuple.type.2: type = tuple_type (i32) [template] -// CHECK:STDOUT: %.1: i32 = int_value 12 [template] -// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.1) [template] -// CHECK:STDOUT: %.2: i32 = int_value 0 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 12 [template] +// CHECK:STDOUT: %tuple.type.3: type = tuple_type (Core.IntLiteral) [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 12 [template] +// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.27) [template] +// CHECK:STDOUT: %.28: Core.IntLiteral = int_value 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -63,10 +71,14 @@ var c: i32 = b.0; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_18: i32 = int_value 12 [template = constants.%.1] -// CHECK:STDOUT: %.loc11_21.1: %tuple.type.2 = tuple_literal (%.loc11_18) -// CHECK:STDOUT: %.loc11_21.2: init %tuple.type.2 = tuple_init (%.loc11_18) to file.%a.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc11_22: init %tuple.type.2 = converted %.loc11_21.1, %.loc11_21.2 [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_18: Core.IntLiteral = int_value 12 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_21.1: %tuple.type.3 = tuple_literal (%.loc11_18) +// CHECK:STDOUT: %.loc11_21.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_21.3: = bound_method %.loc11_18, %.loc11_21.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc11_21.3(%.loc11_18) [template = constants.%.27] +// CHECK:STDOUT: %.loc11_21.4: init i32 = converted %.loc11_18, %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc11_21.5: init %tuple.type.2 = tuple_init (%.loc11_21.4) to file.%a.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_22: init %tuple.type.2 = converted %.loc11_21.1, %.loc11_21.5 [template = constants.%tuple] // CHECK:STDOUT: assign file.%a.var, %.loc11_22 // CHECK:STDOUT: %a.ref: ref %tuple.type.2 = name_ref a, file.%a // CHECK:STDOUT: %.loc12_17.1: ref i32 = tuple_access %a.ref, element0 @@ -75,7 +87,7 @@ var c: i32 = b.0; // CHECK:STDOUT: %.loc12_18: init %tuple.type.2 = converted %a.ref, %.loc12_17.3 // CHECK:STDOUT: assign file.%b.var, %.loc12_18 // CHECK:STDOUT: %b.ref: ref %tuple.type.2 = name_ref b, file.%b -// CHECK:STDOUT: %.loc13_16: i32 = int_value 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc13_16: Core.IntLiteral = int_value 0 [template = constants.%.28] // CHECK:STDOUT: %.loc13_15.1: ref i32 = tuple_access %b.ref, element0 // CHECK:STDOUT: %.loc13_15.2: i32 = bind_value %.loc13_15.1 // CHECK:STDOUT: assign file.%c.var, %.loc13_15.2 diff --git a/toolchain/check/testdata/tuple/access/fail_access_error.carbon b/toolchain/check/testdata/tuple/access/fail_access_error.carbon index 1def9810389c4..5fb1dcde490c1 100644 --- a/toolchain/check/testdata/tuple/access/fail_access_error.carbon +++ b/toolchain/check/testdata/tuple/access/fail_access_error.carbon @@ -21,14 +21,24 @@ var b: i32 = a.(oops); // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %tuple.type.1: type = tuple_type (type, type) [template] // CHECK:STDOUT: %tuple.type.2: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.2: i32 = int_value 12 [template] -// CHECK:STDOUT: %.3: i32 = int_value 6 [template] -// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.2, %.3) [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 12 [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 6 [template] +// CHECK:STDOUT: %tuple.type.3: type = tuple_type (Core.IntLiteral, Core.IntLiteral) [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: %.27: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.28: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.29: i32 = int_value 12 [template] +// CHECK:STDOUT: %.30: = bound_method %.3, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 6 [template] +// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.29, %.31) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -60,15 +70,23 @@ var b: i32 = a.(oops); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_22: i32 = int_value 12 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_26: i32 = int_value 6 [template = constants.%.3] -// CHECK:STDOUT: %.loc11_27.1: %tuple.type.2 = tuple_literal (%.loc11_22, %.loc11_26) -// CHECK:STDOUT: %.loc11_27.2: ref i32 = tuple_access file.%a.var, element0 -// CHECK:STDOUT: %.loc11_27.3: init i32 = initialize_from %.loc11_22 to %.loc11_27.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_27.4: ref i32 = tuple_access file.%a.var, element1 -// CHECK:STDOUT: %.loc11_27.5: init i32 = initialize_from %.loc11_26 to %.loc11_27.4 [template = constants.%.3] -// CHECK:STDOUT: %.loc11_27.6: init %tuple.type.2 = tuple_init (%.loc11_27.3, %.loc11_27.5) to file.%a.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc11_28: init %tuple.type.2 = converted %.loc11_27.1, %.loc11_27.6 [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_22: Core.IntLiteral = int_value 12 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_26: Core.IntLiteral = int_value 6 [template = constants.%.3] +// CHECK:STDOUT: %.loc11_27.1: %tuple.type.3 = tuple_literal (%.loc11_22, %.loc11_26) +// CHECK:STDOUT: %.loc11_27.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_27.3: = bound_method %.loc11_22, %.loc11_27.2 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked.loc11_27.1: init i32 = call %.loc11_27.3(%.loc11_22) [template = constants.%.29] +// CHECK:STDOUT: %.loc11_27.4: init i32 = converted %.loc11_22, %int.convert_checked.loc11_27.1 [template = constants.%.29] +// CHECK:STDOUT: %.loc11_27.5: ref i32 = tuple_access file.%a.var, element0 +// CHECK:STDOUT: %.loc11_27.6: init i32 = initialize_from %.loc11_27.4 to %.loc11_27.5 [template = constants.%.29] +// CHECK:STDOUT: %.loc11_27.7: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_27.8: = bound_method %.loc11_26, %.loc11_27.7 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc11_27.2: init i32 = call %.loc11_27.8(%.loc11_26) [template = constants.%.31] +// CHECK:STDOUT: %.loc11_27.9: init i32 = converted %.loc11_26, %int.convert_checked.loc11_27.2 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_27.10: ref i32 = tuple_access file.%a.var, element1 +// CHECK:STDOUT: %.loc11_27.11: init i32 = initialize_from %.loc11_27.9 to %.loc11_27.10 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_27.12: init %tuple.type.2 = tuple_init (%.loc11_27.6, %.loc11_27.11) to file.%a.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_28: init %tuple.type.2 = converted %.loc11_27.1, %.loc11_27.12 [template = constants.%tuple] // CHECK:STDOUT: assign file.%a.var, %.loc11_28 // CHECK:STDOUT: %a.ref: ref %tuple.type.2 = name_ref a, file.%a // CHECK:STDOUT: %oops.ref: = name_ref oops, [template = ] diff --git a/toolchain/check/testdata/tuple/access/fail_empty_access.carbon b/toolchain/check/testdata/tuple/access/fail_empty_access.carbon index aa1bb2611e21a..e0aeb11755603 100644 --- a/toolchain/check/testdata/tuple/access/fail_empty_access.carbon +++ b/toolchain/check/testdata/tuple/access/fail_empty_access.carbon @@ -25,7 +25,7 @@ fn Run() { // CHECK:STDOUT: %F: %F.type = struct_value () [template] // CHECK:STDOUT: %Run.type: type = fn_type @Run [template] // CHECK:STDOUT: %Run: %Run.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -55,7 +55,7 @@ fn Run() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [template = constants.%F] // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.ref() -// CHECK:STDOUT: %.loc17_7: i32 = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc17_7: Core.IntLiteral = int_value 0 [template = constants.%.1] // CHECK:STDOUT: %.loc17_4.1: ref %empty_tuple.type = temporary_storage // CHECK:STDOUT: %.loc17_4.2: ref %empty_tuple.type = temporary %.loc17_4.1, %F.call // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/tuple/access/fail_large_index.carbon b/toolchain/check/testdata/tuple/access/fail_large_index.carbon index 09096cd236508..d894d77eabe68 100644 --- a/toolchain/check/testdata/tuple/access/fail_large_index.carbon +++ b/toolchain/check/testdata/tuple/access/fail_large_index.carbon @@ -27,15 +27,23 @@ var d: i32 = b.(0x7FFF_FFFF); // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %tuple.type.1: type = tuple_type (type) [template] // CHECK:STDOUT: %tuple.type.2: type = tuple_type (i32) [template] -// CHECK:STDOUT: %.1: i32 = int_value 12 [template] -// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.1) [template] -// CHECK:STDOUT: %.2: i32 = int_value 1 [template] -// CHECK:STDOUT: %.3: i32 = int_value 2147483647 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 12 [template] +// CHECK:STDOUT: %tuple.type.3: type = tuple_type (Core.IntLiteral) [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 12 [template] +// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.27) [template] +// CHECK:STDOUT: %.28: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 2147483647 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -78,10 +86,14 @@ var d: i32 = b.(0x7FFF_FFFF); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_18: i32 = int_value 12 [template = constants.%.1] -// CHECK:STDOUT: %.loc11_21.1: %tuple.type.2 = tuple_literal (%.loc11_18) -// CHECK:STDOUT: %.loc11_21.2: init %tuple.type.2 = tuple_init (%.loc11_18) to file.%a.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc11_22: init %tuple.type.2 = converted %.loc11_21.1, %.loc11_21.2 [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_18: Core.IntLiteral = int_value 12 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_21.1: %tuple.type.3 = tuple_literal (%.loc11_18) +// CHECK:STDOUT: %.loc11_21.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_21.3: = bound_method %.loc11_18, %.loc11_21.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc11_21.3(%.loc11_18) [template = constants.%.27] +// CHECK:STDOUT: %.loc11_21.4: init i32 = converted %.loc11_18, %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc11_21.5: init %tuple.type.2 = tuple_init (%.loc11_21.4) to file.%a.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_22: init %tuple.type.2 = converted %.loc11_21.1, %.loc11_21.5 [template = constants.%tuple] // CHECK:STDOUT: assign file.%a.var, %.loc11_22 // CHECK:STDOUT: %a.ref: ref %tuple.type.2 = name_ref a, file.%a // CHECK:STDOUT: %.loc12_17.1: ref i32 = tuple_access %a.ref, element0 @@ -90,10 +102,10 @@ var d: i32 = b.(0x7FFF_FFFF); // CHECK:STDOUT: %.loc12_18: init %tuple.type.2 = converted %a.ref, %.loc12_17.3 // CHECK:STDOUT: assign file.%b.var, %.loc12_18 // CHECK:STDOUT: %b.ref.loc17: ref %tuple.type.2 = name_ref b, file.%b -// CHECK:STDOUT: %.loc17: i32 = int_value 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc17: Core.IntLiteral = int_value 1 [template = constants.%.28] // CHECK:STDOUT: assign file.%c.var, // CHECK:STDOUT: %b.ref.loc21: ref %tuple.type.2 = name_ref b, file.%b -// CHECK:STDOUT: %.loc21: i32 = int_value 2147483647 [template = constants.%.3] +// CHECK:STDOUT: %.loc21: Core.IntLiteral = int_value 2147483647 [template = constants.%.29] // CHECK:STDOUT: assign file.%d.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/tuple/access/fail_negative_indexing.carbon b/toolchain/check/testdata/tuple/access/fail_negative_indexing.carbon index 1342ea26606f8..66631993fa9e5 100644 --- a/toolchain/check/testdata/tuple/access/fail_negative_indexing.carbon +++ b/toolchain/check/testdata/tuple/access/fail_negative_indexing.carbon @@ -9,7 +9,7 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/tuple/access/fail_negative_indexing.carbon var a: (i32, i32) = (12, 6); -// CHECK:STDERR: fail_negative_indexing.carbon:[[@LINE+3]]:17: error: cannot access member of interface `Negate` in type `i32` that does not implement that interface [MissingImplInMemberAccess] +// CHECK:STDERR: fail_negative_indexing.carbon:[[@LINE+3]]:17: error: cannot access member of interface `Negate` in type `Core.IntLiteral` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: var b: i32 = a.(-10); // CHECK:STDERR: ^~~ var b: i32 = a.(-10); @@ -21,16 +21,26 @@ var b: i32 = a.(-10); // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %tuple.type.1: type = tuple_type (type, type) [template] // CHECK:STDOUT: %tuple.type.2: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.2: i32 = int_value 12 [template] -// CHECK:STDOUT: %.3: i32 = int_value 6 [template] -// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.2, %.3) [template] -// CHECK:STDOUT: %.4: i32 = int_value 10 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 12 [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 6 [template] +// CHECK:STDOUT: %tuple.type.3: type = tuple_type (Core.IntLiteral, Core.IntLiteral) [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: %.27: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.28: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.29: i32 = int_value 12 [template] +// CHECK:STDOUT: %.30: = bound_method %.3, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 6 [template] +// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.29, %.31) [template] +// CHECK:STDOUT: %.32: Core.IntLiteral = int_value 10 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int32 = %import_ref.1 -// CHECK:STDOUT: .Negate = %import_ref.2 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 +// CHECK:STDOUT: .Negate = %import_ref.51 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -62,18 +72,26 @@ var b: i32 = a.(-10); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_22: i32 = int_value 12 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_26: i32 = int_value 6 [template = constants.%.3] -// CHECK:STDOUT: %.loc11_27.1: %tuple.type.2 = tuple_literal (%.loc11_22, %.loc11_26) -// CHECK:STDOUT: %.loc11_27.2: ref i32 = tuple_access file.%a.var, element0 -// CHECK:STDOUT: %.loc11_27.3: init i32 = initialize_from %.loc11_22 to %.loc11_27.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_27.4: ref i32 = tuple_access file.%a.var, element1 -// CHECK:STDOUT: %.loc11_27.5: init i32 = initialize_from %.loc11_26 to %.loc11_27.4 [template = constants.%.3] -// CHECK:STDOUT: %.loc11_27.6: init %tuple.type.2 = tuple_init (%.loc11_27.3, %.loc11_27.5) to file.%a.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc11_28: init %tuple.type.2 = converted %.loc11_27.1, %.loc11_27.6 [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_22: Core.IntLiteral = int_value 12 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_26: Core.IntLiteral = int_value 6 [template = constants.%.3] +// CHECK:STDOUT: %.loc11_27.1: %tuple.type.3 = tuple_literal (%.loc11_22, %.loc11_26) +// CHECK:STDOUT: %.loc11_27.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_27.3: = bound_method %.loc11_22, %.loc11_27.2 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked.loc11_27.1: init i32 = call %.loc11_27.3(%.loc11_22) [template = constants.%.29] +// CHECK:STDOUT: %.loc11_27.4: init i32 = converted %.loc11_22, %int.convert_checked.loc11_27.1 [template = constants.%.29] +// CHECK:STDOUT: %.loc11_27.5: ref i32 = tuple_access file.%a.var, element0 +// CHECK:STDOUT: %.loc11_27.6: init i32 = initialize_from %.loc11_27.4 to %.loc11_27.5 [template = constants.%.29] +// CHECK:STDOUT: %.loc11_27.7: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_27.8: = bound_method %.loc11_26, %.loc11_27.7 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc11_27.2: init i32 = call %.loc11_27.8(%.loc11_26) [template = constants.%.31] +// CHECK:STDOUT: %.loc11_27.9: init i32 = converted %.loc11_26, %int.convert_checked.loc11_27.2 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_27.10: ref i32 = tuple_access file.%a.var, element1 +// CHECK:STDOUT: %.loc11_27.11: init i32 = initialize_from %.loc11_27.9 to %.loc11_27.10 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_27.12: init %tuple.type.2 = tuple_init (%.loc11_27.6, %.loc11_27.11) to file.%a.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_28: init %tuple.type.2 = converted %.loc11_27.1, %.loc11_27.12 [template = constants.%tuple] // CHECK:STDOUT: assign file.%a.var, %.loc11_28 // CHECK:STDOUT: %a.ref: ref %tuple.type.2 = name_ref a, file.%a -// CHECK:STDOUT: %.loc15: i32 = int_value 10 [template = constants.%.4] +// CHECK:STDOUT: %.loc15: Core.IntLiteral = int_value 10 [template = constants.%.32] // CHECK:STDOUT: assign file.%b.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/tuple/access/fail_non_deterministic_type.carbon b/toolchain/check/testdata/tuple/access/fail_non_deterministic_type.carbon index 69607bd1dbf88..1b35b6a1c9329 100644 --- a/toolchain/check/testdata/tuple/access/fail_non_deterministic_type.carbon +++ b/toolchain/check/testdata/tuple/access/fail_non_deterministic_type.carbon @@ -22,15 +22,27 @@ var c: i32 = a.(b); // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %tuple.type.1: type = tuple_type (type, type) [template] // CHECK:STDOUT: %tuple.type.2: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.2: i32 = int_value 2 [template] -// CHECK:STDOUT: %.3: i32 = int_value 3 [template] -// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.2, %.3) [template] -// CHECK:STDOUT: %.4: i32 = int_value 0 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %tuple.type.3: type = tuple_type (Core.IntLiteral, Core.IntLiteral) [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: %.27: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.28: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.29: i32 = int_value 2 [template] +// CHECK:STDOUT: %.30: = bound_method %.3, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 3 [template] +// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.29, %.31) [template] +// CHECK:STDOUT: %.32: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %.33: = bound_method %.32, %Convert.15 [template] +// CHECK:STDOUT: %.34: i32 = int_value 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -68,21 +80,32 @@ var c: i32 = a.(b); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_22: i32 = int_value 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_25: i32 = int_value 3 [template = constants.%.3] -// CHECK:STDOUT: %.loc11_26.1: %tuple.type.2 = tuple_literal (%.loc11_22, %.loc11_25) -// CHECK:STDOUT: %.loc11_26.2: ref i32 = tuple_access file.%a.var, element0 -// CHECK:STDOUT: %.loc11_26.3: init i32 = initialize_from %.loc11_22 to %.loc11_26.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_26.4: ref i32 = tuple_access file.%a.var, element1 -// CHECK:STDOUT: %.loc11_26.5: init i32 = initialize_from %.loc11_25 to %.loc11_26.4 [template = constants.%.3] -// CHECK:STDOUT: %.loc11_26.6: init %tuple.type.2 = tuple_init (%.loc11_26.3, %.loc11_26.5) to file.%a.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc11_27: init %tuple.type.2 = converted %.loc11_26.1, %.loc11_26.6 [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_22: Core.IntLiteral = int_value 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_25: Core.IntLiteral = int_value 3 [template = constants.%.3] +// CHECK:STDOUT: %.loc11_26.1: %tuple.type.3 = tuple_literal (%.loc11_22, %.loc11_25) +// CHECK:STDOUT: %.loc11_26.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_26.3: = bound_method %.loc11_22, %.loc11_26.2 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked.loc11_26.1: init i32 = call %.loc11_26.3(%.loc11_22) [template = constants.%.29] +// CHECK:STDOUT: %.loc11_26.4: init i32 = converted %.loc11_22, %int.convert_checked.loc11_26.1 [template = constants.%.29] +// CHECK:STDOUT: %.loc11_26.5: ref i32 = tuple_access file.%a.var, element0 +// CHECK:STDOUT: %.loc11_26.6: init i32 = initialize_from %.loc11_26.4 to %.loc11_26.5 [template = constants.%.29] +// CHECK:STDOUT: %.loc11_26.7: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_26.8: = bound_method %.loc11_25, %.loc11_26.7 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc11_26.2: init i32 = call %.loc11_26.8(%.loc11_25) [template = constants.%.31] +// CHECK:STDOUT: %.loc11_26.9: init i32 = converted %.loc11_25, %int.convert_checked.loc11_26.2 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_26.10: ref i32 = tuple_access file.%a.var, element1 +// CHECK:STDOUT: %.loc11_26.11: init i32 = initialize_from %.loc11_26.9 to %.loc11_26.10 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_26.12: init %tuple.type.2 = tuple_init (%.loc11_26.6, %.loc11_26.11) to file.%a.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_27: init %tuple.type.2 = converted %.loc11_26.1, %.loc11_26.12 [template = constants.%tuple] // CHECK:STDOUT: assign file.%a.var, %.loc11_27 -// CHECK:STDOUT: %.loc12: i32 = int_value 0 [template = constants.%.4] -// CHECK:STDOUT: assign file.%b.var, %.loc12 +// CHECK:STDOUT: %.loc12_14: Core.IntLiteral = int_value 0 [template = constants.%.32] +// CHECK:STDOUT: %.loc12_15.1: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc12_15.2: = bound_method %.loc12_14, %.loc12_15.1 [template = constants.%.33] +// CHECK:STDOUT: %int.convert_checked.loc12: init i32 = call %.loc12_15.2(%.loc12_14) [template = constants.%.34] +// CHECK:STDOUT: %.loc12_15.3: init i32 = converted %.loc12_14, %int.convert_checked.loc12 [template = constants.%.34] +// CHECK:STDOUT: assign file.%b.var, %.loc12_15.3 // CHECK:STDOUT: %a.ref: ref %tuple.type.2 = name_ref a, file.%a // CHECK:STDOUT: %b.ref: ref i32 = name_ref b, file.%b -// CHECK:STDOUT: %.loc16: i32 = bind_value %b.ref // CHECK:STDOUT: assign file.%c.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/tuple/access/fail_non_int_indexing.carbon b/toolchain/check/testdata/tuple/access/fail_non_int_indexing.carbon index c7054df738b9b..d278dc1404395 100644 --- a/toolchain/check/testdata/tuple/access/fail_non_int_indexing.carbon +++ b/toolchain/check/testdata/tuple/access/fail_non_int_indexing.carbon @@ -9,10 +9,10 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/tuple/access/fail_non_int_indexing.carbon var a: (i32, i32) = (12, 6); -// CHECK:STDERR: fail_non_int_indexing.carbon:[[@LINE+6]]:17: error: cannot implicitly convert from `f64` to `i32` [ImplicitAsConversionFailure] +// CHECK:STDERR: fail_non_int_indexing.carbon:[[@LINE+6]]:17: error: cannot implicitly convert from `f64` to `Core.IntLiteral` [ImplicitAsConversionFailure] // CHECK:STDERR: var b: i32 = a.(2.6); // CHECK:STDERR: ^~~ -// CHECK:STDERR: fail_non_int_indexing.carbon:[[@LINE+3]]:17: note: type `f64` does not implement interface `ImplicitAs(i32)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_non_int_indexing.carbon:[[@LINE+3]]:17: note: type `f64` does not implement interface `ImplicitAs(Core.IntLiteral)` [MissingImplInMemberAccessNote] // CHECK:STDERR: var b: i32 = a.(2.6); // CHECK:STDERR: ^~~ var b: i32 = a.(2.6); @@ -24,10 +24,19 @@ var b: i32 = a.(2.6); // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %tuple.type.1: type = tuple_type (type, type) [template] // CHECK:STDOUT: %tuple.type.2: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.2: i32 = int_value 12 [template] -// CHECK:STDOUT: %.3: i32 = int_value 6 [template] -// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.2, %.3) [template] -// CHECK:STDOUT: %.4: f64 = float_literal 2.6000000000000001 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 12 [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 6 [template] +// CHECK:STDOUT: %tuple.type.3: type = tuple_type (Core.IntLiteral, Core.IntLiteral) [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: %.27: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.28: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.29: i32 = int_value 12 [template] +// CHECK:STDOUT: %.30: = bound_method %.3, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 6 [template] +// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.29, %.31) [template] +// CHECK:STDOUT: %.32: f64 = float_literal 2.6000000000000001 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -65,19 +74,27 @@ var b: i32 = a.(2.6); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_22: i32 = int_value 12 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_26: i32 = int_value 6 [template = constants.%.3] -// CHECK:STDOUT: %.loc11_27.1: %tuple.type.2 = tuple_literal (%.loc11_22, %.loc11_26) -// CHECK:STDOUT: %.loc11_27.2: ref i32 = tuple_access file.%a.var, element0 -// CHECK:STDOUT: %.loc11_27.3: init i32 = initialize_from %.loc11_22 to %.loc11_27.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_27.4: ref i32 = tuple_access file.%a.var, element1 -// CHECK:STDOUT: %.loc11_27.5: init i32 = initialize_from %.loc11_26 to %.loc11_27.4 [template = constants.%.3] -// CHECK:STDOUT: %.loc11_27.6: init %tuple.type.2 = tuple_init (%.loc11_27.3, %.loc11_27.5) to file.%a.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc11_28: init %tuple.type.2 = converted %.loc11_27.1, %.loc11_27.6 [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_22: Core.IntLiteral = int_value 12 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_26: Core.IntLiteral = int_value 6 [template = constants.%.3] +// CHECK:STDOUT: %.loc11_27.1: %tuple.type.3 = tuple_literal (%.loc11_22, %.loc11_26) +// CHECK:STDOUT: %.loc11_27.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_27.3: = bound_method %.loc11_22, %.loc11_27.2 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked.loc11_27.1: init i32 = call %.loc11_27.3(%.loc11_22) [template = constants.%.29] +// CHECK:STDOUT: %.loc11_27.4: init i32 = converted %.loc11_22, %int.convert_checked.loc11_27.1 [template = constants.%.29] +// CHECK:STDOUT: %.loc11_27.5: ref i32 = tuple_access file.%a.var, element0 +// CHECK:STDOUT: %.loc11_27.6: init i32 = initialize_from %.loc11_27.4 to %.loc11_27.5 [template = constants.%.29] +// CHECK:STDOUT: %.loc11_27.7: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_27.8: = bound_method %.loc11_26, %.loc11_27.7 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc11_27.2: init i32 = call %.loc11_27.8(%.loc11_26) [template = constants.%.31] +// CHECK:STDOUT: %.loc11_27.9: init i32 = converted %.loc11_26, %int.convert_checked.loc11_27.2 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_27.10: ref i32 = tuple_access file.%a.var, element1 +// CHECK:STDOUT: %.loc11_27.11: init i32 = initialize_from %.loc11_27.9 to %.loc11_27.10 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_27.12: init %tuple.type.2 = tuple_init (%.loc11_27.6, %.loc11_27.11) to file.%a.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_28: init %tuple.type.2 = converted %.loc11_27.1, %.loc11_27.12 [template = constants.%tuple] // CHECK:STDOUT: assign file.%a.var, %.loc11_28 // CHECK:STDOUT: %a.ref: ref %tuple.type.2 = name_ref a, file.%a -// CHECK:STDOUT: %.loc18_17.1: f64 = float_literal 2.6000000000000001 [template = constants.%.4] -// CHECK:STDOUT: %.loc18_17.2: i32 = converted %.loc18_17.1, [template = ] +// CHECK:STDOUT: %.loc18_17.1: f64 = float_literal 2.6000000000000001 [template = constants.%.32] +// CHECK:STDOUT: %.loc18_17.2: Core.IntLiteral = converted %.loc18_17.1, [template = ] // CHECK:STDOUT: assign file.%b.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/tuple/access/fail_non_tuple_access.carbon b/toolchain/check/testdata/tuple/access/fail_non_tuple_access.carbon index 147d6fa493191..27d1e860f16e3 100644 --- a/toolchain/check/testdata/tuple/access/fail_non_tuple_access.carbon +++ b/toolchain/check/testdata/tuple/access/fail_non_tuple_access.carbon @@ -9,7 +9,7 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/tuple/access/fail_non_tuple_access.carbon fn Main() { - // CHECK:STDERR: fail_non_tuple_access.carbon:[[@LINE+4]]:3: error: type `i32` does not support indexing [TypeNotIndexable] + // CHECK:STDERR: fail_non_tuple_access.carbon:[[@LINE+4]]:3: error: type `Core.IntLiteral` does not support indexing [TypeNotIndexable] // CHECK:STDERR: 0[1]; // CHECK:STDERR: ^~~~ // CHECK:STDERR: @@ -27,21 +27,23 @@ fn Main() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %Main.type: type = fn_type @Main [template] // CHECK:STDOUT: %Main: %Main.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] -// CHECK:STDOUT: %.2: i32 = int_value 1 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 1 [template] // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] -// CHECK:STDOUT: %.5: i32 = int_value 2 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %.5: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.6: type = array_type %.5, i32 [template] +// CHECK:STDOUT: %.8: Core.IntLiteral = int_value 5 [template] +// CHECK:STDOUT: %tuple.type: type = tuple_type (Core.IntLiteral, Core.IntLiteral) [template] +// CHECK:STDOUT: %.9: i32 = int_value 0 [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: %.29: = interface_witness (%Convert.15) [template] -// CHECK:STDOUT: %.30: = bound_method %.5, %Convert.15 [template] -// CHECK:STDOUT: %.31: Core.IntLiteral = int_value 2 [template] -// CHECK:STDOUT: %.32: type = array_type %.31, i32 [template] -// CHECK:STDOUT: %.34: i32 = int_value 5 [template] -// CHECK:STDOUT: %tuple.type: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %array: %.32 = tuple_value (%.34, %.34) [template] +// CHECK:STDOUT: %.33: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.34: = bound_method %.8, %Convert.15 [template] +// CHECK:STDOUT: %.35: i32 = int_value 5 [template] +// CHECK:STDOUT: %.36: i32 = int_value 1 [template] +// CHECK:STDOUT: %array: %.6 = tuple_value (%.35, %.35) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -65,39 +67,42 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc16_3: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: %.loc16_5: i32 = int_value 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc16_3: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc16_5: Core.IntLiteral = int_value 1 [template = constants.%.2] // CHECK:STDOUT: %int.make_type_32.loc18: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc18_24.1: i32 = int_value 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc18_24: Core.IntLiteral = int_value 2 [template = constants.%.5] // CHECK:STDOUT: %.loc18_19.1: type = value_of_initializer %int.make_type_32.loc18 [template = i32] // CHECK:STDOUT: %.loc18_19.2: type = converted %int.make_type_32.loc18, %.loc18_19.1 [template = i32] -// CHECK:STDOUT: %.loc18_24.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] -// CHECK:STDOUT: %.loc18_24.3: = bound_method %.loc18_24.1, %.loc18_24.2 [template = constants.%.30] -// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc18_24.3(%.loc18_24.1) [template = constants.%.31] -// CHECK:STDOUT: %.loc18_24.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.31] -// CHECK:STDOUT: %.loc18_24.5: Core.IntLiteral = converted %.loc18_24.1, %.loc18_24.4 [template = constants.%.31] -// CHECK:STDOUT: %.loc18_25: type = array_type %.loc18_24.5, i32 [template = constants.%.32] -// CHECK:STDOUT: %non_tuple.var: ref %.32 = var non_tuple -// CHECK:STDOUT: %non_tuple: ref %.32 = bind_name non_tuple, %non_tuple.var -// CHECK:STDOUT: %.loc18_30: i32 = int_value 5 [template = constants.%.34] -// CHECK:STDOUT: %.loc18_33: i32 = int_value 5 [template = constants.%.34] +// CHECK:STDOUT: %.loc18_25: type = array_type %.loc18_24, i32 [template = constants.%.6] +// CHECK:STDOUT: %non_tuple.var: ref %.6 = var non_tuple +// CHECK:STDOUT: %non_tuple: ref %.6 = bind_name non_tuple, %non_tuple.var +// CHECK:STDOUT: %.loc18_30: Core.IntLiteral = int_value 5 [template = constants.%.8] +// CHECK:STDOUT: %.loc18_33: Core.IntLiteral = int_value 5 [template = constants.%.8] // CHECK:STDOUT: %.loc18_34.1: %tuple.type = tuple_literal (%.loc18_30, %.loc18_33) -// CHECK:STDOUT: %.loc18_34.2: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: %.loc18_34.3: ref i32 = array_index %non_tuple.var, %.loc18_34.2 -// CHECK:STDOUT: %.loc18_34.4: init i32 = initialize_from %.loc18_30 to %.loc18_34.3 [template = constants.%.34] -// CHECK:STDOUT: %.loc18_34.5: i32 = int_value 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc18_34.2: %Convert.type.2 = interface_witness_access constants.%.33, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc18_34.3: = bound_method %.loc18_30, %.loc18_34.2 [template = constants.%.34] +// CHECK:STDOUT: %int.convert_checked.loc18_34.1: init i32 = call %.loc18_34.3(%.loc18_30) [template = constants.%.35] +// CHECK:STDOUT: %.loc18_34.4: init i32 = converted %.loc18_30, %int.convert_checked.loc18_34.1 [template = constants.%.35] +// CHECK:STDOUT: %.loc18_34.5: i32 = int_value 0 [template = constants.%.9] // CHECK:STDOUT: %.loc18_34.6: ref i32 = array_index %non_tuple.var, %.loc18_34.5 -// CHECK:STDOUT: %.loc18_34.7: init i32 = initialize_from %.loc18_33 to %.loc18_34.6 [template = constants.%.34] -// CHECK:STDOUT: %.loc18_34.8: init %.32 = array_init (%.loc18_34.4, %.loc18_34.7) to %non_tuple.var [template = constants.%array] -// CHECK:STDOUT: %.loc18_35: init %.32 = converted %.loc18_34.1, %.loc18_34.8 [template = constants.%array] +// CHECK:STDOUT: %.loc18_34.7: init i32 = initialize_from %.loc18_34.4 to %.loc18_34.6 [template = constants.%.35] +// CHECK:STDOUT: %.loc18_34.8: %Convert.type.2 = interface_witness_access constants.%.33, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc18_34.9: = bound_method %.loc18_33, %.loc18_34.8 [template = constants.%.34] +// CHECK:STDOUT: %int.convert_checked.loc18_34.2: init i32 = call %.loc18_34.9(%.loc18_33) [template = constants.%.35] +// CHECK:STDOUT: %.loc18_34.10: init i32 = converted %.loc18_33, %int.convert_checked.loc18_34.2 [template = constants.%.35] +// CHECK:STDOUT: %.loc18_34.11: i32 = int_value 1 [template = constants.%.36] +// CHECK:STDOUT: %.loc18_34.12: ref i32 = array_index %non_tuple.var, %.loc18_34.11 +// CHECK:STDOUT: %.loc18_34.13: init i32 = initialize_from %.loc18_34.10 to %.loc18_34.12 [template = constants.%.35] +// CHECK:STDOUT: %.loc18_34.14: init %.6 = array_init (%.loc18_34.7, %.loc18_34.13) to %non_tuple.var [template = constants.%array] +// CHECK:STDOUT: %.loc18_35: init %.6 = converted %.loc18_34.1, %.loc18_34.14 [template = constants.%array] // CHECK:STDOUT: assign %non_tuple.var, %.loc18_35 // CHECK:STDOUT: %int.make_type_32.loc22: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc22_14.1: type = value_of_initializer %int.make_type_32.loc22 [template = i32] // CHECK:STDOUT: %.loc22_14.2: type = converted %int.make_type_32.loc22, %.loc22_14.1 [template = i32] // CHECK:STDOUT: %first.var: ref i32 = var first // CHECK:STDOUT: %first: ref i32 = bind_name first, %first.var -// CHECK:STDOUT: %non_tuple.ref: ref %.32 = name_ref non_tuple, %non_tuple -// CHECK:STDOUT: %.loc22_30: i32 = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %non_tuple.ref: ref %.6 = name_ref non_tuple, %non_tuple +// CHECK:STDOUT: %.loc22_30: Core.IntLiteral = int_value 0 [template = constants.%.1] // CHECK:STDOUT: assign %first.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/tuple/access/fail_out_of_bound_access.carbon b/toolchain/check/testdata/tuple/access/fail_out_of_bound_access.carbon index e7a33f110e2d2..dd740d1b5de32 100644 --- a/toolchain/check/testdata/tuple/access/fail_out_of_bound_access.carbon +++ b/toolchain/check/testdata/tuple/access/fail_out_of_bound_access.carbon @@ -21,15 +21,25 @@ var b: i32 = a.2; // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %tuple.type.1: type = tuple_type (type, type) [template] // CHECK:STDOUT: %tuple.type.2: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.2: i32 = int_value 12 [template] -// CHECK:STDOUT: %.3: i32 = int_value 6 [template] -// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.2, %.3) [template] -// CHECK:STDOUT: %.4: i32 = int_value 2 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 12 [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 6 [template] +// CHECK:STDOUT: %tuple.type.3: type = tuple_type (Core.IntLiteral, Core.IntLiteral) [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: %.27: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.28: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.29: i32 = int_value 12 [template] +// CHECK:STDOUT: %.30: = bound_method %.3, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 6 [template] +// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.29, %.31) [template] +// CHECK:STDOUT: %.32: Core.IntLiteral = int_value 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -61,18 +71,26 @@ var b: i32 = a.2; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_22: i32 = int_value 12 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_26: i32 = int_value 6 [template = constants.%.3] -// CHECK:STDOUT: %.loc11_27.1: %tuple.type.2 = tuple_literal (%.loc11_22, %.loc11_26) -// CHECK:STDOUT: %.loc11_27.2: ref i32 = tuple_access file.%a.var, element0 -// CHECK:STDOUT: %.loc11_27.3: init i32 = initialize_from %.loc11_22 to %.loc11_27.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_27.4: ref i32 = tuple_access file.%a.var, element1 -// CHECK:STDOUT: %.loc11_27.5: init i32 = initialize_from %.loc11_26 to %.loc11_27.4 [template = constants.%.3] -// CHECK:STDOUT: %.loc11_27.6: init %tuple.type.2 = tuple_init (%.loc11_27.3, %.loc11_27.5) to file.%a.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc11_28: init %tuple.type.2 = converted %.loc11_27.1, %.loc11_27.6 [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_22: Core.IntLiteral = int_value 12 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_26: Core.IntLiteral = int_value 6 [template = constants.%.3] +// CHECK:STDOUT: %.loc11_27.1: %tuple.type.3 = tuple_literal (%.loc11_22, %.loc11_26) +// CHECK:STDOUT: %.loc11_27.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_27.3: = bound_method %.loc11_22, %.loc11_27.2 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked.loc11_27.1: init i32 = call %.loc11_27.3(%.loc11_22) [template = constants.%.29] +// CHECK:STDOUT: %.loc11_27.4: init i32 = converted %.loc11_22, %int.convert_checked.loc11_27.1 [template = constants.%.29] +// CHECK:STDOUT: %.loc11_27.5: ref i32 = tuple_access file.%a.var, element0 +// CHECK:STDOUT: %.loc11_27.6: init i32 = initialize_from %.loc11_27.4 to %.loc11_27.5 [template = constants.%.29] +// CHECK:STDOUT: %.loc11_27.7: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_27.8: = bound_method %.loc11_26, %.loc11_27.7 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc11_27.2: init i32 = call %.loc11_27.8(%.loc11_26) [template = constants.%.31] +// CHECK:STDOUT: %.loc11_27.9: init i32 = converted %.loc11_26, %int.convert_checked.loc11_27.2 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_27.10: ref i32 = tuple_access file.%a.var, element1 +// CHECK:STDOUT: %.loc11_27.11: init i32 = initialize_from %.loc11_27.9 to %.loc11_27.10 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_27.12: init %tuple.type.2 = tuple_init (%.loc11_27.6, %.loc11_27.11) to file.%a.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_28: init %tuple.type.2 = converted %.loc11_27.1, %.loc11_27.12 [template = constants.%tuple] // CHECK:STDOUT: assign file.%a.var, %.loc11_28 // CHECK:STDOUT: %a.ref: ref %tuple.type.2 = name_ref a, file.%a -// CHECK:STDOUT: %.loc15: i32 = int_value 2 [template = constants.%.4] +// CHECK:STDOUT: %.loc15: Core.IntLiteral = int_value 2 [template = constants.%.32] // CHECK:STDOUT: assign file.%b.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/tuple/access/fail_out_of_bound_not_literal.carbon b/toolchain/check/testdata/tuple/access/fail_out_of_bound_not_literal.carbon index f4afaf4ed2b68..7563519d7216a 100644 --- a/toolchain/check/testdata/tuple/access/fail_out_of_bound_not_literal.carbon +++ b/toolchain/check/testdata/tuple/access/fail_out_of_bound_not_literal.carbon @@ -21,17 +21,27 @@ var b: i32 = a.({.index = 2}.index); // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %tuple.type.1: type = tuple_type (type, type) [template] // CHECK:STDOUT: %tuple.type.2: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.2: i32 = int_value 12 [template] -// CHECK:STDOUT: %.3: i32 = int_value 34 [template] -// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.2, %.3) [template] -// CHECK:STDOUT: %.4: i32 = int_value 2 [template] -// CHECK:STDOUT: %.5: type = struct_type {.index: i32} [template] -// CHECK:STDOUT: %struct: %.5 = struct_value (%.4) [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 12 [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 34 [template] +// CHECK:STDOUT: %tuple.type.3: type = tuple_type (Core.IntLiteral, Core.IntLiteral) [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: %.27: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.28: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.29: i32 = int_value 12 [template] +// CHECK:STDOUT: %.30: = bound_method %.3, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 34 [template] +// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.29, %.31) [template] +// CHECK:STDOUT: %.32: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.33: type = struct_type {.index: Core.IntLiteral} [template] +// CHECK:STDOUT: %struct: %.33 = struct_value (%.32) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -63,22 +73,30 @@ var b: i32 = a.({.index = 2}.index); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_22: i32 = int_value 12 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_26: i32 = int_value 34 [template = constants.%.3] -// CHECK:STDOUT: %.loc11_28.1: %tuple.type.2 = tuple_literal (%.loc11_22, %.loc11_26) -// CHECK:STDOUT: %.loc11_28.2: ref i32 = tuple_access file.%a.var, element0 -// CHECK:STDOUT: %.loc11_28.3: init i32 = initialize_from %.loc11_22 to %.loc11_28.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_28.4: ref i32 = tuple_access file.%a.var, element1 -// CHECK:STDOUT: %.loc11_28.5: init i32 = initialize_from %.loc11_26 to %.loc11_28.4 [template = constants.%.3] -// CHECK:STDOUT: %.loc11_28.6: init %tuple.type.2 = tuple_init (%.loc11_28.3, %.loc11_28.5) to file.%a.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc11_29: init %tuple.type.2 = converted %.loc11_28.1, %.loc11_28.6 [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_22: Core.IntLiteral = int_value 12 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_26: Core.IntLiteral = int_value 34 [template = constants.%.3] +// CHECK:STDOUT: %.loc11_28.1: %tuple.type.3 = tuple_literal (%.loc11_22, %.loc11_26) +// CHECK:STDOUT: %.loc11_28.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_28.3: = bound_method %.loc11_22, %.loc11_28.2 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked.loc11_28.1: init i32 = call %.loc11_28.3(%.loc11_22) [template = constants.%.29] +// CHECK:STDOUT: %.loc11_28.4: init i32 = converted %.loc11_22, %int.convert_checked.loc11_28.1 [template = constants.%.29] +// CHECK:STDOUT: %.loc11_28.5: ref i32 = tuple_access file.%a.var, element0 +// CHECK:STDOUT: %.loc11_28.6: init i32 = initialize_from %.loc11_28.4 to %.loc11_28.5 [template = constants.%.29] +// CHECK:STDOUT: %.loc11_28.7: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_28.8: = bound_method %.loc11_26, %.loc11_28.7 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc11_28.2: init i32 = call %.loc11_28.8(%.loc11_26) [template = constants.%.31] +// CHECK:STDOUT: %.loc11_28.9: init i32 = converted %.loc11_26, %int.convert_checked.loc11_28.2 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_28.10: ref i32 = tuple_access file.%a.var, element1 +// CHECK:STDOUT: %.loc11_28.11: init i32 = initialize_from %.loc11_28.9 to %.loc11_28.10 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_28.12: init %tuple.type.2 = tuple_init (%.loc11_28.6, %.loc11_28.11) to file.%a.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_29: init %tuple.type.2 = converted %.loc11_28.1, %.loc11_28.12 [template = constants.%tuple] // CHECK:STDOUT: assign file.%a.var, %.loc11_29 // CHECK:STDOUT: %a.ref: ref %tuple.type.2 = name_ref a, file.%a -// CHECK:STDOUT: %.loc15_27: i32 = int_value 2 [template = constants.%.4] -// CHECK:STDOUT: %.loc15_28.1: %.5 = struct_literal (%.loc15_27) -// CHECK:STDOUT: %struct: %.5 = struct_value (%.loc15_27) [template = constants.%struct] -// CHECK:STDOUT: %.loc15_28.2: %.5 = converted %.loc15_28.1, %struct [template = constants.%struct] -// CHECK:STDOUT: %.loc15_29: i32 = struct_access %.loc15_28.2, element0 [template = constants.%.4] +// CHECK:STDOUT: %.loc15_27: Core.IntLiteral = int_value 2 [template = constants.%.32] +// CHECK:STDOUT: %.loc15_28.1: %.33 = struct_literal (%.loc15_27) +// CHECK:STDOUT: %struct: %.33 = struct_value (%.loc15_27) [template = constants.%struct] +// CHECK:STDOUT: %.loc15_28.2: %.33 = converted %.loc15_28.1, %struct [template = constants.%struct] +// CHECK:STDOUT: %.loc15_29: Core.IntLiteral = struct_access %.loc15_28.2, element0 [template = constants.%.32] // CHECK:STDOUT: assign file.%b.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/tuple/access/index_not_literal.carbon b/toolchain/check/testdata/tuple/access/index_not_literal.carbon index 39ff874b1c4d1..42c9653db5d50 100644 --- a/toolchain/check/testdata/tuple/access/index_not_literal.carbon +++ b/toolchain/check/testdata/tuple/access/index_not_literal.carbon @@ -18,17 +18,27 @@ var b: i32 = a.({.index = 1}.index); // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %tuple.type.1: type = tuple_type (type, type) [template] // CHECK:STDOUT: %tuple.type.2: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.2: i32 = int_value 12 [template] -// CHECK:STDOUT: %.3: i32 = int_value 34 [template] -// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.2, %.3) [template] -// CHECK:STDOUT: %.4: i32 = int_value 1 [template] -// CHECK:STDOUT: %.5: type = struct_type {.index: i32} [template] -// CHECK:STDOUT: %struct: %.5 = struct_value (%.4) [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 12 [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 34 [template] +// CHECK:STDOUT: %tuple.type.3: type = tuple_type (Core.IntLiteral, Core.IntLiteral) [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: %.27: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.28: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.29: i32 = int_value 12 [template] +// CHECK:STDOUT: %.30: = bound_method %.3, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 34 [template] +// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.29, %.31) [template] +// CHECK:STDOUT: %.32: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.33: type = struct_type {.index: Core.IntLiteral} [template] +// CHECK:STDOUT: %struct: %.33 = struct_value (%.32) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -60,22 +70,30 @@ var b: i32 = a.({.index = 1}.index); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_22: i32 = int_value 12 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_26: i32 = int_value 34 [template = constants.%.3] -// CHECK:STDOUT: %.loc11_28.1: %tuple.type.2 = tuple_literal (%.loc11_22, %.loc11_26) -// CHECK:STDOUT: %.loc11_28.2: ref i32 = tuple_access file.%a.var, element0 -// CHECK:STDOUT: %.loc11_28.3: init i32 = initialize_from %.loc11_22 to %.loc11_28.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_28.4: ref i32 = tuple_access file.%a.var, element1 -// CHECK:STDOUT: %.loc11_28.5: init i32 = initialize_from %.loc11_26 to %.loc11_28.4 [template = constants.%.3] -// CHECK:STDOUT: %.loc11_28.6: init %tuple.type.2 = tuple_init (%.loc11_28.3, %.loc11_28.5) to file.%a.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc11_29: init %tuple.type.2 = converted %.loc11_28.1, %.loc11_28.6 [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_22: Core.IntLiteral = int_value 12 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_26: Core.IntLiteral = int_value 34 [template = constants.%.3] +// CHECK:STDOUT: %.loc11_28.1: %tuple.type.3 = tuple_literal (%.loc11_22, %.loc11_26) +// CHECK:STDOUT: %.loc11_28.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_28.3: = bound_method %.loc11_22, %.loc11_28.2 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked.loc11_28.1: init i32 = call %.loc11_28.3(%.loc11_22) [template = constants.%.29] +// CHECK:STDOUT: %.loc11_28.4: init i32 = converted %.loc11_22, %int.convert_checked.loc11_28.1 [template = constants.%.29] +// CHECK:STDOUT: %.loc11_28.5: ref i32 = tuple_access file.%a.var, element0 +// CHECK:STDOUT: %.loc11_28.6: init i32 = initialize_from %.loc11_28.4 to %.loc11_28.5 [template = constants.%.29] +// CHECK:STDOUT: %.loc11_28.7: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_28.8: = bound_method %.loc11_26, %.loc11_28.7 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc11_28.2: init i32 = call %.loc11_28.8(%.loc11_26) [template = constants.%.31] +// CHECK:STDOUT: %.loc11_28.9: init i32 = converted %.loc11_26, %int.convert_checked.loc11_28.2 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_28.10: ref i32 = tuple_access file.%a.var, element1 +// CHECK:STDOUT: %.loc11_28.11: init i32 = initialize_from %.loc11_28.9 to %.loc11_28.10 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_28.12: init %tuple.type.2 = tuple_init (%.loc11_28.6, %.loc11_28.11) to file.%a.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_29: init %tuple.type.2 = converted %.loc11_28.1, %.loc11_28.12 [template = constants.%tuple] // CHECK:STDOUT: assign file.%a.var, %.loc11_29 // CHECK:STDOUT: %a.ref: ref %tuple.type.2 = name_ref a, file.%a -// CHECK:STDOUT: %.loc12_27: i32 = int_value 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc12_28.1: %.5 = struct_literal (%.loc12_27) -// CHECK:STDOUT: %struct: %.5 = struct_value (%.loc12_27) [template = constants.%struct] -// CHECK:STDOUT: %.loc12_28.2: %.5 = converted %.loc12_28.1, %struct [template = constants.%struct] -// CHECK:STDOUT: %.loc12_29: i32 = struct_access %.loc12_28.2, element0 [template = constants.%.4] +// CHECK:STDOUT: %.loc12_27: Core.IntLiteral = int_value 1 [template = constants.%.32] +// CHECK:STDOUT: %.loc12_28.1: %.33 = struct_literal (%.loc12_27) +// CHECK:STDOUT: %struct: %.33 = struct_value (%.loc12_27) [template = constants.%struct] +// CHECK:STDOUT: %.loc12_28.2: %.33 = converted %.loc12_28.1, %struct [template = constants.%struct] +// CHECK:STDOUT: %.loc12_29: Core.IntLiteral = struct_access %.loc12_28.2, element0 [template = constants.%.32] // CHECK:STDOUT: %.loc12_15.1: ref i32 = tuple_access %a.ref, element1 // CHECK:STDOUT: %.loc12_15.2: i32 = bind_value %.loc12_15.1 // CHECK:STDOUT: assign file.%b.var, %.loc12_15.2 diff --git a/toolchain/check/testdata/tuple/access/return_value_access.carbon b/toolchain/check/testdata/tuple/access/return_value_access.carbon index db2acf5f283a8..19e0103534684 100644 --- a/toolchain/check/testdata/tuple/access/return_value_access.carbon +++ b/toolchain/check/testdata/tuple/access/return_value_access.carbon @@ -23,15 +23,23 @@ fn Run() -> i32 { // CHECK:STDOUT: %tuple.type.2: type = tuple_type (i32) [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] -// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.1) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %tuple.type.3: type = tuple_type (Core.IntLiteral) [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 0 [template] +// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.27) [template] // CHECK:STDOUT: %Run.type: type = fn_type @Run [template] // CHECK:STDOUT: %Run: %Run.type = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -70,10 +78,15 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> %tuple.type.2 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_28: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: %.loc11_30: %tuple.type.2 = tuple_literal (%.loc11_28) -// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.loc11_28) [template = constants.%tuple] -// CHECK:STDOUT: %.loc11_31: %tuple.type.2 = converted %.loc11_30, %tuple [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_28: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_30.1: %tuple.type.3 = tuple_literal (%.loc11_28) +// CHECK:STDOUT: %.loc11_30.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_30.3: = bound_method %.loc11_28, %.loc11_30.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc11_30.3(%.loc11_28) [template = constants.%.27] +// CHECK:STDOUT: %.loc11_30.4: i32 = value_of_initializer %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc11_30.5: i32 = converted %.loc11_28, %.loc11_30.4 [template = constants.%.27] +// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.loc11_30.5) [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_31: %tuple.type.2 = converted %.loc11_30.1, %tuple [template = constants.%tuple] // CHECK:STDOUT: return %.loc11_31 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -81,7 +94,7 @@ fn Run() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [template = constants.%F] // CHECK:STDOUT: %F.call: init %tuple.type.2 = call %F.ref() -// CHECK:STDOUT: %.loc14_14: i32 = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc14_14: Core.IntLiteral = int_value 0 [template = constants.%.1] // CHECK:STDOUT: %.loc14_11.1: ref %tuple.type.2 = temporary_storage // CHECK:STDOUT: %.loc14_11.2: ref %tuple.type.2 = temporary %.loc14_11.1, %F.call // CHECK:STDOUT: %.loc14_13.1: ref i32 = tuple_access %.loc14_11.2, element0 diff --git a/toolchain/check/testdata/tuple/fail_assign_nested.carbon b/toolchain/check/testdata/tuple/fail_assign_nested.carbon index a56f5ec25b65c..f81aaebd32060 100644 --- a/toolchain/check/testdata/tuple/fail_assign_nested.carbon +++ b/toolchain/check/testdata/tuple/fail_assign_nested.carbon @@ -22,13 +22,13 @@ var x: ((i32, i32), (i32, i32)) = ((1, 2, 3), (4, 5, 6)); // CHECK:STDOUT: %tuple.type.2: type = tuple_type (%tuple.type.1, %tuple.type.1) [template] // CHECK:STDOUT: %tuple.type.3: type = tuple_type (i32, i32) [template] // CHECK:STDOUT: %tuple.type.4: type = tuple_type (%tuple.type.3, %tuple.type.3) [template] -// CHECK:STDOUT: %.3: i32 = int_value 1 [template] -// CHECK:STDOUT: %.4: i32 = int_value 2 [template] -// CHECK:STDOUT: %.5: i32 = int_value 3 [template] -// CHECK:STDOUT: %tuple.type.6: type = tuple_type (i32, i32, i32) [template] -// CHECK:STDOUT: %.6: i32 = int_value 4 [template] -// CHECK:STDOUT: %.7: i32 = int_value 5 [template] -// CHECK:STDOUT: %.8: i32 = int_value 6 [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.5: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %tuple.type.6: type = tuple_type (Core.IntLiteral, Core.IntLiteral, Core.IntLiteral) [template] +// CHECK:STDOUT: %.6: Core.IntLiteral = int_value 4 [template] +// CHECK:STDOUT: %.7: Core.IntLiteral = int_value 5 [template] +// CHECK:STDOUT: %.8: Core.IntLiteral = int_value 6 [template] // CHECK:STDOUT: %tuple.type.7: type = tuple_type (%tuple.type.6, %tuple.type.6) [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -70,13 +70,13 @@ var x: ((i32, i32), (i32, i32)) = ((1, 2, 3), (4, 5, 6)); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc14_37: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc14_40: i32 = int_value 2 [template = constants.%.4] -// CHECK:STDOUT: %.loc14_43: i32 = int_value 3 [template = constants.%.5] +// CHECK:STDOUT: %.loc14_37: Core.IntLiteral = int_value 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc14_40: Core.IntLiteral = int_value 2 [template = constants.%.4] +// CHECK:STDOUT: %.loc14_43: Core.IntLiteral = int_value 3 [template = constants.%.5] // CHECK:STDOUT: %.loc14_44: %tuple.type.6 = tuple_literal (%.loc14_37, %.loc14_40, %.loc14_43) -// CHECK:STDOUT: %.loc14_48: i32 = int_value 4 [template = constants.%.6] -// CHECK:STDOUT: %.loc14_51: i32 = int_value 5 [template = constants.%.7] -// CHECK:STDOUT: %.loc14_54: i32 = int_value 6 [template = constants.%.8] +// CHECK:STDOUT: %.loc14_48: Core.IntLiteral = int_value 4 [template = constants.%.6] +// CHECK:STDOUT: %.loc14_51: Core.IntLiteral = int_value 5 [template = constants.%.7] +// CHECK:STDOUT: %.loc14_54: Core.IntLiteral = int_value 6 [template = constants.%.8] // CHECK:STDOUT: %.loc14_55: %tuple.type.6 = tuple_literal (%.loc14_48, %.loc14_51, %.loc14_54) // CHECK:STDOUT: %.loc14_56: %tuple.type.7 = tuple_literal (%.loc14_44, %.loc14_55) // CHECK:STDOUT: assign file.%x.var, diff --git a/toolchain/check/testdata/tuple/fail_element_type_mismatch.carbon b/toolchain/check/testdata/tuple/fail_element_type_mismatch.carbon index 81197cd1a9100..2edf3d1b16bbb 100644 --- a/toolchain/check/testdata/tuple/fail_element_type_mismatch.carbon +++ b/toolchain/check/testdata/tuple/fail_element_type_mismatch.carbon @@ -23,9 +23,15 @@ var x: (i32, i32) = (2, 65.89); // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %tuple.type.1: type = tuple_type (type, type) [template] // CHECK:STDOUT: %tuple.type.2: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.2: i32 = int_value 2 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 2 [template] // CHECK:STDOUT: %.3: f64 = float_literal 65.890000000000001 [template] -// CHECK:STDOUT: %tuple.type.3: type = tuple_type (i32, f64) [template] +// CHECK:STDOUT: %tuple.type.3: type = tuple_type (Core.IntLiteral, f64) [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: %.27: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.28: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.29: i32 = int_value 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -57,12 +63,16 @@ var x: (i32, i32) = (2, 65.89); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc17_22: i32 = int_value 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc17_22: Core.IntLiteral = int_value 2 [template = constants.%.2] // CHECK:STDOUT: %.loc17_25: f64 = float_literal 65.890000000000001 [template = constants.%.3] // CHECK:STDOUT: %.loc17_30.1: %tuple.type.3 = tuple_literal (%.loc17_22, %.loc17_25) -// CHECK:STDOUT: %.loc17_30.2: ref i32 = tuple_access file.%x.var, element0 -// CHECK:STDOUT: %.loc17_30.3: init i32 = initialize_from %.loc17_22 to %.loc17_30.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc17_30.4: i32 = converted %.loc17_25, [template = ] +// CHECK:STDOUT: %.loc17_30.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc17_30.3: = bound_method %.loc17_22, %.loc17_30.2 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc17_30.3(%.loc17_22) [template = constants.%.29] +// CHECK:STDOUT: %.loc17_30.4: init i32 = converted %.loc17_22, %int.convert_checked [template = constants.%.29] +// CHECK:STDOUT: %.loc17_30.5: ref i32 = tuple_access file.%x.var, element0 +// CHECK:STDOUT: %.loc17_30.6: init i32 = initialize_from %.loc17_30.4 to %.loc17_30.5 [template = constants.%.29] +// CHECK:STDOUT: %.loc17_30.7: i32 = converted %.loc17_25, [template = ] // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/tuple/fail_nested_incomplete.carbon b/toolchain/check/testdata/tuple/fail_nested_incomplete.carbon index 38a973886e357..fe8eafce3dd02 100644 --- a/toolchain/check/testdata/tuple/fail_nested_incomplete.carbon +++ b/toolchain/check/testdata/tuple/fail_nested_incomplete.carbon @@ -29,7 +29,7 @@ var p: Incomplete* = &t[1]; // CHECK:STDOUT: %tuple.type.1: type = tuple_type (type, type) [template] // CHECK:STDOUT: %tuple.type.2: type = tuple_type (i32, %Incomplete) [template] // CHECK:STDOUT: %.1: type = ptr_type %Incomplete [template] -// CHECK:STDOUT: %.2: i32 = int_value 1 [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -68,7 +68,7 @@ var p: Incomplete* = &t[1]; // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %t.ref: ref = name_ref t, file.%t -// CHECK:STDOUT: %.loc21_25: i32 = int_value 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc21_25: Core.IntLiteral = int_value 1 [template = constants.%.2] // CHECK:STDOUT: %.loc21_22: = addr_of [template = ] // CHECK:STDOUT: assign file.%p.var, // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/tuple/fail_too_few_element.carbon b/toolchain/check/testdata/tuple/fail_too_few_element.carbon index 57a13363e884b..457bf892f169c 100644 --- a/toolchain/check/testdata/tuple/fail_too_few_element.carbon +++ b/toolchain/check/testdata/tuple/fail_too_few_element.carbon @@ -20,8 +20,8 @@ var x: (i32, i32) = (2, ); // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %tuple.type.1: type = tuple_type (type, type) [template] // CHECK:STDOUT: %tuple.type.2: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.2: i32 = int_value 2 [template] -// CHECK:STDOUT: %tuple.type.3: type = tuple_type (i32) [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %tuple.type.3: type = tuple_type (Core.IntLiteral) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -52,7 +52,7 @@ var x: (i32, i32) = (2, ); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc14_22: i32 = int_value 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc14_22: Core.IntLiteral = int_value 2 [template = constants.%.2] // CHECK:STDOUT: %.loc14_25: %tuple.type.3 = tuple_literal (%.loc14_22) // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/tuple/fail_value_as_type.carbon b/toolchain/check/testdata/tuple/fail_value_as_type.carbon index 9a781c18313d5..02d837bf3f8d6 100644 --- a/toolchain/check/testdata/tuple/fail_value_as_type.carbon +++ b/toolchain/check/testdata/tuple/fail_value_as_type.carbon @@ -8,10 +8,10 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/tuple/fail_value_as_type.carbon -// CHECK:STDERR: fail_value_as_type.carbon:[[@LINE+6]]:8: error: cannot implicitly convert from `i32` to `type` [ImplicitAsConversionFailure] +// CHECK:STDERR: fail_value_as_type.carbon:[[@LINE+6]]:8: error: cannot implicitly convert from `Core.IntLiteral` to `type` [ImplicitAsConversionFailure] // CHECK:STDERR: var x: (1, ); // CHECK:STDERR: ^~~~~ -// CHECK:STDERR: fail_value_as_type.carbon:[[@LINE+3]]:8: note: type `i32` does not implement interface `ImplicitAs(type)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_value_as_type.carbon:[[@LINE+3]]:8: note: type `Core.IntLiteral` does not implement interface `ImplicitAs(type)` [MissingImplInMemberAccessNote] // CHECK:STDERR: var x: (1, ); // CHECK:STDERR: ^~~~~ var x: (1, ); @@ -19,8 +19,8 @@ var x: (1, ); // CHECK:STDOUT: --- fail_value_as_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] -// CHECK:STDOUT: %tuple.type: type = tuple_type (i32) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %tuple.type: type = tuple_type (Core.IntLiteral) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -37,7 +37,7 @@ var x: (1, ); // CHECK:STDOUT: .x = %x // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %.loc17_9: i32 = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc17_9: Core.IntLiteral = int_value 1 [template = constants.%.1] // CHECK:STDOUT: %.loc17_12.1: %tuple.type = tuple_literal (%.loc17_9) // CHECK:STDOUT: %.loc17_12.2: type = converted %.loc17_9, [template = ] // CHECK:STDOUT: %x.var: ref = var x diff --git a/toolchain/check/testdata/tuple/import.carbon b/toolchain/check/testdata/tuple/import.carbon index 28925e4210ccc..1be2025e4b34b 100644 --- a/toolchain/check/testdata/tuple/import.carbon +++ b/toolchain/check/testdata/tuple/import.carbon @@ -45,10 +45,10 @@ var c_bad: C((1, 2, 3)) = F(); impl package Implicit; -// CHECK:STDERR: fail_bad_value.impl.carbon:[[@LINE+6]]:1: error: cannot implicitly convert from `C()` to `C()` [ImplicitAsConversionFailure] +// CHECK:STDERR: fail_bad_value.impl.carbon:[[@LINE+6]]:1: error: cannot implicitly convert from `C()` to `C()` [ImplicitAsConversionFailure] // CHECK:STDERR: var c_bad: C((3, 4)) = F(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_bad_value.impl.carbon:[[@LINE+3]]:1: note: type `C()` does not implement interface `ImplicitAs(C())` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_bad_value.impl.carbon:[[@LINE+3]]:1: note: type `C()` does not implement interface `ImplicitAs(C())` [MissingImplInMemberAccessNote] // CHECK:STDERR: var c_bad: C((3, 4)) = F(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ var c_bad: C((3, 4)) = F(); @@ -60,28 +60,44 @@ var c_bad: C((3, 4)) = F(); // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %tuple.type.1: type = tuple_type (type) [template] // CHECK:STDOUT: %tuple.type.2: type = tuple_type (i32) [template] -// CHECK:STDOUT: %.1: i32 = int_value 0 [template] -// CHECK:STDOUT: %tuple.1: %tuple.type.2 = tuple_value (%.1) [template] -// CHECK:STDOUT: %tuple.type.3: type = tuple_type (%tuple.type.1, type) [template] -// CHECK:STDOUT: %tuple.type.4: type = tuple_type (type, type) [template] -// CHECK:STDOUT: %tuple.type.5: type = tuple_type (%tuple.type.3, %tuple.type.4) [template] -// CHECK:STDOUT: %tuple.type.6: type = tuple_type (%tuple.type.2, i32) [template] -// CHECK:STDOUT: %tuple.type.7: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %tuple.type.8: type = tuple_type (%tuple.type.6, %tuple.type.7) [template] -// CHECK:STDOUT: %.5: i32 = int_value 1 [template] -// CHECK:STDOUT: %.6: i32 = int_value 2 [template] -// CHECK:STDOUT: %.7: i32 = int_value 3 [template] -// CHECK:STDOUT: %tuple.2: %tuple.type.6 = tuple_value (%tuple.1, %.5) [template] -// CHECK:STDOUT: %tuple.3: %tuple.type.7 = tuple_value (%.6, %.7) [template] -// CHECK:STDOUT: %tuple.4: %tuple.type.8 = tuple_value (%tuple.2, %tuple.3) [template] -// CHECK:STDOUT: %X: %tuple.type.7 = bind_symbolic_name X, 0 [symbolic] -// CHECK:STDOUT: %X.patt: %tuple.type.7 = symbolic_binding_pattern X, 0 [symbolic] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %tuple.type.3: type = tuple_type (Core.IntLiteral) [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 0 [template] +// CHECK:STDOUT: %tuple.1: %tuple.type.2 = tuple_value (%.27) [template] +// CHECK:STDOUT: %tuple.type.4: type = tuple_type (%tuple.type.1, type) [template] +// CHECK:STDOUT: %tuple.type.5: type = tuple_type (type, type) [template] +// CHECK:STDOUT: %tuple.type.6: type = tuple_type (%tuple.type.4, %tuple.type.5) [template] +// CHECK:STDOUT: %tuple.type.7: type = tuple_type (%tuple.type.2, i32) [template] +// CHECK:STDOUT: %tuple.type.8: type = tuple_type (i32, i32) [template] +// CHECK:STDOUT: %tuple.type.9: type = tuple_type (%tuple.type.7, %tuple.type.8) [template] +// CHECK:STDOUT: %.31: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %tuple.type.11: type = tuple_type (%tuple.type.3, Core.IntLiteral) [template] +// CHECK:STDOUT: %.32: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.33: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %tuple.type.12: type = tuple_type (Core.IntLiteral, Core.IntLiteral) [template] +// CHECK:STDOUT: %tuple.type.13: type = tuple_type (%tuple.type.11, %tuple.type.12) [template] +// CHECK:STDOUT: %.34: = bound_method %.31, %Convert.15 [template] +// CHECK:STDOUT: %.35: i32 = int_value 1 [template] +// CHECK:STDOUT: %tuple.2: %tuple.type.7 = tuple_value (%tuple.1, %.35) [template] +// CHECK:STDOUT: %.36: = bound_method %.32, %Convert.15 [template] +// CHECK:STDOUT: %.37: i32 = int_value 2 [template] +// CHECK:STDOUT: %.38: = bound_method %.33, %Convert.15 [template] +// CHECK:STDOUT: %.39: i32 = int_value 3 [template] +// CHECK:STDOUT: %tuple.3: %tuple.type.8 = tuple_value (%.37, %.39) [template] +// CHECK:STDOUT: %tuple.4: %tuple.type.9 = tuple_value (%tuple.2, %tuple.3) [template] +// CHECK:STDOUT: %X: %tuple.type.8 = bind_symbolic_name X, 0 [symbolic] +// CHECK:STDOUT: %X.patt: %tuple.type.8 = symbolic_binding_pattern X, 0 [symbolic] // CHECK:STDOUT: %C.type: type = generic_class_type @C [template] // CHECK:STDOUT: %C.1: %C.type = struct_value () [template] // CHECK:STDOUT: %C.2: type = class_type @C, @C(%X) [symbolic] -// CHECK:STDOUT: %.8: type = struct_type {} [template] -// CHECK:STDOUT: %.9: = complete_type_witness %.8 [template] -// CHECK:STDOUT: %tuple.5: %tuple.type.7 = tuple_value (%.5, %.6) [template] +// CHECK:STDOUT: %.40: type = struct_type {} [template] +// CHECK:STDOUT: %.41: = complete_type_witness %.40 [template] +// CHECK:STDOUT: %tuple.5: %tuple.type.8 = tuple_value (%.35, %.37) [template] // CHECK:STDOUT: %C.3: type = class_type @C, @C(%tuple.5) [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] @@ -89,7 +105,8 @@ var c_bad: C((3, 4)) = F(); // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -114,64 +131,74 @@ var c_bad: C((3, 4)) = F(); // CHECK:STDOUT: %int.make_type_32.loc5_15: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %.loc5_19: %tuple.type.1 = tuple_literal (%int.make_type_32.loc5_15) // CHECK:STDOUT: %int.make_type_32.loc5_22: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc5_25: %tuple.type.3 = tuple_literal (%.loc5_19, %int.make_type_32.loc5_22) +// CHECK:STDOUT: %.loc5_25: %tuple.type.4 = tuple_literal (%.loc5_19, %int.make_type_32.loc5_22) // CHECK:STDOUT: %int.make_type_32.loc5_29: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %int.make_type_32.loc5_34: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc5_37: %tuple.type.4 = tuple_literal (%int.make_type_32.loc5_29, %int.make_type_32.loc5_34) -// CHECK:STDOUT: %.loc5_38.1: %tuple.type.5 = tuple_literal (%.loc5_25, %.loc5_37) +// CHECK:STDOUT: %.loc5_37: %tuple.type.5 = tuple_literal (%int.make_type_32.loc5_29, %int.make_type_32.loc5_34) +// CHECK:STDOUT: %.loc5_38.1: %tuple.type.6 = tuple_literal (%.loc5_25, %.loc5_37) // CHECK:STDOUT: %.loc5_38.2: type = value_of_initializer %int.make_type_32.loc5_15 [template = i32] // CHECK:STDOUT: %.loc5_38.3: type = converted %int.make_type_32.loc5_15, %.loc5_38.2 [template = i32] // CHECK:STDOUT: %.loc5_38.4: type = converted %.loc5_19, constants.%tuple.type.2 [template = constants.%tuple.type.2] // CHECK:STDOUT: %.loc5_38.5: type = value_of_initializer %int.make_type_32.loc5_22 [template = i32] // CHECK:STDOUT: %.loc5_38.6: type = converted %int.make_type_32.loc5_22, %.loc5_38.5 [template = i32] -// CHECK:STDOUT: %.loc5_38.7: type = converted %.loc5_25, constants.%tuple.type.6 [template = constants.%tuple.type.6] +// CHECK:STDOUT: %.loc5_38.7: type = converted %.loc5_25, constants.%tuple.type.7 [template = constants.%tuple.type.7] // CHECK:STDOUT: %.loc5_38.8: type = value_of_initializer %int.make_type_32.loc5_29 [template = i32] // CHECK:STDOUT: %.loc5_38.9: type = converted %int.make_type_32.loc5_29, %.loc5_38.8 [template = i32] // CHECK:STDOUT: %.loc5_38.10: type = value_of_initializer %int.make_type_32.loc5_34 [template = i32] // CHECK:STDOUT: %.loc5_38.11: type = converted %int.make_type_32.loc5_34, %.loc5_38.10 [template = i32] -// CHECK:STDOUT: %.loc5_38.12: type = converted %.loc5_37, constants.%tuple.type.7 [template = constants.%tuple.type.7] -// CHECK:STDOUT: %.loc5_38.13: type = converted %.loc5_38.1, constants.%tuple.type.8 [template = constants.%tuple.type.8] -// CHECK:STDOUT: %b_ref.var: ref %tuple.type.8 = var b_ref -// CHECK:STDOUT: %b_ref: ref %tuple.type.8 = bind_name b_ref, %b_ref.var +// CHECK:STDOUT: %.loc5_38.12: type = converted %.loc5_37, constants.%tuple.type.8 [template = constants.%tuple.type.8] +// CHECK:STDOUT: %.loc5_38.13: type = converted %.loc5_38.1, constants.%tuple.type.9 [template = constants.%tuple.type.9] +// CHECK:STDOUT: %b_ref.var: ref %tuple.type.9 = var b_ref +// CHECK:STDOUT: %b_ref: ref %tuple.type.9 = bind_name b_ref, %b_ref.var // CHECK:STDOUT: %C.decl: %C.type = class_decl @C [template = constants.%C.1] { -// CHECK:STDOUT: %X.patt.loc7_9.1: %tuple.type.7 = symbolic_binding_pattern X, 0 [symbolic = %X.patt.loc7_9.2 (constants.%X.patt)] -// CHECK:STDOUT: %X.param_patt: %tuple.type.7 = value_param_pattern %X.patt.loc7_9.1, runtime_param [symbolic = %X.patt.loc7_9.2 (constants.%X.patt)] +// CHECK:STDOUT: %X.patt.loc7_9.1: %tuple.type.8 = symbolic_binding_pattern X, 0 [symbolic = %X.patt.loc7_9.2 (constants.%X.patt)] +// CHECK:STDOUT: %X.param_patt: %tuple.type.8 = value_param_pattern %X.patt.loc7_9.1, runtime_param [symbolic = %X.patt.loc7_9.2 (constants.%X.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %int.make_type_32.loc7_14: init type = call constants.%Int32() [template = i32] // CHECK:STDOUT: %int.make_type_32.loc7_19: init type = call constants.%Int32() [template = i32] -// CHECK:STDOUT: %.loc7_22.1: %tuple.type.4 = tuple_literal (%int.make_type_32.loc7_14, %int.make_type_32.loc7_19) +// CHECK:STDOUT: %.loc7_22.1: %tuple.type.5 = tuple_literal (%int.make_type_32.loc7_14, %int.make_type_32.loc7_19) // CHECK:STDOUT: %.loc7_22.2: type = value_of_initializer %int.make_type_32.loc7_14 [template = i32] // CHECK:STDOUT: %.loc7_22.3: type = converted %int.make_type_32.loc7_14, %.loc7_22.2 [template = i32] // CHECK:STDOUT: %.loc7_22.4: type = value_of_initializer %int.make_type_32.loc7_19 [template = i32] // CHECK:STDOUT: %.loc7_22.5: type = converted %int.make_type_32.loc7_19, %.loc7_22.4 [template = i32] -// CHECK:STDOUT: %.loc7_22.6: type = converted %.loc7_22.1, constants.%tuple.type.7 [template = constants.%tuple.type.7] -// CHECK:STDOUT: %X.param: %tuple.type.7 = value_param runtime_param -// CHECK:STDOUT: %X.loc7_9.1: %tuple.type.7 = bind_symbolic_name X, 0, %X.param [symbolic = %X.loc7_9.2 (constants.%X)] +// CHECK:STDOUT: %.loc7_22.6: type = converted %.loc7_22.1, constants.%tuple.type.8 [template = constants.%tuple.type.8] +// CHECK:STDOUT: %X.param: %tuple.type.8 = value_param runtime_param +// CHECK:STDOUT: %X.loc7_9.1: %tuple.type.8 = bind_symbolic_name X, 0, %X.param [symbolic = %X.loc7_9.2 (constants.%X)] // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] { // CHECK:STDOUT: %return.patt: %C.3 = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %C.3 = out_param_pattern %return.patt, runtime_param0 // CHECK:STDOUT: } { // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [template = constants.%C.1] -// CHECK:STDOUT: %.loc9_14: i32 = int_value 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc9_17: i32 = int_value 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc9_18: %tuple.type.7 = tuple_literal (%.loc9_14, %.loc9_17) -// CHECK:STDOUT: %tuple: %tuple.type.7 = tuple_value (%.loc9_14, %.loc9_17) [template = constants.%tuple.5] -// CHECK:STDOUT: %.loc9_12: %tuple.type.7 = converted %.loc9_18, %tuple [template = constants.%tuple.5] +// CHECK:STDOUT: %.loc9_14: Core.IntLiteral = int_value 1 [template = constants.%.31] +// CHECK:STDOUT: %.loc9_17: Core.IntLiteral = int_value 2 [template = constants.%.32] +// CHECK:STDOUT: %.loc9_18.1: %tuple.type.12 = tuple_literal (%.loc9_14, %.loc9_17) +// CHECK:STDOUT: %.loc9_18.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_18.3: = bound_method %.loc9_14, %.loc9_18.2 [template = constants.%.34] +// CHECK:STDOUT: %int.convert_checked.loc9_18.1: init i32 = call %.loc9_18.3(%.loc9_14) [template = constants.%.35] +// CHECK:STDOUT: %.loc9_18.4: i32 = value_of_initializer %int.convert_checked.loc9_18.1 [template = constants.%.35] +// CHECK:STDOUT: %.loc9_18.5: i32 = converted %.loc9_14, %.loc9_18.4 [template = constants.%.35] +// CHECK:STDOUT: %.loc9_18.6: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc9_18.7: = bound_method %.loc9_17, %.loc9_18.6 [template = constants.%.36] +// CHECK:STDOUT: %int.convert_checked.loc9_18.2: init i32 = call %.loc9_18.7(%.loc9_17) [template = constants.%.37] +// CHECK:STDOUT: %.loc9_18.8: i32 = value_of_initializer %int.convert_checked.loc9_18.2 [template = constants.%.37] +// CHECK:STDOUT: %.loc9_18.9: i32 = converted %.loc9_17, %.loc9_18.8 [template = constants.%.37] +// CHECK:STDOUT: %tuple: %tuple.type.8 = tuple_value (%.loc9_18.5, %.loc9_18.9) [template = constants.%tuple.5] +// CHECK:STDOUT: %.loc9_12: %tuple.type.8 = converted %.loc9_18.1, %tuple [template = constants.%tuple.5] // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%tuple.5) [template = constants.%C.3] // CHECK:STDOUT: %return.param: ref %C.3 = out_param runtime_param0 // CHECK:STDOUT: %return: ref %C.3 = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @C(%X.loc7_9.1: %tuple.type.7) { -// CHECK:STDOUT: %X.loc7_9.2: %tuple.type.7 = bind_symbolic_name X, 0 [symbolic = %X.loc7_9.2 (constants.%X)] -// CHECK:STDOUT: %X.patt.loc7_9.2: %tuple.type.7 = symbolic_binding_pattern X, 0 [symbolic = %X.patt.loc7_9.2 (constants.%X.patt)] +// CHECK:STDOUT: generic class @C(%X.loc7_9.1: %tuple.type.8) { +// CHECK:STDOUT: %X.loc7_9.2: %tuple.type.8 = bind_symbolic_name X, 0 [symbolic = %X.loc7_9.2 (constants.%X)] +// CHECK:STDOUT: %X.patt.loc7_9.2: %tuple.type.8 = symbolic_binding_pattern X, 0 [symbolic = %X.patt.loc7_9.2 (constants.%X.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: // CHECK:STDOUT: class { -// CHECK:STDOUT: %.loc7_26: = complete_type_witness %.8 [template = constants.%.9] +// CHECK:STDOUT: %.loc7_26: = complete_type_witness %.40 [template = constants.%.41] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C.2 @@ -182,37 +209,57 @@ var c_bad: C((3, 4)) = F(); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc4_22: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_24.1: %tuple.type.2 = tuple_literal (%.loc4_22) -// CHECK:STDOUT: %.loc4_24.2: init %tuple.type.2 = tuple_init (%.loc4_22) to file.%a_ref.var [template = constants.%tuple.1] -// CHECK:STDOUT: %.loc4_25: init %tuple.type.2 = converted %.loc4_24.1, %.loc4_24.2 [template = constants.%tuple.1] +// CHECK:STDOUT: %.loc4_22: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc4_24.1: %tuple.type.3 = tuple_literal (%.loc4_22) +// CHECK:STDOUT: %.loc4_24.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc4_24.3: = bound_method %.loc4_22, %.loc4_24.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc4: init i32 = call %.loc4_24.3(%.loc4_22) [template = constants.%.27] +// CHECK:STDOUT: %.loc4_24.4: init i32 = converted %.loc4_22, %int.convert_checked.loc4 [template = constants.%.27] +// CHECK:STDOUT: %.loc4_24.5: init %tuple.type.2 = tuple_init (%.loc4_24.4) to file.%a_ref.var [template = constants.%tuple.1] +// CHECK:STDOUT: %.loc4_25: init %tuple.type.2 = converted %.loc4_24.1, %.loc4_24.5 [template = constants.%tuple.1] // CHECK:STDOUT: assign file.%a_ref.var, %.loc4_25 -// CHECK:STDOUT: %.loc5_45: i32 = int_value 0 [template = constants.%.1] -// CHECK:STDOUT: %.loc5_47.1: %tuple.type.2 = tuple_literal (%.loc5_45) -// CHECK:STDOUT: %.loc5_50: i32 = int_value 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc5_51.1: %tuple.type.6 = tuple_literal (%.loc5_47.1, %.loc5_50) -// CHECK:STDOUT: %.loc5_55: i32 = int_value 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc5_58: i32 = int_value 3 [template = constants.%.7] -// CHECK:STDOUT: %.loc5_59.1: %tuple.type.7 = tuple_literal (%.loc5_55, %.loc5_58) -// CHECK:STDOUT: %.loc5_60.1: %tuple.type.8 = tuple_literal (%.loc5_51.1, %.loc5_59.1) -// CHECK:STDOUT: %.loc5_60.2: ref %tuple.type.6 = tuple_access file.%b_ref.var, element0 +// CHECK:STDOUT: %.loc5_45: Core.IntLiteral = int_value 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc5_47.1: %tuple.type.3 = tuple_literal (%.loc5_45) +// CHECK:STDOUT: %.loc5_50: Core.IntLiteral = int_value 1 [template = constants.%.31] +// CHECK:STDOUT: %.loc5_51.1: %tuple.type.11 = tuple_literal (%.loc5_47.1, %.loc5_50) +// CHECK:STDOUT: %.loc5_55: Core.IntLiteral = int_value 2 [template = constants.%.32] +// CHECK:STDOUT: %.loc5_58: Core.IntLiteral = int_value 3 [template = constants.%.33] +// CHECK:STDOUT: %.loc5_59.1: %tuple.type.12 = tuple_literal (%.loc5_55, %.loc5_58) +// CHECK:STDOUT: %.loc5_60.1: %tuple.type.13 = tuple_literal (%.loc5_51.1, %.loc5_59.1) +// CHECK:STDOUT: %.loc5_47.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc5_47.3: = bound_method %.loc5_45, %.loc5_47.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked.loc5_47: init i32 = call %.loc5_47.3(%.loc5_45) [template = constants.%.27] +// CHECK:STDOUT: %.loc5_47.4: init i32 = converted %.loc5_45, %int.convert_checked.loc5_47 [template = constants.%.27] +// CHECK:STDOUT: %.loc5_60.2: ref %tuple.type.7 = tuple_access file.%b_ref.var, element0 // CHECK:STDOUT: %.loc5_51.2: ref %tuple.type.2 = tuple_access %.loc5_60.2, element0 -// CHECK:STDOUT: %.loc5_47.2: init %tuple.type.2 = tuple_init (%.loc5_45) to %.loc5_51.2 [template = constants.%tuple.1] -// CHECK:STDOUT: %.loc5_51.3: init %tuple.type.2 = converted %.loc5_47.1, %.loc5_47.2 [template = constants.%tuple.1] +// CHECK:STDOUT: %.loc5_47.5: init %tuple.type.2 = tuple_init (%.loc5_47.4) to %.loc5_51.2 [template = constants.%tuple.1] +// CHECK:STDOUT: %.loc5_51.3: init %tuple.type.2 = converted %.loc5_47.1, %.loc5_47.5 [template = constants.%tuple.1] // CHECK:STDOUT: %.loc5_51.4: init %tuple.type.2 = initialize_from %.loc5_51.3 to %.loc5_51.2 [template = constants.%tuple.1] -// CHECK:STDOUT: %.loc5_51.5: ref i32 = tuple_access %.loc5_60.2, element1 -// CHECK:STDOUT: %.loc5_51.6: init i32 = initialize_from %.loc5_50 to %.loc5_51.5 [template = constants.%.5] -// CHECK:STDOUT: %.loc5_51.7: init %tuple.type.6 = tuple_init (%.loc5_51.4, %.loc5_51.6) to %.loc5_60.2 [template = constants.%tuple.2] -// CHECK:STDOUT: %.loc5_60.3: init %tuple.type.6 = converted %.loc5_51.1, %.loc5_51.7 [template = constants.%tuple.2] -// CHECK:STDOUT: %.loc5_60.4: ref %tuple.type.7 = tuple_access file.%b_ref.var, element1 -// CHECK:STDOUT: %.loc5_59.2: ref i32 = tuple_access %.loc5_60.4, element0 -// CHECK:STDOUT: %.loc5_59.3: init i32 = initialize_from %.loc5_55 to %.loc5_59.2 [template = constants.%.6] -// CHECK:STDOUT: %.loc5_59.4: ref i32 = tuple_access %.loc5_60.4, element1 -// CHECK:STDOUT: %.loc5_59.5: init i32 = initialize_from %.loc5_58 to %.loc5_59.4 [template = constants.%.7] -// CHECK:STDOUT: %.loc5_59.6: init %tuple.type.7 = tuple_init (%.loc5_59.3, %.loc5_59.5) to %.loc5_60.4 [template = constants.%tuple.3] -// CHECK:STDOUT: %.loc5_60.5: init %tuple.type.7 = converted %.loc5_59.1, %.loc5_59.6 [template = constants.%tuple.3] -// CHECK:STDOUT: %.loc5_60.6: init %tuple.type.8 = tuple_init (%.loc5_60.3, %.loc5_60.5) to file.%b_ref.var [template = constants.%tuple.4] -// CHECK:STDOUT: %.loc5_61: init %tuple.type.8 = converted %.loc5_60.1, %.loc5_60.6 [template = constants.%tuple.4] +// CHECK:STDOUT: %.loc5_51.5: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc5_51.6: = bound_method %.loc5_50, %.loc5_51.5 [template = constants.%.34] +// CHECK:STDOUT: %int.convert_checked.loc5_51: init i32 = call %.loc5_51.6(%.loc5_50) [template = constants.%.35] +// CHECK:STDOUT: %.loc5_51.7: init i32 = converted %.loc5_50, %int.convert_checked.loc5_51 [template = constants.%.35] +// CHECK:STDOUT: %.loc5_51.8: ref i32 = tuple_access %.loc5_60.2, element1 +// CHECK:STDOUT: %.loc5_51.9: init i32 = initialize_from %.loc5_51.7 to %.loc5_51.8 [template = constants.%.35] +// CHECK:STDOUT: %.loc5_51.10: init %tuple.type.7 = tuple_init (%.loc5_51.4, %.loc5_51.9) to %.loc5_60.2 [template = constants.%tuple.2] +// CHECK:STDOUT: %.loc5_60.3: init %tuple.type.7 = converted %.loc5_51.1, %.loc5_51.10 [template = constants.%tuple.2] +// CHECK:STDOUT: %.loc5_59.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc5_59.3: = bound_method %.loc5_55, %.loc5_59.2 [template = constants.%.36] +// CHECK:STDOUT: %int.convert_checked.loc5_59.1: init i32 = call %.loc5_59.3(%.loc5_55) [template = constants.%.37] +// CHECK:STDOUT: %.loc5_59.4: init i32 = converted %.loc5_55, %int.convert_checked.loc5_59.1 [template = constants.%.37] +// CHECK:STDOUT: %.loc5_60.4: ref %tuple.type.8 = tuple_access file.%b_ref.var, element1 +// CHECK:STDOUT: %.loc5_59.5: ref i32 = tuple_access %.loc5_60.4, element0 +// CHECK:STDOUT: %.loc5_59.6: init i32 = initialize_from %.loc5_59.4 to %.loc5_59.5 [template = constants.%.37] +// CHECK:STDOUT: %.loc5_59.7: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc5_59.8: = bound_method %.loc5_58, %.loc5_59.7 [template = constants.%.38] +// CHECK:STDOUT: %int.convert_checked.loc5_59.2: init i32 = call %.loc5_59.8(%.loc5_58) [template = constants.%.39] +// CHECK:STDOUT: %.loc5_59.9: init i32 = converted %.loc5_58, %int.convert_checked.loc5_59.2 [template = constants.%.39] +// CHECK:STDOUT: %.loc5_59.10: ref i32 = tuple_access %.loc5_60.4, element1 +// CHECK:STDOUT: %.loc5_59.11: init i32 = initialize_from %.loc5_59.9 to %.loc5_59.10 [template = constants.%.39] +// CHECK:STDOUT: %.loc5_59.12: init %tuple.type.8 = tuple_init (%.loc5_59.6, %.loc5_59.11) to %.loc5_60.4 [template = constants.%tuple.3] +// CHECK:STDOUT: %.loc5_60.5: init %tuple.type.8 = converted %.loc5_59.1, %.loc5_59.12 [template = constants.%tuple.3] +// CHECK:STDOUT: %.loc5_60.6: init %tuple.type.9 = tuple_init (%.loc5_60.3, %.loc5_60.5) to file.%b_ref.var [template = constants.%tuple.4] +// CHECK:STDOUT: %.loc5_61: init %tuple.type.9 = converted %.loc5_60.1, %.loc5_60.6 [template = constants.%tuple.4] // CHECK:STDOUT: assign file.%b_ref.var, %.loc5_61 // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -230,6 +277,74 @@ var c_bad: C((3, 4)) = F(); // CHECK:STDOUT: --- implicit.impl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.2: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic] +// CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2) = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.3: type = facet_type <@ImplicitAs, @ImplicitAs(i32)> [template] +// CHECK:STDOUT: %Self.2: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Convert.type.1: type = fn_type @Convert.1, @ImplicitAs(%Dest) [symbolic] +// CHECK:STDOUT: %Convert.1: %Convert.type.1 = struct_value () [symbolic] +// CHECK:STDOUT: %.1: type = assoc_entity_type %ImplicitAs.type.2, %Convert.type.1 [symbolic] +// CHECK:STDOUT: %.2: %.1 = assoc_entity element0, imports.%import_ref.11 [symbolic] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(i32) [template] +// CHECK:STDOUT: %Convert.2: %Convert.type.2 = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type %ImplicitAs.type.3, %Convert.type.2 [template] +// CHECK:STDOUT: %.4: %.3 = assoc_entity element0, imports.%import_ref.12 [template] +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic] +// CHECK:STDOUT: %.5: type = int_type signed, %N [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.4: type = facet_type <@ImplicitAs, @ImplicitAs(%.5)> [symbolic] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.3: type = fn_type @Convert.2, @impl.2(%N) [symbolic] +// CHECK:STDOUT: %Convert.3: %Convert.type.3 = struct_value () [symbolic] +// CHECK:STDOUT: %.6: = interface_witness (%Convert.3) [symbolic] +// CHECK:STDOUT: %.7: type = int_type unsigned, %N [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.5: type = facet_type <@ImplicitAs, @ImplicitAs(%.7)> [symbolic] +// CHECK:STDOUT: %Convert.type.4: type = fn_type @Convert.3, @impl.3(%N) [symbolic] +// CHECK:STDOUT: %Convert.4: %Convert.type.4 = struct_value () [symbolic] +// CHECK:STDOUT: %.8: = interface_witness (%Convert.4) [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.6: type = facet_type <@ImplicitAs, @ImplicitAs(Core.IntLiteral)> [template] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %Convert.5: %Convert.type.5 = struct_value () [template] +// CHECK:STDOUT: %.9: type = assoc_entity_type %ImplicitAs.type.6, %Convert.type.5 [template] +// CHECK:STDOUT: %.10: %.9 = assoc_entity element0, imports.%import_ref.22 [template] +// CHECK:STDOUT: %Convert.type.6: type = fn_type @Convert.4, @impl.5(%N) [symbolic] +// CHECK:STDOUT: %Convert.6: %Convert.type.6 = struct_value () [symbolic] +// CHECK:STDOUT: %.11: = interface_witness (%Convert.6) [symbolic] +// CHECK:STDOUT: %Convert.type.7: type = fn_type @Convert.5, @impl.6(%N) [symbolic] +// CHECK:STDOUT: %Convert.7: %Convert.type.7 = struct_value () [symbolic] +// CHECK:STDOUT: %.12: = interface_witness (%Convert.7) [symbolic] +// CHECK:STDOUT: %As.type.2: type = facet_type <@As, @As(%Dest)> [symbolic] +// CHECK:STDOUT: %Self.3: @As.%As.type (%As.type.2) = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %As.type.3: type = facet_type <@As, @As(i32)> [template] +// CHECK:STDOUT: %Self.4: %As.type.2 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Convert.type.8: type = fn_type @Convert.6, @As(%Dest) [symbolic] +// CHECK:STDOUT: %Convert.8: %Convert.type.8 = struct_value () [symbolic] +// CHECK:STDOUT: %.13: type = assoc_entity_type %As.type.2, %Convert.type.8 [symbolic] +// CHECK:STDOUT: %.14: %.13 = assoc_entity element0, imports.%import_ref.35 [symbolic] +// CHECK:STDOUT: %Convert.type.9: type = fn_type @Convert.6, @As(i32) [template] +// CHECK:STDOUT: %Convert.9: %Convert.type.9 = struct_value () [template] +// CHECK:STDOUT: %.15: type = assoc_entity_type %As.type.3, %Convert.type.9 [template] +// CHECK:STDOUT: %.16: %.15 = assoc_entity element0, imports.%import_ref.36 [template] +// CHECK:STDOUT: %As.type.4: type = facet_type <@As, @As(%.5)> [symbolic] +// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.7, @impl.8(%N) [symbolic] +// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [symbolic] +// CHECK:STDOUT: %.17: = interface_witness (%Convert.10) [symbolic] +// CHECK:STDOUT: %As.type.5: type = facet_type <@As, @As(%.7)> [symbolic] +// CHECK:STDOUT: %Convert.type.11: type = fn_type @Convert.8, @impl.9(%N) [symbolic] +// CHECK:STDOUT: %Convert.11: %Convert.type.11 = struct_value () [symbolic] +// CHECK:STDOUT: %.18: = interface_witness (%Convert.11) [symbolic] +// CHECK:STDOUT: %As.type.6: type = facet_type <@As, @As(Core.IntLiteral)> [template] +// CHECK:STDOUT: %Convert.type.12: type = fn_type @Convert.6, @As(Core.IntLiteral) [template] +// CHECK:STDOUT: %Convert.12: %Convert.type.12 = struct_value () [template] +// CHECK:STDOUT: %.19: type = assoc_entity_type %As.type.6, %Convert.type.12 [template] +// CHECK:STDOUT: %.20: %.19 = assoc_entity element0, imports.%import_ref.46 [template] +// CHECK:STDOUT: %Convert.type.13: type = fn_type @Convert.9, @impl.11(%N) [symbolic] +// CHECK:STDOUT: %Convert.13: %Convert.type.13 = struct_value () [symbolic] +// CHECK:STDOUT: %.21: = interface_witness (%Convert.13) [symbolic] +// CHECK:STDOUT: %Convert.type.14: type = fn_type @Convert.10, @impl.12(%N) [symbolic] +// CHECK:STDOUT: %Convert.14: %Convert.type.14 = struct_value () [symbolic] +// CHECK:STDOUT: %.22: = interface_witness (%Convert.14) [symbolic] // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template] // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %tuple.type.1: type = tuple_type (type) [template] @@ -244,9 +359,18 @@ var c_bad: C((3, 4)) = F(); // CHECK:STDOUT: %C.1: %C.type = struct_value () [template] // CHECK:STDOUT: %X: %tuple.type.7 = bind_symbolic_name X, 0 [symbolic] // CHECK:STDOUT: %X.patt: %tuple.type.7 = symbolic_binding_pattern X, 0 [symbolic] -// CHECK:STDOUT: %.6: i32 = int_value 1 [template] -// CHECK:STDOUT: %.7: i32 = int_value 2 [template] -// CHECK:STDOUT: %tuple: %tuple.type.7 = tuple_value (%.6, %.7) [template] +// CHECK:STDOUT: %.28: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.29: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %tuple.type.10: type = tuple_type (Core.IntLiteral, Core.IntLiteral) [template] +// CHECK:STDOUT: %.30: %.1 = assoc_entity element0, imports.%import_ref.56 [symbolic] +// CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template] +// CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template] +// CHECK:STDOUT: %.31: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.32: = bound_method %.28, %Convert.15 [template] +// CHECK:STDOUT: %.33: i32 = int_value 1 [template] +// CHECK:STDOUT: %.34: = bound_method %.29, %Convert.15 [template] +// CHECK:STDOUT: %.35: i32 = int_value 2 [template] +// CHECK:STDOUT: %tuple: %tuple.type.7 = tuple_value (%.33, %.35) [template] // CHECK:STDOUT: %C.3: type = class_type @C, @C(%tuple) [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] @@ -254,15 +378,60 @@ var c_bad: C((3, 4)) = F(); // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %import_ref.1: ref %tuple.type.2 = import_ref Implicit//default, inst+19, loaded -// CHECK:STDOUT: %import_ref.2: ref %tuple.type.8 = import_ref Implicit//default, inst+59, loaded -// CHECK:STDOUT: %import_ref.3: %C.type = import_ref Implicit//default, inst+108, loaded [template = constants.%C.1] -// CHECK:STDOUT: %import_ref.4: %F.type = import_ref Implicit//default, inst+130, loaded [template = constants.%F] +// CHECK:STDOUT: %import_ref.2: ref %tuple.type.8 = import_ref Implicit//default, inst+423, loaded +// CHECK:STDOUT: %import_ref.3: %C.type = import_ref Implicit//default, inst+497, loaded [template = constants.%C.1] +// CHECK:STDOUT: %import_ref.4: %F.type = import_ref Implicit//default, inst+529, loaded [template = constants.%F] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref.5 +// CHECK:STDOUT: .Int32 = %import_ref.53 +// CHECK:STDOUT: .ImplicitAs = %import_ref.55 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.6 = import_ref Implicit//default, inst+113, unloaded +// CHECK:STDOUT: %import_ref.5 = import_ref Implicit//default, inst+37, unloaded +// CHECK:STDOUT: %import_ref.6: @ImplicitAs.%.1 (%.1) = import_ref Implicit//default, inst+38, loaded [symbolic = @ImplicitAs.%.2 (constants.%.30)] +// CHECK:STDOUT: %import_ref.7 = import_ref Implicit//default, inst+39, unloaded +// CHECK:STDOUT: %import_ref.8: type = import_ref Implicit//default, inst+73, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.9: type = import_ref Implicit//default, inst+74, loaded [template = constants.%ImplicitAs.type.3] +// CHECK:STDOUT: %import_ref.10: = import_ref Implicit//default, inst+75, loaded [template = constants.%.31] +// CHECK:STDOUT: %import_ref.11 = import_ref Implicit//default, inst+54, unloaded +// CHECK:STDOUT: %import_ref.13: type = import_ref Implicit//default, inst+85, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.14: type = import_ref Implicit//default, inst+86, loaded [symbolic = @impl.2.%ImplicitAs.type (constants.%ImplicitAs.type.4)] +// CHECK:STDOUT: %import_ref.15 = import_ref Implicit//default, inst+87, unloaded +// CHECK:STDOUT: %import_ref.16: type = import_ref Implicit//default, inst+115, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.17: type = import_ref Implicit//default, inst+116, loaded [symbolic = @impl.3.%ImplicitAs.type (constants.%ImplicitAs.type.5)] +// CHECK:STDOUT: %import_ref.18 = import_ref Implicit//default, inst+117, unloaded +// CHECK:STDOUT: %import_ref.19: type = import_ref Implicit//default, inst+140, loaded [template = i32] +// CHECK:STDOUT: %import_ref.20: type = import_ref Implicit//default, inst+141, loaded [template = constants.%ImplicitAs.type.6] +// CHECK:STDOUT: %import_ref.21 = import_ref Implicit//default, inst+142, unloaded +// CHECK:STDOUT: %import_ref.23: type = import_ref Implicit//default, inst+153, loaded [symbolic = @impl.5.%.1 (constants.%.5)] +// CHECK:STDOUT: %import_ref.24: type = import_ref Implicit//default, inst+154, loaded [template = constants.%ImplicitAs.type.6] +// CHECK:STDOUT: %import_ref.25 = import_ref Implicit//default, inst+155, unloaded +// CHECK:STDOUT: %import_ref.26: type = import_ref Implicit//default, inst+180, loaded [symbolic = @impl.6.%.1 (constants.%.7)] +// CHECK:STDOUT: %import_ref.27: type = import_ref Implicit//default, inst+181, loaded [template = constants.%ImplicitAs.type.6] +// CHECK:STDOUT: %import_ref.28 = import_ref Implicit//default, inst+182, unloaded +// CHECK:STDOUT: %import_ref.29 = import_ref Implicit//default, inst+212, unloaded +// CHECK:STDOUT: %import_ref.30 = import_ref Implicit//default, inst+213, unloaded +// CHECK:STDOUT: %import_ref.31 = import_ref Implicit//default, inst+214, unloaded +// CHECK:STDOUT: %import_ref.32: type = import_ref Implicit//default, inst+216, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.33: type = import_ref Implicit//default, inst+217, loaded [template = constants.%As.type.3] +// CHECK:STDOUT: %import_ref.34 = import_ref Implicit//default, inst+218, unloaded +// CHECK:STDOUT: %import_ref.35 = import_ref Implicit//default, inst+233, unloaded +// CHECK:STDOUT: %import_ref.37: type = import_ref Implicit//default, inst+255, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.38: type = import_ref Implicit//default, inst+256, loaded [symbolic = @impl.8.%As.type (constants.%As.type.4)] +// CHECK:STDOUT: %import_ref.39 = import_ref Implicit//default, inst+257, unloaded +// CHECK:STDOUT: %import_ref.40: type = import_ref Implicit//default, inst+284, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.41: type = import_ref Implicit//default, inst+285, loaded [symbolic = @impl.9.%As.type (constants.%As.type.5)] +// CHECK:STDOUT: %import_ref.42 = import_ref Implicit//default, inst+286, unloaded +// CHECK:STDOUT: %import_ref.43: type = import_ref Implicit//default, inst+309, loaded [template = i32] +// CHECK:STDOUT: %import_ref.44: type = import_ref Implicit//default, inst+310, loaded [template = constants.%As.type.6] +// CHECK:STDOUT: %import_ref.45 = import_ref Implicit//default, inst+311, unloaded +// CHECK:STDOUT: %import_ref.47: type = import_ref Implicit//default, inst+322, loaded [symbolic = @impl.11.%.1 (constants.%.5)] +// CHECK:STDOUT: %import_ref.48: type = import_ref Implicit//default, inst+323, loaded [template = constants.%As.type.6] +// CHECK:STDOUT: %import_ref.49 = import_ref Implicit//default, inst+324, unloaded +// CHECK:STDOUT: %import_ref.50: type = import_ref Implicit//default, inst+349, loaded [symbolic = @impl.12.%.1 (constants.%.7)] +// CHECK:STDOUT: %import_ref.51: type = import_ref Implicit//default, inst+350, loaded [template = constants.%As.type.6] +// CHECK:STDOUT: %import_ref.52 = import_ref Implicit//default, inst+351, unloaded +// CHECK:STDOUT: %import_ref.54 = import_ref Implicit//default, inst+502, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -309,16 +478,218 @@ var c_bad: C((3, 4)) = F(); // CHECK:STDOUT: %b.var: ref %tuple.type.8 = var b // CHECK:STDOUT: %b: ref %tuple.type.8 = bind_name b, %b.var // CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%import_ref.3 [template = constants.%C.1] -// CHECK:STDOUT: %.loc6_11: i32 = int_value 1 [template = constants.%.6] -// CHECK:STDOUT: %.loc6_14: i32 = int_value 2 [template = constants.%.7] -// CHECK:STDOUT: %.loc6_15: %tuple.type.7 = tuple_literal (%.loc6_11, %.loc6_14) -// CHECK:STDOUT: %tuple: %tuple.type.7 = tuple_value (%.loc6_11, %.loc6_14) [template = constants.%tuple] -// CHECK:STDOUT: %.loc6_9: %tuple.type.7 = converted %.loc6_15, %tuple [template = constants.%tuple] +// CHECK:STDOUT: %.loc6_11: Core.IntLiteral = int_value 1 [template = constants.%.28] +// CHECK:STDOUT: %.loc6_14: Core.IntLiteral = int_value 2 [template = constants.%.29] +// CHECK:STDOUT: %.loc6_15.1: %tuple.type.10 = tuple_literal (%.loc6_11, %.loc6_14) +// CHECK:STDOUT: %.loc6_15.2: %Convert.type.2 = interface_witness_access constants.%.31, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc6_15.3: = bound_method %.loc6_11, %.loc6_15.2 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc6_15.1: init i32 = call %.loc6_15.3(%.loc6_11) [template = constants.%.33] +// CHECK:STDOUT: %.loc6_15.4: i32 = value_of_initializer %int.convert_checked.loc6_15.1 [template = constants.%.33] +// CHECK:STDOUT: %.loc6_15.5: i32 = converted %.loc6_11, %.loc6_15.4 [template = constants.%.33] +// CHECK:STDOUT: %.loc6_15.6: %Convert.type.2 = interface_witness_access constants.%.31, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc6_15.7: = bound_method %.loc6_14, %.loc6_15.6 [template = constants.%.34] +// CHECK:STDOUT: %int.convert_checked.loc6_15.2: init i32 = call %.loc6_15.7(%.loc6_14) [template = constants.%.35] +// CHECK:STDOUT: %.loc6_15.8: i32 = value_of_initializer %int.convert_checked.loc6_15.2 [template = constants.%.35] +// CHECK:STDOUT: %.loc6_15.9: i32 = converted %.loc6_14, %.loc6_15.8 [template = constants.%.35] +// CHECK:STDOUT: %tuple: %tuple.type.7 = tuple_value (%.loc6_15.5, %.loc6_15.9) [template = constants.%tuple] +// CHECK:STDOUT: %.loc6_9: %tuple.type.7 = converted %.loc6_15.1, %tuple [template = constants.%tuple] // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%tuple) [template = constants.%C.3] // CHECK:STDOUT: %c.var: ref %C.3 = var c // CHECK:STDOUT: %c: ref %C.3 = bind_name c, %c.var // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(constants.%Dest: type) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)] +// CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.1, @ImplicitAs(%Dest) [symbolic = %Convert.type (constants.%Convert.type.1)] +// CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.1) = struct_value () [symbolic = %Convert (constants.%Convert.1)] +// CHECK:STDOUT: %.1: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2), @ImplicitAs.%Convert.type (%Convert.type.1) [symbolic = %.1 (constants.%.1)] +// CHECK:STDOUT: %.2: @ImplicitAs.%.1 (%.1) = assoc_entity element0, imports.%import_ref.11 [symbolic = %.2 (constants.%.2)] +// CHECK:STDOUT: +// CHECK:STDOUT: interface { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%import_ref.5 +// CHECK:STDOUT: .Convert = imports.%import_ref.6 +// CHECK:STDOUT: witness = (imports.%import_ref.7) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @As(constants.%Dest: type) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest)> [symbolic = %As.type (constants.%As.type.2)] +// CHECK:STDOUT: %Self: %As.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.4)] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.6, @As(%Dest) [symbolic = %Convert.type (constants.%Convert.type.8)] +// CHECK:STDOUT: %Convert: @As.%Convert.type (%Convert.type.8) = struct_value () [symbolic = %Convert (constants.%Convert.8)] +// CHECK:STDOUT: %.1: type = assoc_entity_type @As.%As.type (%As.type.2), @As.%Convert.type (%Convert.type.8) [symbolic = %.1 (constants.%.13)] +// CHECK:STDOUT: %.2: @As.%.1 (%.13) = assoc_entity element0, imports.%import_ref.35 [symbolic = %.2 (constants.%.14)] +// CHECK:STDOUT: +// CHECK:STDOUT: interface { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%import_ref.29 +// CHECK:STDOUT: .Convert = imports.%import_ref.30 +// CHECK:STDOUT: witness = (imports.%import_ref.31) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.1: imports.%import_ref.8 as imports.%import_ref.9 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.10 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.2(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%.1)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.4)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.2, @impl.2(%N) [symbolic = %Convert.type (constants.%Convert.type.3)] +// CHECK:STDOUT: %Convert: @impl.2.%Convert.type (%Convert.type.3) = struct_value () [symbolic = %Convert (constants.%Convert.3)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.6)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.13 as imports.%import_ref.14 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.15 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.3(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%.1)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.3, @impl.3(%N) [symbolic = %Convert.type (constants.%Convert.type.4)] +// CHECK:STDOUT: %Convert: @impl.3.%Convert.type (%Convert.type.4) = struct_value () [symbolic = %Convert (constants.%Convert.4)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.8)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.16 as imports.%import_ref.17 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.18 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.4: imports.%import_ref.19 as imports.%import_ref.20 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.21 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.5(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.4, @impl.5(%N) [symbolic = %Convert.type (constants.%Convert.type.6)] +// CHECK:STDOUT: %Convert: @impl.5.%Convert.type (%Convert.type.6) = struct_value () [symbolic = %Convert (constants.%Convert.6)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.11)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.23 as imports.%import_ref.24 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.25 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.6(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.5, @impl.6(%N) [symbolic = %Convert.type (constants.%Convert.type.7)] +// CHECK:STDOUT: %Convert: @impl.6.%Convert.type (%Convert.type.7) = struct_value () [symbolic = %Convert (constants.%Convert.7)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.12)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.26 as imports.%import_ref.27 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.28 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.7: imports.%import_ref.32 as imports.%import_ref.33 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.34 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.8(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%.1)> [symbolic = %As.type (constants.%As.type.4)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.7, @impl.8(%N) [symbolic = %Convert.type (constants.%Convert.type.10)] +// CHECK:STDOUT: %Convert: @impl.8.%Convert.type (%Convert.type.10) = struct_value () [symbolic = %Convert (constants.%Convert.10)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.17)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.37 as imports.%import_ref.38 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.39 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.9(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%.1)> [symbolic = %As.type (constants.%As.type.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.8, @impl.9(%N) [symbolic = %Convert.type (constants.%Convert.type.11)] +// CHECK:STDOUT: %Convert: @impl.9.%Convert.type (%Convert.type.11) = struct_value () [symbolic = %Convert (constants.%Convert.11)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.18)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.40 as imports.%import_ref.41 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.42 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.10: imports.%import_ref.43 as imports.%import_ref.44 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.45 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.11(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.9, @impl.11(%N) [symbolic = %Convert.type (constants.%Convert.type.13)] +// CHECK:STDOUT: %Convert: @impl.11.%Convert.type (%Convert.type.13) = struct_value () [symbolic = %Convert (constants.%Convert.13)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.21)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.47 as imports.%import_ref.48 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.49 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.12(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.10, @impl.12(%N) [symbolic = %Convert.type (constants.%Convert.type.14)] +// CHECK:STDOUT: %Convert: @impl.12.%Convert.type (%Convert.type.14) = struct_value () [symbolic = %Convert (constants.%Convert.14)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.22)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.50 as imports.%import_ref.51 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.52 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: generic class @C(constants.%X: %tuple.type.7) { // CHECK:STDOUT: %X: %tuple.type.7 = bind_symbolic_name X, 0 [symbolic = %X (constants.%X)] // CHECK:STDOUT: %X.patt: %tuple.type.7 = symbolic_binding_pattern X, 0 [symbolic = %X.patt (constants.%X.patt)] @@ -327,10 +698,100 @@ var c_bad: C((3, 4)) = F(); // CHECK:STDOUT: // CHECK:STDOUT: class { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = imports.%import_ref.6 +// CHECK:STDOUT: .Self = imports.%import_ref.54 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.1(constants.%Dest: type, constants.%Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2)) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)] +// CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.1.%Self (%Self.2)]() -> @Convert.1.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.2(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.2.%.1 (%.5) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.3(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.3.%.1 (%.7) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.4(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.4.%.1 (%.5)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.5(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.5.%.1 (%.7)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.6(constants.%Dest: type, constants.%Self.3: @As.%As.type (%As.type.2)) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest)> [symbolic = %As.type (constants.%As.type.2)] +// CHECK:STDOUT: %Self: %As.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.4)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.6.%Self (%Self.4)]() -> @Convert.6.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.7(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.7.%.1 (%.5) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.8(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.8.%.1 (%.7) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.9(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.9.%.1 (%.5)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.10(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.10.%.1 (%.7)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Convert.11[%self.param_patt: Core.IntLiteral]() -> i32 = "int.convert_checked"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> %C.3; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { @@ -379,6 +840,284 @@ var c_bad: C((3, 4)) = F(); // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(i32) { +// CHECK:STDOUT: %Dest => i32 +// CHECK:STDOUT: %Dest.patt => i32 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3 +// CHECK:STDOUT: %Self => constants.%Self.2 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.2 +// CHECK:STDOUT: %Convert => constants.%Convert.2 +// CHECK:STDOUT: %.1 => constants.%.3 +// CHECK:STDOUT: %.2 => constants.%.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@Convert.1.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.1(constants.%Dest, constants.%Self.1) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.2 +// CHECK:STDOUT: %Self => constants.%Self.1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%.5) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@impl.2.%.1) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.2(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.2(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.2(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%.7) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@impl.3.%.1) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.3(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.3(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.3(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(Core.IntLiteral) { +// CHECK:STDOUT: %Dest => Core.IntLiteral +// CHECK:STDOUT: %Dest.patt => Core.IntLiteral +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.6 +// CHECK:STDOUT: %Self => constants.%Self.2 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.5 +// CHECK:STDOUT: %Convert => constants.%Convert.5 +// CHECK:STDOUT: %.1 => constants.%.9 +// CHECK:STDOUT: %.2 => constants.%.10 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.5(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.5(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.4(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.6(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.6(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.5(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(i32) { +// CHECK:STDOUT: %Dest => i32 +// CHECK:STDOUT: %Dest.patt => i32 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type => constants.%As.type.3 +// CHECK:STDOUT: %Self => constants.%Self.4 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.9 +// CHECK:STDOUT: %Convert => constants.%Convert.9 +// CHECK:STDOUT: %.1 => constants.%.15 +// CHECK:STDOUT: %.2 => constants.%.16 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(@Convert.6.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.6(constants.%Dest, constants.%Self.3) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %As.type => constants.%As.type.2 +// CHECK:STDOUT: %Self => constants.%Self.3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%.5) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(@impl.8.%.1) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.8(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %As.type => constants.%As.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.8(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %As.type => constants.%As.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.7(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%.7) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(@impl.9.%.1) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.9(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %As.type => constants.%As.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.9(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %As.type => constants.%As.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.8(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(Core.IntLiteral) { +// CHECK:STDOUT: %Dest => Core.IntLiteral +// CHECK:STDOUT: %Dest.patt => Core.IntLiteral +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type => constants.%As.type.6 +// CHECK:STDOUT: %Self => constants.%Self.4 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.12 +// CHECK:STDOUT: %Convert => constants.%Convert.12 +// CHECK:STDOUT: %.1 => constants.%.19 +// CHECK:STDOUT: %.2 => constants.%.20 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.11(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.11(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.9(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.12(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.12(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.10(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: specific @C(constants.%X) { // CHECK:STDOUT: %X => constants.%X // CHECK:STDOUT: %X.patt => constants.%X @@ -394,31 +1133,145 @@ var c_bad: C((3, 4)) = F(); // CHECK:STDOUT: --- fail_bad_type.impl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.2: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic] +// CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2) = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.3: type = facet_type <@ImplicitAs, @ImplicitAs(i32)> [template] +// CHECK:STDOUT: %Self.2: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Convert.type.1: type = fn_type @Convert.1, @ImplicitAs(%Dest) [symbolic] +// CHECK:STDOUT: %Convert.1: %Convert.type.1 = struct_value () [symbolic] +// CHECK:STDOUT: %.1: type = assoc_entity_type %ImplicitAs.type.2, %Convert.type.1 [symbolic] +// CHECK:STDOUT: %.2: %.1 = assoc_entity element0, imports.%import_ref.11 [symbolic] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(i32) [template] +// CHECK:STDOUT: %Convert.2: %Convert.type.2 = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type %ImplicitAs.type.3, %Convert.type.2 [template] +// CHECK:STDOUT: %.4: %.3 = assoc_entity element0, imports.%import_ref.12 [template] +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic] +// CHECK:STDOUT: %.5: type = int_type signed, %N [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.4: type = facet_type <@ImplicitAs, @ImplicitAs(%.5)> [symbolic] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.3: type = fn_type @Convert.2, @impl.2(%N) [symbolic] +// CHECK:STDOUT: %Convert.3: %Convert.type.3 = struct_value () [symbolic] +// CHECK:STDOUT: %.6: = interface_witness (%Convert.3) [symbolic] +// CHECK:STDOUT: %.7: type = int_type unsigned, %N [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.5: type = facet_type <@ImplicitAs, @ImplicitAs(%.7)> [symbolic] +// CHECK:STDOUT: %Convert.type.4: type = fn_type @Convert.3, @impl.3(%N) [symbolic] +// CHECK:STDOUT: %Convert.4: %Convert.type.4 = struct_value () [symbolic] +// CHECK:STDOUT: %.8: = interface_witness (%Convert.4) [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.6: type = facet_type <@ImplicitAs, @ImplicitAs(Core.IntLiteral)> [template] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %Convert.5: %Convert.type.5 = struct_value () [template] +// CHECK:STDOUT: %.9: type = assoc_entity_type %ImplicitAs.type.6, %Convert.type.5 [template] +// CHECK:STDOUT: %.10: %.9 = assoc_entity element0, imports.%import_ref.22 [template] +// CHECK:STDOUT: %Convert.type.6: type = fn_type @Convert.4, @impl.5(%N) [symbolic] +// CHECK:STDOUT: %Convert.6: %Convert.type.6 = struct_value () [symbolic] +// CHECK:STDOUT: %.11: = interface_witness (%Convert.6) [symbolic] +// CHECK:STDOUT: %Convert.type.7: type = fn_type @Convert.5, @impl.6(%N) [symbolic] +// CHECK:STDOUT: %Convert.7: %Convert.type.7 = struct_value () [symbolic] +// CHECK:STDOUT: %.12: = interface_witness (%Convert.7) [symbolic] +// CHECK:STDOUT: %As.type.2: type = facet_type <@As, @As(%Dest)> [symbolic] +// CHECK:STDOUT: %Self.3: @As.%As.type (%As.type.2) = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %As.type.3: type = facet_type <@As, @As(i32)> [template] +// CHECK:STDOUT: %Self.4: %As.type.2 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Convert.type.8: type = fn_type @Convert.6, @As(%Dest) [symbolic] +// CHECK:STDOUT: %Convert.8: %Convert.type.8 = struct_value () [symbolic] +// CHECK:STDOUT: %.13: type = assoc_entity_type %As.type.2, %Convert.type.8 [symbolic] +// CHECK:STDOUT: %.14: %.13 = assoc_entity element0, imports.%import_ref.35 [symbolic] +// CHECK:STDOUT: %Convert.type.9: type = fn_type @Convert.6, @As(i32) [template] +// CHECK:STDOUT: %Convert.9: %Convert.type.9 = struct_value () [template] +// CHECK:STDOUT: %.15: type = assoc_entity_type %As.type.3, %Convert.type.9 [template] +// CHECK:STDOUT: %.16: %.15 = assoc_entity element0, imports.%import_ref.36 [template] +// CHECK:STDOUT: %As.type.4: type = facet_type <@As, @As(%.5)> [symbolic] +// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.7, @impl.8(%N) [symbolic] +// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [symbolic] +// CHECK:STDOUT: %.17: = interface_witness (%Convert.10) [symbolic] +// CHECK:STDOUT: %As.type.5: type = facet_type <@As, @As(%.7)> [symbolic] +// CHECK:STDOUT: %Convert.type.11: type = fn_type @Convert.8, @impl.9(%N) [symbolic] +// CHECK:STDOUT: %Convert.11: %Convert.type.11 = struct_value () [symbolic] +// CHECK:STDOUT: %.18: = interface_witness (%Convert.11) [symbolic] +// CHECK:STDOUT: %As.type.6: type = facet_type <@As, @As(Core.IntLiteral)> [template] +// CHECK:STDOUT: %Convert.type.12: type = fn_type @Convert.6, @As(Core.IntLiteral) [template] +// CHECK:STDOUT: %Convert.12: %Convert.type.12 = struct_value () [template] +// CHECK:STDOUT: %.19: type = assoc_entity_type %As.type.6, %Convert.type.12 [template] +// CHECK:STDOUT: %.20: %.19 = assoc_entity element0, imports.%import_ref.46 [template] +// CHECK:STDOUT: %Convert.type.13: type = fn_type @Convert.9, @impl.11(%N) [symbolic] +// CHECK:STDOUT: %Convert.13: %Convert.type.13 = struct_value () [symbolic] +// CHECK:STDOUT: %.21: = interface_witness (%Convert.13) [symbolic] +// CHECK:STDOUT: %Convert.type.14: type = fn_type @Convert.10, @impl.12(%N) [symbolic] +// CHECK:STDOUT: %Convert.14: %Convert.type.14 = struct_value () [symbolic] +// CHECK:STDOUT: %.22: = interface_witness (%Convert.14) [symbolic] // CHECK:STDOUT: %C.type: type = generic_class_type @C [template] // CHECK:STDOUT: %C.1: %C.type = struct_value () [template] // CHECK:STDOUT: %tuple.type.1: type = tuple_type (i32, i32) [template] // CHECK:STDOUT: %X: %tuple.type.1 = bind_symbolic_name X, 0 [symbolic] // CHECK:STDOUT: %X.patt: %tuple.type.1 = symbolic_binding_pattern X, 0 [symbolic] -// CHECK:STDOUT: %.3: i32 = int_value 1 [template] -// CHECK:STDOUT: %.4: i32 = int_value 2 [template] -// CHECK:STDOUT: %.5: i32 = int_value 3 [template] -// CHECK:STDOUT: %tuple.type.2: type = tuple_type (i32, i32, i32) [template] +// CHECK:STDOUT: %.25: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.26: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %.27: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %tuple.type.2: type = tuple_type (Core.IntLiteral, Core.IntLiteral, Core.IntLiteral) [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %tuple: %tuple.type.1 = tuple_value (%.3, %.4) [template] +// CHECK:STDOUT: %.29: i32 = int_value 2 [template] +// CHECK:STDOUT: %.30: i32 = int_value 1 [template] +// CHECK:STDOUT: %tuple: %tuple.type.1 = tuple_value (%.30, %.29) [template] // CHECK:STDOUT: %C.3: type = class_type @C, @C(%tuple) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %import_ref.1 = import_ref Implicit//default, inst+19, unloaded -// CHECK:STDOUT: %import_ref.2 = import_ref Implicit//default, inst+59, unloaded -// CHECK:STDOUT: %import_ref.3: %C.type = import_ref Implicit//default, inst+108, loaded [template = constants.%C.1] -// CHECK:STDOUT: %import_ref.4: %F.type = import_ref Implicit//default, inst+130, loaded [template = constants.%F] +// CHECK:STDOUT: %import_ref.2 = import_ref Implicit//default, inst+423, unloaded +// CHECK:STDOUT: %import_ref.3: %C.type = import_ref Implicit//default, inst+497, loaded [template = constants.%C.1] +// CHECK:STDOUT: %import_ref.4: %F.type = import_ref Implicit//default, inst+529, loaded [template = constants.%F] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.5 = import_ref Implicit//default, inst+113, unloaded +// CHECK:STDOUT: %import_ref.5 = import_ref Implicit//default, inst+37, unloaded +// CHECK:STDOUT: %import_ref.6 = import_ref Implicit//default, inst+38, unloaded +// CHECK:STDOUT: %import_ref.7 = import_ref Implicit//default, inst+39, unloaded +// CHECK:STDOUT: %import_ref.8: type = import_ref Implicit//default, inst+73, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.9: type = import_ref Implicit//default, inst+74, loaded [template = constants.%ImplicitAs.type.3] +// CHECK:STDOUT: %import_ref.10 = import_ref Implicit//default, inst+75, unloaded +// CHECK:STDOUT: %import_ref.11 = import_ref Implicit//default, inst+54, unloaded +// CHECK:STDOUT: %import_ref.13: type = import_ref Implicit//default, inst+85, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.14: type = import_ref Implicit//default, inst+86, loaded [symbolic = @impl.2.%ImplicitAs.type (constants.%ImplicitAs.type.4)] +// CHECK:STDOUT: %import_ref.15 = import_ref Implicit//default, inst+87, unloaded +// CHECK:STDOUT: %import_ref.16: type = import_ref Implicit//default, inst+115, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.17: type = import_ref Implicit//default, inst+116, loaded [symbolic = @impl.3.%ImplicitAs.type (constants.%ImplicitAs.type.5)] +// CHECK:STDOUT: %import_ref.18 = import_ref Implicit//default, inst+117, unloaded +// CHECK:STDOUT: %import_ref.19: type = import_ref Implicit//default, inst+140, loaded [template = i32] +// CHECK:STDOUT: %import_ref.20: type = import_ref Implicit//default, inst+141, loaded [template = constants.%ImplicitAs.type.6] +// CHECK:STDOUT: %import_ref.21 = import_ref Implicit//default, inst+142, unloaded +// CHECK:STDOUT: %import_ref.23: type = import_ref Implicit//default, inst+153, loaded [symbolic = @impl.5.%.1 (constants.%.5)] +// CHECK:STDOUT: %import_ref.24: type = import_ref Implicit//default, inst+154, loaded [template = constants.%ImplicitAs.type.6] +// CHECK:STDOUT: %import_ref.25 = import_ref Implicit//default, inst+155, unloaded +// CHECK:STDOUT: %import_ref.26: type = import_ref Implicit//default, inst+180, loaded [symbolic = @impl.6.%.1 (constants.%.7)] +// CHECK:STDOUT: %import_ref.27: type = import_ref Implicit//default, inst+181, loaded [template = constants.%ImplicitAs.type.6] +// CHECK:STDOUT: %import_ref.28 = import_ref Implicit//default, inst+182, unloaded +// CHECK:STDOUT: %import_ref.29 = import_ref Implicit//default, inst+212, unloaded +// CHECK:STDOUT: %import_ref.30 = import_ref Implicit//default, inst+213, unloaded +// CHECK:STDOUT: %import_ref.31 = import_ref Implicit//default, inst+214, unloaded +// CHECK:STDOUT: %import_ref.32: type = import_ref Implicit//default, inst+216, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.33: type = import_ref Implicit//default, inst+217, loaded [template = constants.%As.type.3] +// CHECK:STDOUT: %import_ref.34 = import_ref Implicit//default, inst+218, unloaded +// CHECK:STDOUT: %import_ref.35 = import_ref Implicit//default, inst+233, unloaded +// CHECK:STDOUT: %import_ref.37: type = import_ref Implicit//default, inst+255, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.38: type = import_ref Implicit//default, inst+256, loaded [symbolic = @impl.8.%As.type (constants.%As.type.4)] +// CHECK:STDOUT: %import_ref.39 = import_ref Implicit//default, inst+257, unloaded +// CHECK:STDOUT: %import_ref.40: type = import_ref Implicit//default, inst+284, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.41: type = import_ref Implicit//default, inst+285, loaded [symbolic = @impl.9.%As.type (constants.%As.type.5)] +// CHECK:STDOUT: %import_ref.42 = import_ref Implicit//default, inst+286, unloaded +// CHECK:STDOUT: %import_ref.43: type = import_ref Implicit//default, inst+309, loaded [template = i32] +// CHECK:STDOUT: %import_ref.44: type = import_ref Implicit//default, inst+310, loaded [template = constants.%As.type.6] +// CHECK:STDOUT: %import_ref.45 = import_ref Implicit//default, inst+311, unloaded +// CHECK:STDOUT: %import_ref.47: type = import_ref Implicit//default, inst+322, loaded [symbolic = @impl.11.%.1 (constants.%.5)] +// CHECK:STDOUT: %import_ref.48: type = import_ref Implicit//default, inst+323, loaded [template = constants.%As.type.6] +// CHECK:STDOUT: %import_ref.49 = import_ref Implicit//default, inst+324, unloaded +// CHECK:STDOUT: %import_ref.50: type = import_ref Implicit//default, inst+349, loaded [symbolic = @impl.12.%.1 (constants.%.7)] +// CHECK:STDOUT: %import_ref.51: type = import_ref Implicit//default, inst+350, loaded [template = constants.%As.type.6] +// CHECK:STDOUT: %import_ref.52 = import_ref Implicit//default, inst+351, unloaded +// CHECK:STDOUT: %import_ref.53 = import_ref Implicit//default, inst+502, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -434,80 +1287,764 @@ var c_bad: C((3, 4)) = F(); // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%import_ref.3 [template = constants.%C.1] -// CHECK:STDOUT: %.loc12_15: i32 = int_value 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc12_18: i32 = int_value 2 [template = constants.%.4] -// CHECK:STDOUT: %.loc12_21: i32 = int_value 3 [template = constants.%.5] +// CHECK:STDOUT: %.loc12_15: Core.IntLiteral = int_value 1 [template = constants.%.25] +// CHECK:STDOUT: %.loc12_18: Core.IntLiteral = int_value 2 [template = constants.%.26] +// CHECK:STDOUT: %.loc12_21: Core.IntLiteral = int_value 3 [template = constants.%.27] // CHECK:STDOUT: %.loc12_22: %tuple.type.2 = tuple_literal (%.loc12_15, %.loc12_18, %.loc12_21) // CHECK:STDOUT: %c_bad.var: ref = var c_bad // CHECK:STDOUT: %c_bad: ref = bind_name c_bad, %c_bad.var // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @C(constants.%X: %tuple.type.1) { -// CHECK:STDOUT: %X: %tuple.type.1 = bind_symbolic_name X, 0 [symbolic = %X (constants.%X)] -// CHECK:STDOUT: %X.patt: %tuple.type.1 = symbolic_binding_pattern X, 0 [symbolic = %X.patt (constants.%X.patt)] +// CHECK:STDOUT: generic interface @ImplicitAs(constants.%Dest: type) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)] +// CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.1, @ImplicitAs(%Dest) [symbolic = %Convert.type (constants.%Convert.type.1)] +// CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.1) = struct_value () [symbolic = %Convert (constants.%Convert.1)] +// CHECK:STDOUT: %.1: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2), @ImplicitAs.%Convert.type (%Convert.type.1) [symbolic = %.1 (constants.%.1)] +// CHECK:STDOUT: %.2: @ImplicitAs.%.1 (%.1) = assoc_entity element0, imports.%import_ref.11 [symbolic = %.2 (constants.%.2)] // CHECK:STDOUT: -// CHECK:STDOUT: class { +// CHECK:STDOUT: interface { // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = imports.%import_ref.5 +// CHECK:STDOUT: .Convert = imports.%import_ref.6 +// CHECK:STDOUT: witness = (imports.%import_ref.7) // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F() -> %C.3; +// CHECK:STDOUT: generic interface @As(constants.%Dest: type) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)] // CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: %F.type = name_ref F, imports.%import_ref.4 [template = constants.%F] -// CHECK:STDOUT: %.loc12: ref %C.3 = temporary_storage -// CHECK:STDOUT: %F.call: init %C.3 = call %F.ref() to %.loc12 -// CHECK:STDOUT: assign file.%c_bad.var, -// CHECK:STDOUT: return +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest)> [symbolic = %As.type (constants.%As.type.2)] +// CHECK:STDOUT: %Self: %As.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.4)] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.6, @As(%Dest) [symbolic = %Convert.type (constants.%Convert.type.8)] +// CHECK:STDOUT: %Convert: @As.%Convert.type (%Convert.type.8) = struct_value () [symbolic = %Convert (constants.%Convert.8)] +// CHECK:STDOUT: %.1: type = assoc_entity_type @As.%As.type (%As.type.2), @As.%Convert.type (%Convert.type.8) [symbolic = %.1 (constants.%.13)] +// CHECK:STDOUT: %.2: @As.%.1 (%.13) = assoc_entity element0, imports.%import_ref.35 [symbolic = %.2 (constants.%.14)] +// CHECK:STDOUT: +// CHECK:STDOUT: interface { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%import_ref.29 +// CHECK:STDOUT: .Convert = imports.%import_ref.30 +// CHECK:STDOUT: witness = (imports.%import_ref.31) +// CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @C(constants.%X) { -// CHECK:STDOUT: %X => constants.%X -// CHECK:STDOUT: %X.patt => constants.%X +// CHECK:STDOUT: impl @impl.1: imports.%import_ref.8 as imports.%import_ref.9 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.10 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @C(constants.%tuple) { -// CHECK:STDOUT: %X => constants.%tuple -// CHECK:STDOUT: %X.patt => constants.%tuple +// CHECK:STDOUT: generic impl @impl.2(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%.1)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.4)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.2, @impl.2(%N) [symbolic = %Convert.type (constants.%Convert.type.3)] +// CHECK:STDOUT: %Convert: @impl.2.%Convert.type (%Convert.type.3) = struct_value () [symbolic = %Convert (constants.%Convert.3)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.6)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.13 as imports.%import_ref.14 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.15 +// CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: --- fail_bad_value.impl.carbon +// CHECK:STDOUT: generic impl @impl.3(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%.1)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.3, @impl.3(%N) [symbolic = %Convert.type (constants.%Convert.type.4)] +// CHECK:STDOUT: %Convert: @impl.3.%Convert.type (%Convert.type.4) = struct_value () [symbolic = %Convert (constants.%Convert.4)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.8)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.16 as imports.%import_ref.17 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.18 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.4: imports.%import_ref.19 as imports.%import_ref.20 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.21 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.5(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.4, @impl.5(%N) [symbolic = %Convert.type (constants.%Convert.type.6)] +// CHECK:STDOUT: %Convert: @impl.5.%Convert.type (%Convert.type.6) = struct_value () [symbolic = %Convert (constants.%Convert.6)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.11)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.23 as imports.%import_ref.24 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.25 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.6(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.5, @impl.6(%N) [symbolic = %Convert.type (constants.%Convert.type.7)] +// CHECK:STDOUT: %Convert: @impl.6.%Convert.type (%Convert.type.7) = struct_value () [symbolic = %Convert (constants.%Convert.7)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.12)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.26 as imports.%import_ref.27 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.28 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.7: imports.%import_ref.32 as imports.%import_ref.33 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.34 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.8(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%.1)> [symbolic = %As.type (constants.%As.type.4)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.7, @impl.8(%N) [symbolic = %Convert.type (constants.%Convert.type.10)] +// CHECK:STDOUT: %Convert: @impl.8.%Convert.type (%Convert.type.10) = struct_value () [symbolic = %Convert (constants.%Convert.10)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.17)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.37 as imports.%import_ref.38 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.39 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.9(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%.1)> [symbolic = %As.type (constants.%As.type.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.8, @impl.9(%N) [symbolic = %Convert.type (constants.%Convert.type.11)] +// CHECK:STDOUT: %Convert: @impl.9.%Convert.type (%Convert.type.11) = struct_value () [symbolic = %Convert (constants.%Convert.11)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.18)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.40 as imports.%import_ref.41 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.42 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.10: imports.%import_ref.43 as imports.%import_ref.44 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.45 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.11(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.9, @impl.11(%N) [symbolic = %Convert.type (constants.%Convert.type.13)] +// CHECK:STDOUT: %Convert: @impl.11.%Convert.type (%Convert.type.13) = struct_value () [symbolic = %Convert (constants.%Convert.13)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.21)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.47 as imports.%import_ref.48 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.49 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.12(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.10, @impl.12(%N) [symbolic = %Convert.type (constants.%Convert.type.14)] +// CHECK:STDOUT: %Convert: @impl.12.%Convert.type (%Convert.type.14) = struct_value () [symbolic = %Convert (constants.%Convert.14)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.22)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.50 as imports.%import_ref.51 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.52 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic class @C(constants.%X: %tuple.type.1) { +// CHECK:STDOUT: %X: %tuple.type.1 = bind_symbolic_name X, 0 [symbolic = %X (constants.%X)] +// CHECK:STDOUT: %X.patt: %tuple.type.1 = symbolic_binding_pattern X, 0 [symbolic = %X.patt (constants.%X.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: class { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%import_ref.53 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.1(constants.%Dest: type, constants.%Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2)) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)] +// CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.1.%Self (%Self.2)]() -> @Convert.1.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.2(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.2.%.1 (%.5) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.3(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.3.%.1 (%.7) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.4(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.4.%.1 (%.5)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.5(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.5.%.1 (%.7)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.6(constants.%Dest: type, constants.%Self.3: @As.%As.type (%As.type.2)) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest)> [symbolic = %As.type (constants.%As.type.2)] +// CHECK:STDOUT: %Self: %As.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.4)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.6.%Self (%Self.4)]() -> @Convert.6.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.7(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.7.%.1 (%.5) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.8(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.8.%.1 (%.7) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.9(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.9.%.1 (%.5)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.10(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.10.%.1 (%.7)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() -> %C.3; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @__global_init() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %F.ref: %F.type = name_ref F, imports.%import_ref.4 [template = constants.%F] +// CHECK:STDOUT: %.loc12: ref %C.3 = temporary_storage +// CHECK:STDOUT: %F.call: init %C.3 = call %F.ref() to %.loc12 +// CHECK:STDOUT: assign file.%c_bad.var, +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(i32) { +// CHECK:STDOUT: %Dest => i32 +// CHECK:STDOUT: %Dest.patt => i32 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3 +// CHECK:STDOUT: %Self => constants.%Self.2 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.2 +// CHECK:STDOUT: %Convert => constants.%Convert.2 +// CHECK:STDOUT: %.1 => constants.%.3 +// CHECK:STDOUT: %.2 => constants.%.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@Convert.1.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.1(constants.%Dest, constants.%Self.1) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.2 +// CHECK:STDOUT: %Self => constants.%Self.1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%.5) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@impl.2.%.1) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.2(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.2(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.2(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%.7) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@impl.3.%.1) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.3(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.3(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.3(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(Core.IntLiteral) { +// CHECK:STDOUT: %Dest => Core.IntLiteral +// CHECK:STDOUT: %Dest.patt => Core.IntLiteral +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.6 +// CHECK:STDOUT: %Self => constants.%Self.2 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.5 +// CHECK:STDOUT: %Convert => constants.%Convert.5 +// CHECK:STDOUT: %.1 => constants.%.9 +// CHECK:STDOUT: %.2 => constants.%.10 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.5(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.5(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.4(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.6(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.6(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.5(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(i32) { +// CHECK:STDOUT: %Dest => i32 +// CHECK:STDOUT: %Dest.patt => i32 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type => constants.%As.type.3 +// CHECK:STDOUT: %Self => constants.%Self.4 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.9 +// CHECK:STDOUT: %Convert => constants.%Convert.9 +// CHECK:STDOUT: %.1 => constants.%.15 +// CHECK:STDOUT: %.2 => constants.%.16 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(@Convert.6.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.6(constants.%Dest, constants.%Self.3) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %As.type => constants.%As.type.2 +// CHECK:STDOUT: %Self => constants.%Self.3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%.5) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(@impl.8.%.1) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.8(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %As.type => constants.%As.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.8(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %As.type => constants.%As.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.7(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%.7) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(@impl.9.%.1) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.9(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %As.type => constants.%As.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.9(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %As.type => constants.%As.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.8(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(Core.IntLiteral) { +// CHECK:STDOUT: %Dest => Core.IntLiteral +// CHECK:STDOUT: %Dest.patt => Core.IntLiteral +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type => constants.%As.type.6 +// CHECK:STDOUT: %Self => constants.%Self.4 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.12 +// CHECK:STDOUT: %Convert => constants.%Convert.12 +// CHECK:STDOUT: %.1 => constants.%.19 +// CHECK:STDOUT: %.2 => constants.%.20 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.11(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.11(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.9(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.12(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.12(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.10(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @C(constants.%X) { +// CHECK:STDOUT: %X => constants.%X +// CHECK:STDOUT: %X.patt => constants.%X +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @C(constants.%tuple) { +// CHECK:STDOUT: %X => constants.%tuple +// CHECK:STDOUT: %X.patt => constants.%tuple +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- fail_bad_value.impl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.2: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic] +// CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2) = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.3: type = facet_type <@ImplicitAs, @ImplicitAs(i32)> [template] +// CHECK:STDOUT: %Self.2: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Convert.type.1: type = fn_type @Convert.1, @ImplicitAs(%Dest) [symbolic] +// CHECK:STDOUT: %Convert.1: %Convert.type.1 = struct_value () [symbolic] +// CHECK:STDOUT: %.1: type = assoc_entity_type %ImplicitAs.type.2, %Convert.type.1 [symbolic] +// CHECK:STDOUT: %.2: %.1 = assoc_entity element0, imports.%import_ref.11 [symbolic] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(i32) [template] +// CHECK:STDOUT: %Convert.2: %Convert.type.2 = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type %ImplicitAs.type.3, %Convert.type.2 [template] +// CHECK:STDOUT: %.4: %.3 = assoc_entity element0, imports.%import_ref.12 [template] +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic] +// CHECK:STDOUT: %.5: type = int_type signed, %N [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.4: type = facet_type <@ImplicitAs, @ImplicitAs(%.5)> [symbolic] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.3: type = fn_type @Convert.2, @impl.2(%N) [symbolic] +// CHECK:STDOUT: %Convert.3: %Convert.type.3 = struct_value () [symbolic] +// CHECK:STDOUT: %.6: = interface_witness (%Convert.3) [symbolic] +// CHECK:STDOUT: %.7: type = int_type unsigned, %N [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.5: type = facet_type <@ImplicitAs, @ImplicitAs(%.7)> [symbolic] +// CHECK:STDOUT: %Convert.type.4: type = fn_type @Convert.3, @impl.3(%N) [symbolic] +// CHECK:STDOUT: %Convert.4: %Convert.type.4 = struct_value () [symbolic] +// CHECK:STDOUT: %.8: = interface_witness (%Convert.4) [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.6: type = facet_type <@ImplicitAs, @ImplicitAs(Core.IntLiteral)> [template] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %Convert.5: %Convert.type.5 = struct_value () [template] +// CHECK:STDOUT: %.9: type = assoc_entity_type %ImplicitAs.type.6, %Convert.type.5 [template] +// CHECK:STDOUT: %.10: %.9 = assoc_entity element0, imports.%import_ref.22 [template] +// CHECK:STDOUT: %Convert.type.6: type = fn_type @Convert.4, @impl.5(%N) [symbolic] +// CHECK:STDOUT: %Convert.6: %Convert.type.6 = struct_value () [symbolic] +// CHECK:STDOUT: %.11: = interface_witness (%Convert.6) [symbolic] +// CHECK:STDOUT: %Convert.type.7: type = fn_type @Convert.5, @impl.6(%N) [symbolic] +// CHECK:STDOUT: %Convert.7: %Convert.type.7 = struct_value () [symbolic] +// CHECK:STDOUT: %.12: = interface_witness (%Convert.7) [symbolic] +// CHECK:STDOUT: %As.type.2: type = facet_type <@As, @As(%Dest)> [symbolic] +// CHECK:STDOUT: %Self.3: @As.%As.type (%As.type.2) = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %As.type.3: type = facet_type <@As, @As(i32)> [template] +// CHECK:STDOUT: %Self.4: %As.type.2 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Convert.type.8: type = fn_type @Convert.6, @As(%Dest) [symbolic] +// CHECK:STDOUT: %Convert.8: %Convert.type.8 = struct_value () [symbolic] +// CHECK:STDOUT: %.13: type = assoc_entity_type %As.type.2, %Convert.type.8 [symbolic] +// CHECK:STDOUT: %.14: %.13 = assoc_entity element0, imports.%import_ref.35 [symbolic] +// CHECK:STDOUT: %Convert.type.9: type = fn_type @Convert.6, @As(i32) [template] +// CHECK:STDOUT: %Convert.9: %Convert.type.9 = struct_value () [template] +// CHECK:STDOUT: %.15: type = assoc_entity_type %As.type.3, %Convert.type.9 [template] +// CHECK:STDOUT: %.16: %.15 = assoc_entity element0, imports.%import_ref.36 [template] +// CHECK:STDOUT: %As.type.4: type = facet_type <@As, @As(%.5)> [symbolic] +// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.7, @impl.8(%N) [symbolic] +// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [symbolic] +// CHECK:STDOUT: %.17: = interface_witness (%Convert.10) [symbolic] +// CHECK:STDOUT: %As.type.5: type = facet_type <@As, @As(%.7)> [symbolic] +// CHECK:STDOUT: %Convert.type.11: type = fn_type @Convert.8, @impl.9(%N) [symbolic] +// CHECK:STDOUT: %Convert.11: %Convert.type.11 = struct_value () [symbolic] +// CHECK:STDOUT: %.18: = interface_witness (%Convert.11) [symbolic] +// CHECK:STDOUT: %As.type.6: type = facet_type <@As, @As(Core.IntLiteral)> [template] +// CHECK:STDOUT: %Convert.type.12: type = fn_type @Convert.6, @As(Core.IntLiteral) [template] +// CHECK:STDOUT: %Convert.12: %Convert.type.12 = struct_value () [template] +// CHECK:STDOUT: %.19: type = assoc_entity_type %As.type.6, %Convert.type.12 [template] +// CHECK:STDOUT: %.20: %.19 = assoc_entity element0, imports.%import_ref.46 [template] +// CHECK:STDOUT: %Convert.type.13: type = fn_type @Convert.9, @impl.11(%N) [symbolic] +// CHECK:STDOUT: %Convert.13: %Convert.type.13 = struct_value () [symbolic] +// CHECK:STDOUT: %.21: = interface_witness (%Convert.13) [symbolic] +// CHECK:STDOUT: %Convert.type.14: type = fn_type @Convert.10, @impl.12(%N) [symbolic] +// CHECK:STDOUT: %Convert.14: %Convert.type.14 = struct_value () [symbolic] +// CHECK:STDOUT: %.22: = interface_witness (%Convert.14) [symbolic] // CHECK:STDOUT: %C.type: type = generic_class_type @C [template] // CHECK:STDOUT: %C.1: %C.type = struct_value () [template] -// CHECK:STDOUT: %tuple.type: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %X: %tuple.type = bind_symbolic_name X, 0 [symbolic] -// CHECK:STDOUT: %X.patt: %tuple.type = symbolic_binding_pattern X, 0 [symbolic] -// CHECK:STDOUT: %.3: i32 = int_value 3 [template] -// CHECK:STDOUT: %.4: i32 = int_value 4 [template] -// CHECK:STDOUT: %tuple.1: %tuple.type = tuple_value (%.3, %.4) [template] +// CHECK:STDOUT: %tuple.type.1: type = tuple_type (i32, i32) [template] +// CHECK:STDOUT: %X: %tuple.type.1 = bind_symbolic_name X, 0 [symbolic] +// CHECK:STDOUT: %X.patt: %tuple.type.1 = symbolic_binding_pattern X, 0 [symbolic] +// CHECK:STDOUT: %.25: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %.26: Core.IntLiteral = int_value 4 [template] +// CHECK:STDOUT: %tuple.type.2: type = tuple_type (Core.IntLiteral, Core.IntLiteral) [template] +// CHECK:STDOUT: %.28: %.1 = assoc_entity element0, imports.%import_ref.55 [symbolic] +// CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template] +// CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template] +// CHECK:STDOUT: %.29: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.30: = bound_method %.25, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 3 [template] +// CHECK:STDOUT: %.32: = bound_method %.26, %Convert.15 [template] +// CHECK:STDOUT: %.33: i32 = int_value 4 [template] +// CHECK:STDOUT: %tuple.1: %tuple.type.1 = tuple_value (%.31, %.33) [template] // CHECK:STDOUT: %C.3: type = class_type @C, @C(%tuple.1) [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %.7: i32 = int_value 2 [template] -// CHECK:STDOUT: %.8: i32 = int_value 1 [template] -// CHECK:STDOUT: %tuple.2: %tuple.type = tuple_value (%.8, %.7) [template] +// CHECK:STDOUT: %.35: i32 = int_value 2 [template] +// CHECK:STDOUT: %.36: i32 = int_value 1 [template] +// CHECK:STDOUT: %tuple.2: %tuple.type.1 = tuple_value (%.36, %.35) [template] // CHECK:STDOUT: %C.4: type = class_type @C, @C(%tuple.2) [template] +// CHECK:STDOUT: %ImplicitAs.type.7: type = facet_type <@ImplicitAs, @ImplicitAs(%C.3)> [template] +// CHECK:STDOUT: %Convert.type.16: type = fn_type @Convert.1, @ImplicitAs(%C.3) [template] +// CHECK:STDOUT: %Convert.16: %Convert.type.16 = struct_value () [template] +// CHECK:STDOUT: %.37: type = assoc_entity_type %ImplicitAs.type.7, %Convert.type.16 [template] +// CHECK:STDOUT: %.38: %.37 = assoc_entity element0, imports.%import_ref.11 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %import_ref.1 = import_ref Implicit//default, inst+19, unloaded -// CHECK:STDOUT: %import_ref.2 = import_ref Implicit//default, inst+59, unloaded -// CHECK:STDOUT: %import_ref.3: %C.type = import_ref Implicit//default, inst+108, loaded [template = constants.%C.1] -// CHECK:STDOUT: %import_ref.4: %F.type = import_ref Implicit//default, inst+130, loaded [template = constants.%F] +// CHECK:STDOUT: %import_ref.2 = import_ref Implicit//default, inst+423, unloaded +// CHECK:STDOUT: %import_ref.3: %C.type = import_ref Implicit//default, inst+497, loaded [template = constants.%C.1] +// CHECK:STDOUT: %import_ref.4: %F.type = import_ref Implicit//default, inst+529, loaded [template = constants.%F] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .ImplicitAs = %import_ref.6 +// CHECK:STDOUT: .ImplicitAs = %import_ref.54 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.5 = import_ref Implicit//default, inst+113, unloaded +// CHECK:STDOUT: %import_ref.5 = import_ref Implicit//default, inst+37, unloaded +// CHECK:STDOUT: %import_ref.6: @ImplicitAs.%.1 (%.1) = import_ref Implicit//default, inst+38, loaded [symbolic = @ImplicitAs.%.2 (constants.%.28)] +// CHECK:STDOUT: %import_ref.7 = import_ref Implicit//default, inst+39, unloaded +// CHECK:STDOUT: %import_ref.8: type = import_ref Implicit//default, inst+73, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.9: type = import_ref Implicit//default, inst+74, loaded [template = constants.%ImplicitAs.type.3] +// CHECK:STDOUT: %import_ref.10: = import_ref Implicit//default, inst+75, loaded [template = constants.%.29] +// CHECK:STDOUT: %import_ref.11 = import_ref Implicit//default, inst+54, unloaded +// CHECK:STDOUT: %import_ref.13: type = import_ref Implicit//default, inst+85, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.14: type = import_ref Implicit//default, inst+86, loaded [symbolic = @impl.2.%ImplicitAs.type (constants.%ImplicitAs.type.4)] +// CHECK:STDOUT: %import_ref.15 = import_ref Implicit//default, inst+87, unloaded +// CHECK:STDOUT: %import_ref.16: type = import_ref Implicit//default, inst+115, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.17: type = import_ref Implicit//default, inst+116, loaded [symbolic = @impl.3.%ImplicitAs.type (constants.%ImplicitAs.type.5)] +// CHECK:STDOUT: %import_ref.18 = import_ref Implicit//default, inst+117, unloaded +// CHECK:STDOUT: %import_ref.19: type = import_ref Implicit//default, inst+140, loaded [template = i32] +// CHECK:STDOUT: %import_ref.20: type = import_ref Implicit//default, inst+141, loaded [template = constants.%ImplicitAs.type.6] +// CHECK:STDOUT: %import_ref.21 = import_ref Implicit//default, inst+142, unloaded +// CHECK:STDOUT: %import_ref.23: type = import_ref Implicit//default, inst+153, loaded [symbolic = @impl.5.%.1 (constants.%.5)] +// CHECK:STDOUT: %import_ref.24: type = import_ref Implicit//default, inst+154, loaded [template = constants.%ImplicitAs.type.6] +// CHECK:STDOUT: %import_ref.25 = import_ref Implicit//default, inst+155, unloaded +// CHECK:STDOUT: %import_ref.26: type = import_ref Implicit//default, inst+180, loaded [symbolic = @impl.6.%.1 (constants.%.7)] +// CHECK:STDOUT: %import_ref.27: type = import_ref Implicit//default, inst+181, loaded [template = constants.%ImplicitAs.type.6] +// CHECK:STDOUT: %import_ref.28 = import_ref Implicit//default, inst+182, unloaded +// CHECK:STDOUT: %import_ref.29 = import_ref Implicit//default, inst+212, unloaded +// CHECK:STDOUT: %import_ref.30 = import_ref Implicit//default, inst+213, unloaded +// CHECK:STDOUT: %import_ref.31 = import_ref Implicit//default, inst+214, unloaded +// CHECK:STDOUT: %import_ref.32: type = import_ref Implicit//default, inst+216, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.33: type = import_ref Implicit//default, inst+217, loaded [template = constants.%As.type.3] +// CHECK:STDOUT: %import_ref.34 = import_ref Implicit//default, inst+218, unloaded +// CHECK:STDOUT: %import_ref.35 = import_ref Implicit//default, inst+233, unloaded +// CHECK:STDOUT: %import_ref.37: type = import_ref Implicit//default, inst+255, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.38: type = import_ref Implicit//default, inst+256, loaded [symbolic = @impl.8.%As.type (constants.%As.type.4)] +// CHECK:STDOUT: %import_ref.39 = import_ref Implicit//default, inst+257, unloaded +// CHECK:STDOUT: %import_ref.40: type = import_ref Implicit//default, inst+284, loaded [template = Core.IntLiteral] +// CHECK:STDOUT: %import_ref.41: type = import_ref Implicit//default, inst+285, loaded [symbolic = @impl.9.%As.type (constants.%As.type.5)] +// CHECK:STDOUT: %import_ref.42 = import_ref Implicit//default, inst+286, unloaded +// CHECK:STDOUT: %import_ref.43: type = import_ref Implicit//default, inst+309, loaded [template = i32] +// CHECK:STDOUT: %import_ref.44: type = import_ref Implicit//default, inst+310, loaded [template = constants.%As.type.6] +// CHECK:STDOUT: %import_ref.45 = import_ref Implicit//default, inst+311, unloaded +// CHECK:STDOUT: %import_ref.47: type = import_ref Implicit//default, inst+322, loaded [symbolic = @impl.11.%.1 (constants.%.5)] +// CHECK:STDOUT: %import_ref.48: type = import_ref Implicit//default, inst+323, loaded [template = constants.%As.type.6] +// CHECK:STDOUT: %import_ref.49 = import_ref Implicit//default, inst+324, unloaded +// CHECK:STDOUT: %import_ref.50: type = import_ref Implicit//default, inst+349, loaded [symbolic = @impl.12.%.1 (constants.%.7)] +// CHECK:STDOUT: %import_ref.51: type = import_ref Implicit//default, inst+350, loaded [template = constants.%As.type.6] +// CHECK:STDOUT: %import_ref.52 = import_ref Implicit//default, inst+351, unloaded +// CHECK:STDOUT: %import_ref.53 = import_ref Implicit//default, inst+502, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -523,28 +2060,320 @@ var c_bad: C((3, 4)) = F(); // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%import_ref.3 [template = constants.%C.1] -// CHECK:STDOUT: %.loc10_15: i32 = int_value 3 [template = constants.%.3] -// CHECK:STDOUT: %.loc10_18: i32 = int_value 4 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_19: %tuple.type = tuple_literal (%.loc10_15, %.loc10_18) -// CHECK:STDOUT: %tuple: %tuple.type = tuple_value (%.loc10_15, %.loc10_18) [template = constants.%tuple.1] -// CHECK:STDOUT: %.loc10_13: %tuple.type = converted %.loc10_19, %tuple [template = constants.%tuple.1] +// CHECK:STDOUT: %.loc10_15: Core.IntLiteral = int_value 3 [template = constants.%.25] +// CHECK:STDOUT: %.loc10_18: Core.IntLiteral = int_value 4 [template = constants.%.26] +// CHECK:STDOUT: %.loc10_19.1: %tuple.type.2 = tuple_literal (%.loc10_15, %.loc10_18) +// CHECK:STDOUT: %.loc10_19.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc10_19.3: = bound_method %.loc10_15, %.loc10_19.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc10_19.1: init i32 = call %.loc10_19.3(%.loc10_15) [template = constants.%.31] +// CHECK:STDOUT: %.loc10_19.4: i32 = value_of_initializer %int.convert_checked.loc10_19.1 [template = constants.%.31] +// CHECK:STDOUT: %.loc10_19.5: i32 = converted %.loc10_15, %.loc10_19.4 [template = constants.%.31] +// CHECK:STDOUT: %.loc10_19.6: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc10_19.7: = bound_method %.loc10_18, %.loc10_19.6 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc10_19.2: init i32 = call %.loc10_19.7(%.loc10_18) [template = constants.%.33] +// CHECK:STDOUT: %.loc10_19.8: i32 = value_of_initializer %int.convert_checked.loc10_19.2 [template = constants.%.33] +// CHECK:STDOUT: %.loc10_19.9: i32 = converted %.loc10_18, %.loc10_19.8 [template = constants.%.33] +// CHECK:STDOUT: %tuple: %tuple.type.1 = tuple_value (%.loc10_19.5, %.loc10_19.9) [template = constants.%tuple.1] +// CHECK:STDOUT: %.loc10_13: %tuple.type.1 = converted %.loc10_19.1, %tuple [template = constants.%tuple.1] // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%tuple.1) [template = constants.%C.3] // CHECK:STDOUT: %c_bad.var: ref %C.3 = var c_bad // CHECK:STDOUT: %c_bad: ref %C.3 = bind_name c_bad, %c_bad.var // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @C(constants.%X: %tuple.type) { -// CHECK:STDOUT: %X: %tuple.type = bind_symbolic_name X, 0 [symbolic = %X (constants.%X)] -// CHECK:STDOUT: %X.patt: %tuple.type = symbolic_binding_pattern X, 0 [symbolic = %X.patt (constants.%X.patt)] +// CHECK:STDOUT: generic interface @ImplicitAs(constants.%Dest: type) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)] +// CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.1, @ImplicitAs(%Dest) [symbolic = %Convert.type (constants.%Convert.type.1)] +// CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.1) = struct_value () [symbolic = %Convert (constants.%Convert.1)] +// CHECK:STDOUT: %.1: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2), @ImplicitAs.%Convert.type (%Convert.type.1) [symbolic = %.1 (constants.%.1)] +// CHECK:STDOUT: %.2: @ImplicitAs.%.1 (%.1) = assoc_entity element0, imports.%import_ref.11 [symbolic = %.2 (constants.%.2)] // CHECK:STDOUT: -// CHECK:STDOUT: class { +// CHECK:STDOUT: interface { // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = imports.%import_ref.5 +// CHECK:STDOUT: .Convert = imports.%import_ref.6 +// CHECK:STDOUT: witness = (imports.%import_ref.7) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @As(constants.%Dest: type) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest)> [symbolic = %As.type (constants.%As.type.2)] +// CHECK:STDOUT: %Self: %As.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.4)] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.6, @As(%Dest) [symbolic = %Convert.type (constants.%Convert.type.8)] +// CHECK:STDOUT: %Convert: @As.%Convert.type (%Convert.type.8) = struct_value () [symbolic = %Convert (constants.%Convert.8)] +// CHECK:STDOUT: %.1: type = assoc_entity_type @As.%As.type (%As.type.2), @As.%Convert.type (%Convert.type.8) [symbolic = %.1 (constants.%.13)] +// CHECK:STDOUT: %.2: @As.%.1 (%.13) = assoc_entity element0, imports.%import_ref.35 [symbolic = %.2 (constants.%.14)] +// CHECK:STDOUT: +// CHECK:STDOUT: interface { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%import_ref.29 +// CHECK:STDOUT: .Convert = imports.%import_ref.30 +// CHECK:STDOUT: witness = (imports.%import_ref.31) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.1: imports.%import_ref.8 as imports.%import_ref.9 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.10 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.2(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%.1)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.4)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.2, @impl.2(%N) [symbolic = %Convert.type (constants.%Convert.type.3)] +// CHECK:STDOUT: %Convert: @impl.2.%Convert.type (%Convert.type.3) = struct_value () [symbolic = %Convert (constants.%Convert.3)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.6)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.13 as imports.%import_ref.14 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.15 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.3(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%.1)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.3, @impl.3(%N) [symbolic = %Convert.type (constants.%Convert.type.4)] +// CHECK:STDOUT: %Convert: @impl.3.%Convert.type (%Convert.type.4) = struct_value () [symbolic = %Convert (constants.%Convert.4)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.8)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.16 as imports.%import_ref.17 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.18 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.4: imports.%import_ref.19 as imports.%import_ref.20 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.21 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.5(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.4, @impl.5(%N) [symbolic = %Convert.type (constants.%Convert.type.6)] +// CHECK:STDOUT: %Convert: @impl.5.%Convert.type (%Convert.type.6) = struct_value () [symbolic = %Convert (constants.%Convert.6)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.11)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.23 as imports.%import_ref.24 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.25 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.6(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.5, @impl.6(%N) [symbolic = %Convert.type (constants.%Convert.type.7)] +// CHECK:STDOUT: %Convert: @impl.6.%Convert.type (%Convert.type.7) = struct_value () [symbolic = %Convert (constants.%Convert.7)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.12)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.26 as imports.%import_ref.27 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.28 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.7: imports.%import_ref.32 as imports.%import_ref.33 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.34 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.8(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%.1)> [symbolic = %As.type (constants.%As.type.4)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.7, @impl.8(%N) [symbolic = %Convert.type (constants.%Convert.type.10)] +// CHECK:STDOUT: %Convert: @impl.8.%Convert.type (%Convert.type.10) = struct_value () [symbolic = %Convert (constants.%Convert.10)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.17)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.37 as imports.%import_ref.38 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.39 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.9(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%.1)> [symbolic = %As.type (constants.%As.type.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.8, @impl.9(%N) [symbolic = %Convert.type (constants.%Convert.type.11)] +// CHECK:STDOUT: %Convert: @impl.9.%Convert.type (%Convert.type.11) = struct_value () [symbolic = %Convert (constants.%Convert.11)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.18)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.40 as imports.%import_ref.41 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.42 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.10: imports.%import_ref.43 as imports.%import_ref.44 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.45 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.11(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.9, @impl.11(%N) [symbolic = %Convert.type (constants.%Convert.type.13)] +// CHECK:STDOUT: %Convert: @impl.11.%Convert.type (%Convert.type.13) = struct_value () [symbolic = %Convert (constants.%Convert.13)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.21)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.47 as imports.%import_ref.48 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.49 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.12(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.10, @impl.12(%N) [symbolic = %Convert.type (constants.%Convert.type.14)] +// CHECK:STDOUT: %Convert: @impl.12.%Convert.type (%Convert.type.14) = struct_value () [symbolic = %Convert (constants.%Convert.14)] +// CHECK:STDOUT: %.2: = interface_witness (%Convert) [symbolic = %.2 (constants.%.22)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.50 as imports.%import_ref.51 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%import_ref.52 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic class @C(constants.%X: %tuple.type.1) { +// CHECK:STDOUT: %X: %tuple.type.1 = bind_symbolic_name X, 0 [symbolic = %X (constants.%X)] +// CHECK:STDOUT: %X.patt: %tuple.type.1 = symbolic_binding_pattern X, 0 [symbolic = %X.patt (constants.%X.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: class { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%import_ref.53 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.1(constants.%Dest: type, constants.%Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2)) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)] +// CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.1.%Self (%Self.2)]() -> @Convert.1.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.2(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.2.%.1 (%.5) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.3(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.3.%.1 (%.7) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.4(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.4.%.1 (%.5)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.5(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.5.%.1 (%.7)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.6(constants.%Dest: type, constants.%Self.3: @As.%As.type (%As.type.2)) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest)> [symbolic = %As.type (constants.%As.type.2)] +// CHECK:STDOUT: %Self: %As.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.4)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.6.%Self (%Self.4)]() -> @Convert.6.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.7(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.7.%.1 (%.5) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.8(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: Core.IntLiteral]() -> @Convert.8.%.1 (%.7) = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.9(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type signed, %N [symbolic = %.1 (constants.%.5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.9.%.1 (%.5)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.10(constants.%N: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %.1: type = int_type unsigned, %N [symbolic = %.1 (constants.%.7)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.10.%.1 (%.7)]() -> Core.IntLiteral = "int.convert_checked"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Convert.11[%self.param_patt: Core.IntLiteral]() -> i32 = "int.convert_checked"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> %C.4; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { @@ -557,6 +2386,284 @@ var c_bad: C((3, 4)) = F(); // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(i32) { +// CHECK:STDOUT: %Dest => i32 +// CHECK:STDOUT: %Dest.patt => i32 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3 +// CHECK:STDOUT: %Self => constants.%Self.2 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.2 +// CHECK:STDOUT: %Convert => constants.%Convert.2 +// CHECK:STDOUT: %.1 => constants.%.3 +// CHECK:STDOUT: %.2 => constants.%.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@Convert.1.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.1(constants.%Dest, constants.%Self.1) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.2 +// CHECK:STDOUT: %Self => constants.%Self.1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%.5) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@impl.2.%.1) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.2(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.2(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.2(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%.7) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@impl.3.%.1) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.3(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.3(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.3(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(Core.IntLiteral) { +// CHECK:STDOUT: %Dest => Core.IntLiteral +// CHECK:STDOUT: %Dest.patt => Core.IntLiteral +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.6 +// CHECK:STDOUT: %Self => constants.%Self.2 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.5 +// CHECK:STDOUT: %Convert => constants.%Convert.5 +// CHECK:STDOUT: %.1 => constants.%.9 +// CHECK:STDOUT: %.2 => constants.%.10 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.5(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.5(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.4(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.6(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.6(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.5(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(i32) { +// CHECK:STDOUT: %Dest => i32 +// CHECK:STDOUT: %Dest.patt => i32 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type => constants.%As.type.3 +// CHECK:STDOUT: %Self => constants.%Self.4 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.9 +// CHECK:STDOUT: %Convert => constants.%Convert.9 +// CHECK:STDOUT: %.1 => constants.%.15 +// CHECK:STDOUT: %.2 => constants.%.16 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(@Convert.6.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.6(constants.%Dest, constants.%Self.3) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %As.type => constants.%As.type.2 +// CHECK:STDOUT: %Self => constants.%Self.3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%.5) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(@impl.8.%.1) { +// CHECK:STDOUT: %Dest => constants.%.5 +// CHECK:STDOUT: %Dest.patt => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.8(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %As.type => constants.%As.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.8(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: %As.type => constants.%As.type.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.7(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%.7) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(@impl.9.%.1) { +// CHECK:STDOUT: %Dest => constants.%.7 +// CHECK:STDOUT: %Dest.patt => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.9(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %As.type => constants.%As.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.9(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: %As.type => constants.%As.type.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.8(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(Core.IntLiteral) { +// CHECK:STDOUT: %Dest => Core.IntLiteral +// CHECK:STDOUT: %Dest.patt => Core.IntLiteral +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type => constants.%As.type.6 +// CHECK:STDOUT: %Self => constants.%Self.4 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.12 +// CHECK:STDOUT: %Convert => constants.%Convert.12 +// CHECK:STDOUT: %.1 => constants.%.19 +// CHECK:STDOUT: %.2 => constants.%.20 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.11(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.11(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.9(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.12(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.12(%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %N.patt => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.10(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %.1 => constants.%.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: specific @C(constants.%X) { // CHECK:STDOUT: %X => constants.%X // CHECK:STDOUT: %X.patt => constants.%X @@ -576,3 +2683,16 @@ var c_bad: C((3, 4)) = F(); // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%C.3) { +// CHECK:STDOUT: %Dest => constants.%C.3 +// CHECK:STDOUT: %Dest.patt => constants.%C.3 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.7 +// CHECK:STDOUT: %Self => constants.%Self.2 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.16 +// CHECK:STDOUT: %Convert => constants.%Convert.16 +// CHECK:STDOUT: %.1 => constants.%.37 +// CHECK:STDOUT: %.2 => constants.%.38 +// CHECK:STDOUT: } +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/tuple/nested_tuple.carbon b/toolchain/check/testdata/tuple/nested_tuple.carbon index 253a92b31e18a..047650c191475 100644 --- a/toolchain/check/testdata/tuple/nested_tuple.carbon +++ b/toolchain/check/testdata/tuple/nested_tuple.carbon @@ -19,16 +19,29 @@ var x: ((i32, i32), i32) = ((12, 76), 6); // CHECK:STDOUT: %tuple.type.2: type = tuple_type (%tuple.type.1, type) [template] // CHECK:STDOUT: %tuple.type.3: type = tuple_type (i32, i32) [template] // CHECK:STDOUT: %tuple.type.4: type = tuple_type (%tuple.type.3, i32) [template] -// CHECK:STDOUT: %.3: i32 = int_value 12 [template] -// CHECK:STDOUT: %.4: i32 = int_value 76 [template] -// CHECK:STDOUT: %.5: i32 = int_value 6 [template] -// CHECK:STDOUT: %tuple.1: %tuple.type.3 = tuple_value (%.3, %.4) [template] -// CHECK:STDOUT: %tuple.2: %tuple.type.4 = tuple_value (%tuple.1, %.5) [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 12 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 76 [template] +// CHECK:STDOUT: %tuple.type.6: type = tuple_type (Core.IntLiteral, Core.IntLiteral) [template] +// CHECK:STDOUT: %.5: Core.IntLiteral = int_value 6 [template] +// CHECK:STDOUT: %tuple.type.7: type = tuple_type (%tuple.type.6, Core.IntLiteral) [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: %.29: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.30: = bound_method %.3, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 12 [template] +// CHECK:STDOUT: %.32: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.33: i32 = int_value 76 [template] +// CHECK:STDOUT: %tuple.1: %tuple.type.3 = tuple_value (%.31, %.33) [template] +// CHECK:STDOUT: %.34: = bound_method %.5, %Convert.15 [template] +// CHECK:STDOUT: %.35: i32 = int_value 6 [template] +// CHECK:STDOUT: %tuple.2: %tuple.type.4 = tuple_value (%tuple.1, %.35) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -59,22 +72,34 @@ var x: ((i32, i32), i32) = ((12, 76), 6); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_30: i32 = int_value 12 [template = constants.%.3] -// CHECK:STDOUT: %.loc11_34: i32 = int_value 76 [template = constants.%.4] -// CHECK:STDOUT: %.loc11_36.1: %tuple.type.3 = tuple_literal (%.loc11_30, %.loc11_34) -// CHECK:STDOUT: %.loc11_39: i32 = int_value 6 [template = constants.%.5] -// CHECK:STDOUT: %.loc11_40.1: %tuple.type.4 = tuple_literal (%.loc11_36.1, %.loc11_39) +// CHECK:STDOUT: %.loc11_30: Core.IntLiteral = int_value 12 [template = constants.%.3] +// CHECK:STDOUT: %.loc11_34: Core.IntLiteral = int_value 76 [template = constants.%.4] +// CHECK:STDOUT: %.loc11_36.1: %tuple.type.6 = tuple_literal (%.loc11_30, %.loc11_34) +// CHECK:STDOUT: %.loc11_39: Core.IntLiteral = int_value 6 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_40.1: %tuple.type.7 = tuple_literal (%.loc11_36.1, %.loc11_39) +// CHECK:STDOUT: %.loc11_36.2: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_36.3: = bound_method %.loc11_30, %.loc11_36.2 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc11_36.1: init i32 = call %.loc11_36.3(%.loc11_30) [template = constants.%.31] +// CHECK:STDOUT: %.loc11_36.4: init i32 = converted %.loc11_30, %int.convert_checked.loc11_36.1 [template = constants.%.31] // CHECK:STDOUT: %.loc11_40.2: ref %tuple.type.3 = tuple_access file.%x.var, element0 -// CHECK:STDOUT: %.loc11_36.2: ref i32 = tuple_access %.loc11_40.2, element0 -// CHECK:STDOUT: %.loc11_36.3: init i32 = initialize_from %.loc11_30 to %.loc11_36.2 [template = constants.%.3] -// CHECK:STDOUT: %.loc11_36.4: ref i32 = tuple_access %.loc11_40.2, element1 -// CHECK:STDOUT: %.loc11_36.5: init i32 = initialize_from %.loc11_34 to %.loc11_36.4 [template = constants.%.4] -// CHECK:STDOUT: %.loc11_36.6: init %tuple.type.3 = tuple_init (%.loc11_36.3, %.loc11_36.5) to %.loc11_40.2 [template = constants.%tuple.1] -// CHECK:STDOUT: %.loc11_40.3: init %tuple.type.3 = converted %.loc11_36.1, %.loc11_36.6 [template = constants.%tuple.1] -// CHECK:STDOUT: %.loc11_40.4: ref i32 = tuple_access file.%x.var, element1 -// CHECK:STDOUT: %.loc11_40.5: init i32 = initialize_from %.loc11_39 to %.loc11_40.4 [template = constants.%.5] -// CHECK:STDOUT: %.loc11_40.6: init %tuple.type.4 = tuple_init (%.loc11_40.3, %.loc11_40.5) to file.%x.var [template = constants.%tuple.2] -// CHECK:STDOUT: %.loc11_41: init %tuple.type.4 = converted %.loc11_40.1, %.loc11_40.6 [template = constants.%tuple.2] +// CHECK:STDOUT: %.loc11_36.5: ref i32 = tuple_access %.loc11_40.2, element0 +// CHECK:STDOUT: %.loc11_36.6: init i32 = initialize_from %.loc11_36.4 to %.loc11_36.5 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_36.7: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_36.8: = bound_method %.loc11_34, %.loc11_36.7 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc11_36.2: init i32 = call %.loc11_36.8(%.loc11_34) [template = constants.%.33] +// CHECK:STDOUT: %.loc11_36.9: init i32 = converted %.loc11_34, %int.convert_checked.loc11_36.2 [template = constants.%.33] +// CHECK:STDOUT: %.loc11_36.10: ref i32 = tuple_access %.loc11_40.2, element1 +// CHECK:STDOUT: %.loc11_36.11: init i32 = initialize_from %.loc11_36.9 to %.loc11_36.10 [template = constants.%.33] +// CHECK:STDOUT: %.loc11_36.12: init %tuple.type.3 = tuple_init (%.loc11_36.6, %.loc11_36.11) to %.loc11_40.2 [template = constants.%tuple.1] +// CHECK:STDOUT: %.loc11_40.3: init %tuple.type.3 = converted %.loc11_36.1, %.loc11_36.12 [template = constants.%tuple.1] +// CHECK:STDOUT: %.loc11_40.4: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_40.5: = bound_method %.loc11_39, %.loc11_40.4 [template = constants.%.34] +// CHECK:STDOUT: %int.convert_checked.loc11_40: init i32 = call %.loc11_40.5(%.loc11_39) [template = constants.%.35] +// CHECK:STDOUT: %.loc11_40.6: init i32 = converted %.loc11_39, %int.convert_checked.loc11_40 [template = constants.%.35] +// CHECK:STDOUT: %.loc11_40.7: ref i32 = tuple_access file.%x.var, element1 +// CHECK:STDOUT: %.loc11_40.8: init i32 = initialize_from %.loc11_40.6 to %.loc11_40.7 [template = constants.%.35] +// CHECK:STDOUT: %.loc11_40.9: init %tuple.type.4 = tuple_init (%.loc11_40.3, %.loc11_40.8) to file.%x.var [template = constants.%tuple.2] +// CHECK:STDOUT: %.loc11_41: init %tuple.type.4 = converted %.loc11_40.1, %.loc11_40.9 [template = constants.%tuple.2] // CHECK:STDOUT: assign file.%x.var, %.loc11_41 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/tuple/nested_tuple_in_place.carbon b/toolchain/check/testdata/tuple/nested_tuple_in_place.carbon index 5fc80e4661d97..269c9f955a326 100644 --- a/toolchain/check/testdata/tuple/nested_tuple_in_place.carbon +++ b/toolchain/check/testdata/tuple/nested_tuple_in_place.carbon @@ -35,13 +35,23 @@ fn H() { // CHECK:STDOUT: %H: %H.type = struct_value () [template] // CHECK:STDOUT: %tuple.type.6: type = tuple_type (type, %tuple.type.1, type) [template] // CHECK:STDOUT: %tuple.type.7: type = tuple_type (i32, %tuple.type.2, i32) [template] -// CHECK:STDOUT: %.4: i32 = int_value 1 [template] -// CHECK:STDOUT: %.5: i32 = int_value 2 [template] +// CHECK:STDOUT: %.4: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %.5: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %tuple.type.9: type = tuple_type (Core.IntLiteral, %tuple.type.2, Core.IntLiteral) [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: %.29: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.30: = bound_method %.4, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 1 [template] +// CHECK:STDOUT: %.32: = bound_method %.5, %Convert.15 [template] +// CHECK:STDOUT: %.33: i32 = int_value 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -143,18 +153,26 @@ fn H() { // CHECK:STDOUT: %.loc18_36.13: type = converted %.loc18_36.1, constants.%tuple.type.7 [template = constants.%tuple.type.7] // CHECK:STDOUT: %v.var: ref %tuple.type.7 = var v // CHECK:STDOUT: %v: ref %tuple.type.7 = bind_name v, %v.var -// CHECK:STDOUT: %.loc18_41: i32 = int_value 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc18_41: Core.IntLiteral = int_value 1 [template = constants.%.4] // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [template = constants.%F] // CHECK:STDOUT: %.loc18_50.1: ref %tuple.type.2 = tuple_access %v.var, element1 // CHECK:STDOUT: %F.call: init %tuple.type.2 = call %F.ref() to %.loc18_50.1 -// CHECK:STDOUT: %.loc18_49: i32 = int_value 2 [template = constants.%.5] -// CHECK:STDOUT: %.loc18_50.2: %tuple.type.7 = tuple_literal (%.loc18_41, %F.call, %.loc18_49) -// CHECK:STDOUT: %.loc18_50.3: ref i32 = tuple_access %v.var, element0 -// CHECK:STDOUT: %.loc18_50.4: init i32 = initialize_from %.loc18_41 to %.loc18_50.3 [template = constants.%.4] -// CHECK:STDOUT: %.loc18_50.5: ref i32 = tuple_access %v.var, element2 -// CHECK:STDOUT: %.loc18_50.6: init i32 = initialize_from %.loc18_49 to %.loc18_50.5 [template = constants.%.5] -// CHECK:STDOUT: %.loc18_50.7: init %tuple.type.7 = tuple_init (%.loc18_50.4, %F.call, %.loc18_50.6) to %v.var -// CHECK:STDOUT: %.loc18_51: init %tuple.type.7 = converted %.loc18_50.2, %.loc18_50.7 +// CHECK:STDOUT: %.loc18_49: Core.IntLiteral = int_value 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc18_50.2: %tuple.type.9 = tuple_literal (%.loc18_41, %F.call, %.loc18_49) +// CHECK:STDOUT: %.loc18_50.3: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc18_50.4: = bound_method %.loc18_41, %.loc18_50.3 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc18_50.1: init i32 = call %.loc18_50.4(%.loc18_41) [template = constants.%.31] +// CHECK:STDOUT: %.loc18_50.5: init i32 = converted %.loc18_41, %int.convert_checked.loc18_50.1 [template = constants.%.31] +// CHECK:STDOUT: %.loc18_50.6: ref i32 = tuple_access %v.var, element0 +// CHECK:STDOUT: %.loc18_50.7: init i32 = initialize_from %.loc18_50.5 to %.loc18_50.6 [template = constants.%.31] +// CHECK:STDOUT: %.loc18_50.8: %Convert.type.2 = interface_witness_access constants.%.29, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc18_50.9: = bound_method %.loc18_49, %.loc18_50.8 [template = constants.%.32] +// CHECK:STDOUT: %int.convert_checked.loc18_50.2: init i32 = call %.loc18_50.9(%.loc18_49) [template = constants.%.33] +// CHECK:STDOUT: %.loc18_50.10: init i32 = converted %.loc18_49, %int.convert_checked.loc18_50.2 [template = constants.%.33] +// CHECK:STDOUT: %.loc18_50.11: ref i32 = tuple_access %v.var, element2 +// CHECK:STDOUT: %.loc18_50.12: init i32 = initialize_from %.loc18_50.10 to %.loc18_50.11 [template = constants.%.33] +// CHECK:STDOUT: %.loc18_50.13: init %tuple.type.7 = tuple_init (%.loc18_50.7, %F.call, %.loc18_50.12) to %v.var +// CHECK:STDOUT: %.loc18_51: init %tuple.type.7 = converted %.loc18_50.2, %.loc18_50.13 // CHECK:STDOUT: assign %v.var, %.loc18_51 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/tuple/one_element.carbon b/toolchain/check/testdata/tuple/one_element.carbon index ea0e82f3a1e09..536d5bb7bafc6 100644 --- a/toolchain/check/testdata/tuple/one_element.carbon +++ b/toolchain/check/testdata/tuple/one_element.carbon @@ -18,13 +18,21 @@ var y: (i32,) = x; // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %tuple.type.1: type = tuple_type (type) [template] // CHECK:STDOUT: %tuple.type.2: type = tuple_type (i32) [template] -// CHECK:STDOUT: %.1: i32 = int_value 4 [template] -// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.1) [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 4 [template] +// CHECK:STDOUT: %tuple.type.3: type = tuple_type (Core.IntLiteral) [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: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.26: = bound_method %.1, %Convert.15 [template] +// CHECK:STDOUT: %.27: i32 = int_value 4 [template] +// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.27) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -55,10 +63,14 @@ var y: (i32,) = x; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_18: i32 = int_value 4 [template = constants.%.1] -// CHECK:STDOUT: %.loc11_20.1: %tuple.type.2 = tuple_literal (%.loc11_18) -// CHECK:STDOUT: %.loc11_20.2: init %tuple.type.2 = tuple_init (%.loc11_18) to file.%x.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc11_21: init %tuple.type.2 = converted %.loc11_20.1, %.loc11_20.2 [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_18: Core.IntLiteral = int_value 4 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_20.1: %tuple.type.3 = tuple_literal (%.loc11_18) +// CHECK:STDOUT: %.loc11_20.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_20.3: = bound_method %.loc11_18, %.loc11_20.2 [template = constants.%.26] +// CHECK:STDOUT: %int.convert_checked: init i32 = call %.loc11_20.3(%.loc11_18) [template = constants.%.27] +// CHECK:STDOUT: %.loc11_20.4: init i32 = converted %.loc11_18, %int.convert_checked [template = constants.%.27] +// CHECK:STDOUT: %.loc11_20.5: init %tuple.type.2 = tuple_init (%.loc11_20.4) to file.%x.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_21: init %tuple.type.2 = converted %.loc11_20.1, %.loc11_20.5 [template = constants.%tuple] // CHECK:STDOUT: assign file.%x.var, %.loc11_21 // CHECK:STDOUT: %x.ref: ref %tuple.type.2 = name_ref x, file.%x // CHECK:STDOUT: %.loc12_17.1: ref i32 = tuple_access %x.ref, element0 diff --git a/toolchain/check/testdata/tuple/two_elements.carbon b/toolchain/check/testdata/tuple/two_elements.carbon index 9e07959eb57a2..9e0cec189fa1a 100644 --- a/toolchain/check/testdata/tuple/two_elements.carbon +++ b/toolchain/check/testdata/tuple/two_elements.carbon @@ -21,14 +21,24 @@ var y: (i32, i32) = x; // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template] // CHECK:STDOUT: %tuple.type.1: type = tuple_type (type, type) [template] // CHECK:STDOUT: %tuple.type.2: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.2: i32 = int_value 4 [template] -// CHECK:STDOUT: %.3: i32 = int_value 102 [template] -// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.2, %.3) [template] +// CHECK:STDOUT: %.2: Core.IntLiteral = int_value 4 [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 102 [template] +// CHECK:STDOUT: %tuple.type.3: type = tuple_type (Core.IntLiteral, Core.IntLiteral) [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: %.27: = interface_witness (%Convert.15) [template] +// CHECK:STDOUT: %.28: = bound_method %.2, %Convert.15 [template] +// CHECK:STDOUT: %.29: i32 = int_value 4 [template] +// CHECK:STDOUT: %.30: = bound_method %.3, %Convert.15 [template] +// CHECK:STDOUT: %.31: i32 = int_value 102 [template] +// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.29, %.31) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int32 = %import_ref +// CHECK:STDOUT: .Int32 = %import_ref.1 +// CHECK:STDOUT: .ImplicitAs = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -83,23 +93,41 @@ var y: (i32, i32) = x; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_22: i32 = int_value 4 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_25: i32 = int_value 102 [template = constants.%.3] -// CHECK:STDOUT: %.loc11_28: %tuple.type.2 = tuple_literal (%.loc11_22, %.loc11_25) -// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.loc11_22, %.loc11_25) [template = constants.%tuple] -// CHECK:STDOUT: %.loc11_29: %tuple.type.2 = converted %.loc11_28, %tuple [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_22: Core.IntLiteral = int_value 4 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_25: Core.IntLiteral = int_value 102 [template = constants.%.3] +// CHECK:STDOUT: %.loc11_28.1: %tuple.type.3 = tuple_literal (%.loc11_22, %.loc11_25) +// CHECK:STDOUT: %.loc11_28.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_28.3: = bound_method %.loc11_22, %.loc11_28.2 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked.loc11_28.1: init i32 = call %.loc11_28.3(%.loc11_22) [template = constants.%.29] +// CHECK:STDOUT: %.loc11_28.4: i32 = value_of_initializer %int.convert_checked.loc11_28.1 [template = constants.%.29] +// CHECK:STDOUT: %.loc11_28.5: i32 = converted %.loc11_22, %.loc11_28.4 [template = constants.%.29] +// CHECK:STDOUT: %.loc11_28.6: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc11_28.7: = bound_method %.loc11_25, %.loc11_28.6 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc11_28.2: init i32 = call %.loc11_28.7(%.loc11_25) [template = constants.%.31] +// CHECK:STDOUT: %.loc11_28.8: i32 = value_of_initializer %int.convert_checked.loc11_28.2 [template = constants.%.31] +// CHECK:STDOUT: %.loc11_28.9: i32 = converted %.loc11_25, %.loc11_28.8 [template = constants.%.31] +// CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%.loc11_28.5, %.loc11_28.9) [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_29: %tuple.type.2 = converted %.loc11_28.1, %tuple [template = constants.%tuple] // CHECK:STDOUT: %v: %tuple.type.2 = bind_name v, %.loc11_29 // CHECK:STDOUT: %v.ref: %tuple.type.2 = name_ref v, %v // CHECK:STDOUT: %w: %tuple.type.2 = bind_name w, %v.ref -// CHECK:STDOUT: %.loc14_22: i32 = int_value 4 [template = constants.%.2] -// CHECK:STDOUT: %.loc14_25: i32 = int_value 102 [template = constants.%.3] -// CHECK:STDOUT: %.loc14_28.1: %tuple.type.2 = tuple_literal (%.loc14_22, %.loc14_25) -// CHECK:STDOUT: %.loc14_28.2: ref i32 = tuple_access file.%x.var, element0 -// CHECK:STDOUT: %.loc14_28.3: init i32 = initialize_from %.loc14_22 to %.loc14_28.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc14_28.4: ref i32 = tuple_access file.%x.var, element1 -// CHECK:STDOUT: %.loc14_28.5: init i32 = initialize_from %.loc14_25 to %.loc14_28.4 [template = constants.%.3] -// CHECK:STDOUT: %.loc14_28.6: init %tuple.type.2 = tuple_init (%.loc14_28.3, %.loc14_28.5) to file.%x.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc14_29: init %tuple.type.2 = converted %.loc14_28.1, %.loc14_28.6 [template = constants.%tuple] +// CHECK:STDOUT: %.loc14_22: Core.IntLiteral = int_value 4 [template = constants.%.2] +// CHECK:STDOUT: %.loc14_25: Core.IntLiteral = int_value 102 [template = constants.%.3] +// CHECK:STDOUT: %.loc14_28.1: %tuple.type.3 = tuple_literal (%.loc14_22, %.loc14_25) +// CHECK:STDOUT: %.loc14_28.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc14_28.3: = bound_method %.loc14_22, %.loc14_28.2 [template = constants.%.28] +// CHECK:STDOUT: %int.convert_checked.loc14_28.1: init i32 = call %.loc14_28.3(%.loc14_22) [template = constants.%.29] +// CHECK:STDOUT: %.loc14_28.4: init i32 = converted %.loc14_22, %int.convert_checked.loc14_28.1 [template = constants.%.29] +// CHECK:STDOUT: %.loc14_28.5: ref i32 = tuple_access file.%x.var, element0 +// CHECK:STDOUT: %.loc14_28.6: init i32 = initialize_from %.loc14_28.4 to %.loc14_28.5 [template = constants.%.29] +// CHECK:STDOUT: %.loc14_28.7: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.15] +// CHECK:STDOUT: %.loc14_28.8: = bound_method %.loc14_25, %.loc14_28.7 [template = constants.%.30] +// CHECK:STDOUT: %int.convert_checked.loc14_28.2: init i32 = call %.loc14_28.8(%.loc14_25) [template = constants.%.31] +// CHECK:STDOUT: %.loc14_28.9: init i32 = converted %.loc14_25, %int.convert_checked.loc14_28.2 [template = constants.%.31] +// CHECK:STDOUT: %.loc14_28.10: ref i32 = tuple_access file.%x.var, element1 +// CHECK:STDOUT: %.loc14_28.11: init i32 = initialize_from %.loc14_28.9 to %.loc14_28.10 [template = constants.%.31] +// CHECK:STDOUT: %.loc14_28.12: init %tuple.type.2 = tuple_init (%.loc14_28.6, %.loc14_28.11) to file.%x.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc14_29: init %tuple.type.2 = converted %.loc14_28.1, %.loc14_28.12 [template = constants.%tuple] // CHECK:STDOUT: assign file.%x.var, %.loc14_29 // CHECK:STDOUT: %x.ref: ref %tuple.type.2 = name_ref x, file.%x // CHECK:STDOUT: %.loc15_21.1: ref i32 = tuple_access %x.ref, element0 diff --git a/toolchain/check/testdata/var/fail_storage_is_literal.carbon b/toolchain/check/testdata/var/fail_storage_is_literal.carbon index 83006220516f1..f43a8aa6dad4d 100644 --- a/toolchain/check/testdata/var/fail_storage_is_literal.carbon +++ b/toolchain/check/testdata/var/fail_storage_is_literal.carbon @@ -9,10 +9,10 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/var/fail_storage_is_literal.carbon fn Main() { - // CHECK:STDERR: fail_storage_is_literal.carbon:[[@LINE+6]]:10: error: cannot implicitly convert from `i32` to `type` [ImplicitAsConversionFailure] + // CHECK:STDERR: fail_storage_is_literal.carbon:[[@LINE+6]]:10: error: cannot implicitly convert from `Core.IntLiteral` to `type` [ImplicitAsConversionFailure] // CHECK:STDERR: var x: 1 = 1; // CHECK:STDERR: ^ - // CHECK:STDERR: fail_storage_is_literal.carbon:[[@LINE+3]]:10: note: type `i32` does not implement interface `ImplicitAs(type)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_storage_is_literal.carbon:[[@LINE+3]]:10: note: type `Core.IntLiteral` does not implement interface `ImplicitAs(type)` [MissingImplInMemberAccessNote] // CHECK:STDERR: var x: 1 = 1; // CHECK:STDERR: ^ var x: 1 = 1; @@ -23,7 +23,7 @@ fn Main() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %Main.type: type = fn_type @Main [template] // CHECK:STDOUT: %Main: %Main.type = struct_value () [template] -// CHECK:STDOUT: %.1: i32 = int_value 1 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -45,11 +45,11 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc18_10.1: i32 = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc18_10.1: Core.IntLiteral = int_value 1 [template = constants.%.1] // CHECK:STDOUT: %.loc18_10.2: type = converted %.loc18_10.1, [template = ] // CHECK:STDOUT: %x.var: ref = var x // CHECK:STDOUT: %x: ref = bind_name x, %x.var -// CHECK:STDOUT: %.loc18_14: i32 = int_value 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc18_14: Core.IntLiteral = int_value 1 [template = constants.%.1] // CHECK:STDOUT: assign %x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/where_expr/constraints.carbon b/toolchain/check/testdata/where_expr/constraints.carbon index 67762dfeee75a..58c0c308147a2 100644 --- a/toolchain/check/testdata/where_expr/constraints.carbon +++ b/toolchain/check/testdata/where_expr/constraints.carbon @@ -71,10 +71,10 @@ import library "state_constraints"; // `2` can't be converted to the type of `I.Member` // TODO: The diagnostics are wrong since member access into facets isn't // working properly yet. -// CHECK:STDERR: fail_check_rewrite_constraints.carbon:[[@LINE+7]]:46: error: cannot implicitly convert from `i32` to `` [ImplicitAsConversionFailure] +// CHECK:STDERR: fail_check_rewrite_constraints.carbon:[[@LINE+7]]:46: error: cannot implicitly convert from `Core.IntLiteral` to `` [ImplicitAsConversionFailure] // CHECK:STDERR: fn RewriteTypeMismatch(X:! I where .Member = 2); // CHECK:STDERR: ^ -// CHECK:STDERR: fail_check_rewrite_constraints.carbon:[[@LINE+4]]:46: note: type `i32` does not implement interface `ImplicitAs()` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_check_rewrite_constraints.carbon:[[@LINE+4]]:46: note: type `Core.IntLiteral` does not implement interface `ImplicitAs()` [MissingImplInMemberAccessNote] // CHECK:STDERR: fn RewriteTypeMismatch(X:! I where .Member = 2); // CHECK:STDERR: ^ // CHECK:STDERR: @@ -84,10 +84,10 @@ fn RewriteTypeMismatch(X:! I where .Member = 2); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_left_of_impls_non_type.carbon:[[@LINE+7]]:32: error: cannot implicitly convert from `i32` to `type` [ImplicitAsConversionFailure] +// CHECK:STDERR: fail_left_of_impls_non_type.carbon:[[@LINE+7]]:32: error: cannot implicitly convert from `Core.IntLiteral` to `type` [ImplicitAsConversionFailure] // CHECK:STDERR: fn NonTypeImpls(U:! type where 7 impls type); // CHECK:STDERR: ^ -// CHECK:STDERR: fail_left_of_impls_non_type.carbon:[[@LINE+4]]:32: note: type `i32` does not implement interface `ImplicitAs(type)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_left_of_impls_non_type.carbon:[[@LINE+4]]:32: note: type `Core.IntLiteral` does not implement interface `ImplicitAs(type)` [MissingImplInMemberAccessNote] // CHECK:STDERR: fn NonTypeImpls(U:! type where 7 impls type); // CHECK:STDERR: ^ // CHECK:STDERR: @@ -97,10 +97,10 @@ fn NonTypeImpls(U:! type where 7 impls type); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_right_of_impls_non_type.carbon:[[@LINE+7]]:44: error: cannot implicitly convert from `i32` to `type` [ImplicitAsConversionFailure] +// CHECK:STDERR: fail_right_of_impls_non_type.carbon:[[@LINE+7]]:44: error: cannot implicitly convert from `Core.IntLiteral` to `type` [ImplicitAsConversionFailure] // CHECK:STDERR: fn ImplsNonType(U:! type where .Self impls 7); // CHECK:STDERR: ^ -// CHECK:STDERR: fail_right_of_impls_non_type.carbon:[[@LINE+4]]:44: note: type `i32` does not implement interface `ImplicitAs(type)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_right_of_impls_non_type.carbon:[[@LINE+4]]:44: note: type `Core.IntLiteral` does not implement interface `ImplicitAs(type)` [MissingImplInMemberAccessNote] // CHECK:STDERR: fn ImplsNonType(U:! type where .Self impls 7); // CHECK:STDERR: ^ // CHECK:STDERR: @@ -513,7 +513,7 @@ let B: type where .Self impls A = D; // CHECK:STDOUT: %.Self: %I.type.1 = bind_symbolic_name .Self, 0 [symbolic] // CHECK:STDOUT: %.1: type = assoc_entity_type %I.type.1, type [template] // CHECK:STDOUT: %.2: %.1 = assoc_entity element0, imports.%import_ref.11 [template] -// CHECK:STDOUT: %.3: i32 = int_value 2 [template] +// CHECK:STDOUT: %.3: Core.IntLiteral = int_value 2 [template] // CHECK:STDOUT: %I.type.2: type = facet_type <@I where TODO> [template] // CHECK:STDOUT: %X: %I.type.2 = bind_symbolic_name X, 0 [symbolic] // CHECK:STDOUT: %X.patt: %I.type.2 = symbolic_binding_pattern X, 0 [symbolic] @@ -559,7 +559,7 @@ let B: type where .Self impls A = D; // CHECK:STDOUT: %.Self: %I.type.1 = bind_symbolic_name .Self, 0 [symbolic = constants.%.Self] // CHECK:STDOUT: %.Self.ref: %I.type.1 = name_ref .Self, %.Self [symbolic = constants.%.Self] // CHECK:STDOUT: %Member.ref: %.1 = name_ref Member, imports.%import_ref.7 [template = constants.%.2] -// CHECK:STDOUT: %.loc16_46.1: i32 = int_value 2 [template = constants.%.3] +// CHECK:STDOUT: %.loc16_46.1: Core.IntLiteral = int_value 2 [template = constants.%.3] // CHECK:STDOUT: %.loc16_46.2: %.1 = converted %.loc16_46.1, [template = ] // CHECK:STDOUT: %.loc16_30: type = where_expr %.Self [template = constants.%I.type.2] { // CHECK:STDOUT: requirement_rewrite %Member.ref, @@ -593,7 +593,7 @@ let B: type where .Self impls A = D; // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self, 0 [symbolic] -// CHECK:STDOUT: %.1: i32 = int_value 7 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 7 [template] // CHECK:STDOUT: %type_where: type = facet_type [template] // CHECK:STDOUT: %U: %type_where = bind_symbolic_name U, 0 [symbolic] // CHECK:STDOUT: %U.patt: %type_where = symbolic_binding_pattern U, 0 [symbolic] @@ -620,7 +620,7 @@ let B: type where .Self impls A = D; // CHECK:STDOUT: %U.param_patt: %type_where = value_param_pattern %U.patt.loc11_17.1, runtime_param [symbolic = %U.patt.loc11_17.2 (constants.%U.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self, 0 [symbolic = constants.%.Self] -// CHECK:STDOUT: %.loc11_32.1: i32 = int_value 7 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_32.1: Core.IntLiteral = int_value 7 [template = constants.%.1] // CHECK:STDOUT: %.loc11_32.2: type = converted %.loc11_32.1, [template = ] // CHECK:STDOUT: %.loc11_26: type = where_expr %.Self [template = constants.%type_where] { // CHECK:STDOUT: requirement_impls , type @@ -646,7 +646,7 @@ let B: type where .Self impls A = D; // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self, 0 [symbolic] -// CHECK:STDOUT: %.1: i32 = int_value 7 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 7 [template] // CHECK:STDOUT: %type_where: type = facet_type [template] // CHECK:STDOUT: %U: %type_where = bind_symbolic_name U, 0 [symbolic] // CHECK:STDOUT: %U.patt: %type_where = symbolic_binding_pattern U, 0 [symbolic] @@ -674,7 +674,7 @@ let B: type where .Self impls A = D; // CHECK:STDOUT: } { // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self, 0 [symbolic = constants.%.Self] // CHECK:STDOUT: %.Self.ref: type = name_ref .Self, %.Self [symbolic = constants.%.Self] -// CHECK:STDOUT: %.loc11_44.1: i32 = int_value 7 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_44.1: Core.IntLiteral = int_value 7 [template = constants.%.1] // CHECK:STDOUT: %.loc11_44.2: type = converted %.loc11_44.1, [template = ] // CHECK:STDOUT: %.loc11_26: type = where_expr %.Self [template = constants.%type_where] { // CHECK:STDOUT: requirement_impls %.Self.ref, diff --git a/toolchain/check/testdata/where_expr/fail_not_facet.carbon b/toolchain/check/testdata/where_expr/fail_not_facet.carbon index 0aae5b446b165..481f2ce7eee12 100644 --- a/toolchain/check/testdata/where_expr/fail_not_facet.carbon +++ b/toolchain/check/testdata/where_expr/fail_not_facet.carbon @@ -154,7 +154,7 @@ var v: e where .x = 3; // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.Self: = bind_symbolic_name .Self, 0 [symbolic] -// CHECK:STDOUT: %.1: i32 = int_value 3 [template] +// CHECK:STDOUT: %.1: Core.IntLiteral = int_value 3 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -173,7 +173,7 @@ var v: e where .x = 3; // CHECK:STDOUT: %e.ref: = name_ref e, [template = ] // CHECK:STDOUT: %.Self: = bind_symbolic_name .Self, 0 [symbolic = constants.%.Self] // CHECK:STDOUT: %.Self.ref: = name_ref .Self, %.Self [symbolic = constants.%.Self] -// CHECK:STDOUT: %.loc7_21: i32 = int_value 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc7_21: Core.IntLiteral = int_value 3 [template = constants.%.1] // CHECK:STDOUT: %.loc7_10: type = where_expr %.Self [template = ] { // CHECK:STDOUT: requirement_rewrite , // CHECK:STDOUT: } diff --git a/toolchain/diagnostics/coverage_test.cpp b/toolchain/diagnostics/coverage_test.cpp index 979bacfaae5d1..f22d50b1bfeac 100644 --- a/toolchain/diagnostics/coverage_test.cpp +++ b/toolchain/diagnostics/coverage_test.cpp @@ -29,10 +29,6 @@ constexpr DiagnosticKind UntestedDiagnosticKinds[] = { DiagnosticKind::ErrorStattingFile, DiagnosticKind::FileTooLarge, - // Int literals are currently limited to i32. Once that's fixed, this - // should be tested. - DiagnosticKind::ArrayBoundTooLarge, - // These aren't feasible to test with a normal testcase, but are tested in // lex/tokenized_buffer_test.cpp. DiagnosticKind::TooManyTokens, diff --git a/toolchain/diagnostics/diagnostic_kind.def b/toolchain/diagnostics/diagnostic_kind.def index c3cf38c85a33e..904a6635a1d93 100644 --- a/toolchain/diagnostics/diagnostic_kind.def +++ b/toolchain/diagnostics/diagnostic_kind.def @@ -321,7 +321,6 @@ CARBON_DIAGNOSTIC_KIND(IncompleteTypeInLetDecl) CARBON_DIAGNOSTIC_KIND(IncompleteTypeInMemberAccess) CARBON_DIAGNOSTIC_KIND(IncompleteTypeInValueConversion) CARBON_DIAGNOSTIC_KIND(IncompleteTypeInVarDecl) -CARBON_DIAGNOSTIC_KIND(IntLiteralTooLargeForI32) CARBON_DIAGNOSTIC_KIND(IntTooLargeForType) CARBON_DIAGNOSTIC_KIND(IntWidthNotMultipleOf8) CARBON_DIAGNOSTIC_KIND(IntWidthNotPositive) diff --git a/toolchain/lower/testdata/array/assign_return_value.carbon b/toolchain/lower/testdata/array/assign_return_value.carbon index c744d8b8c3301..9ad452361c9d9 100644 --- a/toolchain/lower/testdata/array/assign_return_value.carbon +++ b/toolchain/lower/testdata/array/assign_return_value.carbon @@ -21,8 +21,8 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: define void @_CF.Main(ptr sret({ i32, i32 }) %return) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc11_38.2.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 0, !dbg !7 -// CHECK:STDOUT: %.loc11_38.4.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 1, !dbg !7 +// CHECK:STDOUT: %.loc11_38.5.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 0, !dbg !7 +// CHECK:STDOUT: %.loc11_38.10.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 1, !dbg !7 // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @tuple.loc11_39, i64 8, i1 false), !dbg !8 // CHECK:STDOUT: ret void, !dbg !8 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/array/base.carbon b/toolchain/lower/testdata/array/base.carbon index c28efde708fd2..df8ff6db1c714 100644 --- a/toolchain/lower/testdata/array/base.carbon +++ b/toolchain/lower/testdata/array/base.carbon @@ -27,7 +27,7 @@ fn Run() { // CHECK:STDOUT: define void @main() !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %a.var = alloca [1 x i32], align 4, !dbg !7 -// CHECK:STDOUT: %.loc12_24.3.array.index = getelementptr inbounds [1 x i32], ptr %a.var, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: %.loc12_24.6.array.index = getelementptr inbounds [1 x i32], ptr %a.var, i32 0, i32 0, !dbg !8 // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %a.var, ptr align 4 @array.1.loc12_25, i64 4, i1 false), !dbg !9 // CHECK:STDOUT: %b.var = alloca [2 x double], align 8, !dbg !10 // CHECK:STDOUT: %.loc13_32.3.array.index = getelementptr inbounds [2 x double], ptr %b.var, i32 0, i32 0, !dbg !11 @@ -41,9 +41,9 @@ fn Run() { // CHECK:STDOUT: %.loc14_40.15.array.index = getelementptr inbounds [5 x {}], ptr %c.var, i32 0, i32 4, !dbg !14 // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %c.var, ptr align 1 @array.3.loc14_41, i64 0, i1 false), !dbg !15 // CHECK:STDOUT: %d.var = alloca { i32, i32, i32 }, align 8, !dbg !16 -// CHECK:STDOUT: %.loc15_36.2.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %d.var, i32 0, i32 0, !dbg !17 -// CHECK:STDOUT: %.loc15_36.4.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %d.var, i32 0, i32 1, !dbg !17 -// CHECK:STDOUT: %.loc15_36.6.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %d.var, i32 0, i32 2, !dbg !17 +// CHECK:STDOUT: %.loc15_36.5.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %d.var, i32 0, i32 0, !dbg !17 +// CHECK:STDOUT: %.loc15_36.10.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %d.var, i32 0, i32 1, !dbg !17 +// CHECK:STDOUT: %.loc15_36.15.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %d.var, i32 0, i32 2, !dbg !17 // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %d.var, ptr align 4 @tuple.loc15_37, i64 12, i1 false), !dbg !18 // CHECK:STDOUT: %e.var = alloca [3 x i32], align 4, !dbg !19 // CHECK:STDOUT: %.loc16_21.1.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %d.var, i32 0, i32 0, !dbg !20 diff --git a/toolchain/lower/testdata/array/function_param.carbon b/toolchain/lower/testdata/array/function_param.carbon index 3bca4f6c7dcdc..470d300a743cd 100644 --- a/toolchain/lower/testdata/array/function_param.carbon +++ b/toolchain/lower/testdata/array/function_param.carbon @@ -19,7 +19,7 @@ fn G() -> i32 { // CHECK:STDOUT: ; ModuleID = 'function_param.carbon' // CHECK:STDOUT: source_filename = "function_param.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @array.loc16_20.13 = internal constant [3 x i32] [i32 1, i32 2, i32 3] +// CHECK:STDOUT: @array.loc16_20.22 = internal constant [3 x i32] [i32 1, i32 2, i32 3] // CHECK:STDOUT: // CHECK:STDOUT: define i32 @_CF.Main(ptr %arr, i32 %i) !dbg !4 { // CHECK:STDOUT: entry: @@ -30,12 +30,12 @@ fn G() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @_CG.Main() !dbg !9 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc16_20.2.temp = alloca [3 x i32], align 4, !dbg !10 -// CHECK:STDOUT: %.loc16_20.4.array.index = getelementptr inbounds [3 x i32], ptr %.loc16_20.2.temp, i32 0, i32 0, !dbg !10 -// CHECK:STDOUT: %.loc16_20.7.array.index = getelementptr inbounds [3 x i32], ptr %.loc16_20.2.temp, i32 0, i32 1, !dbg !10 -// CHECK:STDOUT: %.loc16_20.10.array.index = getelementptr inbounds [3 x i32], ptr %.loc16_20.2.temp, i32 0, i32 2, !dbg !10 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %.loc16_20.2.temp, ptr align 4 @array.loc16_20.13, i64 12, i1 false), !dbg !10 -// CHECK:STDOUT: %F.call = call i32 @_CF.Main(ptr %.loc16_20.2.temp, i32 1), !dbg !11 +// CHECK:STDOUT: %.loc16_20.5.temp = alloca [3 x i32], align 4, !dbg !10 +// CHECK:STDOUT: %.loc16_20.7.array.index = getelementptr inbounds [3 x i32], ptr %.loc16_20.5.temp, i32 0, i32 0, !dbg !10 +// CHECK:STDOUT: %.loc16_20.13.array.index = getelementptr inbounds [3 x i32], ptr %.loc16_20.5.temp, i32 0, i32 1, !dbg !10 +// CHECK:STDOUT: %.loc16_20.19.array.index = getelementptr inbounds [3 x i32], ptr %.loc16_20.5.temp, i32 0, i32 2, !dbg !10 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %.loc16_20.5.temp, ptr align 4 @array.loc16_20.22, i64 12, i1 false), !dbg !10 +// CHECK:STDOUT: %F.call = call i32 @_CF.Main(ptr %.loc16_20.5.temp, i32 1), !dbg !11 // CHECK:STDOUT: ret i32 %F.call, !dbg !12 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/basics/numeric_literals.carbon b/toolchain/lower/testdata/basics/numeric_literals.carbon index ac9faab62d5e6..3de52d8217c95 100644 --- a/toolchain/lower/testdata/basics/numeric_literals.carbon +++ b/toolchain/lower/testdata/basics/numeric_literals.carbon @@ -36,10 +36,10 @@ fn F() { // CHECK:STDOUT: define void @_CF.Main() !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %ints.var = alloca [4 x i32], align 4, !dbg !7 -// CHECK:STDOUT: %.loc19_3.3.array.index = getelementptr inbounds [4 x i32], ptr %ints.var, i32 0, i32 0, !dbg !8 -// CHECK:STDOUT: %.loc19_3.6.array.index = getelementptr inbounds [4 x i32], ptr %ints.var, i32 0, i32 1, !dbg !8 -// CHECK:STDOUT: %.loc19_3.9.array.index = getelementptr inbounds [4 x i32], ptr %ints.var, i32 0, i32 2, !dbg !8 -// CHECK:STDOUT: %.loc19_3.12.array.index = getelementptr inbounds [4 x i32], ptr %ints.var, i32 0, i32 3, !dbg !8 +// CHECK:STDOUT: %.loc19_3.6.array.index = getelementptr inbounds [4 x i32], ptr %ints.var, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: %.loc19_3.12.array.index = getelementptr inbounds [4 x i32], ptr %ints.var, i32 0, i32 1, !dbg !8 +// CHECK:STDOUT: %.loc19_3.18.array.index = getelementptr inbounds [4 x i32], ptr %ints.var, i32 0, i32 2, !dbg !8 +// CHECK:STDOUT: %.loc19_3.24.array.index = getelementptr inbounds [4 x i32], ptr %ints.var, i32 0, i32 3, !dbg !8 // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %ints.var, ptr align 4 @array.1.loc19_4, i64 16, i1 false), !dbg !9 // CHECK:STDOUT: %floats.var = alloca [6 x double], align 8, !dbg !10 // CHECK:STDOUT: %.loc27_3.3.array.index = getelementptr inbounds [6 x double], ptr %floats.var, i32 0, i32 0, !dbg !11 diff --git a/toolchain/lower/testdata/class/adapt.carbon b/toolchain/lower/testdata/class/adapt.carbon index 4e6f176cd77a8..d3304fd1abe41 100644 --- a/toolchain/lower/testdata/class/adapt.carbon +++ b/toolchain/lower/testdata/class/adapt.carbon @@ -58,8 +58,8 @@ fn DoStuff(a: Int) -> Int { // CHECK:STDOUT: // CHECK:STDOUT: define void @_CMake.PairOfInts.Main(ptr sret({ i32, i32 }) %return) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc9_27.2.a = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 0, !dbg !7 -// CHECK:STDOUT: %.loc9_27.4.b = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 1, !dbg !7 +// CHECK:STDOUT: %.loc9_27.5.a = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 0, !dbg !7 +// CHECK:STDOUT: %.loc9_27.10.b = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 1, !dbg !7 // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @struct.loc9_28, i64 8, i1 false), !dbg !8 // CHECK:STDOUT: ret void, !dbg !8 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/class/base.carbon b/toolchain/lower/testdata/class/base.carbon index b992df0201388..f3bd7591640e5 100644 --- a/toolchain/lower/testdata/class/base.carbon +++ b/toolchain/lower/testdata/class/base.carbon @@ -38,8 +38,8 @@ fn Convert(p: Derived*) -> Base* { // CHECK:STDOUT: define void @_CMake.Main(ptr sret({ { i32 }, i32 }) %return) !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc22_35.2.base = getelementptr inbounds nuw { { i32 }, i32 }, ptr %return, i32 0, i32 0, !dbg !7 -// CHECK:STDOUT: %.loc22_26.2.b = getelementptr inbounds nuw { i32 }, ptr %.loc22_35.2.base, i32 0, i32 0, !dbg !8 -// CHECK:STDOUT: %.loc22_35.4.d = getelementptr inbounds nuw { { i32 }, i32 }, ptr %return, i32 0, i32 1, !dbg !7 +// CHECK:STDOUT: %.loc22_26.5.b = getelementptr inbounds nuw { i32 }, ptr %.loc22_35.2.base, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: %.loc22_35.7.d = getelementptr inbounds nuw { { i32 }, i32 }, ptr %return, i32 0, i32 1, !dbg !7 // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @struct.2.loc22_36, i64 8, i1 false), !dbg !9 // CHECK:STDOUT: ret void, !dbg !9 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/class/convert.carbon b/toolchain/lower/testdata/class/convert.carbon index 903fe74808e71..4f8d3ded29157 100644 --- a/toolchain/lower/testdata/class/convert.carbon +++ b/toolchain/lower/testdata/class/convert.carbon @@ -43,7 +43,7 @@ fn DoIt() { // CHECK:STDOUT: define void @_CDoIt.Main() !dbg !11 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %w.var = alloca { i32 }, align 8, !dbg !12 -// CHECK:STDOUT: %.loc22_31.2.n = getelementptr inbounds nuw { i32 }, ptr %w.var, i32 0, i32 0, !dbg !13 +// CHECK:STDOUT: %.loc22_31.5.n = getelementptr inbounds nuw { i32 }, ptr %w.var, i32 0, i32 0, !dbg !13 // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %w.var, ptr align 4 @struct.loc22_32, i64 4, i1 false), !dbg !14 // CHECK:STDOUT: %Convert.call = call i32 @"_CConvert.IntWrapper.Main:ImplicitAs.Core"(ptr %w.var), !dbg !15 // CHECK:STDOUT: call void @_CConsume.Main(i32 %Convert.call), !dbg !16 diff --git a/toolchain/lower/testdata/function/call/struct_param.carbon b/toolchain/lower/testdata/function/call/struct_param.carbon index c1d708b2f05cf..e01f4e979b5e9 100644 --- a/toolchain/lower/testdata/function/call/struct_param.carbon +++ b/toolchain/lower/testdata/function/call/struct_param.carbon @@ -17,7 +17,7 @@ fn Main() { // CHECK:STDOUT: ; ModuleID = 'struct_param.carbon' // CHECK:STDOUT: source_filename = "struct_param.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @struct.3.loc14_34.2 = internal constant { i32, i32 } { i32 2, i32 3 } +// CHECK:STDOUT: @struct.3.loc14_34.10 = internal constant { i32, i32 } { i32 2, i32 3 } // CHECK:STDOUT: // CHECK:STDOUT: define void @_CF.Main({ i32 } %b, ptr %c) !dbg !4 { // CHECK:STDOUT: entry: @@ -26,7 +26,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: define void @_CMain.Main() !dbg !8 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: call void @_CF.Main({ i32 } { i32 1 }, ptr @struct.3.loc14_34.2), !dbg !9 +// CHECK:STDOUT: call void @_CF.Main({ i32 } { i32 1 }, ptr @struct.3.loc14_34.10), !dbg !9 // CHECK:STDOUT: ret void, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/call/tuple_param.carbon b/toolchain/lower/testdata/function/call/tuple_param.carbon index f7920d85a4d29..876c97ec6633b 100644 --- a/toolchain/lower/testdata/function/call/tuple_param.carbon +++ b/toolchain/lower/testdata/function/call/tuple_param.carbon @@ -17,7 +17,7 @@ fn Main() { // CHECK:STDOUT: ; ModuleID = 'tuple_param.carbon' // CHECK:STDOUT: source_filename = "tuple_param.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @tuple.2.loc14_20.2 = internal constant { i32, i32 } { i32 2, i32 3 } +// CHECK:STDOUT: @tuple.2.loc14_20.10 = internal constant { i32, i32 } { i32 2, i32 3 } // CHECK:STDOUT: // CHECK:STDOUT: define void @_CF.Main({ i32 } %b, ptr %c) !dbg !4 { // CHECK:STDOUT: entry: @@ -26,7 +26,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: define void @_CMain.Main() !dbg !8 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: call void @_CF.Main({ i32 } { i32 1 }, ptr @tuple.2.loc14_20.2), !dbg !9 +// CHECK:STDOUT: call void @_CF.Main({ i32 } { i32 1 }, ptr @tuple.2.loc14_20.10), !dbg !9 // CHECK:STDOUT: ret void, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/call/tuple_param_with_return_slot.carbon b/toolchain/lower/testdata/function/call/tuple_param_with_return_slot.carbon index a01be0ad1b628..de0d0e886e280 100644 --- a/toolchain/lower/testdata/function/call/tuple_param_with_return_slot.carbon +++ b/toolchain/lower/testdata/function/call/tuple_param_with_return_slot.carbon @@ -19,7 +19,7 @@ fn Main() { // CHECK:STDOUT: ; ModuleID = 'tuple_param_with_return_slot.carbon' // CHECK:STDOUT: source_filename = "tuple_param_with_return_slot.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @tuple.2.loc16_20.2 = internal constant { i32, i32 } { i32 2, i32 3 } +// CHECK:STDOUT: @tuple.2.loc16_20.10 = internal constant { i32, i32 } { i32 2, i32 3 } // CHECK:STDOUT: // CHECK:STDOUT: define void @_CF.Main(ptr sret({ i32, i32, i32 }) %return, { i32 } %b, ptr %c) !dbg !4 { // CHECK:STDOUT: entry: @@ -40,7 +40,7 @@ fn Main() { // CHECK:STDOUT: define void @_CMain.Main() !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc16_4.1.temp = alloca { i32, i32, i32 }, align 8, !dbg !13 -// CHECK:STDOUT: call void @_CF.Main(ptr %.loc16_4.1.temp, { i32 } { i32 1 }, ptr @tuple.2.loc16_20.2), !dbg !13 +// CHECK:STDOUT: call void @_CF.Main(ptr %.loc16_4.1.temp, { i32 } { i32 1 }, ptr @tuple.2.loc16_20.10), !dbg !13 // CHECK:STDOUT: ret void, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/generic/call.carbon b/toolchain/lower/testdata/function/generic/call.carbon index 2c843e594b169..55e39e09c8976 100644 --- a/toolchain/lower/testdata/function/generic/call.carbon +++ b/toolchain/lower/testdata/function/generic/call.carbon @@ -41,24 +41,24 @@ fn G() { // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %d.var, ptr align 1 @struct.2.loc19_16, i64 0, i1 false), !dbg !10 // CHECK:STDOUT: %n.var = alloca i32, align 4, !dbg !11 // CHECK:STDOUT: store i32 0, ptr %n.var, align 4, !dbg !12 -// CHECK:STDOUT: call void @_CF.Main.1(ptr %c.var), !dbg !13 -// CHECK:STDOUT: call void @_CF.Main.2(ptr %d.var), !dbg !14 +// CHECK:STDOUT: call void @_CF.Main.45(ptr %c.var), !dbg !13 +// CHECK:STDOUT: call void @_CF.Main.46(ptr %d.var), !dbg !14 // CHECK:STDOUT: %.loc24_5 = load i32, ptr %n.var, align 4, !dbg !15 -// CHECK:STDOUT: call void @_CF.Main.3(i32 %.loc24_5), !dbg !16 -// CHECK:STDOUT: call void @_CF.Main.4(%type zeroinitializer), !dbg !17 +// CHECK:STDOUT: call void @_CF.Main.47(i32 %.loc24_5), !dbg !16 +// CHECK:STDOUT: call void @_CF.Main.48(%type zeroinitializer), !dbg !17 // CHECK:STDOUT: ret void, !dbg !18 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) // CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0 // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_CF.Main.1(ptr) +// CHECK:STDOUT: declare void @_CF.Main.45(ptr) // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_CF.Main.2(ptr) +// CHECK:STDOUT: declare void @_CF.Main.46(ptr) // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_CF.Main.3(i32) +// CHECK:STDOUT: declare void @_CF.Main.47(i32) // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_CF.Main.4(%type) +// CHECK:STDOUT: declare void @_CF.Main.48(%type) // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.memcpy.p0.p0.i64, { 1, 0 } diff --git a/toolchain/lower/testdata/function/generic/call_method.carbon b/toolchain/lower/testdata/function/generic/call_method.carbon index efd3d4d3730ac..890add72e408e 100644 --- a/toolchain/lower/testdata/function/generic/call_method.carbon +++ b/toolchain/lower/testdata/function/generic/call_method.carbon @@ -32,14 +32,14 @@ fn CallF() -> i32 { // CHECK:STDOUT: %n.var = alloca i32, align 4, !dbg !9 // CHECK:STDOUT: store i32 0, ptr %n.var, align 4, !dbg !10 // CHECK:STDOUT: %.loc20_14 = load i32, ptr %n.var, align 4, !dbg !11 -// CHECK:STDOUT: %F.call = call i32 @_CF.C.Main.1(ptr %c.var, i32 %.loc20_14), !dbg !12 +// CHECK:STDOUT: %F.call = call i32 @_CF.C.Main.45(ptr %c.var, i32 %.loc20_14), !dbg !12 // CHECK:STDOUT: ret i32 %F.call, !dbg !13 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) // CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0 // CHECK:STDOUT: -// CHECK:STDOUT: declare i32 @_CF.C.Main.1(ptr, i32) +// CHECK:STDOUT: declare i32 @_CF.C.Main.45(ptr, i32) // CHECK:STDOUT: // CHECK:STDOUT: attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/if_expr/empty_block.carbon b/toolchain/lower/testdata/if_expr/empty_block.carbon index fb3e33cfb4150..78de38da47811 100644 --- a/toolchain/lower/testdata/if_expr/empty_block.carbon +++ b/toolchain/lower/testdata/if_expr/empty_block.carbon @@ -9,7 +9,7 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/if_expr/empty_block.carbon fn Select(b: bool, c: bool, d: bool) -> i32 { - return if b then if c then 1 else 2 else if d then 3 else 4; + return if b then if c then 1 as i32 else 2 else if d then 3 as i32 else 4; } // CHECK:STDOUT: ; ModuleID = 'empty_block.carbon' @@ -33,20 +33,20 @@ fn Select(b: bool, c: bool, d: bool) -> i32 { // CHECK:STDOUT: br label %if.expr.result.loc12_10, !dbg !7 // CHECK:STDOUT: // CHECK:STDOUT: if.expr.else.loc12_10: ; preds = %entry -// CHECK:STDOUT: br i1 %d, label %if.expr.then.loc12_44, label %if.expr.else.loc12_44, !dbg !9 +// CHECK:STDOUT: br i1 %d, label %if.expr.then.loc12_51, label %if.expr.else.loc12_51, !dbg !9 // CHECK:STDOUT: -// CHECK:STDOUT: if.expr.then.loc12_44: ; preds = %if.expr.else.loc12_10 -// CHECK:STDOUT: br label %if.expr.result.loc12_44, !dbg !9 +// CHECK:STDOUT: if.expr.then.loc12_51: ; preds = %if.expr.else.loc12_10 +// CHECK:STDOUT: br label %if.expr.result.loc12_51, !dbg !9 // CHECK:STDOUT: -// CHECK:STDOUT: if.expr.else.loc12_44: ; preds = %if.expr.else.loc12_10 -// CHECK:STDOUT: br label %if.expr.result.loc12_44, !dbg !9 +// CHECK:STDOUT: if.expr.else.loc12_51: ; preds = %if.expr.else.loc12_10 +// CHECK:STDOUT: br label %if.expr.result.loc12_51, !dbg !9 // CHECK:STDOUT: -// CHECK:STDOUT: if.expr.result.loc12_44: ; preds = %if.expr.else.loc12_44, %if.expr.then.loc12_44 -// CHECK:STDOUT: %1 = phi i32 [ 3, %if.expr.then.loc12_44 ], [ 4, %if.expr.else.loc12_44 ] +// CHECK:STDOUT: if.expr.result.loc12_51: ; preds = %if.expr.else.loc12_51, %if.expr.then.loc12_51 +// CHECK:STDOUT: %1 = phi i32 [ 3, %if.expr.then.loc12_51 ], [ 4, %if.expr.else.loc12_51 ] // CHECK:STDOUT: br label %if.expr.result.loc12_10, !dbg !7 // CHECK:STDOUT: -// CHECK:STDOUT: if.expr.result.loc12_10: ; preds = %if.expr.result.loc12_44, %if.expr.result.loc12_20 -// CHECK:STDOUT: %2 = phi i32 [ %0, %if.expr.result.loc12_20 ], [ %1, %if.expr.result.loc12_44 ] +// CHECK:STDOUT: if.expr.result.loc12_10: ; preds = %if.expr.result.loc12_51, %if.expr.result.loc12_20 +// CHECK:STDOUT: %2 = phi i32 [ %0, %if.expr.result.loc12_20 ], [ %1, %if.expr.result.loc12_51 ] // CHECK:STDOUT: ret i32 %2, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -62,5 +62,5 @@ fn Select(b: bool, c: bool, d: bool) -> i32 { // CHECK:STDOUT: !6 = !{} // CHECK:STDOUT: !7 = !DILocation(line: 12, column: 10, scope: !4) // CHECK:STDOUT: !8 = !DILocation(line: 12, column: 20, scope: !4) -// CHECK:STDOUT: !9 = !DILocation(line: 12, column: 44, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 12, column: 51, scope: !4) // CHECK:STDOUT: !10 = !DILocation(line: 12, column: 3, scope: !4) diff --git a/toolchain/lower/testdata/index/array_element_access.carbon b/toolchain/lower/testdata/index/array_element_access.carbon index ca4ed8469e09d..a08a7f49296cd 100644 --- a/toolchain/lower/testdata/index/array_element_access.carbon +++ b/toolchain/lower/testdata/index/array_element_access.carbon @@ -26,16 +26,16 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: define void @_CA.Main(ptr sret({ i32, i32 }) %return) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc10_36.2.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 0, !dbg !7 -// CHECK:STDOUT: %.loc10_36.4.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 1, !dbg !7 +// CHECK:STDOUT: %.loc10_36.5.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 0, !dbg !7 +// CHECK:STDOUT: %.loc10_36.10.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 1, !dbg !7 // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @tuple.loc10_37, i64 8, i1 false), !dbg !8 // CHECK:STDOUT: ret void, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @_CB.Main(ptr sret([2 x i32]) %return) !dbg !9 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc12_34.3.array.index = getelementptr inbounds [2 x i32], ptr %return, i32 0, i32 0, !dbg !10 -// CHECK:STDOUT: %.loc12_34.6.array.index = getelementptr inbounds [2 x i32], ptr %return, i32 0, i32 1, !dbg !10 +// CHECK:STDOUT: %.loc12_34.6.array.index = getelementptr inbounds [2 x i32], ptr %return, i32 0, i32 0, !dbg !10 +// CHECK:STDOUT: %.loc12_34.12.array.index = getelementptr inbounds [2 x i32], ptr %return, i32 0, i32 1, !dbg !10 // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @array.loc12_35, i64 8, i1 false), !dbg !11 // CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/let/tuple.carbon b/toolchain/lower/testdata/let/tuple.carbon index c85ccd405e1ea..7160040a8fb2e 100644 --- a/toolchain/lower/testdata/let/tuple.carbon +++ b/toolchain/lower/testdata/let/tuple.carbon @@ -24,13 +24,13 @@ fn F() -> i32 { // CHECK:STDOUT: define i32 @_CF.Main() !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %a.var = alloca { i32, i32, i32 }, align 8, !dbg !7 -// CHECK:STDOUT: %.loc12_36.2.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 0, !dbg !8 -// CHECK:STDOUT: %.loc12_36.4.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 1, !dbg !8 -// CHECK:STDOUT: %.loc12_36.6.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 2, !dbg !8 +// CHECK:STDOUT: %.loc12_36.5.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: %.loc12_36.10.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 1, !dbg !8 +// CHECK:STDOUT: %.loc12_36.15.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 2, !dbg !8 // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %a.var, ptr align 4 @tuple.1.loc12_37, i64 12, i1 false), !dbg !9 // CHECK:STDOUT: %b.var = alloca { i32, i32 }, align 8, !dbg !10 -// CHECK:STDOUT: %.loc13_28.2.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %b.var, i32 0, i32 0, !dbg !11 -// CHECK:STDOUT: %.loc13_28.4.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %b.var, i32 0, i32 1, !dbg !11 +// CHECK:STDOUT: %.loc13_28.5.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %b.var, i32 0, i32 0, !dbg !11 +// CHECK:STDOUT: %.loc13_28.10.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %b.var, i32 0, i32 1, !dbg !11 // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %b.var, ptr align 4 @tuple.2.loc13_29, i64 8, i1 false), !dbg !12 // CHECK:STDOUT: %.loc14_43.1.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 0, !dbg !13 // CHECK:STDOUT: %.loc14_43.2 = load i32, ptr %.loc14_43.1.tuple.elem, align 4, !dbg !13 diff --git a/toolchain/lower/testdata/operators/assignment.carbon b/toolchain/lower/testdata/operators/assignment.carbon index 3d1ecf4869776..15456762da305 100644 --- a/toolchain/lower/testdata/operators/assignment.carbon +++ b/toolchain/lower/testdata/operators/assignment.carbon @@ -26,8 +26,8 @@ fn Main() { // CHECK:STDOUT: store i32 12, ptr %a.var, align 4, !dbg !8 // CHECK:STDOUT: store i32 9, ptr %a.var, align 4, !dbg !9 // CHECK:STDOUT: %b.var = alloca { i32, i32 }, align 8, !dbg !10 -// CHECK:STDOUT: %.loc15_12.2.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %b.var, i32 0, i32 0, !dbg !11 -// CHECK:STDOUT: %.loc15_12.4.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %b.var, i32 0, i32 1, !dbg !11 +// CHECK:STDOUT: %.loc15_12.5.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %b.var, i32 0, i32 0, !dbg !11 +// CHECK:STDOUT: %.loc15_12.10.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %b.var, i32 0, i32 1, !dbg !11 // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %b.var, ptr align 4 @tuple.loc15_5, i64 8, i1 false), !dbg !12 // CHECK:STDOUT: ret void, !dbg !13 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/pointer/address_of_field.carbon b/toolchain/lower/testdata/pointer/address_of_field.carbon index 56b7fa5e0161b..1e7dc1db27519 100644 --- a/toolchain/lower/testdata/pointer/address_of_field.carbon +++ b/toolchain/lower/testdata/pointer/address_of_field.carbon @@ -25,8 +25,8 @@ fn F() { // CHECK:STDOUT: define void @_CF.Main() !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %s.var = alloca { i32, i32 }, align 8, !dbg !7 -// CHECK:STDOUT: %.loc14_46.2.a = getelementptr inbounds nuw { i32, i32 }, ptr %s.var, i32 0, i32 0, !dbg !8 -// CHECK:STDOUT: %.loc14_46.4.b = getelementptr inbounds nuw { i32, i32 }, ptr %s.var, i32 0, i32 1, !dbg !8 +// CHECK:STDOUT: %.loc14_46.5.a = getelementptr inbounds nuw { i32, i32 }, ptr %s.var, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: %.loc14_46.10.b = getelementptr inbounds nuw { i32, i32 }, ptr %s.var, i32 0, i32 1, !dbg !8 // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %s.var, ptr align 4 @struct.loc14_47, i64 8, i1 false), !dbg !9 // CHECK:STDOUT: %.loc15_7.b = getelementptr inbounds nuw { i32, i32 }, ptr %s.var, i32 0, i32 1, !dbg !10 // CHECK:STDOUT: call void @_CG.Main(ptr %.loc15_7.b), !dbg !11 diff --git a/toolchain/lower/testdata/return/return_var.carbon b/toolchain/lower/testdata/return/return_var.carbon index 3063aa012c0f6..1c82e72ea0434 100644 --- a/toolchain/lower/testdata/return/return_var.carbon +++ b/toolchain/lower/testdata/return/return_var.carbon @@ -24,9 +24,9 @@ fn Make() -> C { // CHECK:STDOUT: // CHECK:STDOUT: define void @_CMake.Main(ptr sret({ i32, ptr }) %return) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc18_30.2.data = getelementptr inbounds nuw { i32, ptr }, ptr %return, i32 0, i32 0, !dbg !7 -// CHECK:STDOUT: %.loc18_30.4.next = getelementptr inbounds nuw { i32, ptr }, ptr %return, i32 0, i32 1, !dbg !7 -// CHECK:STDOUT: store ptr %return, ptr %.loc18_30.4.next, align 8, !dbg !7 +// CHECK:STDOUT: %.loc18_30.5.data = getelementptr inbounds nuw { i32, ptr }, ptr %return, i32 0, i32 0, !dbg !7 +// CHECK:STDOUT: %.loc18_30.7.next = getelementptr inbounds nuw { i32, ptr }, ptr %return, i32 0, i32 1, !dbg !7 +// CHECK:STDOUT: store ptr %return, ptr %.loc18_30.7.next, align 8, !dbg !7 // CHECK:STDOUT: ret void, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/struct/member_access.carbon b/toolchain/lower/testdata/struct/member_access.carbon index c617c889b1758..351fd4360aa2b 100644 --- a/toolchain/lower/testdata/struct/member_access.carbon +++ b/toolchain/lower/testdata/struct/member_access.carbon @@ -24,7 +24,7 @@ fn Run() -> i32 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %x.var = alloca { double, i32 }, align 8, !dbg !7 // CHECK:STDOUT: %.loc12_48.2.a = getelementptr inbounds nuw { double, i32 }, ptr %x.var, i32 0, i32 0, !dbg !8 -// CHECK:STDOUT: %.loc12_48.4.b = getelementptr inbounds nuw { double, i32 }, ptr %x.var, i32 0, i32 1, !dbg !8 +// CHECK:STDOUT: %.loc12_48.7.b = getelementptr inbounds nuw { double, i32 }, ptr %x.var, i32 0, i32 1, !dbg !8 // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %x.var, ptr align 8 @struct.loc12_49, i64 16, i1 false), !dbg !9 // CHECK:STDOUT: %y.var = alloca i32, align 4, !dbg !10 // CHECK:STDOUT: %.loc13_17.1.b = getelementptr inbounds nuw { double, i32 }, ptr %x.var, i32 0, i32 1, !dbg !11 diff --git a/toolchain/lower/testdata/struct/two_entries.carbon b/toolchain/lower/testdata/struct/two_entries.carbon index 47a71cb151a36..a6aace7604ee5 100644 --- a/toolchain/lower/testdata/struct/two_entries.carbon +++ b/toolchain/lower/testdata/struct/two_entries.carbon @@ -22,8 +22,8 @@ fn Run() -> i32 { // CHECK:STDOUT: define i32 @main() !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %x.var = alloca { i32, i32 }, align 8, !dbg !7 -// CHECK:STDOUT: %.loc12_46.2.a = getelementptr inbounds nuw { i32, i32 }, ptr %x.var, i32 0, i32 0, !dbg !8 -// CHECK:STDOUT: %.loc12_46.4.b = getelementptr inbounds nuw { i32, i32 }, ptr %x.var, i32 0, i32 1, !dbg !8 +// CHECK:STDOUT: %.loc12_46.5.a = getelementptr inbounds nuw { i32, i32 }, ptr %x.var, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: %.loc12_46.10.b = getelementptr inbounds nuw { i32, i32 }, ptr %x.var, i32 0, i32 1, !dbg !8 // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %x.var, ptr align 4 @struct.loc12_47, i64 8, i1 false), !dbg !9 // CHECK:STDOUT: %y.var = alloca { i32, i32 }, align 8, !dbg !10 // CHECK:STDOUT: %.loc13_31.1.a = getelementptr inbounds nuw { i32, i32 }, ptr %x.var, i32 0, i32 0, !dbg !11 diff --git a/toolchain/lower/testdata/tuple/access/element_access.carbon b/toolchain/lower/testdata/tuple/access/element_access.carbon index f4878f6728ea4..8e8575e3d0f76 100644 --- a/toolchain/lower/testdata/tuple/access/element_access.carbon +++ b/toolchain/lower/testdata/tuple/access/element_access.carbon @@ -23,9 +23,9 @@ fn Run() -> i32 { // CHECK:STDOUT: define i32 @main() !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %a.var = alloca { i32, i32, i32 }, align 8, !dbg !7 -// CHECK:STDOUT: %.loc12_36.2.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 0, !dbg !8 -// CHECK:STDOUT: %.loc12_36.4.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 1, !dbg !8 -// CHECK:STDOUT: %.loc12_36.6.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 2, !dbg !8 +// CHECK:STDOUT: %.loc12_36.5.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: %.loc12_36.10.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 1, !dbg !8 +// CHECK:STDOUT: %.loc12_36.15.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 2, !dbg !8 // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %a.var, ptr align 4 @tuple.loc12_37, i64 12, i1 false), !dbg !9 // CHECK:STDOUT: %b.var = alloca i32, align 4, !dbg !10 // CHECK:STDOUT: %.loc13_17.1.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 0, !dbg !11 diff --git a/toolchain/lower/testdata/tuple/access/return_value_access.carbon b/toolchain/lower/testdata/tuple/access/return_value_access.carbon index fe8042d0dc889..815e8dd7fcf9f 100644 --- a/toolchain/lower/testdata/tuple/access/return_value_access.carbon +++ b/toolchain/lower/testdata/tuple/access/return_value_access.carbon @@ -21,8 +21,8 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: define void @_CF.Main(ptr sret({ i32, i32 }) %return) !dbg !4 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc11_38.2.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 0, !dbg !7 -// CHECK:STDOUT: %.loc11_38.4.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 1, !dbg !7 +// CHECK:STDOUT: %.loc11_38.5.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 0, !dbg !7 +// CHECK:STDOUT: %.loc11_38.10.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 1, !dbg !7 // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @tuple.loc11_39, i64 8, i1 false), !dbg !8 // CHECK:STDOUT: ret void, !dbg !8 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/tuple/two_entries.carbon b/toolchain/lower/testdata/tuple/two_entries.carbon index bbc42fc4e6ea4..3ac2b4a0fa49f 100644 --- a/toolchain/lower/testdata/tuple/two_entries.carbon +++ b/toolchain/lower/testdata/tuple/two_entries.carbon @@ -22,8 +22,8 @@ fn Run() -> i32 { // CHECK:STDOUT: define i32 @main() !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %x.var = alloca { i32, i32 }, align 8, !dbg !7 -// CHECK:STDOUT: %.loc12_29.2.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %x.var, i32 0, i32 0, !dbg !8 -// CHECK:STDOUT: %.loc12_29.4.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %x.var, i32 0, i32 1, !dbg !8 +// CHECK:STDOUT: %.loc12_29.5.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %x.var, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: %.loc12_29.10.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %x.var, i32 0, i32 1, !dbg !8 // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %x.var, ptr align 4 @tuple.loc12_30, i64 8, i1 false), !dbg !9 // CHECK:STDOUT: %y.var = alloca { i32, i32 }, align 8, !dbg !10 // CHECK:STDOUT: %.loc13_23.1.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %x.var, i32 0, i32 0, !dbg !11