diff --git a/core/prelude.carbon b/core/prelude.carbon index 5f4012aa30d5..79ffe4b85d61 100644 --- a/core/prelude.carbon +++ b/core/prelude.carbon @@ -6,6 +6,7 @@ package Core library "prelude"; +export import library "prelude/destroy"; export import library "prelude/iterate"; export import library "prelude/operators"; export import library "prelude/types"; diff --git a/core/prelude/destroy.carbon b/core/prelude/destroy.carbon new file mode 100644 index 000000000000..d8759fc327cb --- /dev/null +++ b/core/prelude/destroy.carbon @@ -0,0 +1,16 @@ +// Part of the Carbon Language project, under the Apache License v2.0 with LLVM +// Exceptions. See /LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +package Core library "prelude/destroy"; + +// Object destruction, including running `fn destroy()`. Note this is distinct +// from memory deallocation. +interface Destroy { + fn Op[self: Self](); +} + +// Provide a default blanket impl for trivial destruction. +impl forall [T:! type] T as Destroy { + fn Op[self: Self]() = "no_op"; +} diff --git a/core/range.carbon b/core/range.carbon index e0601f50e1c4..4e653122c192 100644 --- a/core/range.carbon +++ b/core/range.carbon @@ -7,6 +7,7 @@ package Core library "range"; +import library "prelude/destroy"; import library "prelude/iterate"; import library "prelude/operators/arithmetic"; import library "prelude/operators/as"; diff --git a/toolchain/check/control_flow.cpp b/toolchain/check/control_flow.cpp index 07141d2ad4a6..5c0b2b598d23 100644 --- a/toolchain/check/control_flow.cpp +++ b/toolchain/check/control_flow.cpp @@ -9,8 +9,8 @@ #include "toolchain/base/kind_switch.h" #include "toolchain/check/call.h" #include "toolchain/check/inst.h" -#include "toolchain/check/member_access.h" #include "toolchain/check/name_lookup.h" +#include "toolchain/check/operator.h" #include "toolchain/sem_ir/ids.h" #include "toolchain/sem_ir/typed_insts.h" @@ -137,36 +137,13 @@ auto IsCurrentPositionReachable(Context& context) -> bool { SemIR::TerminatorKind::Terminator; } -auto MaybeAddCleanupForInst(Context& context, SemIR::TypeId type_id, - SemIR::InstId inst_id) -> void { +auto MaybeAddCleanupForInst(Context& context, SemIR::InstId inst_id) -> void { if (!context.scope_stack().IsInFunctionScope()) { // Cleanup can only occur in function scopes. return; } - // TODO: Add destruction of members of ArrayType, StructType, and - // TupleType. Includes refactoring MaybeAddCleanupForInst to remain - // non-recursive. - - auto type_inst = context.types().GetAsInst(type_id); - CARBON_KIND_SWITCH(type_inst) { - case SemIR::ClassType::Kind: { - // TODO: Figure out what destruction of classes with destroyable members - // should look like (maybe an implicit `fn destroy` added by - // `handle_class.cpp`?). - auto destroy_id = - PerformMemberAccess(context, SemIR::LocId::None, inst_id, - SemIR::NameId::Destroy, /*required=*/false); - if (destroy_id.has_value()) { - context.scope_stack().destroy_id_stack().AppendToTop(destroy_id); - } - break; - } - - default: - // Not interesting storage for destruction. - return; - } + context.scope_stack().destroy_id_stack().AppendToTop(inst_id); } // Common support for cleanup blocks. @@ -180,7 +157,11 @@ static auto AddCleanupBlock(Context& context) -> void { } for (auto destroy_id : llvm::reverse(destroy_ids)) { - PerformCall(context, SemIR::LocId::None, destroy_id, {}); + // TODO: This does the `Destroy` lookup and call at every cleanup block. + // Control flow can lead to the same variable being destroyed by multiple + // cleanup blocks, so we'll want to avoid this in the future. + BuildUnaryOperator(context, SemIR::LocId(destroy_id), + {.interface_name = "Destroy"}, destroy_id); } } diff --git a/toolchain/check/control_flow.h b/toolchain/check/control_flow.h index e51f32f588ff..6f1796085c06 100644 --- a/toolchain/check/control_flow.h +++ b/toolchain/check/control_flow.h @@ -67,8 +67,7 @@ auto IsCurrentPositionReachable(Context& context) -> bool; // Determines whether the instruction requires cleanup and, if so, adds it for // cleanup blocks. Note for example that a class may not need destruction when // neither it nor its members have `destroy` functions. -auto MaybeAddCleanupForInst(Context& context, SemIR::TypeId type_id, - SemIR::InstId inst_id) -> void; +auto MaybeAddCleanupForInst(Context& context, SemIR::InstId inst_id) -> void; // Adds an instruction that has cleanup associated. template @@ -76,7 +75,7 @@ template auto AddInstWithCleanup(Context& context, LocT loc, InstT inst) -> SemIR::InstId { auto inst_id = AddInst(context, SemIR::LocIdAndInst(loc, inst)); - MaybeAddCleanupForInst(context, inst.type_id, inst_id); + MaybeAddCleanupForInst(context, inst_id); return inst_id; } @@ -86,7 +85,7 @@ template auto AddInstWithCleanupInNoBlock(Context& context, LocT loc, InstT inst) -> SemIR::InstId { auto inst_id = AddInstInNoBlock(context, SemIR::LocIdAndInst(loc, inst)); - MaybeAddCleanupForInst(context, inst.type_id, inst_id); + MaybeAddCleanupForInst(context, inst_id); return inst_id; } diff --git a/toolchain/check/eval_inst.cpp b/toolchain/check/eval_inst.cpp index 727b852a97ae..d84bbd1d6b6f 100644 --- a/toolchain/check/eval_inst.cpp +++ b/toolchain/check/eval_inst.cpp @@ -17,6 +17,7 @@ #include "toolchain/check/type_completion.h" #include "toolchain/diagnostics/diagnostic.h" #include "toolchain/parse/typed_nodes.h" +#include "toolchain/sem_ir/builtin_function_kind.h" #include "toolchain/sem_ir/expr_info.h" #include "toolchain/sem_ir/ids.h" #include "toolchain/sem_ir/pattern.h" @@ -484,8 +485,12 @@ auto EvalConstantInst(Context& context, SemIR::InstId inst_id, auto EvalConstantInst(Context& context, SemIR::InstId inst_id, SemIR::SpecificFunction inst) -> ConstantEvalResult { - if (!SemIR::GetCalleeFunction(context.sem_ir(), inst.callee_id) - .self_type_id.has_value()) { + if (auto callee_function = + SemIR::GetCalleeFunction(context.sem_ir(), inst.callee_id); + !callee_function.self_type_id.has_value() && + context.functions() + .Get(callee_function.function_id) + .builtin_function_kind() != SemIR::BuiltinFunctionKind::NoOp) { // This is not an associated function. Those will be required to be defined // as part of checking that the impl is complete. context.definitions_required_by_use().push_back( diff --git a/toolchain/check/testdata/array/basics.carbon b/toolchain/check/testdata/array/basics.carbon index 7c4fb050f8c4..bfd4aee059a1 100644 --- a/toolchain/check/testdata/array/basics.carbon +++ b/toolchain/check/testdata/array/basics.carbon @@ -172,6 +172,7 @@ var a: array(1, 1); // CHECK:STDOUT: %tuple.type.ff9: type = tuple_type (type, type, type) [concrete] // CHECK:STDOUT: %tuple.type.734: type = tuple_type (%C, %C, %C) [concrete] // CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete] // CHECK:STDOUT: %array_type: type = array_type %int_2, %tuple.type.734 [concrete] @@ -179,9 +180,28 @@ var a: array(1, 1); // CHECK:STDOUT: %tuple.type.14a: type = tuple_type (%tuple.type.734, %tuple.type.734) [concrete] // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.66a: = impl_witness imports.%Destroy.impl_witness_table, @impl(%tuple.type.734) [concrete] +// CHECK:STDOUT: %Op.type.fe9: type = fn_type @Op.2, @impl(%tuple.type.734) [concrete] +// CHECK:STDOUT: %Op.ae1: %Op.type.fe9 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.829: %Destroy.type = facet_value %tuple.type.734, (%Destroy.impl_witness.66a) [concrete] +// CHECK:STDOUT: %.e31: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.829 [concrete] +// CHECK:STDOUT: %Op.specific_fn.80d: = specific_function %Op.ae1, @Op.2(%tuple.type.734) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.9e1: = impl_witness imports.%Destroy.impl_witness_table, @impl(%array_type) [concrete] +// CHECK:STDOUT: %Op.type.280: type = fn_type @Op.2, @impl(%array_type) [concrete] +// CHECK:STDOUT: %Op.d4f: %Op.type.280 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.d8f: %Destroy.type = facet_value %array_type, (%Destroy.impl_witness.9e1) [concrete] +// CHECK:STDOUT: %.b1e: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.d8f [concrete] +// CHECK:STDOUT: %Op.specific_fn.04c: = specific_function %Op.d4f, @Op.2(%array_type) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G() { @@ -205,8 +225,8 @@ var a: array(1, 1); // CHECK:STDOUT: %F.call.loc10_40: init %tuple.type.734 = call %F.ref.loc10_38() to %.loc10_41.3 // CHECK:STDOUT: %.loc10_41.5: %tuple.type.14a = tuple_literal (%F.call.loc10_35, %F.call.loc10_40) // CHECK:STDOUT: %.loc10_41.6: init %array_type = array_init (%F.call.loc10_35, %F.call.loc10_40) to %v.var -// CHECK:STDOUT: %.loc10_3: init %array_type = converted %.loc10_41.5, %.loc10_41.6 -// CHECK:STDOUT: assign %v.var, %.loc10_3 +// CHECK:STDOUT: %.loc10_3.1: init %array_type = converted %.loc10_41.5, %.loc10_41.6 +// CHECK:STDOUT: assign %v.var, %.loc10_3.1 // CHECK:STDOUT: %.loc10_28: type = splice_block %array_type [concrete = constants.%array_type] { // CHECK:STDOUT: %C.ref.loc10_17: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %C.ref.loc10_20: type = name_ref C, file.%C.decl [concrete = constants.%C] @@ -217,6 +237,38 @@ var a: array(1, 1); // CHECK:STDOUT: %array_type: type = array_type %int_2, %.loc10_24.2 [concrete = constants.%array_type] // CHECK:STDOUT: } // CHECK:STDOUT: %v: ref %array_type = bind_name v, %v.var +// CHECK:STDOUT: %impl.elem0.loc10_41.1: %.e31 = impl_witness_access constants.%Destroy.impl_witness.66a, element0 [concrete = constants.%Op.ae1] +// CHECK:STDOUT: %bound_method.loc10_41.1: = bound_method %.loc10_41.3, %impl.elem0.loc10_41.1 +// CHECK:STDOUT: %specific_fn.loc10_41.1: = specific_function %impl.elem0.loc10_41.1, @Op.2(constants.%tuple.type.734) [concrete = constants.%Op.specific_fn.80d] +// CHECK:STDOUT: %bound_method.loc10_41.2: = bound_method %.loc10_41.3, %specific_fn.loc10_41.1 +// CHECK:STDOUT: %tuple.elem0.loc10_41.1: ref %C = tuple_access %.loc10_41.3, element0 +// CHECK:STDOUT: %.loc10_41.7: %C = bind_value %tuple.elem0.loc10_41.1 +// CHECK:STDOUT: %tuple.elem1.loc10_41.1: ref %C = tuple_access %.loc10_41.3, element1 +// CHECK:STDOUT: %.loc10_41.8: %C = bind_value %tuple.elem1.loc10_41.1 +// CHECK:STDOUT: %tuple.elem2.loc10_41.1: ref %C = tuple_access %.loc10_41.3, element2 +// CHECK:STDOUT: %.loc10_41.9: %C = bind_value %tuple.elem2.loc10_41.1 +// CHECK:STDOUT: %tuple.loc10_41.1: %tuple.type.734 = tuple_value (%.loc10_41.7, %.loc10_41.8, %.loc10_41.9) +// CHECK:STDOUT: %.loc10_41.10: %tuple.type.734 = converted %.loc10_41.3, %tuple.loc10_41.1 +// CHECK:STDOUT: %no_op.loc10_41.1: init %empty_tuple.type = call %bound_method.loc10_41.2(%.loc10_41.10) +// CHECK:STDOUT: %impl.elem0.loc10_41.2: %.e31 = impl_witness_access constants.%Destroy.impl_witness.66a, element0 [concrete = constants.%Op.ae1] +// CHECK:STDOUT: %bound_method.loc10_41.3: = bound_method %.loc10_41.1, %impl.elem0.loc10_41.2 +// CHECK:STDOUT: %specific_fn.loc10_41.2: = specific_function %impl.elem0.loc10_41.2, @Op.2(constants.%tuple.type.734) [concrete = constants.%Op.specific_fn.80d] +// CHECK:STDOUT: %bound_method.loc10_41.4: = bound_method %.loc10_41.1, %specific_fn.loc10_41.2 +// CHECK:STDOUT: %tuple.elem0.loc10_41.2: ref %C = tuple_access %.loc10_41.1, element0 +// CHECK:STDOUT: %.loc10_41.11: %C = bind_value %tuple.elem0.loc10_41.2 +// CHECK:STDOUT: %tuple.elem1.loc10_41.2: ref %C = tuple_access %.loc10_41.1, element1 +// CHECK:STDOUT: %.loc10_41.12: %C = bind_value %tuple.elem1.loc10_41.2 +// CHECK:STDOUT: %tuple.elem2.loc10_41.2: ref %C = tuple_access %.loc10_41.1, element2 +// CHECK:STDOUT: %.loc10_41.13: %C = bind_value %tuple.elem2.loc10_41.2 +// CHECK:STDOUT: %tuple.loc10_41.2: %tuple.type.734 = tuple_value (%.loc10_41.11, %.loc10_41.12, %.loc10_41.13) +// CHECK:STDOUT: %.loc10_41.14: %tuple.type.734 = converted %.loc10_41.1, %tuple.loc10_41.2 +// CHECK:STDOUT: %no_op.loc10_41.2: init %empty_tuple.type = call %bound_method.loc10_41.4(%.loc10_41.14) +// CHECK:STDOUT: %impl.elem0.loc10_3: %.b1e = impl_witness_access constants.%Destroy.impl_witness.9e1, element0 [concrete = constants.%Op.d4f] +// CHECK:STDOUT: %bound_method.loc10_3.1: = bound_method %v.var, %impl.elem0.loc10_3 +// CHECK:STDOUT: %specific_fn.loc10_3: = specific_function %impl.elem0.loc10_3, @Op.2(constants.%array_type) [concrete = constants.%Op.specific_fn.04c] +// CHECK:STDOUT: %bound_method.loc10_3.2: = bound_method %v.var, %specific_fn.loc10_3 +// CHECK:STDOUT: %.loc10_3.2: %array_type = bind_value %v.var +// CHECK:STDOUT: %no_op.loc10_3: init %empty_tuple.type = call %bound_method.loc10_3.2(%.loc10_3.2) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -229,9 +281,30 @@ var a: array(1, 1); // CHECK:STDOUT: %pattern_type.035: type = pattern_type %array_type [concrete] // CHECK:STDOUT: %tuple.type: type = tuple_type (%empty_tuple.type, %empty_tuple.type, %empty_tuple.type) [concrete] // CHECK:STDOUT: %pattern_type.8c1: type = pattern_type %tuple.type [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.5b3: = impl_witness imports.%Destroy.impl_witness_table, @impl(%tuple.type) [concrete] +// CHECK:STDOUT: %Op.type.073: type = fn_type @Op.2, @impl(%tuple.type) [concrete] +// CHECK:STDOUT: %Op.dce: %Op.type.073 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.d28: %Destroy.type = facet_value %tuple.type, (%Destroy.impl_witness.5b3) [concrete] +// CHECK:STDOUT: %.886: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.d28 [concrete] +// CHECK:STDOUT: %Op.specific_fn.234: = specific_function %Op.dce, @Op.2(%tuple.type) [concrete] +// CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] +// CHECK:STDOUT: %tuple: %tuple.type = tuple_value (%empty_tuple, %empty_tuple, %empty_tuple) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.287: = impl_witness imports.%Destroy.impl_witness_table, @impl(%array_type) [concrete] +// CHECK:STDOUT: %Op.type.c60: type = fn_type @Op.2, @impl(%array_type) [concrete] +// CHECK:STDOUT: %Op.f81: %Op.type.c60 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.409: %Destroy.type = facet_value %array_type, (%Destroy.impl_witness.287) [concrete] +// CHECK:STDOUT: %.b3c: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.409 [concrete] +// CHECK:STDOUT: %Op.specific_fn.29c: = specific_function %Op.f81, @Op.2(%array_type) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G() { @@ -264,6 +337,28 @@ var a: array(1, 1); // CHECK:STDOUT: %.loc8_21.6: type = converted %.loc8_21.2, constants.%tuple.type [concrete = constants.%tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %b: ref %tuple.type = bind_name b, %b.var +// CHECK:STDOUT: %impl.elem0.loc8: %.886 = impl_witness_access constants.%Destroy.impl_witness.5b3, element0 [concrete = constants.%Op.dce] +// CHECK:STDOUT: %bound_method.loc8_3.1: = bound_method %b.var, %impl.elem0.loc8 +// CHECK:STDOUT: %specific_fn.loc8: = specific_function %impl.elem0.loc8, @Op.2(constants.%tuple.type) [concrete = constants.%Op.specific_fn.234] +// CHECK:STDOUT: %bound_method.loc8_3.2: = bound_method %b.var, %specific_fn.loc8 +// CHECK:STDOUT: %tuple.elem0: ref %empty_tuple.type = tuple_access %b.var, element0 +// CHECK:STDOUT: %tuple.loc8_3.1: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_3.1: %empty_tuple.type = converted %tuple.elem0, %tuple.loc8_3.1 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %tuple.elem1: ref %empty_tuple.type = tuple_access %b.var, element1 +// CHECK:STDOUT: %tuple.loc8_3.2: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_3.2: %empty_tuple.type = converted %tuple.elem1, %tuple.loc8_3.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %tuple.elem2: ref %empty_tuple.type = tuple_access %b.var, element2 +// CHECK:STDOUT: %tuple.loc8_3.3: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_3.3: %empty_tuple.type = converted %tuple.elem2, %tuple.loc8_3.3 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %tuple.loc8_3.4: %tuple.type = tuple_value (%.loc8_3.1, %.loc8_3.2, %.loc8_3.3) [concrete = constants.%tuple] +// CHECK:STDOUT: %.loc8_3.4: %tuple.type = converted %b.var, %tuple.loc8_3.4 [concrete = constants.%tuple] +// CHECK:STDOUT: %no_op.loc8: init %empty_tuple.type = call %bound_method.loc8_3.2(%.loc8_3.4) +// CHECK:STDOUT: %impl.elem0.loc7: %.b3c = impl_witness_access constants.%Destroy.impl_witness.287, element0 [concrete = constants.%Op.f81] +// CHECK:STDOUT: %bound_method.loc7_3.1: = bound_method %a.var, %impl.elem0.loc7 +// CHECK:STDOUT: %specific_fn.loc7: = specific_function %impl.elem0.loc7, @Op.2(constants.%array_type) [concrete = constants.%Op.specific_fn.29c] +// CHECK:STDOUT: %bound_method.loc7_3.2: = bound_method %a.var, %specific_fn.loc7 +// CHECK:STDOUT: %.loc7_3: %array_type = bind_value %a.var +// CHECK:STDOUT: %no_op.loc7: init %empty_tuple.type = call %bound_method.loc7_3.2(%.loc7_3) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -275,14 +370,34 @@ var a: array(1, 1); // CHECK:STDOUT: %F.type: type = fn_type @F [concrete] // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] +// CHECK:STDOUT: %tuple: %tuple.type = tuple_value (%empty_tuple) [concrete] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete] // CHECK:STDOUT: %array_type: type = array_type %int_1, %empty_tuple.type [concrete] // CHECK:STDOUT: %pattern_type.fe8: type = pattern_type %array_type [concrete] // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete] // CHECK:STDOUT: %array: %array_type = tuple_value (%empty_tuple) [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.511: = impl_witness imports.%Destroy.impl_witness_table, @impl(%tuple.type) [concrete] +// CHECK:STDOUT: %Op.type.23e: type = fn_type @Op.2, @impl(%tuple.type) [concrete] +// CHECK:STDOUT: %Op.f19: %Op.type.23e = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.108: %Destroy.type = facet_value %tuple.type, (%Destroy.impl_witness.511) [concrete] +// CHECK:STDOUT: %.2cd: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.108 [concrete] +// CHECK:STDOUT: %Op.specific_fn.d2b: = specific_function %Op.f19, @Op.2(%tuple.type) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.740: = impl_witness imports.%Destroy.impl_witness_table, @impl(%array_type) [concrete] +// CHECK:STDOUT: %Op.type.471: type = fn_type @Op.2, @impl(%array_type) [concrete] +// CHECK:STDOUT: %Op.688: %Op.type.471 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.682: %Destroy.type = facet_value %array_type, (%Destroy.impl_witness.740) [concrete] +// CHECK:STDOUT: %.0ab: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.682 [concrete] +// CHECK:STDOUT: %Op.specific_fn.cae: = specific_function %Op.688, @Op.2(%array_type) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { @@ -296,14 +411,14 @@ var a: array(1, 1); // CHECK:STDOUT: %F.call: init %tuple.type = call %F.ref() // CHECK:STDOUT: %.loc8_27.1: ref %tuple.type = temporary_storage // CHECK:STDOUT: %.loc8_27.2: ref %tuple.type = temporary %.loc8_27.1, %F.call -// CHECK:STDOUT: %tuple.elem0: ref %empty_tuple.type = tuple_access %.loc8_27.2, element0 +// CHECK:STDOUT: %tuple.elem0.loc8_27.1: ref %empty_tuple.type = tuple_access %.loc8_27.2, element0 // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] // CHECK:STDOUT: %.loc8_27.3: ref %empty_tuple.type = array_index %t.var, %int_0 // CHECK:STDOUT: %.loc8_27.4: init %empty_tuple.type = tuple_init () to %.loc8_27.3 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_27.5: init %empty_tuple.type = converted %tuple.elem0, %.loc8_27.4 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_27.5: init %empty_tuple.type = converted %tuple.elem0.loc8_27.1, %.loc8_27.4 [concrete = constants.%empty_tuple] // CHECK:STDOUT: %.loc8_27.6: init %array_type = array_init (%.loc8_27.5) to %t.var [concrete = constants.%array] -// CHECK:STDOUT: %.loc8_3: init %array_type = converted %F.call, %.loc8_27.6 [concrete = constants.%array] -// CHECK:STDOUT: assign %t.var, %.loc8_3 +// CHECK:STDOUT: %.loc8_3.1: init %array_type = converted %F.call, %.loc8_27.6 [concrete = constants.%array] +// CHECK:STDOUT: assign %t.var, %.loc8_3.1 // CHECK:STDOUT: %.loc8_21: type = splice_block %array_type [concrete = constants.%array_type] { // CHECK:STDOUT: %.loc8_17.1: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] @@ -311,6 +426,22 @@ var a: array(1, 1); // CHECK:STDOUT: %array_type: type = array_type %int_1, %.loc8_17.2 [concrete = constants.%array_type] // CHECK:STDOUT: } // CHECK:STDOUT: %t: ref %array_type = bind_name t, %t.var +// CHECK:STDOUT: %impl.elem0.loc8_27: %.2cd = impl_witness_access constants.%Destroy.impl_witness.511, element0 [concrete = constants.%Op.f19] +// CHECK:STDOUT: %bound_method.loc8_27.1: = bound_method %.loc8_27.1, %impl.elem0.loc8_27 +// CHECK:STDOUT: %specific_fn.loc8_27: = specific_function %impl.elem0.loc8_27, @Op.2(constants.%tuple.type) [concrete = constants.%Op.specific_fn.d2b] +// CHECK:STDOUT: %bound_method.loc8_27.2: = bound_method %.loc8_27.1, %specific_fn.loc8_27 +// CHECK:STDOUT: %tuple.elem0.loc8_27.2: ref %empty_tuple.type = tuple_access %.loc8_27.1, element0 +// CHECK:STDOUT: %tuple.loc8_27.1: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_27.7: %empty_tuple.type = converted %tuple.elem0.loc8_27.2, %tuple.loc8_27.1 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %tuple.loc8_27.2: %tuple.type = tuple_value (%.loc8_27.7) [concrete = constants.%tuple] +// CHECK:STDOUT: %.loc8_27.8: %tuple.type = converted %.loc8_27.1, %tuple.loc8_27.2 [concrete = constants.%tuple] +// CHECK:STDOUT: %no_op.loc8_27: init %empty_tuple.type = call %bound_method.loc8_27.2(%.loc8_27.8) +// CHECK:STDOUT: %impl.elem0.loc8_3: %.0ab = impl_witness_access constants.%Destroy.impl_witness.740, element0 [concrete = constants.%Op.688] +// CHECK:STDOUT: %bound_method.loc8_3.1: = bound_method %t.var, %impl.elem0.loc8_3 +// CHECK:STDOUT: %specific_fn.loc8_3: = specific_function %impl.elem0.loc8_3, @Op.2(constants.%array_type) [concrete = constants.%Op.specific_fn.cae] +// CHECK:STDOUT: %bound_method.loc8_3.2: = bound_method %t.var, %specific_fn.loc8_3 +// CHECK:STDOUT: %.loc8_3.2: %array_type = bind_value %t.var +// CHECK:STDOUT: %no_op.loc8_3: init %empty_tuple.type = call %bound_method.loc8_3.2(%.loc8_3.2) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/array/init_dependent_bound.carbon b/toolchain/check/testdata/array/init_dependent_bound.carbon index 1a21cda7ec56..cc6ddcfceaac 100644 --- a/toolchain/check/testdata/array/init_dependent_bound.carbon +++ b/toolchain/check/testdata/array/init_dependent_bound.carbon @@ -63,17 +63,34 @@ fn H() { G(3); } // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete] // CHECK:STDOUT: %array_type.281: type = array_type %int_0, %T [symbolic] -// CHECK:STDOUT: %require_complete: = require_complete_type %array_type.281 [symbolic] +// CHECK:STDOUT: %require_complete.b7f: = require_complete_type %array_type.281 [symbolic] // CHECK:STDOUT: %pattern_type.d48: type = pattern_type %array_type.281 [symbolic] // CHECK:STDOUT: %array.2ed: %array_type.281 = tuple_value () [symbolic] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %array_type.281, @Destroy [symbolic] +// CHECK:STDOUT: %Destroy.facet.cdc: %Destroy.type = facet_value %array_type.281, (%Destroy.lookup_impl_witness) [symbolic] +// CHECK:STDOUT: %.77e: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.cdc [symbolic] +// CHECK:STDOUT: %impl.elem0: %.77e = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic] +// CHECK:STDOUT: %specific_impl_fn: = specific_impl_function %impl.elem0, @Op.1(%Destroy.facet.cdc) [symbolic] // CHECK:STDOUT: %C: type = class_type @C [concrete] // CHECK:STDOUT: %array_type.6f1: type = array_type %int_0, %C [concrete] // CHECK:STDOUT: %complete_type.ed6: = complete_type_witness %array_type.6f1 [concrete] // CHECK:STDOUT: %pattern_type.9c8: type = pattern_type %array_type.6f1 [concrete] // CHECK:STDOUT: %array.2e5: %array_type.6f1 = tuple_value () [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.8b8: = impl_witness imports.%Destroy.impl_witness_table, @impl(%array_type.6f1) [concrete] +// CHECK:STDOUT: %Op.type.a3e: type = fn_type @Op.2, @impl(%array_type.6f1) [concrete] +// CHECK:STDOUT: %Op.dc5: %Op.type.a3e = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.da7: %Destroy.type = facet_value %array_type.6f1, (%Destroy.impl_witness.8b8) [concrete] +// CHECK:STDOUT: %.a21: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.da7 [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.dc5, @Op.2(%array_type.6f1) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @G(%T.loc4_6.1: type) { @@ -81,9 +98,14 @@ fn H() { G(3); } // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %array_type.loc7_22.2: type = array_type constants.%int_0, %T.loc4_6.2 [symbolic = %array_type.loc7_22.2 (constants.%array_type.281)] -// CHECK:STDOUT: %require_complete: = require_complete_type %array_type.loc7_22.2 [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %require_complete: = require_complete_type %array_type.loc7_22.2 [symbolic = %require_complete (constants.%require_complete.b7f)] // CHECK:STDOUT: %pattern_type: type = pattern_type %array_type.loc7_22.2 [symbolic = %pattern_type (constants.%pattern_type.d48)] // CHECK:STDOUT: %array: @G.%array_type.loc7_22.2 (%array_type.281) = tuple_value () [symbolic = %array (constants.%array.2ed)] +// CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %array_type.loc7_22.2, @Destroy [symbolic = %Destroy.lookup_impl_witness (constants.%Destroy.lookup_impl_witness)] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %array_type.loc7_22.2, (%Destroy.lookup_impl_witness) [symbolic = %Destroy.facet (constants.%Destroy.facet.cdc)] +// CHECK:STDOUT: %.loc7_3.4: type = fn_type_with_self_type constants.%Op.type.bae, %Destroy.facet [symbolic = %.loc7_3.4 (constants.%.77e)] +// CHECK:STDOUT: %impl.elem0.loc7_3.2: @G.%.loc7_3.4 (%.77e) = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc7_3.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %specific_impl_fn.loc7_3.2: = specific_impl_function %impl.elem0.loc7_3.2, @Op.1(%Destroy.facet) [symbolic = %specific_impl_fn.loc7_3.2 (constants.%specific_impl_fn)] // CHECK:STDOUT: // CHECK:STDOUT: fn() { // CHECK:STDOUT: !entry: @@ -94,14 +116,20 @@ fn H() { G(3); } // CHECK:STDOUT: %arr.var: ref @G.%array_type.loc7_22.2 (%array_type.281) = var %arr.var_patt // CHECK:STDOUT: %.loc7_27.1: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc7_27.2: init @G.%array_type.loc7_22.2 (%array_type.281) = array_init () to %arr.var [symbolic = %array (constants.%array.2ed)] -// CHECK:STDOUT: %.loc7_3: init @G.%array_type.loc7_22.2 (%array_type.281) = converted %.loc7_27.1, %.loc7_27.2 [symbolic = %array (constants.%array.2ed)] -// CHECK:STDOUT: assign %arr.var, %.loc7_3 +// CHECK:STDOUT: %.loc7_3.1: init @G.%array_type.loc7_22.2 (%array_type.281) = converted %.loc7_27.1, %.loc7_27.2 [symbolic = %array (constants.%array.2ed)] +// CHECK:STDOUT: assign %arr.var, %.loc7_3.1 // CHECK:STDOUT: %.loc7_22: type = splice_block %array_type.loc7_22.1 [symbolic = %array_type.loc7_22.2 (constants.%array_type.281)] { // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc4_6.1 [symbolic = %T.loc4_6.2 (constants.%T)] // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] // CHECK:STDOUT: %array_type.loc7_22.1: type = array_type %int_0, %T.ref [symbolic = %array_type.loc7_22.2 (constants.%array_type.281)] // CHECK:STDOUT: } // CHECK:STDOUT: %arr: ref @G.%array_type.loc7_22.2 (%array_type.281) = bind_name arr, %arr.var +// CHECK:STDOUT: %impl.elem0.loc7_3.1: @G.%.loc7_3.4 (%.77e) = impl_witness_access constants.%Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc7_3.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %bound_method.loc7_3.1: = bound_method %arr.var, %impl.elem0.loc7_3.1 +// CHECK:STDOUT: %specific_impl_fn.loc7_3.1: = specific_impl_function %impl.elem0.loc7_3.1, @Op.1(constants.%Destroy.facet.cdc) [symbolic = %specific_impl_fn.loc7_3.2 (constants.%specific_impl_fn)] +// CHECK:STDOUT: %bound_method.loc7_3.2: = bound_method %arr.var, %specific_impl_fn.loc7_3.1 +// CHECK:STDOUT: %.loc7_3.2: @G.%array_type.loc7_22.2 (%array_type.281) = bind_value %arr.var +// CHECK:STDOUT: %.loc7_3.3: init %empty_tuple.type = call %bound_method.loc7_3.2(%.loc7_3.2) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -118,6 +146,11 @@ fn H() { G(3); } // CHECK:STDOUT: %require_complete => constants.%complete_type.ed6 // CHECK:STDOUT: %pattern_type => constants.%pattern_type.9c8 // CHECK:STDOUT: %array => constants.%array.2e5 +// CHECK:STDOUT: %Destroy.lookup_impl_witness => constants.%Destroy.impl_witness.8b8 +// CHECK:STDOUT: %Destroy.facet => constants.%Destroy.facet.da7 +// CHECK:STDOUT: %.loc7_3.4 => constants.%.a21 +// CHECK:STDOUT: %impl.elem0.loc7_3.2 => constants.%Op.dc5 +// CHECK:STDOUT: %specific_impl_fn.loc7_3.2 => constants.%Op.specific_fn // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_todo_init_template_dependent_bound.carbon @@ -182,6 +215,7 @@ fn H() { G(3); } // CHECK:STDOUT: assign %arr.var, // CHECK:STDOUT: // CHECK:STDOUT: %arr: = bind_name arr, [concrete = ] +// CHECK:STDOUT: %impl.elem0: = impl_witness_access , element0 [concrete = ] // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/as/basics.carbon b/toolchain/check/testdata/as/basics.carbon index 6324e5964c08..23e984fcc4ba 100644 --- a/toolchain/check/testdata/as/basics.carbon +++ b/toolchain/check/testdata/as/basics.carbon @@ -204,13 +204,33 @@ let n: {.x: ()} = {.x = ()} as {.x = ()}; // CHECK:STDOUT: constants { // CHECK:STDOUT: %X: type = class_type @X [concrete] // CHECK:STDOUT: %Make.type: type = fn_type @Make [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Make: %Make.type = struct_value () [concrete] // CHECK:STDOUT: %tuple.type.24b: type = tuple_type (type, type) [concrete] // CHECK:STDOUT: %tuple.type.b67: type = tuple_type (%X, %X) [concrete] // CHECK:STDOUT: %pattern_type.bb7: type = pattern_type %tuple.type.b67 [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.599: = impl_witness imports.%Destroy.impl_witness_table, @impl(%X) [concrete] +// CHECK:STDOUT: %Op.type.9e1: type = fn_type @Op.2, @impl(%X) [concrete] +// CHECK:STDOUT: %Op.33a: %Op.type.9e1 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.177: %Destroy.type = facet_value %X, (%Destroy.impl_witness.599) [concrete] +// CHECK:STDOUT: %.bfc: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.177 [concrete] +// CHECK:STDOUT: %Op.specific_fn.d1f: = specific_function %Op.33a, @Op.2(%X) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.543: = impl_witness imports.%Destroy.impl_witness_table, @impl(%tuple.type.b67) [concrete] +// CHECK:STDOUT: %Op.type.df3: type = fn_type @Op.2, @impl(%tuple.type.b67) [concrete] +// CHECK:STDOUT: %Op.279: %Op.type.df3 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.54c: %Destroy.type = facet_value %tuple.type.b67, (%Destroy.impl_witness.543) [concrete] +// CHECK:STDOUT: %.fdd: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.54c [concrete] +// CHECK:STDOUT: %Op.specific_fn.837: = specific_function %Op.279, @Op.2(%tuple.type.b67) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Let() { @@ -242,6 +262,18 @@ let n: {.x: ()} = {.x = ()} as {.x = ()}; // CHECK:STDOUT: %tuple: %tuple.type.b67 = tuple_value (%.loc13_25.3, %.loc13_33.3) // CHECK:STDOUT: %.loc13_34.2: %tuple.type.b67 = converted %.loc13_34.1, %tuple // CHECK:STDOUT: %a: %tuple.type.b67 = bind_name a, %.loc13_34.2 +// CHECK:STDOUT: %impl.elem0.loc13_33: %.bfc = impl_witness_access constants.%Destroy.impl_witness.599, element0 [concrete = constants.%Op.33a] +// CHECK:STDOUT: %bound_method.loc13_33.1: = bound_method %.loc13_33.1, %impl.elem0.loc13_33 +// CHECK:STDOUT: %specific_fn.loc13_33: = specific_function %impl.elem0.loc13_33, @Op.2(constants.%X) [concrete = constants.%Op.specific_fn.d1f] +// CHECK:STDOUT: %bound_method.loc13_33.2: = bound_method %.loc13_33.1, %specific_fn.loc13_33 +// CHECK:STDOUT: %.loc13_33.4: %X = bind_value %.loc13_33.1 +// CHECK:STDOUT: %no_op.loc13_33: init %empty_tuple.type = call %bound_method.loc13_33.2(%.loc13_33.4) +// CHECK:STDOUT: %impl.elem0.loc13_25: %.bfc = impl_witness_access constants.%Destroy.impl_witness.599, element0 [concrete = constants.%Op.33a] +// CHECK:STDOUT: %bound_method.loc13_25.1: = bound_method %.loc13_25.1, %impl.elem0.loc13_25 +// CHECK:STDOUT: %specific_fn.loc13_25: = specific_function %impl.elem0.loc13_25, @Op.2(constants.%X) [concrete = constants.%Op.specific_fn.d1f] +// CHECK:STDOUT: %bound_method.loc13_25.2: = bound_method %.loc13_25.1, %specific_fn.loc13_25 +// CHECK:STDOUT: %.loc13_25.4: %X = bind_value %.loc13_25.1 +// CHECK:STDOUT: %no_op.loc13_25: init %empty_tuple.type = call %bound_method.loc13_25.2(%.loc13_25.4) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -253,19 +285,19 @@ let n: {.x: ()} = {.x = ()} as {.x = ()}; // CHECK:STDOUT: } // CHECK:STDOUT: %b.var: ref %tuple.type.b67 = var %b.var_patt // CHECK:STDOUT: %Make.ref.loc20_20: %Make.type = name_ref Make, file.%Make.decl [concrete = constants.%Make] -// CHECK:STDOUT: %tuple.elem0: ref %X = tuple_access %b.var, element0 -// CHECK:STDOUT: %Make.call.loc20_25: init %X = call %Make.ref.loc20_20() to %tuple.elem0 +// CHECK:STDOUT: %tuple.elem0.loc20_34: ref %X = tuple_access %b.var, element0 +// CHECK:STDOUT: %Make.call.loc20_25: init %X = call %Make.ref.loc20_20() to %tuple.elem0.loc20_34 // CHECK:STDOUT: %Make.ref.loc20_28: %Make.type = name_ref Make, file.%Make.decl [concrete = constants.%Make] -// CHECK:STDOUT: %tuple.elem1: ref %X = tuple_access %b.var, element1 -// CHECK:STDOUT: %Make.call.loc20_33: init %X = call %Make.ref.loc20_28() to %tuple.elem1 +// CHECK:STDOUT: %tuple.elem1.loc20_34: ref %X = tuple_access %b.var, element1 +// CHECK:STDOUT: %Make.call.loc20_33: init %X = call %Make.ref.loc20_28() to %tuple.elem1.loc20_34 // CHECK:STDOUT: %.loc20_34.1: %tuple.type.b67 = tuple_literal (%Make.call.loc20_25, %Make.call.loc20_33) // CHECK:STDOUT: %X.ref.loc20_40: type = name_ref X, file.%X.decl [concrete = constants.%X] // CHECK:STDOUT: %X.ref.loc20_43: type = name_ref X, file.%X.decl [concrete = constants.%X] // CHECK:STDOUT: %.loc20_44.1: %tuple.type.24b = tuple_literal (%X.ref.loc20_40, %X.ref.loc20_43) // CHECK:STDOUT: %.loc20_44.2: type = converted %.loc20_44.1, constants.%tuple.type.b67 [concrete = constants.%tuple.type.b67] // CHECK:STDOUT: %.loc20_34.2: init %tuple.type.b67 = tuple_init (%Make.call.loc20_25, %Make.call.loc20_33) to %b.var -// CHECK:STDOUT: %.loc20_3: init %tuple.type.b67 = converted %.loc20_34.1, %.loc20_34.2 -// CHECK:STDOUT: assign %b.var, %.loc20_3 +// CHECK:STDOUT: %.loc20_3.1: init %tuple.type.b67 = converted %.loc20_34.1, %.loc20_34.2 +// CHECK:STDOUT: assign %b.var, %.loc20_3.1 // CHECK:STDOUT: %.loc20_15.1: type = splice_block %.loc20_15.3 [concrete = constants.%tuple.type.b67] { // CHECK:STDOUT: %X.ref.loc20_11: type = name_ref X, file.%X.decl [concrete = constants.%X] // CHECK:STDOUT: %X.ref.loc20_14: type = name_ref X, file.%X.decl [concrete = constants.%X] @@ -273,6 +305,29 @@ let n: {.x: ()} = {.x = ()} as {.x = ()}; // CHECK:STDOUT: %.loc20_15.3: type = converted %.loc20_15.2, constants.%tuple.type.b67 [concrete = constants.%tuple.type.b67] // CHECK:STDOUT: } // CHECK:STDOUT: %b: ref %tuple.type.b67 = bind_name b, %b.var +// CHECK:STDOUT: %impl.elem0.loc20_34.1: %.bfc = impl_witness_access constants.%Destroy.impl_witness.599, element0 [concrete = constants.%Op.33a] +// CHECK:STDOUT: %bound_method.loc20_34.1: = bound_method %tuple.elem1.loc20_34, %impl.elem0.loc20_34.1 +// CHECK:STDOUT: %specific_fn.loc20_34.1: = specific_function %impl.elem0.loc20_34.1, @Op.2(constants.%X) [concrete = constants.%Op.specific_fn.d1f] +// CHECK:STDOUT: %bound_method.loc20_34.2: = bound_method %tuple.elem1.loc20_34, %specific_fn.loc20_34.1 +// CHECK:STDOUT: %.loc20_34.3: %X = bind_value %tuple.elem1.loc20_34 +// CHECK:STDOUT: %no_op.loc20_34.1: init %empty_tuple.type = call %bound_method.loc20_34.2(%.loc20_34.3) +// CHECK:STDOUT: %impl.elem0.loc20_34.2: %.bfc = impl_witness_access constants.%Destroy.impl_witness.599, element0 [concrete = constants.%Op.33a] +// CHECK:STDOUT: %bound_method.loc20_34.3: = bound_method %tuple.elem0.loc20_34, %impl.elem0.loc20_34.2 +// CHECK:STDOUT: %specific_fn.loc20_34.2: = specific_function %impl.elem0.loc20_34.2, @Op.2(constants.%X) [concrete = constants.%Op.specific_fn.d1f] +// CHECK:STDOUT: %bound_method.loc20_34.4: = bound_method %tuple.elem0.loc20_34, %specific_fn.loc20_34.2 +// CHECK:STDOUT: %.loc20_34.4: %X = bind_value %tuple.elem0.loc20_34 +// CHECK:STDOUT: %no_op.loc20_34.2: init %empty_tuple.type = call %bound_method.loc20_34.4(%.loc20_34.4) +// CHECK:STDOUT: %impl.elem0.loc20_3: %.fdd = impl_witness_access constants.%Destroy.impl_witness.543, element0 [concrete = constants.%Op.279] +// CHECK:STDOUT: %bound_method.loc20_3.1: = bound_method %b.var, %impl.elem0.loc20_3 +// CHECK:STDOUT: %specific_fn.loc20_3: = specific_function %impl.elem0.loc20_3, @Op.2(constants.%tuple.type.b67) [concrete = constants.%Op.specific_fn.837] +// CHECK:STDOUT: %bound_method.loc20_3.2: = bound_method %b.var, %specific_fn.loc20_3 +// CHECK:STDOUT: %tuple.elem0.loc20_3: ref %X = tuple_access %b.var, element0 +// CHECK:STDOUT: %.loc20_3.2: %X = bind_value %tuple.elem0.loc20_3 +// CHECK:STDOUT: %tuple.elem1.loc20_3: ref %X = tuple_access %b.var, element1 +// CHECK:STDOUT: %.loc20_3.3: %X = bind_value %tuple.elem1.loc20_3 +// CHECK:STDOUT: %tuple: %tuple.type.b67 = tuple_value (%.loc20_3.2, %.loc20_3.3) +// CHECK:STDOUT: %.loc20_3.4: %tuple.type.b67 = converted %b.var, %tuple +// CHECK:STDOUT: %no_op.loc20_3: init %empty_tuple.type = call %bound_method.loc20_3.2(%.loc20_3.4) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -281,13 +336,27 @@ let n: {.x: ()} = {.x = ()} as {.x = ()}; // CHECK:STDOUT: constants { // CHECK:STDOUT: %X: type = class_type @X [concrete] // CHECK:STDOUT: %pattern_type.019: type = pattern_type %X [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %ptr.d17: type = ptr_type %X [concrete] // CHECK:STDOUT: %pattern_type.1c6: type = pattern_type %ptr.d17 [concrete] // CHECK:STDOUT: %Make.type: type = fn_type @Make [concrete] // CHECK:STDOUT: %Make: %Make.type = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.599: = impl_witness imports.%Destroy.impl_witness_table, @impl(%X) [concrete] +// CHECK:STDOUT: %Op.type.9e1: type = fn_type @Op.2, @impl(%X) [concrete] +// CHECK:STDOUT: %Op.33a: %Op.type.9e1 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %X, (%Destroy.impl_witness.599) [concrete] +// CHECK:STDOUT: %.bfc: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.33a, @Op.2(%X) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Value(%n.param: %X) { @@ -327,12 +396,24 @@ let n: {.x: ()} = {.x = ()} as {.x = ()}; // CHECK:STDOUT: } // CHECK:STDOUT: %x.var: ref %X = var %x.var_patt // CHECK:STDOUT: %Make.ref: %Make.type = name_ref Make, file.%Make.decl [concrete = constants.%Make] -// CHECK:STDOUT: %.loc24: ref %X = splice_block %x.var {} -// CHECK:STDOUT: %Make.call: init %X = call %Make.ref() to %.loc24 +// CHECK:STDOUT: %.loc24_3.1: ref %X = splice_block %x.var {} +// CHECK:STDOUT: %Make.call: init %X = call %Make.ref() to %.loc24_3.1 // CHECK:STDOUT: %X.ref.loc24_25: type = name_ref X, file.%X.decl [concrete = constants.%X] // CHECK:STDOUT: assign %x.var, %Make.call // CHECK:STDOUT: %X.ref.loc24_10: type = name_ref X, file.%X.decl [concrete = constants.%X] // CHECK:STDOUT: %x: ref %X = bind_name x, %x.var +// CHECK:STDOUT: %impl.elem0.loc24_3.1: %.bfc = impl_witness_access constants.%Destroy.impl_witness.599, element0 [concrete = constants.%Op.33a] +// CHECK:STDOUT: %bound_method.loc24_3.1: = bound_method %.loc24_3.1, %impl.elem0.loc24_3.1 +// CHECK:STDOUT: %specific_fn.loc24_3.1: = specific_function %impl.elem0.loc24_3.1, @Op.2(constants.%X) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc24_3.2: = bound_method %.loc24_3.1, %specific_fn.loc24_3.1 +// CHECK:STDOUT: %.loc24_3.2: %X = bind_value %.loc24_3.1 +// CHECK:STDOUT: %no_op.loc24_3.1: init %empty_tuple.type = call %bound_method.loc24_3.2(%.loc24_3.2) +// CHECK:STDOUT: %impl.elem0.loc24_3.2: %.bfc = impl_witness_access constants.%Destroy.impl_witness.599, element0 [concrete = constants.%Op.33a] +// CHECK:STDOUT: %bound_method.loc24_3.3: = bound_method %x.var, %impl.elem0.loc24_3.2 +// CHECK:STDOUT: %specific_fn.loc24_3.2: = specific_function %impl.elem0.loc24_3.2, @Op.2(constants.%X) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc24_3.4: = bound_method %x.var, %specific_fn.loc24_3.2 +// CHECK:STDOUT: %.loc24_3.3: %X = bind_value %x.var +// CHECK:STDOUT: %no_op.loc24_3.2: init %empty_tuple.type = call %bound_method.loc24_3.4(%.loc24_3.3) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/basics/dump_sem_ir_ranges.carbon b/toolchain/check/testdata/basics/dump_sem_ir_ranges.carbon index 4a6850286e7a..ec20076908b0 100644 --- a/toolchain/check/testdata/basics/dump_sem_ir_ranges.carbon +++ b/toolchain/check/testdata/basics/dump_sem_ir_ranges.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/none.carbon +// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/destroy.carbon // // The default behavior should be `--dump-sem-ir-ranges=if-present`, although // tests set it to `only`. This explicitly tests the default of the toolchain, @@ -97,18 +97,21 @@ fn F(); // CHECK:STDOUT: %A.type: type = fn_type @A [concrete] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %A: %A.type = struct_value () [concrete] -// CHECK:STDOUT: %pattern_type: type = pattern_type %empty_tuple.type [concrete] +// CHECK:STDOUT: %pattern_type.cb1: type = pattern_type %empty_tuple.type [concrete] +// CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] // CHECK:STDOUT: %B.type: type = fn_type @B [concrete] // CHECK:STDOUT: %B: %B.type = struct_value () [concrete] -// CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] // CHECK:STDOUT: %C.type: type = fn_type @C [concrete] // CHECK:STDOUT: %C: %C.type = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: %C.decl: %C.type = fn_decl @C [concrete = constants.%C] { -// CHECK:STDOUT: %return.patt: %pattern_type = return_slot_pattern [concrete] -// CHECK:STDOUT: %return.param_patt: %pattern_type = out_param_pattern %return.patt, call_param0 [concrete] +// CHECK:STDOUT: %return.patt: %pattern_type.cb1 = return_slot_pattern [concrete] +// CHECK:STDOUT: %return.param_patt: %pattern_type.cb1 = out_param_pattern %return.patt, call_param0 [concrete] // CHECK:STDOUT: } { // CHECK:STDOUT: %.loc17_12.1: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc17_12.2: type = converted %.loc17_12.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] @@ -130,8 +133,8 @@ fn F(); // CHECK:STDOUT: fn @C() -> %empty_tuple.type { // CHECK:STDOUT: !entry: // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %c.patt: %pattern_type = binding_pattern c [concrete] -// CHECK:STDOUT: %c.var_patt: %pattern_type = var_pattern %c.patt [concrete] +// CHECK:STDOUT: %c.patt: %pattern_type.cb1 = binding_pattern c [concrete] +// CHECK:STDOUT: %c.var_patt: %pattern_type.cb1 = var_pattern %c.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %c.var: ref %empty_tuple.type = var %c.var_patt // CHECK:STDOUT: %.loc18_11.1: type = splice_block %.loc18_11.3 [concrete = constants.%empty_tuple.type] { @@ -160,6 +163,9 @@ fn F(); // CHECK:STDOUT: %I: %I.type = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {} // CHECK:STDOUT: } @@ -200,6 +206,22 @@ fn F(); // CHECK:STDOUT: %C.type: type = fn_type @C [concrete] // CHECK:STDOUT: %C: %C.type = struct_value () [concrete] // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.1dc: = impl_witness imports.%Destroy.impl_witness_table, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.type.a63: type = fn_type @Op.2, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.ea3: %Op.type.a63 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %empty_tuple.type, (%Destroy.impl_witness.1dc) [concrete] +// CHECK:STDOUT: %.346: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.ea3, @Op.2(%empty_tuple.type) [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G() { @@ -212,13 +234,29 @@ fn F(); // CHECK:STDOUT: %C.call: init %empty_tuple.type = call %C.ref() // CHECK:STDOUT: %.loc13_7.1: ref %empty_tuple.type = temporary_storage // CHECK:STDOUT: %.loc13_7.2: ref %empty_tuple.type = temporary %.loc13_7.1, %A.call -// CHECK:STDOUT: %tuple.loc13: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc13_7.3: %empty_tuple.type = converted %A.call, %tuple.loc13 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %tuple.loc13_7.1: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc13_7.3: %empty_tuple.type = converted %A.call, %tuple.loc13_7.1 [concrete = constants.%empty_tuple] // CHECK:STDOUT: // CHECK:STDOUT: %.loc17_7.1: ref %empty_tuple.type = temporary_storage // CHECK:STDOUT: %.loc17_7.2: ref %empty_tuple.type = temporary %.loc17_7.1, %C.call -// CHECK:STDOUT: %tuple.loc17: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc17_7.3: %empty_tuple.type = converted %C.call, %tuple.loc17 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %tuple.loc17_7.1: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc17_7.3: %empty_tuple.type = converted %C.call, %tuple.loc17_7.1 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: +// CHECK:STDOUT: %impl.elem0.loc17: %.346 = impl_witness_access constants.%Destroy.impl_witness.1dc, element0 [concrete = constants.%Op.ea3] +// CHECK:STDOUT: %bound_method.loc17_7.1: = bound_method %.loc17_7.1, %impl.elem0.loc17 +// CHECK:STDOUT: %specific_fn.loc17: = specific_function %impl.elem0.loc17, @Op.2(constants.%empty_tuple.type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc17_7.2: = bound_method %.loc17_7.1, %specific_fn.loc17 +// CHECK:STDOUT: %tuple.loc17_7.2: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc17_7.4: %empty_tuple.type = converted %.loc17_7.1, %tuple.loc17_7.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %no_op.loc17: init %empty_tuple.type = call %bound_method.loc17_7.2(%.loc17_7.4) +// CHECK:STDOUT: +// CHECK:STDOUT: %impl.elem0.loc13: %.346 = impl_witness_access constants.%Destroy.impl_witness.1dc, element0 [concrete = constants.%Op.ea3] +// CHECK:STDOUT: %bound_method.loc13_7.1: = bound_method %.loc13_7.1, %impl.elem0.loc13 +// CHECK:STDOUT: %specific_fn.loc13: = specific_function %impl.elem0.loc13, @Op.2(constants.%empty_tuple.type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc13_7.2: = bound_method %.loc13_7.1, %specific_fn.loc13 +// CHECK:STDOUT: %tuple.loc13_7.2: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc13_7.4: %empty_tuple.type = converted %.loc13_7.1, %tuple.loc13_7.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %no_op.loc13: init %empty_tuple.type = call %bound_method.loc13_7.2(%.loc13_7.4) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -229,10 +267,19 @@ fn F(); // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/basics/duplicate_name_same_line.carbon b/toolchain/check/testdata/basics/duplicate_name_same_line.carbon index 093c0f2eef20..92f7bdd742d8 100644 --- a/toolchain/check/testdata/basics/duplicate_name_same_line.carbon +++ b/toolchain/check/testdata/basics/duplicate_name_same_line.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/none.carbon +// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/destroy.carbon // // AUTOUPDATE // TIP: To test this file alone, run: @@ -24,7 +24,24 @@ fn A() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] -// CHECK:STDOUT: %pattern_type: type = pattern_type %empty_tuple.type [concrete] +// CHECK:STDOUT: %pattern_type.cb1: type = pattern_type %empty_tuple.type [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.1dc: = impl_witness imports.%Destroy.impl_witness_table, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.type.a63: type = fn_type @Op.2, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.ea3: %Op.type.a63 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %empty_tuple.type, (%Destroy.impl_witness.1dc) [concrete] +// CHECK:STDOUT: %.346: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.ea3, @Op.2(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() { @@ -33,8 +50,8 @@ fn A() { // CHECK:STDOUT: // CHECK:STDOUT: !if.then: // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %n.patt.loc18_9: %pattern_type = binding_pattern n [concrete] -// CHECK:STDOUT: %n.var_patt.loc18_5: %pattern_type = var_pattern %n.patt.loc18_9 [concrete] +// CHECK:STDOUT: %n.patt.loc18_9: %pattern_type.cb1 = binding_pattern n [concrete] +// CHECK:STDOUT: %n.var_patt.loc18_5: %pattern_type.cb1 = var_pattern %n.patt.loc18_9 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %n.var.loc18_5: ref %empty_tuple.type = var %n.var_patt.loc18_5 // CHECK:STDOUT: %.loc18_13.1: type = splice_block %.loc18_13.3 [concrete = constants.%empty_tuple.type] { @@ -46,8 +63,8 @@ fn A() { // CHECK:STDOUT: // CHECK:STDOUT: !if.else: // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %n.patt.loc18_29: %pattern_type = binding_pattern n [concrete] -// CHECK:STDOUT: %n.var_patt.loc18_25: %pattern_type = var_pattern %n.patt.loc18_29 [concrete] +// CHECK:STDOUT: %n.patt.loc18_29: %pattern_type.cb1 = binding_pattern n [concrete] +// CHECK:STDOUT: %n.var_patt.loc18_25: %pattern_type.cb1 = var_pattern %n.patt.loc18_29 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %n.var.loc18_25: ref %empty_tuple.type = var %n.var_patt.loc18_25 // CHECK:STDOUT: %.loc18_33.1: type = splice_block %.loc18_33.3 [concrete = constants.%empty_tuple.type] { @@ -58,6 +75,20 @@ fn A() { // CHECK:STDOUT: // CHECK:STDOUT: // CHECK:STDOUT: !if.done: +// CHECK:STDOUT: %impl.elem0.loc18_25: %.346 = impl_witness_access constants.%Destroy.impl_witness.1dc, element0 [concrete = constants.%Op.ea3] +// CHECK:STDOUT: %bound_method.loc18_25.1: = bound_method %n.var.loc18_25, %impl.elem0.loc18_25 +// CHECK:STDOUT: %specific_fn.loc18_25: = specific_function %impl.elem0.loc18_25, @Op.2(constants.%empty_tuple.type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc18_25.2: = bound_method %n.var.loc18_25, %specific_fn.loc18_25 +// CHECK:STDOUT: %tuple.loc18_25: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc18_25: %empty_tuple.type = converted %n.var.loc18_25, %tuple.loc18_25 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %no_op.loc18_25: init %empty_tuple.type = call %bound_method.loc18_25.2(%.loc18_25) +// CHECK:STDOUT: %impl.elem0.loc18_5: %.346 = impl_witness_access constants.%Destroy.impl_witness.1dc, element0 [concrete = constants.%Op.ea3] +// CHECK:STDOUT: %bound_method.loc18_5.1: = bound_method %n.var.loc18_5, %impl.elem0.loc18_5 +// CHECK:STDOUT: %specific_fn.loc18_5: = specific_function %impl.elem0.loc18_5, @Op.2(constants.%empty_tuple.type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc18_5.2: = bound_method %n.var.loc18_5, %specific_fn.loc18_5 +// CHECK:STDOUT: %tuple.loc18_5: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc18_5: %empty_tuple.type = converted %n.var.loc18_5, %tuple.loc18_5 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %no_op.loc18_5: init %empty_tuple.type = call %bound_method.loc18_5.2(%.loc18_5) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/access_modifers.carbon b/toolchain/check/testdata/class/access_modifers.carbon index 04d51048f7a3..70d6c398b824 100644 --- a/toolchain/check/testdata/class/access_modifers.carbon +++ b/toolchain/check/testdata/class/access_modifers.carbon @@ -156,6 +156,7 @@ class A { // CHECK:STDOUT: %Circle: type = class_type @Circle [concrete] // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] // CHECK:STDOUT: %Circle.elem: type = unbound_element_type %Circle, %i32 [concrete] @@ -192,12 +193,24 @@ class A { // CHECK:STDOUT: %Circle.val: %Circle = struct_value (%int_5.0f6) [concrete] // CHECK:STDOUT: %Run.type: type = fn_type @Run [concrete] // CHECK:STDOUT: %Run: %Run.type = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.2 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.3, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.315: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%Circle) [concrete] +// CHECK:STDOUT: %Op.type.6cf: type = fn_type @Op.3, @impl.49c(%Circle) [concrete] +// CHECK:STDOUT: %Op.e38: %Op.type.6cf = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %Circle, (%Destroy.impl_witness.315) [concrete] +// CHECK:STDOUT: %.9b5: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.e38, @Op.3(%Circle) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Int = %Core.Int // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -205,6 +218,9 @@ class A { // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -328,6 +344,12 @@ class A { // CHECK:STDOUT: %SOME_INTERNAL_CONSTANT.ref: = name_ref SOME_INTERNAL_CONSTANT, [concrete = ] // CHECK:STDOUT: %circle.ref.loc51: %Circle = name_ref circle, %circle // CHECK:STDOUT: %SomeInternalFunction.ref: = name_ref SomeInternalFunction, [concrete = ] +// CHECK:STDOUT: %impl.elem0: %.9b5 = impl_witness_access constants.%Destroy.impl_witness.315, element0 [concrete = constants.%Op.e38] +// CHECK:STDOUT: %bound_method.loc18_36.1: = bound_method %.loc18_36.1, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.3(constants.%Circle) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc18_36.2: = bound_method %.loc18_36.1, %specific_fn +// CHECK:STDOUT: %.loc18_36.4: %Circle = bind_value %.loc18_36.1 +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc18_36.2(%.loc18_36.4) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/derived_to_base.carbon b/toolchain/check/testdata/class/derived_to_base.carbon index adb070d1325d..8387d70ad80e 100644 --- a/toolchain/check/testdata/class/derived_to_base.carbon +++ b/toolchain/check/testdata/class/derived_to_base.carbon @@ -48,6 +48,7 @@ fn ConvertInit() { // CHECK:STDOUT: %A: type = class_type @A [concrete] // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] // CHECK:STDOUT: %A.elem: type = unbound_element_type %A, %i32 [concrete] @@ -114,12 +115,24 @@ fn ConvertInit() { // CHECK:STDOUT: %bound_method.047: = bound_method %int_3.1ba, %Convert.specific_fn [concrete] // CHECK:STDOUT: %int_3.822: %i32 = int_value 3 [concrete] // CHECK:STDOUT: %C.val: %C = struct_value (%B.val, %int_3.822) [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.2 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.3, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.906: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%C) [concrete] +// CHECK:STDOUT: %Op.type.153: type = fn_type @Op.3, @impl.49c(%C) [concrete] +// CHECK:STDOUT: %Op.5d7: %Op.type.153 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %C, (%Destroy.impl_witness.906) [concrete] +// CHECK:STDOUT: %.b80: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.5d7, @Op.3(%C) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Int = %Core.Int // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -127,6 +140,9 @@ fn ConvertInit() { // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -367,10 +383,10 @@ fn ConvertInit() { // CHECK:STDOUT: %.loc42_48.6: init %i32 = initialize_from %.loc42_48.4 to %.loc42_48.5 [concrete = constants.%int_2.ef8] // CHECK:STDOUT: %.loc42_48.7: init %B = class_init (%.loc42_48.3, %.loc42_48.6), %.loc42_57.3 [concrete = constants.%B.val] // CHECK:STDOUT: %.loc42_57.4: init %B = converted %.loc42_48.1, %.loc42_48.7 [concrete = constants.%B.val] -// CHECK:STDOUT: %impl.elem0.loc42_57: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] -// CHECK:STDOUT: %bound_method.loc42_57.1: = bound_method %int_3, %impl.elem0.loc42_57 [concrete = constants.%Convert.bound.b30] -// CHECK:STDOUT: %specific_fn.loc42_57: = specific_function %impl.elem0.loc42_57, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc42_57.2: = bound_method %int_3, %specific_fn.loc42_57 [concrete = constants.%bound_method.047] +// CHECK:STDOUT: %impl.elem0.loc42_57.1: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc42_57.1: = bound_method %int_3, %impl.elem0.loc42_57.1 [concrete = constants.%Convert.bound.b30] +// CHECK:STDOUT: %specific_fn.loc42_57.1: = specific_function %impl.elem0.loc42_57.1, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc42_57.2: = bound_method %int_3, %specific_fn.loc42_57.1 [concrete = constants.%bound_method.047] // CHECK:STDOUT: %int.convert_checked.loc42_57: init %i32 = call %bound_method.loc42_57.2(%int_3) [concrete = constants.%int_3.822] // CHECK:STDOUT: %.loc42_57.5: init %i32 = converted %int_3, %int.convert_checked.loc42_57 [concrete = constants.%int_3.822] // CHECK:STDOUT: %.loc42_57.6: ref %i32 = class_element_access %.loc42_57.2, element1 @@ -384,6 +400,12 @@ fn ConvertInit() { // CHECK:STDOUT: %.loc42_59.4: ref %A = converted %.loc42_59.1, %.loc42_59.3 // CHECK:STDOUT: %.loc42_59.5: %A = bind_value %.loc42_59.4 // CHECK:STDOUT: %a: %A = bind_name a, %.loc42_59.5 +// CHECK:STDOUT: %impl.elem0.loc42_57.2: %.b80 = impl_witness_access constants.%Destroy.impl_witness.906, element0 [concrete = constants.%Op.5d7] +// CHECK:STDOUT: %bound_method.loc42_57.3: = bound_method %.loc42_57.2, %impl.elem0.loc42_57.2 +// CHECK:STDOUT: %specific_fn.loc42_57.2: = specific_function %impl.elem0.loc42_57.2, @Op.3(constants.%C) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc42_57.4: = bound_method %.loc42_57.2, %specific_fn.loc42_57.2 +// CHECK:STDOUT: %.loc42_57.10: %C = bind_value %.loc42_57.2 +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc42_57.4(%.loc42_57.10) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/destroy_calls.carbon b/toolchain/check/testdata/class/destroy_calls.carbon index 5b955dcef6c2..bda3a9b08d20 100644 --- a/toolchain/check/testdata/class/destroy_calls.carbon +++ b/toolchain/check/testdata/class/destroy_calls.carbon @@ -94,9 +94,7 @@ fn F() { var b: Args; } -// --- fail_not_breaking_generics.carbon -// CHECK:STDERR: fail_not_breaking_generics.carbon: error: value of type `` is not callable [CallToNonCallable] -// CHECK:STDERR: +// --- not_breaking_generics.carbon library "[[@TEST_NAME]]"; class C(template T:! type) {} @@ -140,6 +138,7 @@ fn G() { F({}); } // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -272,17 +271,33 @@ fn G() { F({}); } // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] // CHECK:STDOUT: %pattern_type.88f: type = pattern_type %NoAddr [concrete] -// CHECK:STDOUT: %destroy.type.bc5: type = fn_type @destroy.1 [concrete] -// CHECK:STDOUT: %destroy.60f: %destroy.type.bc5 = struct_value () [concrete] // CHECK:STDOUT: %ExplicitReturn: type = class_type @ExplicitReturn [concrete] // CHECK:STDOUT: %pattern_type.611: type = pattern_type %ExplicitReturn [concrete] -// CHECK:STDOUT: %destroy.type.dfa: type = fn_type @destroy.2 [concrete] -// CHECK:STDOUT: %destroy.539: %destroy.type.dfa = struct_value () [concrete] // CHECK:STDOUT: %WithAddr: type = class_type @WithAddr [concrete] // CHECK:STDOUT: %pattern_type.f93: type = pattern_type %WithAddr [concrete] -// CHECK:STDOUT: %destroy.type.02f: type = fn_type @destroy.3 [concrete] -// CHECK:STDOUT: %destroy.8d0: %destroy.type.02f = struct_value () [concrete] -// CHECK:STDOUT: %ptr.b4e: type = ptr_type %WithAddr [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.824: = impl_witness imports.%Destroy.impl_witness_table, @impl(%WithAddr) [concrete] +// CHECK:STDOUT: %Op.type.8f4: type = fn_type @Op.2, @impl(%WithAddr) [concrete] +// CHECK:STDOUT: %Op.bec: %Op.type.8f4 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.6cc: %Destroy.type = facet_value %WithAddr, (%Destroy.impl_witness.824) [concrete] +// CHECK:STDOUT: %.372: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.6cc [concrete] +// CHECK:STDOUT: %Op.specific_fn.b42: = specific_function %Op.bec, @Op.2(%WithAddr) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.40a: = impl_witness imports.%Destroy.impl_witness_table, @impl(%ExplicitReturn) [concrete] +// CHECK:STDOUT: %Op.type.641: type = fn_type @Op.2, @impl(%ExplicitReturn) [concrete] +// CHECK:STDOUT: %Op.8e6: %Op.type.641 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.c42: %Destroy.type = facet_value %ExplicitReturn, (%Destroy.impl_witness.40a) [concrete] +// CHECK:STDOUT: %.b47: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.c42 [concrete] +// CHECK:STDOUT: %Op.specific_fn.523: = specific_function %Op.8e6, @Op.2(%ExplicitReturn) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.aaa: = impl_witness imports.%Destroy.impl_witness_table, @impl(%NoAddr) [concrete] +// CHECK:STDOUT: %Op.type.73f: type = fn_type @Op.2, @impl(%NoAddr) [concrete] +// CHECK:STDOUT: %Op.d78: %Op.type.73f = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.2b6: %Destroy.type = facet_value %NoAddr, (%Destroy.impl_witness.aaa) [concrete] +// CHECK:STDOUT: %.7a4: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.2b6 [concrete] +// CHECK:STDOUT: %Op.specific_fn.8fe: = specific_function %Op.d78, @Op.2(%NoAddr) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -290,20 +305,25 @@ fn G() { F({}); } // CHECK:STDOUT: %Main.ExplicitReturn: type = import_ref Main//types, ExplicitReturn, loaded [concrete = constants.%ExplicitReturn] // CHECK:STDOUT: %Main.WithAddr: type = import_ref Main//types, WithAddr, loaded [concrete = constants.%WithAddr] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Main.import_ref.8f24d3.1: = import_ref Main//types, loc7_1, loaded [concrete = constants.%complete_type] // CHECK:STDOUT: %Main.import_ref.f42 = import_ref Main//types, inst18 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.b5b = import_ref Main//types, loc5_22, unloaded -// CHECK:STDOUT: %Main.import_ref.7fe: %destroy.type.bc5 = import_ref Main//types, loc6_27, loaded [concrete = constants.%destroy.60f] +// CHECK:STDOUT: %Main.import_ref.1ed = import_ref Main//types, loc6_27, unloaded // CHECK:STDOUT: %Main.import_ref.8f24d3.2: = import_ref Main//types, loc12_1, loaded [concrete = constants.%complete_type] // CHECK:STDOUT: %Main.import_ref.ee7 = import_ref Main//types, inst42 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.b14 = import_ref Main//types, loc10_30, unloaded -// CHECK:STDOUT: %Main.import_ref.83a: %destroy.type.dfa = import_ref Main//types, loc11_33, loaded [concrete = constants.%destroy.539] +// CHECK:STDOUT: %Main.import_ref.f79 = import_ref Main//types, loc11_33, unloaded // CHECK:STDOUT: %Main.import_ref.8f24d3.3: = import_ref Main//types, loc17_1, loaded [concrete = constants.%complete_type] // CHECK:STDOUT: %Main.import_ref.95d = import_ref Main//types, inst70 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.1cb = import_ref Main//types, loc15_24, unloaded -// CHECK:STDOUT: %Main.import_ref.54e: %destroy.type.02f = import_ref Main//types, loc16_33, loaded [concrete = constants.%destroy.8d0] +// CHECK:STDOUT: %Main.import_ref.675 = import_ref Main//types, loc16_33, unloaded +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -325,7 +345,7 @@ fn G() { F({}); } // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = imports.%Main.import_ref.f42 // CHECK:STDOUT: .Make = imports.%Main.import_ref.b5b -// CHECK:STDOUT: .destroy = imports.%Main.import_ref.7fe +// CHECK:STDOUT: .destroy = imports.%Main.import_ref.1ed // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @ExplicitReturn [from "types.carbon"] { @@ -334,7 +354,7 @@ fn G() { F({}); } // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = imports.%Main.import_ref.ee7 // CHECK:STDOUT: .Make = imports.%Main.import_ref.b14 -// CHECK:STDOUT: .destroy = imports.%Main.import_ref.83a +// CHECK:STDOUT: .destroy = imports.%Main.import_ref.f79 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @WithAddr [from "types.carbon"] { @@ -343,7 +363,7 @@ fn G() { F({}); } // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = imports.%Main.import_ref.95d // CHECK:STDOUT: .Make = imports.%Main.import_ref.1cb -// CHECK:STDOUT: .destroy = imports.%Main.import_ref.54e +// CHECK:STDOUT: .destroy = imports.%Main.import_ref.675 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { @@ -353,8 +373,6 @@ fn G() { F({}); } // CHECK:STDOUT: %no_addr.var_patt: %pattern_type.88f = var_pattern %no_addr.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %no_addr.var: ref %NoAddr = var %no_addr.var_patt -// CHECK:STDOUT: %destroy.ref.1: %destroy.type.bc5 = name_ref destroy, imports.%Main.import_ref.7fe [concrete = constants.%destroy.60f] -// CHECK:STDOUT: %destroy.bound.1: = bound_method %no_addr.var, %destroy.ref.1 // CHECK:STDOUT: %NoAddr.ref: type = name_ref NoAddr, imports.%Main.NoAddr [concrete = constants.%NoAddr] // CHECK:STDOUT: %no_addr: ref %NoAddr = bind_name no_addr, %no_addr.var // CHECK:STDOUT: name_binding_decl { @@ -362,8 +380,6 @@ fn G() { F({}); } // CHECK:STDOUT: %explicit_return.var_patt: %pattern_type.611 = var_pattern %explicit_return.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %explicit_return.var: ref %ExplicitReturn = var %explicit_return.var_patt -// CHECK:STDOUT: %destroy.ref.2: %destroy.type.dfa = name_ref destroy, imports.%Main.import_ref.83a [concrete = constants.%destroy.539] -// CHECK:STDOUT: %destroy.bound.2: = bound_method %explicit_return.var, %destroy.ref.2 // CHECK:STDOUT: %ExplicitReturn.ref: type = name_ref ExplicitReturn, imports.%Main.ExplicitReturn [concrete = constants.%ExplicitReturn] // CHECK:STDOUT: %explicit_return: ref %ExplicitReturn = bind_name explicit_return, %explicit_return.var // CHECK:STDOUT: name_binding_decl { @@ -371,25 +387,29 @@ fn G() { F({}); } // CHECK:STDOUT: %with_addr.var_patt: %pattern_type.f93 = var_pattern %with_addr.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %with_addr.var: ref %WithAddr = var %with_addr.var_patt -// CHECK:STDOUT: %destroy.ref.3: %destroy.type.02f = name_ref destroy, imports.%Main.import_ref.54e [concrete = constants.%destroy.8d0] -// CHECK:STDOUT: %destroy.bound.3: = bound_method %with_addr.var, %destroy.ref.3 // CHECK:STDOUT: %WithAddr.ref: type = name_ref WithAddr, imports.%Main.WithAddr [concrete = constants.%WithAddr] // CHECK:STDOUT: %with_addr: ref %WithAddr = bind_name with_addr, %with_addr.var -// CHECK:STDOUT: %addr: %ptr.b4e = addr_of %with_addr.var -// CHECK:STDOUT: %destroy.call.1: init %empty_tuple.type = call %destroy.bound.3(%addr) +// CHECK:STDOUT: %impl.elem0.loc8: %.372 = impl_witness_access constants.%Destroy.impl_witness.824, element0 [concrete = constants.%Op.bec] +// CHECK:STDOUT: %bound_method.loc8_3.1: = bound_method %with_addr.var, %impl.elem0.loc8 +// CHECK:STDOUT: %specific_fn.loc8: = specific_function %impl.elem0.loc8, @Op.2(constants.%WithAddr) [concrete = constants.%Op.specific_fn.b42] +// CHECK:STDOUT: %bound_method.loc8_3.2: = bound_method %with_addr.var, %specific_fn.loc8 +// CHECK:STDOUT: %.loc8: %WithAddr = bind_value %with_addr.var +// CHECK:STDOUT: %no_op.loc8: init %empty_tuple.type = call %bound_method.loc8_3.2(%.loc8) +// CHECK:STDOUT: %impl.elem0.loc7: %.b47 = impl_witness_access constants.%Destroy.impl_witness.40a, element0 [concrete = constants.%Op.8e6] +// CHECK:STDOUT: %bound_method.loc7_3.1: = bound_method %explicit_return.var, %impl.elem0.loc7 +// CHECK:STDOUT: %specific_fn.loc7: = specific_function %impl.elem0.loc7, @Op.2(constants.%ExplicitReturn) [concrete = constants.%Op.specific_fn.523] +// CHECK:STDOUT: %bound_method.loc7_3.2: = bound_method %explicit_return.var, %specific_fn.loc7 // CHECK:STDOUT: %.loc7: %ExplicitReturn = bind_value %explicit_return.var -// CHECK:STDOUT: %destroy.call.2: init %empty_tuple.type = call %destroy.bound.2(%.loc7) +// CHECK:STDOUT: %no_op.loc7: init %empty_tuple.type = call %bound_method.loc7_3.2(%.loc7) +// CHECK:STDOUT: %impl.elem0.loc6: %.7a4 = impl_witness_access constants.%Destroy.impl_witness.aaa, element0 [concrete = constants.%Op.d78] +// CHECK:STDOUT: %bound_method.loc6_3.1: = bound_method %no_addr.var, %impl.elem0.loc6 +// CHECK:STDOUT: %specific_fn.loc6: = specific_function %impl.elem0.loc6, @Op.2(constants.%NoAddr) [concrete = constants.%Op.specific_fn.8fe] +// CHECK:STDOUT: %bound_method.loc6_3.2: = bound_method %no_addr.var, %specific_fn.loc6 // CHECK:STDOUT: %.loc6: %NoAddr = bind_value %no_addr.var -// CHECK:STDOUT: %destroy.call.3: init %empty_tuple.type = call %destroy.bound.1(%.loc6) +// CHECK:STDOUT: %no_op.loc6: init %empty_tuple.type = call %bound_method.loc6_3.2(%.loc6) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @destroy.1 [from "types.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @destroy.2 [from "types.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @destroy.3 [from "types.carbon"]; -// CHECK:STDOUT: // CHECK:STDOUT: --- nested_scope.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -400,18 +420,34 @@ fn G() { F({}); } // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] // CHECK:STDOUT: %pattern_type.88f: type = pattern_type %NoAddr [concrete] -// CHECK:STDOUT: %destroy.type.bc5: type = fn_type @destroy.1 [concrete] -// CHECK:STDOUT: %destroy.60f: %destroy.type.bc5 = struct_value () [concrete] // CHECK:STDOUT: %ExplicitReturn: type = class_type @ExplicitReturn [concrete] // CHECK:STDOUT: %pattern_type.611: type = pattern_type %ExplicitReturn [concrete] -// CHECK:STDOUT: %destroy.type.dfa: type = fn_type @destroy.2 [concrete] -// CHECK:STDOUT: %destroy.539: %destroy.type.dfa = struct_value () [concrete] // CHECK:STDOUT: %WithAddr: type = class_type @WithAddr [concrete] // CHECK:STDOUT: %pattern_type.f93: type = pattern_type %WithAddr [concrete] -// CHECK:STDOUT: %destroy.type.02f: type = fn_type @destroy.3 [concrete] -// CHECK:STDOUT: %destroy.8d0: %destroy.type.02f = struct_value () [concrete] -// CHECK:STDOUT: %ptr.b4e: type = ptr_type %WithAddr [concrete] // CHECK:STDOUT: %true: bool = bool_literal true [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.aaa: = impl_witness imports.%Destroy.impl_witness_table, @impl(%NoAddr) [concrete] +// CHECK:STDOUT: %Op.type.73f: type = fn_type @Op.2, @impl(%NoAddr) [concrete] +// CHECK:STDOUT: %Op.d78: %Op.type.73f = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.2b6: %Destroy.type = facet_value %NoAddr, (%Destroy.impl_witness.aaa) [concrete] +// CHECK:STDOUT: %.7a4: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.2b6 [concrete] +// CHECK:STDOUT: %Op.specific_fn.8fe: = specific_function %Op.d78, @Op.2(%NoAddr) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.824: = impl_witness imports.%Destroy.impl_witness_table, @impl(%WithAddr) [concrete] +// CHECK:STDOUT: %Op.type.8f4: type = fn_type @Op.2, @impl(%WithAddr) [concrete] +// CHECK:STDOUT: %Op.bec: %Op.type.8f4 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.6cc: %Destroy.type = facet_value %WithAddr, (%Destroy.impl_witness.824) [concrete] +// CHECK:STDOUT: %.372: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.6cc [concrete] +// CHECK:STDOUT: %Op.specific_fn.b42: = specific_function %Op.bec, @Op.2(%WithAddr) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.40a: = impl_witness imports.%Destroy.impl_witness_table, @impl(%ExplicitReturn) [concrete] +// CHECK:STDOUT: %Op.type.641: type = fn_type @Op.2, @impl(%ExplicitReturn) [concrete] +// CHECK:STDOUT: %Op.8e6: %Op.type.641 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.c42: %Destroy.type = facet_value %ExplicitReturn, (%Destroy.impl_witness.40a) [concrete] +// CHECK:STDOUT: %.b47: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.c42 [concrete] +// CHECK:STDOUT: %Op.specific_fn.523: = specific_function %Op.8e6, @Op.2(%ExplicitReturn) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -419,20 +455,25 @@ fn G() { F({}); } // CHECK:STDOUT: %Main.ExplicitReturn: type = import_ref Main//types, ExplicitReturn, loaded [concrete = constants.%ExplicitReturn] // CHECK:STDOUT: %Main.WithAddr: type = import_ref Main//types, WithAddr, loaded [concrete = constants.%WithAddr] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Main.import_ref.8f24d3.1: = import_ref Main//types, loc7_1, loaded [concrete = constants.%complete_type] // CHECK:STDOUT: %Main.import_ref.f42 = import_ref Main//types, inst18 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.b5b = import_ref Main//types, loc5_22, unloaded -// CHECK:STDOUT: %Main.import_ref.7fe: %destroy.type.bc5 = import_ref Main//types, loc6_27, loaded [concrete = constants.%destroy.60f] +// CHECK:STDOUT: %Main.import_ref.1ed = import_ref Main//types, loc6_27, unloaded // CHECK:STDOUT: %Main.import_ref.8f24d3.2: = import_ref Main//types, loc12_1, loaded [concrete = constants.%complete_type] // CHECK:STDOUT: %Main.import_ref.ee7 = import_ref Main//types, inst42 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.b14 = import_ref Main//types, loc10_30, unloaded -// CHECK:STDOUT: %Main.import_ref.83a: %destroy.type.dfa = import_ref Main//types, loc11_33, loaded [concrete = constants.%destroy.539] +// CHECK:STDOUT: %Main.import_ref.f79 = import_ref Main//types, loc11_33, unloaded // CHECK:STDOUT: %Main.import_ref.8f24d3.3: = import_ref Main//types, loc17_1, loaded [concrete = constants.%complete_type] // CHECK:STDOUT: %Main.import_ref.95d = import_ref Main//types, inst70 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.1cb = import_ref Main//types, loc15_24, unloaded -// CHECK:STDOUT: %Main.import_ref.54e: %destroy.type.02f = import_ref Main//types, loc16_33, loaded [concrete = constants.%destroy.8d0] +// CHECK:STDOUT: %Main.import_ref.675 = import_ref Main//types, loc16_33, unloaded +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -454,7 +495,7 @@ fn G() { F({}); } // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = imports.%Main.import_ref.f42 // CHECK:STDOUT: .Make = imports.%Main.import_ref.b5b -// CHECK:STDOUT: .destroy = imports.%Main.import_ref.7fe +// CHECK:STDOUT: .destroy = imports.%Main.import_ref.1ed // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @ExplicitReturn [from "types.carbon"] { @@ -463,7 +504,7 @@ fn G() { F({}); } // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = imports.%Main.import_ref.ee7 // CHECK:STDOUT: .Make = imports.%Main.import_ref.b14 -// CHECK:STDOUT: .destroy = imports.%Main.import_ref.83a +// CHECK:STDOUT: .destroy = imports.%Main.import_ref.f79 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @WithAddr [from "types.carbon"] { @@ -472,7 +513,7 @@ fn G() { F({}); } // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = imports.%Main.import_ref.95d // CHECK:STDOUT: .Make = imports.%Main.import_ref.1cb -// CHECK:STDOUT: .destroy = imports.%Main.import_ref.54e +// CHECK:STDOUT: .destroy = imports.%Main.import_ref.675 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { @@ -482,8 +523,6 @@ fn G() { F({}); } // CHECK:STDOUT: %no_addr.var_patt: %pattern_type.88f = var_pattern %no_addr.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %no_addr.var: ref %NoAddr = var %no_addr.var_patt -// CHECK:STDOUT: %destroy.ref.1: %destroy.type.bc5 = name_ref destroy, imports.%Main.import_ref.7fe [concrete = constants.%destroy.60f] -// CHECK:STDOUT: %destroy.bound.1: = bound_method %no_addr.var, %destroy.ref.1 // CHECK:STDOUT: %NoAddr.ref.loc6: type = name_ref NoAddr, imports.%Main.NoAddr [concrete = constants.%NoAddr] // CHECK:STDOUT: %no_addr: ref %NoAddr = bind_name no_addr, %no_addr.var // CHECK:STDOUT: name_binding_decl { @@ -491,8 +530,6 @@ fn G() { F({}); } // CHECK:STDOUT: %explicit_return.var_patt: %pattern_type.611 = var_pattern %explicit_return.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %explicit_return.var: ref %ExplicitReturn = var %explicit_return.var_patt -// CHECK:STDOUT: %destroy.ref.2: %destroy.type.dfa = name_ref destroy, imports.%Main.import_ref.83a [concrete = constants.%destroy.539] -// CHECK:STDOUT: %destroy.bound.2: = bound_method %explicit_return.var, %destroy.ref.2 // CHECK:STDOUT: %ExplicitReturn.ref: type = name_ref ExplicitReturn, imports.%Main.ExplicitReturn [concrete = constants.%ExplicitReturn] // CHECK:STDOUT: %explicit_return: ref %ExplicitReturn = bind_name explicit_return, %explicit_return.var // CHECK:STDOUT: name_binding_decl { @@ -500,8 +537,6 @@ fn G() { F({}); } // CHECK:STDOUT: %with_addr.var_patt: %pattern_type.f93 = var_pattern %with_addr.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %with_addr.var: ref %WithAddr = var %with_addr.var_patt -// CHECK:STDOUT: %destroy.ref.3: %destroy.type.02f = name_ref destroy, imports.%Main.import_ref.54e [concrete = constants.%destroy.8d0] -// CHECK:STDOUT: %destroy.bound.3: = bound_method %with_addr.var, %destroy.ref.3 // CHECK:STDOUT: %WithAddr.ref: type = name_ref WithAddr, imports.%Main.WithAddr [concrete = constants.%WithAddr] // CHECK:STDOUT: %with_addr: ref %WithAddr = bind_name with_addr, %with_addr.var // CHECK:STDOUT: %true: bool = bool_literal true [concrete = constants.%true] @@ -513,30 +548,38 @@ fn G() { F({}); } // CHECK:STDOUT: %in_scope.var_patt: %pattern_type.88f = var_pattern %in_scope.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %in_scope.var: ref %NoAddr = var %in_scope.var_patt -// CHECK:STDOUT: %destroy.ref.4: %destroy.type.bc5 = name_ref destroy, imports.%Main.import_ref.7fe [concrete = constants.%destroy.60f] -// CHECK:STDOUT: %destroy.bound.4: = bound_method %in_scope.var, %destroy.ref.4 // CHECK:STDOUT: %NoAddr.ref.loc10: type = name_ref NoAddr, imports.%Main.NoAddr [concrete = constants.%NoAddr] // CHECK:STDOUT: %in_scope: ref %NoAddr = bind_name in_scope, %in_scope.var // CHECK:STDOUT: br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.else: +// CHECK:STDOUT: %impl.elem0.loc10: %.7a4 = impl_witness_access constants.%Destroy.impl_witness.aaa, element0 [concrete = constants.%Op.d78] +// CHECK:STDOUT: %bound_method.loc10_5.1: = bound_method %in_scope.var, %impl.elem0.loc10 +// CHECK:STDOUT: %specific_fn.loc10: = specific_function %impl.elem0.loc10, @Op.2(constants.%NoAddr) [concrete = constants.%Op.specific_fn.8fe] +// CHECK:STDOUT: %bound_method.loc10_5.2: = bound_method %in_scope.var, %specific_fn.loc10 // CHECK:STDOUT: %.loc10: %NoAddr = bind_value %in_scope.var -// CHECK:STDOUT: %destroy.call.1: init %empty_tuple.type = call %destroy.bound.4(%.loc10) -// CHECK:STDOUT: %addr: %ptr.b4e = addr_of %with_addr.var -// CHECK:STDOUT: %destroy.call.2: init %empty_tuple.type = call %destroy.bound.3(%addr) +// CHECK:STDOUT: %no_op.loc10: init %empty_tuple.type = call %bound_method.loc10_5.2(%.loc10) +// CHECK:STDOUT: %impl.elem0.loc8: %.372 = impl_witness_access constants.%Destroy.impl_witness.824, element0 [concrete = constants.%Op.bec] +// CHECK:STDOUT: %bound_method.loc8_3.1: = bound_method %with_addr.var, %impl.elem0.loc8 +// CHECK:STDOUT: %specific_fn.loc8: = specific_function %impl.elem0.loc8, @Op.2(constants.%WithAddr) [concrete = constants.%Op.specific_fn.b42] +// CHECK:STDOUT: %bound_method.loc8_3.2: = bound_method %with_addr.var, %specific_fn.loc8 +// CHECK:STDOUT: %.loc8: %WithAddr = bind_value %with_addr.var +// CHECK:STDOUT: %no_op.loc8: init %empty_tuple.type = call %bound_method.loc8_3.2(%.loc8) +// CHECK:STDOUT: %impl.elem0.loc7: %.b47 = impl_witness_access constants.%Destroy.impl_witness.40a, element0 [concrete = constants.%Op.8e6] +// CHECK:STDOUT: %bound_method.loc7_3.1: = bound_method %explicit_return.var, %impl.elem0.loc7 +// CHECK:STDOUT: %specific_fn.loc7: = specific_function %impl.elem0.loc7, @Op.2(constants.%ExplicitReturn) [concrete = constants.%Op.specific_fn.523] +// CHECK:STDOUT: %bound_method.loc7_3.2: = bound_method %explicit_return.var, %specific_fn.loc7 // CHECK:STDOUT: %.loc7: %ExplicitReturn = bind_value %explicit_return.var -// CHECK:STDOUT: %destroy.call.3: init %empty_tuple.type = call %destroy.bound.2(%.loc7) +// CHECK:STDOUT: %no_op.loc7: init %empty_tuple.type = call %bound_method.loc7_3.2(%.loc7) +// CHECK:STDOUT: %impl.elem0.loc6: %.7a4 = impl_witness_access constants.%Destroy.impl_witness.aaa, element0 [concrete = constants.%Op.d78] +// CHECK:STDOUT: %bound_method.loc6_3.1: = bound_method %no_addr.var, %impl.elem0.loc6 +// CHECK:STDOUT: %specific_fn.loc6: = specific_function %impl.elem0.loc6, @Op.2(constants.%NoAddr) [concrete = constants.%Op.specific_fn.8fe] +// CHECK:STDOUT: %bound_method.loc6_3.2: = bound_method %no_addr.var, %specific_fn.loc6 // CHECK:STDOUT: %.loc6: %NoAddr = bind_value %no_addr.var -// CHECK:STDOUT: %destroy.call.4: init %empty_tuple.type = call %destroy.bound.1(%.loc6) +// CHECK:STDOUT: %no_op.loc6: init %empty_tuple.type = call %bound_method.loc6_3.2(%.loc6) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @destroy.1 [from "types.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @destroy.2 [from "types.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @destroy.3 [from "types.carbon"]; -// CHECK:STDOUT: // CHECK:STDOUT: --- temp.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -548,19 +591,35 @@ fn G() { F({}); } // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] // CHECK:STDOUT: %Make.type.bc9: type = fn_type @Make.1 [concrete] // CHECK:STDOUT: %Make.1be: %Make.type.bc9 = struct_value () [concrete] -// CHECK:STDOUT: %destroy.type.bc5: type = fn_type @destroy.1 [concrete] -// CHECK:STDOUT: %destroy.60f: %destroy.type.bc5 = struct_value () [concrete] // CHECK:STDOUT: %ExplicitReturn: type = class_type @ExplicitReturn [concrete] // CHECK:STDOUT: %Make.type.378: type = fn_type @Make.2 [concrete] // CHECK:STDOUT: %Make.960: %Make.type.378 = struct_value () [concrete] -// CHECK:STDOUT: %destroy.type.dfa: type = fn_type @destroy.2 [concrete] -// CHECK:STDOUT: %destroy.539: %destroy.type.dfa = struct_value () [concrete] // CHECK:STDOUT: %WithAddr: type = class_type @WithAddr [concrete] // CHECK:STDOUT: %Make.type.e14: type = fn_type @Make.3 [concrete] // CHECK:STDOUT: %Make.b0a: %Make.type.e14 = struct_value () [concrete] -// CHECK:STDOUT: %destroy.type.02f: type = fn_type @destroy.3 [concrete] -// CHECK:STDOUT: %destroy.8d0: %destroy.type.02f = struct_value () [concrete] -// CHECK:STDOUT: %ptr.b4e: type = ptr_type %WithAddr [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.824: = impl_witness imports.%Destroy.impl_witness_table, @impl(%WithAddr) [concrete] +// CHECK:STDOUT: %Op.type.8f4: type = fn_type @Op.2, @impl(%WithAddr) [concrete] +// CHECK:STDOUT: %Op.bec: %Op.type.8f4 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.6cc: %Destroy.type = facet_value %WithAddr, (%Destroy.impl_witness.824) [concrete] +// CHECK:STDOUT: %.372: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.6cc [concrete] +// CHECK:STDOUT: %Op.specific_fn.b42: = specific_function %Op.bec, @Op.2(%WithAddr) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.40a: = impl_witness imports.%Destroy.impl_witness_table, @impl(%ExplicitReturn) [concrete] +// CHECK:STDOUT: %Op.type.641: type = fn_type @Op.2, @impl(%ExplicitReturn) [concrete] +// CHECK:STDOUT: %Op.8e6: %Op.type.641 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.c42: %Destroy.type = facet_value %ExplicitReturn, (%Destroy.impl_witness.40a) [concrete] +// CHECK:STDOUT: %.b47: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.c42 [concrete] +// CHECK:STDOUT: %Op.specific_fn.523: = specific_function %Op.8e6, @Op.2(%ExplicitReturn) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.aaa: = impl_witness imports.%Destroy.impl_witness_table, @impl(%NoAddr) [concrete] +// CHECK:STDOUT: %Op.type.73f: type = fn_type @Op.2, @impl(%NoAddr) [concrete] +// CHECK:STDOUT: %Op.d78: %Op.type.73f = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.2b6: %Destroy.type = facet_value %NoAddr, (%Destroy.impl_witness.aaa) [concrete] +// CHECK:STDOUT: %.7a4: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.2b6 [concrete] +// CHECK:STDOUT: %Op.specific_fn.8fe: = specific_function %Op.d78, @Op.2(%NoAddr) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -568,20 +627,25 @@ fn G() { F({}); } // CHECK:STDOUT: %Main.ExplicitReturn: type = import_ref Main//types, ExplicitReturn, loaded [concrete = constants.%ExplicitReturn] // CHECK:STDOUT: %Main.WithAddr: type = import_ref Main//types, WithAddr, loaded [concrete = constants.%WithAddr] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Main.import_ref.8f24d3.1: = import_ref Main//types, loc7_1, loaded [concrete = constants.%complete_type] // CHECK:STDOUT: %Main.import_ref.f42 = import_ref Main//types, inst18 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.784: %Make.type.bc9 = import_ref Main//types, loc5_22, loaded [concrete = constants.%Make.1be] -// CHECK:STDOUT: %Main.import_ref.7fe: %destroy.type.bc5 = import_ref Main//types, loc6_27, loaded [concrete = constants.%destroy.60f] +// CHECK:STDOUT: %Main.import_ref.1ed = import_ref Main//types, loc6_27, unloaded // CHECK:STDOUT: %Main.import_ref.8f24d3.2: = import_ref Main//types, loc12_1, loaded [concrete = constants.%complete_type] // CHECK:STDOUT: %Main.import_ref.ee7 = import_ref Main//types, inst42 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.8e0: %Make.type.378 = import_ref Main//types, loc10_30, loaded [concrete = constants.%Make.960] -// CHECK:STDOUT: %Main.import_ref.83a: %destroy.type.dfa = import_ref Main//types, loc11_33, loaded [concrete = constants.%destroy.539] +// CHECK:STDOUT: %Main.import_ref.f79 = import_ref Main//types, loc11_33, unloaded // CHECK:STDOUT: %Main.import_ref.8f24d3.3: = import_ref Main//types, loc17_1, loaded [concrete = constants.%complete_type] // CHECK:STDOUT: %Main.import_ref.95d = import_ref Main//types, inst70 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.974: %Make.type.e14 = import_ref Main//types, loc15_24, loaded [concrete = constants.%Make.b0a] -// CHECK:STDOUT: %Main.import_ref.54e: %destroy.type.02f = import_ref Main//types, loc16_33, loaded [concrete = constants.%destroy.8d0] +// CHECK:STDOUT: %Main.import_ref.675 = import_ref Main//types, loc16_33, unloaded +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -603,7 +667,7 @@ fn G() { F({}); } // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = imports.%Main.import_ref.f42 // CHECK:STDOUT: .Make = imports.%Main.import_ref.784 -// CHECK:STDOUT: .destroy = imports.%Main.import_ref.7fe +// CHECK:STDOUT: .destroy = imports.%Main.import_ref.1ed // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @ExplicitReturn [from "types.carbon"] { @@ -612,7 +676,7 @@ fn G() { F({}); } // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = imports.%Main.import_ref.ee7 // CHECK:STDOUT: .Make = imports.%Main.import_ref.8e0 -// CHECK:STDOUT: .destroy = imports.%Main.import_ref.83a +// CHECK:STDOUT: .destroy = imports.%Main.import_ref.f79 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @WithAddr [from "types.carbon"] { @@ -621,7 +685,7 @@ fn G() { F({}); } // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = imports.%Main.import_ref.95d // CHECK:STDOUT: .Make = imports.%Main.import_ref.974 -// CHECK:STDOUT: .destroy = imports.%Main.import_ref.54e +// CHECK:STDOUT: .destroy = imports.%Main.import_ref.675 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { @@ -629,45 +693,45 @@ fn G() { F({}); } // CHECK:STDOUT: %NoAddr.ref: type = name_ref NoAddr, imports.%Main.NoAddr [concrete = constants.%NoAddr] // CHECK:STDOUT: %Make.ref.loc8: %Make.type.bc9 = name_ref Make, imports.%Main.import_ref.784 [concrete = constants.%Make.1be] // CHECK:STDOUT: %.loc8_15.1: ref %NoAddr = temporary_storage -// CHECK:STDOUT: %destroy.ref.1: %destroy.type.bc5 = name_ref destroy, imports.%Main.import_ref.7fe [concrete = constants.%destroy.60f] -// CHECK:STDOUT: %destroy.bound.1: = bound_method %.loc8_15.1, %destroy.ref.1 // CHECK:STDOUT: %Make.call.loc8: init %NoAddr = call %Make.ref.loc8() to %.loc8_15.1 // CHECK:STDOUT: %.loc8_15.2: ref %NoAddr = temporary %.loc8_15.1, %Make.call.loc8 // CHECK:STDOUT: %ExplicitReturn.ref: type = name_ref ExplicitReturn, imports.%Main.ExplicitReturn [concrete = constants.%ExplicitReturn] // CHECK:STDOUT: %Make.ref.loc9: %Make.type.378 = name_ref Make, imports.%Main.import_ref.8e0 [concrete = constants.%Make.960] // CHECK:STDOUT: %.loc9_23.1: ref %ExplicitReturn = temporary_storage -// CHECK:STDOUT: %destroy.ref.2: %destroy.type.dfa = name_ref destroy, imports.%Main.import_ref.83a [concrete = constants.%destroy.539] -// CHECK:STDOUT: %destroy.bound.2: = bound_method %.loc9_23.1, %destroy.ref.2 // CHECK:STDOUT: %Make.call.loc9: init %ExplicitReturn = call %Make.ref.loc9() to %.loc9_23.1 // CHECK:STDOUT: %.loc9_23.2: ref %ExplicitReturn = temporary %.loc9_23.1, %Make.call.loc9 // CHECK:STDOUT: %WithAddr.ref: type = name_ref WithAddr, imports.%Main.WithAddr [concrete = constants.%WithAddr] // CHECK:STDOUT: %Make.ref.loc10: %Make.type.e14 = name_ref Make, imports.%Main.import_ref.974 [concrete = constants.%Make.b0a] // CHECK:STDOUT: %.loc10_17.1: ref %WithAddr = temporary_storage -// CHECK:STDOUT: %destroy.ref.3: %destroy.type.02f = name_ref destroy, imports.%Main.import_ref.54e [concrete = constants.%destroy.8d0] -// CHECK:STDOUT: %destroy.bound.3: = bound_method %.loc10_17.1, %destroy.ref.3 // CHECK:STDOUT: %Make.call.loc10: init %WithAddr = call %Make.ref.loc10() to %.loc10_17.1 // CHECK:STDOUT: %.loc10_17.2: ref %WithAddr = temporary %.loc10_17.1, %Make.call.loc10 -// CHECK:STDOUT: %addr: %ptr.b4e = addr_of %.loc10_17.1 -// CHECK:STDOUT: %destroy.call.1: init %empty_tuple.type = call %destroy.bound.3(%addr) +// CHECK:STDOUT: %impl.elem0.loc10: %.372 = impl_witness_access constants.%Destroy.impl_witness.824, element0 [concrete = constants.%Op.bec] +// CHECK:STDOUT: %bound_method.loc10_17.1: = bound_method %.loc10_17.1, %impl.elem0.loc10 +// CHECK:STDOUT: %specific_fn.loc10: = specific_function %impl.elem0.loc10, @Op.2(constants.%WithAddr) [concrete = constants.%Op.specific_fn.b42] +// CHECK:STDOUT: %bound_method.loc10_17.2: = bound_method %.loc10_17.1, %specific_fn.loc10 +// CHECK:STDOUT: %.loc10_17.3: %WithAddr = bind_value %.loc10_17.1 +// CHECK:STDOUT: %no_op.loc10: init %empty_tuple.type = call %bound_method.loc10_17.2(%.loc10_17.3) +// CHECK:STDOUT: %impl.elem0.loc9: %.b47 = impl_witness_access constants.%Destroy.impl_witness.40a, element0 [concrete = constants.%Op.8e6] +// CHECK:STDOUT: %bound_method.loc9_23.1: = bound_method %.loc9_23.1, %impl.elem0.loc9 +// CHECK:STDOUT: %specific_fn.loc9: = specific_function %impl.elem0.loc9, @Op.2(constants.%ExplicitReturn) [concrete = constants.%Op.specific_fn.523] +// CHECK:STDOUT: %bound_method.loc9_23.2: = bound_method %.loc9_23.1, %specific_fn.loc9 // CHECK:STDOUT: %.loc9_23.3: %ExplicitReturn = bind_value %.loc9_23.1 -// CHECK:STDOUT: %destroy.call.2: init %empty_tuple.type = call %destroy.bound.2(%.loc9_23.3) +// CHECK:STDOUT: %no_op.loc9: init %empty_tuple.type = call %bound_method.loc9_23.2(%.loc9_23.3) +// CHECK:STDOUT: %impl.elem0.loc8: %.7a4 = impl_witness_access constants.%Destroy.impl_witness.aaa, element0 [concrete = constants.%Op.d78] +// CHECK:STDOUT: %bound_method.loc8_15.1: = bound_method %.loc8_15.1, %impl.elem0.loc8 +// CHECK:STDOUT: %specific_fn.loc8: = specific_function %impl.elem0.loc8, @Op.2(constants.%NoAddr) [concrete = constants.%Op.specific_fn.8fe] +// CHECK:STDOUT: %bound_method.loc8_15.2: = bound_method %.loc8_15.1, %specific_fn.loc8 // CHECK:STDOUT: %.loc8_15.3: %NoAddr = bind_value %.loc8_15.1 -// CHECK:STDOUT: %destroy.call.3: init %empty_tuple.type = call %destroy.bound.1(%.loc8_15.3) +// CHECK:STDOUT: %no_op.loc8: init %empty_tuple.type = call %bound_method.loc8_15.2(%.loc8_15.3) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Make.1 [from "types.carbon"]; // CHECK:STDOUT: -// CHECK:STDOUT: fn @destroy.1 [from "types.carbon"]; -// CHECK:STDOUT: // CHECK:STDOUT: fn @Make.2 [from "types.carbon"]; // CHECK:STDOUT: -// CHECK:STDOUT: fn @destroy.2 [from "types.carbon"]; -// CHECK:STDOUT: // CHECK:STDOUT: fn @Make.3 [from "types.carbon"]; // CHECK:STDOUT: -// CHECK:STDOUT: fn @destroy.3 [from "types.carbon"]; -// CHECK:STDOUT: // CHECK:STDOUT: --- fail_recovery.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -685,12 +749,34 @@ fn G() { F({}); } // CHECK:STDOUT: %F.type: type = fn_type @F [concrete] // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] // CHECK:STDOUT: %pattern_type.9f4: type = pattern_type %NoSelf [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.ba4: = impl_witness imports.%Destroy.impl_witness_table, @impl(%Args) [concrete] +// CHECK:STDOUT: %Op.type.59d: type = fn_type @Op.2, @impl(%Args) [concrete] +// CHECK:STDOUT: %Op.a71: %Op.type.59d = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.7fd: %Destroy.type = facet_value %Args, (%Destroy.impl_witness.ba4) [concrete] +// CHECK:STDOUT: %.dcb: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.7fd [concrete] +// CHECK:STDOUT: %Op.specific_fn.242: = specific_function %Op.a71, @Op.2(%Args) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.da8: = impl_witness imports.%Destroy.impl_witness_table, @impl(%NoSelf) [concrete] +// CHECK:STDOUT: %Op.type.f20: type = fn_type @Op.2, @impl(%NoSelf) [concrete] +// CHECK:STDOUT: %Op.2e0: %Op.type.f20 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.f87: %Destroy.type = facet_value %NoSelf, (%Destroy.impl_witness.da8) [concrete] +// CHECK:STDOUT: %.960: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.f87 [concrete] +// CHECK:STDOUT: %Op.specific_fn.a58: = specific_function %Op.2e0, @Op.2(%NoSelf) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -754,7 +840,6 @@ fn G() { F({}); } // CHECK:STDOUT: %a.var_patt: %pattern_type.9f4 = var_pattern %a.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %a.var: ref %NoSelf = var %a.var_patt -// CHECK:STDOUT: %destroy.ref.1: %destroy.type.d69 = name_ref destroy, @NoSelf.%destroy.decl [concrete = constants.%destroy.ab7] // CHECK:STDOUT: %NoSelf.ref: type = name_ref NoSelf, file.%NoSelf.decl [concrete = constants.%NoSelf] // CHECK:STDOUT: %a: ref %NoSelf = bind_name a, %a.var // CHECK:STDOUT: name_binding_decl { @@ -762,48 +847,70 @@ fn G() { F({}); } // CHECK:STDOUT: %b.var_patt: %pattern_type.a81 = var_pattern %b.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %b.var: ref %Args = var %b.var_patt -// CHECK:STDOUT: %destroy.ref.2: %destroy.type.ba0 = name_ref destroy, @Args.%destroy.decl [concrete = constants.%destroy.723] -// CHECK:STDOUT: %destroy.bound: = bound_method %b.var, %destroy.ref.2 // CHECK:STDOUT: %Args.ref: type = name_ref Args, file.%Args.decl [concrete = constants.%Args] // CHECK:STDOUT: %b: ref %Args = bind_name b, %b.var +// CHECK:STDOUT: %impl.elem0.loc22: %.dcb = impl_witness_access constants.%Destroy.impl_witness.ba4, element0 [concrete = constants.%Op.a71] +// CHECK:STDOUT: %bound_method.loc22_3.1: = bound_method %b.var, %impl.elem0.loc22 +// CHECK:STDOUT: %specific_fn.loc22: = specific_function %impl.elem0.loc22, @Op.2(constants.%Args) [concrete = constants.%Op.specific_fn.242] +// CHECK:STDOUT: %bound_method.loc22_3.2: = bound_method %b.var, %specific_fn.loc22 // CHECK:STDOUT: %.loc22: %Args = bind_value %b.var -// CHECK:STDOUT: %destroy.call.1: init %empty_tuple.type = call %destroy.bound(%.loc22) -// CHECK:STDOUT: %destroy.call.2: init %empty_tuple.type = call %destroy.ref.1() +// CHECK:STDOUT: %no_op.loc22: init %empty_tuple.type = call %bound_method.loc22_3.2(%.loc22) +// CHECK:STDOUT: %impl.elem0.loc21: %.960 = impl_witness_access constants.%Destroy.impl_witness.da8, element0 [concrete = constants.%Op.2e0] +// CHECK:STDOUT: %bound_method.loc21_3.1: = bound_method %a.var, %impl.elem0.loc21 +// CHECK:STDOUT: %specific_fn.loc21: = specific_function %impl.elem0.loc21, @Op.2(constants.%NoSelf) [concrete = constants.%Op.specific_fn.a58] +// CHECK:STDOUT: %bound_method.loc21_3.2: = bound_method %a.var, %specific_fn.loc21 +// CHECK:STDOUT: %.loc21: %NoSelf = bind_value %a.var +// CHECK:STDOUT: %no_op.loc21: init %empty_tuple.type = call %bound_method.loc21_3.2(%.loc21) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: --- fail_not_breaking_generics.carbon +// CHECK:STDOUT: --- not_breaking_generics.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0, template [template] +// CHECK:STDOUT: %T.8b3d5d.1: type = bind_symbolic_name T, 0, template [template] // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete] // CHECK:STDOUT: %C.type: type = generic_class_type @C [concrete] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %C.generic: %C.type = struct_value () [concrete] -// CHECK:STDOUT: %C.f2e: type = class_type @C, @C(%T) [template] +// CHECK:STDOUT: %C.f2e: type = class_type @C, @C(%T.8b3d5d.1) [template] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] // CHECK:STDOUT: %F.type: type = fn_type @F [concrete] // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] -// CHECK:STDOUT: %require_complete: = require_complete_type %C.f2e [template] +// CHECK:STDOUT: %require_complete.389: = require_complete_type %C.f2e [template] // CHECK:STDOUT: %pattern_type.e5e: type = pattern_type %C.f2e [template] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T.8b3d5d.2: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T.8b3d5d.2) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %C.f2e, @Destroy [template] +// CHECK:STDOUT: %Destroy.facet.d66: %Destroy.type = facet_value %C.f2e, (%Destroy.lookup_impl_witness) [template] +// CHECK:STDOUT: %.eb5: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.d66 [template] +// CHECK:STDOUT: %impl.elem0: %.eb5 = impl_witness_access %Destroy.lookup_impl_witness, element0 [template] +// CHECK:STDOUT: %specific_impl_fn: = specific_impl_function %impl.elem0, @Op.1(%Destroy.facet.d66) [template] // CHECK:STDOUT: %G.type: type = fn_type @G [concrete] // CHECK:STDOUT: %G: %G.type = struct_value () [concrete] // CHECK:STDOUT: %F.specific_fn: = specific_function %F, @F(%empty_struct_type) [concrete] // CHECK:STDOUT: %C.7a7: type = class_type @C, @C(%empty_struct_type) [concrete] // CHECK:STDOUT: %pattern_type.99a: type = pattern_type %C.7a7 [concrete] -// CHECK:STDOUT: %inst.as_compatible: = inst_value [concrete] { -// CHECK:STDOUT: %.072: ref %C.7a7 = as_compatible @F.%v.var -// CHECK:STDOUT: } -// CHECK:STDOUT: %inst.splice_block: = inst_value [concrete] { -// CHECK:STDOUT: %.432: = splice_block [concrete = ] {} -// CHECK:STDOUT: } +// CHECK:STDOUT: %Destroy.impl_witness.a3f: = impl_witness imports.%Destroy.impl_witness_table, @impl(%C.7a7) [concrete] +// CHECK:STDOUT: %Op.type.add: type = fn_type @Op.2, @impl(%C.7a7) [concrete] +// CHECK:STDOUT: %Op.b1c: %Op.type.add = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.f20: %Destroy.type = facet_value %C.7a7, (%Destroy.impl_witness.a3f) [concrete] +// CHECK:STDOUT: %.2d6: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.f20 [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.b1c, @Op.2(%C.7a7) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -817,18 +924,18 @@ fn G() { F({}); } // CHECK:STDOUT: %C.decl: %C.type = class_decl @C [concrete = constants.%C.generic] { // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0, template [concrete] // CHECK:STDOUT: } { -// CHECK:STDOUT: %T.loc5_18.1: type = bind_symbolic_name T, 0, template [template = %T.loc5_18.2 (constants.%T)] +// CHECK:STDOUT: %T.loc3_18.1: type = bind_symbolic_name T, 0, template [template = %T.loc3_18.2 (constants.%T.8b3d5d.1)] // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] { // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0, template [concrete] // CHECK:STDOUT: } { -// CHECK:STDOUT: %T.loc7_15.1: type = bind_symbolic_name T, 0, template [template = %T.loc7_15.2 (constants.%T)] +// CHECK:STDOUT: %T.loc5_15.1: type = bind_symbolic_name T, 0, template [template = %T.loc5_15.2 (constants.%T.8b3d5d.1)] // CHECK:STDOUT: } // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @C(%T.loc5_18.1: type) { -// CHECK:STDOUT: %T.loc5_18.2: type = bind_symbolic_name T, 0, template [template = %T.loc5_18.2 (constants.%T)] +// CHECK:STDOUT: generic class @C(%T.loc3_18.1: type) { +// CHECK:STDOUT: %T.loc3_18.2: type = bind_symbolic_name T, 0, template [template = %T.loc3_18.2 (constants.%T.8b3d5d.1)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -842,16 +949,18 @@ fn G() { F({}); } // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @F(%T.loc7_15.1: type) { -// CHECK:STDOUT: %T.loc7_15.2: type = bind_symbolic_name T, 0, template [template = %T.loc7_15.2 (constants.%T)] +// CHECK:STDOUT: generic fn @F(%T.loc5_15.1: type) { +// CHECK:STDOUT: %T.loc5_15.2: type = bind_symbolic_name T, 0, template [template = %T.loc5_15.2 (constants.%T.8b3d5d.1)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %C.loc8_13.2: type = class_type @C, @C(%T.loc7_15.2) [template = %C.loc8_13.2 (constants.%C.f2e)] -// CHECK:STDOUT: %require_complete: = require_complete_type %C.loc8_13.2 [template = %require_complete (constants.%require_complete)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %C.loc8_13.2 [template = %pattern_type (constants.%pattern_type.e5e)] -// CHECK:STDOUT: %.3: = refine_type_action %v.var, %C.loc8_13.2 [template] -// CHECK:STDOUT: %.4: = access_optional_member_action %.1, destroy [template] -// CHECK:STDOUT: %.5: type = type_of_inst %.4 [template] +// CHECK:STDOUT: %C.loc6_13.2: type = class_type @C, @C(%T.loc5_15.2) [template = %C.loc6_13.2 (constants.%C.f2e)] +// CHECK:STDOUT: %require_complete: = require_complete_type %C.loc6_13.2 [template = %require_complete (constants.%require_complete.389)] +// CHECK:STDOUT: %pattern_type: type = pattern_type %C.loc6_13.2 [template = %pattern_type (constants.%pattern_type.e5e)] +// CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %C.loc6_13.2, @Destroy [template = %Destroy.lookup_impl_witness (constants.%Destroy.lookup_impl_witness)] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %C.loc6_13.2, (%Destroy.lookup_impl_witness) [template = %Destroy.facet (constants.%Destroy.facet.d66)] +// CHECK:STDOUT: %.loc6_3.3: type = fn_type_with_self_type constants.%Op.type.bae, %Destroy.facet [template = %.loc6_3.3 (constants.%.eb5)] +// CHECK:STDOUT: %impl.elem0.loc6_3.2: @F.%.loc6_3.3 (%.eb5) = impl_witness_access %Destroy.lookup_impl_witness, element0 [template = %impl.elem0.loc6_3.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %specific_impl_fn.loc6_3.2: = specific_impl_function %impl.elem0.loc6_3.2, @Op.1(%Destroy.facet) [template = %specific_impl_fn.loc6_3.2 (constants.%specific_impl_fn)] // CHECK:STDOUT: // CHECK:STDOUT: fn() { // CHECK:STDOUT: !entry: @@ -859,15 +968,19 @@ fn G() { F({}); } // CHECK:STDOUT: %v.patt: @F.%pattern_type (%pattern_type.e5e) = binding_pattern v [concrete] // CHECK:STDOUT: %v.var_patt: @F.%pattern_type (%pattern_type.e5e) = var_pattern %v.patt [concrete] // CHECK:STDOUT: } -// CHECK:STDOUT: %v.var: ref @F.%C.loc8_13.2 (%C.f2e) = var %v.var_patt -// CHECK:STDOUT: %.1: @F.%C.loc8_13.2 (%C.f2e) = splice_inst %.3 -// CHECK:STDOUT: %.2: @F.%.5 (@F.%.5) = splice_inst %.4 -// CHECK:STDOUT: %.loc8: type = splice_block %C.loc8_13.1 [template = %C.loc8_13.2 (constants.%C.f2e)] { +// CHECK:STDOUT: %v.var: ref @F.%C.loc6_13.2 (%C.f2e) = var %v.var_patt +// CHECK:STDOUT: %.loc6_13: type = splice_block %C.loc6_13.1 [template = %C.loc6_13.2 (constants.%C.f2e)] { // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [concrete = constants.%C.generic] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc7_15.1 [template = %T.loc7_15.2 (constants.%T)] -// CHECK:STDOUT: %C.loc8_13.1: type = class_type @C, @C(constants.%T) [template = %C.loc8_13.2 (constants.%C.f2e)] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc5_15.1 [template = %T.loc5_15.2 (constants.%T.8b3d5d.1)] +// CHECK:STDOUT: %C.loc6_13.1: type = class_type @C, @C(constants.%T.8b3d5d.1) [template = %C.loc6_13.2 (constants.%C.f2e)] // CHECK:STDOUT: } -// CHECK:STDOUT: %v: ref @F.%C.loc8_13.2 (%C.f2e) = bind_name v, %v.var +// CHECK:STDOUT: %v: ref @F.%C.loc6_13.2 (%C.f2e) = bind_name v, %v.var +// CHECK:STDOUT: %impl.elem0.loc6_3.1: @F.%.loc6_3.3 (%.eb5) = impl_witness_access constants.%Destroy.lookup_impl_witness, element0 [template = %impl.elem0.loc6_3.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %bound_method.loc6_3.1: = bound_method %v.var, %impl.elem0.loc6_3.1 +// CHECK:STDOUT: %specific_impl_fn.loc6_3.1: = specific_impl_function %impl.elem0.loc6_3.1, @Op.1(constants.%Destroy.facet.d66) [template = %specific_impl_fn.loc6_3.2 (constants.%specific_impl_fn)] +// CHECK:STDOUT: %bound_method.loc6_3.2: = bound_method %v.var, %specific_impl_fn.loc6_3.1 +// CHECK:STDOUT: %.loc6_3.1: @F.%C.loc6_13.2 (%C.f2e) = bind_value %v.var +// CHECK:STDOUT: %.loc6_3.2: init %empty_tuple.type = call %bound_method.loc6_3.2(%.loc6_3.1) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -875,37 +988,39 @@ fn G() { F({}); } // CHECK:STDOUT: fn @G() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] -// CHECK:STDOUT: %.loc11_13: %empty_struct_type = struct_literal () -// CHECK:STDOUT: %.loc11_14: type = converted %.loc11_13, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc9_13: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc9_14: type = converted %.loc9_13, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: %F.specific_fn: = specific_function %F.ref, @F(constants.%empty_struct_type) [concrete = constants.%F.specific_fn] // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.specific_fn() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @C(constants.%T) { -// CHECK:STDOUT: %T.loc5_18.2 => constants.%T +// CHECK:STDOUT: specific @C(constants.%T.8b3d5d.1) { +// CHECK:STDOUT: %T.loc3_18.2 => constants.%T.8b3d5d.1 // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F(constants.%T) { -// CHECK:STDOUT: %T.loc7_15.2 => constants.%T +// CHECK:STDOUT: specific @F(constants.%T.8b3d5d.1) { +// CHECK:STDOUT: %T.loc5_15.2 => constants.%T.8b3d5d.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @F(constants.%empty_struct_type) { -// CHECK:STDOUT: %T.loc7_15.2 => constants.%empty_struct_type +// CHECK:STDOUT: %T.loc5_15.2 => constants.%empty_struct_type // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %C.loc8_13.2 => constants.%C.7a7 +// CHECK:STDOUT: %C.loc6_13.2 => constants.%C.7a7 // CHECK:STDOUT: %require_complete => constants.%complete_type // CHECK:STDOUT: %pattern_type => constants.%pattern_type.99a -// CHECK:STDOUT: %.3 => constants.%inst.as_compatible -// CHECK:STDOUT: %.4 => constants.%inst.splice_block -// CHECK:STDOUT: %.5 => +// CHECK:STDOUT: %Destroy.lookup_impl_witness => constants.%Destroy.impl_witness.a3f +// CHECK:STDOUT: %Destroy.facet => constants.%Destroy.facet.f20 +// CHECK:STDOUT: %.loc6_3.3 => constants.%.2d6 +// CHECK:STDOUT: %impl.elem0.loc6_3.2 => constants.%Op.b1c +// CHECK:STDOUT: %specific_impl_fn.loc6_3.2 => constants.%Op.specific_fn // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @C(constants.%empty_struct_type) { -// CHECK:STDOUT: %T.loc5_18.2 => constants.%empty_struct_type +// CHECK:STDOUT: %T.loc3_18.2 => constants.%empty_struct_type // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/fail_abstract.carbon b/toolchain/check/testdata/class/fail_abstract.carbon index 9efad6825492..fdc6cfeb13e8 100644 --- a/toolchain/check/testdata/class/fail_abstract.carbon +++ b/toolchain/check/testdata/class/fail_abstract.carbon @@ -205,6 +205,7 @@ fn CallReturnAbstract() { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -249,12 +250,16 @@ fn CallReturnAbstract() { // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] // CHECK:STDOUT: %Var.type: type = fn_type @Var [concrete] // CHECK:STDOUT: %Var: %Var.type = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -286,6 +291,7 @@ fn CallReturnAbstract() { // CHECK:STDOUT: %v.var: ref = var %v.var_patt [concrete = ] // CHECK:STDOUT: %Abstract.ref: type = name_ref Abstract, file.%Abstract.decl [concrete = constants.%Abstract] // CHECK:STDOUT: %v: = bind_name v, [concrete = ] +// CHECK:STDOUT: %impl.elem0: = impl_witness_access , element0 [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -303,6 +309,7 @@ fn CallReturnAbstract() { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -356,6 +363,7 @@ fn CallReturnAbstract() { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -407,6 +415,7 @@ fn CallReturnAbstract() { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -476,6 +485,7 @@ fn CallReturnAbstract() { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -553,6 +563,7 @@ fn CallReturnAbstract() { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -636,6 +647,7 @@ fn CallReturnAbstract() { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -719,6 +731,7 @@ fn CallReturnAbstract() { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -769,6 +782,7 @@ fn CallReturnAbstract() { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_abstract_in_tuple.carbon b/toolchain/check/testdata/class/fail_abstract_in_tuple.carbon index 44f2501fc729..0037991588af 100644 --- a/toolchain/check/testdata/class/fail_abstract_in_tuple.carbon +++ b/toolchain/check/testdata/class/fail_abstract_in_tuple.carbon @@ -139,6 +139,7 @@ fn Var5() { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -187,12 +188,16 @@ fn Var5() { // CHECK:STDOUT: %Var: %Var.type = struct_value () [concrete] // CHECK:STDOUT: %tuple.type.85c: type = tuple_type (type) [concrete] // CHECK:STDOUT: %tuple.type.ac6: type = tuple_type (%Abstract2) [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -228,6 +233,7 @@ fn Var5() { // CHECK:STDOUT: %.loc13_21.3: type = converted %.loc13_21.2, constants.%tuple.type.ac6 [concrete = constants.%tuple.type.ac6] // CHECK:STDOUT: } // CHECK:STDOUT: %v: = bind_name v, [concrete = ] +// CHECK:STDOUT: %impl.elem0: = impl_witness_access , element0 [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -248,6 +254,7 @@ fn Var5() { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -305,12 +312,16 @@ fn Var5() { // CHECK:STDOUT: %Var2: %Var2.type = struct_value () [concrete] // CHECK:STDOUT: %tuple.type.24b: type = tuple_type (type, type) [concrete] // CHECK:STDOUT: %tuple.type.e3e: type = tuple_type (%Abstract4, %Abstract5) [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -358,6 +369,7 @@ fn Var5() { // CHECK:STDOUT: %.loc14_32.3: type = converted %.loc14_32.2, constants.%tuple.type.e3e [concrete = constants.%tuple.type.e3e] // CHECK:STDOUT: } // CHECK:STDOUT: %v2: = bind_name v2, [concrete = ] +// CHECK:STDOUT: %impl.elem0: = impl_witness_access , element0 [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -371,12 +383,16 @@ fn Var5() { // CHECK:STDOUT: %Var3: %Var3.type = struct_value () [concrete] // CHECK:STDOUT: %tuple.type.159: type = tuple_type (type, %empty_struct_type) [concrete] // CHECK:STDOUT: %tuple.type.d93: type = tuple_type (%Abstract6, %empty_struct_type) [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -414,6 +430,7 @@ fn Var5() { // CHECK:STDOUT: %.loc13_25.4: type = converted %.loc13_25.2, constants.%tuple.type.d93 [concrete = constants.%tuple.type.d93] // CHECK:STDOUT: } // CHECK:STDOUT: %v3: = bind_name v3, [concrete = ] +// CHECK:STDOUT: %impl.elem0: = impl_witness_access , element0 [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -427,12 +444,16 @@ fn Var5() { // CHECK:STDOUT: %Var4: %Var4.type = struct_value () [concrete] // CHECK:STDOUT: %tuple.type.c8c: type = tuple_type (%empty_struct_type, type) [concrete] // CHECK:STDOUT: %tuple.type.919: type = tuple_type (%empty_struct_type, %Abstract7) [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -470,6 +491,7 @@ fn Var5() { // CHECK:STDOUT: %.loc13_25.4: type = converted %.loc13_25.2, constants.%tuple.type.919 [concrete = constants.%tuple.type.919] // CHECK:STDOUT: } // CHECK:STDOUT: %v4: = bind_name v4, [concrete = ] +// CHECK:STDOUT: %impl.elem0: = impl_witness_access , element0 [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -484,6 +506,7 @@ fn Var5() { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -515,15 +538,19 @@ fn Var5() { // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] // CHECK:STDOUT: %tuple.type.85c: type = tuple_type (type) [concrete] // CHECK:STDOUT: %tuple.type.555: type = tuple_type (%Abstract) [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Main.Abstract: type = import_ref Main//lib, Abstract, loaded [concrete = constants.%Abstract] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Main.import_ref.8f2: = import_ref Main//lib, loc3_26, loaded [concrete = constants.%complete_type] // CHECK:STDOUT: %Main.import_ref.ee1 = import_ref Main//lib, inst18 [no loc], unloaded +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -557,6 +584,7 @@ fn Var5() { // CHECK:STDOUT: %.loc14_21.3: type = converted %.loc14_21.2, constants.%tuple.type.555 [concrete = constants.%tuple.type.555] // CHECK:STDOUT: } // CHECK:STDOUT: %v5: = bind_name v5, [concrete = ] +// CHECK:STDOUT: %impl.elem0: = impl_witness_access , element0 [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_addr_self.carbon b/toolchain/check/testdata/class/fail_addr_self.carbon index f6b7e35a97a8..f4a1d01641e3 100644 --- a/toolchain/check/testdata/class/fail_addr_self.carbon +++ b/toolchain/check/testdata/class/fail_addr_self.carbon @@ -56,13 +56,28 @@ fn F(c: Class, p: Class*) { // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] // CHECK:STDOUT: %F.type.b25: type = fn_type @F.2 [concrete] // CHECK:STDOUT: %F.c41: %F.type.b25 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.fef: = impl_witness imports.%Destroy.impl_witness_table, @impl(%Class) [concrete] +// CHECK:STDOUT: %Op.type.7de: type = fn_type @Op.2, @impl(%Class) [concrete] +// CHECK:STDOUT: %Op.d64: %Op.type.7de = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %Class, (%Destroy.impl_witness.fef) [concrete] +// CHECK:STDOUT: %.b9f: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.d64, @Op.2(%Class) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -132,8 +147,8 @@ fn F(c: Class, p: Class*) { // CHECK:STDOUT: %c.ref.loc32: %Class = name_ref c, %c // CHECK:STDOUT: %F.ref.loc32: %F.type.f1b = name_ref F, @Class.%F.decl [concrete = constants.%F.1f2] // CHECK:STDOUT: %F.bound.loc32: = bound_method %c.ref.loc32, %F.ref.loc32 -// CHECK:STDOUT: %.loc32: ref %Class = temporary_storage -// CHECK:STDOUT: %addr.loc32: %ptr.e71 = addr_of %.loc32 +// CHECK:STDOUT: %.loc32_3.1: ref %Class = temporary_storage +// CHECK:STDOUT: %addr.loc32: %ptr.e71 = addr_of %.loc32_3.1 // CHECK:STDOUT: %F.call.loc32: init %empty_tuple.type = call %F.bound.loc32(%addr.loc32) // CHECK:STDOUT: %c.ref.loc34: %Class = name_ref c, %c // CHECK:STDOUT: %G.ref.loc34: %G.type = name_ref G, @Class.%G.decl [concrete = constants.%G] @@ -151,6 +166,12 @@ fn F(c: Class, p: Class*) { // CHECK:STDOUT: %G.bound.loc39: = bound_method %.loc39_4.1, %G.ref.loc39 // CHECK:STDOUT: %.loc39_4.2: %Class = bind_value %.loc39_4.1 // CHECK:STDOUT: %G.call.loc39: init %empty_tuple.type = call %G.bound.loc39(%.loc39_4.2) +// CHECK:STDOUT: %impl.elem0: %.b9f = impl_witness_access constants.%Destroy.impl_witness.fef, element0 [concrete = constants.%Op.d64] +// CHECK:STDOUT: %bound_method.loc32_3.1: = bound_method %.loc32_3.1, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%Class) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc32_3.2: = bound_method %.loc32_3.1, %specific_fn +// CHECK:STDOUT: %.loc32_3.2: %Class = bind_value %.loc32_3.1 +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc32_3.2(%.loc32_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/field_access.carbon b/toolchain/check/testdata/class/field_access.carbon index cce103c007db..8c1c5ffb8ec0 100644 --- a/toolchain/check/testdata/class/field_access.carbon +++ b/toolchain/check/testdata/class/field_access.carbon @@ -31,6 +31,7 @@ fn Run() { // CHECK:STDOUT: %Class: type = class_type @Class [concrete] // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] // CHECK:STDOUT: %Class.elem: type = unbound_element_type %Class, %i32 [concrete] @@ -61,12 +62,30 @@ fn Run() { // CHECK:STDOUT: %Convert.bound.ef9: = bound_method %int_2.ecc, %Convert.956 [concrete] // CHECK:STDOUT: %bound_method.b92: = bound_method %int_2.ecc, %Convert.specific_fn [concrete] // CHECK:STDOUT: %int_2.ef8: %i32 = int_value 2 [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.2 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.3, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.64e: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.type.a17: type = fn_type @Op.3, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.e6a: %Op.type.a17 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.5f7: %Destroy.type = facet_value %i32, (%Destroy.impl_witness.64e) [concrete] +// CHECK:STDOUT: %.ab7: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.5f7 [concrete] +// CHECK:STDOUT: %Op.specific_fn.014: = specific_function %Op.e6a, @Op.3(%i32) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.fef: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%Class) [concrete] +// CHECK:STDOUT: %Op.type.7de: type = fn_type @Op.3, @impl.49c(%Class) [concrete] +// CHECK:STDOUT: %Op.d64: %Op.type.7de = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.817: %Destroy.type = facet_value %Class, (%Destroy.impl_witness.fef) [concrete] +// CHECK:STDOUT: %.b9f: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.817 [concrete] +// CHECK:STDOUT: %Op.specific_fn.618: = specific_function %Op.d64, @Op.3(%Class) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Int = %Core.Int // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -74,6 +93,9 @@ fn Run() { // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -165,6 +187,24 @@ fn Run() { // CHECK:STDOUT: %i32.loc25: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: %ck: ref %i32 = bind_name ck, %ck.var +// CHECK:STDOUT: %impl.elem0.loc25: %.ab7 = impl_witness_access constants.%Destroy.impl_witness.64e, element0 [concrete = constants.%Op.e6a] +// CHECK:STDOUT: %bound_method.loc25_3.1: = bound_method %ck.var, %impl.elem0.loc25 +// CHECK:STDOUT: %specific_fn.loc25: = specific_function %impl.elem0.loc25, @Op.3(constants.%i32) [concrete = constants.%Op.specific_fn.014] +// CHECK:STDOUT: %bound_method.loc25_3.2: = bound_method %ck.var, %specific_fn.loc25 +// CHECK:STDOUT: %.loc25_3: %i32 = bind_value %ck.var +// CHECK:STDOUT: %no_op.loc25: init %empty_tuple.type = call %bound_method.loc25_3.2(%.loc25_3) +// CHECK:STDOUT: %impl.elem0.loc24: %.ab7 = impl_witness_access constants.%Destroy.impl_witness.64e, element0 [concrete = constants.%Op.e6a] +// CHECK:STDOUT: %bound_method.loc24_3.1: = bound_method %cj.var, %impl.elem0.loc24 +// CHECK:STDOUT: %specific_fn.loc24: = specific_function %impl.elem0.loc24, @Op.3(constants.%i32) [concrete = constants.%Op.specific_fn.014] +// CHECK:STDOUT: %bound_method.loc24_3.2: = bound_method %cj.var, %specific_fn.loc24 +// CHECK:STDOUT: %.loc24_3: %i32 = bind_value %cj.var +// CHECK:STDOUT: %no_op.loc24: init %empty_tuple.type = call %bound_method.loc24_3.2(%.loc24_3) +// CHECK:STDOUT: %impl.elem0.loc21: %.b9f = impl_witness_access constants.%Destroy.impl_witness.fef, element0 [concrete = constants.%Op.d64] +// CHECK:STDOUT: %bound_method.loc21_3.1: = bound_method %c.var, %impl.elem0.loc21 +// CHECK:STDOUT: %specific_fn.loc21: = specific_function %impl.elem0.loc21, @Op.3(constants.%Class) [concrete = constants.%Op.specific_fn.618] +// CHECK:STDOUT: %bound_method.loc21_3.2: = bound_method %c.var, %specific_fn.loc21 +// CHECK:STDOUT: %.loc21: %Class = bind_value %c.var +// CHECK:STDOUT: %no_op.loc21: init %empty_tuple.type = call %bound_method.loc21_3.2(%.loc21) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/field_access_in_value.carbon b/toolchain/check/testdata/class/field_access_in_value.carbon index 15522d0ad431..ef36547cf360 100644 --- a/toolchain/check/testdata/class/field_access_in_value.carbon +++ b/toolchain/check/testdata/class/field_access_in_value.carbon @@ -32,6 +32,7 @@ fn Test() { // CHECK:STDOUT: %Class: type = class_type @Class [concrete] // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] // CHECK:STDOUT: %Class.elem: type = unbound_element_type %Class, %i32 [concrete] @@ -62,12 +63,30 @@ fn Test() { // CHECK:STDOUT: %Convert.bound.ef9: = bound_method %int_2.ecc, %Convert.956 [concrete] // CHECK:STDOUT: %bound_method.b92: = bound_method %int_2.ecc, %Convert.specific_fn [concrete] // CHECK:STDOUT: %int_2.ef8: %i32 = int_value 2 [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.2 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.3, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.64e: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.type.a17: type = fn_type @Op.3, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.e6a: %Op.type.a17 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.5f7: %Destroy.type = facet_value %i32, (%Destroy.impl_witness.64e) [concrete] +// CHECK:STDOUT: %.ab7: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.5f7 [concrete] +// CHECK:STDOUT: %Op.specific_fn.014: = specific_function %Op.e6a, @Op.3(%i32) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.fef: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%Class) [concrete] +// CHECK:STDOUT: %Op.type.7de: type = fn_type @Op.3, @impl.49c(%Class) [concrete] +// CHECK:STDOUT: %Op.d64: %Op.type.7de = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.817: %Destroy.type = facet_value %Class, (%Destroy.impl_witness.fef) [concrete] +// CHECK:STDOUT: %.b9f: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.817 [concrete] +// CHECK:STDOUT: %Op.specific_fn.618: = specific_function %Op.d64, @Op.3(%Class) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Int = %Core.Int // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -75,6 +94,9 @@ fn Test() { // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -173,6 +195,24 @@ fn Test() { // CHECK:STDOUT: %i32.loc26: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: %ck: ref %i32 = bind_name ck, %ck.var +// CHECK:STDOUT: %impl.elem0.loc26: %.ab7 = impl_witness_access constants.%Destroy.impl_witness.64e, element0 [concrete = constants.%Op.e6a] +// CHECK:STDOUT: %bound_method.loc26_3.1: = bound_method %ck.var, %impl.elem0.loc26 +// CHECK:STDOUT: %specific_fn.loc26: = specific_function %impl.elem0.loc26, @Op.3(constants.%i32) [concrete = constants.%Op.specific_fn.014] +// CHECK:STDOUT: %bound_method.loc26_3.2: = bound_method %ck.var, %specific_fn.loc26 +// CHECK:STDOUT: %.loc26_3: %i32 = bind_value %ck.var +// CHECK:STDOUT: %no_op.loc26: init %empty_tuple.type = call %bound_method.loc26_3.2(%.loc26_3) +// CHECK:STDOUT: %impl.elem0.loc25: %.ab7 = impl_witness_access constants.%Destroy.impl_witness.64e, element0 [concrete = constants.%Op.e6a] +// CHECK:STDOUT: %bound_method.loc25_3.1: = bound_method %cj.var, %impl.elem0.loc25 +// CHECK:STDOUT: %specific_fn.loc25: = specific_function %impl.elem0.loc25, @Op.3(constants.%i32) [concrete = constants.%Op.specific_fn.014] +// CHECK:STDOUT: %bound_method.loc25_3.2: = bound_method %cj.var, %specific_fn.loc25 +// CHECK:STDOUT: %.loc25_3: %i32 = bind_value %cj.var +// CHECK:STDOUT: %no_op.loc25: init %empty_tuple.type = call %bound_method.loc25_3.2(%.loc25_3) +// CHECK:STDOUT: %impl.elem0.loc21: %.b9f = impl_witness_access constants.%Destroy.impl_witness.fef, element0 [concrete = constants.%Op.d64] +// CHECK:STDOUT: %bound_method.loc21_3.1: = bound_method %cv.var, %impl.elem0.loc21 +// CHECK:STDOUT: %specific_fn.loc21: = specific_function %impl.elem0.loc21, @Op.3(constants.%Class) [concrete = constants.%Op.specific_fn.618] +// CHECK:STDOUT: %bound_method.loc21_3.2: = bound_method %cv.var, %specific_fn.loc21 +// CHECK:STDOUT: %.loc21: %Class = bind_value %cv.var +// CHECK:STDOUT: %no_op.loc21: init %empty_tuple.type = call %bound_method.loc21_3.2(%.loc21) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/generic/import.carbon b/toolchain/check/testdata/class/generic/import.carbon index 2075ced27fad..e1d3231f5713 100644 --- a/toolchain/check/testdata/class/generic/import.carbon +++ b/toolchain/check/testdata/class/generic/import.carbon @@ -638,6 +638,7 @@ class Class(U:! type) { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Use.type: type = fn_type @Use [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Use: %Use.type = struct_value () [concrete] // CHECK:STDOUT: %CompleteClass.type: type = generic_class_type @CompleteClass [concrete] // CHECK:STDOUT: %CompleteClass.generic: %CompleteClass.type = struct_value () [concrete] @@ -666,6 +667,22 @@ class Class(U:! type) { // CHECK:STDOUT: %F.971: %F.type.0aa = struct_value () [concrete] // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete] // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.2 [concrete] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.3, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.f45: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%CompleteClass.a06) [concrete] +// CHECK:STDOUT: %Op.type.370: type = fn_type @Op.3, @impl.49c(%CompleteClass.a06) [concrete] +// CHECK:STDOUT: %Op.867: %Op.type.370 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.968: %Destroy.type = facet_value %CompleteClass.a06, (%Destroy.impl_witness.f45) [concrete] +// CHECK:STDOUT: %.219: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.968 [concrete] +// CHECK:STDOUT: %Op.specific_fn.0ab: = specific_function %Op.867, @Op.3(%CompleteClass.a06) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.190: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%CompleteClass.0fe) [concrete] +// CHECK:STDOUT: %Op.type.310: type = fn_type @Op.3, @impl.49c(%CompleteClass.0fe) [concrete] +// CHECK:STDOUT: %Op.200: %Op.type.310 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.e96: %Destroy.type = facet_value %CompleteClass.0fe, (%Destroy.impl_witness.190) [concrete] +// CHECK:STDOUT: %.614: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.e96 [concrete] +// CHECK:STDOUT: %Op.specific_fn.a4e: = specific_function %Op.200, @Op.3(%CompleteClass.0fe) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -675,6 +692,7 @@ class Class(U:! type) { // CHECK:STDOUT: %Core.ece: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Int = %Core.Int // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -686,6 +704,9 @@ class Class(U:! type) { // CHECK:STDOUT: %Main.import_ref.5ab3ec.2: type = import_ref Main//foo, loc6_21, loaded [symbolic = @CompleteClass.%T (constants.%T)] // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic] // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -728,9 +749,9 @@ class Class(U:! type) { // CHECK:STDOUT: } // CHECK:STDOUT: %v.var: ref %CompleteClass.0fe = var %v.var_patt // CHECK:STDOUT: %F.ref: %F.type.b25 = name_ref F, imports.%Main.F [concrete = constants.%F.c41] -// CHECK:STDOUT: %.loc14_34: ref %CompleteClass.a06 = temporary_storage -// CHECK:STDOUT: %F.call: init %CompleteClass.a06 = call %F.ref() to %.loc14_34 -// CHECK:STDOUT: %.loc14_3: %CompleteClass.0fe = converted %F.call, [concrete = ] +// CHECK:STDOUT: %.loc14_34.1: ref %CompleteClass.a06 = temporary_storage +// CHECK:STDOUT: %F.call: init %CompleteClass.a06 = call %F.ref() to %.loc14_34.1 +// CHECK:STDOUT: %.loc14_3.1: %CompleteClass.0fe = converted %F.call, [concrete = ] // CHECK:STDOUT: assign %v.var, // CHECK:STDOUT: %.loc14_28: type = splice_block %CompleteClass [concrete = constants.%CompleteClass.0fe] { // CHECK:STDOUT: %CompleteClass.ref: %CompleteClass.type = name_ref CompleteClass, imports.%Main.CompleteClass [concrete = constants.%CompleteClass.generic] @@ -740,6 +761,18 @@ class Class(U:! type) { // CHECK:STDOUT: %CompleteClass: type = class_type @CompleteClass, @CompleteClass(constants.%ptr.9e1) [concrete = constants.%CompleteClass.0fe] // CHECK:STDOUT: } // CHECK:STDOUT: %v: ref %CompleteClass.0fe = bind_name v, %v.var +// CHECK:STDOUT: %impl.elem0.loc14_34: %.219 = impl_witness_access constants.%Destroy.impl_witness.f45, element0 [concrete = constants.%Op.867] +// CHECK:STDOUT: %bound_method.loc14_34.1: = bound_method %.loc14_34.1, %impl.elem0.loc14_34 +// CHECK:STDOUT: %specific_fn.loc14_34: = specific_function %impl.elem0.loc14_34, @Op.3(constants.%CompleteClass.a06) [concrete = constants.%Op.specific_fn.0ab] +// CHECK:STDOUT: %bound_method.loc14_34.2: = bound_method %.loc14_34.1, %specific_fn.loc14_34 +// CHECK:STDOUT: %.loc14_34.2: %CompleteClass.a06 = bind_value %.loc14_34.1 +// CHECK:STDOUT: %no_op.loc14_34: init %empty_tuple.type = call %bound_method.loc14_34.2(%.loc14_34.2) +// CHECK:STDOUT: %impl.elem0.loc14_3: %.614 = impl_witness_access constants.%Destroy.impl_witness.190, element0 [concrete = constants.%Op.200] +// CHECK:STDOUT: %bound_method.loc14_3.1: = bound_method %v.var, %impl.elem0.loc14_3 +// CHECK:STDOUT: %specific_fn.loc14_3: = specific_function %impl.elem0.loc14_3, @Op.3(constants.%CompleteClass.0fe) [concrete = constants.%Op.specific_fn.a4e] +// CHECK:STDOUT: %bound_method.loc14_3.2: = bound_method %v.var, %specific_fn.loc14_3 +// CHECK:STDOUT: %.loc14_3.2: %CompleteClass.0fe = bind_value %v.var +// CHECK:STDOUT: %no_op.loc14_3: init %empty_tuple.type = call %bound_method.loc14_3.2(%.loc14_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/generic/self.carbon b/toolchain/check/testdata/class/generic/self.carbon index f37de3aebd16..a1b21efe989a 100644 --- a/toolchain/check/testdata/class/generic/self.carbon +++ b/toolchain/check/testdata/class/generic/self.carbon @@ -28,6 +28,7 @@ class Class(T:! type) { // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete] // CHECK:STDOUT: %Class.type: type = generic_class_type @Class [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Class.generic: %Class.type = struct_value () [concrete] // CHECK:STDOUT: %Class: type = class_type @Class, @Class(%T) [symbolic] // CHECK:STDOUT: %pattern_type.3c1: type = pattern_type %Class [symbolic] @@ -39,17 +40,26 @@ class Class(T:! type) { // CHECK:STDOUT: %F: %F.type = struct_value () [symbolic] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] -// CHECK:STDOUT: %require_complete: = require_complete_type %Class [symbolic] +// CHECK:STDOUT: %require_complete.4f8: = require_complete_type %Class [symbolic] // CHECK:STDOUT: %Class.val: %Class = struct_value () [symbolic] // CHECK:STDOUT: %MakeSelf.specific_fn: = specific_function %MakeSelf, @MakeSelf(%T) [symbolic] // CHECK:STDOUT: %MakeClass.specific_fn: = specific_function %MakeClass, @MakeClass(%T) [symbolic] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %Class, @Destroy [symbolic] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %Class, (%Destroy.lookup_impl_witness) [symbolic] +// CHECK:STDOUT: %.d76: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [symbolic] +// CHECK:STDOUT: %impl.elem0: %.d76 = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic] +// CHECK:STDOUT: %specific_impl_fn: = specific_impl_function %impl.elem0, @Op.1(%Destroy.facet) [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/destroy, Destroy, loaded [concrete = constants.%Destroy.type] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -117,7 +127,7 @@ class Class(T:! type) { // CHECK:STDOUT: %pattern_type: type = pattern_type %Class [symbolic = %pattern_type (constants.%pattern_type.3c1)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type %Class [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %require_complete: = require_complete_type %Class [symbolic = %require_complete (constants.%require_complete.4f8)] // CHECK:STDOUT: %Class.val: @MakeSelf.%Class (%Class) = struct_value () [symbolic = %Class.val (constants.%Class.val)] // CHECK:STDOUT: // CHECK:STDOUT: fn() -> %return.param: @MakeSelf.%Class (%Class) { @@ -135,7 +145,7 @@ class Class(T:! type) { // CHECK:STDOUT: %pattern_type: type = pattern_type %Class.loc18_28.1 [symbolic = %pattern_type (constants.%pattern_type.3c1)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type %Class.loc18_28.1 [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %require_complete: = require_complete_type %Class.loc18_28.1 [symbolic = %require_complete (constants.%require_complete.4f8)] // CHECK:STDOUT: %Class.val: @MakeClass.%Class.loc18_28.1 (%Class) = struct_value () [symbolic = %Class.val (constants.%Class.val)] // CHECK:STDOUT: // CHECK:STDOUT: fn() -> %return.param: @MakeClass.%Class.loc18_28.1 (%Class) { @@ -151,7 +161,7 @@ class Class(T:! type) { // CHECK:STDOUT: !definition: // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] // CHECK:STDOUT: %Class.loc20_19.2: type = class_type @Class, @Class(%T) [symbolic = %Class.loc20_19.2 (constants.%Class)] -// CHECK:STDOUT: %require_complete: = require_complete_type %Class.loc20_19.2 [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %require_complete: = require_complete_type %Class.loc20_19.2 [symbolic = %require_complete (constants.%require_complete.4f8)] // CHECK:STDOUT: %pattern_type: type = pattern_type %Class.loc20_19.2 [symbolic = %pattern_type (constants.%pattern_type.3c1)] // CHECK:STDOUT: %MakeSelf.type: type = fn_type @MakeSelf, @Class(%T) [symbolic = %MakeSelf.type (constants.%MakeSelf.type)] // CHECK:STDOUT: %MakeSelf: @F.%MakeSelf.type (%MakeSelf.type) = struct_value () [symbolic = %MakeSelf (constants.%MakeSelf)] @@ -159,6 +169,11 @@ class Class(T:! type) { // CHECK:STDOUT: %MakeClass.type: type = fn_type @MakeClass, @Class(%T) [symbolic = %MakeClass.type (constants.%MakeClass.type)] // CHECK:STDOUT: %MakeClass: @F.%MakeClass.type (%MakeClass.type) = struct_value () [symbolic = %MakeClass (constants.%MakeClass)] // CHECK:STDOUT: %MakeClass.specific_fn.loc21_19.2: = specific_function %MakeClass, @MakeClass(%T) [symbolic = %MakeClass.specific_fn.loc21_19.2 (constants.%MakeClass.specific_fn)] +// CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %Class.loc20_19.2, @Destroy [symbolic = %Destroy.lookup_impl_witness (constants.%Destroy.lookup_impl_witness)] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %Class.loc20_19.2, (%Destroy.lookup_impl_witness) [symbolic = %Destroy.facet (constants.%Destroy.facet)] +// CHECK:STDOUT: %.loc21_5.6: type = fn_type_with_self_type constants.%Op.type.bae, %Destroy.facet [symbolic = %.loc21_5.6 (constants.%.d76)] +// CHECK:STDOUT: %impl.elem0.loc21_5.3: @F.%.loc21_5.6 (%.d76) = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc21_5.3 (constants.%impl.elem0)] +// CHECK:STDOUT: %specific_impl_fn.loc21_5.3: = specific_impl_function %impl.elem0.loc21_5.3, @Op.1(%Destroy.facet) [symbolic = %specific_impl_fn.loc21_5.3 (constants.%specific_impl_fn)] // CHECK:STDOUT: // CHECK:STDOUT: fn() { // CHECK:STDOUT: !entry: @@ -170,8 +185,8 @@ class Class(T:! type) { // CHECK:STDOUT: %.loc20_23: @F.%MakeSelf.type (%MakeSelf.type) = specific_constant @Class.%MakeSelf.decl, @Class(constants.%T) [symbolic = %MakeSelf (constants.%MakeSelf)] // CHECK:STDOUT: %MakeSelf.ref: @F.%MakeSelf.type (%MakeSelf.type) = name_ref MakeSelf, %.loc20_23 [symbolic = %MakeSelf (constants.%MakeSelf)] // CHECK:STDOUT: %MakeSelf.specific_fn.loc20_23.1: = specific_function %MakeSelf.ref, @MakeSelf(constants.%T) [symbolic = %MakeSelf.specific_fn.loc20_23.2 (constants.%MakeSelf.specific_fn)] -// CHECK:STDOUT: %.loc20_5: ref @F.%Class.loc20_19.2 (%Class) = splice_block %c.var {} -// CHECK:STDOUT: %MakeSelf.call: init @F.%Class.loc20_19.2 (%Class) = call %MakeSelf.specific_fn.loc20_23.1() to %.loc20_5 +// CHECK:STDOUT: %.loc20_5.1: ref @F.%Class.loc20_19.2 (%Class) = splice_block %c.var {} +// CHECK:STDOUT: %MakeSelf.call: init @F.%Class.loc20_19.2 (%Class) = call %MakeSelf.specific_fn.loc20_23.1() to %.loc20_5.1 // CHECK:STDOUT: assign %c.var, %MakeSelf.call // CHECK:STDOUT: %.loc20_19: type = splice_block %Class.loc20_19.1 [symbolic = %Class.loc20_19.2 (constants.%Class)] { // CHECK:STDOUT: %Class.ref: %Class.type = name_ref Class, file.%Class.decl [concrete = constants.%Class.generic] @@ -187,14 +202,38 @@ class Class(T:! type) { // CHECK:STDOUT: %.loc21_19: @F.%MakeClass.type (%MakeClass.type) = specific_constant @Class.%MakeClass.decl, @Class(constants.%T) [symbolic = %MakeClass (constants.%MakeClass)] // CHECK:STDOUT: %MakeClass.ref: @F.%MakeClass.type (%MakeClass.type) = name_ref MakeClass, %.loc21_19 [symbolic = %MakeClass (constants.%MakeClass)] // CHECK:STDOUT: %MakeClass.specific_fn.loc21_19.1: = specific_function %MakeClass.ref, @MakeClass(constants.%T) [symbolic = %MakeClass.specific_fn.loc21_19.2 (constants.%MakeClass.specific_fn)] -// CHECK:STDOUT: %.loc21_5: ref @F.%Class.loc20_19.2 (%Class) = splice_block %s.var {} -// CHECK:STDOUT: %MakeClass.call: init @F.%Class.loc20_19.2 (%Class) = call %MakeClass.specific_fn.loc21_19.1() to %.loc21_5 +// CHECK:STDOUT: %.loc21_5.1: ref @F.%Class.loc20_19.2 (%Class) = splice_block %s.var {} +// CHECK:STDOUT: %MakeClass.call: init @F.%Class.loc20_19.2 (%Class) = call %MakeClass.specific_fn.loc21_19.1() to %.loc21_5.1 // CHECK:STDOUT: assign %s.var, %MakeClass.call // CHECK:STDOUT: %.loc21_12.1: type = splice_block %Self.ref [symbolic = %Class.loc20_19.2 (constants.%Class)] { // CHECK:STDOUT: %.loc21_12.2: type = specific_constant constants.%Class, @Class(constants.%T) [symbolic = %Class.loc20_19.2 (constants.%Class)] // CHECK:STDOUT: %Self.ref: type = name_ref Self, %.loc21_12.2 [symbolic = %Class.loc20_19.2 (constants.%Class)] // CHECK:STDOUT: } // CHECK:STDOUT: %s: ref @F.%Class.loc20_19.2 (%Class) = bind_name s, %s.var +// CHECK:STDOUT: %impl.elem0.loc21_5.1: @F.%.loc21_5.6 (%.d76) = impl_witness_access constants.%Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc21_5.3 (constants.%impl.elem0)] +// CHECK:STDOUT: %bound_method.loc21_5.1: = bound_method %.loc21_5.1, %impl.elem0.loc21_5.1 +// CHECK:STDOUT: %specific_impl_fn.loc21_5.1: = specific_impl_function %impl.elem0.loc21_5.1, @Op.1(constants.%Destroy.facet) [symbolic = %specific_impl_fn.loc21_5.3 (constants.%specific_impl_fn)] +// CHECK:STDOUT: %bound_method.loc21_5.2: = bound_method %.loc21_5.1, %specific_impl_fn.loc21_5.1 +// CHECK:STDOUT: %.loc21_5.2: @F.%Class.loc20_19.2 (%Class) = bind_value %.loc21_5.1 +// CHECK:STDOUT: %.loc21_5.3: init %empty_tuple.type = call %bound_method.loc21_5.2(%.loc21_5.2) +// CHECK:STDOUT: %impl.elem0.loc21_5.2: @F.%.loc21_5.6 (%.d76) = impl_witness_access constants.%Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc21_5.3 (constants.%impl.elem0)] +// CHECK:STDOUT: %bound_method.loc21_5.3: = bound_method %s.var, %impl.elem0.loc21_5.2 +// CHECK:STDOUT: %specific_impl_fn.loc21_5.2: = specific_impl_function %impl.elem0.loc21_5.2, @Op.1(constants.%Destroy.facet) [symbolic = %specific_impl_fn.loc21_5.3 (constants.%specific_impl_fn)] +// CHECK:STDOUT: %bound_method.loc21_5.4: = bound_method %s.var, %specific_impl_fn.loc21_5.2 +// CHECK:STDOUT: %.loc21_5.4: @F.%Class.loc20_19.2 (%Class) = bind_value %s.var +// CHECK:STDOUT: %.loc21_5.5: init %empty_tuple.type = call %bound_method.loc21_5.4(%.loc21_5.4) +// CHECK:STDOUT: %impl.elem0.loc20_5.1: @F.%.loc21_5.6 (%.d76) = impl_witness_access constants.%Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc21_5.3 (constants.%impl.elem0)] +// CHECK:STDOUT: %bound_method.loc20_5.1: = bound_method %.loc20_5.1, %impl.elem0.loc20_5.1 +// CHECK:STDOUT: %specific_impl_fn.loc20_5.1: = specific_impl_function %impl.elem0.loc20_5.1, @Op.1(constants.%Destroy.facet) [symbolic = %specific_impl_fn.loc21_5.3 (constants.%specific_impl_fn)] +// CHECK:STDOUT: %bound_method.loc20_5.2: = bound_method %.loc20_5.1, %specific_impl_fn.loc20_5.1 +// CHECK:STDOUT: %.loc20_5.2: @F.%Class.loc20_19.2 (%Class) = bind_value %.loc20_5.1 +// CHECK:STDOUT: %.loc20_5.3: init %empty_tuple.type = call %bound_method.loc20_5.2(%.loc20_5.2) +// CHECK:STDOUT: %impl.elem0.loc20_5.2: @F.%.loc21_5.6 (%.d76) = impl_witness_access constants.%Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc21_5.3 (constants.%impl.elem0)] +// CHECK:STDOUT: %bound_method.loc20_5.3: = bound_method %c.var, %impl.elem0.loc20_5.2 +// CHECK:STDOUT: %specific_impl_fn.loc20_5.2: = specific_impl_function %impl.elem0.loc20_5.2, @Op.1(constants.%Destroy.facet) [symbolic = %specific_impl_fn.loc21_5.3 (constants.%specific_impl_fn)] +// CHECK:STDOUT: %bound_method.loc20_5.4: = bound_method %c.var, %specific_impl_fn.loc20_5.2 +// CHECK:STDOUT: %.loc20_5.4: @F.%Class.loc20_19.2 (%Class) = bind_value %c.var +// CHECK:STDOUT: %.loc20_5.5: init %empty_tuple.type = call %bound_method.loc20_5.4(%.loc20_5.4) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -217,7 +256,7 @@ class Class(T:! type) { // CHECK:STDOUT: %pattern_type => constants.%pattern_type.3c1 // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete => constants.%require_complete +// CHECK:STDOUT: %require_complete => constants.%require_complete.4f8 // CHECK:STDOUT: %Class.val => constants.%Class.val // CHECK:STDOUT: } // CHECK:STDOUT: @@ -227,7 +266,7 @@ class Class(T:! type) { // CHECK:STDOUT: %pattern_type => constants.%pattern_type.3c1 // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete => constants.%require_complete +// CHECK:STDOUT: %require_complete => constants.%require_complete.4f8 // CHECK:STDOUT: %Class.val => constants.%Class.val // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/import.carbon b/toolchain/check/testdata/class/import.carbon index eb2681c38638..e97f85d6aad1 100644 --- a/toolchain/check/testdata/class/import.carbon +++ b/toolchain/check/testdata/class/import.carbon @@ -216,6 +216,41 @@ fn Run() { // CHECK:STDOUT: %Incomplete: type = class_type @Incomplete [concrete] // CHECK:STDOUT: %ptr.c62: type = ptr_type %Incomplete [concrete] // CHECK:STDOUT: %pattern_type.275: type = pattern_type %ptr.c62 [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.2 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.3, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.0f1: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%ptr.c62) [concrete] +// CHECK:STDOUT: %Op.type.7f0: type = fn_type @Op.3, @impl.49c(%ptr.c62) [concrete] +// CHECK:STDOUT: %Op.90d: %Op.type.7f0 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.f98: %Destroy.type = facet_value %ptr.c62, (%Destroy.impl_witness.0f1) [concrete] +// CHECK:STDOUT: %.1e9: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.f98 [concrete] +// CHECK:STDOUT: %Op.specific_fn.b24: = specific_function %Op.90d, @Op.3(%ptr.c62) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.20e: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%ptr.6cf) [concrete] +// CHECK:STDOUT: %Op.type.d2a: type = fn_type @Op.3, @impl.49c(%ptr.6cf) [concrete] +// CHECK:STDOUT: %Op.3b0: %Op.type.d2a = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.c42: %Destroy.type = facet_value %ptr.6cf, (%Destroy.impl_witness.20e) [concrete] +// CHECK:STDOUT: %.581: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.c42 [concrete] +// CHECK:STDOUT: %Op.specific_fn.3de: = specific_function %Op.3b0, @Op.3(%ptr.6cf) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.ff6: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%ForwardDeclared.7b34f2.1) [concrete] +// CHECK:STDOUT: %Op.type.308: type = fn_type @Op.3, @impl.49c(%ForwardDeclared.7b34f2.1) [concrete] +// CHECK:STDOUT: %Op.9e2: %Op.type.308 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.0e6: %Destroy.type = facet_value %ForwardDeclared.7b34f2.1, (%Destroy.impl_witness.ff6) [concrete] +// CHECK:STDOUT: %.21e: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.0e6 [concrete] +// CHECK:STDOUT: %Op.specific_fn.09a: = specific_function %Op.9e2, @Op.3(%ForwardDeclared.7b34f2.1) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.913: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%Field) [concrete] +// CHECK:STDOUT: %Op.type.47c: type = fn_type @Op.3, @impl.49c(%Field) [concrete] +// CHECK:STDOUT: %Op.576: %Op.type.47c = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.30c: %Destroy.type = facet_value %Field, (%Destroy.impl_witness.913) [concrete] +// CHECK:STDOUT: %.e41: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.30c [concrete] +// CHECK:STDOUT: %Op.specific_fn.29d: = specific_function %Op.576, @Op.3(%Field) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.5ee: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%Empty) [concrete] +// CHECK:STDOUT: %Op.type.b74: type = fn_type @Op.3, @impl.49c(%Empty) [concrete] +// CHECK:STDOUT: %Op.6e4: %Op.type.b74 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.96b: %Destroy.type = facet_value %Empty, (%Destroy.impl_witness.5ee) [concrete] +// CHECK:STDOUT: %.98a: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.96b [concrete] +// CHECK:STDOUT: %Op.specific_fn.1a5: = specific_function %Op.6e4, @Op.3(%Empty) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -225,6 +260,7 @@ fn Run() { // CHECK:STDOUT: %Main.Incomplete: type = import_ref Main//a, Incomplete, loaded [concrete = constants.%Incomplete] // CHECK:STDOUT: %Core.ece: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -245,6 +281,9 @@ fn Run() { // CHECK:STDOUT: %Main.import_ref.39e731.2 = import_ref Main//a, inst59 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.42a = import_ref Main//a, loc14_21, unloaded // CHECK:STDOUT: %Main.import_ref.67a = import_ref Main//a, loc15_27, unloaded +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -305,8 +344,8 @@ fn Run() { // CHECK:STDOUT: %a.var: ref %Empty = var %a.var_patt // CHECK:STDOUT: %.loc7_19.1: %empty_struct_type = struct_literal () // CHECK:STDOUT: %.loc7_19.2: init %Empty = class_init (), %a.var [concrete = constants.%Empty.val] -// CHECK:STDOUT: %.loc7_3: init %Empty = converted %.loc7_19.1, %.loc7_19.2 [concrete = constants.%Empty.val] -// CHECK:STDOUT: assign %a.var, %.loc7_3 +// CHECK:STDOUT: %.loc7_3.1: init %Empty = converted %.loc7_19.1, %.loc7_19.2 [concrete = constants.%Empty.val] +// CHECK:STDOUT: assign %a.var, %.loc7_3.1 // CHECK:STDOUT: %Empty.ref: type = name_ref Empty, imports.%Main.Empty [concrete = constants.%Empty] // CHECK:STDOUT: %a: ref %Empty = bind_name a, %a.var // CHECK:STDOUT: name_binding_decl { @@ -316,17 +355,17 @@ fn Run() { // CHECK:STDOUT: %b.var: ref %Field = var %b.var_patt // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] // CHECK:STDOUT: %.loc9_25.1: %struct_type.x.c96 = struct_literal (%int_1) -// CHECK:STDOUT: %impl.elem0.loc9: %.d6a = impl_witness_access constants.%ImplicitAs.impl_witness.e34, element0 [concrete = constants.%Convert.16d] -// CHECK:STDOUT: %bound_method.loc9_25.1: = bound_method %int_1, %impl.elem0.loc9 [concrete = constants.%Convert.bound.43e] -// CHECK:STDOUT: %specific_fn.loc9: = specific_function %impl.elem0.loc9, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc9_25.2: = bound_method %int_1, %specific_fn.loc9 [concrete = constants.%bound_method.947] +// CHECK:STDOUT: %impl.elem0.loc9_25: %.d6a = impl_witness_access constants.%ImplicitAs.impl_witness.e34, element0 [concrete = constants.%Convert.16d] +// CHECK:STDOUT: %bound_method.loc9_25.1: = bound_method %int_1, %impl.elem0.loc9_25 [concrete = constants.%Convert.bound.43e] +// CHECK:STDOUT: %specific_fn.loc9_25: = specific_function %impl.elem0.loc9_25, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc9_25.2: = bound_method %int_1, %specific_fn.loc9_25 [concrete = constants.%bound_method.947] // CHECK:STDOUT: %int.convert_checked.loc9: init %i32 = call %bound_method.loc9_25.2(%int_1) [concrete = constants.%int_1.47b] // CHECK:STDOUT: %.loc9_25.2: init %i32 = converted %int_1, %int.convert_checked.loc9 [concrete = constants.%int_1.47b] // CHECK:STDOUT: %.loc9_25.3: ref %i32 = class_element_access %b.var, element0 // CHECK:STDOUT: %.loc9_25.4: init %i32 = initialize_from %.loc9_25.2 to %.loc9_25.3 [concrete = constants.%int_1.47b] // CHECK:STDOUT: %.loc9_25.5: init %Field = class_init (%.loc9_25.4), %b.var [concrete = constants.%Field.val] -// CHECK:STDOUT: %.loc9_3: init %Field = converted %.loc9_25.1, %.loc9_25.5 [concrete = constants.%Field.val] -// CHECK:STDOUT: assign %b.var, %.loc9_3 +// CHECK:STDOUT: %.loc9_3.1: init %Field = converted %.loc9_25.1, %.loc9_25.5 [concrete = constants.%Field.val] +// CHECK:STDOUT: assign %b.var, %.loc9_3.1 // CHECK:STDOUT: %Field.ref: type = name_ref Field, imports.%Main.Field [concrete = constants.%Field] // CHECK:STDOUT: %b: ref %Field = bind_name b, %b.var // CHECK:STDOUT: %b.ref: ref %Field = name_ref b, %b @@ -347,8 +386,8 @@ fn Run() { // CHECK:STDOUT: %c.var: ref %ForwardDeclared.7b34f2.1 = var %c.var_patt // CHECK:STDOUT: %.loc12_29.1: %empty_struct_type = struct_literal () // CHECK:STDOUT: %.loc12_29.2: init %ForwardDeclared.7b34f2.1 = class_init (), %c.var [concrete = constants.%ForwardDeclared.val] -// CHECK:STDOUT: %.loc12_3: init %ForwardDeclared.7b34f2.1 = converted %.loc12_29.1, %.loc12_29.2 [concrete = constants.%ForwardDeclared.val] -// CHECK:STDOUT: assign %c.var, %.loc12_3 +// CHECK:STDOUT: %.loc12_3.1: init %ForwardDeclared.7b34f2.1 = converted %.loc12_29.1, %.loc12_29.2 [concrete = constants.%ForwardDeclared.val] +// CHECK:STDOUT: assign %c.var, %.loc12_3.1 // CHECK:STDOUT: %ForwardDeclared.ref.loc12: type = name_ref ForwardDeclared, imports.%Main.ForwardDeclared [concrete = constants.%ForwardDeclared.7b34f2.1] // CHECK:STDOUT: %c: ref %ForwardDeclared.7b34f2.1 = bind_name c, %c.var // CHECK:STDOUT: %c.ref.loc13: ref %ForwardDeclared.7b34f2.1 = name_ref c, %c @@ -369,7 +408,7 @@ fn Run() { // CHECK:STDOUT: %c.ref.loc16: ref %ForwardDeclared.7b34f2.1 = name_ref c, %c // CHECK:STDOUT: %addr.loc16: %ptr.6cf = addr_of %c.ref.loc16 // CHECK:STDOUT: assign %d.var, %addr.loc16 -// CHECK:STDOUT: %.loc16: type = splice_block %ptr.loc16 [concrete = constants.%ptr.6cf] { +// CHECK:STDOUT: %.loc16_25: type = splice_block %ptr.loc16 [concrete = constants.%ptr.6cf] { // CHECK:STDOUT: %ForwardDeclared.ref.loc16: type = name_ref ForwardDeclared, imports.%Main.ForwardDeclared [concrete = constants.%ForwardDeclared.7b34f2.1] // CHECK:STDOUT: %ptr.loc16: type = ptr_type %ForwardDeclared.ref.loc16 [concrete = constants.%ptr.6cf] // CHECK:STDOUT: } @@ -379,11 +418,41 @@ fn Run() { // CHECK:STDOUT: %e.var_patt: %pattern_type.275 = var_pattern %e.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %e.var: ref %ptr.c62 = var %e.var_patt -// CHECK:STDOUT: %.loc18: type = splice_block %ptr.loc18 [concrete = constants.%ptr.c62] { +// CHECK:STDOUT: %.loc18_20: type = splice_block %ptr.loc18 [concrete = constants.%ptr.c62] { // CHECK:STDOUT: %Incomplete.ref: type = name_ref Incomplete, imports.%Main.Incomplete [concrete = constants.%Incomplete] // CHECK:STDOUT: %ptr.loc18: type = ptr_type %Incomplete.ref [concrete = constants.%ptr.c62] // CHECK:STDOUT: } // CHECK:STDOUT: %e: ref %ptr.c62 = bind_name e, %e.var +// CHECK:STDOUT: %impl.elem0.loc18: %.1e9 = impl_witness_access constants.%Destroy.impl_witness.0f1, element0 [concrete = constants.%Op.90d] +// CHECK:STDOUT: %bound_method.loc18_3.1: = bound_method %e.var, %impl.elem0.loc18 +// CHECK:STDOUT: %specific_fn.loc18: = specific_function %impl.elem0.loc18, @Op.3(constants.%ptr.c62) [concrete = constants.%Op.specific_fn.b24] +// CHECK:STDOUT: %bound_method.loc18_3.2: = bound_method %e.var, %specific_fn.loc18 +// CHECK:STDOUT: %.loc18_3: %ptr.c62 = bind_value %e.var +// CHECK:STDOUT: %no_op.loc18: init %empty_tuple.type = call %bound_method.loc18_3.2(%.loc18_3) +// CHECK:STDOUT: %impl.elem0.loc16: %.581 = impl_witness_access constants.%Destroy.impl_witness.20e, element0 [concrete = constants.%Op.3b0] +// CHECK:STDOUT: %bound_method.loc16_3.1: = bound_method %d.var, %impl.elem0.loc16 +// CHECK:STDOUT: %specific_fn.loc16: = specific_function %impl.elem0.loc16, @Op.3(constants.%ptr.6cf) [concrete = constants.%Op.specific_fn.3de] +// CHECK:STDOUT: %bound_method.loc16_3.2: = bound_method %d.var, %specific_fn.loc16 +// CHECK:STDOUT: %.loc16_3: %ptr.6cf = bind_value %d.var +// CHECK:STDOUT: %no_op.loc16: init %empty_tuple.type = call %bound_method.loc16_3.2(%.loc16_3) +// CHECK:STDOUT: %impl.elem0.loc12: %.21e = impl_witness_access constants.%Destroy.impl_witness.ff6, element0 [concrete = constants.%Op.9e2] +// CHECK:STDOUT: %bound_method.loc12_3.1: = bound_method %c.var, %impl.elem0.loc12 +// CHECK:STDOUT: %specific_fn.loc12: = specific_function %impl.elem0.loc12, @Op.3(constants.%ForwardDeclared.7b34f2.1) [concrete = constants.%Op.specific_fn.09a] +// CHECK:STDOUT: %bound_method.loc12_3.2: = bound_method %c.var, %specific_fn.loc12 +// CHECK:STDOUT: %.loc12_3.2: %ForwardDeclared.7b34f2.1 = bind_value %c.var +// CHECK:STDOUT: %no_op.loc12: init %empty_tuple.type = call %bound_method.loc12_3.2(%.loc12_3.2) +// CHECK:STDOUT: %impl.elem0.loc9_3: %.e41 = impl_witness_access constants.%Destroy.impl_witness.913, element0 [concrete = constants.%Op.576] +// CHECK:STDOUT: %bound_method.loc9_3.1: = bound_method %b.var, %impl.elem0.loc9_3 +// CHECK:STDOUT: %specific_fn.loc9_3: = specific_function %impl.elem0.loc9_3, @Op.3(constants.%Field) [concrete = constants.%Op.specific_fn.29d] +// CHECK:STDOUT: %bound_method.loc9_3.2: = bound_method %b.var, %specific_fn.loc9_3 +// CHECK:STDOUT: %.loc9_3.2: %Field = bind_value %b.var +// CHECK:STDOUT: %no_op.loc9: init %empty_tuple.type = call %bound_method.loc9_3.2(%.loc9_3.2) +// CHECK:STDOUT: %impl.elem0.loc7: %.98a = impl_witness_access constants.%Destroy.impl_witness.5ee, element0 [concrete = constants.%Op.6e4] +// CHECK:STDOUT: %bound_method.loc7_3.1: = bound_method %a.var, %impl.elem0.loc7 +// CHECK:STDOUT: %specific_fn.loc7: = specific_function %impl.elem0.loc7, @Op.3(constants.%Empty) [concrete = constants.%Op.specific_fn.1a5] +// CHECK:STDOUT: %bound_method.loc7_3.2: = bound_method %a.var, %specific_fn.loc7 +// CHECK:STDOUT: %.loc7_3.2: %Empty = bind_value %a.var +// CHECK:STDOUT: %no_op.loc7: init %empty_tuple.type = call %bound_method.loc7_3.2(%.loc7_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/import_base.carbon b/toolchain/check/testdata/class/import_base.carbon index ce17bae7aeb4..3cc8d518f77e 100644 --- a/toolchain/check/testdata/class/import_base.carbon +++ b/toolchain/check/testdata/class/import_base.carbon @@ -182,6 +182,17 @@ fn Run() { // CHECK:STDOUT: %int_2.d0d: %i32 = int_value 2 [concrete] // CHECK:STDOUT: %F.type: type = fn_type @F [concrete] // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.2 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.3, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.23a: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%Child) [concrete] +// CHECK:STDOUT: %Op.type.ea2: type = fn_type @Op.3, @impl.49c(%Child) [concrete] +// CHECK:STDOUT: %Op.c04: %Op.type.ea2 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %Child, (%Destroy.impl_witness.23a) [concrete] +// CHECK:STDOUT: %.337: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.c04, @Op.3(%Child) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -189,6 +200,7 @@ fn Run() { // CHECK:STDOUT: %Main.Child: type = import_ref Main//a, Child, loaded [concrete = constants.%Child] // CHECK:STDOUT: %Core.ece: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -206,6 +218,9 @@ fn Run() { // CHECK:STDOUT: %Core.import_ref.a86: @impl.c81.%Convert.type (%Convert.type.0b2) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @impl.c81.%Convert (constants.%Convert.6d7)] // CHECK:STDOUT: %ImplicitAs.impl_witness_table.e36 = impl_witness_table (%Core.import_ref.a86), @impl.c81 [concrete] // CHECK:STDOUT: %.720: %Base.elem = field_decl x, element0 [concrete] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -273,8 +288,8 @@ fn Run() { // CHECK:STDOUT: %.loc7_47.8: init %Base = class_init (%.loc7_47.4, %.loc7_47.7), %.loc7_48.2 [concrete = constants.%Base.val] // CHECK:STDOUT: %.loc7_48.3: init %Base = converted %.loc7_47.1, %.loc7_47.8 [concrete = constants.%Base.val] // CHECK:STDOUT: %.loc7_48.4: init %Child = class_init (%.loc7_48.3), %a.var [concrete = constants.%Child.val] -// CHECK:STDOUT: %.loc7_3: init %Child = converted %.loc7_48.1, %.loc7_48.4 [concrete = constants.%Child.val] -// CHECK:STDOUT: assign %a.var, %.loc7_3 +// CHECK:STDOUT: %.loc7_3.1: init %Child = converted %.loc7_48.1, %.loc7_48.4 [concrete = constants.%Child.val] +// CHECK:STDOUT: assign %a.var, %.loc7_3.1 // CHECK:STDOUT: %Child.ref: type = name_ref Child, imports.%Main.Child [concrete = constants.%Child] // CHECK:STDOUT: %a: ref %Child = bind_name a, %a.var // CHECK:STDOUT: %a.ref.loc8: ref %Child = name_ref a, %a @@ -297,6 +312,12 @@ fn Run() { // CHECK:STDOUT: %.loc9_3.2: ref %Base = converted %a.ref.loc9, %.loc9_3.1 // CHECK:STDOUT: %.loc9_3.3: %Base = bind_value %.loc9_3.2 // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.bound(%.loc9_3.3) +// CHECK:STDOUT: %impl.elem0.loc7_3: %.337 = impl_witness_access constants.%Destroy.impl_witness.23a, element0 [concrete = constants.%Op.c04] +// CHECK:STDOUT: %bound_method.loc7_3.1: = bound_method %a.var, %impl.elem0.loc7_3 +// CHECK:STDOUT: %specific_fn.loc7_3: = specific_function %impl.elem0.loc7_3, @Op.3(constants.%Child) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_3.2: = bound_method %a.var, %specific_fn.loc7_3 +// CHECK:STDOUT: %.loc7_3.2: %Child = bind_value %a.var +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc7_3.2(%.loc7_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/import_member_cycle.carbon b/toolchain/check/testdata/class/import_member_cycle.carbon index 709981be4180..2d52649546f3 100644 --- a/toolchain/check/testdata/class/import_member_cycle.carbon +++ b/toolchain/check/testdata/class/import_member_cycle.carbon @@ -74,23 +74,39 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Run.type: type = fn_type @Run [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Run: %Run.type = struct_value () [concrete] // CHECK:STDOUT: %Cycle: type = class_type @Cycle [concrete] -// CHECK:STDOUT: %ptr: type = ptr_type %Cycle [concrete] -// CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %ptr} [concrete] -// CHECK:STDOUT: %complete_type: = complete_type_witness %struct_type.a [concrete] -// CHECK:STDOUT: %pattern_type: type = pattern_type %ptr [concrete] +// CHECK:STDOUT: %ptr.257: type = ptr_type %Cycle [concrete] +// CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %ptr.257} [concrete] +// CHECK:STDOUT: %complete_type.e4b: = complete_type_witness %struct_type.a [concrete] +// CHECK:STDOUT: %pattern_type.d3d: type = pattern_type %ptr.257 [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.2ce: = impl_witness imports.%Destroy.impl_witness_table, @impl(%ptr.257) [concrete] +// CHECK:STDOUT: %Op.type.a45: type = fn_type @Op.2, @impl(%ptr.257) [concrete] +// CHECK:STDOUT: %Op.109: %Op.type.a45 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %ptr.257, (%Destroy.impl_witness.2ce) [concrete] +// CHECK:STDOUT: %.dff: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.109, @Op.2(%ptr.257) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Main.Cycle: type = import_ref Main//a, Cycle, loaded [concrete = constants.%Cycle] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } -// CHECK:STDOUT: %Main.import_ref.72d: = import_ref Main//a, loc6_1, loaded [concrete = constants.%complete_type] +// CHECK:STDOUT: %Main.import_ref.72d: = import_ref Main//a, loc6_1, loaded [concrete = constants.%complete_type.e4b] // CHECK:STDOUT: %Main.import_ref.3a6 = import_ref Main//a, inst18 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.4e0 = import_ref Main//a, loc5_8, unloaded +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -115,15 +131,21 @@ fn Run() { // CHECK:STDOUT: fn @Run() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %a.patt: %pattern_type = binding_pattern a [concrete] -// CHECK:STDOUT: %a.var_patt: %pattern_type = var_pattern %a.patt [concrete] +// CHECK:STDOUT: %a.patt: %pattern_type.d3d = binding_pattern a [concrete] +// CHECK:STDOUT: %a.var_patt: %pattern_type.d3d = var_pattern %a.patt [concrete] // CHECK:STDOUT: } -// CHECK:STDOUT: %a.var: ref %ptr = var %a.var_patt -// CHECK:STDOUT: %.loc7: type = splice_block %ptr [concrete = constants.%ptr] { +// CHECK:STDOUT: %a.var: ref %ptr.257 = var %a.var_patt +// CHECK:STDOUT: %.loc7_15: type = splice_block %ptr [concrete = constants.%ptr.257] { // CHECK:STDOUT: %Cycle.ref: type = name_ref Cycle, imports.%Main.Cycle [concrete = constants.%Cycle] -// CHECK:STDOUT: %ptr: type = ptr_type %Cycle.ref [concrete = constants.%ptr] +// CHECK:STDOUT: %ptr: type = ptr_type %Cycle.ref [concrete = constants.%ptr.257] // CHECK:STDOUT: } -// CHECK:STDOUT: %a: ref %ptr = bind_name a, %a.var +// CHECK:STDOUT: %a: ref %ptr.257 = bind_name a, %a.var +// CHECK:STDOUT: %impl.elem0: %.dff = impl_witness_access constants.%Destroy.impl_witness.2ce, element0 [concrete = constants.%Op.109] +// CHECK:STDOUT: %bound_method.loc7_3.1: = bound_method %a.var, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%ptr.257) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_3.2: = bound_method %a.var, %specific_fn +// CHECK:STDOUT: %.loc7_3: %ptr.257 = bind_value %a.var +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc7_3.2(%.loc7_3) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/nested.carbon b/toolchain/check/testdata/class/nested.carbon index 261b6b22210a..a3644bc19dc0 100644 --- a/toolchain/check/testdata/class/nested.carbon +++ b/toolchain/check/testdata/class/nested.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/none.carbon +// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/destroy.carbon // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only". // EXTRA-ARGS: --dump-sem-ir-ranges=if-present // @@ -58,6 +58,7 @@ fn F(a: Outer*) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %Outer: type = class_type @Outer [concrete] // CHECK:STDOUT: %F.type.288: type = fn_type @F.1 [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %F.bd8: %F.type.288 = struct_value () [concrete] // CHECK:STDOUT: %Inner: type = class_type @Inner [concrete] // CHECK:STDOUT: %ptr.36a: type = ptr_type %Inner [concrete] @@ -76,17 +77,47 @@ fn F(a: Outer*) { // CHECK:STDOUT: %complete_type.e99: = complete_type_witness %struct_type.po.qo.pi [concrete] // CHECK:STDOUT: %pattern_type.e74: type = pattern_type %Outer [concrete] // CHECK:STDOUT: %pattern_type.906: type = pattern_type %Inner [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.768: = impl_witness imports.%Destroy.impl_witness_table, @impl(%Inner) [concrete] +// CHECK:STDOUT: %Op.type.9bc: type = fn_type @Op.2, @impl(%Inner) [concrete] +// CHECK:STDOUT: %Op.754: %Op.type.9bc = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.adc: %Destroy.type = facet_value %Inner, (%Destroy.impl_witness.768) [concrete] +// CHECK:STDOUT: %.6f6: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.adc [concrete] +// CHECK:STDOUT: %Op.specific_fn.72f: = specific_function %Op.754, @Op.2(%Inner) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.e12: = impl_witness imports.%Destroy.impl_witness_table, @impl(%Outer) [concrete] +// CHECK:STDOUT: %Op.type.50c: type = fn_type @Op.2, @impl(%Outer) [concrete] +// CHECK:STDOUT: %Op.8d4: %Op.type.50c = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.c71: %Destroy.type = facet_value %Outer, (%Destroy.impl_witness.e12) [concrete] +// CHECK:STDOUT: %.2c9: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.c71 [concrete] +// CHECK:STDOUT: %Op.specific_fn.2a1: = specific_function %Op.8d4, @Op.2(%Outer) [concrete] // CHECK:STDOUT: %pattern_type.95c: type = pattern_type %ptr.5df [concrete] // CHECK:STDOUT: %F.type.b25: type = fn_type @F.2 [concrete] // CHECK:STDOUT: %F.c41: %F.type.b25 = struct_value () [concrete] // CHECK:STDOUT: %pattern_type.27f: type = pattern_type %ptr.36a [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: .Outer = %Outer.decl // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %Outer.decl: type = class_decl @Outer [concrete = constants.%Outer] {} {} // CHECK:STDOUT: %F.decl: %F.type.b25 = fn_decl @F.2 [concrete = constants.%F.c41] { // CHECK:STDOUT: %a.patt: %pattern_type.95c = binding_pattern a [concrete] @@ -170,6 +201,18 @@ fn F(a: Outer*) { // CHECK:STDOUT: %i.var: ref %Inner = var %i.var_patt // CHECK:STDOUT: %Inner.ref: type = name_ref Inner, @Outer.%Inner.decl [concrete = constants.%Inner] // CHECK:STDOUT: %i: ref %Inner = bind_name i, %i.var +// CHECK:STDOUT: %impl.elem0.loc19: %.6f6 = impl_witness_access constants.%Destroy.impl_witness.768, element0 [concrete = constants.%Op.754] +// CHECK:STDOUT: %bound_method.loc19_5.1: = bound_method %i.var, %impl.elem0.loc19 +// CHECK:STDOUT: %specific_fn.loc19: = specific_function %impl.elem0.loc19, @Op.2(constants.%Inner) [concrete = constants.%Op.specific_fn.72f] +// CHECK:STDOUT: %bound_method.loc19_5.2: = bound_method %i.var, %specific_fn.loc19 +// CHECK:STDOUT: %.loc19: %Inner = bind_value %i.var +// CHECK:STDOUT: %no_op.loc19: init %empty_tuple.type = call %bound_method.loc19_5.2(%.loc19) +// CHECK:STDOUT: %impl.elem0.loc18: %.2c9 = impl_witness_access constants.%Destroy.impl_witness.e12, element0 [concrete = constants.%Op.8d4] +// CHECK:STDOUT: %bound_method.loc18_5.1: = bound_method %o.var, %impl.elem0.loc18 +// CHECK:STDOUT: %specific_fn.loc18: = specific_function %impl.elem0.loc18, @Op.2(constants.%Outer) [concrete = constants.%Op.specific_fn.2a1] +// CHECK:STDOUT: %bound_method.loc18_5.2: = bound_method %o.var, %specific_fn.loc18 +// CHECK:STDOUT: %.loc18: %Outer = bind_value %o.var +// CHECK:STDOUT: %no_op.loc18: init %empty_tuple.type = call %bound_method.loc18_5.2(%.loc18) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -189,6 +232,18 @@ fn F(a: Outer*) { // CHECK:STDOUT: %i.var: ref %Inner = var %i.var_patt // CHECK:STDOUT: %Inner.ref: type = name_ref Inner, @Outer.%Inner.decl [concrete = constants.%Inner] // CHECK:STDOUT: %i: ref %Inner = bind_name i, %i.var +// CHECK:STDOUT: %impl.elem0.loc30: %.6f6 = impl_witness_access constants.%Destroy.impl_witness.768, element0 [concrete = constants.%Op.754] +// CHECK:STDOUT: %bound_method.loc30_7.1: = bound_method %i.var, %impl.elem0.loc30 +// CHECK:STDOUT: %specific_fn.loc30: = specific_function %impl.elem0.loc30, @Op.2(constants.%Inner) [concrete = constants.%Op.specific_fn.72f] +// CHECK:STDOUT: %bound_method.loc30_7.2: = bound_method %i.var, %specific_fn.loc30 +// CHECK:STDOUT: %.loc30: %Inner = bind_value %i.var +// CHECK:STDOUT: %no_op.loc30: init %empty_tuple.type = call %bound_method.loc30_7.2(%.loc30) +// CHECK:STDOUT: %impl.elem0.loc29: %.2c9 = impl_witness_access constants.%Destroy.impl_witness.e12, element0 [concrete = constants.%Op.8d4] +// CHECK:STDOUT: %bound_method.loc29_7.1: = bound_method %o.var, %impl.elem0.loc29 +// CHECK:STDOUT: %specific_fn.loc29: = specific_function %impl.elem0.loc29, @Op.2(constants.%Outer) [concrete = constants.%Op.specific_fn.2a1] +// CHECK:STDOUT: %bound_method.loc29_7.2: = bound_method %o.var, %specific_fn.loc29 +// CHECK:STDOUT: %.loc29: %Outer = bind_value %o.var +// CHECK:STDOUT: %no_op.loc29: init %empty_tuple.type = call %bound_method.loc29_7.2(%.loc29) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -208,6 +263,18 @@ fn F(a: Outer*) { // CHECK:STDOUT: %i.var: ref %Inner = var %i.var_patt // CHECK:STDOUT: %Inner.ref: type = name_ref Inner, @Outer.%Inner.decl [concrete = constants.%Inner] // CHECK:STDOUT: %i: ref %Inner = bind_name i, %i.var +// CHECK:STDOUT: %impl.elem0.loc37: %.6f6 = impl_witness_access constants.%Destroy.impl_witness.768, element0 [concrete = constants.%Op.754] +// CHECK:STDOUT: %bound_method.loc37_5.1: = bound_method %i.var, %impl.elem0.loc37 +// CHECK:STDOUT: %specific_fn.loc37: = specific_function %impl.elem0.loc37, @Op.2(constants.%Inner) [concrete = constants.%Op.specific_fn.72f] +// CHECK:STDOUT: %bound_method.loc37_5.2: = bound_method %i.var, %specific_fn.loc37 +// CHECK:STDOUT: %.loc37: %Inner = bind_value %i.var +// CHECK:STDOUT: %no_op.loc37: init %empty_tuple.type = call %bound_method.loc37_5.2(%.loc37) +// CHECK:STDOUT: %impl.elem0.loc36: %.2c9 = impl_witness_access constants.%Destroy.impl_witness.e12, element0 [concrete = constants.%Op.8d4] +// CHECK:STDOUT: %bound_method.loc36_5.1: = bound_method %o.var, %impl.elem0.loc36 +// CHECK:STDOUT: %specific_fn.loc36: = specific_function %impl.elem0.loc36, @Op.2(constants.%Outer) [concrete = constants.%Op.specific_fn.2a1] +// CHECK:STDOUT: %bound_method.loc36_5.2: = bound_method %o.var, %specific_fn.loc36 +// CHECK:STDOUT: %.loc36: %Outer = bind_value %o.var +// CHECK:STDOUT: %no_op.loc36: init %empty_tuple.type = call %bound_method.loc36_5.2(%.loc36) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/nested_name.carbon b/toolchain/check/testdata/class/nested_name.carbon index 6a517d3a554c..fca248d598ad 100644 --- a/toolchain/check/testdata/class/nested_name.carbon +++ b/toolchain/check/testdata/class/nested_name.carbon @@ -33,6 +33,7 @@ fn G(o: Outer) { // CHECK:STDOUT: %Inner: type = class_type @Inner [concrete] // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] // CHECK:STDOUT: %Inner.elem: type = unbound_element_type %Inner, %i32 [concrete] @@ -47,15 +48,30 @@ fn G(o: Outer) { // CHECK:STDOUT: %pattern_type.e74: type = pattern_type %Outer [concrete] // CHECK:STDOUT: %G.type: type = fn_type @G [concrete] // CHECK:STDOUT: %G: %G.type = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.768: = impl_witness imports.%Destroy.impl_witness_table, @impl(%Inner) [concrete] +// CHECK:STDOUT: %Op.type.9bc: type = fn_type @Op.2, @impl(%Inner) [concrete] +// CHECK:STDOUT: %Op.754: %Op.type.9bc = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %Inner, (%Destroy.impl_witness.768) [concrete] +// CHECK:STDOUT: %.6f6: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.754, @Op.2(%Inner) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -134,11 +150,17 @@ fn G(o: Outer) { // CHECK:STDOUT: %i.var_patt: %pattern_type.906 = var_pattern %i.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %i.var: ref %Inner = var %i.var_patt -// CHECK:STDOUT: %.loc26: type = splice_block %Inner.ref [concrete = constants.%Inner] { +// CHECK:STDOUT: %.loc26_11: type = splice_block %Inner.ref [concrete = constants.%Inner] { // CHECK:STDOUT: %o.ref: %Outer = name_ref o, %o // CHECK:STDOUT: %Inner.ref: type = name_ref Inner, @Outer.%Inner.decl [concrete = constants.%Inner] // CHECK:STDOUT: } // CHECK:STDOUT: %i: ref %Inner = bind_name i, %i.var +// CHECK:STDOUT: %impl.elem0: %.6f6 = impl_witness_access constants.%Destroy.impl_witness.768, element0 [concrete = constants.%Op.754] +// CHECK:STDOUT: %bound_method.loc26_3.1: = bound_method %i.var, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%Inner) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc26_3.2: = bound_method %i.var, %specific_fn +// CHECK:STDOUT: %.loc26_3: %Inner = bind_value %i.var +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc26_3.2(%.loc26_3) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/raw_self_type.carbon b/toolchain/check/testdata/class/raw_self_type.carbon index 3c2439a77ec9..0fdd06ef24c3 100644 --- a/toolchain/check/testdata/class/raw_self_type.carbon +++ b/toolchain/check/testdata/class/raw_self_type.carbon @@ -32,24 +32,40 @@ fn MemberNamedSelf.F(x: Self, y: r#Self) {} // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [concrete] // CHECK:STDOUT: %F.type.f1b: type = fn_type @F.1 [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %F.1f2: %F.type.f1b = struct_value () [concrete] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] +// CHECK:STDOUT: %complete_type.357: = complete_type_witness %empty_struct_type [concrete] // CHECK:STDOUT: %ptr.e71: type = ptr_type %Class [concrete] // CHECK:STDOUT: %pattern_type.796: type = pattern_type %ptr.e71 [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.a50: = impl_witness imports.%Destroy.impl_witness_table, @impl(%ptr.e71) [concrete] +// CHECK:STDOUT: %Op.type.faa: type = fn_type @Op.2, @impl(%ptr.e71) [concrete] +// CHECK:STDOUT: %Op.5a3: %Op.type.faa = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %ptr.e71, (%Destroy.impl_witness.a50) [concrete] +// CHECK:STDOUT: %.9cd: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.5a3, @Op.2(%ptr.e71) [concrete] // CHECK:STDOUT: %MemberNamedSelf: type = class_type @MemberNamedSelf [concrete] -// CHECK:STDOUT: %Self: type = class_type @Self [concrete] +// CHECK:STDOUT: %Self.362: type = class_type @Self [concrete] // CHECK:STDOUT: %pattern_type.356: type = pattern_type %MemberNamedSelf [concrete] -// CHECK:STDOUT: %pattern_type.c06: type = pattern_type %Self [concrete] +// CHECK:STDOUT: %pattern_type.c06: type = pattern_type %Self.362 [concrete] // CHECK:STDOUT: %F.type.648: type = fn_type @F.2 [concrete] // CHECK:STDOUT: %F.e97: %F.type.648 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -70,16 +86,16 @@ fn MemberNamedSelf.F(x: Self, y: r#Self) {} // CHECK:STDOUT: %x.param.loc28: %MemberNamedSelf = value_param call_param0 // CHECK:STDOUT: %Self.ref.loc28_25: type = name_ref Self, constants.%MemberNamedSelf [concrete = constants.%MemberNamedSelf] // CHECK:STDOUT: %x.loc28: %MemberNamedSelf = bind_name x, %x.param.loc28 -// CHECK:STDOUT: %y.param.loc28: %Self = value_param call_param1 -// CHECK:STDOUT: %Self.ref.loc28_34: type = name_ref r#Self, @MemberNamedSelf.%Self.decl [concrete = constants.%Self] -// CHECK:STDOUT: %y.loc28: %Self = bind_name y, %y.param.loc28 +// CHECK:STDOUT: %y.param.loc28: %Self.362 = value_param call_param1 +// CHECK:STDOUT: %Self.ref.loc28_34: type = name_ref r#Self, @MemberNamedSelf.%Self.decl [concrete = constants.%Self.362] +// CHECK:STDOUT: %y.loc28: %Self.362 = bind_name y, %y.param.loc28 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { // CHECK:STDOUT: %F.decl: %F.type.f1b = fn_decl @F.1 [concrete = constants.%F.1f2] {} {} // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete = constants.%complete_type] +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete = constants.%complete_type.357] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -88,7 +104,7 @@ fn MemberNamedSelf.F(x: Self, y: r#Self) {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @MemberNamedSelf { -// CHECK:STDOUT: %Self.decl: type = class_decl @Self [concrete = constants.%Self] {} {} +// CHECK:STDOUT: %Self.decl: type = class_decl @Self [concrete = constants.%Self.362] {} {} // CHECK:STDOUT: %F.decl: %F.type.648 = fn_decl @F.2 [concrete = constants.%F.e97] { // CHECK:STDOUT: %x.patt: %pattern_type.356 = binding_pattern x [concrete] // CHECK:STDOUT: %x.param_patt: %pattern_type.356 = value_param_pattern %x.patt, call_param0 [concrete] @@ -98,12 +114,12 @@ fn MemberNamedSelf.F(x: Self, y: r#Self) {} // CHECK:STDOUT: %x.param.loc25: %MemberNamedSelf = value_param call_param0 // CHECK:STDOUT: %Self.ref.loc25_11: type = name_ref Self, constants.%MemberNamedSelf [concrete = constants.%MemberNamedSelf] // CHECK:STDOUT: %x.loc25: %MemberNamedSelf = bind_name x, %x.param.loc25 -// CHECK:STDOUT: %y.param.loc25: %Self = value_param call_param1 -// CHECK:STDOUT: %Self.ref.loc25_20: type = name_ref r#Self, @MemberNamedSelf.%Self.decl [concrete = constants.%Self] -// CHECK:STDOUT: %y.loc25: %Self = bind_name y, %y.param.loc25 +// CHECK:STDOUT: %y.param.loc25: %Self.362 = value_param call_param1 +// CHECK:STDOUT: %Self.ref.loc25_20: type = name_ref r#Self, @MemberNamedSelf.%Self.decl [concrete = constants.%Self.362] +// CHECK:STDOUT: %y.loc25: %Self.362 = bind_name y, %y.param.loc25 // CHECK:STDOUT: } // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete = constants.%complete_type] +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete = constants.%complete_type.357] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -114,11 +130,11 @@ fn MemberNamedSelf.F(x: Self, y: r#Self) {} // CHECK:STDOUT: // CHECK:STDOUT: class @Self { // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete = constants.%complete_type] +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete = constants.%complete_type.357] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%Self +// CHECK:STDOUT: .Self = constants.%Self.362 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F.1() { @@ -128,7 +144,7 @@ fn MemberNamedSelf.F(x: Self, y: r#Self) {} // CHECK:STDOUT: %Self.var_patt: %pattern_type.796 = var_pattern %Self.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %Self.var: ref %ptr.e71 = var %Self.var_patt -// CHECK:STDOUT: %.loc17: type = splice_block %ptr.loc17 [concrete = constants.%ptr.e71] { +// CHECK:STDOUT: %.loc17_21: type = splice_block %ptr.loc17 [concrete = constants.%ptr.e71] { // CHECK:STDOUT: %Self.ref.loc17: type = name_ref Self, constants.%Class [concrete = constants.%Class] // CHECK:STDOUT: %ptr.loc17: type = ptr_type %Self.ref.loc17 [concrete = constants.%ptr.e71] // CHECK:STDOUT: } @@ -146,10 +162,22 @@ fn MemberNamedSelf.F(x: Self, y: r#Self) {} // CHECK:STDOUT: %ptr.loc18: type = ptr_type %Self.ref.loc18_12 [concrete = constants.%ptr.e71] // CHECK:STDOUT: } // CHECK:STDOUT: %p: ref %ptr.e71 = bind_name p, %p.var +// CHECK:STDOUT: %impl.elem0.loc18: %.9cd = impl_witness_access constants.%Destroy.impl_witness.a50, element0 [concrete = constants.%Op.5a3] +// CHECK:STDOUT: %bound_method.loc18_5.1: = bound_method %p.var, %impl.elem0.loc18 +// CHECK:STDOUT: %specific_fn.loc18: = specific_function %impl.elem0.loc18, @Op.2(constants.%ptr.e71) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc18_5.2: = bound_method %p.var, %specific_fn.loc18 +// CHECK:STDOUT: %.loc18_5: %ptr.e71 = bind_value %p.var +// CHECK:STDOUT: %no_op.loc18: init %empty_tuple.type = call %bound_method.loc18_5.2(%.loc18_5) +// CHECK:STDOUT: %impl.elem0.loc17: %.9cd = impl_witness_access constants.%Destroy.impl_witness.a50, element0 [concrete = constants.%Op.5a3] +// CHECK:STDOUT: %bound_method.loc17_5.1: = bound_method %Self.var, %impl.elem0.loc17 +// CHECK:STDOUT: %specific_fn.loc17: = specific_function %impl.elem0.loc17, @Op.2(constants.%ptr.e71) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc17_5.2: = bound_method %Self.var, %specific_fn.loc17 +// CHECK:STDOUT: %.loc17_5: %ptr.e71 = bind_value %Self.var +// CHECK:STDOUT: %no_op.loc17: init %empty_tuple.type = call %bound_method.loc17_5.2(%.loc17_5) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.2(%x.param.loc28: %MemberNamedSelf, %y.param.loc28: %Self) { +// CHECK:STDOUT: fn @F.2(%x.param.loc28: %MemberNamedSelf, %y.param.loc28: %Self.362) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/reorder_qualified.carbon b/toolchain/check/testdata/class/reorder_qualified.carbon index e2b5d54a124c..ae6e3365cfba 100644 --- a/toolchain/check/testdata/class/reorder_qualified.carbon +++ b/toolchain/check/testdata/class/reorder_qualified.carbon @@ -125,12 +125,42 @@ class A { // CHECK:STDOUT: %bound_method.1da: = bound_method %int_4.0c1, %Convert.specific_fn [concrete] // CHECK:STDOUT: %int_4.940: %i32 = int_value 4 [concrete] // CHECK:STDOUT: %D.val: %D = struct_value (%int_4.940) [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.2 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.3, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.102: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%D) [concrete] +// CHECK:STDOUT: %Op.type.7e3: type = fn_type @Op.3, @impl.49c(%D) [concrete] +// CHECK:STDOUT: %Op.47c: %Op.type.7e3 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.18e: %Destroy.type = facet_value %D, (%Destroy.impl_witness.102) [concrete] +// CHECK:STDOUT: %.8ce: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.18e [concrete] +// CHECK:STDOUT: %Op.specific_fn.ceb: = specific_function %Op.47c, @Op.3(%D) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.c38: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%C) [concrete] +// CHECK:STDOUT: %Op.type.2eb: type = fn_type @Op.3, @impl.49c(%C) [concrete] +// CHECK:STDOUT: %Op.f77: %Op.type.2eb = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.8bd: %Destroy.type = facet_value %C, (%Destroy.impl_witness.c38) [concrete] +// CHECK:STDOUT: %.e53: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.8bd [concrete] +// CHECK:STDOUT: %Op.specific_fn.c65: = specific_function %Op.f77, @Op.3(%C) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.7c6: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%B) [concrete] +// CHECK:STDOUT: %Op.type.266: type = fn_type @Op.3, @impl.49c(%B) [concrete] +// CHECK:STDOUT: %Op.4a4: %Op.type.266 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.422: %Destroy.type = facet_value %B, (%Destroy.impl_witness.7c6) [concrete] +// CHECK:STDOUT: %.24f: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.422 [concrete] +// CHECK:STDOUT: %Op.specific_fn.70c: = specific_function %Op.4a4, @Op.3(%B) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.b6e: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%A) [concrete] +// CHECK:STDOUT: %Op.type.b96: type = fn_type @Op.3, @impl.49c(%A) [concrete] +// CHECK:STDOUT: %Op.885: %Op.type.b96 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.4a1: %Destroy.type = facet_value %A, (%Destroy.impl_witness.b6e) [concrete] +// CHECK:STDOUT: %.af1: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.4a1 [concrete] +// CHECK:STDOUT: %Op.specific_fn.716: = specific_function %Op.885, @Op.3(%A) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Int = %Core.Int // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -138,6 +168,9 @@ class A { // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -248,17 +281,17 @@ class A { // CHECK:STDOUT: %a.var: ref %A = var %a.var_patt // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] // CHECK:STDOUT: %.loc33_25.1: %struct_type.a.a6c = struct_literal (%int_1) -// CHECK:STDOUT: %impl.elem0.loc33: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] -// CHECK:STDOUT: %bound_method.loc33_25.1: = bound_method %int_1, %impl.elem0.loc33 [concrete = constants.%Convert.bound.ab5] -// CHECK:STDOUT: %specific_fn.loc33: = specific_function %impl.elem0.loc33, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc33_25.2: = bound_method %int_1, %specific_fn.loc33 [concrete = constants.%bound_method.9a1] +// CHECK:STDOUT: %impl.elem0.loc33_25: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc33_25.1: = bound_method %int_1, %impl.elem0.loc33_25 [concrete = constants.%Convert.bound.ab5] +// CHECK:STDOUT: %specific_fn.loc33_25: = specific_function %impl.elem0.loc33_25, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc33_25.2: = bound_method %int_1, %specific_fn.loc33_25 [concrete = constants.%bound_method.9a1] // CHECK:STDOUT: %int.convert_checked.loc33: init %i32 = call %bound_method.loc33_25.2(%int_1) [concrete = constants.%int_1.5d2] // CHECK:STDOUT: %.loc33_25.2: init %i32 = converted %int_1, %int.convert_checked.loc33 [concrete = constants.%int_1.5d2] // CHECK:STDOUT: %.loc33_25.3: ref %i32 = class_element_access %a.var, element0 // CHECK:STDOUT: %.loc33_25.4: init %i32 = initialize_from %.loc33_25.2 to %.loc33_25.3 [concrete = constants.%int_1.5d2] // CHECK:STDOUT: %.loc33_25.5: init %A = class_init (%.loc33_25.4), %a.var [concrete = constants.%A.val] -// CHECK:STDOUT: %.loc33_7: init %A = converted %.loc33_25.1, %.loc33_25.5 [concrete = constants.%A.val] -// CHECK:STDOUT: assign %a.var, %.loc33_7 +// CHECK:STDOUT: %.loc33_7.1: init %A = converted %.loc33_25.1, %.loc33_25.5 [concrete = constants.%A.val] +// CHECK:STDOUT: assign %a.var, %.loc33_7.1 // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A] // CHECK:STDOUT: %a: ref %A = bind_name a, %a.var // CHECK:STDOUT: name_binding_decl { @@ -268,17 +301,17 @@ class A { // CHECK:STDOUT: %b.var: ref %B = var %b.var_patt // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] // CHECK:STDOUT: %.loc34_25.1: %struct_type.b.a15 = struct_literal (%int_2) -// CHECK:STDOUT: %impl.elem0.loc34: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] -// CHECK:STDOUT: %bound_method.loc34_25.1: = bound_method %int_2, %impl.elem0.loc34 [concrete = constants.%Convert.bound.ef9] -// CHECK:STDOUT: %specific_fn.loc34: = specific_function %impl.elem0.loc34, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc34_25.2: = bound_method %int_2, %specific_fn.loc34 [concrete = constants.%bound_method.b92] +// CHECK:STDOUT: %impl.elem0.loc34_25: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc34_25.1: = bound_method %int_2, %impl.elem0.loc34_25 [concrete = constants.%Convert.bound.ef9] +// CHECK:STDOUT: %specific_fn.loc34_25: = specific_function %impl.elem0.loc34_25, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc34_25.2: = bound_method %int_2, %specific_fn.loc34_25 [concrete = constants.%bound_method.b92] // CHECK:STDOUT: %int.convert_checked.loc34: init %i32 = call %bound_method.loc34_25.2(%int_2) [concrete = constants.%int_2.ef8] // CHECK:STDOUT: %.loc34_25.2: init %i32 = converted %int_2, %int.convert_checked.loc34 [concrete = constants.%int_2.ef8] // CHECK:STDOUT: %.loc34_25.3: ref %i32 = class_element_access %b.var, element0 // CHECK:STDOUT: %.loc34_25.4: init %i32 = initialize_from %.loc34_25.2 to %.loc34_25.3 [concrete = constants.%int_2.ef8] // CHECK:STDOUT: %.loc34_25.5: init %B = class_init (%.loc34_25.4), %b.var [concrete = constants.%B.val] -// CHECK:STDOUT: %.loc34_7: init %B = converted %.loc34_25.1, %.loc34_25.5 [concrete = constants.%B.val] -// CHECK:STDOUT: assign %b.var, %.loc34_7 +// CHECK:STDOUT: %.loc34_7.1: init %B = converted %.loc34_25.1, %.loc34_25.5 [concrete = constants.%B.val] +// CHECK:STDOUT: assign %b.var, %.loc34_7.1 // CHECK:STDOUT: %B.ref: type = name_ref B, @A.%B.decl [concrete = constants.%B] // CHECK:STDOUT: %b: ref %B = bind_name b, %b.var // CHECK:STDOUT: name_binding_decl { @@ -288,17 +321,17 @@ class A { // CHECK:STDOUT: %c.var: ref %C = var %c.var_patt // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3.1ba] // CHECK:STDOUT: %.loc35_25.1: %struct_type.c.5b8 = struct_literal (%int_3) -// CHECK:STDOUT: %impl.elem0.loc35: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] -// CHECK:STDOUT: %bound_method.loc35_25.1: = bound_method %int_3, %impl.elem0.loc35 [concrete = constants.%Convert.bound.b30] -// CHECK:STDOUT: %specific_fn.loc35: = specific_function %impl.elem0.loc35, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc35_25.2: = bound_method %int_3, %specific_fn.loc35 [concrete = constants.%bound_method.047] +// CHECK:STDOUT: %impl.elem0.loc35_25: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc35_25.1: = bound_method %int_3, %impl.elem0.loc35_25 [concrete = constants.%Convert.bound.b30] +// CHECK:STDOUT: %specific_fn.loc35_25: = specific_function %impl.elem0.loc35_25, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc35_25.2: = bound_method %int_3, %specific_fn.loc35_25 [concrete = constants.%bound_method.047] // CHECK:STDOUT: %int.convert_checked.loc35: init %i32 = call %bound_method.loc35_25.2(%int_3) [concrete = constants.%int_3.822] // CHECK:STDOUT: %.loc35_25.2: init %i32 = converted %int_3, %int.convert_checked.loc35 [concrete = constants.%int_3.822] // CHECK:STDOUT: %.loc35_25.3: ref %i32 = class_element_access %c.var, element0 // CHECK:STDOUT: %.loc35_25.4: init %i32 = initialize_from %.loc35_25.2 to %.loc35_25.3 [concrete = constants.%int_3.822] // CHECK:STDOUT: %.loc35_25.5: init %C = class_init (%.loc35_25.4), %c.var [concrete = constants.%C.val] -// CHECK:STDOUT: %.loc35_7: init %C = converted %.loc35_25.1, %.loc35_25.5 [concrete = constants.%C.val] -// CHECK:STDOUT: assign %c.var, %.loc35_7 +// CHECK:STDOUT: %.loc35_7.1: init %C = converted %.loc35_25.1, %.loc35_25.5 [concrete = constants.%C.val] +// CHECK:STDOUT: assign %c.var, %.loc35_7.1 // CHECK:STDOUT: %C.ref: type = name_ref C, @B.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var // CHECK:STDOUT: name_binding_decl { @@ -308,17 +341,17 @@ class A { // CHECK:STDOUT: %d.var: ref %D = var %d.var_patt // CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [concrete = constants.%int_4.0c1] // CHECK:STDOUT: %.loc36_25.1: %struct_type.d.3ea = struct_literal (%int_4) -// CHECK:STDOUT: %impl.elem0.loc36: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] -// CHECK:STDOUT: %bound_method.loc36_25.1: = bound_method %int_4, %impl.elem0.loc36 [concrete = constants.%Convert.bound.ac3] -// CHECK:STDOUT: %specific_fn.loc36: = specific_function %impl.elem0.loc36, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc36_25.2: = bound_method %int_4, %specific_fn.loc36 [concrete = constants.%bound_method.1da] +// CHECK:STDOUT: %impl.elem0.loc36_25: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc36_25.1: = bound_method %int_4, %impl.elem0.loc36_25 [concrete = constants.%Convert.bound.ac3] +// CHECK:STDOUT: %specific_fn.loc36_25: = specific_function %impl.elem0.loc36_25, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc36_25.2: = bound_method %int_4, %specific_fn.loc36_25 [concrete = constants.%bound_method.1da] // CHECK:STDOUT: %int.convert_checked.loc36: init %i32 = call %bound_method.loc36_25.2(%int_4) [concrete = constants.%int_4.940] // CHECK:STDOUT: %.loc36_25.2: init %i32 = converted %int_4, %int.convert_checked.loc36 [concrete = constants.%int_4.940] // CHECK:STDOUT: %.loc36_25.3: ref %i32 = class_element_access %d.var, element0 // CHECK:STDOUT: %.loc36_25.4: init %i32 = initialize_from %.loc36_25.2 to %.loc36_25.3 [concrete = constants.%int_4.940] // CHECK:STDOUT: %.loc36_25.5: init %D = class_init (%.loc36_25.4), %d.var [concrete = constants.%D.val] -// CHECK:STDOUT: %.loc36_7: init %D = converted %.loc36_25.1, %.loc36_25.5 [concrete = constants.%D.val] -// CHECK:STDOUT: assign %d.var, %.loc36_7 +// CHECK:STDOUT: %.loc36_7.1: init %D = converted %.loc36_25.1, %.loc36_25.5 [concrete = constants.%D.val] +// CHECK:STDOUT: assign %d.var, %.loc36_7.1 // CHECK:STDOUT: %D.ref: type = name_ref D, @C.%D.decl [concrete = constants.%D] // CHECK:STDOUT: %d: ref %D = bind_name d, %d.var // CHECK:STDOUT: %AF.ref: %AF.type = name_ref AF, @A.%AF.decl [concrete = constants.%AF] @@ -329,6 +362,30 @@ class A { // CHECK:STDOUT: %CF.call: init %empty_tuple.type = call %CF.ref() // CHECK:STDOUT: %DF.ref: %DF.type = name_ref DF, @D.%DF.decl [concrete = constants.%DF] // CHECK:STDOUT: %DF.call: init %empty_tuple.type = call %DF.ref() +// CHECK:STDOUT: %impl.elem0.loc36_7: %.8ce = impl_witness_access constants.%Destroy.impl_witness.102, element0 [concrete = constants.%Op.47c] +// CHECK:STDOUT: %bound_method.loc36_7.1: = bound_method %d.var, %impl.elem0.loc36_7 +// CHECK:STDOUT: %specific_fn.loc36_7: = specific_function %impl.elem0.loc36_7, @Op.3(constants.%D) [concrete = constants.%Op.specific_fn.ceb] +// CHECK:STDOUT: %bound_method.loc36_7.2: = bound_method %d.var, %specific_fn.loc36_7 +// CHECK:STDOUT: %.loc36_7.2: %D = bind_value %d.var +// CHECK:STDOUT: %no_op.loc36: init %empty_tuple.type = call %bound_method.loc36_7.2(%.loc36_7.2) +// CHECK:STDOUT: %impl.elem0.loc35_7: %.e53 = impl_witness_access constants.%Destroy.impl_witness.c38, element0 [concrete = constants.%Op.f77] +// CHECK:STDOUT: %bound_method.loc35_7.1: = bound_method %c.var, %impl.elem0.loc35_7 +// CHECK:STDOUT: %specific_fn.loc35_7: = specific_function %impl.elem0.loc35_7, @Op.3(constants.%C) [concrete = constants.%Op.specific_fn.c65] +// CHECK:STDOUT: %bound_method.loc35_7.2: = bound_method %c.var, %specific_fn.loc35_7 +// CHECK:STDOUT: %.loc35_7.2: %C = bind_value %c.var +// CHECK:STDOUT: %no_op.loc35: init %empty_tuple.type = call %bound_method.loc35_7.2(%.loc35_7.2) +// CHECK:STDOUT: %impl.elem0.loc34_7: %.24f = impl_witness_access constants.%Destroy.impl_witness.7c6, element0 [concrete = constants.%Op.4a4] +// CHECK:STDOUT: %bound_method.loc34_7.1: = bound_method %b.var, %impl.elem0.loc34_7 +// CHECK:STDOUT: %specific_fn.loc34_7: = specific_function %impl.elem0.loc34_7, @Op.3(constants.%B) [concrete = constants.%Op.specific_fn.70c] +// CHECK:STDOUT: %bound_method.loc34_7.2: = bound_method %b.var, %specific_fn.loc34_7 +// CHECK:STDOUT: %.loc34_7.2: %B = bind_value %b.var +// CHECK:STDOUT: %no_op.loc34: init %empty_tuple.type = call %bound_method.loc34_7.2(%.loc34_7.2) +// CHECK:STDOUT: %impl.elem0.loc33_7: %.af1 = impl_witness_access constants.%Destroy.impl_witness.b6e, element0 [concrete = constants.%Op.885] +// CHECK:STDOUT: %bound_method.loc33_7.1: = bound_method %a.var, %impl.elem0.loc33_7 +// CHECK:STDOUT: %specific_fn.loc33_7: = specific_function %impl.elem0.loc33_7, @Op.3(constants.%A) [concrete = constants.%Op.specific_fn.716] +// CHECK:STDOUT: %bound_method.loc33_7.2: = bound_method %a.var, %specific_fn.loc33_7 +// CHECK:STDOUT: %.loc33_7.2: %A = bind_value %a.var +// CHECK:STDOUT: %no_op.loc33: init %empty_tuple.type = call %bound_method.loc33_7.2(%.loc33_7.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/scope.carbon b/toolchain/check/testdata/class/scope.carbon index c236a8a61171..c31bc742a489 100644 --- a/toolchain/check/testdata/class/scope.carbon +++ b/toolchain/check/testdata/class/scope.carbon @@ -37,6 +37,7 @@ fn Run() { // CHECK:STDOUT: %Class: type = class_type @Class [concrete] // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete] @@ -71,12 +72,24 @@ fn Run() { // CHECK:STDOUT: %int_2.ef8: %i32 = int_value 2 [concrete] // CHECK:STDOUT: %Run.type: type = fn_type @Run [concrete] // CHECK:STDOUT: %Run: %Run.type = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.2 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.3, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.64e: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.type.a17: type = fn_type @Op.3, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.e6a: %Op.type.a17 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %i32, (%Destroy.impl_witness.64e) [concrete] +// CHECK:STDOUT: %.ab7: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.e6a, @Op.3(%i32) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Int = %Core.Int // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -84,6 +97,9 @@ fn Run() { // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -181,7 +197,7 @@ fn Run() { // CHECK:STDOUT: %F.ref.loc30: %F.type.b25 = name_ref F, file.%F.decl [concrete = constants.%F.c41] // CHECK:STDOUT: %F.call.loc30: init %i32 = call %F.ref.loc30() // CHECK:STDOUT: assign %a.var, %F.call.loc30 -// CHECK:STDOUT: %.loc30: type = splice_block %i32.loc30 [concrete = constants.%i32] { +// CHECK:STDOUT: %.loc30_10: type = splice_block %i32.loc30 [concrete = constants.%i32] { // CHECK:STDOUT: %int_32.loc30: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32.loc30: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: } @@ -195,11 +211,23 @@ fn Run() { // CHECK:STDOUT: %F.ref.loc31: %F.type.f1b = name_ref F, @Class.%F.decl [concrete = constants.%F.1f2] // CHECK:STDOUT: %F.call.loc31: init %i32 = call %F.ref.loc31() // CHECK:STDOUT: assign %b.var, %F.call.loc31 -// CHECK:STDOUT: %.loc31: type = splice_block %i32.loc31 [concrete = constants.%i32] { +// CHECK:STDOUT: %.loc31_10: type = splice_block %i32.loc31 [concrete = constants.%i32] { // CHECK:STDOUT: %int_32.loc31: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32.loc31: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: %b: ref %i32 = bind_name b, %b.var +// CHECK:STDOUT: %impl.elem0.loc31: %.ab7 = impl_witness_access constants.%Destroy.impl_witness.64e, element0 [concrete = constants.%Op.e6a] +// CHECK:STDOUT: %bound_method.loc31_3.1: = bound_method %b.var, %impl.elem0.loc31 +// CHECK:STDOUT: %specific_fn.loc31: = specific_function %impl.elem0.loc31, @Op.3(constants.%i32) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc31_3.2: = bound_method %b.var, %specific_fn.loc31 +// CHECK:STDOUT: %.loc31_3: %i32 = bind_value %b.var +// CHECK:STDOUT: %no_op.loc31: init %empty_tuple.type = call %bound_method.loc31_3.2(%.loc31_3) +// CHECK:STDOUT: %impl.elem0.loc30: %.ab7 = impl_witness_access constants.%Destroy.impl_witness.64e, element0 [concrete = constants.%Op.e6a] +// CHECK:STDOUT: %bound_method.loc30_3.1: = bound_method %a.var, %impl.elem0.loc30 +// CHECK:STDOUT: %specific_fn.loc30: = specific_function %impl.elem0.loc30, @Op.3(constants.%i32) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc30_3.2: = bound_method %a.var, %specific_fn.loc30 +// CHECK:STDOUT: %.loc30_3: %i32 = bind_value %a.var +// CHECK:STDOUT: %no_op.loc30: init %empty_tuple.type = call %bound_method.loc30_3.2(%.loc30_3) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/virtual_modifiers.carbon b/toolchain/check/testdata/class/virtual_modifiers.carbon index 7df4b5c97842..6e100009dbe7 100644 --- a/toolchain/check/testdata/class/virtual_modifiers.carbon +++ b/toolchain/check/testdata/class/virtual_modifiers.carbon @@ -448,6 +448,7 @@ base class T1(T:! type) { // CHECK:STDOUT: %Derived: type = class_type @Derived [concrete] // CHECK:STDOUT: %Base: type = class_type @Base [concrete] // CHECK:STDOUT: %H.type.09e: type = fn_type @H.1 [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %H.c1b: %H.type.09e = struct_value () [concrete] // CHECK:STDOUT: %ptr.454: type = ptr_type [concrete] // CHECK:STDOUT: %Base.vtable_ptr: ref %ptr.454 = vtable_ptr @Base.vtable [concrete] @@ -466,10 +467,22 @@ base class T1(T:! type) { // CHECK:STDOUT: %struct_type.base.f5e: type = struct_type {.base: %empty_struct_type} [concrete] // CHECK:STDOUT: %Base.val: %Base = struct_value (%Derived.vtable_ptr) [concrete] // CHECK:STDOUT: %Derived.val: %Derived = struct_value (%Base.val) [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.ff9: = impl_witness imports.%Destroy.impl_witness_table, @impl(%Derived) [concrete] +// CHECK:STDOUT: %Op.type.102: type = fn_type @Op.2, @impl(%Derived) [concrete] +// CHECK:STDOUT: %Op.539: %Op.type.102 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %Derived, (%Destroy.impl_witness.ff9) [concrete] +// CHECK:STDOUT: %.3cb: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.539, @Op.2(%Derived) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -482,6 +495,9 @@ base class T1(T:! type) { // CHECK:STDOUT: %Modifiers.import_ref.4e7: ref = import_ref Modifiers//default, loc6_1, loaded [concrete = constants.%Base.vtable_ptr] // CHECK:STDOUT: %Modifiers.import_ref.1f3 = import_ref Modifiers//default, inst18 [no loc], unloaded // CHECK:STDOUT: %Modifiers.import_ref.2cc = import_ref Modifiers//default, loc5_29, unloaded +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -559,10 +575,16 @@ base class T1(T:! type) { // CHECK:STDOUT: %.loc12_30.4: init %Base = class_init (%.loc12_30.3), %.loc12_31.2 [concrete = constants.%Base.val] // CHECK:STDOUT: %.loc12_31.3: init %Base = converted %.loc12_30.1, %.loc12_30.4 [concrete = constants.%Base.val] // CHECK:STDOUT: %.loc12_31.4: init %Derived = class_init (%.loc12_31.3), %d.var [concrete = constants.%Derived.val] -// CHECK:STDOUT: %.loc12_3: init %Derived = converted %.loc12_31.1, %.loc12_31.4 [concrete = constants.%Derived.val] -// CHECK:STDOUT: assign %d.var, %.loc12_3 +// CHECK:STDOUT: %.loc12_3.1: init %Derived = converted %.loc12_31.1, %.loc12_31.4 [concrete = constants.%Derived.val] +// CHECK:STDOUT: assign %d.var, %.loc12_3.1 // CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl [concrete = constants.%Derived] // CHECK:STDOUT: %d: ref %Derived = bind_name d, %d.var +// CHECK:STDOUT: %impl.elem0: %.3cb = impl_witness_access constants.%Destroy.impl_witness.ff9, element0 [concrete = constants.%Op.539] +// CHECK:STDOUT: %bound_method.loc12_3.1: = bound_method %d.var, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%Derived) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc12_3.2: = bound_method %d.var, %specific_fn +// CHECK:STDOUT: %.loc12_3.2: %Derived = bind_value %d.var +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc12_3.2(%.loc12_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -665,21 +687,34 @@ base class T1(T:! type) { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] // CHECK:STDOUT: %Base: type = class_type @Base [concrete] // CHECK:STDOUT: %H.type: type = fn_type @H [concrete] // CHECK:STDOUT: %H: %H.type = struct_value () [concrete] -// CHECK:STDOUT: %pattern_type: type = pattern_type %Base [concrete] +// CHECK:STDOUT: %pattern_type.80f: type = pattern_type %Base [concrete] // CHECK:STDOUT: %ptr.454: type = ptr_type [concrete] // CHECK:STDOUT: %Base.vtable_ptr: ref %ptr.454 = vtable_ptr @Base.vtable [concrete] // CHECK:STDOUT: %struct_type.vptr: type = struct_type {.: %ptr.454} [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness %struct_type.vptr [concrete] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %Base.val: %Base = struct_value (%Base.vtable_ptr) [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.cec: = impl_witness imports.%Destroy.impl_witness_table, @impl(%Base) [concrete] +// CHECK:STDOUT: %Op.type.47e: type = fn_type @Op.2, @impl(%Base) [concrete] +// CHECK:STDOUT: %Op.033: %Op.type.47e = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %Base, (%Destroy.impl_witness.cec) [concrete] +// CHECK:STDOUT: %.3f1: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.033, @Op.2(%Base) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -692,6 +727,9 @@ base class T1(T:! type) { // CHECK:STDOUT: %Modifiers.import_ref.4e7: ref = import_ref Modifiers//default, loc6_1, loaded [concrete = constants.%Base.vtable_ptr] // CHECK:STDOUT: %Modifiers.import_ref.1f3 = import_ref Modifiers//default, inst18 [no loc], unloaded // CHECK:STDOUT: %Modifiers.import_ref.2cc = import_ref Modifiers//default, loc5_29, unloaded +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -721,21 +759,27 @@ base class T1(T:! type) { // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %v.patt: %pattern_type = binding_pattern v [concrete] -// CHECK:STDOUT: %v.var_patt: %pattern_type = var_pattern %v.patt [concrete] +// CHECK:STDOUT: %v.patt: %pattern_type.80f = binding_pattern v [concrete] +// CHECK:STDOUT: %v.var_patt: %pattern_type.80f = var_pattern %v.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %v.var: ref %Base = var %v.var_patt // CHECK:STDOUT: %.loc7_28.1: %empty_struct_type = struct_literal () // CHECK:STDOUT: %.loc7_28.2: ref %ptr.454 = class_element_access %v.var, element0 // CHECK:STDOUT: %.loc7_28.3: init %ptr.454 = initialize_from imports.%Modifiers.import_ref.4e7 to %.loc7_28.2 [concrete = constants.%Base.vtable_ptr] // CHECK:STDOUT: %.loc7_28.4: init %Base = class_init (%.loc7_28.3), %v.var [concrete = constants.%Base.val] -// CHECK:STDOUT: %.loc7_3: init %Base = converted %.loc7_28.1, %.loc7_28.4 [concrete = constants.%Base.val] -// CHECK:STDOUT: assign %v.var, %.loc7_3 +// CHECK:STDOUT: %.loc7_3.1: init %Base = converted %.loc7_28.1, %.loc7_28.4 [concrete = constants.%Base.val] +// CHECK:STDOUT: assign %v.var, %.loc7_3.1 // CHECK:STDOUT: %.loc7_19: type = splice_block %Base.ref [concrete = constants.%Base] { // CHECK:STDOUT: %Modifiers.ref: = name_ref Modifiers, imports.%Modifiers [concrete = imports.%Modifiers] // CHECK:STDOUT: %Base.ref: type = name_ref Base, imports.%Modifiers.Base [concrete = constants.%Base] // CHECK:STDOUT: } // CHECK:STDOUT: %v: ref %Base = bind_name v, %v.var +// CHECK:STDOUT: %impl.elem0: %.3f1 = impl_witness_access constants.%Destroy.impl_witness.cec, element0 [concrete = constants.%Op.033] +// CHECK:STDOUT: %bound_method.loc7_3.1: = bound_method %v.var, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%Base) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_3.2: = bound_method %v.var, %specific_fn +// CHECK:STDOUT: %.loc7_3.2: %Base = bind_value %v.var +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc7_3.2(%.loc7_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -843,6 +887,7 @@ base class T1(T:! type) { // CHECK:STDOUT: %B1: type = class_type @B1 [concrete] // CHECK:STDOUT: %pattern_type.e47: type = pattern_type %B1 [concrete] // CHECK:STDOUT: %F.type.e4c: type = fn_type @F.1 [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %F.8f5: %F.type.e4c = struct_value () [concrete] // CHECK:STDOUT: %ptr.454: type = ptr_type [concrete] // CHECK:STDOUT: %B1.vtable_ptr: ref %ptr.454 = vtable_ptr @B1.vtable [concrete] @@ -875,13 +920,40 @@ base class T1(T:! type) { // CHECK:STDOUT: %B1.val.b9d: %B1 = struct_value (%C.vtable_ptr) [concrete] // CHECK:STDOUT: %B2.val.426: %B2 = struct_value (%B1.val.b9d) [concrete] // CHECK:STDOUT: %C.val: %C = struct_value (%B2.val.426) [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.906: = impl_witness imports.%Destroy.impl_witness_table, @impl(%C) [concrete] +// CHECK:STDOUT: %Op.type.153: type = fn_type @Op.2, @impl(%C) [concrete] +// CHECK:STDOUT: %Op.5d7: %Op.type.153 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.494: %Destroy.type = facet_value %C, (%Destroy.impl_witness.906) [concrete] +// CHECK:STDOUT: %.b80: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.494 [concrete] +// CHECK:STDOUT: %Op.specific_fn.6eb: = specific_function %Op.5d7, @Op.2(%C) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.453: = impl_witness imports.%Destroy.impl_witness_table, @impl(%B2) [concrete] +// CHECK:STDOUT: %Op.type.49c: type = fn_type @Op.2, @impl(%B2) [concrete] +// CHECK:STDOUT: %Op.bb0: %Op.type.49c = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.0c6: %Destroy.type = facet_value %B2, (%Destroy.impl_witness.453) [concrete] +// CHECK:STDOUT: %.65f: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.0c6 [concrete] +// CHECK:STDOUT: %Op.specific_fn.a6f: = specific_function %Op.bb0, @Op.2(%B2) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.67b: = impl_witness imports.%Destroy.impl_witness_table, @impl(%B1) [concrete] +// CHECK:STDOUT: %Op.type.5ba: type = fn_type @Op.2, @impl(%B1) [concrete] +// CHECK:STDOUT: %Op.a5c: %Op.type.5ba = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.7f9: %Destroy.type = facet_value %B1, (%Destroy.impl_witness.67b) [concrete] +// CHECK:STDOUT: %.3cf: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.7f9 [concrete] +// CHECK:STDOUT: %Op.specific_fn.075: = specific_function %Op.a5c, @Op.2(%B1) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -998,8 +1070,8 @@ base class T1(T:! type) { // CHECK:STDOUT: %.loc19_17.2: ref %ptr.454 = class_element_access %b1.var, element0 // CHECK:STDOUT: %.loc19_17.3: init %ptr.454 = initialize_from @B1.%vtable_ptr to %.loc19_17.2 [concrete = constants.%B1.vtable_ptr] // CHECK:STDOUT: %.loc19_17.4: init %B1 = class_init (%.loc19_17.3), %b1.var [concrete = constants.%B1.val.267] -// CHECK:STDOUT: %.loc19_3: init %B1 = converted %.loc19_17.1, %.loc19_17.4 [concrete = constants.%B1.val.267] -// CHECK:STDOUT: assign %b1.var, %.loc19_3 +// CHECK:STDOUT: %.loc19_3.1: init %B1 = converted %.loc19_17.1, %.loc19_17.4 [concrete = constants.%B1.val.267] +// CHECK:STDOUT: assign %b1.var, %.loc19_3.1 // CHECK:STDOUT: %B1.ref: type = name_ref B1, file.%B1.decl [concrete = constants.%B1] // CHECK:STDOUT: %b1: ref %B1 = bind_name b1, %b1.var // CHECK:STDOUT: name_binding_decl { @@ -1015,8 +1087,8 @@ base class T1(T:! type) { // CHECK:STDOUT: %.loc20_26.4: init %B1 = class_init (%.loc20_26.3), %.loc20_27.2 [concrete = constants.%B1.val.d2f] // CHECK:STDOUT: %.loc20_27.3: init %B1 = converted %.loc20_26.1, %.loc20_26.4 [concrete = constants.%B1.val.d2f] // CHECK:STDOUT: %.loc20_27.4: init %B2 = class_init (%.loc20_27.3), %b2.var [concrete = constants.%B2.val.e9e] -// CHECK:STDOUT: %.loc20_3: init %B2 = converted %.loc20_27.1, %.loc20_27.4 [concrete = constants.%B2.val.e9e] -// CHECK:STDOUT: assign %b2.var, %.loc20_3 +// CHECK:STDOUT: %.loc20_3.1: init %B2 = converted %.loc20_27.1, %.loc20_27.4 [concrete = constants.%B2.val.e9e] +// CHECK:STDOUT: assign %b2.var, %.loc20_3.1 // CHECK:STDOUT: %B2.ref: type = name_ref B2, file.%B2.decl [concrete = constants.%B2] // CHECK:STDOUT: %b2: ref %B2 = bind_name b2, %b2.var // CHECK:STDOUT: name_binding_decl { @@ -1036,10 +1108,28 @@ base class T1(T:! type) { // CHECK:STDOUT: %.loc21_34.4: init %B2 = class_init (%.loc21_34.3), %.loc21_35.2 [concrete = constants.%B2.val.426] // CHECK:STDOUT: %.loc21_35.3: init %B2 = converted %.loc21_34.1, %.loc21_34.4 [concrete = constants.%B2.val.426] // CHECK:STDOUT: %.loc21_35.4: init %C = class_init (%.loc21_35.3), %c.var [concrete = constants.%C.val] -// CHECK:STDOUT: %.loc21_3: init %C = converted %.loc21_35.1, %.loc21_35.4 [concrete = constants.%C.val] -// CHECK:STDOUT: assign %c.var, %.loc21_3 +// CHECK:STDOUT: %.loc21_3.1: init %C = converted %.loc21_35.1, %.loc21_35.4 [concrete = constants.%C.val] +// CHECK:STDOUT: assign %c.var, %.loc21_3.1 // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var +// CHECK:STDOUT: %impl.elem0.loc21: %.b80 = impl_witness_access constants.%Destroy.impl_witness.906, element0 [concrete = constants.%Op.5d7] +// CHECK:STDOUT: %bound_method.loc21_3.1: = bound_method %c.var, %impl.elem0.loc21 +// CHECK:STDOUT: %specific_fn.loc21: = specific_function %impl.elem0.loc21, @Op.2(constants.%C) [concrete = constants.%Op.specific_fn.6eb] +// CHECK:STDOUT: %bound_method.loc21_3.2: = bound_method %c.var, %specific_fn.loc21 +// CHECK:STDOUT: %.loc21_3.2: %C = bind_value %c.var +// CHECK:STDOUT: %no_op.loc21: init %empty_tuple.type = call %bound_method.loc21_3.2(%.loc21_3.2) +// CHECK:STDOUT: %impl.elem0.loc20: %.65f = impl_witness_access constants.%Destroy.impl_witness.453, element0 [concrete = constants.%Op.bb0] +// CHECK:STDOUT: %bound_method.loc20_3.1: = bound_method %b2.var, %impl.elem0.loc20 +// CHECK:STDOUT: %specific_fn.loc20: = specific_function %impl.elem0.loc20, @Op.2(constants.%B2) [concrete = constants.%Op.specific_fn.a6f] +// CHECK:STDOUT: %bound_method.loc20_3.2: = bound_method %b2.var, %specific_fn.loc20 +// CHECK:STDOUT: %.loc20_3.2: %B2 = bind_value %b2.var +// CHECK:STDOUT: %no_op.loc20: init %empty_tuple.type = call %bound_method.loc20_3.2(%.loc20_3.2) +// CHECK:STDOUT: %impl.elem0.loc19: %.3cf = impl_witness_access constants.%Destroy.impl_witness.67b, element0 [concrete = constants.%Op.a5c] +// CHECK:STDOUT: %bound_method.loc19_3.1: = bound_method %b1.var, %impl.elem0.loc19 +// CHECK:STDOUT: %specific_fn.loc19: = specific_function %impl.elem0.loc19, @Op.2(constants.%B1) [concrete = constants.%Op.specific_fn.075] +// CHECK:STDOUT: %bound_method.loc19_3.2: = bound_method %b1.var, %specific_fn.loc19 +// CHECK:STDOUT: %.loc19_3.2: %B1 = bind_value %b1.var +// CHECK:STDOUT: %no_op.loc19: init %empty_tuple.type = call %bound_method.loc19_3.2(%.loc19_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1102,6 +1192,7 @@ base class T1(T:! type) { // CHECK:STDOUT: %Base: type = class_type @Base [concrete] // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] // CHECK:STDOUT: %Base.elem: type = unbound_element_type %Base, %i32 [concrete] @@ -1143,12 +1234,30 @@ base class T1(T:! type) { // CHECK:STDOUT: %Convert.bound.ac3: = bound_method %int_4.0c1, %Convert.956 [concrete] // CHECK:STDOUT: %bound_method.1da: = bound_method %int_4.0c1, %Convert.specific_fn [concrete] // CHECK:STDOUT: %int_4.940: %i32 = int_value 4 [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.2 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.3, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.dfd: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%Base) [concrete] +// CHECK:STDOUT: %Op.type.193: type = fn_type @Op.3, @impl.49c(%Base) [concrete] +// CHECK:STDOUT: %Op.345: %Op.type.193 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.055: %Destroy.type = facet_value %Base, (%Destroy.impl_witness.dfd) [concrete] +// CHECK:STDOUT: %.097: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.055 [concrete] +// CHECK:STDOUT: %Op.specific_fn.083: = specific_function %Op.345, @Op.3(%Base) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.64e: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.type.a17: type = fn_type @Op.3, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.e6a: %Op.type.a17 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.5f7: %Destroy.type = facet_value %i32, (%Destroy.impl_witness.64e) [concrete] +// CHECK:STDOUT: %.ab7: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.5f7 [concrete] +// CHECK:STDOUT: %Op.specific_fn.014: = specific_function %Op.e6a, @Op.3(%i32) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Int = %Core.Int // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -1156,6 +1265,9 @@ base class T1(T:! type) { // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -1211,13 +1323,13 @@ base class T1(T:! type) { // CHECK:STDOUT: } // CHECK:STDOUT: %i.var: ref %i32 = var %i.var_patt // CHECK:STDOUT: %int_3.loc12: Core.IntLiteral = int_value 3 [concrete = constants.%int_3.1ba] -// CHECK:STDOUT: %impl.elem0.loc12: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] -// CHECK:STDOUT: %bound_method.loc12_3.1: = bound_method %int_3.loc12, %impl.elem0.loc12 [concrete = constants.%Convert.bound.b30] -// CHECK:STDOUT: %specific_fn.loc12: = specific_function %impl.elem0.loc12, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc12_3.2: = bound_method %int_3.loc12, %specific_fn.loc12 [concrete = constants.%bound_method.047] +// CHECK:STDOUT: %impl.elem0.loc12_3.1: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc12_3.1: = bound_method %int_3.loc12, %impl.elem0.loc12_3.1 [concrete = constants.%Convert.bound.b30] +// CHECK:STDOUT: %specific_fn.loc12_3.1: = specific_function %impl.elem0.loc12_3.1, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc12_3.2: = bound_method %int_3.loc12, %specific_fn.loc12_3.1 [concrete = constants.%bound_method.047] // CHECK:STDOUT: %int.convert_checked.loc12: init %i32 = call %bound_method.loc12_3.2(%int_3.loc12) [concrete = constants.%int_3.822] -// CHECK:STDOUT: %.loc12_3: init %i32 = converted %int_3.loc12, %int.convert_checked.loc12 [concrete = constants.%int_3.822] -// CHECK:STDOUT: assign %i.var, %.loc12_3 +// CHECK:STDOUT: %.loc12_3.1: init %i32 = converted %int_3.loc12, %int.convert_checked.loc12 [concrete = constants.%int_3.822] +// CHECK:STDOUT: assign %i.var, %.loc12_3.1 // CHECK:STDOUT: %.loc12_10: type = splice_block %i32 [concrete = constants.%i32] { // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] @@ -1240,8 +1352,8 @@ base class T1(T:! type) { // CHECK:STDOUT: %.loc14_35.6: ref %i32 = class_element_access %b1.var, element1 // CHECK:STDOUT: %.loc14_35.7: init %i32 = initialize_from %.loc14_25 to %.loc14_35.6 // CHECK:STDOUT: %.loc14_35.8: init %Base = class_init (%.loc14_35.3, %.loc14_35.5, %.loc14_35.7), %b1.var -// CHECK:STDOUT: %.loc14_3: init %Base = converted %.loc14_35.1, %.loc14_35.8 -// CHECK:STDOUT: assign %b1.var, %.loc14_3 +// CHECK:STDOUT: %.loc14_3.1: init %Base = converted %.loc14_35.1, %.loc14_35.8 +// CHECK:STDOUT: assign %b1.var, %.loc14_3.1 // CHECK:STDOUT: %Base.ref.loc14: type = name_ref Base, file.%Base.decl [concrete = constants.%Base] // CHECK:STDOUT: %b1: ref %Base = bind_name b1, %b1.var // CHECK:STDOUT: name_binding_decl { @@ -1271,8 +1383,8 @@ base class T1(T:! type) { // CHECK:STDOUT: %.loc15_35.8: ref %i32 = class_element_access %b2.var, element1 // CHECK:STDOUT: %.loc15_35.9: init %i32 = initialize_from %.loc15_35.7 to %.loc15_35.8 [concrete = constants.%int_3.822] // CHECK:STDOUT: %.loc15_35.10: init %Base = class_init (%.loc15_35.3, %.loc15_35.6, %.loc15_35.9), %b2.var [concrete = constants.%Base.val] -// CHECK:STDOUT: %.loc15_3: init %Base = converted %.loc15_35.1, %.loc15_35.10 [concrete = constants.%Base.val] -// CHECK:STDOUT: assign %b2.var, %.loc15_3 +// CHECK:STDOUT: %.loc15_3.1: init %Base = converted %.loc15_35.1, %.loc15_35.10 [concrete = constants.%Base.val] +// CHECK:STDOUT: assign %b2.var, %.loc15_3.1 // CHECK:STDOUT: %Base.ref.loc15: type = name_ref Base, file.%Base.decl [concrete = constants.%Base] // CHECK:STDOUT: %b2: ref %Base = bind_name b2, %b2.var // CHECK:STDOUT: %b1.ref: ref %Base = name_ref b1, %b1 @@ -1286,6 +1398,24 @@ base class T1(T:! type) { // CHECK:STDOUT: %int.convert_checked.loc18: init %i32 = call %bound_method.loc18_9.2(%int_4) [concrete = constants.%int_4.940] // CHECK:STDOUT: %.loc18_9: init %i32 = converted %int_4, %int.convert_checked.loc18 [concrete = constants.%int_4.940] // CHECK:STDOUT: assign %.loc18_5, %.loc18_9 +// CHECK:STDOUT: %impl.elem0.loc15_3: %.097 = impl_witness_access constants.%Destroy.impl_witness.dfd, element0 [concrete = constants.%Op.345] +// CHECK:STDOUT: %bound_method.loc15_3.1: = bound_method %b2.var, %impl.elem0.loc15_3 +// CHECK:STDOUT: %specific_fn.loc15_3: = specific_function %impl.elem0.loc15_3, @Op.3(constants.%Base) [concrete = constants.%Op.specific_fn.083] +// CHECK:STDOUT: %bound_method.loc15_3.2: = bound_method %b2.var, %specific_fn.loc15_3 +// CHECK:STDOUT: %.loc15_3.2: %Base = bind_value %b2.var +// CHECK:STDOUT: %no_op.loc15: init %empty_tuple.type = call %bound_method.loc15_3.2(%.loc15_3.2) +// CHECK:STDOUT: %impl.elem0.loc14: %.097 = impl_witness_access constants.%Destroy.impl_witness.dfd, element0 [concrete = constants.%Op.345] +// CHECK:STDOUT: %bound_method.loc14_3.1: = bound_method %b1.var, %impl.elem0.loc14 +// CHECK:STDOUT: %specific_fn.loc14: = specific_function %impl.elem0.loc14, @Op.3(constants.%Base) [concrete = constants.%Op.specific_fn.083] +// CHECK:STDOUT: %bound_method.loc14_3.2: = bound_method %b1.var, %specific_fn.loc14 +// CHECK:STDOUT: %.loc14_3.2: %Base = bind_value %b1.var +// CHECK:STDOUT: %no_op.loc14: init %empty_tuple.type = call %bound_method.loc14_3.2(%.loc14_3.2) +// CHECK:STDOUT: %impl.elem0.loc12_3.2: %.ab7 = impl_witness_access constants.%Destroy.impl_witness.64e, element0 [concrete = constants.%Op.e6a] +// CHECK:STDOUT: %bound_method.loc12_3.3: = bound_method %i.var, %impl.elem0.loc12_3.2 +// CHECK:STDOUT: %specific_fn.loc12_3.2: = specific_function %impl.elem0.loc12_3.2, @Op.3(constants.%i32) [concrete = constants.%Op.specific_fn.014] +// CHECK:STDOUT: %bound_method.loc12_3.4: = bound_method %i.var, %specific_fn.loc12_3.2 +// CHECK:STDOUT: %.loc12_3.2: %i32 = bind_value %i.var +// CHECK:STDOUT: %no_op.loc12: init %empty_tuple.type = call %bound_method.loc12_3.4(%.loc12_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/deduce/array.carbon b/toolchain/check/testdata/deduce/array.carbon index 5bd3d2b6ff37..89f42c3a39e7 100644 --- a/toolchain/check/testdata/deduce/array.carbon +++ b/toolchain/check/testdata/deduce/array.carbon @@ -552,7 +552,7 @@ fn G() -> i32 { // CHECK:STDOUT: %pattern_type.261: type = pattern_type %array_type.bb5 [symbolic] // CHECK:STDOUT: %F.type: type = fn_type @F [concrete] // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] -// CHECK:STDOUT: %require_complete: = require_complete_type %array_type.bb5 [symbolic] +// CHECK:STDOUT: %require_complete.ec9: = require_complete_type %array_type.bb5 [symbolic] // CHECK:STDOUT: %G.type: type = fn_type @G [concrete] // CHECK:STDOUT: %G: %G.type = struct_value () [concrete] // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete] @@ -565,16 +565,30 @@ fn G() -> i32 { // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete] // CHECK:STDOUT: %array: %array_type.002 = tuple_value (%C.val, %C.val, %C.val) [concrete] // CHECK:STDOUT: %F.specific_fn: = specific_function %F, @F(%C, %int_3) [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.f2c: = impl_witness imports.%Destroy.impl_witness_table, @impl(%array_type.002) [concrete] +// CHECK:STDOUT: %Op.type.85d: type = fn_type @Op.2, @impl(%array_type.002) [concrete] +// CHECK:STDOUT: %Op.1f9: %Op.type.85d = struct_value () [concrete] // CHECK:STDOUT: %complete_type.dd1: = complete_type_witness %array_type.002 [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %array_type.002, (%Destroy.impl_witness.f2c) [concrete] +// CHECK:STDOUT: %.4c4: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.1f9, @Op.2(%array_type.002) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .IntLiteral = %Core.IntLiteral +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Core.IntLiteral: %IntLiteral.type = import_ref Core//prelude/parts/int_literal, IntLiteral, loaded [concrete = constants.%IntLiteral] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -628,7 +642,7 @@ fn G() -> i32 { // CHECK:STDOUT: %pattern_type: type = pattern_type %array_type.loc6_52.2 [symbolic = %pattern_type (constants.%pattern_type.261)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type %array_type.loc6_52.2 [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %require_complete: = require_complete_type %array_type.loc6_52.2 [symbolic = %require_complete (constants.%require_complete.ec9)] // CHECK:STDOUT: // CHECK:STDOUT: fn(%a.param: @F.%array_type.loc6_52.2 (%array_type.bb5)) { // CHECK:STDOUT: !entry: @@ -660,8 +674,8 @@ fn G() -> i32 { // CHECK:STDOUT: %.loc9_34.2: init %C = class_init (), %.loc9_35.6 [concrete = constants.%C.val] // CHECK:STDOUT: %.loc9_35.7: init %C = converted %.loc9_34.1, %.loc9_34.2 [concrete = constants.%C.val] // CHECK:STDOUT: %.loc9_35.8: init %array_type.002 = array_init (%.loc9_35.3, %.loc9_35.5, %.loc9_35.7) to %a.var [concrete = constants.%array] -// CHECK:STDOUT: %.loc9_3: init %array_type.002 = converted %.loc9_35.1, %.loc9_35.8 [concrete = constants.%array] -// CHECK:STDOUT: assign %a.var, %.loc9_3 +// CHECK:STDOUT: %.loc9_3.1: init %array_type.002 = converted %.loc9_35.1, %.loc9_35.8 [concrete = constants.%array] +// CHECK:STDOUT: assign %a.var, %.loc9_3.1 // CHECK:STDOUT: %.loc9_20: type = splice_block %array_type [concrete = constants.%array_type.002] { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3] @@ -673,6 +687,12 @@ fn G() -> i32 { // CHECK:STDOUT: %F.specific_fn: = specific_function %F.ref, @F(constants.%C, constants.%int_3) [concrete = constants.%F.specific_fn] // CHECK:STDOUT: %.loc10: %array_type.002 = bind_value %a.ref // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.specific_fn(%.loc10) +// CHECK:STDOUT: %impl.elem0: %.4c4 = impl_witness_access constants.%Destroy.impl_witness.f2c, element0 [concrete = constants.%Op.1f9] +// CHECK:STDOUT: %bound_method.loc9_3.1: = bound_method %a.var, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%array_type.002) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc9_3.2: = bound_method %a.var, %specific_fn +// CHECK:STDOUT: %.loc9_3.2: %array_type.002 = bind_value %a.var +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc9_3.2(%.loc9_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/deduce/binding_pattern.carbon b/toolchain/check/testdata/deduce/binding_pattern.carbon index d6119bd9aae8..230045517577 100644 --- a/toolchain/check/testdata/deduce/binding_pattern.carbon +++ b/toolchain/check/testdata/deduce/binding_pattern.carbon @@ -103,9 +103,9 @@ fn F(U:! type, V:! type where {} impls Core.ImplicitAs(.Self)) { // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] -// CHECK:STDOUT: %Core.import_ref.492: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.ca0) = import_ref Core//prelude/parts/as, loc10_35, loaded [symbolic = @ImplicitAs.%assoc0 (constants.%assoc0.dc0)] -// CHECK:STDOUT: %Core.import_ref.1c7: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//prelude/parts/as, loc10_35, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] -// CHECK:STDOUT: %Core.import_ref.207 = import_ref Core//prelude/parts/as, loc10_35, unloaded +// CHECK:STDOUT: %Core.import_ref.492: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.ca0) = import_ref Core//prelude/parts/as, loc12_35, loaded [symbolic = @ImplicitAs.%assoc0 (constants.%assoc0.dc0)] +// CHECK:STDOUT: %Core.import_ref.1c7: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//prelude/parts/as, loc12_35, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] +// CHECK:STDOUT: %Core.import_ref.207 = import_ref Core//prelude/parts/as, loc12_35, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -288,9 +288,9 @@ fn F(U:! type, V:! type where {} impls Core.ImplicitAs(.Self)) { // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] -// CHECK:STDOUT: %Core.import_ref.492: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.ca0) = import_ref Core//prelude/parts/as, loc10_35, loaded [symbolic = @ImplicitAs.%assoc0 (constants.%assoc0.dc0)] -// CHECK:STDOUT: %Core.import_ref.1c7: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//prelude/parts/as, loc10_35, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] -// CHECK:STDOUT: %Core.import_ref.207 = import_ref Core//prelude/parts/as, loc10_35, unloaded +// CHECK:STDOUT: %Core.import_ref.492: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.ca0) = import_ref Core//prelude/parts/as, loc12_35, loaded [symbolic = @ImplicitAs.%assoc0 (constants.%assoc0.dc0)] +// CHECK:STDOUT: %Core.import_ref.1c7: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//prelude/parts/as, loc12_35, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] +// CHECK:STDOUT: %Core.import_ref.207 = import_ref Core//prelude/parts/as, loc12_35, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { diff --git a/toolchain/check/testdata/deduce/value_with_type_through_access.carbon b/toolchain/check/testdata/deduce/value_with_type_through_access.carbon index b3fde9a3a57c..8cccea6f020f 100644 --- a/toolchain/check/testdata/deduce/value_with_type_through_access.carbon +++ b/toolchain/check/testdata/deduce/value_with_type_through_access.carbon @@ -106,17 +106,17 @@ fn G() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %tuple.type: type = tuple_type (type) [concrete] -// CHECK:STDOUT: %T: %tuple.type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %T.6eb: %tuple.type = bind_symbolic_name T, 0 [symbolic] // CHECK:STDOUT: %pattern_type.f1e: type = pattern_type %tuple.type [concrete] // CHECK:STDOUT: %HoldsType.type: type = generic_class_type @HoldsType [concrete] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %HoldsType.generic: %HoldsType.type = struct_value () [concrete] -// CHECK:STDOUT: %HoldsType.cc9: type = class_type @HoldsType, @HoldsType(%T) [symbolic] +// CHECK:STDOUT: %HoldsType.cc9: type = class_type @HoldsType, @HoldsType(%T.6eb) [symbolic] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] // CHECK:STDOUT: %pattern_type.ec6: type = pattern_type %HoldsType.cc9 [symbolic] // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete] -// CHECK:STDOUT: %tuple.elem0: type = tuple_access %T, element0 [symbolic] +// CHECK:STDOUT: %tuple.elem0: type = tuple_access %T.6eb, element0 [symbolic] // CHECK:STDOUT: %pattern_type.08e: type = pattern_type %tuple.elem0 [symbolic] // CHECK:STDOUT: %F.type: type = fn_type @F [concrete] // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] @@ -132,13 +132,34 @@ fn G() { // CHECK:STDOUT: %pattern_type.c48: type = pattern_type %C [concrete] // CHECK:STDOUT: %F.specific_fn: = specific_function %F, @F(%tuple) [concrete] // CHECK:STDOUT: %C.val: %C = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T.8b3: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T.8b3) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.906: = impl_witness imports.%Destroy.impl_witness_table, @impl(%C) [concrete] +// CHECK:STDOUT: %Op.type.153: type = fn_type @Op.2, @impl(%C) [concrete] +// CHECK:STDOUT: %Op.5d7: %Op.type.153 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.494: %Destroy.type = facet_value %C, (%Destroy.impl_witness.906) [concrete] +// CHECK:STDOUT: %.b80: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.494 [concrete] +// CHECK:STDOUT: %Op.specific_fn.6eb: = specific_function %Op.5d7, @Op.2(%C) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.ccb: = impl_witness imports.%Destroy.impl_witness_table, @impl(%HoldsType.c09) [concrete] +// CHECK:STDOUT: %Op.type.431: type = fn_type @Op.2, @impl(%HoldsType.c09) [concrete] +// CHECK:STDOUT: %Op.f20: %Op.type.431 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.835: %Destroy.type = facet_value %HoldsType.c09, (%Destroy.impl_witness.ccb) [concrete] +// CHECK:STDOUT: %.9ea: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.835 [concrete] +// CHECK:STDOUT: %Op.specific_fn.58d: = specific_function %Op.f20, @Op.2(%HoldsType.c09) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -157,7 +178,7 @@ fn G() { // CHECK:STDOUT: %.loc4_28.2: %tuple.type = tuple_literal (type) // CHECK:STDOUT: %.loc4_28.3: type = converted %.loc4_28.2, constants.%tuple.type [concrete = constants.%tuple.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc4_17.1: %tuple.type = bind_symbolic_name T, 0 [symbolic = %T.loc4_17.2 (constants.%T)] +// CHECK:STDOUT: %T.loc4_17.1: %tuple.type = bind_symbolic_name T, 0 [symbolic = %T.loc4_17.2 (constants.%T.6eb)] // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] { // CHECK:STDOUT: %T.patt: %pattern_type.f1e = symbolic_binding_pattern T, 0 [concrete] @@ -170,17 +191,17 @@ fn G() { // CHECK:STDOUT: %.loc8_17.2: %tuple.type = tuple_literal (type) // CHECK:STDOUT: %.loc8_17.3: type = converted %.loc8_17.2, constants.%tuple.type [concrete = constants.%tuple.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc8_6.1: %tuple.type = bind_symbolic_name T, 0 [symbolic = %T.loc8_6.2 (constants.%T)] +// CHECK:STDOUT: %T.loc8_6.1: %tuple.type = bind_symbolic_name T, 0 [symbolic = %T.loc8_6.2 (constants.%T.6eb)] // CHECK:STDOUT: %x.param: @F.%HoldsType.loc8_34.2 (%HoldsType.cc9) = value_param call_param0 // CHECK:STDOUT: %.loc8_34: type = splice_block %HoldsType.loc8_34.1 [symbolic = %HoldsType.loc8_34.2 (constants.%HoldsType.cc9)] { // CHECK:STDOUT: %HoldsType.ref: %HoldsType.type = name_ref HoldsType, file.%HoldsType.decl [concrete = constants.%HoldsType.generic] -// CHECK:STDOUT: %T.ref.loc8_33: %tuple.type = name_ref T, %T.loc8_6.1 [symbolic = %T.loc8_6.2 (constants.%T)] -// CHECK:STDOUT: %HoldsType.loc8_34.1: type = class_type @HoldsType, @HoldsType(constants.%T) [symbolic = %HoldsType.loc8_34.2 (constants.%HoldsType.cc9)] +// CHECK:STDOUT: %T.ref.loc8_33: %tuple.type = name_ref T, %T.loc8_6.1 [symbolic = %T.loc8_6.2 (constants.%T.6eb)] +// CHECK:STDOUT: %HoldsType.loc8_34.1: type = class_type @HoldsType, @HoldsType(constants.%T.6eb) [symbolic = %HoldsType.loc8_34.2 (constants.%HoldsType.cc9)] // CHECK:STDOUT: } // CHECK:STDOUT: %x: @F.%HoldsType.loc8_34.2 (%HoldsType.cc9) = bind_name x, %x.param // CHECK:STDOUT: %a.param: @F.%tuple.elem0.loc8_41.2 (%tuple.elem0) = value_param call_param1 // CHECK:STDOUT: %.loc8_41: type = splice_block %tuple.elem0.loc8_41.1 [symbolic = %tuple.elem0.loc8_41.2 (constants.%tuple.elem0)] { -// CHECK:STDOUT: %T.ref.loc8_40: %tuple.type = name_ref T, %T.loc8_6.1 [symbolic = %T.loc8_6.2 (constants.%T)] +// CHECK:STDOUT: %T.ref.loc8_40: %tuple.type = name_ref T, %T.loc8_6.1 [symbolic = %T.loc8_6.2 (constants.%T.6eb)] // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] // CHECK:STDOUT: %tuple.elem0.loc8_41.1: type = tuple_access %T.ref.loc8_40, element0 [symbolic = %tuple.elem0.loc8_41.2 (constants.%tuple.elem0)] // CHECK:STDOUT: } @@ -191,7 +212,7 @@ fn G() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic class @HoldsType(%T.loc4_17.1: %tuple.type) { -// CHECK:STDOUT: %T.loc4_17.2: %tuple.type = bind_symbolic_name T, 0 [symbolic = %T.loc4_17.2 (constants.%T)] +// CHECK:STDOUT: %T.loc4_17.2: %tuple.type = bind_symbolic_name T, 0 [symbolic = %T.loc4_17.2 (constants.%T.6eb)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -215,7 +236,7 @@ fn G() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @F(%T.loc8_6.1: %tuple.type) { -// CHECK:STDOUT: %T.loc8_6.2: %tuple.type = bind_symbolic_name T, 0 [symbolic = %T.loc8_6.2 (constants.%T)] +// CHECK:STDOUT: %T.loc8_6.2: %tuple.type = bind_symbolic_name T, 0 [symbolic = %T.loc8_6.2 (constants.%T.6eb)] // CHECK:STDOUT: %HoldsType.loc8_34.2: type = class_type @HoldsType, @HoldsType(%T.loc8_6.2) [symbolic = %HoldsType.loc8_34.2 (constants.%HoldsType.cc9)] // CHECK:STDOUT: %pattern_type.loc8_20: type = pattern_type %HoldsType.loc8_34.2 [symbolic = %pattern_type.loc8_20 (constants.%pattern_type.ec6)] // CHECK:STDOUT: %tuple.elem0.loc8_41.2: type = tuple_access %T.loc8_6.2, element0 [symbolic = %tuple.elem0.loc8_41.2 (constants.%tuple.elem0)] @@ -254,17 +275,29 @@ fn G() { // CHECK:STDOUT: %.loc13_30.5: ref %C = converted %.loc13_30.1, %.loc13_30.4 // CHECK:STDOUT: %.loc13_30.6: %C = bind_value %.loc13_30.5 // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.specific_fn(%.loc13_8.2, %.loc13_30.6) +// CHECK:STDOUT: %impl.elem0.loc13_30: %.b80 = impl_witness_access constants.%Destroy.impl_witness.906, element0 [concrete = constants.%Op.5d7] +// CHECK:STDOUT: %bound_method.loc13_30.1: = bound_method %.loc13_30.2, %impl.elem0.loc13_30 +// CHECK:STDOUT: %specific_fn.loc13_30: = specific_function %impl.elem0.loc13_30, @Op.2(constants.%C) [concrete = constants.%Op.specific_fn.6eb] +// CHECK:STDOUT: %bound_method.loc13_30.2: = bound_method %.loc13_30.2, %specific_fn.loc13_30 +// CHECK:STDOUT: %.loc13_30.7: %C = bind_value %.loc13_30.2 +// CHECK:STDOUT: %no_op.loc13_30: init %empty_tuple.type = call %bound_method.loc13_30.2(%.loc13_30.7) +// CHECK:STDOUT: %impl.elem0.loc13_6: %.9ea = impl_witness_access constants.%Destroy.impl_witness.ccb, element0 [concrete = constants.%Op.f20] +// CHECK:STDOUT: %bound_method.loc13_6.1: = bound_method %.loc13_6.2, %impl.elem0.loc13_6 +// CHECK:STDOUT: %specific_fn.loc13_6: = specific_function %impl.elem0.loc13_6, @Op.2(constants.%HoldsType.c09) [concrete = constants.%Op.specific_fn.58d] +// CHECK:STDOUT: %bound_method.loc13_6.2: = bound_method %.loc13_6.2, %specific_fn.loc13_6 +// CHECK:STDOUT: %.loc13_6.5: %HoldsType.c09 = bind_value %.loc13_6.2 +// CHECK:STDOUT: %no_op.loc13_6: init %empty_tuple.type = call %bound_method.loc13_6.2(%.loc13_6.5) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @HoldsType(constants.%T) { -// CHECK:STDOUT: %T.loc4_17.2 => constants.%T +// CHECK:STDOUT: specific @HoldsType(constants.%T.6eb) { +// CHECK:STDOUT: %T.loc4_17.2 => constants.%T.6eb // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F(constants.%T) { -// CHECK:STDOUT: %T.loc8_6.2 => constants.%T +// CHECK:STDOUT: specific @F(constants.%T.6eb) { +// CHECK:STDOUT: %T.loc8_6.2 => constants.%T.6eb // CHECK:STDOUT: %HoldsType.loc8_34.2 => constants.%HoldsType.cc9 // CHECK:STDOUT: %pattern_type.loc8_20 => constants.%pattern_type.ec6 // CHECK:STDOUT: %tuple.elem0.loc8_41.2 => constants.%tuple.elem0 @@ -293,16 +326,16 @@ fn G() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %struct_type.t: type = struct_type {.t: type} [concrete] -// CHECK:STDOUT: %T: %struct_type.t = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %T.08d: %struct_type.t = bind_symbolic_name T, 0 [symbolic] // CHECK:STDOUT: %pattern_type.7f2: type = pattern_type %struct_type.t [concrete] // CHECK:STDOUT: %HoldsType.type: type = generic_class_type @HoldsType [concrete] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %HoldsType.generic: %HoldsType.type = struct_value () [concrete] -// CHECK:STDOUT: %HoldsType.843: type = class_type @HoldsType, @HoldsType(%T) [symbolic] +// CHECK:STDOUT: %HoldsType.843: type = class_type @HoldsType, @HoldsType(%T.08d) [symbolic] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] // CHECK:STDOUT: %pattern_type.aa4: type = pattern_type %HoldsType.843 [symbolic] -// CHECK:STDOUT: %.20a: type = struct_access %T, element0 [symbolic] +// CHECK:STDOUT: %.20a: type = struct_access %T.08d, element0 [symbolic] // CHECK:STDOUT: %pattern_type.9f0: type = pattern_type %.20a [symbolic] // CHECK:STDOUT: %F.type: type = fn_type @F [concrete] // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] @@ -318,13 +351,34 @@ fn G() { // CHECK:STDOUT: %pattern_type.c48: type = pattern_type %C [concrete] // CHECK:STDOUT: %F.specific_fn: = specific_function %F, @F(%struct) [concrete] // CHECK:STDOUT: %C.val: %C = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T.8b3: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T.8b3) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.906: = impl_witness imports.%Destroy.impl_witness_table, @impl(%C) [concrete] +// CHECK:STDOUT: %Op.type.153: type = fn_type @Op.2, @impl(%C) [concrete] +// CHECK:STDOUT: %Op.5d7: %Op.type.153 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.494: %Destroy.type = facet_value %C, (%Destroy.impl_witness.906) [concrete] +// CHECK:STDOUT: %.b80: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.494 [concrete] +// CHECK:STDOUT: %Op.specific_fn.6eb: = specific_function %Op.5d7, @Op.2(%C) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.55e: = impl_witness imports.%Destroy.impl_witness_table, @impl(%HoldsType.705) [concrete] +// CHECK:STDOUT: %Op.type.8ea: type = fn_type @Op.2, @impl(%HoldsType.705) [concrete] +// CHECK:STDOUT: %Op.180: %Op.type.8ea = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.7e8: %Destroy.type = facet_value %HoldsType.705, (%Destroy.impl_witness.55e) [concrete] +// CHECK:STDOUT: %.3b5: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.7e8 [concrete] +// CHECK:STDOUT: %Op.specific_fn.fde: = specific_function %Op.180, @Op.2(%HoldsType.705) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -340,7 +394,7 @@ fn G() { // CHECK:STDOUT: %T.patt: %pattern_type.7f2 = symbolic_binding_pattern T, 0 [concrete] // CHECK:STDOUT: } { // CHECK:STDOUT: %struct_type.t: type = struct_type {.t: type} [concrete = constants.%struct_type.t] -// CHECK:STDOUT: %T.loc4_17.1: %struct_type.t = bind_symbolic_name T, 0 [symbolic = %T.loc4_17.2 (constants.%T)] +// CHECK:STDOUT: %T.loc4_17.1: %struct_type.t = bind_symbolic_name T, 0 [symbolic = %T.loc4_17.2 (constants.%T.08d)] // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] { // CHECK:STDOUT: %T.patt: %pattern_type.7f2 = symbolic_binding_pattern T, 0 [concrete] @@ -350,17 +404,17 @@ fn G() { // CHECK:STDOUT: %a.param_patt: @F.%pattern_type.loc8_39 (%pattern_type.9f0) = value_param_pattern %a.patt, call_param1 [concrete] // CHECK:STDOUT: } { // CHECK:STDOUT: %struct_type.t: type = struct_type {.t: type} [concrete = constants.%struct_type.t] -// CHECK:STDOUT: %T.loc8_6.1: %struct_type.t = bind_symbolic_name T, 0 [symbolic = %T.loc8_6.2 (constants.%T)] +// CHECK:STDOUT: %T.loc8_6.1: %struct_type.t = bind_symbolic_name T, 0 [symbolic = %T.loc8_6.2 (constants.%T.08d)] // CHECK:STDOUT: %x.param: @F.%HoldsType.loc8_36.2 (%HoldsType.843) = value_param call_param0 // CHECK:STDOUT: %.loc8_36: type = splice_block %HoldsType.loc8_36.1 [symbolic = %HoldsType.loc8_36.2 (constants.%HoldsType.843)] { // CHECK:STDOUT: %HoldsType.ref: %HoldsType.type = name_ref HoldsType, file.%HoldsType.decl [concrete = constants.%HoldsType.generic] -// CHECK:STDOUT: %T.ref.loc8_35: %struct_type.t = name_ref T, %T.loc8_6.1 [symbolic = %T.loc8_6.2 (constants.%T)] -// CHECK:STDOUT: %HoldsType.loc8_36.1: type = class_type @HoldsType, @HoldsType(constants.%T) [symbolic = %HoldsType.loc8_36.2 (constants.%HoldsType.843)] +// CHECK:STDOUT: %T.ref.loc8_35: %struct_type.t = name_ref T, %T.loc8_6.1 [symbolic = %T.loc8_6.2 (constants.%T.08d)] +// CHECK:STDOUT: %HoldsType.loc8_36.1: type = class_type @HoldsType, @HoldsType(constants.%T.08d) [symbolic = %HoldsType.loc8_36.2 (constants.%HoldsType.843)] // CHECK:STDOUT: } // CHECK:STDOUT: %x: @F.%HoldsType.loc8_36.2 (%HoldsType.843) = bind_name x, %x.param // CHECK:STDOUT: %a.param: @F.%.loc8_43.3 (%.20a) = value_param call_param1 // CHECK:STDOUT: %.loc8_43.1: type = splice_block %.loc8_43.2 [symbolic = %.loc8_43.3 (constants.%.20a)] { -// CHECK:STDOUT: %T.ref.loc8_42: %struct_type.t = name_ref T, %T.loc8_6.1 [symbolic = %T.loc8_6.2 (constants.%T)] +// CHECK:STDOUT: %T.ref.loc8_42: %struct_type.t = name_ref T, %T.loc8_6.1 [symbolic = %T.loc8_6.2 (constants.%T.08d)] // CHECK:STDOUT: %.loc8_43.2: type = struct_access %T.ref.loc8_42, element0 [symbolic = %.loc8_43.3 (constants.%.20a)] // CHECK:STDOUT: } // CHECK:STDOUT: %a: @F.%.loc8_43.3 (%.20a) = bind_name a, %a.param @@ -370,7 +424,7 @@ fn G() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic class @HoldsType(%T.loc4_17.1: %struct_type.t) { -// CHECK:STDOUT: %T.loc4_17.2: %struct_type.t = bind_symbolic_name T, 0 [symbolic = %T.loc4_17.2 (constants.%T)] +// CHECK:STDOUT: %T.loc4_17.2: %struct_type.t = bind_symbolic_name T, 0 [symbolic = %T.loc4_17.2 (constants.%T.08d)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -394,7 +448,7 @@ fn G() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @F(%T.loc8_6.1: %struct_type.t) { -// CHECK:STDOUT: %T.loc8_6.2: %struct_type.t = bind_symbolic_name T, 0 [symbolic = %T.loc8_6.2 (constants.%T)] +// CHECK:STDOUT: %T.loc8_6.2: %struct_type.t = bind_symbolic_name T, 0 [symbolic = %T.loc8_6.2 (constants.%T.08d)] // CHECK:STDOUT: %HoldsType.loc8_36.2: type = class_type @HoldsType, @HoldsType(%T.loc8_6.2) [symbolic = %HoldsType.loc8_36.2 (constants.%HoldsType.843)] // CHECK:STDOUT: %pattern_type.loc8_22: type = pattern_type %HoldsType.loc8_36.2 [symbolic = %pattern_type.loc8_22 (constants.%pattern_type.aa4)] // CHECK:STDOUT: %.loc8_43.3: type = struct_access %T.loc8_6.2, element0 [symbolic = %.loc8_43.3 (constants.%.20a)] @@ -433,17 +487,29 @@ fn G() { // CHECK:STDOUT: %.loc13_33.5: ref %C = converted %.loc13_33.1, %.loc13_33.4 // CHECK:STDOUT: %.loc13_33.6: %C = bind_value %.loc13_33.5 // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.specific_fn(%.loc13_8.2, %.loc13_33.6) +// CHECK:STDOUT: %impl.elem0.loc13_33: %.b80 = impl_witness_access constants.%Destroy.impl_witness.906, element0 [concrete = constants.%Op.5d7] +// CHECK:STDOUT: %bound_method.loc13_33.1: = bound_method %.loc13_33.2, %impl.elem0.loc13_33 +// CHECK:STDOUT: %specific_fn.loc13_33: = specific_function %impl.elem0.loc13_33, @Op.2(constants.%C) [concrete = constants.%Op.specific_fn.6eb] +// CHECK:STDOUT: %bound_method.loc13_33.2: = bound_method %.loc13_33.2, %specific_fn.loc13_33 +// CHECK:STDOUT: %.loc13_33.7: %C = bind_value %.loc13_33.2 +// CHECK:STDOUT: %no_op.loc13_33: init %empty_tuple.type = call %bound_method.loc13_33.2(%.loc13_33.7) +// CHECK:STDOUT: %impl.elem0.loc13_6: %.3b5 = impl_witness_access constants.%Destroy.impl_witness.55e, element0 [concrete = constants.%Op.180] +// CHECK:STDOUT: %bound_method.loc13_6.1: = bound_method %.loc13_6.2, %impl.elem0.loc13_6 +// CHECK:STDOUT: %specific_fn.loc13_6: = specific_function %impl.elem0.loc13_6, @Op.2(constants.%HoldsType.705) [concrete = constants.%Op.specific_fn.fde] +// CHECK:STDOUT: %bound_method.loc13_6.2: = bound_method %.loc13_6.2, %specific_fn.loc13_6 +// CHECK:STDOUT: %.loc13_6.5: %HoldsType.705 = bind_value %.loc13_6.2 +// CHECK:STDOUT: %no_op.loc13_6: init %empty_tuple.type = call %bound_method.loc13_6.2(%.loc13_6.5) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @HoldsType(constants.%T) { -// CHECK:STDOUT: %T.loc4_17.2 => constants.%T +// CHECK:STDOUT: specific @HoldsType(constants.%T.08d) { +// CHECK:STDOUT: %T.loc4_17.2 => constants.%T.08d // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F(constants.%T) { -// CHECK:STDOUT: %T.loc8_6.2 => constants.%T +// CHECK:STDOUT: specific @F(constants.%T.08d) { +// CHECK:STDOUT: %T.loc8_6.2 => constants.%T.08d // CHECK:STDOUT: %HoldsType.loc8_36.2 => constants.%HoldsType.843 // CHECK:STDOUT: %pattern_type.loc8_22 => constants.%pattern_type.aa4 // CHECK:STDOUT: %.loc8_43.3 => constants.%.20a @@ -475,15 +541,16 @@ fn G() { // CHECK:STDOUT: %Class.elem: type = unbound_element_type %Class, type [concrete] // CHECK:STDOUT: %struct_type.t: type = struct_type {.t: type} [concrete] // CHECK:STDOUT: %complete_type.509: = complete_type_witness %struct_type.t [concrete] -// CHECK:STDOUT: %T: %Class = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %T.0de: %Class = bind_symbolic_name T, 0 [symbolic] // CHECK:STDOUT: %pattern_type.761: type = pattern_type %Class [concrete] // CHECK:STDOUT: %HoldsType.type: type = generic_class_type @HoldsType [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %HoldsType.generic: %HoldsType.type = struct_value () [concrete] -// CHECK:STDOUT: %HoldsType.f95cf2.1: type = class_type @HoldsType, @HoldsType(%T) [symbolic] +// CHECK:STDOUT: %HoldsType.f95cf2.1: type = class_type @HoldsType, @HoldsType(%T.0de) [symbolic] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %complete_type.357: = complete_type_witness %empty_struct_type [concrete] -// CHECK:STDOUT: %pattern_type.937: type = pattern_type %HoldsType.f95cf2.1 [symbolic] -// CHECK:STDOUT: %.2fe: ref type = class_element_access %T, element0 [symbolic] +// CHECK:STDOUT: %pattern_type.93719d.1: type = pattern_type %HoldsType.f95cf2.1 [symbolic] +// CHECK:STDOUT: %.2fe: ref type = class_element_access %T.0de, element0 [symbolic] // CHECK:STDOUT: %F.type: type = fn_type @F [concrete] // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] // CHECK:STDOUT: %require_complete.8fa644.1: = require_complete_type %HoldsType.f95cf2.1 [symbolic] @@ -494,13 +561,33 @@ fn G() { // CHECK:STDOUT: %Class.val: %Class = struct_value (%C) [concrete] // CHECK:STDOUT: %HoldsType.f95cf2.2: type = class_type @HoldsType, @HoldsType(%c) [symbolic] // CHECK:STDOUT: %HoldsType.val: %HoldsType.f95cf2.2 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T.8b3: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T.8b3) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %HoldsType.f95cf2.2, @Destroy [symbolic] +// CHECK:STDOUT: %Destroy.facet.088: %Destroy.type = facet_value %HoldsType.f95cf2.2, (%Destroy.lookup_impl_witness) [symbolic] +// CHECK:STDOUT: %.da6: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.088 [symbolic] +// CHECK:STDOUT: %impl.elem0: %.da6 = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic] +// CHECK:STDOUT: %specific_impl_fn: = specific_impl_function %impl.elem0, @Op.1(%Destroy.facet.088) [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.fef: = impl_witness imports.%Destroy.impl_witness_table, @impl(%Class) [concrete] +// CHECK:STDOUT: %Op.type.7de: type = fn_type @Op.2, @impl(%Class) [concrete] +// CHECK:STDOUT: %Op.d64: %Op.type.7de = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.817: %Destroy.type = facet_value %Class, (%Destroy.impl_witness.fef) [concrete] +// CHECK:STDOUT: %.b9f: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.817 [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.d64, @Op.2(%Class) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -518,27 +605,27 @@ fn G() { // CHECK:STDOUT: %T.patt: %pattern_type.761 = symbolic_binding_pattern T, 0 [concrete] // CHECK:STDOUT: } { // CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [concrete = constants.%Class] -// CHECK:STDOUT: %T.loc8_17.1: %Class = bind_symbolic_name T, 0 [symbolic = %T.loc8_17.2 (constants.%T)] +// CHECK:STDOUT: %T.loc8_17.1: %Class = bind_symbolic_name T, 0 [symbolic = %T.loc8_17.2 (constants.%T.0de)] // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] { // CHECK:STDOUT: %T.patt: %pattern_type.761 = symbolic_binding_pattern T, 0 [concrete] -// CHECK:STDOUT: %x.patt: @F.%pattern_type (%pattern_type.937) = binding_pattern x [concrete] -// CHECK:STDOUT: %x.param_patt: @F.%pattern_type (%pattern_type.937) = value_param_pattern %x.patt, call_param0 [concrete] +// CHECK:STDOUT: %x.patt: @F.%pattern_type (%pattern_type.93719d.1) = binding_pattern x [concrete] +// CHECK:STDOUT: %x.param_patt: @F.%pattern_type (%pattern_type.93719d.1) = value_param_pattern %x.patt, call_param0 [concrete] // CHECK:STDOUT: %a.patt: = binding_pattern a [concrete] // CHECK:STDOUT: %a.param_patt: = value_param_pattern %a.patt, call_param1 [concrete] // CHECK:STDOUT: } { // CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [concrete = constants.%Class] -// CHECK:STDOUT: %T.loc21_6.1: %Class = bind_symbolic_name T, 0 [symbolic = %T.loc21_6.2 (constants.%T)] +// CHECK:STDOUT: %T.loc21_6.1: %Class = bind_symbolic_name T, 0 [symbolic = %T.loc21_6.2 (constants.%T.0de)] // CHECK:STDOUT: %x.param: @F.%HoldsType.loc21_31.2 (%HoldsType.f95cf2.1) = value_param call_param0 // CHECK:STDOUT: %.loc21_31: type = splice_block %HoldsType.loc21_31.1 [symbolic = %HoldsType.loc21_31.2 (constants.%HoldsType.f95cf2.1)] { // CHECK:STDOUT: %HoldsType.ref: %HoldsType.type = name_ref HoldsType, file.%HoldsType.decl [concrete = constants.%HoldsType.generic] -// CHECK:STDOUT: %T.ref.loc21_30: %Class = name_ref T, %T.loc21_6.1 [symbolic = %T.loc21_6.2 (constants.%T)] -// CHECK:STDOUT: %HoldsType.loc21_31.1: type = class_type @HoldsType, @HoldsType(constants.%T) [symbolic = %HoldsType.loc21_31.2 (constants.%HoldsType.f95cf2.1)] +// CHECK:STDOUT: %T.ref.loc21_30: %Class = name_ref T, %T.loc21_6.1 [symbolic = %T.loc21_6.2 (constants.%T.0de)] +// CHECK:STDOUT: %HoldsType.loc21_31.1: type = class_type @HoldsType, @HoldsType(constants.%T.0de) [symbolic = %HoldsType.loc21_31.2 (constants.%HoldsType.f95cf2.1)] // CHECK:STDOUT: } // CHECK:STDOUT: %x: @F.%HoldsType.loc21_31.2 (%HoldsType.f95cf2.1) = bind_name x, %x.param // CHECK:STDOUT: %a.param: = value_param call_param1 // CHECK:STDOUT: %.1: = splice_block [concrete = ] { -// CHECK:STDOUT: %T.ref.loc21_37: %Class = name_ref T, %T.loc21_6.1 [symbolic = %T.loc21_6.2 (constants.%T)] +// CHECK:STDOUT: %T.ref.loc21_37: %Class = name_ref T, %T.loc21_6.1 [symbolic = %T.loc21_6.2 (constants.%T.0de)] // CHECK:STDOUT: %t.ref: %Class.elem = name_ref t, @Class.%.loc5 [concrete = @Class.%.loc5] // CHECK:STDOUT: %.loc21_38.1: ref type = class_element_access %T.ref.loc21_37, element0 [symbolic = %.loc21_38.3 (constants.%.2fe)] // CHECK:STDOUT: %.loc21_38.2: type = bind_value %.loc21_38.1 @@ -561,7 +648,7 @@ fn G() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic class @HoldsType(%T.loc8_17.1: %Class) { -// CHECK:STDOUT: %T.loc8_17.2: %Class = bind_symbolic_name T, 0 [symbolic = %T.loc8_17.2 (constants.%T)] +// CHECK:STDOUT: %T.loc8_17.2: %Class = bind_symbolic_name T, 0 [symbolic = %T.loc8_17.2 (constants.%T.0de)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -585,9 +672,9 @@ fn G() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @F(%T.loc21_6.1: %Class) { -// CHECK:STDOUT: %T.loc21_6.2: %Class = bind_symbolic_name T, 0 [symbolic = %T.loc21_6.2 (constants.%T)] +// CHECK:STDOUT: %T.loc21_6.2: %Class = bind_symbolic_name T, 0 [symbolic = %T.loc21_6.2 (constants.%T.0de)] // CHECK:STDOUT: %HoldsType.loc21_31.2: type = class_type @HoldsType, @HoldsType(%T.loc21_6.2) [symbolic = %HoldsType.loc21_31.2 (constants.%HoldsType.f95cf2.1)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %HoldsType.loc21_31.2 [symbolic = %pattern_type (constants.%pattern_type.937)] +// CHECK:STDOUT: %pattern_type: type = pattern_type %HoldsType.loc21_31.2 [symbolic = %pattern_type (constants.%pattern_type.93719d.1)] // CHECK:STDOUT: %.loc21_38.3: ref type = class_element_access %T.loc21_6.2, element0 [symbolic = %.loc21_38.3 (constants.%.2fe)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: @@ -626,19 +713,31 @@ fn G() { // CHECK:STDOUT: %.loc27_6.4: ref %HoldsType.f95cf2.2 = temporary %.loc27_6.2, %.loc27_6.3 // CHECK:STDOUT: %.loc27_8: ref %HoldsType.f95cf2.2 = converted %.loc27_6.1, %.loc27_6.4 // CHECK:STDOUT: %.loc27_26: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %impl.elem0.loc27: %.da6 = impl_witness_access constants.%Destroy.lookup_impl_witness, element0 [symbolic = constants.%impl.elem0] +// CHECK:STDOUT: %bound_method.loc27_6.1: = bound_method %.loc27_6.2, %impl.elem0.loc27 +// CHECK:STDOUT: %specific_impl_fn: = specific_impl_function %impl.elem0.loc27, @Op.1(constants.%Destroy.facet.088) [symbolic = constants.%specific_impl_fn] +// CHECK:STDOUT: %bound_method.loc27_6.2: = bound_method %.loc27_6.2, %specific_impl_fn +// CHECK:STDOUT: %.loc27_6.5: %HoldsType.f95cf2.2 = bind_value %.loc27_6.2 +// CHECK:STDOUT: %.loc27_6.6: init %empty_tuple.type = call %bound_method.loc27_6.2(%.loc27_6.5) +// CHECK:STDOUT: %impl.elem0.loc26: %.b9f = impl_witness_access constants.%Destroy.impl_witness.fef, element0 [concrete = constants.%Op.d64] +// CHECK:STDOUT: %bound_method.loc26_26.1: = bound_method %.loc26_26.2, %impl.elem0.loc26 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0.loc26, @Op.2(constants.%Class) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc26_26.2: = bound_method %.loc26_26.2, %specific_fn +// CHECK:STDOUT: %.loc26_26.7: %Class = bind_value %.loc26_26.2 +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc26_26.2(%.loc26_26.7) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @HoldsType(constants.%T) { -// CHECK:STDOUT: %T.loc8_17.2 => constants.%T +// CHECK:STDOUT: specific @HoldsType(constants.%T.0de) { +// CHECK:STDOUT: %T.loc8_17.2 => constants.%T.0de // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F(constants.%T) { -// CHECK:STDOUT: %T.loc21_6.2 => constants.%T +// CHECK:STDOUT: specific @F(constants.%T.0de) { +// CHECK:STDOUT: %T.loc21_6.2 => constants.%T.0de // CHECK:STDOUT: %HoldsType.loc21_31.2 => constants.%HoldsType.f95cf2.1 -// CHECK:STDOUT: %pattern_type => constants.%pattern_type.937 +// CHECK:STDOUT: %pattern_type => constants.%pattern_type.93719d.1 // CHECK:STDOUT: %.loc21_38.3 => constants.%.2fe // CHECK:STDOUT: } // CHECK:STDOUT: @@ -653,11 +752,12 @@ fn G() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete] // CHECK:STDOUT: %array_type: type = array_type %int_1, type [concrete] -// CHECK:STDOUT: %T: %array_type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %T.eb6: %array_type = bind_symbolic_name T, 0 [symbolic] // CHECK:STDOUT: %pattern_type.dcb: type = pattern_type %array_type [concrete] // CHECK:STDOUT: %HoldsType.type: type = generic_class_type @HoldsType [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %HoldsType.generic: %HoldsType.type = struct_value () [concrete] -// CHECK:STDOUT: %HoldsType: type = class_type @HoldsType, @HoldsType(%T) [symbolic] +// CHECK:STDOUT: %HoldsType: type = class_type @HoldsType, @HoldsType(%T.eb6) [symbolic] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %complete_type.357: = complete_type_witness %empty_struct_type [concrete] // CHECK:STDOUT: %pattern_type.142: type = pattern_type %HoldsType [symbolic] @@ -690,12 +790,24 @@ fn G() { // CHECK:STDOUT: %G: %G.type = struct_value () [concrete] // CHECK:STDOUT: %tuple.type: type = tuple_type (type) [concrete] // CHECK:STDOUT: %array: %array_type = tuple_value (%C) [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.2 [concrete] +// CHECK:STDOUT: %T.8b3: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.3, @impl.49c(%T.8b3) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.a38: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%array_type) [concrete] +// CHECK:STDOUT: %Op.type.8a7: type = fn_type @Op.3, @impl.49c(%array_type) [concrete] +// CHECK:STDOUT: %Op.246: %Op.type.8a7 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %array_type, (%Destroy.impl_witness.a38) [concrete] +// CHECK:STDOUT: %.f95: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.246, @Op.3(%array_type) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Int = %Core.Int // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -703,6 +815,9 @@ fn G() { // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -721,7 +836,7 @@ fn G() { // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] // CHECK:STDOUT: %array_type: type = array_type %int_1, type [concrete = constants.%array_type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc4_17.1: %array_type = bind_symbolic_name T, 0 [symbolic = %T.loc4_17.2 (constants.%T)] +// CHECK:STDOUT: %T.loc4_17.1: %array_type = bind_symbolic_name T, 0 [symbolic = %T.loc4_17.2 (constants.%T.eb6)] // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] { // CHECK:STDOUT: %T.patt: %pattern_type.dcb = symbolic_binding_pattern T, 0 [concrete] @@ -734,17 +849,17 @@ fn G() { // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] // CHECK:STDOUT: %array_type: type = array_type %int_1, type [concrete = constants.%array_type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc12_6.1: %array_type = bind_symbolic_name T, 0 [symbolic = %T.loc12_6.2 (constants.%T)] +// CHECK:STDOUT: %T.loc12_6.1: %array_type = bind_symbolic_name T, 0 [symbolic = %T.loc12_6.2 (constants.%T.eb6)] // CHECK:STDOUT: %x.param: @F.%HoldsType.loc12_40.2 (%HoldsType) = value_param call_param0 // CHECK:STDOUT: %.loc12_40: type = splice_block %HoldsType.loc12_40.1 [symbolic = %HoldsType.loc12_40.2 (constants.%HoldsType)] { // CHECK:STDOUT: %HoldsType.ref: %HoldsType.type = name_ref HoldsType, file.%HoldsType.decl [concrete = constants.%HoldsType.generic] -// CHECK:STDOUT: %T.ref.loc12_39: %array_type = name_ref T, %T.loc12_6.1 [symbolic = %T.loc12_6.2 (constants.%T)] -// CHECK:STDOUT: %HoldsType.loc12_40.1: type = class_type @HoldsType, @HoldsType(constants.%T) [symbolic = %HoldsType.loc12_40.2 (constants.%HoldsType)] +// CHECK:STDOUT: %T.ref.loc12_39: %array_type = name_ref T, %T.loc12_6.1 [symbolic = %T.loc12_6.2 (constants.%T.eb6)] +// CHECK:STDOUT: %HoldsType.loc12_40.1: type = class_type @HoldsType, @HoldsType(constants.%T.eb6) [symbolic = %HoldsType.loc12_40.2 (constants.%HoldsType)] // CHECK:STDOUT: } // CHECK:STDOUT: %x: @F.%HoldsType.loc12_40.2 (%HoldsType) = bind_name x, %x.param // CHECK:STDOUT: %a.param: = value_param call_param1 // CHECK:STDOUT: %.1: = splice_block [concrete = ] { -// CHECK:STDOUT: %T.ref.loc12_46: %array_type = name_ref T, %T.loc12_6.1 [symbolic = %T.loc12_6.2 (constants.%T)] +// CHECK:STDOUT: %T.ref.loc12_46: %array_type = name_ref T, %T.loc12_6.1 [symbolic = %T.loc12_6.2 (constants.%T.eb6)] // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] @@ -766,7 +881,7 @@ fn G() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic class @HoldsType(%T.loc4_17.1: %array_type) { -// CHECK:STDOUT: %T.loc4_17.2: %array_type = bind_symbolic_name T, 0 [symbolic = %T.loc4_17.2 (constants.%T)] +// CHECK:STDOUT: %T.loc4_17.2: %array_type = bind_symbolic_name T, 0 [symbolic = %T.loc4_17.2 (constants.%T.eb6)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -790,7 +905,7 @@ fn G() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @F(%T.loc12_6.1: %array_type) { -// CHECK:STDOUT: %T.loc12_6.2: %array_type = bind_symbolic_name T, 0 [symbolic = %T.loc12_6.2 (constants.%T)] +// CHECK:STDOUT: %T.loc12_6.2: %array_type = bind_symbolic_name T, 0 [symbolic = %T.loc12_6.2 (constants.%T.eb6)] // CHECK:STDOUT: %HoldsType.loc12_40.2: type = class_type @HoldsType, @HoldsType(%T.loc12_6.2) [symbolic = %HoldsType.loc12_40.2 (constants.%HoldsType)] // CHECK:STDOUT: %pattern_type: type = pattern_type %HoldsType.loc12_40.2 [symbolic = %pattern_type (constants.%pattern_type.142)] // CHECK:STDOUT: @@ -821,17 +936,23 @@ fn G() { // CHECK:STDOUT: %.loc24_27.2: ref %array_type = temporary %.loc24_25.2, %.loc24_27.1 // CHECK:STDOUT: %.loc24_27.3: %array_type = bind_value %.loc24_27.2 // CHECK:STDOUT: %.loc24_48: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %impl.elem0: %.f95 = impl_witness_access constants.%Destroy.impl_witness.a38, element0 [concrete = constants.%Op.246] +// CHECK:STDOUT: %bound_method.loc24_25.1: = bound_method %.loc24_25.2, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.3(constants.%array_type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc24_25.2: = bound_method %.loc24_25.2, %specific_fn +// CHECK:STDOUT: %.loc24_25.6: %array_type = bind_value %.loc24_25.2 +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc24_25.2(%.loc24_25.6) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @HoldsType(constants.%T) { -// CHECK:STDOUT: %T.loc4_17.2 => constants.%T +// CHECK:STDOUT: specific @HoldsType(constants.%T.eb6) { +// CHECK:STDOUT: %T.loc4_17.2 => constants.%T.eb6 // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F(constants.%T) { -// CHECK:STDOUT: %T.loc12_6.2 => constants.%T +// CHECK:STDOUT: specific @F(constants.%T.eb6) { +// CHECK:STDOUT: %T.loc12_6.2 => constants.%T.eb6 // CHECK:STDOUT: %HoldsType.loc12_40.2 => constants.%HoldsType // CHECK:STDOUT: %pattern_type => constants.%pattern_type.142 // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/eval/aggregates.carbon b/toolchain/check/testdata/eval/aggregates.carbon index 79b09d04184c..1d7e847cdee8 100644 --- a/toolchain/check/testdata/eval/aggregates.carbon +++ b/toolchain/check/testdata/eval/aggregates.carbon @@ -453,6 +453,7 @@ fn G(N:! i32) { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %ptr.79f: type = ptr_type %T [symbolic] // CHECK:STDOUT: %const: type = const_type %T [symbolic] // CHECK:STDOUT: %tuple.type.24b: type = tuple_type (type, type) [concrete] @@ -466,6 +467,26 @@ fn G(N:! i32) { // CHECK:STDOUT: %array_type.ec2: type = array_type %int_5, %T [symbolic] // CHECK:STDOUT: %require_complete.fe1: = require_complete_type %array_type.ec2 [symbolic] // CHECK:STDOUT: %pattern_type.035: type = pattern_type %array_type.ec2 [symbolic] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %require_complete.4ae: = require_complete_type %T [symbolic] +// CHECK:STDOUT: %Destroy.lookup_impl_witness.b45: = lookup_impl_witness %array_type.ec2, @Destroy [symbolic] +// CHECK:STDOUT: %Destroy.facet.0d3: %Destroy.type = facet_value %array_type.ec2, (%Destroy.lookup_impl_witness.b45) [symbolic] +// CHECK:STDOUT: %.03f: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.0d3 [symbolic] +// CHECK:STDOUT: %impl.elem0.1ce: %.03f = impl_witness_access %Destroy.lookup_impl_witness.b45, element0 [symbolic] +// CHECK:STDOUT: %specific_impl_fn.236: = specific_impl_function %impl.elem0.1ce, @Op.1(%Destroy.facet.0d3) [symbolic] +// CHECK:STDOUT: %Destroy.lookup_impl_witness.b34: = lookup_impl_witness %struct_type.a, @Destroy [symbolic] +// CHECK:STDOUT: %Destroy.facet.2c9: %Destroy.type = facet_value %struct_type.a, (%Destroy.lookup_impl_witness.b34) [symbolic] +// CHECK:STDOUT: %.b85: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.2c9 [symbolic] +// CHECK:STDOUT: %impl.elem0.dc9: %.b85 = impl_witness_access %Destroy.lookup_impl_witness.b34, element0 [symbolic] +// CHECK:STDOUT: %specific_impl_fn.2a6: = specific_impl_function %impl.elem0.dc9, @Op.1(%Destroy.facet.2c9) [symbolic] +// CHECK:STDOUT: %Destroy.lookup_impl_witness.a8a: = lookup_impl_witness %tuple.type.4f2, @Destroy [symbolic] +// CHECK:STDOUT: %Destroy.facet.7be: %Destroy.type = facet_value %tuple.type.4f2, (%Destroy.lookup_impl_witness.a8a) [symbolic] +// CHECK:STDOUT: %.f5c: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.7be [symbolic] +// CHECK:STDOUT: %impl.elem0.87c: %.f5c = impl_witness_access %Destroy.lookup_impl_witness.a8a, element0 [symbolic] +// CHECK:STDOUT: %specific_impl_fn.4b8: = specific_impl_function %impl.elem0.87c, @Op.1(%Destroy.facet.7be) [symbolic] +// CHECK:STDOUT: %require_complete.6e5: = require_complete_type %ptr.79f [symbolic] +// CHECK:STDOUT: %require_complete.7cc: = require_complete_type %const [symbolic] // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] // CHECK:STDOUT: %N.51e: %i32 = bind_symbolic_name N, 0 [symbolic] @@ -486,6 +507,11 @@ fn G(N:! i32) { // CHECK:STDOUT: %array_type.c7c: type = array_type %int.convert_checked, %i32 [symbolic] // CHECK:STDOUT: %require_complete.7cb: = require_complete_type %array_type.c7c [symbolic] // CHECK:STDOUT: %pattern_type.ccc: type = pattern_type %array_type.c7c [symbolic] +// CHECK:STDOUT: %Destroy.lookup_impl_witness.4fa: = lookup_impl_witness %array_type.c7c, @Destroy [symbolic] +// CHECK:STDOUT: %Destroy.facet.ad4: %Destroy.type = facet_value %array_type.c7c, (%Destroy.lookup_impl_witness.4fa) [symbolic] +// CHECK:STDOUT: %.a57: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.ad4 [symbolic] +// CHECK:STDOUT: %impl.elem0.f15: %.a57 = impl_witness_access %Destroy.lookup_impl_witness.4fa, element0 [symbolic] +// CHECK:STDOUT: %specific_impl_fn.bae: = specific_impl_function %impl.elem0.f15, @Op.1(%Destroy.facet.ad4) [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -500,14 +526,32 @@ fn G(N:! i32) { // CHECK:STDOUT: %ptr.loc6_12.2: type = ptr_type %T.loc4_6.2 [symbolic = %ptr.loc6_12.2 (constants.%ptr.79f)] // CHECK:STDOUT: %const.loc6_15.2: type = const_type %T.loc4_6.2 [symbolic = %const.loc6_15.2 (constants.%const)] // CHECK:STDOUT: %tuple.type: type = tuple_type (%ptr.loc6_12.2, %const.loc6_15.2) [symbolic = %tuple.type (constants.%tuple.type.4f2)] -// CHECK:STDOUT: %require_complete.loc6: = require_complete_type %tuple.type [symbolic = %require_complete.loc6 (constants.%require_complete.155)] +// CHECK:STDOUT: %require_complete.loc6_22: = require_complete_type %tuple.type [symbolic = %require_complete.loc6_22 (constants.%require_complete.155)] // CHECK:STDOUT: %pattern_type.loc6: type = pattern_type %tuple.type [symbolic = %pattern_type.loc6 (constants.%pattern_type.973)] // CHECK:STDOUT: %struct_type.a.loc7_16.2: type = struct_type {.a: @F.%T.loc4_6.2 (%T)} [symbolic = %struct_type.a.loc7_16.2 (constants.%struct_type.a)] -// CHECK:STDOUT: %require_complete.loc7: = require_complete_type %struct_type.a.loc7_16.2 [symbolic = %require_complete.loc7 (constants.%require_complete.28a)] +// CHECK:STDOUT: %require_complete.loc7_16: = require_complete_type %struct_type.a.loc7_16.2 [symbolic = %require_complete.loc7_16 (constants.%require_complete.28a)] // CHECK:STDOUT: %pattern_type.loc7: type = pattern_type %struct_type.a.loc7_16.2 [symbolic = %pattern_type.loc7 (constants.%pattern_type.95a)] // CHECK:STDOUT: %array_type.loc8_20.2: type = array_type constants.%int_5, %T.loc4_6.2 [symbolic = %array_type.loc8_20.2 (constants.%array_type.ec2)] // CHECK:STDOUT: %require_complete.loc8: = require_complete_type %array_type.loc8_20.2 [symbolic = %require_complete.loc8 (constants.%require_complete.fe1)] // CHECK:STDOUT: %pattern_type.loc8: type = pattern_type %array_type.loc8_20.2 [symbolic = %pattern_type.loc8 (constants.%pattern_type.035)] +// CHECK:STDOUT: %Destroy.lookup_impl_witness.loc8: = lookup_impl_witness %array_type.loc8_20.2, @Destroy [symbolic = %Destroy.lookup_impl_witness.loc8 (constants.%Destroy.lookup_impl_witness.b45)] +// CHECK:STDOUT: %Destroy.facet.loc8: %Destroy.type = facet_value %array_type.loc8_20.2, (%Destroy.lookup_impl_witness.loc8) [symbolic = %Destroy.facet.loc8 (constants.%Destroy.facet.0d3)] +// CHECK:STDOUT: %.loc8_3.3: type = fn_type_with_self_type constants.%Op.type.bae, %Destroy.facet.loc8 [symbolic = %.loc8_3.3 (constants.%.03f)] +// CHECK:STDOUT: %impl.elem0.loc8_3.2: @F.%.loc8_3.3 (%.03f) = impl_witness_access %Destroy.lookup_impl_witness.loc8, element0 [symbolic = %impl.elem0.loc8_3.2 (constants.%impl.elem0.1ce)] +// CHECK:STDOUT: %specific_impl_fn.loc8_3.2: = specific_impl_function %impl.elem0.loc8_3.2, @Op.1(%Destroy.facet.loc8) [symbolic = %specific_impl_fn.loc8_3.2 (constants.%specific_impl_fn.236)] +// CHECK:STDOUT: %Destroy.lookup_impl_witness.loc7: = lookup_impl_witness %struct_type.a.loc7_16.2, @Destroy [symbolic = %Destroy.lookup_impl_witness.loc7 (constants.%Destroy.lookup_impl_witness.b34)] +// CHECK:STDOUT: %Destroy.facet.loc7: %Destroy.type = facet_value %struct_type.a.loc7_16.2, (%Destroy.lookup_impl_witness.loc7) [symbolic = %Destroy.facet.loc7 (constants.%Destroy.facet.2c9)] +// CHECK:STDOUT: %.loc7_3.5: type = fn_type_with_self_type constants.%Op.type.bae, %Destroy.facet.loc7 [symbolic = %.loc7_3.5 (constants.%.b85)] +// CHECK:STDOUT: %impl.elem0.loc7_3.2: @F.%.loc7_3.5 (%.b85) = impl_witness_access %Destroy.lookup_impl_witness.loc7, element0 [symbolic = %impl.elem0.loc7_3.2 (constants.%impl.elem0.dc9)] +// CHECK:STDOUT: %specific_impl_fn.loc7_3.2: = specific_impl_function %impl.elem0.loc7_3.2, @Op.1(%Destroy.facet.loc7) [symbolic = %specific_impl_fn.loc7_3.2 (constants.%specific_impl_fn.2a6)] +// CHECK:STDOUT: %require_complete.loc7_3: = require_complete_type %T.loc4_6.2 [symbolic = %require_complete.loc7_3 (constants.%require_complete.4ae)] +// CHECK:STDOUT: %Destroy.lookup_impl_witness.loc6: = lookup_impl_witness %tuple.type, @Destroy [symbolic = %Destroy.lookup_impl_witness.loc6 (constants.%Destroy.lookup_impl_witness.a8a)] +// CHECK:STDOUT: %Destroy.facet.loc6: %Destroy.type = facet_value %tuple.type, (%Destroy.lookup_impl_witness.loc6) [symbolic = %Destroy.facet.loc6 (constants.%Destroy.facet.7be)] +// CHECK:STDOUT: %.loc6_3.5: type = fn_type_with_self_type constants.%Op.type.bae, %Destroy.facet.loc6 [symbolic = %.loc6_3.5 (constants.%.f5c)] +// CHECK:STDOUT: %impl.elem0.loc6_3.2: @F.%.loc6_3.5 (%.f5c) = impl_witness_access %Destroy.lookup_impl_witness.loc6, element0 [symbolic = %impl.elem0.loc6_3.2 (constants.%impl.elem0.87c)] +// CHECK:STDOUT: %specific_impl_fn.loc6_3.2: = specific_impl_function %impl.elem0.loc6_3.2, @Op.1(%Destroy.facet.loc6) [symbolic = %specific_impl_fn.loc6_3.2 (constants.%specific_impl_fn.4b8)] +// CHECK:STDOUT: %require_complete.loc6_3.1: = require_complete_type %ptr.loc6_12.2 [symbolic = %require_complete.loc6_3.1 (constants.%require_complete.6e5)] +// CHECK:STDOUT: %require_complete.loc6_3.2: = require_complete_type %const.loc6_15.2 [symbolic = %require_complete.loc6_3.2 (constants.%require_complete.7cc)] // CHECK:STDOUT: // CHECK:STDOUT: fn() { // CHECK:STDOUT: !entry: @@ -530,7 +574,7 @@ fn G(N:! i32) { // CHECK:STDOUT: %v.var_patt: @F.%pattern_type.loc7 (%pattern_type.95a) = var_pattern %v.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %v.var: ref @F.%struct_type.a.loc7_16.2 (%struct_type.a) = var %v.var_patt -// CHECK:STDOUT: %.loc7: type = splice_block %struct_type.a.loc7_16.1 [symbolic = %struct_type.a.loc7_16.2 (constants.%struct_type.a)] { +// CHECK:STDOUT: %.loc7_16: type = splice_block %struct_type.a.loc7_16.1 [symbolic = %struct_type.a.loc7_16.2 (constants.%struct_type.a)] { // CHECK:STDOUT: %T.ref.loc7: type = name_ref T, %T.loc4_6.1 [symbolic = %T.loc4_6.2 (constants.%T)] // CHECK:STDOUT: %struct_type.a.loc7_16.1: type = struct_type {.a: @F.%T.loc4_6.2 (%T)} [symbolic = %struct_type.a.loc7_16.2 (constants.%struct_type.a)] // CHECK:STDOUT: } @@ -540,12 +584,38 @@ fn G(N:! i32) { // CHECK:STDOUT: %w.var_patt: @F.%pattern_type.loc8 (%pattern_type.035) = var_pattern %w.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %w.var: ref @F.%array_type.loc8_20.2 (%array_type.ec2) = var %w.var_patt -// CHECK:STDOUT: %.loc8: type = splice_block %array_type.loc8_20.1 [symbolic = %array_type.loc8_20.2 (constants.%array_type.ec2)] { +// CHECK:STDOUT: %.loc8_20: type = splice_block %array_type.loc8_20.1 [symbolic = %array_type.loc8_20.2 (constants.%array_type.ec2)] { // CHECK:STDOUT: %T.ref.loc8: type = name_ref T, %T.loc4_6.1 [symbolic = %T.loc4_6.2 (constants.%T)] // CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [concrete = constants.%int_5] // CHECK:STDOUT: %array_type.loc8_20.1: type = array_type %int_5, %T.ref.loc8 [symbolic = %array_type.loc8_20.2 (constants.%array_type.ec2)] // CHECK:STDOUT: } // CHECK:STDOUT: %w: ref @F.%array_type.loc8_20.2 (%array_type.ec2) = bind_name w, %w.var +// CHECK:STDOUT: %impl.elem0.loc8_3.1: @F.%.loc8_3.3 (%.03f) = impl_witness_access constants.%Destroy.lookup_impl_witness.b45, element0 [symbolic = %impl.elem0.loc8_3.2 (constants.%impl.elem0.1ce)] +// CHECK:STDOUT: %bound_method.loc8_3.1: = bound_method %w.var, %impl.elem0.loc8_3.1 +// CHECK:STDOUT: %specific_impl_fn.loc8_3.1: = specific_impl_function %impl.elem0.loc8_3.1, @Op.1(constants.%Destroy.facet.0d3) [symbolic = %specific_impl_fn.loc8_3.2 (constants.%specific_impl_fn.236)] +// CHECK:STDOUT: %bound_method.loc8_3.2: = bound_method %w.var, %specific_impl_fn.loc8_3.1 +// CHECK:STDOUT: %.loc8_3.1: @F.%array_type.loc8_20.2 (%array_type.ec2) = bind_value %w.var +// CHECK:STDOUT: %.loc8_3.2: init %empty_tuple.type = call %bound_method.loc8_3.2(%.loc8_3.1) +// CHECK:STDOUT: %impl.elem0.loc7_3.1: @F.%.loc7_3.5 (%.b85) = impl_witness_access constants.%Destroy.lookup_impl_witness.b34, element0 [symbolic = %impl.elem0.loc7_3.2 (constants.%impl.elem0.dc9)] +// CHECK:STDOUT: %bound_method.loc7_3.1: = bound_method %v.var, %impl.elem0.loc7_3.1 +// CHECK:STDOUT: %specific_impl_fn.loc7_3.1: = specific_impl_function %impl.elem0.loc7_3.1, @Op.1(constants.%Destroy.facet.2c9) [symbolic = %specific_impl_fn.loc7_3.2 (constants.%specific_impl_fn.2a6)] +// CHECK:STDOUT: %bound_method.loc7_3.2: = bound_method %v.var, %specific_impl_fn.loc7_3.1 +// CHECK:STDOUT: %.loc7_3.1: ref @F.%T.loc4_6.2 (%T) = struct_access %v.var, element0 +// CHECK:STDOUT: %.loc7_3.2: @F.%T.loc4_6.2 (%T) = bind_value %.loc7_3.1 +// CHECK:STDOUT: %struct: @F.%struct_type.a.loc7_16.2 (%struct_type.a) = struct_value (%.loc7_3.2) +// CHECK:STDOUT: %.loc7_3.3: @F.%struct_type.a.loc7_16.2 (%struct_type.a) = converted %v.var, %struct +// CHECK:STDOUT: %.loc7_3.4: init %empty_tuple.type = call %bound_method.loc7_3.2(%.loc7_3.3) +// CHECK:STDOUT: %impl.elem0.loc6_3.1: @F.%.loc6_3.5 (%.f5c) = impl_witness_access constants.%Destroy.lookup_impl_witness.a8a, element0 [symbolic = %impl.elem0.loc6_3.2 (constants.%impl.elem0.87c)] +// CHECK:STDOUT: %bound_method.loc6_3.1: = bound_method %u.var, %impl.elem0.loc6_3.1 +// CHECK:STDOUT: %specific_impl_fn.loc6_3.1: = specific_impl_function %impl.elem0.loc6_3.1, @Op.1(constants.%Destroy.facet.7be) [symbolic = %specific_impl_fn.loc6_3.2 (constants.%specific_impl_fn.4b8)] +// CHECK:STDOUT: %bound_method.loc6_3.2: = bound_method %u.var, %specific_impl_fn.loc6_3.1 +// CHECK:STDOUT: %tuple.elem0: ref @F.%ptr.loc6_12.2 (%ptr.79f) = tuple_access %u.var, element0 +// CHECK:STDOUT: %.loc6_3.1: @F.%ptr.loc6_12.2 (%ptr.79f) = bind_value %tuple.elem0 +// CHECK:STDOUT: %tuple.elem1: ref @F.%const.loc6_15.2 (%const) = tuple_access %u.var, element1 +// CHECK:STDOUT: %.loc6_3.2: @F.%const.loc6_15.2 (%const) = bind_value %tuple.elem1 +// CHECK:STDOUT: %tuple: @F.%tuple.type (%tuple.type.4f2) = tuple_value (%.loc6_3.1, %.loc6_3.2) +// CHECK:STDOUT: %.loc6_3.3: @F.%tuple.type (%tuple.type.4f2) = converted %u.var, %tuple +// CHECK:STDOUT: %.loc6_3.4: init %empty_tuple.type = call %bound_method.loc6_3.2(%.loc6_3.3) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -560,6 +630,11 @@ fn G(N:! i32) { // CHECK:STDOUT: %array_type.loc14_22.2: type = array_type %int.convert_checked.loc14_21.2, constants.%i32 [symbolic = %array_type.loc14_22.2 (constants.%array_type.c7c)] // CHECK:STDOUT: %require_complete: = require_complete_type %array_type.loc14_22.2 [symbolic = %require_complete (constants.%require_complete.7cb)] // CHECK:STDOUT: %pattern_type: type = pattern_type %array_type.loc14_22.2 [symbolic = %pattern_type (constants.%pattern_type.ccc)] +// CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %array_type.loc14_22.2, @Destroy [symbolic = %Destroy.lookup_impl_witness (constants.%Destroy.lookup_impl_witness.4fa)] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %array_type.loc14_22.2, (%Destroy.lookup_impl_witness) [symbolic = %Destroy.facet (constants.%Destroy.facet.ad4)] +// CHECK:STDOUT: %.loc14_3.3: type = fn_type_with_self_type constants.%Op.type.bae, %Destroy.facet [symbolic = %.loc14_3.3 (constants.%.a57)] +// CHECK:STDOUT: %impl.elem0.loc14_3.2: @G.%.loc14_3.3 (%.a57) = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc14_3.2 (constants.%impl.elem0.f15)] +// CHECK:STDOUT: %specific_impl_fn.loc14_3.2: = specific_impl_function %impl.elem0.loc14_3.2, @Op.1(%Destroy.facet) [symbolic = %specific_impl_fn.loc14_3.2 (constants.%specific_impl_fn.bae)] // CHECK:STDOUT: // CHECK:STDOUT: fn() { // CHECK:STDOUT: !entry: @@ -572,9 +647,9 @@ fn G(N:! i32) { // CHECK:STDOUT: %int_32.loc14: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32.loc14: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: %N.ref: %i32 = name_ref N, %N.loc12_6.1 [symbolic = %N.loc12_6.2 (constants.%N.51e)] -// CHECK:STDOUT: %impl.elem0: %.0ea = impl_witness_access constants.%ImplicitAs.impl_witness.a11, element0 [concrete = constants.%Convert.960] -// CHECK:STDOUT: %bound_method.loc14_21.1: = bound_method %N.ref, %impl.elem0 [symbolic = %Convert.bound (constants.%Convert.bound)] -// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Convert.3(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %impl.elem0.loc14_21: %.0ea = impl_witness_access constants.%ImplicitAs.impl_witness.a11, element0 [concrete = constants.%Convert.960] +// CHECK:STDOUT: %bound_method.loc14_21.1: = bound_method %N.ref, %impl.elem0.loc14_21 [symbolic = %Convert.bound (constants.%Convert.bound)] +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0.loc14_21, @Convert.3(constants.%int_32) [concrete = constants.%Convert.specific_fn] // CHECK:STDOUT: %bound_method.loc14_21.2: = bound_method %N.ref, %specific_fn [symbolic = %bound_method.loc14_21.3 (constants.%bound_method)] // CHECK:STDOUT: %int.convert_checked.loc14_21.1: init Core.IntLiteral = call %bound_method.loc14_21.2(%N.ref) [symbolic = %int.convert_checked.loc14_21.2 (constants.%int.convert_checked)] // CHECK:STDOUT: %.loc14_21.1: Core.IntLiteral = value_of_initializer %int.convert_checked.loc14_21.1 [symbolic = %int.convert_checked.loc14_21.2 (constants.%int.convert_checked)] @@ -582,6 +657,12 @@ fn G(N:! i32) { // CHECK:STDOUT: %array_type.loc14_22.1: type = array_type %.loc14_21.2, %i32.loc14 [symbolic = %array_type.loc14_22.2 (constants.%array_type.c7c)] // CHECK:STDOUT: } // CHECK:STDOUT: %k: ref @G.%array_type.loc14_22.2 (%array_type.c7c) = bind_name k, %k.var +// CHECK:STDOUT: %impl.elem0.loc14_3.1: @G.%.loc14_3.3 (%.a57) = impl_witness_access constants.%Destroy.lookup_impl_witness.4fa, element0 [symbolic = %impl.elem0.loc14_3.2 (constants.%impl.elem0.f15)] +// CHECK:STDOUT: %bound_method.loc14_3.1: = bound_method %k.var, %impl.elem0.loc14_3.1 +// CHECK:STDOUT: %specific_impl_fn.loc14_3.1: = specific_impl_function %impl.elem0.loc14_3.1, @Op.1(constants.%Destroy.facet.ad4) [symbolic = %specific_impl_fn.loc14_3.2 (constants.%specific_impl_fn.bae)] +// CHECK:STDOUT: %bound_method.loc14_3.2: = bound_method %k.var, %specific_impl_fn.loc14_3.1 +// CHECK:STDOUT: %.loc14_3.1: @G.%array_type.loc14_22.2 (%array_type.c7c) = bind_value %k.var +// CHECK:STDOUT: %.loc14_3.2: init %empty_tuple.type = call %bound_method.loc14_3.2(%.loc14_3.1) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/facet/call_combined_impl_witness.carbon b/toolchain/check/testdata/facet/call_combined_impl_witness.carbon index 5a786e3603c1..8ca010174d24 100644 --- a/toolchain/check/testdata/facet/call_combined_impl_witness.carbon +++ b/toolchain/check/testdata/facet/call_combined_impl_witness.carbon @@ -88,19 +88,19 @@ fn F() { // CHECK:STDOUT: %facet_type.d5f: type = facet_type <@Empty & @A> [concrete] // CHECK:STDOUT: %Op.bound.44b: = bound_method %facet_type.d5f, %Op.ff4 [concrete] // CHECK:STDOUT: %facet_type.242: type = facet_type <@Empty & @A & @B> [concrete] -// CHECK:STDOUT: %T: %facet_type.242 = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %T.2df: %facet_type.242 = bind_symbolic_name T, 0 [symbolic] // CHECK:STDOUT: %pattern_type.8e7: type = pattern_type %facet_type.242 [concrete] -// CHECK:STDOUT: %T.as_type: type = facet_access_type %T [symbolic] +// CHECK:STDOUT: %T.as_type: type = facet_access_type %T.2df [symbolic] // CHECK:STDOUT: %pattern_type.9a0: type = pattern_type %T.as_type [symbolic] // CHECK:STDOUT: %G.type: type = fn_type @G [concrete] // CHECK:STDOUT: %G: %G.type = struct_value () [concrete] -// CHECK:STDOUT: %require_complete: = require_complete_type %T.as_type [symbolic] -// CHECK:STDOUT: %A.lookup_impl_witness: = lookup_impl_witness %T, @A [symbolic] +// CHECK:STDOUT: %require_complete.383: = require_complete_type %T.as_type [symbolic] +// CHECK:STDOUT: %A.lookup_impl_witness: = lookup_impl_witness %T.2df, @A [symbolic] // CHECK:STDOUT: %A.facet.487: %A.type = facet_value %T.as_type, (%A.lookup_impl_witness) [symbolic] // CHECK:STDOUT: %.fde: type = fn_type_with_self_type %AA.type.b97, %A.facet.487 [symbolic] // CHECK:STDOUT: %impl.elem0.de2: %.fde = impl_witness_access %A.lookup_impl_witness, element0 [symbolic] // CHECK:STDOUT: %specific_impl_fn.086: = specific_impl_function %impl.elem0.de2, @AA.1(%A.facet.487) [symbolic] -// CHECK:STDOUT: %B.lookup_impl_witness: = lookup_impl_witness %T, @B [symbolic] +// CHECK:STDOUT: %B.lookup_impl_witness: = lookup_impl_witness %T.2df, @B [symbolic] // CHECK:STDOUT: %B.facet.8d1: %B.type = facet_value %T.as_type, (%B.lookup_impl_witness) [symbolic] // CHECK:STDOUT: %.368: type = fn_type_with_self_type %BB.type.64d, %B.facet.8d1 [symbolic] // CHECK:STDOUT: %impl.elem0.43b: %.368 = impl_witness_access %B.lookup_impl_witness, element0 [symbolic] @@ -111,6 +111,17 @@ fn F() { // CHECK:STDOUT: %facet_value: %facet_type.242 = facet_value %C, (%Empty.impl_witness, %A.impl_witness, %B.impl_witness) [concrete] // CHECK:STDOUT: %pattern_type.c48: type = pattern_type %C [concrete] // CHECK:STDOUT: %G.specific_fn: = specific_function %G, @G(%facet_value) [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.3 [concrete] +// CHECK:STDOUT: %T.8b3: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.4, @impl.49c(%T.8b3) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.906: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%C) [concrete] +// CHECK:STDOUT: %Op.type.153: type = fn_type @Op.4, @impl.49c(%C) [concrete] +// CHECK:STDOUT: %Op.5d7: %Op.type.153 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %C, (%Destroy.impl_witness.906) [concrete] +// CHECK:STDOUT: %.b80: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.5d7, @Op.4(%C) [concrete] // CHECK:STDOUT: %.7ab: type = fn_type_with_self_type %AA.type.b97, %A.facet.66c [concrete] // CHECK:STDOUT: %.b43: type = fn_type_with_self_type %BB.type.64d, %B.facet.82f [concrete] // CHECK:STDOUT: } @@ -118,12 +129,16 @@ fn F() { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .BitAndWith = %Core.BitAndWith +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Core.BitAndWith: %BitAndWith.type.f2e = import_ref Core//prelude, BitAndWith, loaded [concrete = constants.%BitAndWith.generic] // CHECK:STDOUT: %Core.import_ref.012: %Op.type.1cc = import_ref Core//prelude, loc13_42, loaded [concrete = constants.%Op.ff4] // CHECK:STDOUT: %BitAndWith.impl_witness_table = impl_witness_table (%Core.import_ref.012), @impl.865 [concrete] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -179,10 +194,10 @@ fn F() { // CHECK:STDOUT: %.loc33_20.2: type = value_of_initializer %type.and.loc33_20 [concrete = constants.%facet_type.242] // CHECK:STDOUT: %.loc33_20.3: type = converted %type.and.loc33_20, %.loc33_20.2 [concrete = constants.%facet_type.242] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc33_6.1: %facet_type.242 = bind_symbolic_name T, 0 [symbolic = %T.loc33_6.2 (constants.%T)] +// CHECK:STDOUT: %T.loc33_6.1: %facet_type.242 = bind_symbolic_name T, 0 [symbolic = %T.loc33_6.2 (constants.%T.2df)] // CHECK:STDOUT: %t.param: @G.%T.as_type.loc33_28.2 (%T.as_type) = value_param call_param0 // CHECK:STDOUT: %.loc33_28.1: type = splice_block %.loc33_28.2 [symbolic = %T.as_type.loc33_28.2 (constants.%T.as_type)] { -// CHECK:STDOUT: %T.ref.loc33: %facet_type.242 = name_ref T, %T.loc33_6.1 [symbolic = %T.loc33_6.2 (constants.%T)] +// CHECK:STDOUT: %T.ref.loc33: %facet_type.242 = name_ref T, %T.loc33_6.1 [symbolic = %T.loc33_6.2 (constants.%T.2df)] // CHECK:STDOUT: %T.as_type.loc33_28.1: type = facet_access_type %T.ref.loc33 [symbolic = %T.as_type.loc33_28.2 (constants.%T.as_type)] // CHECK:STDOUT: %.loc33_28.2: type = converted %T.ref.loc33, %T.as_type.loc33_28.1 [symbolic = %T.as_type.loc33_28.2 (constants.%T.as_type)] // CHECK:STDOUT: } @@ -274,12 +289,12 @@ fn F() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @G(%T.loc33_6.1: %facet_type.242) { -// CHECK:STDOUT: %T.loc33_6.2: %facet_type.242 = bind_symbolic_name T, 0 [symbolic = %T.loc33_6.2 (constants.%T)] +// CHECK:STDOUT: %T.loc33_6.2: %facet_type.242 = bind_symbolic_name T, 0 [symbolic = %T.loc33_6.2 (constants.%T.2df)] // CHECK:STDOUT: %T.as_type.loc33_28.2: type = facet_access_type %T.loc33_6.2 [symbolic = %T.as_type.loc33_28.2 (constants.%T.as_type)] // CHECK:STDOUT: %pattern_type: type = pattern_type %T.as_type.loc33_28.2 [symbolic = %pattern_type (constants.%pattern_type.9a0)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type %T.as_type.loc33_28.2 [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %require_complete: = require_complete_type %T.as_type.loc33_28.2 [symbolic = %require_complete (constants.%require_complete.383)] // CHECK:STDOUT: %A.lookup_impl_witness: = lookup_impl_witness %T.loc33_6.2, @A [symbolic = %A.lookup_impl_witness (constants.%A.lookup_impl_witness)] // CHECK:STDOUT: %A.facet.loc34: %A.type = facet_value %T.as_type.loc33_28.2, (%A.lookup_impl_witness) [symbolic = %A.facet.loc34 (constants.%A.facet.487)] // CHECK:STDOUT: %.loc34_4.2: type = fn_type_with_self_type constants.%AA.type.b97, %A.facet.loc34 [symbolic = %.loc34_4.2 (constants.%.fde)] @@ -295,45 +310,45 @@ fn F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %t.ref.loc34: @G.%T.as_type.loc33_28.2 (%T.as_type) = name_ref t, %t // CHECK:STDOUT: %AA.ref.loc34: %A.assoc_type = name_ref AA, @A.%assoc0 [concrete = constants.%assoc0.6e7] -// CHECK:STDOUT: %T.as_type.loc34: type = facet_access_type constants.%T [symbolic = %T.as_type.loc33_28.2 (constants.%T.as_type)] -// CHECK:STDOUT: %.loc34_4.1: type = converted constants.%T, %T.as_type.loc34 [symbolic = %T.as_type.loc33_28.2 (constants.%T.as_type)] +// CHECK:STDOUT: %T.as_type.loc34: type = facet_access_type constants.%T.2df [symbolic = %T.as_type.loc33_28.2 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc34_4.1: type = converted constants.%T.2df, %T.as_type.loc34 [symbolic = %T.as_type.loc33_28.2 (constants.%T.as_type)] // CHECK:STDOUT: %impl.elem0.loc34_4.1: @G.%.loc34_4.2 (%.fde) = impl_witness_access constants.%A.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc34_4.2 (constants.%impl.elem0.de2)] // CHECK:STDOUT: %specific_impl_fn.loc34_4.1: = specific_impl_function %impl.elem0.loc34_4.1, @AA.1(constants.%A.facet.487) [symbolic = %specific_impl_fn.loc34_4.2 (constants.%specific_impl_fn.086)] // CHECK:STDOUT: %.loc34_8: init %empty_tuple.type = call %specific_impl_fn.loc34_4.1() // CHECK:STDOUT: %t.ref.loc35: @G.%T.as_type.loc33_28.2 (%T.as_type) = name_ref t, %t // CHECK:STDOUT: %BB.ref.loc35: %B.assoc_type = name_ref BB, @B.%assoc0 [concrete = constants.%assoc0.a29] -// CHECK:STDOUT: %T.as_type.loc35: type = facet_access_type constants.%T [symbolic = %T.as_type.loc33_28.2 (constants.%T.as_type)] -// CHECK:STDOUT: %.loc35_4.1: type = converted constants.%T, %T.as_type.loc35 [symbolic = %T.as_type.loc33_28.2 (constants.%T.as_type)] +// CHECK:STDOUT: %T.as_type.loc35: type = facet_access_type constants.%T.2df [symbolic = %T.as_type.loc33_28.2 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc35_4.1: type = converted constants.%T.2df, %T.as_type.loc35 [symbolic = %T.as_type.loc33_28.2 (constants.%T.as_type)] // CHECK:STDOUT: %impl.elem0.loc35_4.1: @G.%.loc35_4.2 (%.368) = impl_witness_access constants.%B.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc35_4.2 (constants.%impl.elem0.43b)] // CHECK:STDOUT: %specific_impl_fn.loc35_4.1: = specific_impl_function %impl.elem0.loc35_4.1, @BB.1(constants.%B.facet.8d1) [symbolic = %specific_impl_fn.loc35_4.2 (constants.%specific_impl_fn.573)] // CHECK:STDOUT: %.loc35_8: init %empty_tuple.type = call %specific_impl_fn.loc35_4.1() -// CHECK:STDOUT: %T.ref.loc37: %facet_type.242 = name_ref T, %T.loc33_6.1 [symbolic = %T.loc33_6.2 (constants.%T)] +// CHECK:STDOUT: %T.ref.loc37: %facet_type.242 = name_ref T, %T.loc33_6.1 [symbolic = %T.loc33_6.2 (constants.%T.2df)] // CHECK:STDOUT: %AA.ref.loc37: %A.assoc_type = name_ref AA, @A.%assoc0 [concrete = constants.%assoc0.6e7] // CHECK:STDOUT: %T.as_type.loc37: type = facet_access_type %T.ref.loc37 [symbolic = %T.as_type.loc33_28.2 (constants.%T.as_type)] // CHECK:STDOUT: %.loc37_4: type = converted %T.ref.loc37, %T.as_type.loc37 [symbolic = %T.as_type.loc33_28.2 (constants.%T.as_type)] // CHECK:STDOUT: %impl.elem0.loc37: @G.%.loc34_4.2 (%.fde) = impl_witness_access constants.%A.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc34_4.2 (constants.%impl.elem0.de2)] // CHECK:STDOUT: %specific_impl_fn.loc37: = specific_impl_function %impl.elem0.loc37, @AA.1(constants.%A.facet.487) [symbolic = %specific_impl_fn.loc34_4.2 (constants.%specific_impl_fn.086)] // CHECK:STDOUT: %.loc37_8: init %empty_tuple.type = call %specific_impl_fn.loc37() -// CHECK:STDOUT: %T.ref.loc38: %facet_type.242 = name_ref T, %T.loc33_6.1 [symbolic = %T.loc33_6.2 (constants.%T)] +// CHECK:STDOUT: %T.ref.loc38: %facet_type.242 = name_ref T, %T.loc33_6.1 [symbolic = %T.loc33_6.2 (constants.%T.2df)] // CHECK:STDOUT: %BB.ref.loc38: %B.assoc_type = name_ref BB, @B.%assoc0 [concrete = constants.%assoc0.a29] // CHECK:STDOUT: %T.as_type.loc38: type = facet_access_type %T.ref.loc38 [symbolic = %T.as_type.loc33_28.2 (constants.%T.as_type)] // CHECK:STDOUT: %.loc38_4: type = converted %T.ref.loc38, %T.as_type.loc38 [symbolic = %T.as_type.loc33_28.2 (constants.%T.as_type)] // CHECK:STDOUT: %impl.elem0.loc38: @G.%.loc35_4.2 (%.368) = impl_witness_access constants.%B.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc35_4.2 (constants.%impl.elem0.43b)] // CHECK:STDOUT: %specific_impl_fn.loc38: = specific_impl_function %impl.elem0.loc38, @BB.1(constants.%B.facet.8d1) [symbolic = %specific_impl_fn.loc35_4.2 (constants.%specific_impl_fn.573)] // CHECK:STDOUT: %.loc38_8: init %empty_tuple.type = call %specific_impl_fn.loc38() -// CHECK:STDOUT: %T.ref.loc40: %facet_type.242 = name_ref T, %T.loc33_6.1 [symbolic = %T.loc33_6.2 (constants.%T)] +// CHECK:STDOUT: %T.ref.loc40: %facet_type.242 = name_ref T, %T.loc33_6.1 [symbolic = %T.loc33_6.2 (constants.%T.2df)] // CHECK:STDOUT: %A.ref.loc40: type = name_ref A, file.%A.decl [concrete = constants.%A.type] // CHECK:STDOUT: %AA.ref.loc40: %A.assoc_type = name_ref AA, @A.%assoc0 [concrete = constants.%assoc0.6e7] -// CHECK:STDOUT: %T.as_type.loc40: type = facet_access_type constants.%T [symbolic = %T.as_type.loc33_28.2 (constants.%T.as_type)] +// CHECK:STDOUT: %T.as_type.loc40: type = facet_access_type constants.%T.2df [symbolic = %T.as_type.loc33_28.2 (constants.%T.as_type)] // CHECK:STDOUT: %A.facet.loc40: %A.type = facet_value %T.as_type.loc40, (constants.%A.lookup_impl_witness) [symbolic = %A.facet.loc34 (constants.%A.facet.487)] // CHECK:STDOUT: %.loc40_4: %A.type = converted %T.ref.loc40, %A.facet.loc40 [symbolic = %A.facet.loc34 (constants.%A.facet.487)] // CHECK:STDOUT: %impl.elem0.loc40: @G.%.loc34_4.2 (%.fde) = impl_witness_access constants.%A.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc34_4.2 (constants.%impl.elem0.de2)] // CHECK:STDOUT: %specific_impl_fn.loc40: = specific_impl_function %impl.elem0.loc40, @AA.1(constants.%A.facet.487) [symbolic = %specific_impl_fn.loc34_4.2 (constants.%specific_impl_fn.086)] // CHECK:STDOUT: %.loc40_12: init %empty_tuple.type = call %specific_impl_fn.loc40() -// CHECK:STDOUT: %T.ref.loc41: %facet_type.242 = name_ref T, %T.loc33_6.1 [symbolic = %T.loc33_6.2 (constants.%T)] +// CHECK:STDOUT: %T.ref.loc41: %facet_type.242 = name_ref T, %T.loc33_6.1 [symbolic = %T.loc33_6.2 (constants.%T.2df)] // CHECK:STDOUT: %B.ref.loc41: type = name_ref B, file.%B.decl [concrete = constants.%B.type] // CHECK:STDOUT: %BB.ref.loc41: %B.assoc_type = name_ref BB, @B.%assoc0 [concrete = constants.%assoc0.a29] -// CHECK:STDOUT: %T.as_type.loc41: type = facet_access_type constants.%T [symbolic = %T.as_type.loc33_28.2 (constants.%T.as_type)] +// CHECK:STDOUT: %T.as_type.loc41: type = facet_access_type constants.%T.2df [symbolic = %T.as_type.loc33_28.2 (constants.%T.as_type)] // CHECK:STDOUT: %B.facet.loc41: %B.type = facet_value %T.as_type.loc41, (constants.%B.lookup_impl_witness) [symbolic = %B.facet.loc35 (constants.%B.facet.8d1)] // CHECK:STDOUT: %.loc41_4: %B.type = converted %T.ref.loc41, %B.facet.loc41 [symbolic = %B.facet.loc35 (constants.%B.facet.8d1)] // CHECK:STDOUT: %impl.elem0.loc41: @G.%.loc35_4.2 (%.368) = impl_witness_access constants.%B.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc35_4.2 (constants.%impl.elem0.43b)] @@ -359,6 +374,12 @@ fn F() { // CHECK:STDOUT: %G.specific_fn: = specific_function %G.ref, @G(constants.%facet_value) [concrete = constants.%G.specific_fn] // CHECK:STDOUT: %.loc45_8.2: %C = bind_value %.loc45_8.1 // CHECK:STDOUT: %G.call: init %empty_tuple.type = call %G.specific_fn(%.loc45_8.2) +// CHECK:STDOUT: %impl.elem0: %.b80 = impl_witness_access constants.%Destroy.impl_witness.906, element0 [concrete = constants.%Op.5d7] +// CHECK:STDOUT: %bound_method.loc45_6.1: = bound_method %.loc45_6.2, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.4(constants.%C) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc45_6.2: = bound_method %.loc45_6.2, %specific_fn +// CHECK:STDOUT: %.loc45_6.5: %C = bind_value %.loc45_6.2 +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc45_6.2(%.loc45_6.5) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -370,8 +391,8 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: specific @BB.1(constants.%B.facet.82f) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @G(constants.%T) { -// CHECK:STDOUT: %T.loc33_6.2 => constants.%T +// CHECK:STDOUT: specific @G(constants.%T.2df) { +// CHECK:STDOUT: %T.loc33_6.2 => constants.%T.2df // CHECK:STDOUT: %T.as_type.loc33_28.2 => constants.%T.as_type // CHECK:STDOUT: %pattern_type => constants.%pattern_type.9a0 // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/facet/convert_class_type_to_generic_facet_value.carbon b/toolchain/check/testdata/facet/convert_class_type_to_generic_facet_value.carbon index 065cb66ea91f..0aab6401f236 100644 --- a/toolchain/check/testdata/facet/convert_class_type_to_generic_facet_value.carbon +++ b/toolchain/check/testdata/facet/convert_class_type_to_generic_facet_value.carbon @@ -387,13 +387,27 @@ fn G() { // CHECK:STDOUT: %pattern_type.ded: type = pattern_type %Generic.type.769 [concrete] // CHECK:STDOUT: %pattern_type.589: type = pattern_type %GenericParam [concrete] // CHECK:STDOUT: %CallGenericMethod.specific_fn: = specific_function %CallGenericMethod, @CallGenericMethod(%GenericParam, %Generic.facet) [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.abd: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%GenericParam) [concrete] +// CHECK:STDOUT: %Op.type.ae1: type = fn_type @Op.2, @impl.49c(%GenericParam) [concrete] +// CHECK:STDOUT: %Op.0cc: %Op.type.ae1 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %GenericParam, (%Destroy.impl_witness.abd) [concrete] +// CHECK:STDOUT: %.4c3: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.0cc, @Op.2(%GenericParam) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -413,13 +427,13 @@ fn G() { // CHECK:STDOUT: } // CHECK:STDOUT: %GenericParam.decl: type = class_decl @GenericParam [concrete = constants.%GenericParam] {} {} // CHECK:STDOUT: %ImplsGeneric.decl: type = class_decl @ImplsGeneric [concrete = constants.%ImplsGeneric] {} {} -// CHECK:STDOUT: impl_decl @impl [concrete] {} { +// CHECK:STDOUT: impl_decl @impl.046 [concrete] {} { // CHECK:STDOUT: %ImplsGeneric.ref: type = name_ref ImplsGeneric, file.%ImplsGeneric.decl [concrete = constants.%ImplsGeneric] // CHECK:STDOUT: %Generic.ref: %Generic.type.c21 = name_ref Generic, file.%Generic.decl [concrete = constants.%Generic.generic] // CHECK:STDOUT: %GenericParam.ref: type = name_ref GenericParam, file.%GenericParam.decl [concrete = constants.%GenericParam] // CHECK:STDOUT: %Generic.type: type = facet_type <@Generic, @Generic(constants.%GenericParam)> [concrete = constants.%Generic.type.769] // CHECK:STDOUT: } -// CHECK:STDOUT: %Generic.impl_witness_table = impl_witness_table (@impl.%F.decl), @impl [concrete] +// CHECK:STDOUT: %Generic.impl_witness_table = impl_witness_table (@impl.046.%F.decl), @impl.046 [concrete] // CHECK:STDOUT: %Generic.impl_witness: = impl_witness %Generic.impl_witness_table [concrete = constants.%Generic.impl_witness] // CHECK:STDOUT: %CallGenericMethod.decl: %CallGenericMethod.type = fn_decl @CallGenericMethod [concrete = constants.%CallGenericMethod] { // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete] @@ -464,7 +478,7 @@ fn G() { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl: %ImplsGeneric.ref as %Generic.type { +// CHECK:STDOUT: impl @impl.046: %ImplsGeneric.ref as %Generic.type { // CHECK:STDOUT: %F.decl: %F.type.17b = fn_decl @F.2 [concrete = constants.%F.a56] {} {} // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -530,6 +544,12 @@ fn G() { // CHECK:STDOUT: %CallGenericMethod.specific_fn: = specific_function %CallGenericMethod.ref, @CallGenericMethod(constants.%GenericParam, constants.%Generic.facet) [concrete = constants.%CallGenericMethod.specific_fn] // CHECK:STDOUT: %.loc18_38.2: %GenericParam = bind_value %.loc18_38.1 // CHECK:STDOUT: %CallGenericMethod.call: init %empty_tuple.type = call %CallGenericMethod.specific_fn(%.loc18_38.2) +// CHECK:STDOUT: %impl.elem0: %.4c3 = impl_witness_access constants.%Destroy.impl_witness.abd, element0 [concrete = constants.%Op.0cc] +// CHECK:STDOUT: %bound_method.loc18_36.1: = bound_method %.loc18_36.2, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%GenericParam) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc18_36.2: = bound_method %.loc18_36.2, %specific_fn +// CHECK:STDOUT: %.loc18_36.5: %GenericParam = bind_value %.loc18_36.2 +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc18_36.2(%.loc18_36.5) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/facet/convert_class_value_to_facet_value_value.carbon b/toolchain/check/testdata/facet/convert_class_value_to_facet_value_value.carbon index d15b9dd957ad..6792d39ce8aa 100644 --- a/toolchain/check/testdata/facet/convert_class_value_to_facet_value_value.carbon +++ b/toolchain/check/testdata/facet/convert_class_value_to_facet_value_value.carbon @@ -27,15 +27,15 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Animal.type: type = facet_type <@Animal> [concrete] -// CHECK:STDOUT: %Self: %Animal.type = bind_symbolic_name Self, 0 [symbolic] -// CHECK:STDOUT: %T: %Animal.type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Self.fd4: %Animal.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %T.fd4: %Animal.type = bind_symbolic_name T, 0 [symbolic] // CHECK:STDOUT: %pattern_type.3b0: type = pattern_type %Animal.type [concrete] -// CHECK:STDOUT: %T.as_type: type = facet_access_type %T [symbolic] +// CHECK:STDOUT: %T.as_type: type = facet_access_type %T.fd4 [symbolic] // CHECK:STDOUT: %pattern_type.36a: type = pattern_type %T.as_type [symbolic] // CHECK:STDOUT: %WalkAnimal.type: type = fn_type @WalkAnimal [concrete] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %WalkAnimal: %WalkAnimal.type = struct_value () [concrete] -// CHECK:STDOUT: %require_complete: = require_complete_type %T.as_type [symbolic] +// CHECK:STDOUT: %require_complete.234: = require_complete_type %T.as_type [symbolic] // CHECK:STDOUT: %Goat: type = class_type @Goat [concrete] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] @@ -46,13 +46,28 @@ fn F() { // CHECK:STDOUT: %Animal.facet: %Animal.type = facet_value %Goat, (%Animal.impl_witness) [concrete] // CHECK:STDOUT: %pattern_type.ab7: type = pattern_type %Goat [concrete] // CHECK:STDOUT: %WalkAnimal.specific_fn: = specific_function %WalkAnimal, @WalkAnimal(%Animal.facet) [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T.8b3: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl.49c(%T.8b3) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.b14: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%Goat) [concrete] +// CHECK:STDOUT: %Op.type.e7a: type = fn_type @Op.2, @impl.49c(%Goat) [concrete] +// CHECK:STDOUT: %Op.55a: %Op.type.e7a = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %Goat, (%Destroy.impl_witness.b14) [concrete] +// CHECK:STDOUT: %.095: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.55a, @Op.2(%Goat) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -71,34 +86,34 @@ fn F() { // CHECK:STDOUT: %a.param_patt: @WalkAnimal.%pattern_type (%pattern_type.36a) = value_param_pattern %a.patt, call_param0 [concrete] // CHECK:STDOUT: } { // CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] -// CHECK:STDOUT: %T.loc17_15.1: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc17_15.2 (constants.%T)] +// CHECK:STDOUT: %T.loc17_15.1: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc17_15.2 (constants.%T.fd4)] // CHECK:STDOUT: %a.param: @WalkAnimal.%T.as_type.loc17_30.2 (%T.as_type) = value_param call_param0 // CHECK:STDOUT: %.loc17_30.1: type = splice_block %.loc17_30.2 [symbolic = %T.as_type.loc17_30.2 (constants.%T.as_type)] { -// CHECK:STDOUT: %T.ref: %Animal.type = name_ref T, %T.loc17_15.1 [symbolic = %T.loc17_15.2 (constants.%T)] +// CHECK:STDOUT: %T.ref: %Animal.type = name_ref T, %T.loc17_15.1 [symbolic = %T.loc17_15.2 (constants.%T.fd4)] // CHECK:STDOUT: %T.as_type.loc17_30.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc17_30.2 (constants.%T.as_type)] // CHECK:STDOUT: %.loc17_30.2: type = converted %T.ref, %T.as_type.loc17_30.1 [symbolic = %T.as_type.loc17_30.2 (constants.%T.as_type)] // CHECK:STDOUT: } // CHECK:STDOUT: %a: @WalkAnimal.%T.as_type.loc17_30.2 (%T.as_type) = bind_name a, %a.param // CHECK:STDOUT: } // CHECK:STDOUT: %Goat.decl: type = class_decl @Goat [concrete = constants.%Goat] {} {} -// CHECK:STDOUT: impl_decl @impl [concrete] {} { +// CHECK:STDOUT: impl_decl @impl.27e [concrete] {} { // CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] // CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %Animal.impl_witness_table = impl_witness_table (), @impl [concrete] +// CHECK:STDOUT: %Animal.impl_witness_table = impl_witness_table (), @impl.27e [concrete] // CHECK:STDOUT: %Animal.impl_witness: = impl_witness %Animal.impl_witness_table [concrete = constants.%Animal.impl_witness] // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Animal { -// CHECK:STDOUT: %Self: %Animal.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] +// CHECK:STDOUT: %Self: %Animal.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.fd4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: witness = () // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl: %Goat.ref as %Animal.ref { +// CHECK:STDOUT: impl @impl.27e: %Goat.ref as %Animal.ref { // CHECK:STDOUT: !members: // CHECK:STDOUT: witness = file.%Animal.impl_witness // CHECK:STDOUT: } @@ -113,12 +128,12 @@ fn F() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @WalkAnimal(%T.loc17_15.1: %Animal.type) { -// CHECK:STDOUT: %T.loc17_15.2: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc17_15.2 (constants.%T)] +// CHECK:STDOUT: %T.loc17_15.2: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc17_15.2 (constants.%T.fd4)] // CHECK:STDOUT: %T.as_type.loc17_30.2: type = facet_access_type %T.loc17_15.2 [symbolic = %T.as_type.loc17_30.2 (constants.%T.as_type)] // CHECK:STDOUT: %pattern_type: type = pattern_type %T.as_type.loc17_30.2 [symbolic = %pattern_type (constants.%pattern_type.36a)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type %T.as_type.loc17_30.2 [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %require_complete: = require_complete_type %T.as_type.loc17_30.2 [symbolic = %require_complete (constants.%require_complete.234)] // CHECK:STDOUT: // CHECK:STDOUT: fn(%a.param: @WalkAnimal.%T.as_type.loc17_30.2 (%T.as_type)) { // CHECK:STDOUT: !entry: @@ -142,11 +157,17 @@ fn F() { // CHECK:STDOUT: %WalkAnimal.specific_fn: = specific_function %WalkAnimal.ref, @WalkAnimal(constants.%Animal.facet) [concrete = constants.%WalkAnimal.specific_fn] // CHECK:STDOUT: %.loc23_17.2: %Goat = bind_value %.loc23_17.1 // CHECK:STDOUT: %WalkAnimal.call: init %empty_tuple.type = call %WalkAnimal.specific_fn(%.loc23_17.2) +// CHECK:STDOUT: %impl.elem0: %.095 = impl_witness_access constants.%Destroy.impl_witness.b14, element0 [concrete = constants.%Op.55a] +// CHECK:STDOUT: %bound_method.loc23_15.1: = bound_method %.loc23_15.2, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%Goat) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc23_15.2: = bound_method %.loc23_15.2, %specific_fn +// CHECK:STDOUT: %.loc23_15.5: %Goat = bind_value %.loc23_15.2 +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc23_15.2(%.loc23_15.5) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @WalkAnimal(constants.%T) { -// CHECK:STDOUT: %T.loc17_15.2 => constants.%T +// CHECK:STDOUT: specific @WalkAnimal(constants.%T.fd4) { +// CHECK:STDOUT: %T.loc17_15.2 => constants.%T.fd4 // CHECK:STDOUT: %T.as_type.loc17_30.2 => constants.%T.as_type // CHECK:STDOUT: %pattern_type => constants.%pattern_type.36a // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/facet/convert_class_value_to_generic_facet_value_value.carbon b/toolchain/check/testdata/facet/convert_class_value_to_generic_facet_value_value.carbon index 0152f2465df8..5c0762150efd 100644 --- a/toolchain/check/testdata/facet/convert_class_value_to_generic_facet_value_value.carbon +++ b/toolchain/check/testdata/facet/convert_class_value_to_generic_facet_value_value.carbon @@ -152,15 +152,35 @@ fn B() { // CHECK:STDOUT: %pattern_type.c8d: type = pattern_type %ImplsGeneric [concrete] // CHECK:STDOUT: %pattern_type.589: type = pattern_type %GenericParam [concrete] // CHECK:STDOUT: %CallGenericMethod.specific_fn: = specific_function %CallGenericMethod, @CallGenericMethod(%GenericParam, %Generic.facet.8ff) [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.abd: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%GenericParam) [concrete] +// CHECK:STDOUT: %Op.type.ae1: type = fn_type @Op.2, @impl.49c(%GenericParam) [concrete] +// CHECK:STDOUT: %Op.0cc: %Op.type.ae1 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.8f4: %Destroy.type = facet_value %GenericParam, (%Destroy.impl_witness.abd) [concrete] +// CHECK:STDOUT: %.4c3: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.8f4 [concrete] +// CHECK:STDOUT: %Op.specific_fn.934: = specific_function %Op.0cc, @Op.2(%GenericParam) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.32c: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%ImplsGeneric) [concrete] +// CHECK:STDOUT: %Op.type.e98: type = fn_type @Op.2, @impl.49c(%ImplsGeneric) [concrete] +// CHECK:STDOUT: %Op.51a: %Op.type.e98 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.ec7: %Destroy.type = facet_value %ImplsGeneric, (%Destroy.impl_witness.32c) [concrete] +// CHECK:STDOUT: %.de2: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.ec7 [concrete] +// CHECK:STDOUT: %Op.specific_fn.7b0: = specific_function %Op.51a, @Op.2(%ImplsGeneric) [concrete] // CHECK:STDOUT: %complete_type.997: = complete_type_witness %Generic.type.769 [concrete] // CHECK:STDOUT: %.3e6: type = fn_type_with_self_type %F.type.4cf, %Generic.facet.8ff [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -180,13 +200,13 @@ fn B() { // CHECK:STDOUT: } // CHECK:STDOUT: %GenericParam.decl: type = class_decl @GenericParam [concrete = constants.%GenericParam] {} {} // CHECK:STDOUT: %ImplsGeneric.decl: type = class_decl @ImplsGeneric [concrete = constants.%ImplsGeneric] {} {} -// CHECK:STDOUT: impl_decl @impl [concrete] {} { +// CHECK:STDOUT: impl_decl @impl.046 [concrete] {} { // CHECK:STDOUT: %ImplsGeneric.ref: type = name_ref ImplsGeneric, file.%ImplsGeneric.decl [concrete = constants.%ImplsGeneric] // CHECK:STDOUT: %Generic.ref: %Generic.type.c21 = name_ref Generic, file.%Generic.decl [concrete = constants.%Generic.generic] // CHECK:STDOUT: %GenericParam.ref: type = name_ref GenericParam, file.%GenericParam.decl [concrete = constants.%GenericParam] // CHECK:STDOUT: %Generic.type: type = facet_type <@Generic, @Generic(constants.%GenericParam)> [concrete = constants.%Generic.type.769] // CHECK:STDOUT: } -// CHECK:STDOUT: %Generic.impl_witness_table = impl_witness_table (@impl.%F.decl), @impl [concrete] +// CHECK:STDOUT: %Generic.impl_witness_table = impl_witness_table (@impl.046.%F.decl), @impl.046 [concrete] // CHECK:STDOUT: %Generic.impl_witness: = impl_witness %Generic.impl_witness_table [concrete = constants.%Generic.impl_witness] // CHECK:STDOUT: %CallGenericMethod.decl: %CallGenericMethod.type = fn_decl @CallGenericMethod [concrete = constants.%CallGenericMethod] { // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete] @@ -240,7 +260,7 @@ fn B() { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl: %ImplsGeneric.ref as %Generic.type { +// CHECK:STDOUT: impl @impl.046: %ImplsGeneric.ref as %Generic.type { // CHECK:STDOUT: %F.decl: %F.type.17b = fn_decl @F.2 [concrete = constants.%F.a56] {} {} // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -332,6 +352,18 @@ fn B() { // CHECK:STDOUT: %.loc20_24.2: %ImplsGeneric = bind_value %.loc20_24.1 // CHECK:STDOUT: %.loc20_44.2: %GenericParam = bind_value %.loc20_44.1 // CHECK:STDOUT: %CallGenericMethod.call: init %empty_tuple.type = call %CallGenericMethod.specific_fn(%.loc20_24.2, %.loc20_44.2) +// CHECK:STDOUT: %impl.elem0.loc20_42: %.4c3 = impl_witness_access constants.%Destroy.impl_witness.abd, element0 [concrete = constants.%Op.0cc] +// CHECK:STDOUT: %bound_method.loc20_42.1: = bound_method %.loc20_42.2, %impl.elem0.loc20_42 +// CHECK:STDOUT: %specific_fn.loc20_42: = specific_function %impl.elem0.loc20_42, @Op.2(constants.%GenericParam) [concrete = constants.%Op.specific_fn.934] +// CHECK:STDOUT: %bound_method.loc20_42.2: = bound_method %.loc20_42.2, %specific_fn.loc20_42 +// CHECK:STDOUT: %.loc20_42.5: %GenericParam = bind_value %.loc20_42.2 +// CHECK:STDOUT: %no_op.loc20_42: init %empty_tuple.type = call %bound_method.loc20_42.2(%.loc20_42.5) +// CHECK:STDOUT: %impl.elem0.loc20_22: %.de2 = impl_witness_access constants.%Destroy.impl_witness.32c, element0 [concrete = constants.%Op.51a] +// CHECK:STDOUT: %bound_method.loc20_22.1: = bound_method %.loc20_22.2, %impl.elem0.loc20_22 +// CHECK:STDOUT: %specific_fn.loc20_22: = specific_function %impl.elem0.loc20_22, @Op.2(constants.%ImplsGeneric) [concrete = constants.%Op.specific_fn.7b0] +// CHECK:STDOUT: %bound_method.loc20_22.2: = bound_method %.loc20_22.2, %specific_fn.loc20_22 +// CHECK:STDOUT: %.loc20_22.5: %ImplsGeneric = bind_value %.loc20_22.2 +// CHECK:STDOUT: %no_op.loc20_22: init %empty_tuple.type = call %bound_method.loc20_22.2(%.loc20_22.5) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -420,7 +452,7 @@ fn B() { // CHECK:STDOUT: %I.type.bea: type = facet_type <@I, @I(%T.8b3, %empty_tuple.type)> [symbolic] // CHECK:STDOUT: %Self.ec5: %I.type.bea = bind_symbolic_name Self, 2 [symbolic] // CHECK:STDOUT: %require_complete.5ce: = require_complete_type %I.type.bea [symbolic] -// CHECK:STDOUT: %I.impl_witness.989: = impl_witness file.%I.impl_witness_table, @impl(%T.8b3) [symbolic] +// CHECK:STDOUT: %I.impl_witness.989: = impl_witness file.%I.impl_witness_table, @impl.0dc(%T.8b3) [symbolic] // CHECK:STDOUT: %I.type.202: type = facet_type <@I, @I(%empty_struct_type, %empty_tuple.type)> [concrete] // CHECK:STDOUT: %T.e96: %I.type.202 = bind_symbolic_name T, 0 [symbolic] // CHECK:STDOUT: %pattern_type.a84: type = pattern_type %I.type.202 [concrete] @@ -434,17 +466,31 @@ fn B() { // CHECK:STDOUT: %C.val: %C = struct_value () [concrete] // CHECK:STDOUT: %Self.38c: %I.type.202 = bind_symbolic_name Self, 2 [symbolic] // CHECK:STDOUT: %complete_type.3d9: = complete_type_witness %I.type.202 [concrete] -// CHECK:STDOUT: %I.impl_witness.806: = impl_witness file.%I.impl_witness_table, @impl(%empty_struct_type) [concrete] +// CHECK:STDOUT: %I.impl_witness.806: = impl_witness file.%I.impl_witness_table, @impl.0dc(%empty_struct_type) [concrete] // CHECK:STDOUT: %I.facet: %I.type.202 = facet_value %C, (%I.impl_witness.806) [concrete] // CHECK:STDOUT: %pattern_type.c48: type = pattern_type %C [concrete] // CHECK:STDOUT: %A.specific_fn: = specific_function %A, @A(%I.facet) [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl.49c(%T.8b3) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.906: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%C) [concrete] +// CHECK:STDOUT: %Op.type.153: type = fn_type @Op.2, @impl.49c(%C) [concrete] +// CHECK:STDOUT: %Op.5d7: %Op.type.153 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %C, (%Destroy.impl_witness.906) [concrete] +// CHECK:STDOUT: %.b80: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.5d7, @Op.2(%C) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -464,7 +510,7 @@ fn B() { // CHECK:STDOUT: %W.loc3_23.1: type = bind_symbolic_name W, 1 [symbolic = %W.loc3_23.2 (constants.%W)] // CHECK:STDOUT: } // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {} -// CHECK:STDOUT: impl_decl @impl [concrete] { +// CHECK:STDOUT: impl_decl @impl.0dc [concrete] { // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete] // CHECK:STDOUT: } { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] @@ -475,8 +521,8 @@ fn B() { // CHECK:STDOUT: %I.type.loc7_36.1: type = facet_type <@I, @I(constants.%T.8b3, constants.%empty_tuple.type)> [symbolic = %I.type.loc7_36.2 (constants.%I.type.bea)] // CHECK:STDOUT: %T.loc7_14.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc7_14.2 (constants.%T.8b3)] // CHECK:STDOUT: } -// CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (), @impl [concrete] -// CHECK:STDOUT: %I.impl_witness: = impl_witness %I.impl_witness_table, @impl(constants.%T.8b3) [symbolic = @impl.%I.impl_witness (constants.%I.impl_witness.989)] +// CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (), @impl.0dc [concrete] +// CHECK:STDOUT: %I.impl_witness: = impl_witness %I.impl_witness_table, @impl.0dc(constants.%T.8b3) [symbolic = @impl.0dc.%I.impl_witness (constants.%I.impl_witness.989)] // CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [concrete = constants.%A] { // CHECK:STDOUT: %T.patt: %pattern_type.a84 = symbolic_binding_pattern T, 0 [concrete] // CHECK:STDOUT: %t.patt: @A.%pattern_type (%pattern_type.3ff) = binding_pattern t [concrete] @@ -519,11 +565,11 @@ fn B() { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic impl @impl(%T.loc7_14.1: type) { +// CHECK:STDOUT: generic impl @impl.0dc(%T.loc7_14.1: type) { // CHECK:STDOUT: %T.loc7_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc7_14.2 (constants.%T.8b3)] // CHECK:STDOUT: %I.type.loc7_36.2: type = facet_type <@I, @I(%T.loc7_14.2, constants.%empty_tuple.type)> [symbolic = %I.type.loc7_36.2 (constants.%I.type.bea)] // CHECK:STDOUT: %require_complete: = require_complete_type %I.type.loc7_36.2 [symbolic = %require_complete (constants.%require_complete.5ce)] -// CHECK:STDOUT: %I.impl_witness: = impl_witness file.%I.impl_witness_table, @impl(%T.loc7_14.2) [symbolic = %I.impl_witness (constants.%I.impl_witness.989)] +// CHECK:STDOUT: %I.impl_witness: = impl_witness file.%I.impl_witness_table, @impl.0dc(%T.loc7_14.2) [symbolic = %I.impl_witness (constants.%I.impl_witness.989)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -572,6 +618,12 @@ fn B() { // CHECK:STDOUT: %A.specific_fn: = specific_function %A.ref, @A(constants.%I.facet) [concrete = constants.%A.specific_fn] // CHECK:STDOUT: %.loc12_8.2: %C = bind_value %.loc12_8.1 // CHECK:STDOUT: %A.call: init %empty_tuple.type = call %A.specific_fn(%.loc12_8.2) +// CHECK:STDOUT: %impl.elem0: %.b80 = impl_witness_access constants.%Destroy.impl_witness.906, element0 [concrete = constants.%Op.5d7] +// CHECK:STDOUT: %bound_method.loc12_6.1: = bound_method %.loc12_6.2, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%C) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc12_6.2: = bound_method %.loc12_6.2, %specific_fn +// CHECK:STDOUT: %.loc12_6.5: %C = bind_value %.loc12_6.2 +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc12_6.2(%.loc12_6.5) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -589,7 +641,7 @@ fn B() { // CHECK:STDOUT: %Self.2 => constants.%Self.ec5 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @impl(constants.%T.8b3) { +// CHECK:STDOUT: specific @impl.0dc(constants.%T.8b3) { // CHECK:STDOUT: %T.loc7_14.2 => constants.%T.8b3 // CHECK:STDOUT: %I.type.loc7_36.2 => constants.%I.type.bea // CHECK:STDOUT: %require_complete => constants.%require_complete.5ce @@ -611,7 +663,7 @@ fn B() { // CHECK:STDOUT: %pattern_type => constants.%pattern_type.3ff // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @impl(constants.%empty_struct_type) { +// CHECK:STDOUT: specific @impl.0dc(constants.%empty_struct_type) { // CHECK:STDOUT: %T.loc7_14.2 => constants.%empty_struct_type // CHECK:STDOUT: %I.type.loc7_36.2 => constants.%I.type.202 // CHECK:STDOUT: %require_complete => constants.%complete_type.3d9 @@ -647,7 +699,7 @@ fn B() { // CHECK:STDOUT: %I.type.bea: type = facet_type <@I, @I(%T.8b3, %empty_tuple.type)> [symbolic] // CHECK:STDOUT: %Self.ec5: %I.type.bea = bind_symbolic_name Self, 2 [symbolic] // CHECK:STDOUT: %require_complete.5ce: = require_complete_type %I.type.bea [symbolic] -// CHECK:STDOUT: %I.impl_witness: = impl_witness file.%I.impl_witness_table, @impl(%T.8b3) [symbolic] +// CHECK:STDOUT: %I.impl_witness: = impl_witness file.%I.impl_witness_table, @impl.0dc(%T.8b3) [symbolic] // CHECK:STDOUT: %I.type.906: type = facet_type <@I, @I(%empty_struct_type, %empty_struct_type)> [concrete] // CHECK:STDOUT: %T.4b2: %I.type.906 = bind_symbolic_name T, 0 [symbolic] // CHECK:STDOUT: %pattern_type.a62: type = pattern_type %I.type.906 [concrete] @@ -659,13 +711,27 @@ fn B() { // CHECK:STDOUT: %B.type: type = fn_type @B [concrete] // CHECK:STDOUT: %B: %B.type = struct_value () [concrete] // CHECK:STDOUT: %C.val: %C = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl.49c(%T.8b3) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.906: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%C) [concrete] +// CHECK:STDOUT: %Op.type.153: type = fn_type @Op.2, @impl.49c(%C) [concrete] +// CHECK:STDOUT: %Op.5d7: %Op.type.153 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %C, (%Destroy.impl_witness.906) [concrete] +// CHECK:STDOUT: %.b80: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.5d7, @Op.2(%C) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -685,7 +751,7 @@ fn B() { // CHECK:STDOUT: %W.loc3_23.1: type = bind_symbolic_name W, 1 [symbolic = %W.loc3_23.2 (constants.%W)] // CHECK:STDOUT: } // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {} -// CHECK:STDOUT: impl_decl @impl [concrete] { +// CHECK:STDOUT: impl_decl @impl.0dc [concrete] { // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete] // CHECK:STDOUT: } { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] @@ -696,8 +762,8 @@ fn B() { // CHECK:STDOUT: %I.type.loc7_36.1: type = facet_type <@I, @I(constants.%T.8b3, constants.%empty_tuple.type)> [symbolic = %I.type.loc7_36.2 (constants.%I.type.bea)] // CHECK:STDOUT: %T.loc7_14.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc7_14.2 (constants.%T.8b3)] // CHECK:STDOUT: } -// CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (), @impl [concrete] -// CHECK:STDOUT: %I.impl_witness: = impl_witness %I.impl_witness_table, @impl(constants.%T.8b3) [symbolic = @impl.%I.impl_witness (constants.%I.impl_witness)] +// CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (), @impl.0dc [concrete] +// CHECK:STDOUT: %I.impl_witness: = impl_witness %I.impl_witness_table, @impl.0dc(constants.%T.8b3) [symbolic = @impl.0dc.%I.impl_witness (constants.%I.impl_witness)] // CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [concrete = constants.%A] { // CHECK:STDOUT: %T.patt: %pattern_type.a62 = symbolic_binding_pattern T, 0 [concrete] // CHECK:STDOUT: %t.patt: @A.%pattern_type (%pattern_type.f1c) = binding_pattern t [concrete] @@ -740,11 +806,11 @@ fn B() { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic impl @impl(%T.loc7_14.1: type) { +// CHECK:STDOUT: generic impl @impl.0dc(%T.loc7_14.1: type) { // CHECK:STDOUT: %T.loc7_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc7_14.2 (constants.%T.8b3)] // CHECK:STDOUT: %I.type.loc7_36.2: type = facet_type <@I, @I(%T.loc7_14.2, constants.%empty_tuple.type)> [symbolic = %I.type.loc7_36.2 (constants.%I.type.bea)] // CHECK:STDOUT: %require_complete: = require_complete_type %I.type.loc7_36.2 [symbolic = %require_complete (constants.%require_complete.5ce)] -// CHECK:STDOUT: %I.impl_witness: = impl_witness file.%I.impl_witness_table, @impl(%T.loc7_14.2) [symbolic = %I.impl_witness (constants.%I.impl_witness)] +// CHECK:STDOUT: %I.impl_witness: = impl_witness file.%I.impl_witness_table, @impl.0dc(%T.loc7_14.2) [symbolic = %I.impl_witness (constants.%I.impl_witness)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -786,6 +852,12 @@ fn B() { // CHECK:STDOUT: %.loc19_6.3: init %C = class_init (), %.loc19_6.2 [concrete = constants.%C.val] // CHECK:STDOUT: %.loc19_6.4: ref %C = temporary %.loc19_6.2, %.loc19_6.3 // CHECK:STDOUT: %.loc19_8: ref %C = converted %.loc19_6.1, %.loc19_6.4 +// CHECK:STDOUT: %impl.elem0: %.b80 = impl_witness_access constants.%Destroy.impl_witness.906, element0 [concrete = constants.%Op.5d7] +// CHECK:STDOUT: %bound_method.loc19_6.1: = bound_method %.loc19_6.2, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%C) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc19_6.2: = bound_method %.loc19_6.2, %specific_fn +// CHECK:STDOUT: %.loc19_6.5: %C = bind_value %.loc19_6.2 +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc19_6.2(%.loc19_6.5) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -803,7 +875,7 @@ fn B() { // CHECK:STDOUT: %Self.2 => constants.%Self.ec5 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @impl(constants.%T.8b3) { +// CHECK:STDOUT: specific @impl.0dc(constants.%T.8b3) { // CHECK:STDOUT: %T.loc7_14.2 => constants.%T.8b3 // CHECK:STDOUT: %I.type.loc7_36.2 => constants.%I.type.bea // CHECK:STDOUT: %require_complete => constants.%require_complete.5ce @@ -825,7 +897,7 @@ fn B() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete] -// CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self.826: %I.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %V: type = bind_symbolic_name V, 0 [symbolic] // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete] // CHECK:STDOUT: %W: type = bind_symbolic_name W, 1 [symbolic] @@ -837,25 +909,39 @@ fn B() { // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] // CHECK:STDOUT: %T.8b3: type = bind_symbolic_name T, 0 [symbolic] // CHECK:STDOUT: %C.463: type = class_type @C, @C(%T.8b3, %empty_tuple.type) [symbolic] -// CHECK:STDOUT: %I.impl_witness: = impl_witness file.%I.impl_witness_table, @impl(%T.8b3) [symbolic] +// CHECK:STDOUT: %I.impl_witness: = impl_witness file.%I.impl_witness_table, @impl.a1a(%T.8b3) [symbolic] // CHECK:STDOUT: %T.826: %I.type = bind_symbolic_name T, 0 [symbolic] // CHECK:STDOUT: %pattern_type.2b5: type = pattern_type %I.type [concrete] // CHECK:STDOUT: %T.as_type: type = facet_access_type %T.826 [symbolic] // CHECK:STDOUT: %pattern_type.6de: type = pattern_type %T.as_type [symbolic] // CHECK:STDOUT: %A.type: type = fn_type @A [concrete] // CHECK:STDOUT: %A: %A.type = struct_value () [concrete] -// CHECK:STDOUT: %require_complete: = require_complete_type %T.as_type [symbolic] +// CHECK:STDOUT: %require_complete.9b1: = require_complete_type %T.as_type [symbolic] // CHECK:STDOUT: %B.type: type = fn_type @B [concrete] // CHECK:STDOUT: %B: %B.type = struct_value () [concrete] // CHECK:STDOUT: %C.c74: type = class_type @C, @C(%empty_struct_type, %empty_struct_type) [concrete] // CHECK:STDOUT: %C.val: %C.c74 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl.49c(%T.8b3) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.efa: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%C.c74) [concrete] +// CHECK:STDOUT: %Op.type.53e: type = fn_type @Op.2, @impl.49c(%C.c74) [concrete] +// CHECK:STDOUT: %Op.2b8: %Op.type.53e = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %C.c74, (%Destroy.impl_witness.efa) [concrete] +// CHECK:STDOUT: %.77a: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.2b8, @Op.2(%C.c74) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -875,7 +961,7 @@ fn B() { // CHECK:STDOUT: %V.loc5_9.1: type = bind_symbolic_name V, 0 [symbolic = %V.loc5_9.2 (constants.%V)] // CHECK:STDOUT: %W.loc5_19.1: type = bind_symbolic_name W, 1 [symbolic = %W.loc5_19.2 (constants.%W)] // CHECK:STDOUT: } -// CHECK:STDOUT: impl_decl @impl [concrete] { +// CHECK:STDOUT: impl_decl @impl.a1a [concrete] { // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete] // CHECK:STDOUT: } { // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [concrete = constants.%C.generic] @@ -886,8 +972,8 @@ fn B() { // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: %T.loc7_14.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc7_14.2 (constants.%T.8b3)] // CHECK:STDOUT: } -// CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (), @impl [concrete] -// CHECK:STDOUT: %I.impl_witness: = impl_witness %I.impl_witness_table, @impl(constants.%T.8b3) [symbolic = @impl.%I.impl_witness (constants.%I.impl_witness)] +// CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (), @impl.a1a [concrete] +// CHECK:STDOUT: %I.impl_witness: = impl_witness %I.impl_witness_table, @impl.a1a(constants.%T.8b3) [symbolic = @impl.a1a.%I.impl_witness (constants.%I.impl_witness)] // CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [concrete = constants.%A] { // CHECK:STDOUT: %T.patt: %pattern_type.2b5 = symbolic_binding_pattern T, 0 [concrete] // CHECK:STDOUT: %t.patt: @A.%pattern_type (%pattern_type.6de) = binding_pattern t [concrete] @@ -907,17 +993,17 @@ fn B() { // 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.826] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: witness = () // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic impl @impl(%T.loc7_14.1: type) { +// CHECK:STDOUT: generic impl @impl.a1a(%T.loc7_14.1: type) { // CHECK:STDOUT: %T.loc7_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc7_14.2 (constants.%T.8b3)] // CHECK:STDOUT: %C.loc7_31.2: type = class_type @C, @C(%T.loc7_14.2, constants.%empty_tuple.type) [symbolic = %C.loc7_31.2 (constants.%C.463)] -// CHECK:STDOUT: %I.impl_witness: = impl_witness file.%I.impl_witness_table, @impl(%T.loc7_14.2) [symbolic = %I.impl_witness (constants.%I.impl_witness)] +// CHECK:STDOUT: %I.impl_witness: = impl_witness file.%I.impl_witness_table, @impl.a1a(%T.loc7_14.2) [symbolic = %I.impl_witness (constants.%I.impl_witness)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -949,7 +1035,7 @@ fn B() { // CHECK:STDOUT: %pattern_type: type = pattern_type %T.as_type.loc9_16.2 [symbolic = %pattern_type (constants.%pattern_type.6de)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type %T.as_type.loc9_16.2 [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %require_complete: = require_complete_type %T.as_type.loc9_16.2 [symbolic = %require_complete (constants.%require_complete.9b1)] // CHECK:STDOUT: // CHECK:STDOUT: fn(%t.param: @A.%T.as_type.loc9_16.2 (%T.as_type)) { // CHECK:STDOUT: !entry: @@ -971,6 +1057,12 @@ fn B() { // CHECK:STDOUT: %.loc19_6.3: init %C.c74 = class_init (), %.loc19_6.2 [concrete = constants.%C.val] // CHECK:STDOUT: %.loc19_6.4: ref %C.c74 = temporary %.loc19_6.2, %.loc19_6.3 // CHECK:STDOUT: %.loc19_8: ref %C.c74 = converted %.loc19_6.1, %.loc19_6.4 +// CHECK:STDOUT: %impl.elem0: %.77a = impl_witness_access constants.%Destroy.impl_witness.efa, element0 [concrete = constants.%Op.2b8] +// CHECK:STDOUT: %bound_method.loc19_6.1: = bound_method %.loc19_6.2, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%C.c74) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc19_6.2: = bound_method %.loc19_6.2, %specific_fn +// CHECK:STDOUT: %.loc19_6.5: %C.c74 = bind_value %.loc19_6.2 +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc19_6.2(%.loc19_6.5) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -984,7 +1076,7 @@ fn B() { // CHECK:STDOUT: %W.loc5_19.2 => constants.%empty_tuple.type // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @impl(constants.%T.8b3) { +// CHECK:STDOUT: specific @impl.a1a(constants.%T.8b3) { // CHECK:STDOUT: %T.loc7_14.2 => constants.%T.8b3 // CHECK:STDOUT: %C.loc7_31.2 => constants.%C.463 // CHECK:STDOUT: %I.impl_witness => constants.%I.impl_witness diff --git a/toolchain/check/testdata/facet/convert_facet_value_as_type_knows_original_type.carbon b/toolchain/check/testdata/facet/convert_facet_value_as_type_knows_original_type.carbon index 0bd7e5c2c939..da41cacd6906 100644 --- a/toolchain/check/testdata/facet/convert_facet_value_as_type_knows_original_type.carbon +++ b/toolchain/check/testdata/facet/convert_facet_value_as_type_knows_original_type.carbon @@ -205,7 +205,7 @@ fn F() { // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Eat.7cd: %Eat.type.e5d = struct_value () [concrete] // CHECK:STDOUT: %Eats.assoc_type: type = assoc_entity_type @Eats [concrete] -// CHECK:STDOUT: %assoc0: %Eats.assoc_type = assoc_entity element0, @Eats.%Eat.decl [concrete] +// CHECK:STDOUT: %assoc0.e43: %Eats.assoc_type = assoc_entity element0, @Eats.%Eat.decl [concrete] // CHECK:STDOUT: %Animal.type: type = facet_type <@Animal> [concrete] // CHECK:STDOUT: %Self.fd4: %Animal.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %Goat: type = class_type @Goat [concrete] @@ -221,16 +221,31 @@ fn F() { // CHECK:STDOUT: %F.type: type = fn_type @F [concrete] // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] // CHECK:STDOUT: %Animal.facet: %Animal.type = facet_value %Goat, (%Animal.impl_witness) [concrete] -// CHECK:STDOUT: %pattern_type: type = pattern_type %Goat [concrete] +// CHECK:STDOUT: %pattern_type.ab7: type = pattern_type %Goat [concrete] // CHECK:STDOUT: %Goat.val: %Goat = struct_value () [concrete] // CHECK:STDOUT: %.f6e: type = fn_type_with_self_type %Eat.type.e5d, %Eats.facet [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.b14: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%Goat) [concrete] +// CHECK:STDOUT: %Op.type.e7a: type = fn_type @Op.2, @impl.49c(%Goat) [concrete] +// CHECK:STDOUT: %Op.55a: %Op.type.e7a = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %Goat, (%Destroy.impl_witness.b14) [concrete] +// CHECK:STDOUT: %.095: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.55a, @Op.2(%Goat) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -251,7 +266,7 @@ fn F() { // CHECK:STDOUT: interface @Eats { // CHECK:STDOUT: %Self: %Eats.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.1b5] // CHECK:STDOUT: %Eat.decl: %Eat.type.e5d = fn_decl @Eat.1 [concrete = constants.%Eat.7cd] {} {} -// CHECK:STDOUT: %assoc0: %Eats.assoc_type = assoc_entity element0, %Eat.decl [concrete = constants.%assoc0] +// CHECK:STDOUT: %assoc0: %Eats.assoc_type = assoc_entity element0, %Eat.decl [concrete = constants.%assoc0.e43] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self @@ -324,7 +339,7 @@ fn F() { // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %x.patt: %pattern_type = binding_pattern x [concrete] +// CHECK:STDOUT: %x.patt: %pattern_type.ab7 = binding_pattern x [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %.loc22_28.1: %empty_struct_type = struct_literal () // CHECK:STDOUT: %Goat.ref.loc22_33: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] @@ -346,7 +361,7 @@ fn F() { // CHECK:STDOUT: %Bleet.ref.loc23: %Bleet.type = name_ref Bleet, @Goat.%Bleet.decl [concrete = constants.%Bleet] // CHECK:STDOUT: %Bleet.call.loc23: init %empty_tuple.type = call %Bleet.ref.loc23() // CHECK:STDOUT: %x.ref.loc24: %Goat = name_ref x, %x -// CHECK:STDOUT: %Eat.ref.loc24: %Eats.assoc_type = name_ref Eat, @Eats.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %Eat.ref.loc24: %Eats.assoc_type = name_ref Eat, @Eats.%assoc0 [concrete = constants.%assoc0.e43] // CHECK:STDOUT: %impl.elem0.loc24: %.f6e = impl_witness_access constants.%Eats.impl_witness, element0 [concrete = constants.%Eat.73e] // CHECK:STDOUT: %Eat.call.loc24: init %empty_tuple.type = call %impl.elem0.loc24() // CHECK:STDOUT: %.loc26_6.1: %empty_struct_type = struct_literal () @@ -375,9 +390,27 @@ fn F() { // CHECK:STDOUT: %.loc27_26: %Animal.type = converted %Goat.ref.loc27_21, %Animal.facet.loc27 [concrete = constants.%Animal.facet] // CHECK:STDOUT: %as_type.loc27: type = facet_access_type %.loc27_26 [concrete = constants.%Goat] // CHECK:STDOUT: %.loc27_35: type = converted %.loc27_26, %as_type.loc27 [concrete = constants.%Goat] -// CHECK:STDOUT: %Eat.ref.loc27: %Eats.assoc_type = name_ref Eat, @Eats.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc27: %.f6e = impl_witness_access constants.%Eats.impl_witness, element0 [concrete = constants.%Eat.73e] -// CHECK:STDOUT: %Eat.call.loc27: init %empty_tuple.type = call %impl.elem0.loc27() +// CHECK:STDOUT: %Eat.ref.loc27: %Eats.assoc_type = name_ref Eat, @Eats.%assoc0 [concrete = constants.%assoc0.e43] +// CHECK:STDOUT: %impl.elem0.loc27_37: %.f6e = impl_witness_access constants.%Eats.impl_witness, element0 [concrete = constants.%Eat.73e] +// CHECK:STDOUT: %Eat.call.loc27: init %empty_tuple.type = call %impl.elem0.loc27_37() +// CHECK:STDOUT: %impl.elem0.loc27_6: %.095 = impl_witness_access constants.%Destroy.impl_witness.b14, element0 [concrete = constants.%Op.55a] +// CHECK:STDOUT: %bound_method.loc27_6.1: = bound_method %.loc27_6.2, %impl.elem0.loc27_6 +// CHECK:STDOUT: %specific_fn.loc27: = specific_function %impl.elem0.loc27_6, @Op.2(constants.%Goat) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc27_6.2: = bound_method %.loc27_6.2, %specific_fn.loc27 +// CHECK:STDOUT: %.loc27_6.5: %Goat = bind_value %.loc27_6.2 +// CHECK:STDOUT: %no_op.loc27: init %empty_tuple.type = call %bound_method.loc27_6.2(%.loc27_6.5) +// CHECK:STDOUT: %impl.elem0.loc26: %.095 = impl_witness_access constants.%Destroy.impl_witness.b14, element0 [concrete = constants.%Op.55a] +// CHECK:STDOUT: %bound_method.loc26_6.1: = bound_method %.loc26_6.2, %impl.elem0.loc26 +// CHECK:STDOUT: %specific_fn.loc26: = specific_function %impl.elem0.loc26, @Op.2(constants.%Goat) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc26_6.2: = bound_method %.loc26_6.2, %specific_fn.loc26 +// CHECK:STDOUT: %.loc26_6.5: %Goat = bind_value %.loc26_6.2 +// CHECK:STDOUT: %no_op.loc26: init %empty_tuple.type = call %bound_method.loc26_6.2(%.loc26_6.5) +// CHECK:STDOUT: %impl.elem0.loc22: %.095 = impl_witness_access constants.%Destroy.impl_witness.b14, element0 [concrete = constants.%Op.55a] +// CHECK:STDOUT: %bound_method.loc22_28.1: = bound_method %.loc22_28.2, %impl.elem0.loc22 +// CHECK:STDOUT: %specific_fn.loc22: = specific_function %impl.elem0.loc22, @Op.2(constants.%Goat) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc22_28.2: = bound_method %.loc22_28.2, %specific_fn.loc22 +// CHECK:STDOUT: %.loc22_28.5: %Goat = bind_value %.loc22_28.2 +// CHECK:STDOUT: %no_op.loc22: init %empty_tuple.type = call %bound_method.loc22_28.2(%.loc22_28.5) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/facet/convert_facet_value_value_to_generic_facet_value_value.carbon b/toolchain/check/testdata/facet/convert_facet_value_value_to_generic_facet_value_value.carbon index 5b61d1111caf..32f33b49e557 100644 --- a/toolchain/check/testdata/facet/convert_facet_value_value_to_generic_facet_value_value.carbon +++ b/toolchain/check/testdata/facet/convert_facet_value_value_to_generic_facet_value_value.carbon @@ -101,6 +101,23 @@ fn F() { // CHECK:STDOUT: %pattern_type.ab7: type = pattern_type %Goat [concrete] // CHECK:STDOUT: %pattern_type.aff: type = pattern_type %Grass [concrete] // CHECK:STDOUT: %HandleAnimal.specific_fn: = specific_function %HandleAnimal, @HandleAnimal(%Animal.facet, %Edible.facet) [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T.8b3: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl.49c(%T.8b3) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.fd6: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%Grass) [concrete] +// CHECK:STDOUT: %Op.type.7fb: type = fn_type @Op.2, @impl.49c(%Grass) [concrete] +// CHECK:STDOUT: %Op.d66: %Op.type.7fb = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.049: %Destroy.type = facet_value %Grass, (%Destroy.impl_witness.fd6) [concrete] +// CHECK:STDOUT: %.cd1: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.049 [concrete] +// CHECK:STDOUT: %Op.specific_fn.9e2: = specific_function %Op.d66, @Op.2(%Grass) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.b14: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%Goat) [concrete] +// CHECK:STDOUT: %Op.type.e7a: type = fn_type @Op.2, @impl.49c(%Goat) [concrete] +// CHECK:STDOUT: %Op.55a: %Op.type.e7a = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.cfd: %Destroy.type = facet_value %Goat, (%Destroy.impl_witness.b14) [concrete] +// CHECK:STDOUT: %.095: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.cfd [concrete] +// CHECK:STDOUT: %Op.specific_fn.d9f: = specific_function %Op.55a, @Op.2(%Goat) [concrete] // CHECK:STDOUT: %Eats.type.1ae: type = facet_type <@Eats, @Eats(%Grass)> [concrete] // CHECK:STDOUT: %Self.016: %Eats.type.1ae = bind_symbolic_name Self, 1 [symbolic] // CHECK:STDOUT: %complete_type.004: = complete_type_witness %Eats.type.1ae [concrete] @@ -112,9 +129,13 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -396,6 +417,18 @@ fn F() { // CHECK:STDOUT: %.loc35_19.2: %Goat = bind_value %.loc35_19.1 // CHECK:STDOUT: %.loc35_31.2: %Grass = bind_value %.loc35_31.1 // CHECK:STDOUT: %HandleAnimal.call: init %empty_tuple.type = call %HandleAnimal.specific_fn(%.loc35_19.2, %.loc35_31.2) +// CHECK:STDOUT: %impl.elem0.loc35_29: %.cd1 = impl_witness_access constants.%Destroy.impl_witness.fd6, element0 [concrete = constants.%Op.d66] +// CHECK:STDOUT: %bound_method.loc35_29.1: = bound_method %.loc35_29.2, %impl.elem0.loc35_29 +// CHECK:STDOUT: %specific_fn.loc35_29: = specific_function %impl.elem0.loc35_29, @Op.2(constants.%Grass) [concrete = constants.%Op.specific_fn.9e2] +// CHECK:STDOUT: %bound_method.loc35_29.2: = bound_method %.loc35_29.2, %specific_fn.loc35_29 +// CHECK:STDOUT: %.loc35_29.5: %Grass = bind_value %.loc35_29.2 +// CHECK:STDOUT: %no_op.loc35_29: init %empty_tuple.type = call %bound_method.loc35_29.2(%.loc35_29.5) +// CHECK:STDOUT: %impl.elem0.loc35_17: %.095 = impl_witness_access constants.%Destroy.impl_witness.b14, element0 [concrete = constants.%Op.55a] +// CHECK:STDOUT: %bound_method.loc35_17.1: = bound_method %.loc35_17.2, %impl.elem0.loc35_17 +// CHECK:STDOUT: %specific_fn.loc35_17: = specific_function %impl.elem0.loc35_17, @Op.2(constants.%Goat) [concrete = constants.%Op.specific_fn.d9f] +// CHECK:STDOUT: %bound_method.loc35_17.2: = bound_method %.loc35_17.2, %specific_fn.loc35_17 +// CHECK:STDOUT: %.loc35_17.5: %Goat = bind_value %.loc35_17.2 +// CHECK:STDOUT: %no_op.loc35_17: init %empty_tuple.type = call %bound_method.loc35_17.2(%.loc35_17.5) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/facet/convert_facet_value_value_to_itself.carbon b/toolchain/check/testdata/facet/convert_facet_value_value_to_itself.carbon index bd530759a146..6053595e9c49 100644 --- a/toolchain/check/testdata/facet/convert_facet_value_value_to_itself.carbon +++ b/toolchain/check/testdata/facet/convert_facet_value_value_to_itself.carbon @@ -29,18 +29,18 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Animal.type: type = facet_type <@Animal> [concrete] -// CHECK:STDOUT: %Self: %Animal.type = bind_symbolic_name Self, 0 [symbolic] -// CHECK:STDOUT: %T: %Animal.type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Self.fd4: %Animal.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %T.fd4: %Animal.type = bind_symbolic_name T, 0 [symbolic] // CHECK:STDOUT: %pattern_type.3b0: type = pattern_type %Animal.type [concrete] -// CHECK:STDOUT: %T.as_type: type = facet_access_type %T [symbolic] +// CHECK:STDOUT: %T.as_type: type = facet_access_type %T.fd4 [symbolic] // CHECK:STDOUT: %pattern_type.36a: type = pattern_type %T.as_type [symbolic] // CHECK:STDOUT: %FeedAnimal.type: type = fn_type @FeedAnimal [concrete] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %FeedAnimal: %FeedAnimal.type = struct_value () [concrete] -// CHECK:STDOUT: %require_complete: = require_complete_type %T.as_type [symbolic] +// CHECK:STDOUT: %require_complete.234: = require_complete_type %T.as_type [symbolic] // CHECK:STDOUT: %HandleAnimal.type: type = fn_type @HandleAnimal [concrete] // CHECK:STDOUT: %HandleAnimal: %HandleAnimal.type = struct_value () [concrete] -// CHECK:STDOUT: %FeedAnimal.specific_fn.ec8: = specific_function %FeedAnimal, @FeedAnimal(%T) [symbolic] +// CHECK:STDOUT: %FeedAnimal.specific_fn.ec8: = specific_function %FeedAnimal, @FeedAnimal(%T.fd4) [symbolic] // CHECK:STDOUT: %Goat: type = class_type @Goat [concrete] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] @@ -51,14 +51,29 @@ fn F() { // CHECK:STDOUT: %Animal.facet: %Animal.type = facet_value %Goat, (%Animal.impl_witness) [concrete] // CHECK:STDOUT: %pattern_type.ab7: type = pattern_type %Goat [concrete] // CHECK:STDOUT: %HandleAnimal.specific_fn: = specific_function %HandleAnimal, @HandleAnimal(%Animal.facet) [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T.8b3: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl.49c(%T.8b3) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.b14: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%Goat) [concrete] +// CHECK:STDOUT: %Op.type.e7a: type = fn_type @Op.2, @impl.49c(%Goat) [concrete] +// CHECK:STDOUT: %Op.55a: %Op.type.e7a = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %Goat, (%Destroy.impl_witness.b14) [concrete] +// CHECK:STDOUT: %.095: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.55a, @Op.2(%Goat) [concrete] // CHECK:STDOUT: %FeedAnimal.specific_fn.82e: = specific_function %FeedAnimal, @FeedAnimal(%Animal.facet) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -78,10 +93,10 @@ fn F() { // CHECK:STDOUT: %a.param_patt: @FeedAnimal.%pattern_type (%pattern_type.36a) = value_param_pattern %a.patt, call_param0 [concrete] // CHECK:STDOUT: } { // CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] -// CHECK:STDOUT: %T.loc17_15.1: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc17_15.2 (constants.%T)] +// CHECK:STDOUT: %T.loc17_15.1: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc17_15.2 (constants.%T.fd4)] // CHECK:STDOUT: %a.param: @FeedAnimal.%T.as_type.loc17_30.2 (%T.as_type) = value_param call_param0 // CHECK:STDOUT: %.loc17_30.1: type = splice_block %.loc17_30.2 [symbolic = %T.as_type.loc17_30.2 (constants.%T.as_type)] { -// CHECK:STDOUT: %T.ref: %Animal.type = name_ref T, %T.loc17_15.1 [symbolic = %T.loc17_15.2 (constants.%T)] +// CHECK:STDOUT: %T.ref: %Animal.type = name_ref T, %T.loc17_15.1 [symbolic = %T.loc17_15.2 (constants.%T.fd4)] // CHECK:STDOUT: %T.as_type.loc17_30.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc17_30.2 (constants.%T.as_type)] // CHECK:STDOUT: %.loc17_30.2: type = converted %T.ref, %T.as_type.loc17_30.1 [symbolic = %T.as_type.loc17_30.2 (constants.%T.as_type)] // CHECK:STDOUT: } @@ -93,34 +108,34 @@ fn F() { // CHECK:STDOUT: %a.param_patt: @HandleAnimal.%pattern_type (%pattern_type.36a) = value_param_pattern %a.patt, call_param0 [concrete] // CHECK:STDOUT: } { // CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] -// CHECK:STDOUT: %T.loc19_17.1: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc19_17.2 (constants.%T)] +// CHECK:STDOUT: %T.loc19_17.1: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc19_17.2 (constants.%T.fd4)] // CHECK:STDOUT: %a.param: @HandleAnimal.%T.as_type.loc19_32.2 (%T.as_type) = value_param call_param0 // CHECK:STDOUT: %.loc19_32.1: type = splice_block %.loc19_32.2 [symbolic = %T.as_type.loc19_32.2 (constants.%T.as_type)] { -// CHECK:STDOUT: %T.ref: %Animal.type = name_ref T, %T.loc19_17.1 [symbolic = %T.loc19_17.2 (constants.%T)] +// CHECK:STDOUT: %T.ref: %Animal.type = name_ref T, %T.loc19_17.1 [symbolic = %T.loc19_17.2 (constants.%T.fd4)] // CHECK:STDOUT: %T.as_type.loc19_32.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc19_32.2 (constants.%T.as_type)] // CHECK:STDOUT: %.loc19_32.2: type = converted %T.ref, %T.as_type.loc19_32.1 [symbolic = %T.as_type.loc19_32.2 (constants.%T.as_type)] // CHECK:STDOUT: } // CHECK:STDOUT: %a: @HandleAnimal.%T.as_type.loc19_32.2 (%T.as_type) = bind_name a, %a.param // CHECK:STDOUT: } // CHECK:STDOUT: %Goat.decl: type = class_decl @Goat [concrete = constants.%Goat] {} {} -// CHECK:STDOUT: impl_decl @impl [concrete] {} { +// CHECK:STDOUT: impl_decl @impl.27e [concrete] {} { // CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] // CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %Animal.impl_witness_table = impl_witness_table (), @impl [concrete] +// CHECK:STDOUT: %Animal.impl_witness_table = impl_witness_table (), @impl.27e [concrete] // CHECK:STDOUT: %Animal.impl_witness: = impl_witness %Animal.impl_witness_table [concrete = constants.%Animal.impl_witness] // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Animal { -// CHECK:STDOUT: %Self: %Animal.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] +// CHECK:STDOUT: %Self: %Animal.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.fd4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: witness = () // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl: %Goat.ref as %Animal.ref { +// CHECK:STDOUT: impl @impl.27e: %Goat.ref as %Animal.ref { // CHECK:STDOUT: !members: // CHECK:STDOUT: witness = file.%Animal.impl_witness // CHECK:STDOUT: } @@ -135,12 +150,12 @@ fn F() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @FeedAnimal(%T.loc17_15.1: %Animal.type) { -// CHECK:STDOUT: %T.loc17_15.2: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc17_15.2 (constants.%T)] +// CHECK:STDOUT: %T.loc17_15.2: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc17_15.2 (constants.%T.fd4)] // CHECK:STDOUT: %T.as_type.loc17_30.2: type = facet_access_type %T.loc17_15.2 [symbolic = %T.as_type.loc17_30.2 (constants.%T.as_type)] // CHECK:STDOUT: %pattern_type: type = pattern_type %T.as_type.loc17_30.2 [symbolic = %pattern_type (constants.%pattern_type.36a)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type %T.as_type.loc17_30.2 [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %require_complete: = require_complete_type %T.as_type.loc17_30.2 [symbolic = %require_complete (constants.%require_complete.234)] // CHECK:STDOUT: // CHECK:STDOUT: fn(%a.param: @FeedAnimal.%T.as_type.loc17_30.2 (%T.as_type)) { // CHECK:STDOUT: !entry: @@ -149,21 +164,21 @@ fn F() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @HandleAnimal(%T.loc19_17.1: %Animal.type) { -// CHECK:STDOUT: %T.loc19_17.2: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc19_17.2 (constants.%T)] +// CHECK:STDOUT: %T.loc19_17.2: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc19_17.2 (constants.%T.fd4)] // CHECK:STDOUT: %T.as_type.loc19_32.2: type = facet_access_type %T.loc19_17.2 [symbolic = %T.as_type.loc19_32.2 (constants.%T.as_type)] // CHECK:STDOUT: %pattern_type: type = pattern_type %T.as_type.loc19_32.2 [symbolic = %pattern_type (constants.%pattern_type.36a)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type %T.as_type.loc19_32.2 [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %require_complete: = require_complete_type %T.as_type.loc19_32.2 [symbolic = %require_complete (constants.%require_complete.234)] // CHECK:STDOUT: %FeedAnimal.specific_fn.loc19_37.2: = specific_function constants.%FeedAnimal, @FeedAnimal(%T.loc19_17.2) [symbolic = %FeedAnimal.specific_fn.loc19_37.2 (constants.%FeedAnimal.specific_fn.ec8)] // CHECK:STDOUT: // CHECK:STDOUT: fn(%a.param: @HandleAnimal.%T.as_type.loc19_32.2 (%T.as_type)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %FeedAnimal.ref: %FeedAnimal.type = name_ref FeedAnimal, file.%FeedAnimal.decl [concrete = constants.%FeedAnimal] // CHECK:STDOUT: %a.ref: @HandleAnimal.%T.as_type.loc19_32.2 (%T.as_type) = name_ref a, %a -// CHECK:STDOUT: %.loc19_49.1: %Animal.type = converted constants.%T.as_type, constants.%T [symbolic = %T.loc19_17.2 (constants.%T)] -// CHECK:STDOUT: %.loc19_49.2: %Animal.type = converted constants.%T.as_type, constants.%T [symbolic = %T.loc19_17.2 (constants.%T)] -// CHECK:STDOUT: %FeedAnimal.specific_fn.loc19_37.1: = specific_function %FeedAnimal.ref, @FeedAnimal(constants.%T) [symbolic = %FeedAnimal.specific_fn.loc19_37.2 (constants.%FeedAnimal.specific_fn.ec8)] +// CHECK:STDOUT: %.loc19_49.1: %Animal.type = converted constants.%T.as_type, constants.%T.fd4 [symbolic = %T.loc19_17.2 (constants.%T.fd4)] +// CHECK:STDOUT: %.loc19_49.2: %Animal.type = converted constants.%T.as_type, constants.%T.fd4 [symbolic = %T.loc19_17.2 (constants.%T.fd4)] +// CHECK:STDOUT: %FeedAnimal.specific_fn.loc19_37.1: = specific_function %FeedAnimal.ref, @FeedAnimal(constants.%T.fd4) [symbolic = %FeedAnimal.specific_fn.loc19_37.2 (constants.%FeedAnimal.specific_fn.ec8)] // CHECK:STDOUT: %FeedAnimal.call: init %empty_tuple.type = call %FeedAnimal.specific_fn.loc19_37.1(%a.ref) // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -185,20 +200,26 @@ fn F() { // CHECK:STDOUT: %HandleAnimal.specific_fn: = specific_function %HandleAnimal.ref, @HandleAnimal(constants.%Animal.facet) [concrete = constants.%HandleAnimal.specific_fn] // CHECK:STDOUT: %.loc25_19.2: %Goat = bind_value %.loc25_19.1 // CHECK:STDOUT: %HandleAnimal.call: init %empty_tuple.type = call %HandleAnimal.specific_fn(%.loc25_19.2) +// CHECK:STDOUT: %impl.elem0: %.095 = impl_witness_access constants.%Destroy.impl_witness.b14, element0 [concrete = constants.%Op.55a] +// CHECK:STDOUT: %bound_method.loc25_17.1: = bound_method %.loc25_17.2, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%Goat) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc25_17.2: = bound_method %.loc25_17.2, %specific_fn +// CHECK:STDOUT: %.loc25_17.5: %Goat = bind_value %.loc25_17.2 +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc25_17.2(%.loc25_17.5) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @FeedAnimal(constants.%T) { -// CHECK:STDOUT: %T.loc17_15.2 => constants.%T +// CHECK:STDOUT: specific @FeedAnimal(constants.%T.fd4) { +// CHECK:STDOUT: %T.loc17_15.2 => constants.%T.fd4 // CHECK:STDOUT: %T.as_type.loc17_30.2 => constants.%T.as_type // CHECK:STDOUT: %pattern_type => constants.%pattern_type.36a // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete => constants.%require_complete +// CHECK:STDOUT: %require_complete => constants.%require_complete.234 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @HandleAnimal(constants.%T) { -// CHECK:STDOUT: %T.loc19_17.2 => constants.%T +// CHECK:STDOUT: specific @HandleAnimal(constants.%T.fd4) { +// CHECK:STDOUT: %T.loc19_17.2 => constants.%T.fd4 // CHECK:STDOUT: %T.as_type.loc19_32.2 => constants.%T.as_type // CHECK:STDOUT: %pattern_type => constants.%pattern_type.36a // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/facet/fail_deduction_uses_runtime_type_conversion.carbon b/toolchain/check/testdata/facet/fail_deduction_uses_runtime_type_conversion.carbon index b67716187799..51976b5b1f66 100644 --- a/toolchain/check/testdata/facet/fail_deduction_uses_runtime_type_conversion.carbon +++ b/toolchain/check/testdata/facet/fail_deduction_uses_runtime_type_conversion.carbon @@ -45,12 +45,12 @@ fn G(holds_to: HoldsType((RuntimeConvertTo, ))) { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %tuple.type: type = tuple_type (type) [concrete] -// CHECK:STDOUT: %T: %tuple.type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %T.6eb: %tuple.type = bind_symbolic_name T, 0 [symbolic] // CHECK:STDOUT: %pattern_type.f1e: type = pattern_type %tuple.type [concrete] // CHECK:STDOUT: %HoldsType.type: type = generic_class_type @HoldsType [concrete] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %HoldsType.generic: %HoldsType.type = struct_value () [concrete] -// CHECK:STDOUT: %HoldsType.cc9: type = class_type @HoldsType, @HoldsType(%T) [symbolic] +// CHECK:STDOUT: %HoldsType.cc9: type = class_type @HoldsType, @HoldsType(%T.6eb) [symbolic] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] // CHECK:STDOUT: %RuntimeConvertFrom: type = class_type @RuntimeConvertFrom [concrete] @@ -67,13 +67,13 @@ fn G(holds_to: HoldsType((RuntimeConvertTo, ))) { // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.580 = facet_value %RuntimeConvertFrom, (%ImplicitAs.impl_witness) [concrete] // CHECK:STDOUT: %RuntimeConvertTo.val: %RuntimeConvertTo = struct_value () [concrete] // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete] -// CHECK:STDOUT: %tuple.elem0: type = tuple_access %T, element0 [symbolic] +// CHECK:STDOUT: %tuple.elem0: type = tuple_access %T.6eb, element0 [symbolic] // CHECK:STDOUT: %A: %tuple.elem0 = bind_symbolic_name A, 1 [symbolic] // CHECK:STDOUT: %pattern_type.08e: type = pattern_type %tuple.elem0 [symbolic] // CHECK:STDOUT: %pattern_type.ec6: type = pattern_type %HoldsType.cc9 [symbolic] // CHECK:STDOUT: %F.type: type = fn_type @F [concrete] // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] -// CHECK:STDOUT: %require_complete: = require_complete_type %HoldsType.cc9 [symbolic] +// CHECK:STDOUT: %require_complete.514: = require_complete_type %HoldsType.cc9 [symbolic] // CHECK:STDOUT: %tuple: %tuple.type = tuple_value (%RuntimeConvertTo) [concrete] // CHECK:STDOUT: %HoldsType.066: type = class_type @HoldsType, @HoldsType(%tuple) [concrete] // CHECK:STDOUT: %pattern_type.a13: type = pattern_type %HoldsType.066 [concrete] @@ -83,15 +83,36 @@ fn G(holds_to: HoldsType((RuntimeConvertTo, ))) { // CHECK:STDOUT: %RuntimeConvertFrom.val: %RuntimeConvertFrom = struct_value () [concrete] // CHECK:STDOUT: %.f4e: type = fn_type_with_self_type %Convert.type.50a, %ImplicitAs.facet [concrete] // CHECK:STDOUT: %Convert.bound: = bound_method %from, %Convert.e81 [symbolic] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T.8b3: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl.49c(%T.8b3) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.3c9: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%RuntimeConvertTo) [concrete] +// CHECK:STDOUT: %Op.type.139: type = fn_type @Op.2, @impl.49c(%RuntimeConvertTo) [concrete] +// CHECK:STDOUT: %Op.d2d: %Op.type.139 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.31d: %Destroy.type = facet_value %RuntimeConvertTo, (%Destroy.impl_witness.3c9) [concrete] +// CHECK:STDOUT: %.79d: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.31d [concrete] +// CHECK:STDOUT: %Op.specific_fn.373: = specific_function %Op.d2d, @Op.2(%RuntimeConvertTo) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.fab: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%RuntimeConvertFrom) [concrete] +// CHECK:STDOUT: %Op.type.147: type = fn_type @Op.2, @impl.49c(%RuntimeConvertFrom) [concrete] +// CHECK:STDOUT: %Op.3f3: %Op.type.147 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.71e: %Destroy.type = facet_value %RuntimeConvertFrom, (%Destroy.impl_witness.fab) [concrete] +// CHECK:STDOUT: %.a98: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.71e [concrete] +// CHECK:STDOUT: %Op.specific_fn.5db: = specific_function %Op.3f3, @Op.2(%RuntimeConvertFrom) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -111,18 +132,18 @@ fn G(holds_to: HoldsType((RuntimeConvertTo, ))) { // CHECK:STDOUT: %.loc17_28.2: %tuple.type = tuple_literal (type) // CHECK:STDOUT: %.loc17_28.3: type = converted %.loc17_28.2, constants.%tuple.type [concrete = constants.%tuple.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc17_17.1: %tuple.type = bind_symbolic_name T, 0 [symbolic = %T.loc17_17.2 (constants.%T)] +// CHECK:STDOUT: %T.loc17_17.1: %tuple.type = bind_symbolic_name T, 0 [symbolic = %T.loc17_17.2 (constants.%T.6eb)] // CHECK:STDOUT: } // CHECK:STDOUT: %RuntimeConvertFrom.decl: type = class_decl @RuntimeConvertFrom [concrete = constants.%RuntimeConvertFrom] {} {} // CHECK:STDOUT: %RuntimeConvertTo.decl: type = class_decl @RuntimeConvertTo [concrete = constants.%RuntimeConvertTo] {} {} -// CHECK:STDOUT: impl_decl @impl [concrete] {} { +// CHECK:STDOUT: impl_decl @impl.423 [concrete] {} { // CHECK:STDOUT: %RuntimeConvertFrom.ref: type = name_ref RuntimeConvertFrom, file.%RuntimeConvertFrom.decl [concrete = constants.%RuntimeConvertFrom] // CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [concrete = imports.%Core] // CHECK:STDOUT: %ImplicitAs.ref: %ImplicitAs.type.cc7 = name_ref ImplicitAs, imports.%Core.ImplicitAs [concrete = constants.%ImplicitAs.generic] // CHECK:STDOUT: %RuntimeConvertTo.ref: type = name_ref RuntimeConvertTo, file.%RuntimeConvertTo.decl [concrete = constants.%RuntimeConvertTo] // CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(constants.%RuntimeConvertTo)> [concrete = constants.%ImplicitAs.type.580] // CHECK:STDOUT: } -// CHECK:STDOUT: %ImplicitAs.impl_witness_table = impl_witness_table (@impl.%Convert.decl), @impl [concrete] +// CHECK:STDOUT: %ImplicitAs.impl_witness_table = impl_witness_table (@impl.423.%Convert.decl), @impl.423 [concrete] // CHECK:STDOUT: %ImplicitAs.impl_witness: = impl_witness %ImplicitAs.impl_witness_table [concrete = constants.%ImplicitAs.impl_witness] // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] { // CHECK:STDOUT: %T.patt: %pattern_type.f1e = symbolic_binding_pattern T, 0 [concrete] @@ -134,9 +155,9 @@ fn G(holds_to: HoldsType((RuntimeConvertTo, ))) { // CHECK:STDOUT: %.loc27_17.2: %tuple.type = tuple_literal (type) // CHECK:STDOUT: %.loc27_17.3: type = converted %.loc27_17.2, constants.%tuple.type [concrete = constants.%tuple.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc27_6.1: %tuple.type = bind_symbolic_name T, 0 [symbolic = %T.loc27_6.2 (constants.%T)] +// CHECK:STDOUT: %T.loc27_6.1: %tuple.type = bind_symbolic_name T, 0 [symbolic = %T.loc27_6.2 (constants.%T.6eb)] // CHECK:STDOUT: %.loc27_25: type = splice_block %tuple.elem0.loc27_25.1 [symbolic = %tuple.elem0.loc27_25.2 (constants.%tuple.elem0)] { -// CHECK:STDOUT: %T.ref.loc27_24: %tuple.type = name_ref T, %T.loc27_6.1 [symbolic = %T.loc27_6.2 (constants.%T)] +// CHECK:STDOUT: %T.ref.loc27_24: %tuple.type = name_ref T, %T.loc27_6.1 [symbolic = %T.loc27_6.2 (constants.%T.6eb)] // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] // CHECK:STDOUT: %tuple.elem0.loc27_25.1: type = tuple_access %T.ref.loc27_24, element0 [symbolic = %tuple.elem0.loc27_25.2 (constants.%tuple.elem0)] // CHECK:STDOUT: } @@ -144,8 +165,8 @@ fn G(holds_to: HoldsType((RuntimeConvertTo, ))) { // CHECK:STDOUT: %x.param: @F.%HoldsType.loc27_43.2 (%HoldsType.cc9) = value_param call_param0 // CHECK:STDOUT: %.loc27_43: type = splice_block %HoldsType.loc27_43.1 [symbolic = %HoldsType.loc27_43.2 (constants.%HoldsType.cc9)] { // CHECK:STDOUT: %HoldsType.ref: %HoldsType.type = name_ref HoldsType, file.%HoldsType.decl [concrete = constants.%HoldsType.generic] -// CHECK:STDOUT: %T.ref.loc27_42: %tuple.type = name_ref T, %T.loc27_6.1 [symbolic = %T.loc27_6.2 (constants.%T)] -// CHECK:STDOUT: %HoldsType.loc27_43.1: type = class_type @HoldsType, @HoldsType(constants.%T) [symbolic = %HoldsType.loc27_43.2 (constants.%HoldsType.cc9)] +// CHECK:STDOUT: %T.ref.loc27_42: %tuple.type = name_ref T, %T.loc27_6.1 [symbolic = %T.loc27_6.2 (constants.%T.6eb)] +// CHECK:STDOUT: %HoldsType.loc27_43.1: type = class_type @HoldsType, @HoldsType(constants.%T.6eb) [symbolic = %HoldsType.loc27_43.2 (constants.%HoldsType.cc9)] // CHECK:STDOUT: } // CHECK:STDOUT: %x: @F.%HoldsType.loc27_43.2 (%HoldsType.cc9) = bind_name x, %x.param // CHECK:STDOUT: } @@ -166,7 +187,7 @@ fn G(holds_to: HoldsType((RuntimeConvertTo, ))) { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl: %RuntimeConvertFrom.ref as %ImplicitAs.type { +// CHECK:STDOUT: impl @impl.423: %RuntimeConvertFrom.ref as %ImplicitAs.type { // CHECK:STDOUT: %Convert.decl: %Convert.type.e8b = fn_decl @Convert.2 [concrete = constants.%Convert.e81] { // CHECK:STDOUT: %self.patt: %pattern_type.f64 = binding_pattern self [concrete] // CHECK:STDOUT: %self.param_patt: %pattern_type.f64 = value_param_pattern %self.patt, call_param0 [concrete] @@ -175,7 +196,7 @@ fn G(holds_to: HoldsType((RuntimeConvertTo, ))) { // CHECK:STDOUT: } { // CHECK:STDOUT: %RuntimeConvertTo.ref: type = name_ref RuntimeConvertTo, file.%RuntimeConvertTo.decl [concrete = constants.%RuntimeConvertTo] // CHECK:STDOUT: %self.param: %RuntimeConvertFrom = value_param call_param0 -// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.%RuntimeConvertFrom.ref [concrete = constants.%RuntimeConvertFrom] +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.423.%RuntimeConvertFrom.ref [concrete = constants.%RuntimeConvertFrom] // CHECK:STDOUT: %self: %RuntimeConvertFrom = bind_name self, %self.param // CHECK:STDOUT: %return.param: ref %RuntimeConvertTo = out_param call_param1 // CHECK:STDOUT: %return: ref %RuntimeConvertTo = return_slot %return.param @@ -188,7 +209,7 @@ fn G(holds_to: HoldsType((RuntimeConvertTo, ))) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic class @HoldsType(%T.loc17_17.1: %tuple.type) { -// CHECK:STDOUT: %T.loc17_17.2: %tuple.type = bind_symbolic_name T, 0 [symbolic = %T.loc17_17.2 (constants.%T)] +// CHECK:STDOUT: %T.loc17_17.2: %tuple.type = bind_symbolic_name T, 0 [symbolic = %T.loc17_17.2 (constants.%T.6eb)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -229,7 +250,7 @@ fn G(holds_to: HoldsType((RuntimeConvertTo, ))) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @F(%T.loc27_6.1: %tuple.type, %A.loc27_20.1: @F.%tuple.elem0.loc27_25.2 (%tuple.elem0)) { -// CHECK:STDOUT: %T.loc27_6.2: %tuple.type = bind_symbolic_name T, 0 [symbolic = %T.loc27_6.2 (constants.%T)] +// CHECK:STDOUT: %T.loc27_6.2: %tuple.type = bind_symbolic_name T, 0 [symbolic = %T.loc27_6.2 (constants.%T.6eb)] // CHECK:STDOUT: %tuple.elem0.loc27_25.2: type = tuple_access %T.loc27_6.2, element0 [symbolic = %tuple.elem0.loc27_25.2 (constants.%tuple.elem0)] // CHECK:STDOUT: %A.loc27_20.2: @F.%tuple.elem0.loc27_25.2 (%tuple.elem0) = bind_symbolic_name A, 1 [symbolic = %A.loc27_20.2 (constants.%A)] // CHECK:STDOUT: %pattern_type.loc27_20: type = pattern_type %tuple.elem0.loc27_25.2 [symbolic = %pattern_type.loc27_20 (constants.%pattern_type.08e)] @@ -237,7 +258,7 @@ fn G(holds_to: HoldsType((RuntimeConvertTo, ))) { // CHECK:STDOUT: %pattern_type.loc27_29: type = pattern_type %HoldsType.loc27_43.2 [symbolic = %pattern_type.loc27_29 (constants.%pattern_type.ec6)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type %HoldsType.loc27_43.2 [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %require_complete: = require_complete_type %HoldsType.loc27_43.2 [symbolic = %require_complete (constants.%require_complete.514)] // CHECK:STDOUT: // CHECK:STDOUT: fn(%x.param: @F.%HoldsType.loc27_43.2 (%HoldsType.cc9)) { // CHECK:STDOUT: !entry: @@ -262,26 +283,38 @@ fn G(holds_to: HoldsType((RuntimeConvertTo, ))) { // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] // CHECK:STDOUT: %from.ref: %RuntimeConvertFrom = name_ref from, %from [symbolic = constants.%from] // CHECK:STDOUT: %holds_to.ref: %HoldsType.066 = name_ref holds_to, %holds_to -// CHECK:STDOUT: %impl.elem0: %.f4e = impl_witness_access constants.%ImplicitAs.impl_witness, element0 [concrete = constants.%Convert.e81] -// CHECK:STDOUT: %bound_method: = bound_method constants.%from, %impl.elem0 [symbolic = constants.%Convert.bound] +// CHECK:STDOUT: %impl.elem0.loc41_19.1: %.f4e = impl_witness_access constants.%ImplicitAs.impl_witness, element0 [concrete = constants.%Convert.e81] +// CHECK:STDOUT: %bound_method.loc41_19.1: = bound_method constants.%from, %impl.elem0.loc41_19.1 [symbolic = constants.%Convert.bound] // CHECK:STDOUT: %.loc41_19.1: ref %RuntimeConvertTo = temporary_storage -// CHECK:STDOUT: %Convert.call: init %RuntimeConvertTo = call %bound_method(constants.%from) to %.loc41_19.1 +// CHECK:STDOUT: %Convert.call: init %RuntimeConvertTo = call %bound_method.loc41_19.1(constants.%from) to %.loc41_19.1 // CHECK:STDOUT: %.loc41_19.2: init %RuntimeConvertTo = converted constants.%from, %Convert.call // CHECK:STDOUT: %.loc41_19.3: ref %RuntimeConvertTo = temporary %.loc41_19.1, %.loc41_19.2 // CHECK:STDOUT: %.loc41_19.4: %RuntimeConvertTo = bind_value %.loc41_19.3 // CHECK:STDOUT: %F.specific_fn: = specific_function %F.ref, @F(constants.%tuple, ) [concrete = ] // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.specific_fn(%holds_to.ref) [concrete = ] +// CHECK:STDOUT: %impl.elem0.loc41_19.2: %.79d = impl_witness_access constants.%Destroy.impl_witness.3c9, element0 [concrete = constants.%Op.d2d] +// CHECK:STDOUT: %bound_method.loc41_19.2: = bound_method %.loc41_19.1, %impl.elem0.loc41_19.2 +// CHECK:STDOUT: %specific_fn.loc41: = specific_function %impl.elem0.loc41_19.2, @Op.2(constants.%RuntimeConvertTo) [concrete = constants.%Op.specific_fn.373] +// CHECK:STDOUT: %bound_method.loc41_19.3: = bound_method %.loc41_19.1, %specific_fn.loc41 +// CHECK:STDOUT: %.loc41_19.5: %RuntimeConvertTo = bind_value %.loc41_19.1 +// CHECK:STDOUT: %no_op.loc41: init %empty_tuple.type = call %bound_method.loc41_19.3(%.loc41_19.5) +// CHECK:STDOUT: %impl.elem0.loc30: %.a98 = impl_witness_access constants.%Destroy.impl_witness.fab, element0 [concrete = constants.%Op.3f3] +// CHECK:STDOUT: %bound_method.loc30_36.1: = bound_method %.loc30_36.2, %impl.elem0.loc30 +// CHECK:STDOUT: %specific_fn.loc30: = specific_function %impl.elem0.loc30, @Op.2(constants.%RuntimeConvertFrom) [concrete = constants.%Op.specific_fn.5db] +// CHECK:STDOUT: %bound_method.loc30_36.2: = bound_method %.loc30_36.2, %specific_fn.loc30 +// CHECK:STDOUT: %.loc30_36.5: %RuntimeConvertFrom = bind_value %.loc30_36.2 +// CHECK:STDOUT: %no_op.loc30: init %empty_tuple.type = call %bound_method.loc30_36.2(%.loc30_36.5) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @HoldsType(constants.%T) { -// CHECK:STDOUT: %T.loc17_17.2 => constants.%T +// CHECK:STDOUT: specific @HoldsType(constants.%T.6eb) { +// CHECK:STDOUT: %T.loc17_17.2 => constants.%T.6eb // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F(constants.%T, constants.%A) { -// CHECK:STDOUT: %T.loc27_6.2 => constants.%T +// CHECK:STDOUT: specific @F(constants.%T.6eb, constants.%A) { +// CHECK:STDOUT: %T.loc27_6.2 => constants.%T.6eb // CHECK:STDOUT: %tuple.elem0.loc27_25.2 => constants.%tuple.elem0 // CHECK:STDOUT: %A.loc27_20.2 => constants.%A // CHECK:STDOUT: %pattern_type.loc27_20 => constants.%pattern_type.08e diff --git a/toolchain/check/testdata/for/actual.carbon b/toolchain/check/testdata/for/actual.carbon new file mode 100644 index 000000000000..409bea7f8c04 --- /dev/null +++ b/toolchain/check/testdata/for/actual.carbon @@ -0,0 +1,1110 @@ +// Part of the Carbon Language project, under the Apache License v2.0 with LLVM +// Exceptions. See /LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// EXTRA-ARGS: --dump-sem-ir-ranges=if-present +// +// AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/for/actual.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/for/actual.carbon + +// --- lib.carbon + +library "lib"; + +class IntRange(N:! Core.IntLiteral()) { + fn Make(start: Core.Int(N), end: Core.Int(N)) -> Self { + return {.start = start, .end = end}; + } + + impl as Core.Iterate where .CursorType = Core.Int(N) and .ElementType = Core.Int(N) { + fn NewCursor[self: Self]() -> Core.Int(N) { return self.start; } + fn Next[self: Self](cursor: Core.Int(N)*) -> Core.Optional(Core.Int(N)) { + var value: Core.Int(N) = *cursor; + if (value < self.end) { + ++*cursor; + return Core.Optional(Core.Int(N)).Some(value); + } else { + return Core.Optional(Core.Int(N)).None(); + } + } + } + + private var start: Core.Int(N); + private var end: Core.Int(N); +} + +fn Range(end: i32) -> IntRange(32) { + return IntRange(32).Make(0, end); +} + +// --- trivial.carbon + +import library "lib"; + +fn Read() { + let y:! Core.IntLiteral() = 43; + var x: IntRange(32) = Range(y); +} + +// CHECK:STDOUT: --- lib.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [concrete] +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic] +// CHECK:STDOUT: %pattern_type.dc0: type = pattern_type Core.IntLiteral [concrete] +// CHECK:STDOUT: %IntRange.type: type = generic_class_type @IntRange [concrete] +// CHECK:STDOUT: %IntRange.generic: %IntRange.type = struct_value () [concrete] +// CHECK:STDOUT: %IntRange.349: type = class_type @IntRange, @IntRange(%N) [symbolic] +// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] +// CHECK:STDOUT: %Int.49d0e6.1: type = class_type @Int, @Int(%N) [symbolic] +// CHECK:STDOUT: %pattern_type.8963eb.1: type = pattern_type %Int.49d0e6.1 [symbolic] +// CHECK:STDOUT: %pattern_type.dcd: type = pattern_type %IntRange.349 [symbolic] +// CHECK:STDOUT: %Make.type.51f: type = fn_type @Make, @IntRange(%N) [symbolic] +// CHECK:STDOUT: %Make.2ec: %Make.type.51f = struct_value () [symbolic] +// CHECK:STDOUT: %Iterate.type: type = facet_type <@Iterate> [concrete] +// CHECK:STDOUT: %Self.a96: %Iterate.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %.Self.ef1: %Iterate.type = bind_symbolic_name .Self [symbolic_self] +// CHECK:STDOUT: %Iterate.assoc_type: type = assoc_entity_type @Iterate [concrete] +// CHECK:STDOUT: %assoc1.02e: %Iterate.assoc_type = assoc_entity element1, imports.%Core.import_ref.9e6 [concrete] +// CHECK:STDOUT: %.Self.as_type.935: type = facet_access_type %.Self.ef1 [symbolic_self] +// CHECK:STDOUT: %Iterate.lookup_impl_witness.65a: = lookup_impl_witness %.Self.ef1, @Iterate [symbolic_self] +// CHECK:STDOUT: %Iterate.facet.7f1: %Iterate.type = facet_value %.Self.as_type.935, (%Iterate.lookup_impl_witness.65a) [symbolic_self] +// CHECK:STDOUT: %impl.elem1.164: type = impl_witness_access %Iterate.lookup_impl_witness.65a, element1 [symbolic_self] +// CHECK:STDOUT: %assoc0.724: %Iterate.assoc_type = assoc_entity element0, imports.%Core.import_ref.4f9 [concrete] +// CHECK:STDOUT: %impl.elem0.19f: type = impl_witness_access %Iterate.lookup_impl_witness.65a, element0 [symbolic_self] +// CHECK:STDOUT: %Iterate_where.type: type = facet_type <@Iterate where %impl.elem1.164 = %Int.49d0e6.1 and %impl.elem0.19f = %Int.49d0e6.1> [symbolic] +// CHECK:STDOUT: %require_complete.d96: = require_complete_type %Iterate_where.type [symbolic] +// CHECK:STDOUT: %Optional.type: type = generic_class_type @Optional [concrete] +// CHECK:STDOUT: %Optional.generic: %Optional.type = struct_value () [concrete] +// CHECK:STDOUT: %T.8b3: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %None.type.ef2: type = fn_type @None, @Optional(%T.8b3) [symbolic] +// CHECK:STDOUT: %None.fd6: %None.type.ef2 = struct_value () [symbolic] +// CHECK:STDOUT: %Some.type.b2c: type = fn_type @Some, @Optional(%T.8b3) [symbolic] +// CHECK:STDOUT: %Some.d0d: %Some.type.b2c = struct_value () [symbolic] +// CHECK:STDOUT: %Iterate.impl_witness: = impl_witness @IntRange.%Iterate.impl_witness_table, @impl.7a3(%N) [symbolic] +// CHECK:STDOUT: %NewCursor.type.b02: type = fn_type @NewCursor.2, @impl.7a3(%N) [symbolic] +// CHECK:STDOUT: %NewCursor.f32: %NewCursor.type.b02 = struct_value () [symbolic] +// CHECK:STDOUT: %ptr.784: type = ptr_type %Int.49d0e6.1 [symbolic] +// CHECK:STDOUT: %pattern_type.4dc: type = pattern_type %ptr.784 [symbolic] +// CHECK:STDOUT: %Optional.708: type = class_type @Optional, @Optional(%Int.49d0e6.1) [symbolic] +// CHECK:STDOUT: %pattern_type.4b1: type = pattern_type %Optional.708 [symbolic] +// CHECK:STDOUT: %Next.type.2c8: type = fn_type @Next.2, @impl.7a3(%N) [symbolic] +// CHECK:STDOUT: %Next.259: %Next.type.2c8 = struct_value () [symbolic] +// CHECK:STDOUT: %require_complete.b4f426.1: = require_complete_type %Int.49d0e6.1 [symbolic] +// CHECK:STDOUT: %IntRange.elem.e7c: type = unbound_element_type %IntRange.349, %Int.49d0e6.1 [symbolic] +// CHECK:STDOUT: %struct_type.start.end.78d: type = struct_type {.start: %Int.49d0e6.1, .end: %Int.49d0e6.1} [symbolic] +// CHECK:STDOUT: %complete_type.9d5: = complete_type_witness %struct_type.start.end.78d [symbolic] +// CHECK:STDOUT: %require_complete.524: = require_complete_type %IntRange.349 [symbolic] +// CHECK:STDOUT: %None.type.73a: type = fn_type @None, @Optional(%Int.49d0e6.1) [symbolic] +// CHECK:STDOUT: %None.83e: %None.type.73a = struct_value () [symbolic] +// CHECK:STDOUT: %Some.type.185: type = fn_type @Some, @Optional(%Int.49d0e6.1) [symbolic] +// CHECK:STDOUT: %Some.58a: %Some.type.185 = struct_value () [symbolic] +// CHECK:STDOUT: %require_complete.b74: = require_complete_type %Optional.708 [symbolic] +// CHECK:STDOUT: %require_complete.0f5: = require_complete_type %ptr.784 [symbolic] +// CHECK:STDOUT: %OrderedWith.type.270: type = generic_interface_type @OrderedWith [concrete] +// CHECK:STDOUT: %OrderedWith.generic: %OrderedWith.type.270 = struct_value () [concrete] +// CHECK:STDOUT: %Other: type = bind_symbolic_name Other, 0 [symbolic] +// CHECK:STDOUT: %Less.type.f19: type = fn_type @Less.1, @OrderedWith(%Other) [symbolic] +// CHECK:STDOUT: %Less.02e: %Less.type.f19 = struct_value () [symbolic] +// CHECK:STDOUT: %OrderedWith.assoc_type.03c: type = assoc_entity_type @OrderedWith, @OrderedWith(%Other) [symbolic] +// CHECK:STDOUT: %OrderedWith.type.872: type = facet_type <@OrderedWith, @OrderedWith(%Int.49d0e6.1)> [symbolic] +// CHECK:STDOUT: %Less.type.8fe: type = fn_type @Less.1, @OrderedWith(%Int.49d0e6.1) [symbolic] +// CHECK:STDOUT: %OrderedWith.assoc_type.d92: type = assoc_entity_type @OrderedWith, @OrderedWith(%Int.49d0e6.1) [symbolic] +// CHECK:STDOUT: %assoc0.2ae: %OrderedWith.assoc_type.d92 = assoc_entity element0, imports.%Core.import_ref.910 [symbolic] +// CHECK:STDOUT: %require_complete.66b6: = require_complete_type %OrderedWith.type.872 [symbolic] +// CHECK:STDOUT: %assoc0.3c6: %OrderedWith.assoc_type.03c = assoc_entity element0, imports.%Core.import_ref.146ebd.1 [symbolic] +// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete] +// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete] +// CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic] +// CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic] +// CHECK:STDOUT: %M: Core.IntLiteral = bind_symbolic_name M, 1 [symbolic] +// CHECK:STDOUT: %Less.type.2c7: type = fn_type @Less.2, @impl.db3(%N, %M) [symbolic] +// CHECK:STDOUT: %Less.a5a: %Less.type.2c7 = struct_value () [symbolic] +// CHECK:STDOUT: %Inc.type: type = facet_type <@Inc> [concrete] +// CHECK:STDOUT: %OrderedWith.impl_witness.df5: = impl_witness imports.%OrderedWith.impl_witness_table.2b2, @impl.db3(%N, %N) [symbolic] +// CHECK:STDOUT: %Less.type.98c: type = fn_type @Less.2, @impl.db3(%N, %N) [symbolic] +// CHECK:STDOUT: %Less.4be: %Less.type.98c = struct_value () [symbolic] +// CHECK:STDOUT: %OrderedWith.facet: %OrderedWith.type.872 = facet_value %Int.49d0e6.1, (%OrderedWith.impl_witness.df5) [symbolic] +// CHECK:STDOUT: %.99c: type = fn_type_with_self_type %Less.type.8fe, %OrderedWith.facet [symbolic] +// CHECK:STDOUT: %Less.specific_fn.bb3: = specific_function %Less.4be, @Less.2(%N, %N) [symbolic] +// CHECK:STDOUT: %Op.type.e3a: type = fn_type @Op.95 [concrete] +// CHECK:STDOUT: %Inc.lookup_impl_witness: = lookup_impl_witness %Int.49d0e6.1, @Inc [symbolic] +// CHECK:STDOUT: %Inc.facet: %Inc.type = facet_value %Int.49d0e6.1, (%Inc.lookup_impl_witness) [symbolic] +// CHECK:STDOUT: %.a0d: type = fn_type_with_self_type %Op.type.e3a, %Inc.facet [symbolic] +// CHECK:STDOUT: %impl.elem0.437: %.a0d = impl_witness_access %Inc.lookup_impl_witness, element0 [symbolic] +// CHECK:STDOUT: %specific_impl_fn.a5f: = specific_impl_function %impl.elem0.437, @Op.95(%Inc.facet) [symbolic] +// CHECK:STDOUT: %Some.specific_fn: = specific_function %Some.58a, @Some(%Int.49d0e6.1) [symbolic] +// CHECK:STDOUT: %None.specific_fn: = specific_function %None.83e, @None(%Int.49d0e6.1) [symbolic] +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] +// CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete] +// CHECK:STDOUT: %IntRange.365: type = class_type @IntRange, @IntRange(%int_32) [concrete] +// CHECK:STDOUT: %pattern_type.d16: type = pattern_type %IntRange.365 [concrete] +// CHECK:STDOUT: %Range.type: type = fn_type @Range [concrete] +// CHECK:STDOUT: %Range: %Range.type = struct_value () [concrete] +// CHECK:STDOUT: %Make.type.cef: type = fn_type @Make, @IntRange(%int_32) [concrete] +// CHECK:STDOUT: %Make.0dc: %Make.type.cef = struct_value () [concrete] +// CHECK:STDOUT: %i32.builtin: type = int_type signed, %int_32 [concrete] +// CHECK:STDOUT: %complete_type.f8a: = complete_type_witness %i32.builtin [concrete] +// CHECK:STDOUT: %IntRange.elem.e33: type = unbound_element_type %IntRange.365, %i32 [concrete] +// CHECK:STDOUT: %struct_type.start.end.d0a: type = struct_type {.start: %i32, .end: %i32} [concrete] +// CHECK:STDOUT: %complete_type.c45: = complete_type_witness %struct_type.start.end.d0a [concrete] +// CHECK:STDOUT: %int_0.5c6: Core.IntLiteral = int_value 0 [concrete] +// CHECK:STDOUT: %Make.specific_fn: = specific_function %Make.0dc, @Make(%int_32) [concrete] +// CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete] +// CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete] +// CHECK:STDOUT: %ImplicitAs.impl_witness.c75: = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete] +// CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete] +// CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.facet.921: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete] +// CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet.921 [concrete] +// CHECK:STDOUT: %Convert.bound: = bound_method %int_0.5c6, %Convert.956 [concrete] +// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.956, @Convert.2(%int_32) [concrete] +// CHECK:STDOUT: %bound_method: = bound_method %int_0.5c6, %Convert.specific_fn [concrete] +// CHECK:STDOUT: %int_0.6a9: %i32 = int_value 0 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .IntLiteral = %Core.IntLiteral +// CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .Iterate = %Core.Iterate +// CHECK:STDOUT: .Optional = %Core.Optional +// CHECK:STDOUT: .OrderedWith = %Core.OrderedWith +// CHECK:STDOUT: .Inc = %Core.Inc +// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.IntLiteral: %IntLiteral.type = import_ref Core//prelude/types/int_literal, IntLiteral, loaded [concrete = constants.%IntLiteral] +// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %Core.Iterate: type = import_ref Core//prelude/iterate, Iterate, loaded [concrete = constants.%Iterate.type] +// CHECK:STDOUT: %Core.import_ref.1c9: %Iterate.assoc_type = import_ref Core//prelude/iterate, loc10_18, loaded [concrete = constants.%assoc0.724] +// CHECK:STDOUT: %Core.import_ref.ed6: %Iterate.assoc_type = import_ref Core//prelude/iterate, loc11_17, loaded [concrete = constants.%assoc1.02e] +// CHECK:STDOUT: %Core.import_ref.9e6: type = import_ref Core//prelude/iterate, loc11_17, loaded [concrete = %CursorType] +// CHECK:STDOUT: %CursorType: type = assoc_const_decl @CursorType [concrete] {} +// CHECK:STDOUT: %Core.import_ref.4f9: type = import_ref Core//prelude/iterate, loc10_18, loaded [concrete = %ElementType] +// CHECK:STDOUT: %ElementType: type = assoc_const_decl @ElementType [concrete] {} +// CHECK:STDOUT: %Core.import_ref.2b7: @Optional.%None.type (%None.type.ef2) = import_ref Core//prelude/iterate, inst96 [indirect], loaded [symbolic = @Optional.%None (constants.%None.fd6)] +// CHECK:STDOUT: %Core.import_ref.5c6: @Optional.%Some.type (%Some.type.b2c) = import_ref Core//prelude/iterate, inst97 [indirect], loaded [symbolic = @Optional.%Some (constants.%Some.d0d)] +// CHECK:STDOUT: %Core.Optional: %Optional.type = import_ref Core//prelude/types/optional, Optional, loaded [concrete = constants.%Optional.generic] +// CHECK:STDOUT: %Core.OrderedWith: %OrderedWith.type.270 = import_ref Core//prelude/operators/comparison, OrderedWith, loaded [concrete = constants.%OrderedWith.generic] +// CHECK:STDOUT: %Core.import_ref.1cc: @OrderedWith.%OrderedWith.assoc_type (%OrderedWith.assoc_type.03c) = import_ref Core//prelude/operators/comparison, loc26_44, loaded [symbolic = @OrderedWith.%assoc0 (constants.%assoc0.3c6)] +// CHECK:STDOUT: %Core.import_ref.910: @OrderedWith.%Less.type (%Less.type.f19) = import_ref Core//prelude/operators/comparison, loc26_44, loaded [symbolic = @OrderedWith.%Less (constants.%Less.02e)] +// CHECK:STDOUT: %Core.import_ref.146ebd.1 = import_ref Core//prelude/operators/comparison, loc26_44, unloaded +// CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] +// CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: %Core.import_ref.a5f: @impl.db3.%Less.type (%Less.type.2c7) = import_ref Core//prelude/types/int, loc51_46, loaded [symbolic = @impl.db3.%Less (constants.%Less.a5a)] +// CHECK:STDOUT: %Core.import_ref.a58 = import_ref Core//prelude/types/int, loc52_58, unloaded +// CHECK:STDOUT: %Core.import_ref.a39 = import_ref Core//prelude/types/int, loc53_49, unloaded +// CHECK:STDOUT: %Core.import_ref.c4c = import_ref Core//prelude/types/int, loc54_61, unloaded +// CHECK:STDOUT: %OrderedWith.impl_witness_table.2b2 = impl_witness_table (%Core.import_ref.a5f, %Core.import_ref.a58, %Core.import_ref.a39, %Core.import_ref.c4c), @impl.db3 [concrete] +// CHECK:STDOUT: %Core.Inc: type = import_ref Core//prelude/operators/arithmetic, Inc, loaded [concrete = constants.%Inc.type] +// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .IntRange = %IntRange.decl +// CHECK:STDOUT: .Range = %Range.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %IntRange.decl: %IntRange.type = class_decl @IntRange [concrete = constants.%IntRange.generic] { +// CHECK:STDOUT: %N.patt: %pattern_type.dc0 = symbolic_binding_pattern N, 0 [concrete] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %.loc4_36.1: type = splice_block %.loc4_36.3 [concrete = Core.IntLiteral] { +// CHECK:STDOUT: %Core.ref.loc4: = name_ref Core, imports.%Core [concrete = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%Core.IntLiteral [concrete = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [concrete = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_36.2: type = value_of_initializer %int_literal.make_type [concrete = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_36.3: type = converted %int_literal.make_type, %.loc4_36.2 [concrete = Core.IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: %N.loc4_16.1: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N.loc4_16.2 (constants.%N)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %Range.decl: %Range.type = fn_decl @Range [concrete = constants.%Range] { +// CHECK:STDOUT: %end.patt: %pattern_type.7ce = binding_pattern end [concrete] +// CHECK:STDOUT: %end.param_patt: %pattern_type.7ce = value_param_pattern %end.patt, call_param0 [concrete] +// CHECK:STDOUT: %return.patt: %pattern_type.d16 = return_slot_pattern [concrete] +// CHECK:STDOUT: %return.param_patt: %pattern_type.d16 = out_param_pattern %return.patt, call_param1 [concrete] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %IntRange.ref.loc26: %IntRange.type = name_ref IntRange, file.%IntRange.decl [concrete = constants.%IntRange.generic] +// CHECK:STDOUT: %int_32.loc26_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %IntRange.loc26: type = class_type @IntRange, @IntRange(constants.%int_32) [concrete = constants.%IntRange.365] +// CHECK:STDOUT: %end.param: %i32 = value_param call_param0 +// CHECK:STDOUT: %.loc26_15: type = splice_block %i32 [concrete = constants.%i32] { +// CHECK:STDOUT: %int_32.loc26_15: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: } +// CHECK:STDOUT: %end: %i32 = bind_name end, %end.param +// CHECK:STDOUT: %return.param: ref %IntRange.365 = out_param call_param1 +// CHECK:STDOUT: %return: ref %IntRange.365 = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.7a3(@IntRange.%N.loc4_16.1: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %IntRange: type = class_type @IntRange, @IntRange(%N) [symbolic = %IntRange (constants.%IntRange.349)] +// CHECK:STDOUT: %Int.loc9_54.2: type = class_type @Int, @Int(%N) [symbolic = %Int.loc9_54.2 (constants.%Int.49d0e6.1)] +// CHECK:STDOUT: %Iterate_where.type: type = facet_type <@Iterate where constants.%impl.elem1.164 = %Int.loc9_54.2 and constants.%impl.elem0.19f = %Int.loc9_54.2> [symbolic = %Iterate_where.type (constants.%Iterate_where.type)] +// CHECK:STDOUT: %require_complete: = require_complete_type %Iterate_where.type [symbolic = %require_complete (constants.%require_complete.d96)] +// CHECK:STDOUT: %Iterate.impl_witness: = impl_witness @IntRange.%Iterate.impl_witness_table, @impl.7a3(%N) [symbolic = %Iterate.impl_witness (constants.%Iterate.impl_witness)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %NewCursor.type: type = fn_type @NewCursor.2, @impl.7a3(%N) [symbolic = %NewCursor.type (constants.%NewCursor.type.b02)] +// CHECK:STDOUT: %NewCursor: @impl.7a3.%NewCursor.type (%NewCursor.type.b02) = struct_value () [symbolic = %NewCursor (constants.%NewCursor.f32)] +// CHECK:STDOUT: %Next.type: type = fn_type @Next.2, @impl.7a3(%N) [symbolic = %Next.type (constants.%Next.type.2c8)] +// CHECK:STDOUT: %Next: @impl.7a3.%Next.type (%Next.type.2c8) = struct_value () [symbolic = %Next (constants.%Next.259)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: %Self.ref as %.loc9_24 { +// CHECK:STDOUT: %NewCursor.decl: @impl.7a3.%NewCursor.type (%NewCursor.type.b02) = fn_decl @NewCursor.2 [symbolic = @impl.7a3.%NewCursor (constants.%NewCursor.f32)] { +// CHECK:STDOUT: %self.patt: @NewCursor.2.%pattern_type.loc10_18 (%pattern_type.dcd) = binding_pattern self [concrete] +// CHECK:STDOUT: %self.param_patt: @NewCursor.2.%pattern_type.loc10_18 (%pattern_type.dcd) = value_param_pattern %self.patt, call_param0 [concrete] +// CHECK:STDOUT: %return.patt: @NewCursor.2.%pattern_type.loc10_32 (%pattern_type.8963eb.1) = return_slot_pattern [concrete] +// CHECK:STDOUT: %return.param_patt: @NewCursor.2.%pattern_type.loc10_32 (%pattern_type.8963eb.1) = out_param_pattern %return.patt, call_param1 [concrete] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [concrete = imports.%Core] +// CHECK:STDOUT: %Int.ref: %Int.type = name_ref Int, imports.%Core.Int [concrete = constants.%Int.generic] +// CHECK:STDOUT: %N.ref: Core.IntLiteral = name_ref N, @IntRange.%N.loc4_16.1 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %Int.loc10_45.2: type = class_type @Int, @Int(constants.%N) [symbolic = %Int.loc10_45.1 (constants.%Int.49d0e6.1)] +// CHECK:STDOUT: %self.param: @NewCursor.2.%IntRange (%IntRange.349) = value_param call_param0 +// CHECK:STDOUT: %.loc10_24.1: type = splice_block %Self.ref [symbolic = %IntRange (constants.%IntRange.349)] { +// CHECK:STDOUT: %.loc10_24.2: type = specific_constant constants.%IntRange.349, @IntRange(constants.%N) [symbolic = %IntRange (constants.%IntRange.349)] +// CHECK:STDOUT: %Self.ref: type = name_ref Self, %.loc10_24.2 [symbolic = %IntRange (constants.%IntRange.349)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @NewCursor.2.%IntRange (%IntRange.349) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @NewCursor.2.%Int.loc10_45.1 (%Int.49d0e6.1) = out_param call_param1 +// CHECK:STDOUT: %return: ref @NewCursor.2.%Int.loc10_45.1 (%Int.49d0e6.1) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Next.decl: @impl.7a3.%Next.type (%Next.type.2c8) = fn_decl @Next.2 [symbolic = @impl.7a3.%Next (constants.%Next.259)] { +// CHECK:STDOUT: %self.patt: @Next.2.%pattern_type.loc11_13 (%pattern_type.dcd) = binding_pattern self [concrete] +// CHECK:STDOUT: %self.param_patt: @Next.2.%pattern_type.loc11_13 (%pattern_type.dcd) = value_param_pattern %self.patt, call_param0 [concrete] +// CHECK:STDOUT: %cursor.patt: @Next.2.%pattern_type.loc11_25 (%pattern_type.4dc) = binding_pattern cursor [concrete] +// CHECK:STDOUT: %cursor.param_patt: @Next.2.%pattern_type.loc11_25 (%pattern_type.4dc) = value_param_pattern %cursor.patt, call_param1 [concrete] +// CHECK:STDOUT: %return.patt: @Next.2.%pattern_type.loc11_47 (%pattern_type.4b1) = return_slot_pattern [concrete] +// CHECK:STDOUT: %return.param_patt: @Next.2.%pattern_type.loc11_47 (%pattern_type.4b1) = out_param_pattern %return.patt, call_param2 [concrete] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref.loc11_50: = name_ref Core, imports.%Core [concrete = imports.%Core] +// CHECK:STDOUT: %Optional.ref.loc11: %Optional.type = name_ref Optional, imports.%Core.Optional [concrete = constants.%Optional.generic] +// CHECK:STDOUT: %Core.ref.loc11_64: = name_ref Core, imports.%Core [concrete = imports.%Core] +// CHECK:STDOUT: %Int.ref.loc11_68: %Int.type = name_ref Int, imports.%Core.Int [concrete = constants.%Int.generic] +// CHECK:STDOUT: %N.ref.loc11_73: Core.IntLiteral = name_ref N, @IntRange.%N.loc4_16.1 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %Int.loc11_74: type = class_type @Int, @Int(constants.%N) [symbolic = %Int.loc11_43.1 (constants.%Int.49d0e6.1)] +// CHECK:STDOUT: %Optional.loc11_75.2: type = class_type @Optional, @Optional(constants.%Int.49d0e6.1) [symbolic = %Optional.loc11_75.1 (constants.%Optional.708)] +// CHECK:STDOUT: %self.param: @Next.2.%IntRange (%IntRange.349) = value_param call_param0 +// CHECK:STDOUT: %.loc11_19.1: type = splice_block %Self.ref [symbolic = %IntRange (constants.%IntRange.349)] { +// CHECK:STDOUT: %.loc11_19.2: type = specific_constant constants.%IntRange.349, @IntRange(constants.%N) [symbolic = %IntRange (constants.%IntRange.349)] +// CHECK:STDOUT: %Self.ref: type = name_ref Self, %.loc11_19.2 [symbolic = %IntRange (constants.%IntRange.349)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Next.2.%IntRange (%IntRange.349) = bind_name self, %self.param +// CHECK:STDOUT: %cursor.param: @Next.2.%ptr.loc11_44.1 (%ptr.784) = value_param call_param1 +// CHECK:STDOUT: %.loc11_44: type = splice_block %ptr.loc11_44.2 [symbolic = %ptr.loc11_44.1 (constants.%ptr.784)] { +// CHECK:STDOUT: %Core.ref.loc11_33: = name_ref Core, imports.%Core [concrete = imports.%Core] +// CHECK:STDOUT: %Int.ref.loc11_37: %Int.type = name_ref Int, imports.%Core.Int [concrete = constants.%Int.generic] +// CHECK:STDOUT: %N.ref.loc11_42: Core.IntLiteral = name_ref N, @IntRange.%N.loc4_16.1 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %Int.loc11_43.2: type = class_type @Int, @Int(constants.%N) [symbolic = %Int.loc11_43.1 (constants.%Int.49d0e6.1)] +// CHECK:STDOUT: %ptr.loc11_44.2: type = ptr_type %Int.loc11_43.2 [symbolic = %ptr.loc11_44.1 (constants.%ptr.784)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %cursor: @Next.2.%ptr.loc11_44.1 (%ptr.784) = bind_name cursor, %cursor.param +// CHECK:STDOUT: %return.param: ref @Next.2.%Optional.loc11_75.1 (%Optional.708) = out_param call_param2 +// CHECK:STDOUT: %return: ref @Next.2.%Optional.loc11_75.1 (%Optional.708) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .N = +// CHECK:STDOUT: .NewCursor = %NewCursor.decl +// CHECK:STDOUT: .Next = %Next.decl +// CHECK:STDOUT: witness = @IntRange.%Iterate.impl_witness +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic class @IntRange(%N.loc4_16.1: Core.IntLiteral) { +// CHECK:STDOUT: %N.loc4_16.2: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N.loc4_16.2 (constants.%N)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Make.type: type = fn_type @Make, @IntRange(%N.loc4_16.2) [symbolic = %Make.type (constants.%Make.type.51f)] +// CHECK:STDOUT: %Make: @IntRange.%Make.type (%Make.type.51f) = struct_value () [symbolic = %Make (constants.%Make.2ec)] +// CHECK:STDOUT: %Int.loc22_32.2: type = class_type @Int, @Int(%N.loc4_16.2) [symbolic = %Int.loc22_32.2 (constants.%Int.49d0e6.1)] +// CHECK:STDOUT: %require_complete: = require_complete_type %Int.loc22_32.2 [symbolic = %require_complete (constants.%require_complete.b4f426.1)] +// CHECK:STDOUT: %IntRange: type = class_type @IntRange, @IntRange(%N.loc4_16.2) [symbolic = %IntRange (constants.%IntRange.349)] +// CHECK:STDOUT: %IntRange.elem: type = unbound_element_type %IntRange, %Int.loc22_32.2 [symbolic = %IntRange.elem (constants.%IntRange.elem.e7c)] +// CHECK:STDOUT: %struct_type.start.end.loc24_1.2: type = struct_type {.start: @IntRange.%Int.loc22_32.2 (%Int.49d0e6.1), .end: @IntRange.%Int.loc22_32.2 (%Int.49d0e6.1)} [symbolic = %struct_type.start.end.loc24_1.2 (constants.%struct_type.start.end.78d)] +// CHECK:STDOUT: %complete_type.loc24_1.2: = complete_type_witness %struct_type.start.end.loc24_1.2 [symbolic = %complete_type.loc24_1.2 (constants.%complete_type.9d5)] +// CHECK:STDOUT: +// CHECK:STDOUT: class { +// CHECK:STDOUT: %Make.decl: @IntRange.%Make.type (%Make.type.51f) = fn_decl @Make [symbolic = @IntRange.%Make (constants.%Make.2ec)] { +// CHECK:STDOUT: %start.patt: @Make.%pattern_type.loc5_11 (%pattern_type.8963eb.1) = binding_pattern start [concrete] +// CHECK:STDOUT: %start.param_patt: @Make.%pattern_type.loc5_11 (%pattern_type.8963eb.1) = value_param_pattern %start.patt, call_param0 [concrete] +// CHECK:STDOUT: %end.patt: @Make.%pattern_type.loc5_11 (%pattern_type.8963eb.1) = binding_pattern end [concrete] +// CHECK:STDOUT: %end.param_patt: @Make.%pattern_type.loc5_11 (%pattern_type.8963eb.1) = value_param_pattern %end.patt, call_param1 [concrete] +// CHECK:STDOUT: %return.patt: @Make.%pattern_type.loc5_49 (%pattern_type.dcd) = return_slot_pattern [concrete] +// CHECK:STDOUT: %return.param_patt: @Make.%pattern_type.loc5_49 (%pattern_type.dcd) = out_param_pattern %return.patt, call_param2 [concrete] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %.loc5_52: type = specific_constant constants.%IntRange.349, @IntRange(constants.%N) [symbolic = %IntRange (constants.%IntRange.349)] +// CHECK:STDOUT: %Self.ref: type = name_ref Self, %.loc5_52 [symbolic = %IntRange (constants.%IntRange.349)] +// CHECK:STDOUT: %start.param: @Make.%Int.loc5_28.1 (%Int.49d0e6.1) = value_param call_param0 +// CHECK:STDOUT: %.loc5_28: type = splice_block %Int.loc5_28.2 [symbolic = %Int.loc5_28.1 (constants.%Int.49d0e6.1)] { +// CHECK:STDOUT: %Core.ref.loc5_18: = name_ref Core, imports.%Core [concrete = imports.%Core] +// CHECK:STDOUT: %Int.ref.loc5_22: %Int.type = name_ref Int, imports.%Core.Int [concrete = constants.%Int.generic] +// CHECK:STDOUT: %N.ref.loc5_27: Core.IntLiteral = name_ref N, @IntRange.%N.loc4_16.1 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %Int.loc5_28.2: type = class_type @Int, @Int(constants.%N) [symbolic = %Int.loc5_28.1 (constants.%Int.49d0e6.1)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %start: @Make.%Int.loc5_28.1 (%Int.49d0e6.1) = bind_name start, %start.param +// CHECK:STDOUT: %end.param: @Make.%Int.loc5_28.1 (%Int.49d0e6.1) = value_param call_param1 +// CHECK:STDOUT: %.loc5_46: type = splice_block %Int.loc5_46 [symbolic = %Int.loc5_28.1 (constants.%Int.49d0e6.1)] { +// CHECK:STDOUT: %Core.ref.loc5_36: = name_ref Core, imports.%Core [concrete = imports.%Core] +// CHECK:STDOUT: %Int.ref.loc5_40: %Int.type = name_ref Int, imports.%Core.Int [concrete = constants.%Int.generic] +// CHECK:STDOUT: %N.ref.loc5_45: Core.IntLiteral = name_ref N, @IntRange.%N.loc4_16.1 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %Int.loc5_46: type = class_type @Int, @Int(constants.%N) [symbolic = %Int.loc5_28.1 (constants.%Int.49d0e6.1)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %end: @Make.%Int.loc5_28.1 (%Int.49d0e6.1) = bind_name end, %end.param +// CHECK:STDOUT: %return.param: ref @Make.%IntRange (%IntRange.349) = out_param call_param2 +// CHECK:STDOUT: %return: ref @Make.%IntRange (%IntRange.349) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: impl_decl @impl.7a3 [concrete] {} { +// CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%IntRange.349 [symbolic = %IntRange (constants.%IntRange.349)] +// CHECK:STDOUT: %Core.ref.loc9_11: = name_ref Core, imports.%Core [concrete = imports.%Core] +// CHECK:STDOUT: %Iterate.ref: type = name_ref Iterate, imports.%Core.Iterate [concrete = constants.%Iterate.type] +// CHECK:STDOUT: %.Self: %Iterate.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self.ef1] +// CHECK:STDOUT: %.Self.ref.loc9_30: %Iterate.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self.ef1] +// CHECK:STDOUT: %CursorType.ref: %Iterate.assoc_type = name_ref CursorType, imports.%Core.import_ref.ed6 [concrete = constants.%assoc1.02e] +// CHECK:STDOUT: %.Self.as_type.loc9_30: type = facet_access_type %.Self.ref.loc9_30 [symbolic_self = constants.%.Self.as_type.935] +// CHECK:STDOUT: %.loc9_30: type = converted %.Self.ref.loc9_30, %.Self.as_type.loc9_30 [symbolic_self = constants.%.Self.as_type.935] +// CHECK:STDOUT: %impl.elem1: type = impl_witness_access constants.%Iterate.lookup_impl_witness.65a, element1 [symbolic_self = constants.%impl.elem1.164] +// CHECK:STDOUT: %Core.ref.loc9_44: = name_ref Core, imports.%Core [concrete = imports.%Core] +// CHECK:STDOUT: %Int.ref.loc9_48: %Int.type = name_ref Int, imports.%Core.Int [concrete = constants.%Int.generic] +// CHECK:STDOUT: %N.ref.loc9_53: Core.IntLiteral = name_ref N, @IntRange.%N.loc4_16.1 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %Int.loc9_54.1: type = class_type @Int, @Int(constants.%N) [symbolic = %Int.loc9_54.2 (constants.%Int.49d0e6.1)] +// CHECK:STDOUT: %.Self.ref.loc9_60: %Iterate.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self.ef1] +// CHECK:STDOUT: %ElementType.ref: %Iterate.assoc_type = name_ref ElementType, imports.%Core.import_ref.1c9 [concrete = constants.%assoc0.724] +// CHECK:STDOUT: %.Self.as_type.loc9_60: type = facet_access_type %.Self.ref.loc9_60 [symbolic_self = constants.%.Self.as_type.935] +// CHECK:STDOUT: %.loc9_60: type = converted %.Self.ref.loc9_60, %.Self.as_type.loc9_60 [symbolic_self = constants.%.Self.as_type.935] +// CHECK:STDOUT: %impl.elem0: type = impl_witness_access constants.%Iterate.lookup_impl_witness.65a, element0 [symbolic_self = constants.%impl.elem0.19f] +// CHECK:STDOUT: %Core.ref.loc9_75: = name_ref Core, imports.%Core [concrete = imports.%Core] +// CHECK:STDOUT: %Int.ref.loc9_79: %Int.type = name_ref Int, imports.%Core.Int [concrete = constants.%Int.generic] +// CHECK:STDOUT: %N.ref.loc9_84: Core.IntLiteral = name_ref N, @IntRange.%N.loc4_16.1 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %Int.loc9_85: type = class_type @Int, @Int(constants.%N) [symbolic = %Int.loc9_54.2 (constants.%Int.49d0e6.1)] +// CHECK:STDOUT: %.loc9_24: type = where_expr %.Self [symbolic = %Iterate_where.type (constants.%Iterate_where.type)] { +// CHECK:STDOUT: requirement_rewrite %impl.elem1, %Int.loc9_54.1 +// CHECK:STDOUT: requirement_rewrite %impl.elem0, %Int.loc9_85 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: %Iterate.impl_witness_table = impl_witness_table (%impl_witness_assoc_constant.loc9_87.2, %impl_witness_assoc_constant.loc9_87.1, @impl.7a3.%NewCursor.decl, @impl.7a3.%Next.decl), @impl.7a3 [concrete] +// CHECK:STDOUT: %Iterate.impl_witness: = impl_witness %Iterate.impl_witness_table, @impl.7a3(constants.%N) [symbolic = @impl.7a3.%Iterate.impl_witness (constants.%Iterate.impl_witness)] +// CHECK:STDOUT: %impl_witness_assoc_constant.loc9_87.1: type = impl_witness_assoc_constant constants.%Int.49d0e6.1 [symbolic = @impl.7a3.%Int.loc9_54.2 (constants.%Int.49d0e6.1)] +// CHECK:STDOUT: %impl_witness_assoc_constant.loc9_87.2: type = impl_witness_assoc_constant constants.%Int.49d0e6.1 [symbolic = @impl.7a3.%Int.loc9_54.2 (constants.%Int.49d0e6.1)] +// CHECK:STDOUT: %Core.ref.loc22: = name_ref Core, imports.%Core [concrete = imports.%Core] +// CHECK:STDOUT: %Int.ref.loc22: %Int.type = name_ref Int, imports.%Core.Int [concrete = constants.%Int.generic] +// CHECK:STDOUT: %N.ref.loc22: Core.IntLiteral = name_ref N, %N.loc4_16.1 [symbolic = %N.loc4_16.2 (constants.%N)] +// CHECK:STDOUT: %Int.loc22_32.1: type = class_type @Int, @Int(constants.%N) [symbolic = %Int.loc22_32.2 (constants.%Int.49d0e6.1)] +// CHECK:STDOUT: %.loc22: @IntRange.%IntRange.elem (%IntRange.elem.e7c) = field_decl start, element0 [concrete] +// CHECK:STDOUT: %Core.ref.loc23: = name_ref Core, imports.%Core [concrete = imports.%Core] +// CHECK:STDOUT: %Int.ref.loc23: %Int.type = name_ref Int, imports.%Core.Int [concrete = constants.%Int.generic] +// CHECK:STDOUT: %N.ref.loc23: Core.IntLiteral = name_ref N, %N.loc4_16.1 [symbolic = %N.loc4_16.2 (constants.%N)] +// CHECK:STDOUT: %Int.loc23: type = class_type @Int, @Int(constants.%N) [symbolic = %Int.loc22_32.2 (constants.%Int.49d0e6.1)] +// CHECK:STDOUT: %.loc23: @IntRange.%IntRange.elem (%IntRange.elem.e7c) = field_decl end, element1 [concrete] +// CHECK:STDOUT: %struct_type.start.end.loc24_1.1: type = struct_type {.start: %Int.49d0e6.1, .end: %Int.49d0e6.1} [symbolic = %struct_type.start.end.loc24_1.2 (constants.%struct_type.start.end.78d)] +// CHECK:STDOUT: %complete_type.loc24_1.1: = complete_type_witness %struct_type.start.end.loc24_1.1 [symbolic = %complete_type.loc24_1.2 (constants.%complete_type.9d5)] +// CHECK:STDOUT: complete_type_witness = %complete_type.loc24_1.1 +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = constants.%IntRange.349 +// CHECK:STDOUT: .N = +// CHECK:STDOUT: .Make = %Make.decl +// CHECK:STDOUT: .start [private] = %.loc22 +// CHECK:STDOUT: .end [private] = %.loc23 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Make(@IntRange.%N.loc4_16.1: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %Int.loc5_28.1: type = class_type @Int, @Int(%N) [symbolic = %Int.loc5_28.1 (constants.%Int.49d0e6.1)] +// CHECK:STDOUT: %pattern_type.loc5_11: type = pattern_type %Int.loc5_28.1 [symbolic = %pattern_type.loc5_11 (constants.%pattern_type.8963eb.1)] +// CHECK:STDOUT: %IntRange: type = class_type @IntRange, @IntRange(%N) [symbolic = %IntRange (constants.%IntRange.349)] +// CHECK:STDOUT: %pattern_type.loc5_49: type = pattern_type %IntRange [symbolic = %pattern_type.loc5_49 (constants.%pattern_type.dcd)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete.loc5_49: = require_complete_type %IntRange [symbolic = %require_complete.loc5_49 (constants.%require_complete.524)] +// CHECK:STDOUT: %require_complete.loc5_16: = require_complete_type %Int.loc5_28.1 [symbolic = %require_complete.loc5_16 (constants.%require_complete.b4f426.1)] +// CHECK:STDOUT: %struct_type.start.end: type = struct_type {.start: @Make.%Int.loc5_28.1 (%Int.49d0e6.1), .end: @Make.%Int.loc5_28.1 (%Int.49d0e6.1)} [symbolic = %struct_type.start.end (constants.%struct_type.start.end.78d)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%start.param: @Make.%Int.loc5_28.1 (%Int.49d0e6.1), %end.param: @Make.%Int.loc5_28.1 (%Int.49d0e6.1)) -> %return.param: @Make.%IntRange (%IntRange.349) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %start.ref: @Make.%Int.loc5_28.1 (%Int.49d0e6.1) = name_ref start, %start +// CHECK:STDOUT: %end.ref: @Make.%Int.loc5_28.1 (%Int.49d0e6.1) = name_ref end, %end +// CHECK:STDOUT: %.loc6_39.1: @Make.%struct_type.start.end (%struct_type.start.end.78d) = struct_literal (%start.ref, %end.ref) +// CHECK:STDOUT: %.loc6_39.2: ref @Make.%Int.loc5_28.1 (%Int.49d0e6.1) = class_element_access %return, element0 +// CHECK:STDOUT: %.loc6_39.3: init @Make.%Int.loc5_28.1 (%Int.49d0e6.1) = initialize_from %start.ref to %.loc6_39.2 +// CHECK:STDOUT: %.loc6_39.4: ref @Make.%Int.loc5_28.1 (%Int.49d0e6.1) = class_element_access %return, element1 +// CHECK:STDOUT: %.loc6_39.5: init @Make.%Int.loc5_28.1 (%Int.49d0e6.1) = initialize_from %end.ref to %.loc6_39.4 +// CHECK:STDOUT: %.loc6_39.6: init @Make.%IntRange (%IntRange.349) = class_init (%.loc6_39.3, %.loc6_39.5), %return +// CHECK:STDOUT: %.loc6_40: init @Make.%IntRange (%IntRange.349) = converted %.loc6_39.1, %.loc6_39.6 +// CHECK:STDOUT: return %.loc6_40 to %return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @NewCursor.2(@IntRange.%N.loc4_16.1: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %IntRange: type = class_type @IntRange, @IntRange(%N) [symbolic = %IntRange (constants.%IntRange.349)] +// CHECK:STDOUT: %pattern_type.loc10_18: type = pattern_type %IntRange [symbolic = %pattern_type.loc10_18 (constants.%pattern_type.dcd)] +// CHECK:STDOUT: %Int.loc10_45.1: type = class_type @Int, @Int(%N) [symbolic = %Int.loc10_45.1 (constants.%Int.49d0e6.1)] +// CHECK:STDOUT: %pattern_type.loc10_32: type = pattern_type %Int.loc10_45.1 [symbolic = %pattern_type.loc10_32 (constants.%pattern_type.8963eb.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete.loc10_22: = require_complete_type %IntRange [symbolic = %require_complete.loc10_22 (constants.%require_complete.524)] +// CHECK:STDOUT: %IntRange.elem: type = unbound_element_type %IntRange, %Int.loc10_45.1 [symbolic = %IntRange.elem (constants.%IntRange.elem.e7c)] +// CHECK:STDOUT: %require_complete.loc10_60: = require_complete_type %Int.loc10_45.1 [symbolic = %require_complete.loc10_60 (constants.%require_complete.b4f426.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%self.param: @NewCursor.2.%IntRange (%IntRange.349)) -> @NewCursor.2.%Int.loc10_45.1 (%Int.49d0e6.1) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %self.ref: @NewCursor.2.%IntRange (%IntRange.349) = name_ref self, %self +// CHECK:STDOUT: %start.ref: @NewCursor.2.%IntRange.elem (%IntRange.elem.e7c) = name_ref start, @IntRange.%.loc22 [concrete = @IntRange.%.loc22] +// CHECK:STDOUT: %.loc10_60.1: ref @NewCursor.2.%Int.loc10_45.1 (%Int.49d0e6.1) = class_element_access %self.ref, element0 +// CHECK:STDOUT: %.loc10_60.2: @NewCursor.2.%Int.loc10_45.1 (%Int.49d0e6.1) = bind_value %.loc10_60.1 +// CHECK:STDOUT: return %.loc10_60.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Next.2(@IntRange.%N.loc4_16.1: Core.IntLiteral) { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %IntRange: type = class_type @IntRange, @IntRange(%N) [symbolic = %IntRange (constants.%IntRange.349)] +// CHECK:STDOUT: %pattern_type.loc11_13: type = pattern_type %IntRange [symbolic = %pattern_type.loc11_13 (constants.%pattern_type.dcd)] +// CHECK:STDOUT: %Int.loc11_43.1: type = class_type @Int, @Int(%N) [symbolic = %Int.loc11_43.1 (constants.%Int.49d0e6.1)] +// CHECK:STDOUT: %ptr.loc11_44.1: type = ptr_type %Int.loc11_43.1 [symbolic = %ptr.loc11_44.1 (constants.%ptr.784)] +// CHECK:STDOUT: %pattern_type.loc11_25: type = pattern_type %ptr.loc11_44.1 [symbolic = %pattern_type.loc11_25 (constants.%pattern_type.4dc)] +// CHECK:STDOUT: %Optional.loc11_75.1: type = class_type @Optional, @Optional(%Int.loc11_43.1) [symbolic = %Optional.loc11_75.1 (constants.%Optional.708)] +// CHECK:STDOUT: %pattern_type.loc11_47: type = pattern_type %Optional.loc11_75.1 [symbolic = %pattern_type.loc11_47 (constants.%pattern_type.4b1)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete.loc11_47: = require_complete_type %Optional.loc11_75.1 [symbolic = %require_complete.loc11_47 (constants.%require_complete.b74)] +// CHECK:STDOUT: %require_complete.loc11_17: = require_complete_type %IntRange [symbolic = %require_complete.loc11_17 (constants.%require_complete.524)] +// CHECK:STDOUT: %require_complete.loc11_31: = require_complete_type %ptr.loc11_44.1 [symbolic = %require_complete.loc11_31 (constants.%require_complete.0f5)] +// CHECK:STDOUT: %require_complete.loc12: = require_complete_type %Int.loc11_43.1 [symbolic = %require_complete.loc12 (constants.%require_complete.b4f426.1)] +// CHECK:STDOUT: %pattern_type.loc12: type = pattern_type %Int.loc11_43.1 [symbolic = %pattern_type.loc12 (constants.%pattern_type.8963eb.1)] +// CHECK:STDOUT: %IntRange.elem: type = unbound_element_type %IntRange, %Int.loc11_43.1 [symbolic = %IntRange.elem (constants.%IntRange.elem.e7c)] +// CHECK:STDOUT: %OrderedWith.type.loc13_17.2: type = facet_type <@OrderedWith, @OrderedWith(%Int.loc11_43.1)> [symbolic = %OrderedWith.type.loc13_17.2 (constants.%OrderedWith.type.872)] +// CHECK:STDOUT: %require_complete.loc13: = require_complete_type %OrderedWith.type.loc13_17.2 [symbolic = %require_complete.loc13 (constants.%require_complete.66b6)] +// CHECK:STDOUT: %OrderedWith.assoc_type: type = assoc_entity_type @OrderedWith, @OrderedWith(%Int.loc11_43.1) [symbolic = %OrderedWith.assoc_type (constants.%OrderedWith.assoc_type.d92)] +// CHECK:STDOUT: %assoc0: @Next.2.%OrderedWith.assoc_type (%OrderedWith.assoc_type.d92) = assoc_entity element0, imports.%Core.import_ref.910 [symbolic = %assoc0 (constants.%assoc0.2ae)] +// CHECK:STDOUT: %OrderedWith.impl_witness: = impl_witness imports.%OrderedWith.impl_witness_table.2b2, @impl.db3(%N, %N) [symbolic = %OrderedWith.impl_witness (constants.%OrderedWith.impl_witness.df5)] +// CHECK:STDOUT: %Less.type.loc13_17.1: type = fn_type @Less.1, @OrderedWith(%Int.loc11_43.1) [symbolic = %Less.type.loc13_17.1 (constants.%Less.type.8fe)] +// CHECK:STDOUT: %OrderedWith.facet: @Next.2.%OrderedWith.type.loc13_17.2 (%OrderedWith.type.872) = facet_value %Int.loc11_43.1, (%OrderedWith.impl_witness) [symbolic = %OrderedWith.facet (constants.%OrderedWith.facet)] +// CHECK:STDOUT: %.loc13_17.2: type = fn_type_with_self_type %Less.type.loc13_17.1, %OrderedWith.facet [symbolic = %.loc13_17.2 (constants.%.99c)] +// CHECK:STDOUT: %Less.type.loc13_17.2: type = fn_type @Less.2, @impl.db3(%N, %N) [symbolic = %Less.type.loc13_17.2 (constants.%Less.type.98c)] +// CHECK:STDOUT: %Less: @Next.2.%Less.type.loc13_17.2 (%Less.type.98c) = struct_value () [symbolic = %Less (constants.%Less.4be)] +// CHECK:STDOUT: %Less.specific_fn: = specific_function %Less, @Less.2(%N, %N) [symbolic = %Less.specific_fn (constants.%Less.specific_fn.bb3)] +// CHECK:STDOUT: %Inc.lookup_impl_witness: = lookup_impl_witness %Int.loc11_43.1, @Inc [symbolic = %Inc.lookup_impl_witness (constants.%Inc.lookup_impl_witness)] +// CHECK:STDOUT: %Inc.facet: %Inc.type = facet_value %Int.loc11_43.1, (%Inc.lookup_impl_witness) [symbolic = %Inc.facet (constants.%Inc.facet)] +// CHECK:STDOUT: %.loc14_9.2: type = fn_type_with_self_type constants.%Op.type.e3a, %Inc.facet [symbolic = %.loc14_9.2 (constants.%.a0d)] +// CHECK:STDOUT: %impl.elem0.loc14_9.2: @Next.2.%.loc14_9.2 (%.a0d) = impl_witness_access %Inc.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc14_9.2 (constants.%impl.elem0.437)] +// CHECK:STDOUT: %specific_impl_fn.loc14_9.2: = specific_impl_function %impl.elem0.loc14_9.2, @Op.95(%Inc.facet) [symbolic = %specific_impl_fn.loc14_9.2 (constants.%specific_impl_fn.a5f)] +// CHECK:STDOUT: %Some.type: type = fn_type @Some, @Optional(%Int.loc11_43.1) [symbolic = %Some.type (constants.%Some.type.185)] +// CHECK:STDOUT: %Some: @Next.2.%Some.type (%Some.type.185) = struct_value () [symbolic = %Some (constants.%Some.58a)] +// CHECK:STDOUT: %Some.specific_fn.loc15_42.2: = specific_function %Some, @Some(%Int.loc11_43.1) [symbolic = %Some.specific_fn.loc15_42.2 (constants.%Some.specific_fn)] +// CHECK:STDOUT: %None.type: type = fn_type @None, @Optional(%Int.loc11_43.1) [symbolic = %None.type (constants.%None.type.73a)] +// CHECK:STDOUT: %None: @Next.2.%None.type (%None.type.73a) = struct_value () [symbolic = %None (constants.%None.83e)] +// CHECK:STDOUT: %None.specific_fn.loc17_42.2: = specific_function %None, @None(%Int.loc11_43.1) [symbolic = %None.specific_fn.loc17_42.2 (constants.%None.specific_fn)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%self.param: @Next.2.%IntRange (%IntRange.349), %cursor.param: @Next.2.%ptr.loc11_44.1 (%ptr.784)) -> %return.param: @Next.2.%Optional.loc11_75.1 (%Optional.708) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: name_binding_decl { +// CHECK:STDOUT: %value.patt: @Next.2.%pattern_type.loc12 (%pattern_type.8963eb.1) = binding_pattern value [concrete] +// CHECK:STDOUT: %value.var_patt: @Next.2.%pattern_type.loc12 (%pattern_type.8963eb.1) = var_pattern %value.patt [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: %value.var: ref @Next.2.%Int.loc11_43.1 (%Int.49d0e6.1) = var %value.var_patt +// CHECK:STDOUT: %cursor.ref.loc12: @Next.2.%ptr.loc11_44.1 (%ptr.784) = name_ref cursor, %cursor +// CHECK:STDOUT: %.loc12_32.1: ref @Next.2.%Int.loc11_43.1 (%Int.49d0e6.1) = deref %cursor.ref.loc12 +// CHECK:STDOUT: %.loc12_32.2: @Next.2.%Int.loc11_43.1 (%Int.49d0e6.1) = bind_value %.loc12_32.1 +// CHECK:STDOUT: assign %value.var, %.loc12_32.2 +// CHECK:STDOUT: %.loc12_28: type = splice_block %Int.loc12 [symbolic = %Int.loc11_43.1 (constants.%Int.49d0e6.1)] { +// CHECK:STDOUT: %Core.ref.loc12: = name_ref Core, imports.%Core [concrete = imports.%Core] +// CHECK:STDOUT: %Int.ref.loc12: %Int.type = name_ref Int, imports.%Core.Int [concrete = constants.%Int.generic] +// CHECK:STDOUT: %N.ref.loc12: Core.IntLiteral = name_ref N, @IntRange.%N.loc4_16.1 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %Int.loc12: type = class_type @Int, @Int(constants.%N) [symbolic = %Int.loc11_43.1 (constants.%Int.49d0e6.1)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %value: ref @Next.2.%Int.loc11_43.1 (%Int.49d0e6.1) = bind_name value, %value.var +// CHECK:STDOUT: %value.ref.loc13: ref @Next.2.%Int.loc11_43.1 (%Int.49d0e6.1) = name_ref value, %value +// CHECK:STDOUT: %self.ref: @Next.2.%IntRange (%IntRange.349) = name_ref self, %self +// CHECK:STDOUT: %end.ref: @Next.2.%IntRange.elem (%IntRange.elem.e7c) = name_ref end, @IntRange.%.loc23 [concrete = @IntRange.%.loc23] +// CHECK:STDOUT: %.loc13_23.1: ref @Next.2.%Int.loc11_43.1 (%Int.49d0e6.1) = class_element_access %self.ref, element1 +// CHECK:STDOUT: %.loc13_23.2: @Next.2.%Int.loc11_43.1 (%Int.49d0e6.1) = bind_value %.loc13_23.1 +// CHECK:STDOUT: %OrderedWith.type.loc13_17.1: type = facet_type <@OrderedWith, @OrderedWith(constants.%Int.49d0e6.1)> [symbolic = %OrderedWith.type.loc13_17.2 (constants.%OrderedWith.type.872)] +// CHECK:STDOUT: %.loc13_17.1: @Next.2.%OrderedWith.assoc_type (%OrderedWith.assoc_type.d92) = specific_constant imports.%Core.import_ref.1cc, @OrderedWith(constants.%Int.49d0e6.1) [symbolic = %assoc0 (constants.%assoc0.2ae)] +// CHECK:STDOUT: %Less.ref: @Next.2.%OrderedWith.assoc_type (%OrderedWith.assoc_type.d92) = name_ref Less, %.loc13_17.1 [symbolic = %assoc0 (constants.%assoc0.2ae)] +// CHECK:STDOUT: %impl.elem0.loc13: @Next.2.%.loc13_17.2 (%.99c) = impl_witness_access constants.%OrderedWith.impl_witness.df5, element0 [symbolic = %Less (constants.%Less.4be)] +// CHECK:STDOUT: %bound_method.loc13_17.1: = bound_method %value.ref.loc13, %impl.elem0.loc13 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0.loc13, @Less.2(constants.%N, constants.%N) [symbolic = %Less.specific_fn (constants.%Less.specific_fn.bb3)] +// CHECK:STDOUT: %bound_method.loc13_17.2: = bound_method %value.ref.loc13, %specific_fn +// CHECK:STDOUT: %.loc13_11: @Next.2.%Int.loc11_43.1 (%Int.49d0e6.1) = bind_value %value.ref.loc13 +// CHECK:STDOUT: %int.less: init bool = call %bound_method.loc13_17.2(%.loc13_11, %.loc13_23.2) +// CHECK:STDOUT: %.loc13_27.1: bool = value_of_initializer %int.less +// CHECK:STDOUT: %.loc13_27.2: bool = converted %int.less, %.loc13_27.1 +// CHECK:STDOUT: if %.loc13_27.2 br !if.then else br !if.else +// CHECK:STDOUT: +// CHECK:STDOUT: !if.then: +// CHECK:STDOUT: %cursor.ref.loc14: @Next.2.%ptr.loc11_44.1 (%ptr.784) = name_ref cursor, %cursor +// CHECK:STDOUT: %.loc14_11: ref @Next.2.%Int.loc11_43.1 (%Int.49d0e6.1) = deref %cursor.ref.loc14 +// CHECK:STDOUT: %impl.elem0.loc14_9.1: @Next.2.%.loc14_9.2 (%.a0d) = impl_witness_access constants.%Inc.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc14_9.2 (constants.%impl.elem0.437)] +// CHECK:STDOUT: %bound_method.loc14_9.1: = bound_method %.loc14_11, %impl.elem0.loc14_9.1 +// CHECK:STDOUT: %specific_impl_fn.loc14_9.1: = specific_impl_function %impl.elem0.loc14_9.1, @Op.95(constants.%Inc.facet) [symbolic = %specific_impl_fn.loc14_9.2 (constants.%specific_impl_fn.a5f)] +// CHECK:STDOUT: %bound_method.loc14_9.2: = bound_method %.loc14_11, %specific_impl_fn.loc14_9.1 +// CHECK:STDOUT: %addr: @Next.2.%ptr.loc11_44.1 (%ptr.784) = addr_of %.loc14_11 +// CHECK:STDOUT: %.loc14_9.1: init %empty_tuple.type = call %bound_method.loc14_9.2(%addr) +// CHECK:STDOUT: %Core.ref.loc15_16: = name_ref Core, imports.%Core [concrete = imports.%Core] +// CHECK:STDOUT: %Optional.ref.loc15: %Optional.type = name_ref Optional, imports.%Core.Optional [concrete = constants.%Optional.generic] +// CHECK:STDOUT: %Core.ref.loc15_30: = name_ref Core, imports.%Core [concrete = imports.%Core] +// CHECK:STDOUT: %Int.ref.loc15: %Int.type = name_ref Int, imports.%Core.Int [concrete = constants.%Int.generic] +// CHECK:STDOUT: %N.ref.loc15: Core.IntLiteral = name_ref N, @IntRange.%N.loc4_16.1 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %Int.loc15: type = class_type @Int, @Int(constants.%N) [symbolic = %Int.loc11_43.1 (constants.%Int.49d0e6.1)] +// CHECK:STDOUT: %Optional.loc15: type = class_type @Optional, @Optional(constants.%Int.49d0e6.1) [symbolic = %Optional.loc11_75.1 (constants.%Optional.708)] +// CHECK:STDOUT: %.loc15_42: @Next.2.%Some.type (%Some.type.185) = specific_constant imports.%Core.import_ref.5c6, @Optional(constants.%Int.49d0e6.1) [symbolic = %Some (constants.%Some.58a)] +// CHECK:STDOUT: %Some.ref: @Next.2.%Some.type (%Some.type.185) = name_ref Some, %.loc15_42 [symbolic = %Some (constants.%Some.58a)] +// CHECK:STDOUT: %value.ref.loc15: ref @Next.2.%Int.loc11_43.1 (%Int.49d0e6.1) = name_ref value, %value +// CHECK:STDOUT: %Some.specific_fn.loc15_42.1: = specific_function %Some.ref, @Some(constants.%Int.49d0e6.1) [symbolic = %Some.specific_fn.loc15_42.2 (constants.%Some.specific_fn)] +// CHECK:STDOUT: %.loc11_47.1: ref @Next.2.%Optional.loc11_75.1 (%Optional.708) = splice_block %return {} +// CHECK:STDOUT: %.loc15_48: @Next.2.%Int.loc11_43.1 (%Int.49d0e6.1) = bind_value %value.ref.loc15 +// CHECK:STDOUT: %Some.call: init @Next.2.%Optional.loc11_75.1 (%Optional.708) = call %Some.specific_fn.loc15_42.1(%.loc15_48) to %.loc11_47.1 +// CHECK:STDOUT: return %Some.call to %return +// CHECK:STDOUT: +// CHECK:STDOUT: !if.else: +// CHECK:STDOUT: %Core.ref.loc17_16: = name_ref Core, imports.%Core [concrete = imports.%Core] +// CHECK:STDOUT: %Optional.ref.loc17: %Optional.type = name_ref Optional, imports.%Core.Optional [concrete = constants.%Optional.generic] +// CHECK:STDOUT: %Core.ref.loc17_30: = name_ref Core, imports.%Core [concrete = imports.%Core] +// CHECK:STDOUT: %Int.ref.loc17: %Int.type = name_ref Int, imports.%Core.Int [concrete = constants.%Int.generic] +// CHECK:STDOUT: %N.ref.loc17: Core.IntLiteral = name_ref N, @IntRange.%N.loc4_16.1 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %Int.loc17: type = class_type @Int, @Int(constants.%N) [symbolic = %Int.loc11_43.1 (constants.%Int.49d0e6.1)] +// CHECK:STDOUT: %Optional.loc17: type = class_type @Optional, @Optional(constants.%Int.49d0e6.1) [symbolic = %Optional.loc11_75.1 (constants.%Optional.708)] +// CHECK:STDOUT: %.loc17: @Next.2.%None.type (%None.type.73a) = specific_constant imports.%Core.import_ref.2b7, @Optional(constants.%Int.49d0e6.1) [symbolic = %None (constants.%None.83e)] +// CHECK:STDOUT: %None.ref: @Next.2.%None.type (%None.type.73a) = name_ref None, %.loc17 [symbolic = %None (constants.%None.83e)] +// CHECK:STDOUT: %None.specific_fn.loc17_42.1: = specific_function %None.ref, @None(constants.%Int.49d0e6.1) [symbolic = %None.specific_fn.loc17_42.2 (constants.%None.specific_fn)] +// CHECK:STDOUT: %.loc11_47.2: ref @Next.2.%Optional.loc11_75.1 (%Optional.708) = splice_block %return {} +// CHECK:STDOUT: %None.call: init @Next.2.%Optional.loc11_75.1 (%Optional.708) = call %None.specific_fn.loc17_42.1() to %.loc11_47.2 +// CHECK:STDOUT: return %None.call to %return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Range(%end.param: %i32) -> %return.param: %IntRange.365 { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %IntRange.ref.loc27: %IntRange.type = name_ref IntRange, file.%IntRange.decl [concrete = constants.%IntRange.generic] +// CHECK:STDOUT: %int_32.loc27: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %IntRange.loc27: type = class_type @IntRange, @IntRange(constants.%int_32) [concrete = constants.%IntRange.365] +// CHECK:STDOUT: %.loc27_22: %Make.type.cef = specific_constant @IntRange.%Make.decl, @IntRange(constants.%int_32) [concrete = constants.%Make.0dc] +// CHECK:STDOUT: %Make.ref: %Make.type.cef = name_ref Make, %.loc27_22 [concrete = constants.%Make.0dc] +// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] +// CHECK:STDOUT: %end.ref: %i32 = name_ref end, %end +// CHECK:STDOUT: %Make.specific_fn: = specific_function %Make.ref, @Make(constants.%int_32) [concrete = constants.%Make.specific_fn] +// CHECK:STDOUT: %.loc26_20: ref %IntRange.365 = splice_block %return {} +// CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc27_28.1: = bound_method %int_0, %impl.elem0 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc27_28.2: = bound_method %int_0, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc27_28.2(%int_0) [concrete = constants.%int_0.6a9] +// CHECK:STDOUT: %.loc27_28.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_0.6a9] +// CHECK:STDOUT: %.loc27_28.2: %i32 = converted %int_0, %.loc27_28.1 [concrete = constants.%int_0.6a9] +// CHECK:STDOUT: %Make.call: init %IntRange.365 = call %Make.specific_fn(%.loc27_28.2, %end.ref) to %.loc26_20 +// CHECK:STDOUT: return %Make.call to %return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @IntRange(constants.%N) { +// CHECK:STDOUT: %N.loc4_16.2 => constants.%N +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Make.type => constants.%Make.type.51f +// CHECK:STDOUT: %Make => constants.%Make.2ec +// CHECK:STDOUT: %Int.loc22_32.2 => constants.%Int.49d0e6.1 +// CHECK:STDOUT: %require_complete => constants.%require_complete.b4f426.1 +// CHECK:STDOUT: %IntRange => constants.%IntRange.349 +// CHECK:STDOUT: %IntRange.elem => constants.%IntRange.elem.e7c +// CHECK:STDOUT: %struct_type.start.end.loc24_1.2 => constants.%struct_type.start.end.78d +// CHECK:STDOUT: %complete_type.loc24_1.2 => constants.%complete_type.9d5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Make(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %Int.loc5_28.1 => constants.%Int.49d0e6.1 +// CHECK:STDOUT: %pattern_type.loc5_11 => constants.%pattern_type.8963eb.1 +// CHECK:STDOUT: %IntRange => constants.%IntRange.349 +// CHECK:STDOUT: %pattern_type.loc5_49 => constants.%pattern_type.dcd +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @CursorType(constants.%Self.a96) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @CursorType(constants.%Iterate.facet.7f1) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ElementType(constants.%Self.a96) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ElementType(constants.%Iterate.facet.7f1) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.7a3(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %IntRange => constants.%IntRange.349 +// CHECK:STDOUT: %Int.loc9_54.2 => constants.%Int.49d0e6.1 +// CHECK:STDOUT: %Iterate_where.type => constants.%Iterate_where.type +// CHECK:STDOUT: %require_complete => constants.%require_complete.d96 +// CHECK:STDOUT: %Iterate.impl_witness => constants.%Iterate.impl_witness +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %NewCursor.type => constants.%NewCursor.type.b02 +// CHECK:STDOUT: %NewCursor => constants.%NewCursor.f32 +// CHECK:STDOUT: %Next.type => constants.%Next.type.2c8 +// CHECK:STDOUT: %Next => constants.%Next.259 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @NewCursor.2(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %IntRange => constants.%IntRange.349 +// CHECK:STDOUT: %pattern_type.loc10_18 => constants.%pattern_type.dcd +// CHECK:STDOUT: %Int.loc10_45.1 => constants.%Int.49d0e6.1 +// CHECK:STDOUT: %pattern_type.loc10_32 => constants.%pattern_type.8963eb.1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Next.2(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %IntRange => constants.%IntRange.349 +// CHECK:STDOUT: %pattern_type.loc11_13 => constants.%pattern_type.dcd +// CHECK:STDOUT: %Int.loc11_43.1 => constants.%Int.49d0e6.1 +// CHECK:STDOUT: %ptr.loc11_44.1 => constants.%ptr.784 +// CHECK:STDOUT: %pattern_type.loc11_25 => constants.%pattern_type.4dc +// CHECK:STDOUT: %Optional.loc11_75.1 => constants.%Optional.708 +// CHECK:STDOUT: %pattern_type.loc11_47 => constants.%pattern_type.4b1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @IntRange(constants.%int_32) { +// CHECK:STDOUT: %N.loc4_16.2 => constants.%int_32 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Make.type => constants.%Make.type.cef +// CHECK:STDOUT: %Make => constants.%Make.0dc +// CHECK:STDOUT: %Int.loc22_32.2 => constants.%i32 +// CHECK:STDOUT: %require_complete => constants.%complete_type.f8a +// CHECK:STDOUT: %IntRange => constants.%IntRange.365 +// CHECK:STDOUT: %IntRange.elem => constants.%IntRange.elem.e33 +// CHECK:STDOUT: %struct_type.start.end.loc24_1.2 => constants.%struct_type.start.end.d0a +// CHECK:STDOUT: %complete_type.loc24_1.2 => constants.%complete_type.c45 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Make(constants.%int_32) { +// CHECK:STDOUT: %N => constants.%int_32 +// CHECK:STDOUT: %Int.loc5_28.1 => constants.%i32 +// CHECK:STDOUT: %pattern_type.loc5_11 => constants.%pattern_type.7ce +// CHECK:STDOUT: %IntRange => constants.%IntRange.365 +// CHECK:STDOUT: %pattern_type.loc5_49 => constants.%pattern_type.d16 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete.loc5_49 => constants.%complete_type.c45 +// CHECK:STDOUT: %require_complete.loc5_16 => constants.%complete_type.f8a +// CHECK:STDOUT: %struct_type.start.end => constants.%struct_type.start.end.d0a +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- trivial.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Read.type: type = fn_type @Read [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %Read: %Read.type = struct_value () [concrete] +// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [concrete] +// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [concrete] +// CHECK:STDOUT: %y: Core.IntLiteral = bind_symbolic_name y, 0 [symbolic] +// CHECK:STDOUT: %pattern_type.dc0: type = pattern_type Core.IntLiteral [concrete] +// CHECK:STDOUT: %int_43: Core.IntLiteral = int_value 43 [concrete] +// CHECK:STDOUT: %IntRange.type: type = generic_class_type @IntRange [concrete] +// CHECK:STDOUT: %IntRange.generic: %IntRange.type = struct_value () [concrete] +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic] +// CHECK:STDOUT: %Int.7ff11f.1: type = class_type @Int, @Int(%N) [symbolic] +// CHECK:STDOUT: %struct_type.start.end.434: type = struct_type {.start: %Int.7ff11f.1, .end: %Int.7ff11f.1} [symbolic] +// CHECK:STDOUT: %complete_type.c76: = complete_type_witness %struct_type.start.end.434 [symbolic] +// CHECK:STDOUT: %IntRange.349: type = class_type @IntRange, @IntRange(%N) [symbolic] +// CHECK:STDOUT: %Make.type.51f: type = fn_type @Make, @IntRange(%N) [symbolic] +// CHECK:STDOUT: %Make.2ec: %Make.type.51f = struct_value () [symbolic] +// CHECK:STDOUT: %pattern_type.dcd: type = pattern_type %IntRange.349 [symbolic] +// CHECK:STDOUT: %pattern_type.0ede7b.1: type = pattern_type %Int.7ff11f.1 [symbolic] +// CHECK:STDOUT: %require_complete.ffde5f.1: = require_complete_type %Int.7ff11f.1 [symbolic] +// CHECK:STDOUT: %IntRange.elem.ecb: type = unbound_element_type %IntRange.349, %Int.7ff11f.1 [symbolic] +// CHECK:STDOUT: %require_complete.524: = require_complete_type %IntRange.349 [symbolic] +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] +// CHECK:STDOUT: %IntRange.365: type = class_type @IntRange, @IntRange(%int_32) [concrete] +// CHECK:STDOUT: %Make.type.cef: type = fn_type @Make, @IntRange(%int_32) [concrete] +// CHECK:STDOUT: %Make.0dc: %Make.type.cef = struct_value () [concrete] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] +// CHECK:STDOUT: %i32.builtin: type = int_type signed, %int_32 [concrete] +// CHECK:STDOUT: %complete_type.f8a: = complete_type_witness %i32.builtin [concrete] +// CHECK:STDOUT: %IntRange.elem.f21: type = unbound_element_type %IntRange.365, %i32 [concrete] +// CHECK:STDOUT: %struct_type.start.end.0fe: type = struct_type {.start: %i32, .end: %i32} [concrete] +// CHECK:STDOUT: %complete_type.a43: = complete_type_witness %struct_type.start.end.0fe [concrete] +// CHECK:STDOUT: %pattern_type.d16: type = pattern_type %IntRange.365 [concrete] +// CHECK:STDOUT: %Range.type: type = fn_type @Range [concrete] +// CHECK:STDOUT: %Range: %Range.type = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete] +// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.type.9ba: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete] +// CHECK:STDOUT: %Convert.type.6da: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete] +// CHECK:STDOUT: %T.8b3: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.0b2: type = fn_type @Convert.3, @impl.c81(%To.c80) [symbolic] +// CHECK:STDOUT: %Convert.6d7: %Convert.type.0b2 = struct_value () [symbolic] +// CHECK:STDOUT: %OrderedWith.type.256: type = facet_type <@OrderedWith, @OrderedWith(%Int.7ff11f.1)> [symbolic] +// CHECK:STDOUT: %require_complete.10b: = require_complete_type %OrderedWith.type.256 [symbolic] +// CHECK:STDOUT: %Less.type.016: type = fn_type @Less.1, @OrderedWith(%Int.7ff11f.1) [symbolic] +// CHECK:STDOUT: %OrderedWith.assoc_type.e53: type = assoc_entity_type @OrderedWith, @OrderedWith(%Int.7ff11f.1) [symbolic] +// CHECK:STDOUT: %ptr.58a: type = ptr_type %Int.7ff11f.1 [symbolic] +// CHECK:STDOUT: %pattern_type.6d0: type = pattern_type %ptr.58a [symbolic] +// CHECK:STDOUT: %require_complete.656: = require_complete_type %ptr.58a [symbolic] +// CHECK:STDOUT: %Inc.type: type = facet_type <@Inc> [concrete] +// CHECK:STDOUT: %ImplicitAs.impl_witness.e34: = impl_witness imports.%ImplicitAs.impl_witness_table.e36, @impl.c81(%int_32) [concrete] +// CHECK:STDOUT: %Convert.type.ed5: type = fn_type @Convert.3, @impl.c81(%int_32) [concrete] +// CHECK:STDOUT: %Convert.16d: %Convert.type.ed5 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.facet.2e7: %ImplicitAs.type.9ba = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.e34) [concrete] +// CHECK:STDOUT: %.d6a: type = fn_type_with_self_type %Convert.type.6da, %ImplicitAs.facet.2e7 [concrete] +// CHECK:STDOUT: %Convert.bound: = bound_method %y, %Convert.16d [symbolic] +// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.16d, @Convert.3(%int_32) [concrete] +// CHECK:STDOUT: %bound_method: = bound_method %y, %Convert.specific_fn [symbolic] +// CHECK:STDOUT: %int.convert_checked.58b: init %i32 = call %bound_method(%y) [symbolic] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.95 [concrete] +// CHECK:STDOUT: %Iterate.type: type = facet_type <@Iterate> [concrete] +// CHECK:STDOUT: %.Self.36d: %Iterate.type = bind_symbolic_name .Self [symbolic_self] +// CHECK:STDOUT: %Iterate.lookup_impl_witness: = lookup_impl_witness %.Self.36d, @Iterate [symbolic_self] +// CHECK:STDOUT: %impl.elem0.a12: type = impl_witness_access %Iterate.lookup_impl_witness, element0 [symbolic_self] +// CHECK:STDOUT: %impl.elem1: type = impl_witness_access %Iterate.lookup_impl_witness, element1 [symbolic_self] +// CHECK:STDOUT: %Iterate_where.type: type = facet_type <@Iterate where %impl.elem0.a12 = %Int.7ff11f.1 and %impl.elem1 = %Int.7ff11f.1> [symbolic] +// CHECK:STDOUT: %require_complete.6f5: = require_complete_type %Iterate_where.type [symbolic] +// CHECK:STDOUT: %Iterate.impl_witness: = impl_witness imports.%Iterate.impl_witness_table, @impl.e7f(%N) [symbolic] +// CHECK:STDOUT: %NewCursor.type: type = fn_type @NewCursor, @impl.e7f(%N) [symbolic] +// CHECK:STDOUT: %NewCursor: %NewCursor.type = struct_value () [symbolic] +// CHECK:STDOUT: %Next.type: type = fn_type @Next, @impl.e7f(%N) [symbolic] +// CHECK:STDOUT: %Next: %Next.type = struct_value () [symbolic] +// CHECK:STDOUT: %Optional.e9f: type = class_type @Optional, @Optional(%Int.7ff11f.1) [symbolic] +// CHECK:STDOUT: %pattern_type.fd8: type = pattern_type %Optional.e9f [symbolic] +// CHECK:STDOUT: %require_complete.5a1: = require_complete_type %Optional.e9f [symbolic] +// CHECK:STDOUT: %assoc0.d1b: %OrderedWith.assoc_type.e53 = assoc_entity element0, imports.%Main.import_ref.014 [symbolic] +// CHECK:STDOUT: %OrderedWith.impl_witness.350: = impl_witness imports.%OrderedWith.impl_witness_table.0e1, @impl.5b6(%N, %N) [symbolic] +// CHECK:STDOUT: %OrderedWith.facet: %OrderedWith.type.256 = facet_value %Int.7ff11f.1, (%OrderedWith.impl_witness.350) [symbolic] +// CHECK:STDOUT: %.3bd: type = fn_type_with_self_type %Less.type.016, %OrderedWith.facet [symbolic] +// CHECK:STDOUT: %Less.type.4f5: type = fn_type @Less.2, @impl.5b6(%N, %N) [symbolic] +// CHECK:STDOUT: %Less.3b5: %Less.type.4f5 = struct_value () [symbolic] +// CHECK:STDOUT: %Less.specific_fn.5e2: = specific_function %Less.3b5, @Less.2(%N, %N) [symbolic] +// CHECK:STDOUT: %Inc.lookup_impl_witness: = lookup_impl_witness %Int.7ff11f.1, @Inc [symbolic] +// CHECK:STDOUT: %Inc.facet: %Inc.type = facet_value %Int.7ff11f.1, (%Inc.lookup_impl_witness) [symbolic] +// CHECK:STDOUT: %Op.type.e3a: type = fn_type @Op.96 [concrete] +// CHECK:STDOUT: %.15d: type = fn_type_with_self_type %Op.type.e3a, %Inc.facet [symbolic] +// CHECK:STDOUT: %impl.elem0.181: %.15d = impl_witness_access %Inc.lookup_impl_witness, element0 [symbolic] +// CHECK:STDOUT: %specific_impl_fn.be7: = specific_impl_function %impl.elem0.181, @Op.96(%Inc.facet) [symbolic] +// CHECK:STDOUT: %Some.type.fe1: type = fn_type @Some, @Optional(%Int.7ff11f.1) [symbolic] +// CHECK:STDOUT: %Some.aae: %Some.type.fe1 = struct_value () [symbolic] +// CHECK:STDOUT: %Some.specific_fn: = specific_function %Some.aae, @Some(%Int.7ff11f.1) [symbolic] +// CHECK:STDOUT: %None.type.8c4: type = fn_type @None, @Optional(%Int.7ff11f.1) [symbolic] +// CHECK:STDOUT: %None.7a7: %None.type.8c4 = struct_value () [symbolic] +// CHECK:STDOUT: %None.specific_fn: = specific_function %None.7a7, @None(%Int.7ff11f.1) [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.97, @impl.49c(%T.8b3) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.eb8: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%IntRange.365) [concrete] +// CHECK:STDOUT: %Op.type.2d1: type = fn_type @Op.97, @impl.49c(%IntRange.365) [concrete] +// CHECK:STDOUT: %Op.fa8: %Op.type.2d1 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %IntRange.365, (%Destroy.impl_witness.eb8) [concrete] +// CHECK:STDOUT: %.cb4: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn.df8: = specific_function %Op.fa8, @Op.97(%IntRange.365) [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Main.IntRange: %IntRange.type = import_ref Main//lib, IntRange, loaded [concrete = constants.%IntRange.generic] +// CHECK:STDOUT: %Main.Range: %Range.type = import_ref Main//lib, Range, loaded [concrete = constants.%Range] +// CHECK:STDOUT: %Core.ece: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .IntLiteral = %Core.IntLiteral +// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.IntLiteral: %IntLiteral.type = import_ref Core//prelude/types/int_literal, IntLiteral, loaded [concrete = constants.%IntLiteral] +// CHECK:STDOUT: %Main.import_ref.f1e294.1: Core.IntLiteral = import_ref Main//lib, loc4_16, loaded [symbolic = @IntRange.%N (constants.%N)] +// CHECK:STDOUT: %Main.import_ref.30f: = import_ref Main//lib, loc24_1, loaded [symbolic = @IntRange.%complete_type (constants.%complete_type.c76)] +// CHECK:STDOUT: %Main.import_ref.d13 = import_ref Main//lib, inst39 [no loc], unloaded +// CHECK:STDOUT: %Main.import_ref.d98 = import_ref Main//lib, loc5_57, unloaded +// CHECK:STDOUT: %Main.import_ref.e58 = import_ref Main//lib, loc22_20, unloaded +// CHECK:STDOUT: %Main.import_ref.261 = import_ref Main//lib, loc23_18, unloaded +// CHECK:STDOUT: %Main.import_ref.f1e294.2: Core.IntLiteral = import_ref Main//lib, loc4_16, loaded [symbolic = @IntRange.%N (constants.%N)] +// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] +// CHECK:STDOUT: %Core.import_ref.a86: @impl.c81.%Convert.type (%Convert.type.0b2) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.c81.%Convert (constants.%Convert.6d7)] +// CHECK:STDOUT: %ImplicitAs.impl_witness_table.e36 = impl_witness_table (%Core.import_ref.a86), @impl.c81 [concrete] +// CHECK:STDOUT: %Core.import_ref.e33 = import_ref Core//prelude/types/int, loc51_46, unloaded +// CHECK:STDOUT: %Core.import_ref.a58 = import_ref Core//prelude/types/int, loc52_58, unloaded +// CHECK:STDOUT: %Core.import_ref.a39 = import_ref Core//prelude/types/int, loc53_49, unloaded +// CHECK:STDOUT: %Core.import_ref.c4c = import_ref Core//prelude/types/int, loc54_61, unloaded +// CHECK:STDOUT: %OrderedWith.impl_witness_table.0e1 = impl_witness_table (%Core.import_ref.e33, %Core.import_ref.a58, %Core.import_ref.a39, %Core.import_ref.c4c), @impl.5b6 [concrete] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Main.import_ref.0c8 = import_ref Main//lib, loc9_87, unloaded +// CHECK:STDOUT: %Main.import_ref.f1e294.3: Core.IntLiteral = import_ref Main//lib, loc4_16, loaded [symbolic = @IntRange.%N (constants.%N)] +// CHECK:STDOUT: %Main.import_ref.dae: type = import_ref Main//lib, loc9_8, loaded [symbolic = @impl.e7f.%IntRange (constants.%IntRange.349)] +// CHECK:STDOUT: %Main.import_ref.35b: type = import_ref Main//lib, loc9_24, loaded [symbolic = @impl.e7f.%Iterate_where.type (constants.%Iterate_where.type)] +// CHECK:STDOUT: %Main.import_ref.e3faa9.1 = import_ref Main//lib, loc9_87, unloaded +// CHECK:STDOUT: %Main.import_ref.e3faa9.2 = import_ref Main//lib, loc9_87, unloaded +// CHECK:STDOUT: %Main.import_ref.11c = import_ref Main//lib, loc10_47, unloaded +// CHECK:STDOUT: %Main.import_ref.f97 = import_ref Main//lib, loc11_77, unloaded +// CHECK:STDOUT: %Iterate.impl_witness_table = impl_witness_table (%Main.import_ref.e3faa9.1, %Main.import_ref.e3faa9.2, %Main.import_ref.11c, %Main.import_ref.f97), @impl.e7f [concrete] +// CHECK:STDOUT: %Main.import_ref.f1e294.4: Core.IntLiteral = import_ref Main//lib, loc4_16, loaded [symbolic = @IntRange.%N (constants.%N)] +// CHECK:STDOUT: %Main.import_ref.f1e294.5: Core.IntLiteral = import_ref Main//lib, loc4_16, loaded [symbolic = @IntRange.%N (constants.%N)] +// CHECK:STDOUT: %Main.import_ref.014 = import_ref Main//lib, inst519 [indirect], unloaded +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/destroy, loc15_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .IntRange = imports.%Main.IntRange +// CHECK:STDOUT: .Range = imports.%Main.Range +// CHECK:STDOUT: .Core = imports.%Core.ece +// CHECK:STDOUT: .Read = %Read.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %default.import = import +// CHECK:STDOUT: %Read.decl: %Read.type = fn_decl @Read [concrete = constants.%Read] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.e7f(imports.%Main.import_ref.f1e294.3: Core.IntLiteral) [from "lib.carbon"] { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %IntRange: type = class_type @IntRange, @IntRange(%N) [symbolic = %IntRange (constants.%IntRange.349)] +// CHECK:STDOUT: %Int: type = class_type @Int, @Int(%N) [symbolic = %Int (constants.%Int.7ff11f.1)] +// CHECK:STDOUT: %Iterate_where.type: type = facet_type <@Iterate where constants.%impl.elem0.a12 = %Int and constants.%impl.elem1 = %Int> [symbolic = %Iterate_where.type (constants.%Iterate_where.type)] +// CHECK:STDOUT: %require_complete: = require_complete_type %Iterate_where.type [symbolic = %require_complete (constants.%require_complete.6f5)] +// CHECK:STDOUT: %Iterate.impl_witness: = impl_witness imports.%Iterate.impl_witness_table, @impl.e7f(%N) [symbolic = %Iterate.impl_witness (constants.%Iterate.impl_witness)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %NewCursor.type: type = fn_type @NewCursor, @impl.e7f(%N) [symbolic = %NewCursor.type (constants.%NewCursor.type)] +// CHECK:STDOUT: %NewCursor: @impl.e7f.%NewCursor.type (%NewCursor.type) = struct_value () [symbolic = %NewCursor (constants.%NewCursor)] +// CHECK:STDOUT: %Next.type: type = fn_type @Next, @impl.e7f(%N) [symbolic = %Next.type (constants.%Next.type)] +// CHECK:STDOUT: %Next: @impl.e7f.%Next.type (%Next.type) = struct_value () [symbolic = %Next (constants.%Next)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%Main.import_ref.dae as imports.%Main.import_ref.35b { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%Main.import_ref.0c8 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic class @IntRange(imports.%Main.import_ref.f1e294.1: Core.IntLiteral) [from "lib.carbon"] { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Make.type: type = fn_type @Make, @IntRange(%N) [symbolic = %Make.type (constants.%Make.type.51f)] +// CHECK:STDOUT: %Make: @IntRange.%Make.type (%Make.type.51f) = struct_value () [symbolic = %Make (constants.%Make.2ec)] +// CHECK:STDOUT: %Int: type = class_type @Int, @Int(%N) [symbolic = %Int (constants.%Int.7ff11f.1)] +// CHECK:STDOUT: %require_complete: = require_complete_type %Int [symbolic = %require_complete (constants.%require_complete.ffde5f.1)] +// CHECK:STDOUT: %IntRange: type = class_type @IntRange, @IntRange(%N) [symbolic = %IntRange (constants.%IntRange.349)] +// CHECK:STDOUT: %IntRange.elem: type = unbound_element_type %IntRange, %Int [symbolic = %IntRange.elem (constants.%IntRange.elem.ecb)] +// CHECK:STDOUT: %struct_type.start.end: type = struct_type {.start: @IntRange.%Int (%Int.7ff11f.1), .end: @IntRange.%Int (%Int.7ff11f.1)} [symbolic = %struct_type.start.end (constants.%struct_type.start.end.434)] +// CHECK:STDOUT: %complete_type: = complete_type_witness %struct_type.start.end [symbolic = %complete_type (constants.%complete_type.c76)] +// CHECK:STDOUT: +// CHECK:STDOUT: class { +// CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.30f +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%Main.import_ref.d13 +// CHECK:STDOUT: .Make = imports.%Main.import_ref.d98 +// CHECK:STDOUT: .start [private] = imports.%Main.import_ref.e58 +// CHECK:STDOUT: .end [private] = imports.%Main.import_ref.261 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Read() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: name_binding_decl { +// CHECK:STDOUT: %y.patt: %pattern_type.dc0 = symbolic_binding_pattern y, 0 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: %int_43: Core.IntLiteral = int_value 43 [concrete = constants.%int_43] +// CHECK:STDOUT: %.loc5_27.1: type = splice_block %.loc5_27.3 [concrete = Core.IntLiteral] { +// CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core.ece [concrete = imports.%Core.ece] +// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%Core.IntLiteral [concrete = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [concrete = Core.IntLiteral] +// CHECK:STDOUT: %.loc5_27.2: type = value_of_initializer %int_literal.make_type [concrete = Core.IntLiteral] +// CHECK:STDOUT: %.loc5_27.3: type = converted %int_literal.make_type, %.loc5_27.2 [concrete = Core.IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: %y: Core.IntLiteral = bind_symbolic_name y, 0, %int_43 [symbolic = constants.%y] +// CHECK:STDOUT: name_binding_decl { +// CHECK:STDOUT: %x.patt: %pattern_type.d16 = binding_pattern x [concrete] +// CHECK:STDOUT: %x.var_patt: %pattern_type.d16 = var_pattern %x.patt [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: %x.var: ref %IntRange.365 = var %x.var_patt +// CHECK:STDOUT: %Range.ref: %Range.type = name_ref Range, imports.%Main.Range [concrete = constants.%Range] +// CHECK:STDOUT: %y.ref: Core.IntLiteral = name_ref y, %y [symbolic = constants.%y] +// CHECK:STDOUT: %.loc6_3.1: ref %IntRange.365 = splice_block %x.var {} +// CHECK:STDOUT: %impl.elem0.loc6_31: %.d6a = impl_witness_access constants.%ImplicitAs.impl_witness.e34, element0 [concrete = constants.%Convert.16d] +// CHECK:STDOUT: %bound_method.loc6_31.1: = bound_method %y.ref, %impl.elem0.loc6_31 [symbolic = constants.%Convert.bound] +// CHECK:STDOUT: %specific_fn.loc6_31: = specific_function %impl.elem0.loc6_31, @Convert.3(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc6_31.2: = bound_method %y.ref, %specific_fn.loc6_31 [symbolic = constants.%bound_method] +// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc6_31.2(%y.ref) [symbolic = constants.%int.convert_checked.58b] +// CHECK:STDOUT: %.loc6_31.1: %i32 = value_of_initializer %int.convert_checked [symbolic = constants.%int.convert_checked.58b] +// CHECK:STDOUT: %.loc6_31.2: %i32 = converted %y.ref, %.loc6_31.1 [symbolic = constants.%int.convert_checked.58b] +// CHECK:STDOUT: %Range.call: init %IntRange.365 = call %Range.ref(%.loc6_31.2) to %.loc6_3.1 +// CHECK:STDOUT: assign %x.var, %Range.call +// CHECK:STDOUT: %.loc6_21: type = splice_block %IntRange [concrete = constants.%IntRange.365] { +// CHECK:STDOUT: %IntRange.ref: %IntRange.type = name_ref IntRange, imports.%Main.IntRange [concrete = constants.%IntRange.generic] +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %IntRange: type = class_type @IntRange, @IntRange(constants.%int_32) [concrete = constants.%IntRange.365] +// CHECK:STDOUT: } +// CHECK:STDOUT: %x: ref %IntRange.365 = bind_name x, %x.var +// CHECK:STDOUT: %impl.elem0.loc6_3.1: %.cb4 = impl_witness_access constants.%Destroy.impl_witness.eb8, element0 [concrete = constants.%Op.fa8] +// CHECK:STDOUT: %bound_method.loc6_3.1: = bound_method %.loc6_3.1, %impl.elem0.loc6_3.1 +// CHECK:STDOUT: %specific_fn.loc6_3.1: = specific_function %impl.elem0.loc6_3.1, @Op.97(constants.%IntRange.365) [concrete = constants.%Op.specific_fn.df8] +// CHECK:STDOUT: %bound_method.loc6_3.2: = bound_method %.loc6_3.1, %specific_fn.loc6_3.1 +// CHECK:STDOUT: %.loc6_3.2: %IntRange.365 = bind_value %.loc6_3.1 +// CHECK:STDOUT: %no_op.loc6_3.1: init %empty_tuple.type = call %bound_method.loc6_3.2(%.loc6_3.2) +// CHECK:STDOUT: %impl.elem0.loc6_3.2: %.cb4 = impl_witness_access constants.%Destroy.impl_witness.eb8, element0 [concrete = constants.%Op.fa8] +// CHECK:STDOUT: %bound_method.loc6_3.3: = bound_method %x.var, %impl.elem0.loc6_3.2 +// CHECK:STDOUT: %specific_fn.loc6_3.2: = specific_function %impl.elem0.loc6_3.2, @Op.97(constants.%IntRange.365) [concrete = constants.%Op.specific_fn.df8] +// CHECK:STDOUT: %bound_method.loc6_3.4: = bound_method %x.var, %specific_fn.loc6_3.2 +// CHECK:STDOUT: %.loc6_3.3: %IntRange.365 = bind_value %x.var +// CHECK:STDOUT: %no_op.loc6_3.2: init %empty_tuple.type = call %bound_method.loc6_3.4(%.loc6_3.3) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Make(imports.%Main.import_ref.f1e294.2: Core.IntLiteral) [from "lib.carbon"] { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %Int: type = class_type @Int, @Int(%N) [symbolic = %Int (constants.%Int.7ff11f.1)] +// CHECK:STDOUT: %pattern_type.1: type = pattern_type %Int [symbolic = %pattern_type.1 (constants.%pattern_type.0ede7b.1)] +// CHECK:STDOUT: %IntRange: type = class_type @IntRange, @IntRange(%N) [symbolic = %IntRange (constants.%IntRange.349)] +// CHECK:STDOUT: %pattern_type.2: type = pattern_type %IntRange [symbolic = %pattern_type.2 (constants.%pattern_type.dcd)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete.1: = require_complete_type %IntRange [symbolic = %require_complete.1 (constants.%require_complete.524)] +// CHECK:STDOUT: %require_complete.2: = require_complete_type %Int [symbolic = %require_complete.2 (constants.%require_complete.ffde5f.1)] +// CHECK:STDOUT: %struct_type.start.end: type = struct_type {.start: @Make.%Int (%Int.7ff11f.1), .end: @Make.%Int (%Int.7ff11f.1)} [symbolic = %struct_type.start.end (constants.%struct_type.start.end.434)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Range [from "lib.carbon"]; +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @NewCursor(imports.%Main.import_ref.f1e294.4: Core.IntLiteral) [from "lib.carbon"] { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %IntRange: type = class_type @IntRange, @IntRange(%N) [symbolic = %IntRange (constants.%IntRange.349)] +// CHECK:STDOUT: %pattern_type.1: type = pattern_type %IntRange [symbolic = %pattern_type.1 (constants.%pattern_type.dcd)] +// CHECK:STDOUT: %Int: type = class_type @Int, @Int(%N) [symbolic = %Int (constants.%Int.7ff11f.1)] +// CHECK:STDOUT: %pattern_type.2: type = pattern_type %Int [symbolic = %pattern_type.2 (constants.%pattern_type.0ede7b.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete.1: = require_complete_type %IntRange [symbolic = %require_complete.1 (constants.%require_complete.524)] +// CHECK:STDOUT: %IntRange.elem: type = unbound_element_type %IntRange, %Int [symbolic = %IntRange.elem (constants.%IntRange.elem.ecb)] +// CHECK:STDOUT: %require_complete.2: = require_complete_type %Int [symbolic = %require_complete.2 (constants.%require_complete.ffde5f.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Next(imports.%Main.import_ref.f1e294.5: Core.IntLiteral) [from "lib.carbon"] { +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] +// CHECK:STDOUT: %IntRange: type = class_type @IntRange, @IntRange(%N) [symbolic = %IntRange (constants.%IntRange.349)] +// CHECK:STDOUT: %pattern_type.1: type = pattern_type %IntRange [symbolic = %pattern_type.1 (constants.%pattern_type.dcd)] +// CHECK:STDOUT: %Int: type = class_type @Int, @Int(%N) [symbolic = %Int (constants.%Int.7ff11f.1)] +// CHECK:STDOUT: %ptr: type = ptr_type %Int [symbolic = %ptr (constants.%ptr.58a)] +// CHECK:STDOUT: %pattern_type.2: type = pattern_type %ptr [symbolic = %pattern_type.2 (constants.%pattern_type.6d0)] +// CHECK:STDOUT: %Optional: type = class_type @Optional, @Optional(%Int) [symbolic = %Optional (constants.%Optional.e9f)] +// CHECK:STDOUT: %pattern_type.3: type = pattern_type %Optional [symbolic = %pattern_type.3 (constants.%pattern_type.fd8)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete.1: = require_complete_type %Optional [symbolic = %require_complete.1 (constants.%require_complete.5a1)] +// CHECK:STDOUT: %require_complete.2: = require_complete_type %IntRange [symbolic = %require_complete.2 (constants.%require_complete.524)] +// CHECK:STDOUT: %require_complete.3: = require_complete_type %ptr [symbolic = %require_complete.3 (constants.%require_complete.656)] +// CHECK:STDOUT: %require_complete.4: = require_complete_type %Int [symbolic = %require_complete.4 (constants.%require_complete.ffde5f.1)] +// CHECK:STDOUT: %pattern_type.4: type = pattern_type %Int [symbolic = %pattern_type.4 (constants.%pattern_type.0ede7b.1)] +// CHECK:STDOUT: %IntRange.elem: type = unbound_element_type %IntRange, %Int [symbolic = %IntRange.elem (constants.%IntRange.elem.ecb)] +// CHECK:STDOUT: %OrderedWith.type: type = facet_type <@OrderedWith, @OrderedWith(%Int)> [symbolic = %OrderedWith.type (constants.%OrderedWith.type.256)] +// CHECK:STDOUT: %require_complete.5: = require_complete_type %OrderedWith.type [symbolic = %require_complete.5 (constants.%require_complete.10b)] +// CHECK:STDOUT: %OrderedWith.assoc_type: type = assoc_entity_type @OrderedWith, @OrderedWith(%Int) [symbolic = %OrderedWith.assoc_type (constants.%OrderedWith.assoc_type.e53)] +// CHECK:STDOUT: %assoc0: @Next.%OrderedWith.assoc_type (%OrderedWith.assoc_type.e53) = assoc_entity element0, imports.%Main.import_ref.014 [symbolic = %assoc0 (constants.%assoc0.d1b)] +// CHECK:STDOUT: %OrderedWith.impl_witness: = impl_witness imports.%OrderedWith.impl_witness_table.0e1, @impl.5b6(%N, %N) [symbolic = %OrderedWith.impl_witness (constants.%OrderedWith.impl_witness.350)] +// CHECK:STDOUT: %Less.type.1: type = fn_type @Less.1, @OrderedWith(%Int) [symbolic = %Less.type.1 (constants.%Less.type.016)] +// CHECK:STDOUT: %OrderedWith.facet: @Next.%OrderedWith.type (%OrderedWith.type.256) = facet_value %Int, (%OrderedWith.impl_witness) [symbolic = %OrderedWith.facet (constants.%OrderedWith.facet)] +// CHECK:STDOUT: %.1: type = fn_type_with_self_type %Less.type.1, %OrderedWith.facet [symbolic = %.1 (constants.%.3bd)] +// CHECK:STDOUT: %Less.type.2: type = fn_type @Less.2, @impl.5b6(%N, %N) [symbolic = %Less.type.2 (constants.%Less.type.4f5)] +// CHECK:STDOUT: %Less: @Next.%Less.type.2 (%Less.type.4f5) = struct_value () [symbolic = %Less (constants.%Less.3b5)] +// CHECK:STDOUT: %Less.specific_fn: = specific_function %Less, @Less.2(%N, %N) [symbolic = %Less.specific_fn (constants.%Less.specific_fn.5e2)] +// CHECK:STDOUT: %Inc.lookup_impl_witness: = lookup_impl_witness %Int, @Inc [symbolic = %Inc.lookup_impl_witness (constants.%Inc.lookup_impl_witness)] +// CHECK:STDOUT: %Inc.facet: %Inc.type = facet_value %Int, (%Inc.lookup_impl_witness) [symbolic = %Inc.facet (constants.%Inc.facet)] +// CHECK:STDOUT: %.2: type = fn_type_with_self_type constants.%Op.type.e3a, %Inc.facet [symbolic = %.2 (constants.%.15d)] +// CHECK:STDOUT: %impl.elem0: @Next.%.2 (%.15d) = impl_witness_access %Inc.lookup_impl_witness, element0 [symbolic = %impl.elem0 (constants.%impl.elem0.181)] +// CHECK:STDOUT: %specific_impl_fn: = specific_impl_function %impl.elem0, @Op.96(%Inc.facet) [symbolic = %specific_impl_fn (constants.%specific_impl_fn.be7)] +// CHECK:STDOUT: %Some.type: type = fn_type @Some, @Optional(%Int) [symbolic = %Some.type (constants.%Some.type.fe1)] +// CHECK:STDOUT: %Some: @Next.%Some.type (%Some.type.fe1) = struct_value () [symbolic = %Some (constants.%Some.aae)] +// CHECK:STDOUT: %Some.specific_fn: = specific_function %Some, @Some(%Int) [symbolic = %Some.specific_fn (constants.%Some.specific_fn)] +// CHECK:STDOUT: %None.type: type = fn_type @None, @Optional(%Int) [symbolic = %None.type (constants.%None.type.8c4)] +// CHECK:STDOUT: %None: @Next.%None.type (%None.type.8c4) = struct_value () [symbolic = %None (constants.%None.7a7)] +// CHECK:STDOUT: %None.specific_fn: = specific_function %None, @None(%Int) [symbolic = %None.specific_fn (constants.%None.specific_fn)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @IntRange(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Make.type => constants.%Make.type.51f +// CHECK:STDOUT: %Make => constants.%Make.2ec +// CHECK:STDOUT: %Int => constants.%Int.7ff11f.1 +// CHECK:STDOUT: %require_complete => constants.%require_complete.ffde5f.1 +// CHECK:STDOUT: %IntRange => constants.%IntRange.349 +// CHECK:STDOUT: %IntRange.elem => constants.%IntRange.elem.ecb +// CHECK:STDOUT: %struct_type.start.end => constants.%struct_type.start.end.434 +// CHECK:STDOUT: %complete_type => constants.%complete_type.c76 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Make(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %Int => constants.%Int.7ff11f.1 +// CHECK:STDOUT: %pattern_type.1 => constants.%pattern_type.0ede7b.1 +// CHECK:STDOUT: %IntRange => constants.%IntRange.349 +// CHECK:STDOUT: %pattern_type.2 => constants.%pattern_type.dcd +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @IntRange(constants.%int_32) { +// CHECK:STDOUT: %N => constants.%int_32 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Make.type => constants.%Make.type.cef +// CHECK:STDOUT: %Make => constants.%Make.0dc +// CHECK:STDOUT: %Int => constants.%i32 +// CHECK:STDOUT: %require_complete => constants.%complete_type.f8a +// CHECK:STDOUT: %IntRange => constants.%IntRange.365 +// CHECK:STDOUT: %IntRange.elem => constants.%IntRange.elem.f21 +// CHECK:STDOUT: %struct_type.start.end => constants.%struct_type.start.end.0fe +// CHECK:STDOUT: %complete_type => constants.%complete_type.a43 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.e7f(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %IntRange => constants.%IntRange.349 +// CHECK:STDOUT: %Int => constants.%Int.7ff11f.1 +// CHECK:STDOUT: %Iterate_where.type => constants.%Iterate_where.type +// CHECK:STDOUT: %require_complete => constants.%require_complete.6f5 +// CHECK:STDOUT: %Iterate.impl_witness => constants.%Iterate.impl_witness +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %NewCursor.type => constants.%NewCursor.type +// CHECK:STDOUT: %NewCursor => constants.%NewCursor +// CHECK:STDOUT: %Next.type => constants.%Next.type +// CHECK:STDOUT: %Next => constants.%Next +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @NewCursor(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %IntRange => constants.%IntRange.349 +// CHECK:STDOUT: %pattern_type.1 => constants.%pattern_type.dcd +// CHECK:STDOUT: %Int => constants.%Int.7ff11f.1 +// CHECK:STDOUT: %pattern_type.2 => constants.%pattern_type.0ede7b.1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Next(constants.%N) { +// CHECK:STDOUT: %N => constants.%N +// CHECK:STDOUT: %IntRange => constants.%IntRange.349 +// CHECK:STDOUT: %pattern_type.1 => constants.%pattern_type.dcd +// CHECK:STDOUT: %Int => constants.%Int.7ff11f.1 +// CHECK:STDOUT: %ptr => constants.%ptr.58a +// CHECK:STDOUT: %pattern_type.2 => constants.%pattern_type.6d0 +// CHECK:STDOUT: %Optional => constants.%Optional.e9f +// CHECK:STDOUT: %pattern_type.3 => constants.%pattern_type.fd8 +// CHECK:STDOUT: } +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/for/basic.carbon b/toolchain/check/testdata/for/basic.carbon index 569938ea1cf0..12d6e248e161 100644 --- a/toolchain/check/testdata/for/basic.carbon +++ b/toolchain/check/testdata/for/basic.carbon @@ -92,11 +92,35 @@ fn Run() { // CHECK:STDOUT: %.708: type = fn_type_with_self_type %Next.type.941, %Iterate.facet.d50 [concrete] // CHECK:STDOUT: %HasValue.specific_fn: = specific_function %HasValue.ada, @HasValue(%empty_tuple.type) [concrete] // CHECK:STDOUT: %Get.specific_fn: = specific_function %Get.6e8, @Get(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.1dc: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.type.a63: type = fn_type @Op.2, @impl.49c(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.ea3: %Op.type.a63 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.926: %Destroy.type = facet_value %empty_tuple.type, (%Destroy.impl_witness.1dc) [concrete] +// CHECK:STDOUT: %.346: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.926 [concrete] +// CHECK:STDOUT: %Op.specific_fn.393: = specific_function %Op.ea3, @Op.2(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.003: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%Optional.f9a) [concrete] +// CHECK:STDOUT: %Op.type.7e4: type = fn_type @Op.2, @impl.49c(%Optional.f9a) [concrete] +// CHECK:STDOUT: %Op.466: %Op.type.7e4 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.a27: %Destroy.type = facet_value %Optional.f9a, (%Destroy.impl_witness.003) [concrete] +// CHECK:STDOUT: %.3c9: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.a27 [concrete] +// CHECK:STDOUT: %Op.specific_fn.733: = specific_function %Op.466, @Op.2(%Optional.f9a) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.49d: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%TrivialRange) [concrete] +// CHECK:STDOUT: %Op.type.8d6: type = fn_type @Op.2, @impl.49c(%TrivialRange) [concrete] +// CHECK:STDOUT: %Op.90d: %Op.type.8d6 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.2e4: %Destroy.type = facet_value %TrivialRange, (%Destroy.impl_witness.49d) [concrete] +// CHECK:STDOUT: %.448: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.2e4 [concrete] +// CHECK:STDOUT: %Op.specific_fn.b69: = specific_function %Op.90d, @Op.2(%TrivialRange) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core.import_ref.cd6: @Optional.%HasValue.type (%HasValue.type.a15) = import_ref Core//prelude/parts/iterate, inst98 [indirect], loaded [symbolic = @Optional.%HasValue (constants.%HasValue.73f)] // CHECK:STDOUT: %Core.import_ref.4fd: @Optional.%Get.type (%Get.type.e03) = import_ref Core//prelude/parts/iterate, inst99 [indirect], loaded [symbolic = @Optional.%Get (constants.%Get.971)] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { @@ -113,7 +137,7 @@ fn Run() { // CHECK:STDOUT: %impl.elem2: %.510 = impl_witness_access constants.%Iterate.impl_witness, element2 [concrete = constants.%NewCursor.c20a1c.2] // CHECK:STDOUT: %bound_method.loc18_35.1: = bound_method %.loc18_20.1, %impl.elem2 // CHECK:STDOUT: %.loc18_20.2: %TrivialRange = bind_value %.loc18_20.1 -// CHECK:STDOUT: %NewCursor.ref: %NewCursor.type.bd2331.1 = name_ref NewCursor, @impl.%NewCursor.decl.loc6_32.1 [concrete = constants.%NewCursor.c20a1c.1] +// CHECK:STDOUT: %NewCursor.ref: %NewCursor.type.bd2331.1 = name_ref NewCursor, @impl.f4d.%NewCursor.decl.loc6_32.1 [concrete = constants.%NewCursor.c20a1c.1] // CHECK:STDOUT: %NewCursor.bound: = bound_method %.loc18_20.2, %NewCursor.ref // CHECK:STDOUT: %NewCursor.call: init %empty_tuple.type = call %NewCursor.bound(%.loc18_20.2) // CHECK:STDOUT: %var: ref %empty_tuple.type = var invalid @@ -153,8 +177,8 @@ fn Run() { // CHECK:STDOUT: } // CHECK:STDOUT: %.loc18_35.9: ref %empty_tuple.type = temporary_storage // CHECK:STDOUT: %.loc18_35.10: ref %empty_tuple.type = temporary %.loc18_35.9, %Get.call -// CHECK:STDOUT: %tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc18_35.11: %empty_tuple.type = converted %Get.call, %tuple [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %tuple.loc18_35.1: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc18_35.11: %empty_tuple.type = converted %Get.call, %tuple.loc18_35.1 [concrete = constants.%empty_tuple] // CHECK:STDOUT: %_: %empty_tuple.type = bind_name _, %.loc18_35.11 // CHECK:STDOUT: %Body.ref: %Body.type = name_ref Body, file.%Body.decl [concrete = constants.%Body] // CHECK:STDOUT: %Body.call: init %empty_tuple.type = call %Body.ref() @@ -163,6 +187,32 @@ fn Run() { // CHECK:STDOUT: !for.done: // CHECK:STDOUT: %AfterLoop.ref: %AfterLoop.type = name_ref AfterLoop, file.%AfterLoop.decl [concrete = constants.%AfterLoop] // CHECK:STDOUT: %AfterLoop.call: init %empty_tuple.type = call %AfterLoop.ref() +// CHECK:STDOUT: %impl.elem0.loc18_35.1: %.346 = impl_witness_access constants.%Destroy.impl_witness.1dc, element0 [concrete = constants.%Op.ea3] +// CHECK:STDOUT: %bound_method.loc18_35.5: = bound_method %.loc18_35.9, %impl.elem0.loc18_35.1 +// CHECK:STDOUT: %specific_fn.loc18_35.1: = specific_function %impl.elem0.loc18_35.1, @Op.2(constants.%empty_tuple.type) [concrete = constants.%Op.specific_fn.393] +// CHECK:STDOUT: %bound_method.loc18_35.6: = bound_method %.loc18_35.9, %specific_fn.loc18_35.1 +// CHECK:STDOUT: %tuple.loc18_35.2: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc18_35.12: %empty_tuple.type = converted %.loc18_35.9, %tuple.loc18_35.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %no_op.loc18_35.1: init %empty_tuple.type = call %bound_method.loc18_35.6(%.loc18_35.12) +// CHECK:STDOUT: %impl.elem0.loc18_35.2: %.3c9 = impl_witness_access constants.%Destroy.impl_witness.003, element0 [concrete = constants.%Op.466] +// CHECK:STDOUT: %bound_method.loc18_35.7: = bound_method %.loc18_35.1, %impl.elem0.loc18_35.2 +// CHECK:STDOUT: %specific_fn.loc18_35.2: = specific_function %impl.elem0.loc18_35.2, @Op.2(constants.%Optional.f9a) [concrete = constants.%Op.specific_fn.733] +// CHECK:STDOUT: %bound_method.loc18_35.8: = bound_method %.loc18_35.1, %specific_fn.loc18_35.2 +// CHECK:STDOUT: %.loc18_35.13: %Optional.f9a = bind_value %.loc18_35.1 +// CHECK:STDOUT: %no_op.loc18_35.2: init %empty_tuple.type = call %bound_method.loc18_35.8(%.loc18_35.13) +// CHECK:STDOUT: %impl.elem0.loc18_35.3: %.346 = impl_witness_access constants.%Destroy.impl_witness.1dc, element0 [concrete = constants.%Op.ea3] +// CHECK:STDOUT: %bound_method.loc18_35.9: = bound_method %var, %impl.elem0.loc18_35.3 +// CHECK:STDOUT: %specific_fn.loc18_35.3: = specific_function %impl.elem0.loc18_35.3, @Op.2(constants.%empty_tuple.type) [concrete = constants.%Op.specific_fn.393] +// CHECK:STDOUT: %bound_method.loc18_35.10: = bound_method %var, %specific_fn.loc18_35.3 +// CHECK:STDOUT: %tuple.loc18_35.3: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc18_35.14: %empty_tuple.type = converted %var, %tuple.loc18_35.3 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %no_op.loc18_35.3: init %empty_tuple.type = call %bound_method.loc18_35.10(%.loc18_35.14) +// CHECK:STDOUT: %impl.elem0.loc18_18: %.448 = impl_witness_access constants.%Destroy.impl_witness.49d, element0 [concrete = constants.%Op.90d] +// CHECK:STDOUT: %bound_method.loc18_18.1: = bound_method %.loc18_18.2, %impl.elem0.loc18_18 +// CHECK:STDOUT: %specific_fn.loc18_18: = specific_function %impl.elem0.loc18_18, @Op.2(constants.%TrivialRange) [concrete = constants.%Op.specific_fn.b69] +// CHECK:STDOUT: %bound_method.loc18_18.2: = bound_method %.loc18_18.2, %specific_fn.loc18_18 +// CHECK:STDOUT: %.loc18_18.5: %TrivialRange = bind_value %.loc18_18.2 +// CHECK:STDOUT: %no_op.loc18_18: init %empty_tuple.type = call %bound_method.loc18_18.2(%.loc18_18.5) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/for/pattern.carbon b/toolchain/check/testdata/for/pattern.carbon index f2d0754e3c0b..ecc6f69322e1 100644 --- a/toolchain/check/testdata/for/pattern.carbon +++ b/toolchain/check/testdata/for/pattern.carbon @@ -139,18 +139,18 @@ fn Run() { // CHECK:STDOUT: %Make.specific_fn: = specific_function %Make.74d, @Make(%C) [concrete] // CHECK:STDOUT: %Iterate.type: type = facet_type <@Iterate> [concrete] // CHECK:STDOUT: %NewCursor.type.427: type = fn_type @NewCursor.1 [concrete] -// CHECK:STDOUT: %NewCursor.type.f5f: type = fn_type @NewCursor.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %NewCursor.type.f5f: type = fn_type @NewCursor.2, @impl.86e(%T) [symbolic] // CHECK:STDOUT: %NewCursor.ec1: %NewCursor.type.f5f = struct_value () [symbolic] -// CHECK:STDOUT: %Next.type.264: type = fn_type @Next.1, @impl(%T) [symbolic] +// CHECK:STDOUT: %Next.type.264: type = fn_type @Next.1, @impl.86e(%T) [symbolic] // CHECK:STDOUT: %Next.08e: %Next.type.264 = struct_value () [symbolic] // CHECK:STDOUT: %HasValue.type.f81: type = fn_type @HasValue, @Optional(%T) [symbolic] // CHECK:STDOUT: %HasValue.6fd: %HasValue.type.f81 = struct_value () [symbolic] // CHECK:STDOUT: %Get.type.b8f: type = fn_type @Get, @Optional(%T) [symbolic] // CHECK:STDOUT: %Get.9c8: %Get.type.b8f = struct_value () [symbolic] -// CHECK:STDOUT: %Iterate.impl_witness.52a: = impl_witness imports.%Iterate.impl_witness_table, @impl(%C) [concrete] -// CHECK:STDOUT: %NewCursor.type.951: type = fn_type @NewCursor.2, @impl(%C) [concrete] +// CHECK:STDOUT: %Iterate.impl_witness.52a: = impl_witness imports.%Iterate.impl_witness_table, @impl.86e(%C) [concrete] +// CHECK:STDOUT: %NewCursor.type.951: type = fn_type @NewCursor.2, @impl.86e(%C) [concrete] // CHECK:STDOUT: %NewCursor.535: %NewCursor.type.951 = struct_value () [concrete] -// CHECK:STDOUT: %Next.type.63f: type = fn_type @Next.1, @impl(%C) [concrete] +// CHECK:STDOUT: %Next.type.63f: type = fn_type @Next.1, @impl.86e(%C) [concrete] // CHECK:STDOUT: %Next.899: %Next.type.63f = struct_value () [concrete] // CHECK:STDOUT: %Iterate.facet: %Iterate.type = facet_value %EmptyRange.cc8, (%Iterate.impl_witness.52a) [concrete] // CHECK:STDOUT: %.2f6: type = fn_type_with_self_type %NewCursor.type.427, %Iterate.facet [concrete] @@ -165,6 +165,35 @@ fn Run() { // CHECK:STDOUT: %Get.9c1: %Get.type.115 = struct_value () [concrete] // CHECK:STDOUT: %HasValue.specific_fn: = specific_function %HasValue.513, @HasValue(%C) [concrete] // CHECK:STDOUT: %Get.specific_fn: = specific_function %Get.9c1, @Get(%C) [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.906: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%C) [concrete] +// CHECK:STDOUT: %Op.type.153: type = fn_type @Op.2, @impl.49c(%C) [concrete] +// CHECK:STDOUT: %Op.5d7: %Op.type.153 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.494: %Destroy.type = facet_value %C, (%Destroy.impl_witness.906) [concrete] +// CHECK:STDOUT: %.b80: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.494 [concrete] +// CHECK:STDOUT: %Op.specific_fn.6eb: = specific_function %Op.5d7, @Op.2(%C) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.b11: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%Optional.cf0) [concrete] +// CHECK:STDOUT: %Op.type.867: type = fn_type @Op.2, @impl.49c(%Optional.cf0) [concrete] +// CHECK:STDOUT: %Op.3e8: %Op.type.867 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.530: %Destroy.type = facet_value %Optional.cf0, (%Destroy.impl_witness.b11) [concrete] +// CHECK:STDOUT: %.1f9: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.530 [concrete] +// CHECK:STDOUT: %Op.specific_fn.273: = specific_function %Op.3e8, @Op.2(%Optional.cf0) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.eb8: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%empty_struct_type) [concrete] +// CHECK:STDOUT: %Op.type.069: type = fn_type @Op.2, @impl.49c(%empty_struct_type) [concrete] +// CHECK:STDOUT: %Op.d5a: %Op.type.069 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.e2f: %Destroy.type = facet_value %empty_struct_type, (%Destroy.impl_witness.eb8) [concrete] +// CHECK:STDOUT: %.9da: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.e2f [concrete] +// CHECK:STDOUT: %Op.specific_fn.652: = specific_function %Op.d5a, @Op.2(%empty_struct_type) [concrete] +// CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.506: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%EmptyRange.cc8) [concrete] +// CHECK:STDOUT: %Op.type.88d: type = fn_type @Op.2, @impl.49c(%EmptyRange.cc8) [concrete] +// CHECK:STDOUT: %Op.929: %Op.type.88d = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.750: %Destroy.type = facet_value %EmptyRange.cc8, (%Destroy.impl_witness.506) [concrete] +// CHECK:STDOUT: %.053: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.750 [concrete] +// CHECK:STDOUT: %Op.specific_fn.a14: = specific_function %Op.929, @Op.2(%EmptyRange.cc8) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -172,11 +201,13 @@ fn Run() { // CHECK:STDOUT: %Main.import_ref.6ea: @EmptyRange.%Make.type (%Make.type.bd2) = import_ref Main//empty_range, loc5_21, loaded [symbolic = @EmptyRange.%Make (constants.%Make.ed1)] // CHECK:STDOUT: %Main.import_ref.6ce = import_ref Main//empty_range, loc7_68, unloaded // CHECK:STDOUT: %Main.import_ref.999 = import_ref Main//empty_range, loc7_68, unloaded -// CHECK:STDOUT: %Main.import_ref.57b: @impl.%NewCursor.type (%NewCursor.type.f5f) = import_ref Main//empty_range, loc8_38, loaded [symbolic = @impl.%NewCursor (constants.%NewCursor.ec1)] -// CHECK:STDOUT: %Main.import_ref.170: @impl.%Next.type (%Next.type.264) = import_ref Main//empty_range, loc11_58, loaded [symbolic = @impl.%Next (constants.%Next.08e)] -// CHECK:STDOUT: %Iterate.impl_witness_table = impl_witness_table (%Main.import_ref.6ce, %Main.import_ref.999, %Main.import_ref.57b, %Main.import_ref.170), @impl [concrete] +// CHECK:STDOUT: %Main.import_ref.57b: @impl.86e.%NewCursor.type (%NewCursor.type.f5f) = import_ref Main//empty_range, loc8_38, loaded [symbolic = @impl.86e.%NewCursor (constants.%NewCursor.ec1)] +// CHECK:STDOUT: %Main.import_ref.170: @impl.86e.%Next.type (%Next.type.264) = import_ref Main//empty_range, loc11_58, loaded [symbolic = @impl.86e.%Next (constants.%Next.08e)] +// CHECK:STDOUT: %Iterate.impl_witness_table = impl_witness_table (%Main.import_ref.6ce, %Main.import_ref.999, %Main.import_ref.57b, %Main.import_ref.170), @impl.86e [concrete] // CHECK:STDOUT: %Main.import_ref.7f9: @Optional.%HasValue.type (%HasValue.type.f81) = import_ref Main//empty_range, inst136 [indirect], loaded [symbolic = @Optional.%HasValue (constants.%HasValue.6fd)] // CHECK:STDOUT: %Main.import_ref.d10: @Optional.%Get.type (%Get.type.b8f) = import_ref Main//empty_range, inst137 [indirect], loaded [symbolic = @Optional.%Get (constants.%Get.9c8)] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { @@ -243,6 +274,31 @@ fn Run() { // CHECK:STDOUT: br !for.next // CHECK:STDOUT: // CHECK:STDOUT: !for.done: +// CHECK:STDOUT: %impl.elem0.loc12_36.1: %.b80 = impl_witness_access constants.%Destroy.impl_witness.906, element0 [concrete = constants.%Op.5d7] +// CHECK:STDOUT: %bound_method.loc12_36.7: = bound_method %.loc12_36.8, %impl.elem0.loc12_36.1 +// CHECK:STDOUT: %specific_fn.loc12_36.3: = specific_function %impl.elem0.loc12_36.1, @Op.2(constants.%C) [concrete = constants.%Op.specific_fn.6eb] +// CHECK:STDOUT: %bound_method.loc12_36.8: = bound_method %.loc12_36.8, %specific_fn.loc12_36.3 +// CHECK:STDOUT: %.loc12_36.12: %C = bind_value %.loc12_36.8 +// CHECK:STDOUT: %no_op.loc12_36.1: init %empty_tuple.type = call %bound_method.loc12_36.8(%.loc12_36.12) +// CHECK:STDOUT: %impl.elem0.loc12_36.2: %.1f9 = impl_witness_access constants.%Destroy.impl_witness.b11, element0 [concrete = constants.%Op.3e8] +// CHECK:STDOUT: %bound_method.loc12_36.9: = bound_method %.loc12_36.1, %impl.elem0.loc12_36.2 +// CHECK:STDOUT: %specific_fn.loc12_36.4: = specific_function %impl.elem0.loc12_36.2, @Op.2(constants.%Optional.cf0) [concrete = constants.%Op.specific_fn.273] +// CHECK:STDOUT: %bound_method.loc12_36.10: = bound_method %.loc12_36.1, %specific_fn.loc12_36.4 +// CHECK:STDOUT: %.loc12_36.13: %Optional.cf0 = bind_value %.loc12_36.1 +// CHECK:STDOUT: %no_op.loc12_36.2: init %empty_tuple.type = call %bound_method.loc12_36.10(%.loc12_36.13) +// CHECK:STDOUT: %impl.elem0.loc12_36.3: %.9da = impl_witness_access constants.%Destroy.impl_witness.eb8, element0 [concrete = constants.%Op.d5a] +// CHECK:STDOUT: %bound_method.loc12_36.11: = bound_method %var, %impl.elem0.loc12_36.3 +// CHECK:STDOUT: %specific_fn.loc12_36.5: = specific_function %impl.elem0.loc12_36.3, @Op.2(constants.%empty_struct_type) [concrete = constants.%Op.specific_fn.652] +// CHECK:STDOUT: %bound_method.loc12_36.12: = bound_method %var, %specific_fn.loc12_36.5 +// CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc12_36.14: %empty_struct_type = converted %var, %empty_struct [concrete = constants.%empty_struct] +// CHECK:STDOUT: %no_op.loc12_36.3: init %empty_tuple.type = call %bound_method.loc12_36.12(%.loc12_36.14) +// CHECK:STDOUT: %impl.elem0.loc12_35: %.053 = impl_witness_access constants.%Destroy.impl_witness.506, element0 [concrete = constants.%Op.929] +// CHECK:STDOUT: %bound_method.loc12_35.1: = bound_method %.loc12_35.1, %impl.elem0.loc12_35 +// CHECK:STDOUT: %specific_fn.loc12_35: = specific_function %impl.elem0.loc12_35, @Op.2(constants.%EmptyRange.cc8) [concrete = constants.%Op.specific_fn.a14] +// CHECK:STDOUT: %bound_method.loc12_35.2: = bound_method %.loc12_35.1, %specific_fn.loc12_35 +// CHECK:STDOUT: %.loc12_35.5: %EmptyRange.cc8 = bind_value %.loc12_35.1 +// CHECK:STDOUT: %no_op.loc12_35: init %empty_tuple.type = call %bound_method.loc12_35.2(%.loc12_35.5) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -268,18 +324,18 @@ fn Run() { // CHECK:STDOUT: %Make.specific_fn: = specific_function %Make.74d, @Make(%C) [concrete] // CHECK:STDOUT: %Iterate.type: type = facet_type <@Iterate> [concrete] // CHECK:STDOUT: %NewCursor.type.427: type = fn_type @NewCursor.1 [concrete] -// CHECK:STDOUT: %NewCursor.type.f5f: type = fn_type @NewCursor.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %NewCursor.type.f5f: type = fn_type @NewCursor.2, @impl.86e(%T) [symbolic] // CHECK:STDOUT: %NewCursor.ec1: %NewCursor.type.f5f = struct_value () [symbolic] -// CHECK:STDOUT: %Next.type.264: type = fn_type @Next.1, @impl(%T) [symbolic] +// CHECK:STDOUT: %Next.type.264: type = fn_type @Next.1, @impl.86e(%T) [symbolic] // CHECK:STDOUT: %Next.08e: %Next.type.264 = struct_value () [symbolic] // CHECK:STDOUT: %HasValue.type.f81: type = fn_type @HasValue, @Optional(%T) [symbolic] // CHECK:STDOUT: %HasValue.6fd: %HasValue.type.f81 = struct_value () [symbolic] // CHECK:STDOUT: %Get.type.b8f: type = fn_type @Get, @Optional(%T) [symbolic] // CHECK:STDOUT: %Get.9c8: %Get.type.b8f = struct_value () [symbolic] -// CHECK:STDOUT: %Iterate.impl_witness.52a: = impl_witness imports.%Iterate.impl_witness_table, @impl(%C) [concrete] -// CHECK:STDOUT: %NewCursor.type.951: type = fn_type @NewCursor.2, @impl(%C) [concrete] +// CHECK:STDOUT: %Iterate.impl_witness.52a: = impl_witness imports.%Iterate.impl_witness_table, @impl.86e(%C) [concrete] +// CHECK:STDOUT: %NewCursor.type.951: type = fn_type @NewCursor.2, @impl.86e(%C) [concrete] // CHECK:STDOUT: %NewCursor.535: %NewCursor.type.951 = struct_value () [concrete] -// CHECK:STDOUT: %Next.type.63f: type = fn_type @Next.1, @impl(%C) [concrete] +// CHECK:STDOUT: %Next.type.63f: type = fn_type @Next.1, @impl.86e(%C) [concrete] // CHECK:STDOUT: %Next.899: %Next.type.63f = struct_value () [concrete] // CHECK:STDOUT: %Iterate.facet: %Iterate.type = facet_value %EmptyRange.cc8, (%Iterate.impl_witness.52a) [concrete] // CHECK:STDOUT: %.2f6: type = fn_type_with_self_type %NewCursor.type.427, %Iterate.facet [concrete] @@ -294,6 +350,35 @@ fn Run() { // CHECK:STDOUT: %Get.9c1: %Get.type.115 = struct_value () [concrete] // CHECK:STDOUT: %HasValue.specific_fn: = specific_function %HasValue.513, @HasValue(%C) [concrete] // CHECK:STDOUT: %Get.specific_fn: = specific_function %Get.9c1, @Get(%C) [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.906: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%C) [concrete] +// CHECK:STDOUT: %Op.type.153: type = fn_type @Op.2, @impl.49c(%C) [concrete] +// CHECK:STDOUT: %Op.5d7: %Op.type.153 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.494: %Destroy.type = facet_value %C, (%Destroy.impl_witness.906) [concrete] +// CHECK:STDOUT: %.b80: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.494 [concrete] +// CHECK:STDOUT: %Op.specific_fn.6eb: = specific_function %Op.5d7, @Op.2(%C) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.b11: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%Optional.cf0) [concrete] +// CHECK:STDOUT: %Op.type.867: type = fn_type @Op.2, @impl.49c(%Optional.cf0) [concrete] +// CHECK:STDOUT: %Op.3e8: %Op.type.867 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.530: %Destroy.type = facet_value %Optional.cf0, (%Destroy.impl_witness.b11) [concrete] +// CHECK:STDOUT: %.1f9: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.530 [concrete] +// CHECK:STDOUT: %Op.specific_fn.273: = specific_function %Op.3e8, @Op.2(%Optional.cf0) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.eb8: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%empty_struct_type) [concrete] +// CHECK:STDOUT: %Op.type.069: type = fn_type @Op.2, @impl.49c(%empty_struct_type) [concrete] +// CHECK:STDOUT: %Op.d5a: %Op.type.069 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.e2f: %Destroy.type = facet_value %empty_struct_type, (%Destroy.impl_witness.eb8) [concrete] +// CHECK:STDOUT: %.9da: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.e2f [concrete] +// CHECK:STDOUT: %Op.specific_fn.652: = specific_function %Op.d5a, @Op.2(%empty_struct_type) [concrete] +// CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.506: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%EmptyRange.cc8) [concrete] +// CHECK:STDOUT: %Op.type.88d: type = fn_type @Op.2, @impl.49c(%EmptyRange.cc8) [concrete] +// CHECK:STDOUT: %Op.929: %Op.type.88d = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.750: %Destroy.type = facet_value %EmptyRange.cc8, (%Destroy.impl_witness.506) [concrete] +// CHECK:STDOUT: %.053: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.750 [concrete] +// CHECK:STDOUT: %Op.specific_fn.a14: = specific_function %Op.929, @Op.2(%EmptyRange.cc8) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -301,11 +386,13 @@ fn Run() { // CHECK:STDOUT: %Main.import_ref.6ea: @EmptyRange.%Make.type (%Make.type.bd2) = import_ref Main//empty_range, loc5_21, loaded [symbolic = @EmptyRange.%Make (constants.%Make.ed1)] // CHECK:STDOUT: %Main.import_ref.6ce = import_ref Main//empty_range, loc7_68, unloaded // CHECK:STDOUT: %Main.import_ref.999 = import_ref Main//empty_range, loc7_68, unloaded -// CHECK:STDOUT: %Main.import_ref.57b: @impl.%NewCursor.type (%NewCursor.type.f5f) = import_ref Main//empty_range, loc8_38, loaded [symbolic = @impl.%NewCursor (constants.%NewCursor.ec1)] -// CHECK:STDOUT: %Main.import_ref.170: @impl.%Next.type (%Next.type.264) = import_ref Main//empty_range, loc11_58, loaded [symbolic = @impl.%Next (constants.%Next.08e)] -// CHECK:STDOUT: %Iterate.impl_witness_table = impl_witness_table (%Main.import_ref.6ce, %Main.import_ref.999, %Main.import_ref.57b, %Main.import_ref.170), @impl [concrete] +// CHECK:STDOUT: %Main.import_ref.57b: @impl.86e.%NewCursor.type (%NewCursor.type.f5f) = import_ref Main//empty_range, loc8_38, loaded [symbolic = @impl.86e.%NewCursor (constants.%NewCursor.ec1)] +// CHECK:STDOUT: %Main.import_ref.170: @impl.86e.%Next.type (%Next.type.264) = import_ref Main//empty_range, loc11_58, loaded [symbolic = @impl.86e.%Next (constants.%Next.08e)] +// CHECK:STDOUT: %Iterate.impl_witness_table = impl_witness_table (%Main.import_ref.6ce, %Main.import_ref.999, %Main.import_ref.57b, %Main.import_ref.170), @impl.86e [concrete] // CHECK:STDOUT: %Main.import_ref.7f9: @Optional.%HasValue.type (%HasValue.type.f81) = import_ref Main//empty_range, inst136 [indirect], loaded [symbolic = @Optional.%HasValue (constants.%HasValue.6fd)] // CHECK:STDOUT: %Main.import_ref.d10: @Optional.%Get.type (%Get.type.b8f) = import_ref Main//empty_range, inst137 [indirect], loaded [symbolic = @Optional.%Get (constants.%Get.9c8)] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { @@ -361,9 +448,9 @@ fn Run() { // CHECK:STDOUT: %Get.bound: = bound_method %.loc12_40.2, %Get.ref // CHECK:STDOUT: %Get.specific_fn: = specific_function %Get.ref, @Get(constants.%C) [concrete = constants.%Get.specific_fn] // CHECK:STDOUT: %bound_method.loc12_40.6: = bound_method %.loc12_40.2, %Get.specific_fn -// CHECK:STDOUT: %.loc12_8: ref %C = splice_block %c.var {} +// CHECK:STDOUT: %.loc12_8.1: ref %C = splice_block %c.var {} // CHECK:STDOUT: %.loc12_40.8: %Optional.cf0 = bind_value %.loc12_40.2 -// CHECK:STDOUT: %Get.call: init %C = call %bound_method.loc12_40.6(%.loc12_40.8) to %.loc12_8 +// CHECK:STDOUT: %Get.call: init %C = call %bound_method.loc12_40.6(%.loc12_40.8) to %.loc12_8.1 // CHECK:STDOUT: assign %c.var, %Get.call // CHECK:STDOUT: %C.ref.loc12_15: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var @@ -374,6 +461,37 @@ fn Run() { // CHECK:STDOUT: br !for.next // CHECK:STDOUT: // CHECK:STDOUT: !for.done: +// CHECK:STDOUT: %impl.elem0.loc12_8.1: %.b80 = impl_witness_access constants.%Destroy.impl_witness.906, element0 [concrete = constants.%Op.5d7] +// CHECK:STDOUT: %bound_method.loc12_8.1: = bound_method %.loc12_8.1, %impl.elem0.loc12_8.1 +// CHECK:STDOUT: %specific_fn.loc12_8.1: = specific_function %impl.elem0.loc12_8.1, @Op.2(constants.%C) [concrete = constants.%Op.specific_fn.6eb] +// CHECK:STDOUT: %bound_method.loc12_8.2: = bound_method %.loc12_8.1, %specific_fn.loc12_8.1 +// CHECK:STDOUT: %.loc12_8.2: %C = bind_value %.loc12_8.1 +// CHECK:STDOUT: %no_op.loc12_8.1: init %empty_tuple.type = call %bound_method.loc12_8.2(%.loc12_8.2) +// CHECK:STDOUT: %impl.elem0.loc12_8.2: %.b80 = impl_witness_access constants.%Destroy.impl_witness.906, element0 [concrete = constants.%Op.5d7] +// CHECK:STDOUT: %bound_method.loc12_8.3: = bound_method %c.var, %impl.elem0.loc12_8.2 +// CHECK:STDOUT: %specific_fn.loc12_8.2: = specific_function %impl.elem0.loc12_8.2, @Op.2(constants.%C) [concrete = constants.%Op.specific_fn.6eb] +// CHECK:STDOUT: %bound_method.loc12_8.4: = bound_method %c.var, %specific_fn.loc12_8.2 +// CHECK:STDOUT: %.loc12_8.3: %C = bind_value %c.var +// CHECK:STDOUT: %no_op.loc12_8.2: init %empty_tuple.type = call %bound_method.loc12_8.4(%.loc12_8.3) +// CHECK:STDOUT: %impl.elem0.loc12_40.1: %.1f9 = impl_witness_access constants.%Destroy.impl_witness.b11, element0 [concrete = constants.%Op.3e8] +// CHECK:STDOUT: %bound_method.loc12_40.7: = bound_method %.loc12_40.1, %impl.elem0.loc12_40.1 +// CHECK:STDOUT: %specific_fn.loc12_40.3: = specific_function %impl.elem0.loc12_40.1, @Op.2(constants.%Optional.cf0) [concrete = constants.%Op.specific_fn.273] +// CHECK:STDOUT: %bound_method.loc12_40.8: = bound_method %.loc12_40.1, %specific_fn.loc12_40.3 +// CHECK:STDOUT: %.loc12_40.9: %Optional.cf0 = bind_value %.loc12_40.1 +// CHECK:STDOUT: %no_op.loc12_40.1: init %empty_tuple.type = call %bound_method.loc12_40.8(%.loc12_40.9) +// CHECK:STDOUT: %impl.elem0.loc12_40.2: %.9da = impl_witness_access constants.%Destroy.impl_witness.eb8, element0 [concrete = constants.%Op.d5a] +// CHECK:STDOUT: %bound_method.loc12_40.9: = bound_method %var, %impl.elem0.loc12_40.2 +// CHECK:STDOUT: %specific_fn.loc12_40.4: = specific_function %impl.elem0.loc12_40.2, @Op.2(constants.%empty_struct_type) [concrete = constants.%Op.specific_fn.652] +// CHECK:STDOUT: %bound_method.loc12_40.10: = bound_method %var, %specific_fn.loc12_40.4 +// CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc12_40.10: %empty_struct_type = converted %var, %empty_struct [concrete = constants.%empty_struct] +// CHECK:STDOUT: %no_op.loc12_40.2: init %empty_tuple.type = call %bound_method.loc12_40.10(%.loc12_40.10) +// CHECK:STDOUT: %impl.elem0.loc12_39: %.053 = impl_witness_access constants.%Destroy.impl_witness.506, element0 [concrete = constants.%Op.929] +// CHECK:STDOUT: %bound_method.loc12_39.1: = bound_method %.loc12_39.1, %impl.elem0.loc12_39 +// CHECK:STDOUT: %specific_fn.loc12_39: = specific_function %impl.elem0.loc12_39, @Op.2(constants.%EmptyRange.cc8) [concrete = constants.%Op.specific_fn.a14] +// CHECK:STDOUT: %bound_method.loc12_39.2: = bound_method %.loc12_39.1, %specific_fn.loc12_39 +// CHECK:STDOUT: %.loc12_39.5: %EmptyRange.cc8 = bind_value %.loc12_39.1 +// CHECK:STDOUT: %no_op.loc12_39: init %empty_tuple.type = call %bound_method.loc12_39.2(%.loc12_39.5) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -402,18 +520,18 @@ fn Run() { // CHECK:STDOUT: %Make.specific_fn: = specific_function %Make.743, @Make(%tuple.type.784) [concrete] // CHECK:STDOUT: %Iterate.type: type = facet_type <@Iterate> [concrete] // CHECK:STDOUT: %NewCursor.type.427: type = fn_type @NewCursor.1 [concrete] -// CHECK:STDOUT: %NewCursor.type.f5f: type = fn_type @NewCursor.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %NewCursor.type.f5f: type = fn_type @NewCursor.2, @impl.86e(%T) [symbolic] // CHECK:STDOUT: %NewCursor.ec1: %NewCursor.type.f5f = struct_value () [symbolic] -// CHECK:STDOUT: %Next.type.264: type = fn_type @Next.1, @impl(%T) [symbolic] +// CHECK:STDOUT: %Next.type.264: type = fn_type @Next.1, @impl.86e(%T) [symbolic] // CHECK:STDOUT: %Next.08e: %Next.type.264 = struct_value () [symbolic] // CHECK:STDOUT: %HasValue.type.f81: type = fn_type @HasValue, @Optional(%T) [symbolic] // CHECK:STDOUT: %HasValue.6fd: %HasValue.type.f81 = struct_value () [symbolic] // CHECK:STDOUT: %Get.type.b8f: type = fn_type @Get, @Optional(%T) [symbolic] // CHECK:STDOUT: %Get.9c8: %Get.type.b8f = struct_value () [symbolic] -// CHECK:STDOUT: %Iterate.impl_witness.6db: = impl_witness imports.%Iterate.impl_witness_table, @impl(%tuple.type.784) [concrete] -// CHECK:STDOUT: %NewCursor.type.d32: type = fn_type @NewCursor.2, @impl(%tuple.type.784) [concrete] +// CHECK:STDOUT: %Iterate.impl_witness.6db: = impl_witness imports.%Iterate.impl_witness_table, @impl.86e(%tuple.type.784) [concrete] +// CHECK:STDOUT: %NewCursor.type.d32: type = fn_type @NewCursor.2, @impl.86e(%tuple.type.784) [concrete] // CHECK:STDOUT: %NewCursor.763: %NewCursor.type.d32 = struct_value () [concrete] -// CHECK:STDOUT: %Next.type.482: type = fn_type @Next.1, @impl(%tuple.type.784) [concrete] +// CHECK:STDOUT: %Next.type.482: type = fn_type @Next.1, @impl.86e(%tuple.type.784) [concrete] // CHECK:STDOUT: %Next.e60: %Next.type.482 = struct_value () [concrete] // CHECK:STDOUT: %Iterate.facet: %Iterate.type = facet_value %EmptyRange.2f3, (%Iterate.impl_witness.6db) [concrete] // CHECK:STDOUT: %.2bf: type = fn_type_with_self_type %NewCursor.type.427, %Iterate.facet [concrete] @@ -428,6 +546,35 @@ fn Run() { // CHECK:STDOUT: %Get.d99: %Get.type.ebd = struct_value () [concrete] // CHECK:STDOUT: %HasValue.specific_fn: = specific_function %HasValue.4f9, @HasValue(%tuple.type.784) [concrete] // CHECK:STDOUT: %Get.specific_fn: = specific_function %Get.d99, @Get(%tuple.type.784) [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.9fe: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%tuple.type.784) [concrete] +// CHECK:STDOUT: %Op.type.0fc: type = fn_type @Op.2, @impl.49c(%tuple.type.784) [concrete] +// CHECK:STDOUT: %Op.0a3: %Op.type.0fc = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.f73: %Destroy.type = facet_value %tuple.type.784, (%Destroy.impl_witness.9fe) [concrete] +// CHECK:STDOUT: %.e86: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.f73 [concrete] +// CHECK:STDOUT: %Op.specific_fn.10e: = specific_function %Op.0a3, @Op.2(%tuple.type.784) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.4bb: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%Optional.79e) [concrete] +// CHECK:STDOUT: %Op.type.e76: type = fn_type @Op.2, @impl.49c(%Optional.79e) [concrete] +// CHECK:STDOUT: %Op.d99: %Op.type.e76 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.a9b: %Destroy.type = facet_value %Optional.79e, (%Destroy.impl_witness.4bb) [concrete] +// CHECK:STDOUT: %.447: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.a9b [concrete] +// CHECK:STDOUT: %Op.specific_fn.e8f: = specific_function %Op.d99, @Op.2(%Optional.79e) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.eb8: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%empty_struct_type) [concrete] +// CHECK:STDOUT: %Op.type.069: type = fn_type @Op.2, @impl.49c(%empty_struct_type) [concrete] +// CHECK:STDOUT: %Op.d5a: %Op.type.069 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.e2f: %Destroy.type = facet_value %empty_struct_type, (%Destroy.impl_witness.eb8) [concrete] +// CHECK:STDOUT: %.9da: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.e2f [concrete] +// CHECK:STDOUT: %Op.specific_fn.652: = specific_function %Op.d5a, @Op.2(%empty_struct_type) [concrete] +// CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.3df: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%EmptyRange.2f3) [concrete] +// CHECK:STDOUT: %Op.type.055: type = fn_type @Op.2, @impl.49c(%EmptyRange.2f3) [concrete] +// CHECK:STDOUT: %Op.74c: %Op.type.055 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.f26: %Destroy.type = facet_value %EmptyRange.2f3, (%Destroy.impl_witness.3df) [concrete] +// CHECK:STDOUT: %.222: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.f26 [concrete] +// CHECK:STDOUT: %Op.specific_fn.cd5: = specific_function %Op.74c, @Op.2(%EmptyRange.2f3) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -435,11 +582,13 @@ fn Run() { // CHECK:STDOUT: %Main.import_ref.6ea: @EmptyRange.%Make.type (%Make.type.bd2) = import_ref Main//empty_range, loc5_21, loaded [symbolic = @EmptyRange.%Make (constants.%Make.ed1)] // CHECK:STDOUT: %Main.import_ref.6ce = import_ref Main//empty_range, loc7_68, unloaded // CHECK:STDOUT: %Main.import_ref.999 = import_ref Main//empty_range, loc7_68, unloaded -// CHECK:STDOUT: %Main.import_ref.57b: @impl.%NewCursor.type (%NewCursor.type.f5f) = import_ref Main//empty_range, loc8_38, loaded [symbolic = @impl.%NewCursor (constants.%NewCursor.ec1)] -// CHECK:STDOUT: %Main.import_ref.170: @impl.%Next.type (%Next.type.264) = import_ref Main//empty_range, loc11_58, loaded [symbolic = @impl.%Next (constants.%Next.08e)] -// CHECK:STDOUT: %Iterate.impl_witness_table = impl_witness_table (%Main.import_ref.6ce, %Main.import_ref.999, %Main.import_ref.57b, %Main.import_ref.170), @impl [concrete] +// CHECK:STDOUT: %Main.import_ref.57b: @impl.86e.%NewCursor.type (%NewCursor.type.f5f) = import_ref Main//empty_range, loc8_38, loaded [symbolic = @impl.86e.%NewCursor (constants.%NewCursor.ec1)] +// CHECK:STDOUT: %Main.import_ref.170: @impl.86e.%Next.type (%Next.type.264) = import_ref Main//empty_range, loc11_58, loaded [symbolic = @impl.86e.%Next (constants.%Next.08e)] +// CHECK:STDOUT: %Iterate.impl_witness_table = impl_witness_table (%Main.import_ref.6ce, %Main.import_ref.999, %Main.import_ref.57b, %Main.import_ref.170), @impl.86e [concrete] // CHECK:STDOUT: %Main.import_ref.7f9: @Optional.%HasValue.type (%HasValue.type.f81) = import_ref Main//empty_range, inst136 [indirect], loaded [symbolic = @Optional.%HasValue (constants.%HasValue.6fd)] // CHECK:STDOUT: %Main.import_ref.d10: @Optional.%Get.type (%Get.type.b8f) = import_ref Main//empty_range, inst137 [indirect], loaded [symbolic = @Optional.%Get (constants.%Get.9c8)] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { @@ -506,21 +655,21 @@ fn Run() { // CHECK:STDOUT: %.loc10_61.9: %Optional.79e = bind_value %.loc10_61.2 // CHECK:STDOUT: %Get.call: init %tuple.type.784 = call %bound_method.loc10_61.6(%.loc10_61.9) to %.loc10_61.8 // CHECK:STDOUT: %.loc10_61.10: ref %tuple.type.784 = temporary %.loc10_61.8, %Get.call -// CHECK:STDOUT: %tuple.elem0: ref bool = tuple_access %.loc10_61.10, element0 -// CHECK:STDOUT: %tuple.elem1: ref bool = tuple_access %.loc10_61.10, element1 +// CHECK:STDOUT: %tuple.elem0.loc10_61.1: ref bool = tuple_access %.loc10_61.10, element0 +// CHECK:STDOUT: %tuple.elem1.loc10_61.1: ref bool = tuple_access %.loc10_61.10, element1 // CHECK:STDOUT: %.loc10_12.1: type = splice_block %.loc10_12.3 [concrete = bool] { // CHECK:STDOUT: %bool.make_type.loc10_12: init type = call constants.%Bool() [concrete = bool] // CHECK:STDOUT: %.loc10_12.2: type = value_of_initializer %bool.make_type.loc10_12 [concrete = bool] // CHECK:STDOUT: %.loc10_12.3: type = converted %bool.make_type.loc10_12, %.loc10_12.2 [concrete = bool] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc10_61.11: bool = bind_value %tuple.elem0 +// CHECK:STDOUT: %.loc10_61.11: bool = bind_value %tuple.elem0.loc10_61.1 // CHECK:STDOUT: %a: bool = bind_name a, %.loc10_61.11 // CHECK:STDOUT: %.loc10_21.1: type = splice_block %.loc10_21.3 [concrete = bool] { // CHECK:STDOUT: %bool.make_type.loc10_21: init type = call constants.%Bool() [concrete = bool] // CHECK:STDOUT: %.loc10_21.2: type = value_of_initializer %bool.make_type.loc10_21 [concrete = bool] // CHECK:STDOUT: %.loc10_21.3: type = converted %bool.make_type.loc10_21, %.loc10_21.2 [concrete = bool] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc10_61.12: bool = bind_value %tuple.elem1 +// CHECK:STDOUT: %.loc10_61.12: bool = bind_value %tuple.elem1.loc10_61.1 // CHECK:STDOUT: %b: bool = bind_name b, %.loc10_61.12 // CHECK:STDOUT: %Body.ref: %Body.type = name_ref Body, file.%Body.decl [concrete = constants.%Body] // CHECK:STDOUT: %a.ref: bool = name_ref a, %a @@ -529,6 +678,36 @@ fn Run() { // CHECK:STDOUT: br !for.next // CHECK:STDOUT: // CHECK:STDOUT: !for.done: +// CHECK:STDOUT: %impl.elem0.loc10_61.1: %.e86 = impl_witness_access constants.%Destroy.impl_witness.9fe, element0 [concrete = constants.%Op.0a3] +// CHECK:STDOUT: %bound_method.loc10_61.7: = bound_method %.loc10_61.8, %impl.elem0.loc10_61.1 +// CHECK:STDOUT: %specific_fn.loc10_61.3: = specific_function %impl.elem0.loc10_61.1, @Op.2(constants.%tuple.type.784) [concrete = constants.%Op.specific_fn.10e] +// CHECK:STDOUT: %bound_method.loc10_61.8: = bound_method %.loc10_61.8, %specific_fn.loc10_61.3 +// CHECK:STDOUT: %tuple.elem0.loc10_61.2: ref bool = tuple_access %.loc10_61.8, element0 +// CHECK:STDOUT: %.loc10_61.13: bool = bind_value %tuple.elem0.loc10_61.2 +// CHECK:STDOUT: %tuple.elem1.loc10_61.2: ref bool = tuple_access %.loc10_61.8, element1 +// CHECK:STDOUT: %.loc10_61.14: bool = bind_value %tuple.elem1.loc10_61.2 +// CHECK:STDOUT: %tuple: %tuple.type.784 = tuple_value (%.loc10_61.13, %.loc10_61.14) +// CHECK:STDOUT: %.loc10_61.15: %tuple.type.784 = converted %.loc10_61.8, %tuple +// CHECK:STDOUT: %no_op.loc10_61.1: init %empty_tuple.type = call %bound_method.loc10_61.8(%.loc10_61.15) +// CHECK:STDOUT: %impl.elem0.loc10_61.2: %.447 = impl_witness_access constants.%Destroy.impl_witness.4bb, element0 [concrete = constants.%Op.d99] +// CHECK:STDOUT: %bound_method.loc10_61.9: = bound_method %.loc10_61.1, %impl.elem0.loc10_61.2 +// CHECK:STDOUT: %specific_fn.loc10_61.4: = specific_function %impl.elem0.loc10_61.2, @Op.2(constants.%Optional.79e) [concrete = constants.%Op.specific_fn.e8f] +// CHECK:STDOUT: %bound_method.loc10_61.10: = bound_method %.loc10_61.1, %specific_fn.loc10_61.4 +// CHECK:STDOUT: %.loc10_61.16: %Optional.79e = bind_value %.loc10_61.1 +// CHECK:STDOUT: %no_op.loc10_61.2: init %empty_tuple.type = call %bound_method.loc10_61.10(%.loc10_61.16) +// CHECK:STDOUT: %impl.elem0.loc10_61.3: %.9da = impl_witness_access constants.%Destroy.impl_witness.eb8, element0 [concrete = constants.%Op.d5a] +// CHECK:STDOUT: %bound_method.loc10_61.11: = bound_method %var, %impl.elem0.loc10_61.3 +// CHECK:STDOUT: %specific_fn.loc10_61.5: = specific_function %impl.elem0.loc10_61.3, @Op.2(constants.%empty_struct_type) [concrete = constants.%Op.specific_fn.652] +// CHECK:STDOUT: %bound_method.loc10_61.12: = bound_method %var, %specific_fn.loc10_61.5 +// CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc10_61.17: %empty_struct_type = converted %var, %empty_struct [concrete = constants.%empty_struct] +// CHECK:STDOUT: %no_op.loc10_61.3: init %empty_tuple.type = call %bound_method.loc10_61.12(%.loc10_61.17) +// CHECK:STDOUT: %impl.elem0.loc10_60: %.222 = impl_witness_access constants.%Destroy.impl_witness.3df, element0 [concrete = constants.%Op.74c] +// CHECK:STDOUT: %bound_method.loc10_60.1: = bound_method %.loc10_60.1, %impl.elem0.loc10_60 +// CHECK:STDOUT: %specific_fn.loc10_60: = specific_function %impl.elem0.loc10_60, @Op.2(constants.%EmptyRange.2f3) [concrete = constants.%Op.specific_fn.cd5] +// CHECK:STDOUT: %bound_method.loc10_60.2: = bound_method %.loc10_60.1, %specific_fn.loc10_60 +// CHECK:STDOUT: %.loc10_60.5: %EmptyRange.2f3 = bind_value %.loc10_60.1 +// CHECK:STDOUT: %no_op.loc10_60: init %empty_tuple.type = call %bound_method.loc10_60.2(%.loc10_60.5) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -556,18 +735,18 @@ fn Run() { // CHECK:STDOUT: %Make.specific_fn: = specific_function %Make.d4f, @Make(%tuple.type.56b) [concrete] // CHECK:STDOUT: %Iterate.type: type = facet_type <@Iterate> [concrete] // CHECK:STDOUT: %NewCursor.type.427: type = fn_type @NewCursor.1 [concrete] -// CHECK:STDOUT: %NewCursor.type.f5f: type = fn_type @NewCursor.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %NewCursor.type.f5f: type = fn_type @NewCursor.2, @impl.86e(%T) [symbolic] // CHECK:STDOUT: %NewCursor.ec1: %NewCursor.type.f5f = struct_value () [symbolic] -// CHECK:STDOUT: %Next.type.264: type = fn_type @Next.1, @impl(%T) [symbolic] +// CHECK:STDOUT: %Next.type.264: type = fn_type @Next.1, @impl.86e(%T) [symbolic] // CHECK:STDOUT: %Next.08e: %Next.type.264 = struct_value () [symbolic] // CHECK:STDOUT: %HasValue.type.f81: type = fn_type @HasValue, @Optional(%T) [symbolic] // CHECK:STDOUT: %HasValue.6fd: %HasValue.type.f81 = struct_value () [symbolic] // CHECK:STDOUT: %Get.type.b8f: type = fn_type @Get, @Optional(%T) [symbolic] // CHECK:STDOUT: %Get.9c8: %Get.type.b8f = struct_value () [symbolic] -// CHECK:STDOUT: %Iterate.impl_witness.627: = impl_witness imports.%Iterate.impl_witness_table, @impl(%tuple.type.56b) [concrete] -// CHECK:STDOUT: %NewCursor.type.59c: type = fn_type @NewCursor.2, @impl(%tuple.type.56b) [concrete] +// CHECK:STDOUT: %Iterate.impl_witness.627: = impl_witness imports.%Iterate.impl_witness_table, @impl.86e(%tuple.type.56b) [concrete] +// CHECK:STDOUT: %NewCursor.type.59c: type = fn_type @NewCursor.2, @impl.86e(%tuple.type.56b) [concrete] // CHECK:STDOUT: %NewCursor.263: %NewCursor.type.59c = struct_value () [concrete] -// CHECK:STDOUT: %Next.type.70f: type = fn_type @Next.1, @impl(%tuple.type.56b) [concrete] +// CHECK:STDOUT: %Next.type.70f: type = fn_type @Next.1, @impl.86e(%tuple.type.56b) [concrete] // CHECK:STDOUT: %Next.852: %Next.type.70f = struct_value () [concrete] // CHECK:STDOUT: %Iterate.facet: %Iterate.type = facet_value %EmptyRange.90a, (%Iterate.impl_witness.627) [concrete] // CHECK:STDOUT: %.8bd: type = fn_type_with_self_type %NewCursor.type.427, %Iterate.facet [concrete] @@ -582,6 +761,35 @@ fn Run() { // CHECK:STDOUT: %Get.8a7: %Get.type.4a4 = struct_value () [concrete] // CHECK:STDOUT: %HasValue.specific_fn: = specific_function %HasValue.bef, @HasValue(%tuple.type.56b) [concrete] // CHECK:STDOUT: %Get.specific_fn: = specific_function %Get.8a7, @Get(%tuple.type.56b) [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.7aa: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%tuple.type.56b) [concrete] +// CHECK:STDOUT: %Op.type.12e: type = fn_type @Op.2, @impl.49c(%tuple.type.56b) [concrete] +// CHECK:STDOUT: %Op.34b: %Op.type.12e = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.5ce: %Destroy.type = facet_value %tuple.type.56b, (%Destroy.impl_witness.7aa) [concrete] +// CHECK:STDOUT: %.874: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.5ce [concrete] +// CHECK:STDOUT: %Op.specific_fn.50d: = specific_function %Op.34b, @Op.2(%tuple.type.56b) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.d9c: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%Optional.657) [concrete] +// CHECK:STDOUT: %Op.type.e9f: type = fn_type @Op.2, @impl.49c(%Optional.657) [concrete] +// CHECK:STDOUT: %Op.5c4: %Op.type.e9f = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.8a2: %Destroy.type = facet_value %Optional.657, (%Destroy.impl_witness.d9c) [concrete] +// CHECK:STDOUT: %.0d9: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.8a2 [concrete] +// CHECK:STDOUT: %Op.specific_fn.068: = specific_function %Op.5c4, @Op.2(%Optional.657) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.eb8: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%empty_struct_type) [concrete] +// CHECK:STDOUT: %Op.type.069: type = fn_type @Op.2, @impl.49c(%empty_struct_type) [concrete] +// CHECK:STDOUT: %Op.d5a: %Op.type.069 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.e2f: %Destroy.type = facet_value %empty_struct_type, (%Destroy.impl_witness.eb8) [concrete] +// CHECK:STDOUT: %.9da: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.e2f [concrete] +// CHECK:STDOUT: %Op.specific_fn.652: = specific_function %Op.d5a, @Op.2(%empty_struct_type) [concrete] +// CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.7c5: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%EmptyRange.90a) [concrete] +// CHECK:STDOUT: %Op.type.8c3: type = fn_type @Op.2, @impl.49c(%EmptyRange.90a) [concrete] +// CHECK:STDOUT: %Op.85b: %Op.type.8c3 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.06e: %Destroy.type = facet_value %EmptyRange.90a, (%Destroy.impl_witness.7c5) [concrete] +// CHECK:STDOUT: %.2da: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.06e [concrete] +// CHECK:STDOUT: %Op.specific_fn.bc1: = specific_function %Op.85b, @Op.2(%EmptyRange.90a) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -589,11 +797,13 @@ fn Run() { // CHECK:STDOUT: %Main.import_ref.6ea: @EmptyRange.%Make.type (%Make.type.bd2) = import_ref Main//empty_range, loc5_21, loaded [symbolic = @EmptyRange.%Make (constants.%Make.ed1)] // CHECK:STDOUT: %Main.import_ref.6ce = import_ref Main//empty_range, loc7_68, unloaded // CHECK:STDOUT: %Main.import_ref.999 = import_ref Main//empty_range, loc7_68, unloaded -// CHECK:STDOUT: %Main.import_ref.57b: @impl.%NewCursor.type (%NewCursor.type.f5f) = import_ref Main//empty_range, loc8_38, loaded [symbolic = @impl.%NewCursor (constants.%NewCursor.ec1)] -// CHECK:STDOUT: %Main.import_ref.170: @impl.%Next.type (%Next.type.264) = import_ref Main//empty_range, loc11_58, loaded [symbolic = @impl.%Next (constants.%Next.08e)] -// CHECK:STDOUT: %Iterate.impl_witness_table = impl_witness_table (%Main.import_ref.6ce, %Main.import_ref.999, %Main.import_ref.57b, %Main.import_ref.170), @impl [concrete] +// CHECK:STDOUT: %Main.import_ref.57b: @impl.86e.%NewCursor.type (%NewCursor.type.f5f) = import_ref Main//empty_range, loc8_38, loaded [symbolic = @impl.86e.%NewCursor (constants.%NewCursor.ec1)] +// CHECK:STDOUT: %Main.import_ref.170: @impl.86e.%Next.type (%Next.type.264) = import_ref Main//empty_range, loc11_58, loaded [symbolic = @impl.86e.%Next (constants.%Next.08e)] +// CHECK:STDOUT: %Iterate.impl_witness_table = impl_witness_table (%Main.import_ref.6ce, %Main.import_ref.999, %Main.import_ref.57b, %Main.import_ref.170), @impl.86e [concrete] // CHECK:STDOUT: %Main.import_ref.7f9: @Optional.%HasValue.type (%HasValue.type.f81) = import_ref Main//empty_range, inst136 [indirect], loaded [symbolic = @Optional.%HasValue (constants.%HasValue.6fd)] // CHECK:STDOUT: %Main.import_ref.d10: @Optional.%Get.type (%Get.type.b8f) = import_ref Main//empty_range, inst137 [indirect], loaded [symbolic = @Optional.%Get (constants.%Get.9c8)] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { @@ -656,13 +866,13 @@ fn Run() { // CHECK:STDOUT: %.loc12_49.9: %Optional.657 = bind_value %.loc12_49.2 // CHECK:STDOUT: %Get.call: init %tuple.type.56b = call %bound_method.loc12_49.6(%.loc12_49.9) to %.loc12_49.8 // CHECK:STDOUT: %.loc12_49.10: ref %tuple.type.56b = temporary %.loc12_49.8, %Get.call -// CHECK:STDOUT: %tuple.elem0: ref %C = tuple_access %.loc12_49.10, element0 -// CHECK:STDOUT: %tuple.elem1: ref %C = tuple_access %.loc12_49.10, element1 +// CHECK:STDOUT: %tuple.elem0.loc12_49.1: ref %C = tuple_access %.loc12_49.10, element0 +// CHECK:STDOUT: %tuple.elem1.loc12_49.1: ref %C = tuple_access %.loc12_49.10, element1 // CHECK:STDOUT: %C.ref.loc12_12: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc12_49.11: %C = bind_value %tuple.elem0 +// CHECK:STDOUT: %.loc12_49.11: %C = bind_value %tuple.elem0.loc12_49.1 // CHECK:STDOUT: %a: %C = bind_name a, %.loc12_49.11 // CHECK:STDOUT: %C.ref.loc12_18: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc12_49.12: %C = bind_value %tuple.elem1 +// CHECK:STDOUT: %.loc12_49.12: %C = bind_value %tuple.elem1.loc12_49.1 // CHECK:STDOUT: %b: %C = bind_name b, %.loc12_49.12 // CHECK:STDOUT: %Body.ref: %Body.type = name_ref Body, file.%Body.decl [concrete = constants.%Body] // CHECK:STDOUT: %a.ref: %C = name_ref a, %a @@ -671,6 +881,36 @@ fn Run() { // CHECK:STDOUT: br !for.next // CHECK:STDOUT: // CHECK:STDOUT: !for.done: +// CHECK:STDOUT: %impl.elem0.loc12_49.1: %.874 = impl_witness_access constants.%Destroy.impl_witness.7aa, element0 [concrete = constants.%Op.34b] +// CHECK:STDOUT: %bound_method.loc12_49.7: = bound_method %.loc12_49.8, %impl.elem0.loc12_49.1 +// CHECK:STDOUT: %specific_fn.loc12_49.3: = specific_function %impl.elem0.loc12_49.1, @Op.2(constants.%tuple.type.56b) [concrete = constants.%Op.specific_fn.50d] +// CHECK:STDOUT: %bound_method.loc12_49.8: = bound_method %.loc12_49.8, %specific_fn.loc12_49.3 +// CHECK:STDOUT: %tuple.elem0.loc12_49.2: ref %C = tuple_access %.loc12_49.8, element0 +// CHECK:STDOUT: %.loc12_49.13: %C = bind_value %tuple.elem0.loc12_49.2 +// CHECK:STDOUT: %tuple.elem1.loc12_49.2: ref %C = tuple_access %.loc12_49.8, element1 +// CHECK:STDOUT: %.loc12_49.14: %C = bind_value %tuple.elem1.loc12_49.2 +// CHECK:STDOUT: %tuple: %tuple.type.56b = tuple_value (%.loc12_49.13, %.loc12_49.14) +// CHECK:STDOUT: %.loc12_49.15: %tuple.type.56b = converted %.loc12_49.8, %tuple +// CHECK:STDOUT: %no_op.loc12_49.1: init %empty_tuple.type = call %bound_method.loc12_49.8(%.loc12_49.15) +// CHECK:STDOUT: %impl.elem0.loc12_49.2: %.0d9 = impl_witness_access constants.%Destroy.impl_witness.d9c, element0 [concrete = constants.%Op.5c4] +// CHECK:STDOUT: %bound_method.loc12_49.9: = bound_method %.loc12_49.1, %impl.elem0.loc12_49.2 +// CHECK:STDOUT: %specific_fn.loc12_49.4: = specific_function %impl.elem0.loc12_49.2, @Op.2(constants.%Optional.657) [concrete = constants.%Op.specific_fn.068] +// CHECK:STDOUT: %bound_method.loc12_49.10: = bound_method %.loc12_49.1, %specific_fn.loc12_49.4 +// CHECK:STDOUT: %.loc12_49.16: %Optional.657 = bind_value %.loc12_49.1 +// CHECK:STDOUT: %no_op.loc12_49.2: init %empty_tuple.type = call %bound_method.loc12_49.10(%.loc12_49.16) +// CHECK:STDOUT: %impl.elem0.loc12_49.3: %.9da = impl_witness_access constants.%Destroy.impl_witness.eb8, element0 [concrete = constants.%Op.d5a] +// CHECK:STDOUT: %bound_method.loc12_49.11: = bound_method %var, %impl.elem0.loc12_49.3 +// CHECK:STDOUT: %specific_fn.loc12_49.5: = specific_function %impl.elem0.loc12_49.3, @Op.2(constants.%empty_struct_type) [concrete = constants.%Op.specific_fn.652] +// CHECK:STDOUT: %bound_method.loc12_49.12: = bound_method %var, %specific_fn.loc12_49.5 +// CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc12_49.17: %empty_struct_type = converted %var, %empty_struct [concrete = constants.%empty_struct] +// CHECK:STDOUT: %no_op.loc12_49.3: init %empty_tuple.type = call %bound_method.loc12_49.12(%.loc12_49.17) +// CHECK:STDOUT: %impl.elem0.loc12_48: %.2da = impl_witness_access constants.%Destroy.impl_witness.7c5, element0 [concrete = constants.%Op.85b] +// CHECK:STDOUT: %bound_method.loc12_48.1: = bound_method %.loc12_48.1, %impl.elem0.loc12_48 +// CHECK:STDOUT: %specific_fn.loc12_48: = specific_function %impl.elem0.loc12_48, @Op.2(constants.%EmptyRange.90a) [concrete = constants.%Op.specific_fn.bc1] +// CHECK:STDOUT: %bound_method.loc12_48.2: = bound_method %.loc12_48.1, %specific_fn.loc12_48 +// CHECK:STDOUT: %.loc12_48.5: %EmptyRange.90a = bind_value %.loc12_48.1 +// CHECK:STDOUT: %no_op.loc12_48: init %empty_tuple.type = call %bound_method.loc12_48.2(%.loc12_48.5) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/call/alias.carbon b/toolchain/check/testdata/function/call/alias.carbon index 0a00fd2d41e6..642158b51c6e 100644 --- a/toolchain/check/testdata/function/call/alias.carbon +++ b/toolchain/check/testdata/function/call/alias.carbon @@ -24,18 +24,34 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] -// CHECK:STDOUT: %pattern_type: type = pattern_type %empty_tuple.type [concrete] +// CHECK:STDOUT: %pattern_type.cb1: type = pattern_type %empty_tuple.type [concrete] // CHECK:STDOUT: %A.type: type = fn_type @A [concrete] // CHECK:STDOUT: %A: %A.type = struct_value () [concrete] // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] // CHECK:STDOUT: %Main.type: type = fn_type @Main [concrete] // CHECK:STDOUT: %Main: %Main.type = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.1dc: = impl_witness imports.%Destroy.impl_witness_table, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.type.a63: type = fn_type @Op.2, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.ea3: %Op.type.a63 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %empty_tuple.type, (%Destroy.impl_witness.1dc) [concrete] +// CHECK:STDOUT: %.346: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.ea3, @Op.2(%empty_tuple.type) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -47,8 +63,8 @@ fn Main() { // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [concrete = constants.%A] { -// CHECK:STDOUT: %return.patt: %pattern_type = return_slot_pattern [concrete] -// CHECK:STDOUT: %return.param_patt: %pattern_type = out_param_pattern %return.patt, call_param0 [concrete] +// CHECK:STDOUT: %return.patt: %pattern_type.cb1 = return_slot_pattern [concrete] +// CHECK:STDOUT: %return.param_patt: %pattern_type.cb1 = out_param_pattern %return.patt, call_param0 [concrete] // CHECK:STDOUT: } { // CHECK:STDOUT: %.loc15_12.1: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc15_12.2: type = converted %.loc15_12.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] @@ -71,8 +87,8 @@ fn Main() { // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %b.patt: %pattern_type = binding_pattern b [concrete] -// CHECK:STDOUT: %b.var_patt: %pattern_type = var_pattern %b.patt [concrete] +// CHECK:STDOUT: %b.patt: %pattern_type.cb1 = binding_pattern b [concrete] +// CHECK:STDOUT: %b.var_patt: %pattern_type.cb1 = var_pattern %b.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %b.var: ref %empty_tuple.type = var %b.var_patt // CHECK:STDOUT: %B.ref: %A.type = name_ref B, file.%B [concrete = constants.%A] @@ -83,6 +99,13 @@ fn Main() { // CHECK:STDOUT: %.loc20_11.3: type = converted %.loc20_11.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %b: ref %empty_tuple.type = bind_name b, %b.var +// CHECK:STDOUT: %impl.elem0: %.346 = impl_witness_access constants.%Destroy.impl_witness.1dc, element0 [concrete = constants.%Op.ea3] +// CHECK:STDOUT: %bound_method.loc20_3.1: = bound_method %b.var, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%empty_tuple.type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc20_3.2: = bound_method %b.var, %specific_fn +// CHECK:STDOUT: %tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc20_3: %empty_tuple.type = converted %b.var, %tuple [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc20_3.2(%.loc20_3) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/call/fail_not_callable.carbon b/toolchain/check/testdata/function/call/fail_not_callable.carbon index 3c9df1003d3c..32d3053a9caa 100644 --- a/toolchain/check/testdata/function/call/fail_not_callable.carbon +++ b/toolchain/check/testdata/function/call/fail_not_callable.carbon @@ -23,6 +23,7 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Run.type: type = fn_type @Run [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Run: %Run.type = struct_value () [concrete] // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] @@ -30,15 +31,30 @@ fn Run() { // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete] // CHECK:STDOUT: %str: String = string_literal "hello" [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T.8b3: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl.49c(%T.8b3) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.64e: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.type.a17: type = fn_type @Op.2, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.e6a: %Op.type.a17 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %i32, (%Destroy.impl_witness.64e) [concrete] +// CHECK:STDOUT: %.ab7: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn.014: = specific_function %Op.e6a, @Op.2(%i32) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/destroy, loc15_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -59,11 +75,17 @@ fn Run() { // CHECK:STDOUT: %x.var: ref %i32 = var %x.var_patt // CHECK:STDOUT: %str: String = string_literal "hello" [concrete = constants.%str] // CHECK:STDOUT: assign %x.var, -// CHECK:STDOUT: %.loc19: type = splice_block %i32 [concrete = constants.%i32] { +// CHECK:STDOUT: %.loc19_10: type = splice_block %i32 [concrete = constants.%i32] { // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: %x: ref %i32 = bind_name x, %x.var +// CHECK:STDOUT: %impl.elem0: %.ab7 = impl_witness_access constants.%Destroy.impl_witness.64e, element0 [concrete = constants.%Op.e6a] +// CHECK:STDOUT: %bound_method.loc19_3.1: = bound_method %x.var, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%i32) [concrete = constants.%Op.specific_fn.014] +// CHECK:STDOUT: %bound_method.loc19_3.2: = bound_method %x.var, %specific_fn +// CHECK:STDOUT: %.loc19_3: %i32 = bind_value %x.var +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc19_3.2(%.loc19_3) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon b/toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon index 730c386d3965..3c91de1ab018 100644 --- a/toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon +++ b/toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon @@ -30,6 +30,7 @@ fn Run() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [concrete] // CHECK:STDOUT: %Float.type: type = fn_type @Float [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Float: %Float.type = struct_value () [concrete] // CHECK:STDOUT: %pattern_type.3de: type = pattern_type f64 [concrete] // CHECK:STDOUT: %Foo.type: type = fn_type @Foo [concrete] @@ -44,6 +45,17 @@ fn Run() { // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete] // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete] // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.2 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.3, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.64e: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.type.a17: type = fn_type @Op.3, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.e6a: %Op.type.a17 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %i32, (%Destroy.impl_witness.64e) [concrete] +// CHECK:STDOUT: %.ab7: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.e6a, @Op.3(%i32) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -51,12 +63,16 @@ fn Run() { // CHECK:STDOUT: .Float = %Core.Float // CHECK:STDOUT: .Int = %Core.Int // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Core.Float: %Float.type = import_ref Core//prelude/parts/float, Float, loaded [concrete = constants.%Float] // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic] // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -95,13 +111,19 @@ fn Run() { // CHECK:STDOUT: %x.var: ref %i32 = var %x.var_patt // CHECK:STDOUT: %Foo.ref: %Foo.type = name_ref Foo, file.%Foo.decl [concrete = constants.%Foo] // CHECK:STDOUT: %Foo.call: init f64 = call %Foo.ref() -// CHECK:STDOUT: %.loc25_3: %i32 = converted %Foo.call, [concrete = ] +// CHECK:STDOUT: %.loc25_3.1: %i32 = converted %Foo.call, [concrete = ] // CHECK:STDOUT: assign %x.var, // CHECK:STDOUT: %.loc25_10: type = splice_block %i32 [concrete = constants.%i32] { // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: %x: ref %i32 = bind_name x, %x.var +// CHECK:STDOUT: %impl.elem0: %.ab7 = impl_witness_access constants.%Destroy.impl_witness.64e, element0 [concrete = constants.%Op.e6a] +// CHECK:STDOUT: %bound_method.loc25_3.1: = bound_method %x.var, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.3(constants.%i32) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc25_3.2: = bound_method %x.var, %specific_fn +// CHECK:STDOUT: %.loc25_3.2: %i32 = bind_value %x.var +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc25_3.2(%.loc25_3.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 03f8f6efb5bb..a47b0f91ac35 100644 --- a/toolchain/check/testdata/function/call/i32.carbon +++ b/toolchain/check/testdata/function/call/i32.carbon @@ -25,6 +25,7 @@ fn Main() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete] @@ -49,12 +50,24 @@ fn Main() { // CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.956, @Convert.2(%int_32) [concrete] // CHECK:STDOUT: %bound_method: = bound_method %int_1.5b8, %Convert.specific_fn [concrete] // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.2 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.3, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.64e: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.type.a17: type = fn_type @Op.3, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.e6a: %Op.type.a17 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %i32, (%Destroy.impl_witness.64e) [concrete] +// CHECK:STDOUT: %.ab7: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.e6a, @Op.3(%i32) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Int = %Core.Int // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -62,6 +75,9 @@ fn Main() { // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -106,10 +122,10 @@ fn Main() { // CHECK:STDOUT: %b.var: ref %i32 = var %b.var_patt // CHECK:STDOUT: %Echo.ref: %Echo.type = name_ref Echo, file.%Echo.decl [concrete = constants.%Echo] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] -// CHECK:STDOUT: %bound_method.loc20_21.1: = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound] -// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc20_21.2: = bound_method %int_1, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %impl.elem0.loc20_21: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc20_21.1: = bound_method %int_1, %impl.elem0.loc20_21 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %specific_fn.loc20_21: = specific_function %impl.elem0.loc20_21, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc20_21.2: = bound_method %int_1, %specific_fn.loc20_21 [concrete = constants.%bound_method] // CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc20_21.2(%int_1) [concrete = constants.%int_1.5d2] // CHECK:STDOUT: %.loc20_21.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.5d2] // CHECK:STDOUT: %.loc20_21.2: %i32 = converted %int_1, %.loc20_21.1 [concrete = constants.%int_1.5d2] @@ -120,6 +136,12 @@ fn Main() { // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: %b: ref %i32 = bind_name b, %b.var +// CHECK:STDOUT: %impl.elem0.loc20_3: %.ab7 = impl_witness_access constants.%Destroy.impl_witness.64e, element0 [concrete = constants.%Op.e6a] +// CHECK:STDOUT: %bound_method.loc20_3.1: = bound_method %b.var, %impl.elem0.loc20_3 +// CHECK:STDOUT: %specific_fn.loc20_3: = specific_function %impl.elem0.loc20_3, @Op.3(constants.%i32) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc20_3.2: = bound_method %b.var, %specific_fn.loc20_3 +// CHECK:STDOUT: %.loc20_3: %i32 = bind_value %b.var +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc20_3.2(%.loc20_3) // CHECK:STDOUT: return // CHECK:STDOUT: } // 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 211ad5cf5073..2e404940b1fc 100644 --- a/toolchain/check/testdata/function/call/more_param_ir.carbon +++ b/toolchain/check/testdata/function/call/more_param_ir.carbon @@ -60,12 +60,24 @@ fn Main() { // CHECK:STDOUT: %Convert.bound.ce9: = bound_method %int_6.462, %Convert.956 [concrete] // CHECK:STDOUT: %bound_method.efa: = bound_method %int_6.462, %Convert.specific_fn [concrete] // CHECK:STDOUT: %int_6.e56: %i32 = int_value 6 [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.2 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.3, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.088: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%tuple.type.a1c) [concrete] +// CHECK:STDOUT: %Op.type.438: type = fn_type @Op.3, @impl.49c(%tuple.type.a1c) [concrete] +// CHECK:STDOUT: %Op.c8e: %Op.type.438 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %tuple.type.a1c, (%Destroy.impl_witness.088) [concrete] +// CHECK:STDOUT: %.6a9: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.c8e, @Op.3(%tuple.type.a1c) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Int = %Core.Int // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -73,6 +85,9 @@ fn Main() { // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -118,15 +133,15 @@ fn Main() { // CHECK:STDOUT: %x.var: ref %tuple.type.a1c = var %x.var_patt // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] // CHECK:STDOUT: %.loc18_22.1: %tuple.type.985 = tuple_literal (%int_1) -// CHECK:STDOUT: %impl.elem0.loc18: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] -// CHECK:STDOUT: %bound_method.loc18_22.1: = bound_method %int_1, %impl.elem0.loc18 [concrete = constants.%Convert.bound.ab5] -// CHECK:STDOUT: %specific_fn.loc18: = specific_function %impl.elem0.loc18, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc18_22.2: = bound_method %int_1, %specific_fn.loc18 [concrete = constants.%bound_method.9a1] +// CHECK:STDOUT: %impl.elem0.loc18_22: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc18_22.1: = bound_method %int_1, %impl.elem0.loc18_22 [concrete = constants.%Convert.bound.ab5] +// CHECK:STDOUT: %specific_fn.loc18_22: = specific_function %impl.elem0.loc18_22, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc18_22.2: = bound_method %int_1, %specific_fn.loc18_22 [concrete = constants.%bound_method.9a1] // CHECK:STDOUT: %int.convert_checked.loc18: init %i32 = call %bound_method.loc18_22.2(%int_1) [concrete = constants.%int_1.5d2] // CHECK:STDOUT: %.loc18_22.2: init %i32 = converted %int_1, %int.convert_checked.loc18 [concrete = constants.%int_1.5d2] // CHECK:STDOUT: %.loc18_22.3: init %tuple.type.a1c = tuple_init (%.loc18_22.2) to %x.var [concrete = constants.%tuple] -// CHECK:STDOUT: %.loc18_3: init %tuple.type.a1c = converted %.loc18_22.1, %.loc18_22.3 [concrete = constants.%tuple] -// CHECK:STDOUT: assign %x.var, %.loc18_3 +// CHECK:STDOUT: %.loc18_3.1: init %tuple.type.a1c = converted %.loc18_22.1, %.loc18_22.3 [concrete = constants.%tuple] +// CHECK:STDOUT: assign %x.var, %.loc18_3.1 // CHECK:STDOUT: %.loc18_15.1: type = splice_block %.loc18_15.3 [concrete = constants.%tuple.type.a1c] { // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] @@ -137,9 +152,9 @@ fn Main() { // CHECK:STDOUT: %Foo.ref: %Foo.type = name_ref Foo, file.%Foo.decl [concrete = constants.%Foo] // CHECK:STDOUT: %x.ref: ref %tuple.type.a1c = name_ref x, %x // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] -// CHECK:STDOUT: %tuple.elem0: ref %i32 = tuple_access %x.ref, element0 +// CHECK:STDOUT: %tuple.elem0.loc20: ref %i32 = tuple_access %x.ref, element0 // CHECK:STDOUT: %int_6: Core.IntLiteral = int_value 6 [concrete = constants.%int_6.462] -// CHECK:STDOUT: %.loc20_8: %i32 = bind_value %tuple.elem0 +// CHECK:STDOUT: %.loc20_8: %i32 = bind_value %tuple.elem0.loc20 // CHECK:STDOUT: %impl.elem0.loc20: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] // CHECK:STDOUT: %bound_method.loc20_12.1: = bound_method %int_6, %impl.elem0.loc20 [concrete = constants.%Convert.bound.ce9] // CHECK:STDOUT: %specific_fn.loc20: = specific_function %impl.elem0.loc20, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] @@ -148,6 +163,15 @@ fn Main() { // CHECK:STDOUT: %.loc20_12.1: %i32 = value_of_initializer %int.convert_checked.loc20 [concrete = constants.%int_6.e56] // CHECK:STDOUT: %.loc20_12.2: %i32 = converted %int_6, %.loc20_12.1 [concrete = constants.%int_6.e56] // CHECK:STDOUT: %Foo.call: init %empty_tuple.type = call %Foo.ref(%.loc20_8, %.loc20_12.2) +// CHECK:STDOUT: %impl.elem0.loc18_3: %.6a9 = impl_witness_access constants.%Destroy.impl_witness.088, element0 [concrete = constants.%Op.c8e] +// CHECK:STDOUT: %bound_method.loc18_3.1: = bound_method %x.var, %impl.elem0.loc18_3 +// CHECK:STDOUT: %specific_fn.loc18_3: = specific_function %impl.elem0.loc18_3, @Op.3(constants.%tuple.type.a1c) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc18_3.2: = bound_method %x.var, %specific_fn.loc18_3 +// CHECK:STDOUT: %tuple.elem0.loc18: ref %i32 = tuple_access %x.var, element0 +// CHECK:STDOUT: %.loc18_3.2: %i32 = bind_value %tuple.elem0.loc18 +// CHECK:STDOUT: %tuple: %tuple.type.a1c = tuple_value (%.loc18_3.2) +// CHECK:STDOUT: %.loc18_3.3: %tuple.type.a1c = converted %x.var, %tuple +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc18_3.2(%.loc18_3.3) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/call/return_implicit.carbon b/toolchain/check/testdata/function/call/return_implicit.carbon index 486c9bf95a0b..3426ba4d0c99 100644 --- a/toolchain/check/testdata/function/call/return_implicit.carbon +++ b/toolchain/check/testdata/function/call/return_implicit.carbon @@ -27,13 +27,30 @@ fn Main() { // CHECK:STDOUT: %MakeImplicitEmptyTuple: %MakeImplicitEmptyTuple.type = struct_value () [concrete] // CHECK:STDOUT: %Main.type: type = fn_type @Main [concrete] // CHECK:STDOUT: %Main: %Main.type = struct_value () [concrete] -// CHECK:STDOUT: %pattern_type: type = pattern_type %empty_tuple.type [concrete] +// CHECK:STDOUT: %pattern_type.cb1: type = pattern_type %empty_tuple.type [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.1dc: = impl_witness imports.%Destroy.impl_witness_table, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.type.a63: type = fn_type @Op.2, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.ea3: %Op.type.a63 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %empty_tuple.type, (%Destroy.impl_witness.1dc) [concrete] +// CHECK:STDOUT: %.346: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.ea3, @Op.2(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -55,8 +72,8 @@ fn Main() { // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %b.patt: %pattern_type = binding_pattern b [concrete] -// CHECK:STDOUT: %b.var_patt: %pattern_type = var_pattern %b.patt [concrete] +// CHECK:STDOUT: %b.patt: %pattern_type.cb1 = binding_pattern b [concrete] +// CHECK:STDOUT: %b.var_patt: %pattern_type.cb1 = var_pattern %b.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %b.var: ref %empty_tuple.type = var %b.var_patt // CHECK:STDOUT: %MakeImplicitEmptyTuple.ref: %MakeImplicitEmptyTuple.type = name_ref MakeImplicitEmptyTuple, file.%MakeImplicitEmptyTuple.decl [concrete = constants.%MakeImplicitEmptyTuple] @@ -67,6 +84,13 @@ fn Main() { // CHECK:STDOUT: %.loc19_11.3: type = converted %.loc19_11.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %b: ref %empty_tuple.type = bind_name b, %b.var +// CHECK:STDOUT: %impl.elem0: %.346 = impl_witness_access constants.%Destroy.impl_witness.1dc, element0 [concrete = constants.%Op.ea3] +// CHECK:STDOUT: %bound_method.loc19_3.1: = bound_method %b.var, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%empty_tuple.type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc19_3.2: = bound_method %b.var, %specific_fn +// CHECK:STDOUT: %tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc19_3: %empty_tuple.type = converted %b.var, %tuple [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc19_3.2(%.loc19_3) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/declaration/fail_import_incomplete_return.carbon b/toolchain/check/testdata/function/declaration/fail_import_incomplete_return.carbon index fdabb8eca207..319d359490b5 100644 --- a/toolchain/check/testdata/function/declaration/fail_import_incomplete_return.carbon +++ b/toolchain/check/testdata/function/declaration/fail_import_incomplete_return.carbon @@ -112,6 +112,7 @@ fn CallFAndGIncomplete() { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -197,6 +198,7 @@ fn CallFAndGIncomplete() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %CallFAndGIncomplete.type: type = fn_type @CallFAndGIncomplete [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %CallFAndGIncomplete: %CallFAndGIncomplete.type = struct_value () [concrete] // CHECK:STDOUT: %ReturnCUnused.type: type = fn_type @ReturnCUnused [concrete] // CHECK:STDOUT: %ReturnCUnused: %ReturnCUnused.type = struct_value () [concrete] @@ -209,6 +211,17 @@ fn CallFAndGIncomplete() { // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] // CHECK:STDOUT: %ReturnDUsed.type: type = fn_type @ReturnDUsed [concrete] // CHECK:STDOUT: %ReturnDUsed: %ReturnDUsed.type = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.45e: = impl_witness imports.%Destroy.impl_witness_table, @impl(%D) [concrete] +// CHECK:STDOUT: %Op.type.548: type = fn_type @Op.2, @impl(%D) [concrete] +// CHECK:STDOUT: %Op.2d4: %Op.type.548 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %D, (%Destroy.impl_witness.45e) [concrete] +// CHECK:STDOUT: %.64e: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.2d4, @Op.2(%D) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -220,10 +233,15 @@ fn CallFAndGIncomplete() { // CHECK:STDOUT: %Main.ReturnDUsed: %ReturnDUsed.type = import_ref Main//incomplete_return, ReturnDUsed, loaded [concrete = constants.%ReturnDUsed] // CHECK:STDOUT: %Main.Call = import_ref Main//incomplete_return, Call, unloaded // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Main.import_ref.8f2: = import_ref Main//incomplete_return, loc37_10, loaded [concrete = constants.%complete_type] // CHECK:STDOUT: %Main.import_ref.cab = import_ref Main//incomplete_return, inst20 [no loc], unloaded +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -266,6 +284,18 @@ fn CallFAndGIncomplete() { // CHECK:STDOUT: %.loc34_15.1: ref %D = temporary_storage // CHECK:STDOUT: %ReturnDUsed.call: init %D = call %ReturnDUsed.ref() to %.loc34_15.1 // CHECK:STDOUT: %.loc34_15.2: ref %D = temporary %.loc34_15.1, %ReturnDUsed.call +// CHECK:STDOUT: %impl.elem0.loc34: %.64e = impl_witness_access constants.%Destroy.impl_witness.45e, element0 [concrete = constants.%Op.2d4] +// CHECK:STDOUT: %bound_method.loc34_15.1: = bound_method %.loc34_15.1, %impl.elem0.loc34 +// CHECK:STDOUT: %specific_fn.loc34: = specific_function %impl.elem0.loc34, @Op.2(constants.%D) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc34_15.2: = bound_method %.loc34_15.1, %specific_fn.loc34 +// CHECK:STDOUT: %.loc34_15.3: %D = bind_value %.loc34_15.1 +// CHECK:STDOUT: %no_op.loc34: init %empty_tuple.type = call %bound_method.loc34_15.2(%.loc34_15.3) +// CHECK:STDOUT: %impl.elem0.loc33: %.64e = impl_witness_access constants.%Destroy.impl_witness.45e, element0 [concrete = constants.%Op.2d4] +// CHECK:STDOUT: %bound_method.loc33_17.1: = bound_method %.loc33_17.1, %impl.elem0.loc33 +// CHECK:STDOUT: %specific_fn.loc33: = specific_function %impl.elem0.loc33, @Op.2(constants.%D) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc33_17.2: = bound_method %.loc33_17.1, %specific_fn.loc33 +// CHECK:STDOUT: %.loc33_17.3: %D = bind_value %.loc33_17.1 +// CHECK:STDOUT: %no_op.loc33: init %empty_tuple.type = call %bound_method.loc33_17.2(%.loc33_17.3) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/definition/fail_local_decl.carbon b/toolchain/check/testdata/function/definition/fail_local_decl.carbon index 4c2f41301762..59084ef695f4 100644 --- a/toolchain/check/testdata/function/definition/fail_local_decl.carbon +++ b/toolchain/check/testdata/function/definition/fail_local_decl.carbon @@ -67,6 +67,7 @@ fn F() { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -97,15 +98,33 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] -// CHECK:STDOUT: %pattern_type: type = pattern_type %empty_struct_type [concrete] +// CHECK:STDOUT: %pattern_type.a96: type = pattern_type %empty_struct_type [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.eb8: = impl_witness imports.%Destroy.impl_witness_table, @impl(%empty_struct_type) [concrete] +// CHECK:STDOUT: %Op.type.069: type = fn_type @Op.2, @impl(%empty_struct_type) [concrete] +// CHECK:STDOUT: %Op.d5a: %Op.type.069 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %empty_struct_type, (%Destroy.impl_witness.eb8) [concrete] +// CHECK:STDOUT: %.9da: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.d5a, @Op.2(%empty_struct_type) [concrete] +// CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -120,8 +139,8 @@ fn F() { // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %v.patt: %pattern_type = binding_pattern v [concrete] -// CHECK:STDOUT: %v.var_patt: %pattern_type = var_pattern %v.patt [concrete] +// CHECK:STDOUT: %v.patt: %pattern_type.a96 = binding_pattern v [concrete] +// CHECK:STDOUT: %v.var_patt: %pattern_type.a96 = var_pattern %v.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %v.var: ref %empty_struct_type = var %v.var_patt // CHECK:STDOUT: %.loc9_19.1: type = splice_block %.loc9_19.3 [concrete = constants.%empty_struct_type] { @@ -130,8 +149,8 @@ fn F() { // CHECK:STDOUT: } // CHECK:STDOUT: %v: ref %empty_struct_type = bind_name v, %v.var // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %w.patt: %pattern_type = binding_pattern w [concrete] -// CHECK:STDOUT: %w.var_patt: %pattern_type = var_pattern %w.patt [concrete] +// CHECK:STDOUT: %w.patt: %pattern_type.a96 = binding_pattern w [concrete] +// CHECK:STDOUT: %w.var_patt: %pattern_type.a96 = var_pattern %w.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %w.var: ref %empty_struct_type = var %w.var_patt // CHECK:STDOUT: %.loc14_21.1: type = splice_block %.loc14_21.3 [concrete = constants.%empty_struct_type] { @@ -139,6 +158,20 @@ fn F() { // CHECK:STDOUT: %.loc14_21.3: type = converted %.loc14_21.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: } // CHECK:STDOUT: %w: ref %empty_struct_type = bind_name w, %w.var +// CHECK:STDOUT: %impl.elem0.loc14: %.9da = impl_witness_access constants.%Destroy.impl_witness.eb8, element0 [concrete = constants.%Op.d5a] +// CHECK:STDOUT: %bound_method.loc14_13.1: = bound_method %w.var, %impl.elem0.loc14 +// CHECK:STDOUT: %specific_fn.loc14: = specific_function %impl.elem0.loc14, @Op.2(constants.%empty_struct_type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc14_13.2: = bound_method %w.var, %specific_fn.loc14 +// CHECK:STDOUT: %empty_struct.loc14: %empty_struct_type = struct_value () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc14_13: %empty_struct_type = converted %w.var, %empty_struct.loc14 [concrete = constants.%empty_struct] +// CHECK:STDOUT: %no_op.loc14: init %empty_tuple.type = call %bound_method.loc14_13.2(%.loc14_13) +// CHECK:STDOUT: %impl.elem0.loc9: %.9da = impl_witness_access constants.%Destroy.impl_witness.eb8, element0 [concrete = constants.%Op.d5a] +// CHECK:STDOUT: %bound_method.loc9_11.1: = bound_method %v.var, %impl.elem0.loc9 +// CHECK:STDOUT: %specific_fn.loc9: = specific_function %impl.elem0.loc9, @Op.2(constants.%empty_struct_type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc9_11.2: = bound_method %v.var, %specific_fn.loc9 +// CHECK:STDOUT: %empty_struct.loc9: %empty_struct_type = struct_value () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc9_11: %empty_struct_type = converted %v.var, %empty_struct.loc9 [concrete = constants.%empty_struct] +// CHECK:STDOUT: %no_op.loc9: init %empty_tuple.type = call %bound_method.loc9_11.2(%.loc9_11) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/generic/resolve_used.carbon b/toolchain/check/testdata/function/generic/resolve_used.carbon index 9f030bd40308..5c6f4e18ed2a 100644 --- a/toolchain/check/testdata/function/generic/resolve_used.carbon +++ b/toolchain/check/testdata/function/generic/resolve_used.carbon @@ -50,9 +50,19 @@ fn CallNegative() { // CHECK:STDOUT: %ErrorIfNIsZero: %ErrorIfNIsZero.type = struct_value () [concrete] // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] -// CHECK:STDOUT: %Int: type = class_type @Int, @Int(%N) [symbolic] -// CHECK:STDOUT: %require_complete.b4f: = require_complete_type %Int [symbolic] -// CHECK:STDOUT: %pattern_type.896: type = pattern_type %Int [symbolic] +// CHECK:STDOUT: %Int.49d0e6.1: type = class_type @Int, @Int(%N) [symbolic] +// CHECK:STDOUT: %require_complete.b4f426.1: = require_complete_type %Int.49d0e6.1 [symbolic] +// CHECK:STDOUT: %pattern_type.8963eb.1: type = pattern_type %Int.49d0e6.1 [symbolic] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.3, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %Int.49d0e6.1, @Destroy [symbolic] +// CHECK:STDOUT: %Destroy.facet.13d: %Destroy.type = facet_value %Int.49d0e6.1, (%Destroy.lookup_impl_witness) [symbolic] +// CHECK:STDOUT: %.bbc: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.13d [symbolic] +// CHECK:STDOUT: %impl.elem0.fe8: %.bbc = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic] +// CHECK:STDOUT: %specific_impl_fn: = specific_impl_function %impl.elem0.fe8, @Op.1(%Destroy.facet.13d) [symbolic] // CHECK:STDOUT: %CallNegative.type: type = fn_type @CallNegative [concrete] // CHECK:STDOUT: %CallNegative: %CallNegative.type = struct_value () [concrete] // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete] @@ -60,17 +70,27 @@ fn CallNegative() { // CHECK:STDOUT: %i0: type = class_type @Int, @Int(%int_0) [concrete] // CHECK:STDOUT: %complete_type.d94: = complete_type_witness [concrete] // CHECK:STDOUT: %pattern_type.47b: type = pattern_type %i0 [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.404: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%i0) [concrete] +// CHECK:STDOUT: %Op.type.1c2: type = fn_type @Op.3, @impl.49c(%i0) [concrete] +// CHECK:STDOUT: %Op.912: %Op.type.1c2 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.973: %Destroy.type = facet_value %i0, (%Destroy.impl_witness.404) [concrete] +// CHECK:STDOUT: %.9ab: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.973 [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.912, @Op.3(%i0) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .IntLiteral = %Core.IntLiteral // CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Core.IntLiteral: %IntLiteral.type = import_ref Core//prelude/parts/int_literal, IntLiteral, loaded [concrete = constants.%IntLiteral] // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -99,24 +119,35 @@ fn CallNegative() { // CHECK:STDOUT: %N.loc4_19.2: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N.loc4_19.2 (constants.%N)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Int.loc12_20.2: type = class_type @Int, @Int(%N.loc4_19.2) [symbolic = %Int.loc12_20.2 (constants.%Int)] -// CHECK:STDOUT: %require_complete: = require_complete_type %Int.loc12_20.2 [symbolic = %require_complete (constants.%require_complete.b4f)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %Int.loc12_20.2 [symbolic = %pattern_type (constants.%pattern_type.896)] +// CHECK:STDOUT: %Int.loc12_20.2: type = class_type @Int, @Int(%N.loc4_19.2) [symbolic = %Int.loc12_20.2 (constants.%Int.49d0e6.1)] +// CHECK:STDOUT: %require_complete: = require_complete_type %Int.loc12_20.2 [symbolic = %require_complete (constants.%require_complete.b4f426.1)] +// CHECK:STDOUT: %pattern_type: type = pattern_type %Int.loc12_20.2 [symbolic = %pattern_type (constants.%pattern_type.8963eb.1)] +// CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %Int.loc12_20.2, @Destroy [symbolic = %Destroy.lookup_impl_witness (constants.%Destroy.lookup_impl_witness)] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %Int.loc12_20.2, (%Destroy.lookup_impl_witness) [symbolic = %Destroy.facet (constants.%Destroy.facet.13d)] +// CHECK:STDOUT: %.loc12_3.3: type = fn_type_with_self_type constants.%Op.type.bae, %Destroy.facet [symbolic = %.loc12_3.3 (constants.%.bbc)] +// CHECK:STDOUT: %impl.elem0.loc12_3.2: @ErrorIfNIsZero.%.loc12_3.3 (%.bbc) = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc12_3.2 (constants.%impl.elem0.fe8)] +// CHECK:STDOUT: %specific_impl_fn.loc12_3.2: = specific_impl_function %impl.elem0.loc12_3.2, @Op.1(%Destroy.facet) [symbolic = %specific_impl_fn.loc12_3.2 (constants.%specific_impl_fn)] // CHECK:STDOUT: // CHECK:STDOUT: fn() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %v.patt: @ErrorIfNIsZero.%pattern_type (%pattern_type.896) = binding_pattern v [concrete] -// CHECK:STDOUT: %v.var_patt: @ErrorIfNIsZero.%pattern_type (%pattern_type.896) = var_pattern %v.patt [concrete] +// CHECK:STDOUT: %v.patt: @ErrorIfNIsZero.%pattern_type (%pattern_type.8963eb.1) = binding_pattern v [concrete] +// CHECK:STDOUT: %v.var_patt: @ErrorIfNIsZero.%pattern_type (%pattern_type.8963eb.1) = var_pattern %v.patt [concrete] // CHECK:STDOUT: } -// CHECK:STDOUT: %v.var: ref @ErrorIfNIsZero.%Int.loc12_20.2 (%Int) = var %v.var_patt -// CHECK:STDOUT: %.loc12: type = splice_block %Int.loc12_20.1 [symbolic = %Int.loc12_20.2 (constants.%Int)] { +// CHECK:STDOUT: %v.var: ref @ErrorIfNIsZero.%Int.loc12_20.2 (%Int.49d0e6.1) = var %v.var_patt +// CHECK:STDOUT: %.loc12_20: type = splice_block %Int.loc12_20.1 [symbolic = %Int.loc12_20.2 (constants.%Int.49d0e6.1)] { // CHECK:STDOUT: %Core.ref.loc12: = name_ref Core, imports.%Core [concrete = imports.%Core] // CHECK:STDOUT: %Int.ref: %Int.type = name_ref Int, imports.%Core.Int [concrete = constants.%Int.generic] // CHECK:STDOUT: %N.ref: Core.IntLiteral = name_ref N, %N.loc4_19.1 [symbolic = %N.loc4_19.2 (constants.%N)] -// CHECK:STDOUT: %Int.loc12_20.1: type = class_type @Int, @Int(constants.%N) [symbolic = %Int.loc12_20.2 (constants.%Int)] +// CHECK:STDOUT: %Int.loc12_20.1: type = class_type @Int, @Int(constants.%N) [symbolic = %Int.loc12_20.2 (constants.%Int.49d0e6.1)] // CHECK:STDOUT: } -// CHECK:STDOUT: %v: ref @ErrorIfNIsZero.%Int.loc12_20.2 (%Int) = bind_name v, %v.var +// CHECK:STDOUT: %v: ref @ErrorIfNIsZero.%Int.loc12_20.2 (%Int.49d0e6.1) = bind_name v, %v.var +// CHECK:STDOUT: %impl.elem0.loc12_3.1: @ErrorIfNIsZero.%.loc12_3.3 (%.bbc) = impl_witness_access constants.%Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc12_3.2 (constants.%impl.elem0.fe8)] +// CHECK:STDOUT: %bound_method.loc12_3.1: = bound_method %v.var, %impl.elem0.loc12_3.1 +// CHECK:STDOUT: %specific_impl_fn.loc12_3.1: = specific_impl_function %impl.elem0.loc12_3.1, @Op.1(constants.%Destroy.facet.13d) [symbolic = %specific_impl_fn.loc12_3.2 (constants.%specific_impl_fn)] +// CHECK:STDOUT: %bound_method.loc12_3.2: = bound_method %v.var, %specific_impl_fn.loc12_3.1 +// CHECK:STDOUT: %.loc12_3.1: @ErrorIfNIsZero.%Int.loc12_20.2 (%Int.49d0e6.1) = bind_value %v.var +// CHECK:STDOUT: %.loc12_3.2: init %empty_tuple.type = call %bound_method.loc12_3.2(%.loc12_3.1) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -141,5 +172,10 @@ fn CallNegative() { // CHECK:STDOUT: %Int.loc12_20.2 => constants.%i0 // CHECK:STDOUT: %require_complete => constants.%complete_type.d94 // CHECK:STDOUT: %pattern_type => constants.%pattern_type.47b +// CHECK:STDOUT: %Destroy.lookup_impl_witness => constants.%Destroy.impl_witness.404 +// CHECK:STDOUT: %Destroy.facet => constants.%Destroy.facet.973 +// CHECK:STDOUT: %.loc12_3.3 => constants.%.9ab +// CHECK:STDOUT: %impl.elem0.loc12_3.2 => constants.%Op.912 +// CHECK:STDOUT: %specific_impl_fn.loc12_3.2 => constants.%Op.specific_fn // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/generic/return_slot.carbon b/toolchain/check/testdata/function/generic/return_slot.carbon index 6fb00f5d64de..ef813f5af807 100644 --- a/toolchain/check/testdata/function/generic/return_slot.carbon +++ b/toolchain/check/testdata/function/generic/return_slot.carbon @@ -33,7 +33,7 @@ fn G() { // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Wrap.generic: %Wrap.type = struct_value () [concrete] // CHECK:STDOUT: %Wrap.af6: type = class_type @Wrap, @Wrap(%T) [symbolic] -// CHECK:STDOUT: %pattern_type.7dc: type = pattern_type %T [symbolic] +// CHECK:STDOUT: %pattern_type.7dcd0a.1: type = pattern_type %T [symbolic] // CHECK:STDOUT: %Make.type.652: type = fn_type @Make, @Wrap(%T) [symbolic] // CHECK:STDOUT: %Make.eb2: %Make.type.652 = struct_value () [symbolic] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] @@ -69,16 +69,43 @@ fn G() { // CHECK:STDOUT: %Make.type.708: type = fn_type @Make, @Wrap(%C) [concrete] // CHECK:STDOUT: %Make.e4b: %Make.type.708 = struct_value () [concrete] // CHECK:STDOUT: %Make.specific_fn.834: = specific_function %Make.e4b, @Make(%C) [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.906: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%C) [concrete] +// CHECK:STDOUT: %Op.type.153: type = fn_type @Op.2, @impl.49c(%C) [concrete] +// CHECK:STDOUT: %Op.5d7: %Op.type.153 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.494: %Destroy.type = facet_value %C, (%Destroy.impl_witness.906) [concrete] +// CHECK:STDOUT: %.b80: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.494 [concrete] +// CHECK:STDOUT: %Op.specific_fn.6eb: = specific_function %Op.5d7, @Op.2(%C) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.1dc: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.type.a63: type = fn_type @Op.2, @impl.49c(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.ea3: %Op.type.a63 = struct_value () [concrete] // CHECK:STDOUT: %complete_type.782: = complete_type_witness %empty_tuple.type [concrete] +// CHECK:STDOUT: %Destroy.facet.926: %Destroy.type = facet_value %empty_tuple.type, (%Destroy.impl_witness.1dc) [concrete] +// CHECK:STDOUT: %.346: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.926 [concrete] +// CHECK:STDOUT: %Op.specific_fn.393: = specific_function %Op.ea3, @Op.2(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.64e: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.type.a17: type = fn_type @Op.2, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.e6a: %Op.type.a17 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.5f7: %Destroy.type = facet_value %i32, (%Destroy.impl_witness.64e) [concrete] +// CHECK:STDOUT: %.ab7: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.5f7 [concrete] +// CHECK:STDOUT: %Op.specific_fn.014: = specific_function %Op.e6a, @Op.2(%i32) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -107,8 +134,8 @@ fn G() { // CHECK:STDOUT: // CHECK:STDOUT: class { // CHECK:STDOUT: %Make.decl: @Wrap.%Make.type (%Make.type.652) = fn_decl @Make [symbolic = @Wrap.%Make (constants.%Make.eb2)] { -// CHECK:STDOUT: %return.patt: @Make.%pattern_type (%pattern_type.7dc) = return_slot_pattern [concrete] -// CHECK:STDOUT: %return.param_patt: @Make.%pattern_type (%pattern_type.7dc) = out_param_pattern %return.patt, call_param0 [concrete] +// CHECK:STDOUT: %return.patt: @Make.%pattern_type (%pattern_type.7dcd0a.1) = return_slot_pattern [concrete] +// CHECK:STDOUT: %return.param_patt: @Make.%pattern_type (%pattern_type.7dcd0a.1) = out_param_pattern %return.patt, call_param0 [concrete] // CHECK:STDOUT: } { // CHECK:STDOUT: %T.ref: type = name_ref T, @Wrap.%T.loc15_12.1 [symbolic = %T (constants.%T)] // CHECK:STDOUT: %return.param: ref @Make.%T (%T) = out_param call_param0 @@ -142,7 +169,7 @@ fn G() { // CHECK:STDOUT: // CHECK:STDOUT: generic fn @Make(@Wrap.%T.loc15_12.1: type) { // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %T [symbolic = %pattern_type (constants.%pattern_type.7dc)] +// CHECK:STDOUT: %pattern_type: type = pattern_type %T [symbolic = %pattern_type (constants.%pattern_type.7dcd0a.1)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete: = require_complete_type %T [symbolic = %require_complete (constants.%require_complete.4ae)] @@ -213,11 +240,36 @@ fn G() { // CHECK:STDOUT: %.loc24_21: %Make.type.708 = specific_constant @Wrap.%Make.decl, @Wrap(constants.%C) [concrete = constants.%Make.e4b] // CHECK:STDOUT: %Make.ref.loc24: %Make.type.708 = name_ref Make, %.loc24_21 [concrete = constants.%Make.e4b] // CHECK:STDOUT: %Make.specific_fn.loc24: = specific_function %Make.ref.loc24, @Make(constants.%C) [concrete = constants.%Make.specific_fn.834] -// CHECK:STDOUT: %.loc24_3: ref %C = splice_block %c.var {} -// CHECK:STDOUT: %Make.call.loc24: init %C = call %Make.specific_fn.loc24() to %.loc24_3 +// CHECK:STDOUT: %.loc24_3.1: ref %C = splice_block %c.var {} +// CHECK:STDOUT: %Make.call.loc24: init %C = call %Make.specific_fn.loc24() to %.loc24_3.1 // CHECK:STDOUT: assign %c.var, %Make.call.loc24 // CHECK:STDOUT: %C.ref.loc24_10: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var +// CHECK:STDOUT: %impl.elem0.loc24_3.1: %.b80 = impl_witness_access constants.%Destroy.impl_witness.906, element0 [concrete = constants.%Op.5d7] +// CHECK:STDOUT: %bound_method.loc24_3.1: = bound_method %.loc24_3.1, %impl.elem0.loc24_3.1 +// CHECK:STDOUT: %specific_fn.loc24_3.1: = specific_function %impl.elem0.loc24_3.1, @Op.2(constants.%C) [concrete = constants.%Op.specific_fn.6eb] +// CHECK:STDOUT: %bound_method.loc24_3.2: = bound_method %.loc24_3.1, %specific_fn.loc24_3.1 +// CHECK:STDOUT: %.loc24_3.2: %C = bind_value %.loc24_3.1 +// CHECK:STDOUT: %no_op.loc24_3.1: init %empty_tuple.type = call %bound_method.loc24_3.2(%.loc24_3.2) +// CHECK:STDOUT: %impl.elem0.loc24_3.2: %.b80 = impl_witness_access constants.%Destroy.impl_witness.906, element0 [concrete = constants.%Op.5d7] +// CHECK:STDOUT: %bound_method.loc24_3.3: = bound_method %c.var, %impl.elem0.loc24_3.2 +// CHECK:STDOUT: %specific_fn.loc24_3.2: = specific_function %impl.elem0.loc24_3.2, @Op.2(constants.%C) [concrete = constants.%Op.specific_fn.6eb] +// CHECK:STDOUT: %bound_method.loc24_3.4: = bound_method %c.var, %specific_fn.loc24_3.2 +// CHECK:STDOUT: %.loc24_3.3: %C = bind_value %c.var +// CHECK:STDOUT: %no_op.loc24_3.2: init %empty_tuple.type = call %bound_method.loc24_3.4(%.loc24_3.3) +// CHECK:STDOUT: %impl.elem0.loc23: %.346 = impl_witness_access constants.%Destroy.impl_witness.1dc, element0 [concrete = constants.%Op.ea3] +// CHECK:STDOUT: %bound_method.loc23_3.1: = bound_method %b.var, %impl.elem0.loc23 +// CHECK:STDOUT: %specific_fn.loc23: = specific_function %impl.elem0.loc23, @Op.2(constants.%empty_tuple.type) [concrete = constants.%Op.specific_fn.393] +// CHECK:STDOUT: %bound_method.loc23_3.2: = bound_method %b.var, %specific_fn.loc23 +// CHECK:STDOUT: %tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc23_3: %empty_tuple.type = converted %b.var, %tuple [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %no_op.loc23: init %empty_tuple.type = call %bound_method.loc23_3.2(%.loc23_3) +// CHECK:STDOUT: %impl.elem0.loc22: %.ab7 = impl_witness_access constants.%Destroy.impl_witness.64e, element0 [concrete = constants.%Op.e6a] +// CHECK:STDOUT: %bound_method.loc22_3.1: = bound_method %a.var, %impl.elem0.loc22 +// CHECK:STDOUT: %specific_fn.loc22: = specific_function %impl.elem0.loc22, @Op.2(constants.%i32) [concrete = constants.%Op.specific_fn.014] +// CHECK:STDOUT: %bound_method.loc22_3.2: = bound_method %a.var, %specific_fn.loc22 +// CHECK:STDOUT: %.loc22_3: %i32 = bind_value %a.var +// CHECK:STDOUT: %no_op.loc22: init %empty_tuple.type = call %bound_method.loc22_3.2(%.loc22_3) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -231,7 +283,7 @@ fn G() { // CHECK:STDOUT: // CHECK:STDOUT: specific @Make(constants.%T) { // CHECK:STDOUT: %T => constants.%T -// CHECK:STDOUT: %pattern_type => constants.%pattern_type.7dc +// CHECK:STDOUT: %pattern_type => constants.%pattern_type.7dcd0a.1 // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete => constants.%require_complete.4ae diff --git a/toolchain/check/testdata/function/generic/type_param.carbon b/toolchain/check/testdata/function/generic/type_param.carbon index c0f3dba309ee..a1066a2bcffc 100644 --- a/toolchain/check/testdata/function/generic/type_param.carbon +++ b/toolchain/check/testdata/function/generic/type_param.carbon @@ -23,19 +23,29 @@ fn F(T:! type) { // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete] // CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] // CHECK:STDOUT: %ptr: type = ptr_type %T [symbolic] // CHECK:STDOUT: %require_complete.6e5: = require_complete_type %ptr [symbolic] // CHECK:STDOUT: %pattern_type.afe: type = pattern_type %ptr [symbolic] // CHECK:STDOUT: %require_complete.4ae: = require_complete_type %T [symbolic] // CHECK:STDOUT: %pattern_type.7dc: type = pattern_type %T [symbolic] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %ptr, @Destroy [symbolic] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %ptr, (%Destroy.lookup_impl_witness) [symbolic] +// CHECK:STDOUT: %.ea9: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [symbolic] +// CHECK:STDOUT: %impl.elem0: %.ea9 = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic] +// CHECK:STDOUT: %specific_impl_fn: = specific_impl_function %impl.elem0, @Op.1(%Destroy.facet) [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -60,6 +70,11 @@ fn F(T:! type) { // CHECK:STDOUT: %pattern_type.loc16: type = pattern_type %ptr.loc16_11.2 [symbolic = %pattern_type.loc16 (constants.%pattern_type.afe)] // CHECK:STDOUT: %require_complete.loc17: = require_complete_type %T.loc15_6.2 [symbolic = %require_complete.loc17 (constants.%require_complete.4ae)] // CHECK:STDOUT: %pattern_type.loc17: type = pattern_type %T.loc15_6.2 [symbolic = %pattern_type.loc17 (constants.%pattern_type.7dc)] +// CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %ptr.loc16_11.2, @Destroy [symbolic = %Destroy.lookup_impl_witness (constants.%Destroy.lookup_impl_witness)] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %ptr.loc16_11.2, (%Destroy.lookup_impl_witness) [symbolic = %Destroy.facet (constants.%Destroy.facet)] +// CHECK:STDOUT: %.loc16_3.3: type = fn_type_with_self_type constants.%Op.type.bae, %Destroy.facet [symbolic = %.loc16_3.3 (constants.%.ea9)] +// CHECK:STDOUT: %impl.elem0.loc16_3.2: @F.%.loc16_3.3 (%.ea9) = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc16_3.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %specific_impl_fn.loc16_3.2: = specific_impl_function %impl.elem0.loc16_3.2, @Op.1(%Destroy.facet) [symbolic = %specific_impl_fn.loc16_3.2 (constants.%specific_impl_fn)] // CHECK:STDOUT: // CHECK:STDOUT: fn() { // CHECK:STDOUT: !entry: @@ -68,7 +83,7 @@ fn F(T:! type) { // CHECK:STDOUT: %p.var_patt: @F.%pattern_type.loc16 (%pattern_type.afe) = var_pattern %p.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %p.var: ref @F.%ptr.loc16_11.2 (%ptr) = var %p.var_patt -// CHECK:STDOUT: %.loc16: type = splice_block %ptr.loc16_11.1 [symbolic = %ptr.loc16_11.2 (constants.%ptr)] { +// CHECK:STDOUT: %.loc16_11: type = splice_block %ptr.loc16_11.1 [symbolic = %ptr.loc16_11.2 (constants.%ptr)] { // CHECK:STDOUT: %T.ref.loc16: type = name_ref T, %T.loc15_6.1 [symbolic = %T.loc15_6.2 (constants.%T)] // CHECK:STDOUT: %ptr.loc16_11.1: type = ptr_type %T.ref.loc16 [symbolic = %ptr.loc16_11.2 (constants.%ptr)] // CHECK:STDOUT: } @@ -82,6 +97,12 @@ fn F(T:! type) { // CHECK:STDOUT: %T.ref.loc17: type = name_ref T, %T.loc15_6.1 [symbolic = %T.loc15_6.2 (constants.%T)] // CHECK:STDOUT: %.loc17_14.2: @F.%T.loc15_6.2 (%T) = bind_value %.loc17_14.1 // CHECK:STDOUT: %n: @F.%T.loc15_6.2 (%T) = bind_name n, %.loc17_14.2 +// CHECK:STDOUT: %impl.elem0.loc16_3.1: @F.%.loc16_3.3 (%.ea9) = impl_witness_access constants.%Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc16_3.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %bound_method.loc16_3.1: = bound_method %p.var, %impl.elem0.loc16_3.1 +// CHECK:STDOUT: %specific_impl_fn.loc16_3.1: = specific_impl_function %impl.elem0.loc16_3.1, @Op.1(constants.%Destroy.facet) [symbolic = %specific_impl_fn.loc16_3.2 (constants.%specific_impl_fn)] +// CHECK:STDOUT: %bound_method.loc16_3.2: = bound_method %p.var, %specific_impl_fn.loc16_3.1 +// CHECK:STDOUT: %.loc16_3.1: @F.%ptr.loc16_11.2 (%ptr) = bind_value %p.var +// CHECK:STDOUT: %.loc16_3.2: init %empty_tuple.type = call %bound_method.loc16_3.2(%.loc16_3.1) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/generic/call_basic_depth.carbon b/toolchain/check/testdata/generic/call_basic_depth.carbon index 6962377190ba..cb92161e41cf 100644 --- a/toolchain/check/testdata/generic/call_basic_depth.carbon +++ b/toolchain/check/testdata/generic/call_basic_depth.carbon @@ -94,6 +94,16 @@ fn M() { // CHECK:STDOUT: %int_0.6a9: %i32 = int_value 0 [concrete] // CHECK:STDOUT: %F.specific_fn.501: = specific_function %F, @F(%i32) [concrete] // CHECK:STDOUT: %G.specific_fn: = specific_function %G, @G(%i32) [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.2 [concrete] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.3, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.64e: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.type.a17: type = fn_type @Op.3, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.e6a: %Op.type.a17 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %i32, (%Destroy.impl_witness.64e) [concrete] +// CHECK:STDOUT: %.ab7: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.e6a, @Op.3(%i32) [concrete] // CHECK:STDOUT: %H.specific_fn.aac: = specific_function %H, @H(%i32) [concrete] // CHECK:STDOUT: %Cfn.specific_fn.7b2: = specific_function %Cfn, @Cfn(%i32) [concrete] // CHECK:STDOUT: } @@ -102,6 +112,7 @@ fn M() { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Int = %Core.Int // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -109,6 +120,9 @@ fn M() { // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -283,13 +297,13 @@ fn M() { // CHECK:STDOUT: } // CHECK:STDOUT: %n.var: ref %i32 = var %n.var_patt // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] -// CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] -// CHECK:STDOUT: %bound_method.loc39_3.1: = bound_method %int_0, %impl.elem0 [concrete = constants.%Convert.bound] -// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc39_3.2: = bound_method %int_0, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %impl.elem0.loc39_3.1: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc39_3.1: = bound_method %int_0, %impl.elem0.loc39_3.1 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %specific_fn.loc39_3.1: = specific_function %impl.elem0.loc39_3.1, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc39_3.2: = bound_method %int_0, %specific_fn.loc39_3.1 [concrete = constants.%bound_method] // CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc39_3.2(%int_0) [concrete = constants.%int_0.6a9] -// CHECK:STDOUT: %.loc39_3: init %i32 = converted %int_0, %int.convert_checked [concrete = constants.%int_0.6a9] -// CHECK:STDOUT: assign %n.var, %.loc39_3 +// CHECK:STDOUT: %.loc39_3.1: init %i32 = converted %int_0, %int.convert_checked [concrete = constants.%int_0.6a9] +// CHECK:STDOUT: assign %n.var, %.loc39_3.1 // CHECK:STDOUT: %.loc39_10: type = splice_block %i32.loc39 [concrete = constants.%i32] { // CHECK:STDOUT: %int_32.loc39: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32.loc39: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] @@ -300,7 +314,7 @@ fn M() { // CHECK:STDOUT: %m.var_patt: %pattern_type.7ce = var_pattern %m.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %m.var: ref %i32 = var %m.var_patt -// CHECK:STDOUT: %.loc40: type = splice_block %i32.loc40 [concrete = constants.%i32] { +// CHECK:STDOUT: %.loc40_10: type = splice_block %i32.loc40 [concrete = constants.%i32] { // CHECK:STDOUT: %int_32.loc40: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32.loc40: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: } @@ -317,6 +331,18 @@ fn M() { // CHECK:STDOUT: %.loc43: %i32 = bind_value %n.ref.loc43 // CHECK:STDOUT: %G.call: init %i32 = call %G.specific_fn(%.loc43) // CHECK:STDOUT: assign %m.ref, %G.call +// CHECK:STDOUT: %impl.elem0.loc40: %.ab7 = impl_witness_access constants.%Destroy.impl_witness.64e, element0 [concrete = constants.%Op.e6a] +// CHECK:STDOUT: %bound_method.loc40_3.1: = bound_method %m.var, %impl.elem0.loc40 +// CHECK:STDOUT: %specific_fn.loc40: = specific_function %impl.elem0.loc40, @Op.3(constants.%i32) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc40_3.2: = bound_method %m.var, %specific_fn.loc40 +// CHECK:STDOUT: %.loc40_3: %i32 = bind_value %m.var +// CHECK:STDOUT: %no_op.loc40: init %empty_tuple.type = call %bound_method.loc40_3.2(%.loc40_3) +// CHECK:STDOUT: %impl.elem0.loc39_3.2: %.ab7 = impl_witness_access constants.%Destroy.impl_witness.64e, element0 [concrete = constants.%Op.e6a] +// CHECK:STDOUT: %bound_method.loc39_3.3: = bound_method %n.var, %impl.elem0.loc39_3.2 +// CHECK:STDOUT: %specific_fn.loc39_3.2: = specific_function %impl.elem0.loc39_3.2, @Op.3(constants.%i32) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc39_3.4: = bound_method %n.var, %specific_fn.loc39_3.2 +// CHECK:STDOUT: %.loc39_3.2: %i32 = bind_value %n.var +// CHECK:STDOUT: %no_op.loc39: init %empty_tuple.type = call %bound_method.loc39_3.4(%.loc39_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/generic/complete_type.carbon b/toolchain/check/testdata/generic/complete_type.carbon index 4d90ca1705d1..2722c560b0ba 100644 --- a/toolchain/check/testdata/generic/complete_type.carbon +++ b/toolchain/check/testdata/generic/complete_type.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/none.carbon +// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/destroy.carbon // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only". // EXTRA-ARGS: --dump-sem-ir-ranges=if-present // @@ -74,6 +74,19 @@ fn F(T:! type) { var v: T; } +// CHECK:STDERR: fail_incomplete_in_function_at_eof.carbon:[[@LINE+17]]:10: note: in `F(B)` used here [ResolvingSpecificHere] +// CHECK:STDERR: fn G() { F(B); } +// CHECK:STDERR: ^ +// CHECK:STDERR: +// CHECK:STDERR: min_prelude/parts/destroy.carbon:8:9: error: `T` evaluates to incomplete type `B` [IncompleteTypeInMonomorphization] +// CHECK:STDERR: fn Op[self: Self]() = "no_op"; +// CHECK:STDERR: ^~~~~~~~~~ +// CHECK:STDERR: fail_incomplete_in_function_at_eof.carbon:[[@LINE-19]]:1: note: class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: class B; +// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: fail_incomplete_in_function_at_eof.carbon:[[@LINE-13]]:3: note: in `Core.` used here [ResolvingSpecificHere] +// CHECK:STDERR: var v: T; +// CHECK:STDERR: ^~~~~~~~ // CHECK:STDERR: fail_incomplete_in_function_at_eof.carbon:[[@LINE+4]]:10: note: in `F(B)` used here [ResolvingSpecificHere] // CHECK:STDERR: fn G() { F(B); } // CHECK:STDERR: ^ @@ -104,12 +117,21 @@ fn G() { F(B); } // CHECK:STDOUT: %complete_type.357: = complete_type_witness %empty_struct_type [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: .B = %B.decl.loc4 // CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %B.decl.loc4: type = class_decl @B [concrete = constants.%B] {} {} // CHECK:STDOUT: %A.decl: %A.type = class_decl @A [concrete = constants.%A.generic] { // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete] @@ -195,20 +217,48 @@ fn G() { F(B); } // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] // CHECK:STDOUT: %require_complete: = require_complete_type %T [symbolic] // CHECK:STDOUT: %pattern_type.7dc: type = pattern_type %T [symbolic] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %T, @Destroy [symbolic] +// CHECK:STDOUT: %Destroy.facet.713: %Destroy.type = facet_value %T, (%Destroy.lookup_impl_witness) [symbolic] +// CHECK:STDOUT: %.a63: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.713 [symbolic] +// CHECK:STDOUT: %impl.elem0: %.a63 = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic] +// CHECK:STDOUT: %specific_impl_fn: = specific_impl_function %impl.elem0, @Op.1(%Destroy.facet.713) [symbolic] // CHECK:STDOUT: %G.type: type = fn_type @G [concrete] // CHECK:STDOUT: %G: %G.type = struct_value () [concrete] // CHECK:STDOUT: %F.specific_fn: = specific_function %F, @F(%B) [concrete] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] // CHECK:STDOUT: %pattern_type.049: type = pattern_type %B [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.39d: = impl_witness imports.%Destroy.impl_witness_table, @impl(%B) [concrete] +// CHECK:STDOUT: %Op.type.1a6: type = fn_type @Op.2, @impl(%B) [concrete] +// CHECK:STDOUT: %Op.3c2: %Op.type.1a6 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.331: %Destroy.type = facet_value %B, (%Destroy.impl_witness.39d) [concrete] +// CHECK:STDOUT: %.c16: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.331 [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.3c2, @Op.2(%B) [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: .B = %B.decl.loc4 // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %B.decl.loc4: type = class_decl @B [concrete = constants.%B] {} {} // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] { // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete] @@ -234,6 +284,11 @@ fn G() { F(B); } // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete: = require_complete_type %T.loc6_6.2 [symbolic = %require_complete (constants.%require_complete)] // CHECK:STDOUT: %pattern_type: type = pattern_type %T.loc6_6.2 [symbolic = %pattern_type (constants.%pattern_type.7dc)] +// CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %T.loc6_6.2, @Destroy [symbolic = %Destroy.lookup_impl_witness (constants.%Destroy.lookup_impl_witness)] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %T.loc6_6.2, (%Destroy.lookup_impl_witness) [symbolic = %Destroy.facet (constants.%Destroy.facet.713)] +// CHECK:STDOUT: %.loc7_3.3: type = fn_type_with_self_type constants.%Op.type.bae, %Destroy.facet [symbolic = %.loc7_3.3 (constants.%.a63)] +// CHECK:STDOUT: %impl.elem0.loc7_3.2: @F.%.loc7_3.3 (%.a63) = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc7_3.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %specific_impl_fn.loc7_3.2: = specific_impl_function %impl.elem0.loc7_3.2, @Op.1(%Destroy.facet) [symbolic = %specific_impl_fn.loc7_3.2 (constants.%specific_impl_fn)] // CHECK:STDOUT: // CHECK:STDOUT: fn() { // CHECK:STDOUT: !entry: @@ -244,6 +299,12 @@ fn G() { F(B); } // CHECK:STDOUT: %v.var: ref @F.%T.loc6_6.2 (%T) = var %v.var_patt // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc6_6.1 [symbolic = %T.loc6_6.2 (constants.%T)] // CHECK:STDOUT: %v: ref @F.%T.loc6_6.2 (%T) = bind_name v, %v.var +// CHECK:STDOUT: %impl.elem0.loc7_3.1: @F.%.loc7_3.3 (%.a63) = impl_witness_access constants.%Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc7_3.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %bound_method.loc7_3.1: = bound_method %v.var, %impl.elem0.loc7_3.1 +// CHECK:STDOUT: %specific_impl_fn.loc7_3.1: = specific_impl_function %impl.elem0.loc7_3.1, @Op.1(constants.%Destroy.facet.713) [symbolic = %specific_impl_fn.loc7_3.2 (constants.%specific_impl_fn)] +// CHECK:STDOUT: %bound_method.loc7_3.2: = bound_method %v.var, %specific_impl_fn.loc7_3.1 +// CHECK:STDOUT: %.loc7_3.1: @F.%T.loc6_6.2 (%T) = bind_value %v.var +// CHECK:STDOUT: %.loc7_3.2: init %empty_tuple.type = call %bound_method.loc7_3.2(%.loc7_3.1) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -267,6 +328,11 @@ fn G() { F(B); } // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete => constants.%complete_type // CHECK:STDOUT: %pattern_type => constants.%pattern_type.049 +// CHECK:STDOUT: %Destroy.lookup_impl_witness => constants.%Destroy.impl_witness.39d +// CHECK:STDOUT: %Destroy.facet => constants.%Destroy.facet.331 +// CHECK:STDOUT: %.loc7_3.3 => constants.%.c16 +// CHECK:STDOUT: %impl.elem0.loc7_3.2 => constants.%Op.3c2 +// CHECK:STDOUT: %specific_impl_fn.loc7_3.2 => constants.%Op.specific_fn // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_incomplete_in_function_at_eof.carbon @@ -280,18 +346,46 @@ fn G() { F(B); } // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] // CHECK:STDOUT: %require_complete: = require_complete_type %T [symbolic] // CHECK:STDOUT: %pattern_type.7dc: type = pattern_type %T [symbolic] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %T, @Destroy [symbolic] +// CHECK:STDOUT: %Destroy.facet.713: %Destroy.type = facet_value %T, (%Destroy.lookup_impl_witness) [symbolic] +// CHECK:STDOUT: %.a63: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.713 [symbolic] +// CHECK:STDOUT: %impl.elem0: %.a63 = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic] +// CHECK:STDOUT: %specific_impl_fn: = specific_impl_function %impl.elem0, @Op.1(%Destroy.facet.713) [symbolic] // CHECK:STDOUT: %G.type: type = fn_type @G [concrete] // CHECK:STDOUT: %G: %G.type = struct_value () [concrete] // CHECK:STDOUT: %F.specific_fn: = specific_function %F, @F(%B) [concrete] // CHECK:STDOUT: %pattern_type.049: type = pattern_type %B [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.39d: = impl_witness imports.%Destroy.impl_witness_table, @impl(%B) [concrete] +// CHECK:STDOUT: %Op.type.1a6: type = fn_type @Op.2, @impl(%B) [concrete] +// CHECK:STDOUT: %Op.3c2: %Op.type.1a6 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.331: %Destroy.type = facet_value %B, (%Destroy.impl_witness.39d) [concrete] +// CHECK:STDOUT: %.c16: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.331 [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.3c2, @Op.2(%B) [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: .B = %B.decl // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %B.decl: type = class_decl @B [concrete = constants.%B] {} {} // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] { // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete] @@ -309,6 +403,11 @@ fn G() { F(B); } // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete: = require_complete_type %T.loc6_6.2 [symbolic = %require_complete (constants.%require_complete)] // CHECK:STDOUT: %pattern_type: type = pattern_type %T.loc6_6.2 [symbolic = %pattern_type (constants.%pattern_type.7dc)] +// CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %T.loc6_6.2, @Destroy [symbolic = %Destroy.lookup_impl_witness (constants.%Destroy.lookup_impl_witness)] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %T.loc6_6.2, (%Destroy.lookup_impl_witness) [symbolic = %Destroy.facet (constants.%Destroy.facet.713)] +// CHECK:STDOUT: %.loc13_3.3: type = fn_type_with_self_type constants.%Op.type.bae, %Destroy.facet [symbolic = %.loc13_3.3 (constants.%.a63)] +// CHECK:STDOUT: %impl.elem0.loc13_3.2: @F.%.loc13_3.3 (%.a63) = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc13_3.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %specific_impl_fn.loc13_3.2: = specific_impl_function %impl.elem0.loc13_3.2, @Op.1(%Destroy.facet) [symbolic = %specific_impl_fn.loc13_3.2 (constants.%specific_impl_fn)] // CHECK:STDOUT: // CHECK:STDOUT: fn() { // CHECK:STDOUT: !entry: @@ -319,6 +418,12 @@ fn G() { F(B); } // CHECK:STDOUT: %v.var: ref @F.%T.loc6_6.2 (%T) = var %v.var_patt // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc6_6.1 [symbolic = %T.loc6_6.2 (constants.%T)] // CHECK:STDOUT: %v: ref @F.%T.loc6_6.2 (%T) = bind_name v, %v.var +// CHECK:STDOUT: %impl.elem0.loc13_3.1: @F.%.loc13_3.3 (%.a63) = impl_witness_access constants.%Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc13_3.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %bound_method.loc13_3.1: = bound_method %v.var, %impl.elem0.loc13_3.1 +// CHECK:STDOUT: %specific_impl_fn.loc13_3.1: = specific_impl_function %impl.elem0.loc13_3.1, @Op.1(constants.%Destroy.facet.713) [symbolic = %specific_impl_fn.loc13_3.2 (constants.%specific_impl_fn)] +// CHECK:STDOUT: %bound_method.loc13_3.2: = bound_method %v.var, %specific_impl_fn.loc13_3.1 +// CHECK:STDOUT: %.loc13_3.1: @F.%T.loc6_6.2 (%T) = bind_value %v.var +// CHECK:STDOUT: %.loc13_3.2: init %empty_tuple.type = call %bound_method.loc13_3.2(%.loc13_3.1) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -342,5 +447,10 @@ fn G() { F(B); } // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete => // CHECK:STDOUT: %pattern_type => constants.%pattern_type.049 +// CHECK:STDOUT: %Destroy.lookup_impl_witness => constants.%Destroy.impl_witness.39d +// CHECK:STDOUT: %Destroy.facet => constants.%Destroy.facet.331 +// CHECK:STDOUT: %.loc13_3.3 => constants.%.c16 +// CHECK:STDOUT: %impl.elem0.loc13_3.2 => constants.%Op.3c2 +// CHECK:STDOUT: %specific_impl_fn.loc13_3.2 => constants.%Op.specific_fn // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/generic/forward_decl.carbon b/toolchain/check/testdata/generic/forward_decl.carbon index 08bcae7c458f..f6fbf166812f 100644 --- a/toolchain/check/testdata/generic/forward_decl.carbon +++ b/toolchain/check/testdata/generic/forward_decl.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/none.carbon +// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/destroy.carbon // // AUTOUPDATE // TIP: To test this file alone, run: diff --git a/toolchain/check/testdata/generic/local.carbon b/toolchain/check/testdata/generic/local.carbon index 1dd6e977bb4f..221187c36779 100644 --- a/toolchain/check/testdata/generic/local.carbon +++ b/toolchain/check/testdata/generic/local.carbon @@ -51,6 +51,7 @@ class C(C:! type) { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete] @@ -91,12 +92,23 @@ class C(C:! type) { // CHECK:STDOUT: %bound_method: = bound_method %int_1.5b8, %Convert.specific_fn [concrete] // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete] // CHECK:STDOUT: %C.val: %C.d45 = struct_value (%int_1.5d2) [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.2 [concrete] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.3, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.bcb: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%C.d45) [concrete] +// CHECK:STDOUT: %Op.type.39b: type = fn_type @Op.3, @impl.49c(%C.d45) [concrete] +// CHECK:STDOUT: %Op.5e9: %Op.type.39b = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %C.d45, (%Destroy.impl_witness.bcb) [concrete] +// CHECK:STDOUT: %.f33: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.5e9, @Op.3(%C.d45) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Int = %Core.Int // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -104,6 +116,9 @@ class C(C:! type) { // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -153,17 +168,17 @@ class C(C:! type) { // CHECK:STDOUT: %v.var: ref %C.d45 = var %v.var_patt // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] // CHECK:STDOUT: %.loc8_26.1: %struct_type.x.c96 = struct_literal (%int_1) -// CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] -// CHECK:STDOUT: %bound_method.loc8_26.1: = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound] -// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc8_26.2: = bound_method %int_1, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %impl.elem0.loc8_26: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc8_26.1: = bound_method %int_1, %impl.elem0.loc8_26 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %specific_fn.loc8_26: = specific_function %impl.elem0.loc8_26, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc8_26.2: = bound_method %int_1, %specific_fn.loc8_26 [concrete = constants.%bound_method] // CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc8_26.2(%int_1) [concrete = constants.%int_1.5d2] // CHECK:STDOUT: %.loc8_26.2: init %i32 = converted %int_1, %int.convert_checked [concrete = constants.%int_1.5d2] // CHECK:STDOUT: %.loc8_26.3: ref %i32 = class_element_access %v.var, element0 // CHECK:STDOUT: %.loc8_26.4: init %i32 = initialize_from %.loc8_26.2 to %.loc8_26.3 [concrete = constants.%int_1.5d2] // CHECK:STDOUT: %.loc8_26.5: init %C.d45 = class_init (%.loc8_26.4), %v.var [concrete = constants.%C.val] -// CHECK:STDOUT: %.loc8_3: init %C.d45 = converted %.loc8_26.1, %.loc8_26.5 [concrete = constants.%C.val] -// CHECK:STDOUT: assign %v.var, %.loc8_3 +// CHECK:STDOUT: %.loc8_3.1: init %C.d45 = converted %.loc8_26.1, %.loc8_26.5 [concrete = constants.%C.val] +// CHECK:STDOUT: assign %v.var, %.loc8_3.1 // CHECK:STDOUT: %.loc8_15: type = splice_block %C [concrete = constants.%C.d45] { // CHECK:STDOUT: %C.ref: %C.type = name_ref C, %C.decl [concrete = constants.%C.generic] // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] @@ -171,6 +186,12 @@ class C(C:! type) { // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%i32) [concrete = constants.%C.d45] // CHECK:STDOUT: } // CHECK:STDOUT: %v: ref %C.d45 = bind_name v, %v.var +// CHECK:STDOUT: %impl.elem0.loc8_3: %.f33 = impl_witness_access constants.%Destroy.impl_witness.bcb, element0 [concrete = constants.%Op.5e9] +// CHECK:STDOUT: %bound_method.loc8_3.1: = bound_method %v.var, %impl.elem0.loc8_3 +// CHECK:STDOUT: %specific_fn.loc8_3: = specific_function %impl.elem0.loc8_3, @Op.3(constants.%C.d45) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc8_3.2: = bound_method %v.var, %specific_fn.loc8_3 +// CHECK:STDOUT: %.loc8_3.2: %C.d45 = bind_value %v.var +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc8_3.2(%.loc8_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/generic/template/unimplemented.carbon b/toolchain/check/testdata/generic/template/unimplemented.carbon index 820f7b26c53f..11e80ff90bd7 100644 --- a/toolchain/check/testdata/generic/template/unimplemented.carbon +++ b/toolchain/check/testdata/generic/template/unimplemented.carbon @@ -242,6 +242,7 @@ fn F[template T:! type](x: T) { // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete] // CHECK:STDOUT: %pattern_type.7dcd0a.1: type = pattern_type %T.8b3d5d.1 [template] // CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] // CHECK:STDOUT: %require_complete.4aeca8.1: = require_complete_type %T.8b3d5d.1 [template] // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete] @@ -253,17 +254,37 @@ fn F[template T:! type](x: T) { // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete] +// CHECK:STDOUT: %T.8b3d5d.2: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.95 [concrete] +// CHECK:STDOUT: %Op.type.bc96ef.1: type = fn_type @Op.96, @impl.49c(%T.8b3d5d.2) [symbolic] +// CHECK:STDOUT: %Op.46fd6b.1: %Op.type.bc96ef.1 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.64e: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.type.a17: type = fn_type @Op.96, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.e6a: %Op.type.a17 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.5f7: %Destroy.type = facet_value %i32, (%Destroy.impl_witness.64e) [concrete] +// CHECK:STDOUT: %.ab7: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.5f7 [concrete] +// CHECK:STDOUT: %Op.specific_fn.014: = specific_function %Op.e6a, @Op.96(%i32) [concrete] +// CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %T.8b3d5d.1, @Destroy [template] +// CHECK:STDOUT: %Destroy.facet.713: %Destroy.type = facet_value %T.8b3d5d.1, (%Destroy.lookup_impl_witness) [template] +// CHECK:STDOUT: %.a63: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.713 [template] +// CHECK:STDOUT: %impl.elem0.538: %.a63 = impl_witness_access %Destroy.lookup_impl_witness, element0 [template] +// CHECK:STDOUT: %specific_impl_fn.1af: = specific_impl_function %impl.elem0.538, @Op.95(%Destroy.facet.713) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs // CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc96ef.1) = import_ref Core//prelude/destroy, loc15_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46fd6b.1)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -291,8 +312,13 @@ fn F[template T:! type](x: T) { // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete: = require_complete_type %T.loc4_15.2 [template = %require_complete (constants.%require_complete.4aeca8.1)] // CHECK:STDOUT: %ImplicitAs.type.loc14_3.2: type = facet_type <@ImplicitAs, @ImplicitAs(%T.loc4_15.2)> [template = %ImplicitAs.type.loc14_3.2 (constants.%ImplicitAs.type.d628ce.2)] -// CHECK:STDOUT: %.loc14_3.3: = access_member_action %ImplicitAs.type.loc14_3.1, Convert [template] -// CHECK:STDOUT: %.loc14_3.4: type = type_of_inst %.loc14_3.3 [template] +// CHECK:STDOUT: %.loc14_3.5: = access_member_action %ImplicitAs.type.loc14_3.1, Convert [template] +// CHECK:STDOUT: %.loc14_3.6: type = type_of_inst %.loc14_3.5 [template] +// CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %T.loc4_15.2, @Destroy [template = %Destroy.lookup_impl_witness (constants.%Destroy.lookup_impl_witness)] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %T.loc4_15.2, (%Destroy.lookup_impl_witness) [template = %Destroy.facet (constants.%Destroy.facet.713)] +// CHECK:STDOUT: %.loc14_3.7: type = fn_type_with_self_type constants.%Op.type.bae, %Destroy.facet [template = %.loc14_3.7 (constants.%.a63)] +// CHECK:STDOUT: %impl.elem0.loc14_3.2: @F.%.loc14_3.7 (%.a63) = impl_witness_access %Destroy.lookup_impl_witness, element0 [template = %impl.elem0.loc14_3.2 (constants.%impl.elem0.538)] +// CHECK:STDOUT: %specific_impl_fn.loc14_3.2: = specific_impl_function %impl.elem0.loc14_3.2, @Op.95(%Destroy.facet) [template = %specific_impl_fn.loc14_3.2 (constants.%specific_impl_fn.1af)] // CHECK:STDOUT: // CHECK:STDOUT: fn(%x.param: @F.%T.loc4_15.2 (%T.8b3d5d.1)) { // CHECK:STDOUT: !entry: @@ -303,7 +329,7 @@ fn F[template T:! type](x: T) { // CHECK:STDOUT: %v.var: ref @F.%T.loc4_15.2 (%T.8b3d5d.1) = var %v.var_patt // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] // CHECK:STDOUT: %ImplicitAs.type.loc14_3.1: type = facet_type <@ImplicitAs, @ImplicitAs(constants.%T.8b3d5d.1)> [template = %ImplicitAs.type.loc14_3.2 (constants.%ImplicitAs.type.d628ce.2)] -// CHECK:STDOUT: %.loc14_3.1: @F.%.loc14_3.4 (@F.%.loc14_3.4) = splice_inst %.loc14_3.3 +// CHECK:STDOUT: %.loc14_3.1: @F.%.loc14_3.6 (@F.%.loc14_3.6) = splice_inst %.loc14_3.5 // CHECK:STDOUT: %.loc14_3.2: @F.%T.loc4_15.2 (%T.8b3d5d.1) = converted %int_0, [concrete = ] // CHECK:STDOUT: assign %v.var, // CHECK:STDOUT: %T.ref.loc14: type = name_ref T, %T.loc4_15.1 [template = %T.loc4_15.2 (constants.%T.8b3d5d.1)] @@ -314,13 +340,25 @@ fn F[template T:! type](x: T) { // CHECK:STDOUT: } // CHECK:STDOUT: %w.var: ref %i32 = var %w.var_patt // CHECK:STDOUT: %x.ref: @F.%T.loc4_15.2 (%T.8b3d5d.1) = name_ref x, %x -// CHECK:STDOUT: %.loc22_3: %i32 = converted %x.ref, [concrete = ] +// CHECK:STDOUT: %.loc22_3.1: %i32 = converted %x.ref, [concrete = ] // CHECK:STDOUT: assign %w.var, // CHECK:STDOUT: %.loc22_10: type = splice_block %i32 [concrete = constants.%i32] { // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: %w: ref %i32 = bind_name w, %w.var +// CHECK:STDOUT: %impl.elem0.loc22: %.ab7 = impl_witness_access constants.%Destroy.impl_witness.64e, element0 [concrete = constants.%Op.e6a] +// CHECK:STDOUT: %bound_method.loc22_3.1: = bound_method %w.var, %impl.elem0.loc22 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0.loc22, @Op.96(constants.%i32) [concrete = constants.%Op.specific_fn.014] +// CHECK:STDOUT: %bound_method.loc22_3.2: = bound_method %w.var, %specific_fn +// CHECK:STDOUT: %.loc22_3.2: %i32 = bind_value %w.var +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc22_3.2(%.loc22_3.2) +// CHECK:STDOUT: %impl.elem0.loc14_3.1: @F.%.loc14_3.7 (%.a63) = impl_witness_access constants.%Destroy.lookup_impl_witness, element0 [template = %impl.elem0.loc14_3.2 (constants.%impl.elem0.538)] +// CHECK:STDOUT: %bound_method.loc14_3.1: = bound_method %v.var, %impl.elem0.loc14_3.1 +// CHECK:STDOUT: %specific_impl_fn.loc14_3.1: = specific_impl_function %impl.elem0.loc14_3.1, @Op.95(constants.%Destroy.facet.713) [template = %specific_impl_fn.loc14_3.2 (constants.%specific_impl_fn.1af)] +// CHECK:STDOUT: %bound_method.loc14_3.2: = bound_method %v.var, %specific_impl_fn.loc14_3.1 +// CHECK:STDOUT: %.loc14_3.3: @F.%T.loc4_15.2 (%T.8b3d5d.1) = bind_value %v.var +// CHECK:STDOUT: %.loc14_3.4: init %empty_tuple.type = call %bound_method.loc14_3.2(%.loc14_3.3) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/generic/template_dependence.carbon b/toolchain/check/testdata/generic/template_dependence.carbon index 2bd98bf6cb13..28416d7da006 100644 --- a/toolchain/check/testdata/generic/template_dependence.carbon +++ b/toolchain/check/testdata/generic/template_dependence.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/none.carbon +// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/destroy.carbon // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only". // EXTRA-ARGS: --dump-sem-ir-ranges=if-present // @@ -43,10 +43,19 @@ fn F(template T:! type, U:! type) -> (T, U) { // CHECK:STDOUT: %require_complete.132: = require_complete_type %ptr.a13 [template] // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] { // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0, template [concrete] // CHECK:STDOUT: %x.patt: @F.%pattern_type.loc4_25 (%pattern_type.12d) = binding_pattern x [concrete] @@ -112,10 +121,19 @@ fn F(template T:! type, U:! type) -> (T, U) { // CHECK:STDOUT: %F.specific_fn: = specific_function %F, @F(%T, %U) [template] // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] { // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0, template [concrete] // CHECK:STDOUT: %U.patt: %pattern_type.98f = symbolic_binding_pattern U, 1 [concrete] diff --git a/toolchain/check/testdata/if_expr/fail_partial_constant.carbon b/toolchain/check/testdata/if_expr/fail_partial_constant.carbon index 469a34b3302e..87da182c053b 100644 --- a/toolchain/check/testdata/if_expr/fail_partial_constant.carbon +++ b/toolchain/check/testdata/if_expr/fail_partial_constant.carbon @@ -57,17 +57,20 @@ fn ChosenBranchIsNonConstant(t: type) { // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Bool = %Core.Bool // CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Core.Bool: %Bool.type = import_ref Core//prelude/parts/bool, Bool, loaded [concrete = constants.%Bool] // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -121,6 +124,7 @@ fn ChosenBranchIsNonConstant(t: type) { // CHECK:STDOUT: // CHECK:STDOUT: !.loc12_7: // CHECK:STDOUT: %v: = bind_name v, [concrete = ] +// CHECK:STDOUT: %impl.elem0: = impl_witness_access , element0 [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -137,15 +141,18 @@ fn ChosenBranchIsNonConstant(t: type) { // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete] // CHECK:STDOUT: %false: bool = bool_literal false [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -221,6 +228,8 @@ fn ChosenBranchIsNonConstant(t: type) { // CHECK:STDOUT: // CHECK:STDOUT: !.loc14_7: // CHECK:STDOUT: %w: = bind_name w, [concrete = ] +// CHECK:STDOUT: %impl.elem0.loc14: = impl_witness_access , element0 [concrete = ] +// CHECK:STDOUT: %impl.elem0.loc9: = impl_witness_access , element0 [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/if_expr/struct.carbon b/toolchain/check/testdata/if_expr/struct.carbon index 4c7c7fa10eb4..5578983d85a7 100644 --- a/toolchain/check/testdata/if_expr/struct.carbon +++ b/toolchain/check/testdata/if_expr/struct.carbon @@ -59,6 +59,17 @@ fn F(cond: bool) { // CHECK:STDOUT: %bound_method.b92: = bound_method %int_2.ecc, %Convert.specific_fn [concrete] // CHECK:STDOUT: %int_2.ef8: %i32 = int_value 2 [concrete] // CHECK:STDOUT: %struct: %struct_type.a.b.501 = struct_value (%int_1.5d2, %int_2.ef8) [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.2 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.3, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.ad1: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%struct_type.a.b.501) [concrete] +// CHECK:STDOUT: %Op.type.da3: type = fn_type @Op.3, @impl.49c(%struct_type.a.b.501) [concrete] +// CHECK:STDOUT: %Op.9db: %Op.type.da3 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %struct_type.a.b.501, (%Destroy.impl_witness.ad1) [concrete] +// CHECK:STDOUT: %.8e0: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.9db, @Op.3(%struct_type.a.b.501) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -66,6 +77,7 @@ fn F(cond: bool) { // CHECK:STDOUT: .Int = %Core.Int // CHECK:STDOUT: .Bool = %Core.Bool // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -74,6 +86,9 @@ fn F(cond: bool) { // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -140,8 +155,8 @@ fn F(cond: bool) { // CHECK:STDOUT: %.loc18_46.6: ref %i32 = struct_access %a.var, element1 // CHECK:STDOUT: %.loc18_46.7: init %i32 = initialize_from %.loc18_46.5 to %.loc18_46.6 [concrete = constants.%int_2.ef8] // CHECK:STDOUT: %.loc18_46.8: init %struct_type.a.b.501 = struct_init (%.loc18_46.4, %.loc18_46.7) to %a.var [concrete = constants.%struct] -// CHECK:STDOUT: %.loc18_3: init %struct_type.a.b.501 = converted %.loc18_46.1, %.loc18_46.8 [concrete = constants.%struct] -// CHECK:STDOUT: assign %a.var, %.loc18_3 +// CHECK:STDOUT: %.loc18_3.1: init %struct_type.a.b.501 = converted %.loc18_46.1, %.loc18_46.8 [concrete = constants.%struct] +// CHECK:STDOUT: assign %a.var, %.loc18_3.1 // CHECK:STDOUT: %.loc18_27: type = splice_block %struct_type.a.b [concrete = constants.%struct_type.a.b.501] { // CHECK:STDOUT: %int_32.loc18_15: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32.loc18_15: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] @@ -177,6 +192,17 @@ fn F(cond: bool) { // CHECK:STDOUT: !if.expr.result: // CHECK:STDOUT: %.loc19_5: %struct_type.a.b.501 = block_arg !if.expr.result // CHECK:STDOUT: %G.call: init %empty_tuple.type = call %G.ref(%.loc19_5) +// CHECK:STDOUT: %impl.elem0.loc18_3: %.8e0 = impl_witness_access constants.%Destroy.impl_witness.ad1, element0 [concrete = constants.%Op.9db] +// CHECK:STDOUT: %bound_method.loc18_3.1: = bound_method %a.var, %impl.elem0.loc18_3 +// CHECK:STDOUT: %specific_fn.loc18_3: = specific_function %impl.elem0.loc18_3, @Op.3(constants.%struct_type.a.b.501) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc18_3.2: = bound_method %a.var, %specific_fn.loc18_3 +// CHECK:STDOUT: %.loc18_3.2: ref %i32 = struct_access %a.var, element0 +// CHECK:STDOUT: %.loc18_3.3: %i32 = bind_value %.loc18_3.2 +// CHECK:STDOUT: %.loc18_3.4: ref %i32 = struct_access %a.var, element1 +// CHECK:STDOUT: %.loc18_3.5: %i32 = bind_value %.loc18_3.4 +// CHECK:STDOUT: %struct.loc18: %struct_type.a.b.501 = struct_value (%.loc18_3.3, %.loc18_3.5) +// CHECK:STDOUT: %.loc18_3.6: %struct_type.a.b.501 = converted %a.var, %struct.loc18 +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc18_3.2(%.loc18_3.6) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/extend_impl_generic.carbon b/toolchain/check/testdata/impl/extend_impl_generic.carbon index 5103b549b4ac..b915dc563f3e 100644 --- a/toolchain/check/testdata/impl/extend_impl_generic.carbon +++ b/toolchain/check/testdata/impl/extend_impl_generic.carbon @@ -57,6 +57,7 @@ class X(U:! type) { // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete] // CHECK:STDOUT: %HasF.type.fe3: type = generic_interface_type @HasF [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %HasF.generic: %HasF.type.fe3 = struct_value () [concrete] // CHECK:STDOUT: %HasF.type.901: type = facet_type <@HasF, @HasF(%T)> [symbolic] // CHECK:STDOUT: %Self.322: %HasF.type.901 = bind_symbolic_name Self, 1 [symbolic] @@ -111,12 +112,29 @@ class X(U:! type) { // CHECK:STDOUT: %G.type: type = fn_type @G [concrete] // CHECK:STDOUT: %G: %G.type = struct_value () [concrete] // CHECK:STDOUT: %.22c: type = fn_type_with_self_type %F.type.7f1, %HasF.facet [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.2 [concrete] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.3, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.9ca: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%Param) [concrete] +// CHECK:STDOUT: %Op.type.70d: type = fn_type @Op.3, @impl.49c(%Param) [concrete] +// CHECK:STDOUT: %Op.e46: %Op.type.70d = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.6a7: %Destroy.type = facet_value %Param, (%Destroy.impl_witness.9ca) [concrete] +// CHECK:STDOUT: %.92a: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.6a7 [concrete] +// CHECK:STDOUT: %Op.specific_fn.022: = specific_function %Op.e46, @Op.3(%Param) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.64e: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.type.a17: type = fn_type @Op.3, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.e6a: %Op.type.a17 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.5f7: %Destroy.type = facet_value %i32, (%Destroy.impl_witness.64e) [concrete] +// CHECK:STDOUT: %.ab7: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.5f7 [concrete] +// CHECK:STDOUT: %Op.specific_fn.014: = specific_function %Op.e6a, @Op.3(%i32) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Int = %Core.Int // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -124,6 +142,9 @@ class X(U:! type) { // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -266,9 +287,9 @@ class X(U:! type) { // CHECK:STDOUT: %C.ref.loc21: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %.loc21_17: %HasF.assoc_type.257 = specific_constant @HasF.%assoc0.loc5_14.1, @HasF(constants.%Param) [concrete = constants.%assoc0.afb] // CHECK:STDOUT: %F.ref.loc21: %HasF.assoc_type.257 = name_ref F, %.loc21_17 [concrete = constants.%assoc0.afb] -// CHECK:STDOUT: %impl.elem0.loc21: %.22c = impl_witness_access constants.%HasF.impl_witness, element0 [concrete = constants.%F.901] +// CHECK:STDOUT: %impl.elem0.loc21_17: %.22c = impl_witness_access constants.%HasF.impl_witness, element0 [concrete = constants.%F.901] // CHECK:STDOUT: %.loc21_20.1: ref %Param = temporary_storage -// CHECK:STDOUT: %F.call.loc21: init %Param = call %impl.elem0.loc21() to %.loc21_20.1 +// CHECK:STDOUT: %F.call.loc21: init %Param = call %impl.elem0.loc21_17() to %.loc21_20.1 // CHECK:STDOUT: %.loc21_20.2: ref %Param = temporary %.loc21_20.1, %F.call.loc21 // CHECK:STDOUT: %x.ref.loc21: %Param.elem = name_ref x, @Param.%.loc9 [concrete = @Param.%.loc9] // CHECK:STDOUT: %.loc21_21.1: ref %i32 = class_element_access %.loc21_20.2, element0 @@ -286,9 +307,9 @@ class X(U:! type) { // CHECK:STDOUT: %c.ref: %C = name_ref c, %c // CHECK:STDOUT: %.loc22_17: %HasF.assoc_type.257 = specific_constant @HasF.%assoc0.loc5_14.1, @HasF(constants.%Param) [concrete = constants.%assoc0.afb] // CHECK:STDOUT: %F.ref.loc22: %HasF.assoc_type.257 = name_ref F, %.loc22_17 [concrete = constants.%assoc0.afb] -// CHECK:STDOUT: %impl.elem0.loc22: %.22c = impl_witness_access constants.%HasF.impl_witness, element0 [concrete = constants.%F.901] +// CHECK:STDOUT: %impl.elem0.loc22_17: %.22c = impl_witness_access constants.%HasF.impl_witness, element0 [concrete = constants.%F.901] // CHECK:STDOUT: %.loc22_20.1: ref %Param = temporary_storage -// CHECK:STDOUT: %F.call.loc22: init %Param = call %impl.elem0.loc22() to %.loc22_20.1 +// CHECK:STDOUT: %F.call.loc22: init %Param = call %impl.elem0.loc22_17() to %.loc22_20.1 // CHECK:STDOUT: %.loc22_20.2: ref %Param = temporary %.loc22_20.1, %F.call.loc22 // CHECK:STDOUT: %x.ref.loc22: %Param.elem = name_ref x, @Param.%.loc9 [concrete = @Param.%.loc9] // CHECK:STDOUT: %.loc22_21.1: ref %i32 = class_element_access %.loc22_20.2, element0 @@ -299,6 +320,24 @@ class X(U:! type) { // CHECK:STDOUT: %i32.loc22: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: %b: ref %i32 = bind_name b, %b.var +// CHECK:STDOUT: %impl.elem0.loc22_20: %.92a = impl_witness_access constants.%Destroy.impl_witness.9ca, element0 [concrete = constants.%Op.e46] +// CHECK:STDOUT: %bound_method.loc22_20.1: = bound_method %.loc22_20.1, %impl.elem0.loc22_20 +// CHECK:STDOUT: %specific_fn.loc22_20: = specific_function %impl.elem0.loc22_20, @Op.3(constants.%Param) [concrete = constants.%Op.specific_fn.022] +// CHECK:STDOUT: %bound_method.loc22_20.2: = bound_method %.loc22_20.1, %specific_fn.loc22_20 +// CHECK:STDOUT: %.loc22_20.3: %Param = bind_value %.loc22_20.1 +// CHECK:STDOUT: %no_op.loc22_20: init %empty_tuple.type = call %bound_method.loc22_20.2(%.loc22_20.3) +// CHECK:STDOUT: %impl.elem0.loc22_3: %.ab7 = impl_witness_access constants.%Destroy.impl_witness.64e, element0 [concrete = constants.%Op.e6a] +// CHECK:STDOUT: %bound_method.loc22_3.1: = bound_method %b.var, %impl.elem0.loc22_3 +// CHECK:STDOUT: %specific_fn.loc22_3: = specific_function %impl.elem0.loc22_3, @Op.3(constants.%i32) [concrete = constants.%Op.specific_fn.014] +// CHECK:STDOUT: %bound_method.loc22_3.2: = bound_method %b.var, %specific_fn.loc22_3 +// CHECK:STDOUT: %.loc22_3: %i32 = bind_value %b.var +// CHECK:STDOUT: %no_op.loc22_3: init %empty_tuple.type = call %bound_method.loc22_3.2(%.loc22_3) +// CHECK:STDOUT: %impl.elem0.loc21_20: %.92a = impl_witness_access constants.%Destroy.impl_witness.9ca, element0 [concrete = constants.%Op.e46] +// CHECK:STDOUT: %bound_method.loc21_20.1: = bound_method %.loc21_20.1, %impl.elem0.loc21_20 +// CHECK:STDOUT: %specific_fn.loc21: = specific_function %impl.elem0.loc21_20, @Op.3(constants.%Param) [concrete = constants.%Op.specific_fn.022] +// CHECK:STDOUT: %bound_method.loc21_20.2: = bound_method %.loc21_20.1, %specific_fn.loc21 +// CHECK:STDOUT: %.loc21_20.3: %Param = bind_value %.loc21_20.1 +// CHECK:STDOUT: %no_op.loc21: init %empty_tuple.type = call %bound_method.loc21_20.2(%.loc21_20.3) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/fail_extend_impl_scope.carbon b/toolchain/check/testdata/impl/fail_extend_impl_scope.carbon index 5eb02da78c9f..c7d5fa3b95de 100644 --- a/toolchain/check/testdata/impl/fail_extend_impl_scope.carbon +++ b/toolchain/check/testdata/impl/fail_extend_impl_scope.carbon @@ -76,6 +76,7 @@ fn F() { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -122,6 +123,7 @@ fn F() { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -165,13 +167,13 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete] -// CHECK:STDOUT: %Self: %Z.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self.6e6: %Z.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %Zero.type.822: type = fn_type @Zero.1 [concrete] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Zero.d14: %Zero.type.822 = struct_value () [concrete] // CHECK:STDOUT: %Z.assoc_type: type = assoc_entity_type @Z [concrete] -// CHECK:STDOUT: %assoc0: %Z.assoc_type = assoc_entity element0, @Z.%Zero.decl [concrete] -// CHECK:STDOUT: %Zero.type.db4: type = fn_type @Zero.2, @impl.6b5(%Self) [symbolic] +// CHECK:STDOUT: %assoc0.534: %Z.assoc_type = assoc_entity element0, @Z.%Zero.decl [concrete] +// CHECK:STDOUT: %Zero.type.db4: type = fn_type @Zero.2, @impl.6b5(%Self.6e6) [symbolic] // CHECK:STDOUT: %Zero.8fb: %Zero.type.db4 = struct_value () [symbolic] // CHECK:STDOUT: %Point: type = class_type @Point [concrete] // CHECK:STDOUT: %Z.impl_witness: = impl_witness @Point.%Z.impl_witness_table [concrete] @@ -184,12 +186,28 @@ fn F() { // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] // CHECK:STDOUT: %Point.val: %Point = struct_value () [concrete] // CHECK:STDOUT: %.766: type = fn_type_with_self_type %Zero.type.822, %Z.facet [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.ea4: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%Point) [concrete] +// CHECK:STDOUT: %Op.type.003: type = fn_type @Op.2, @impl.49c(%Point) [concrete] +// CHECK:STDOUT: %Op.d2d: %Op.type.003 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %Point, (%Destroy.impl_witness.ea4) [concrete] +// CHECK:STDOUT: %.038: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.d2d, @Op.2(%Point) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -206,9 +224,9 @@ fn F() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Z { -// CHECK:STDOUT: %Self: %Z.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] +// CHECK:STDOUT: %Self: %Z.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.6e6] // CHECK:STDOUT: %Zero.decl: %Zero.type.822 = fn_decl @Zero.1 [concrete = constants.%Zero.d14] {} {} -// CHECK:STDOUT: %assoc0: %Z.assoc_type = assoc_entity element0, %Zero.decl [concrete = constants.%assoc0] +// CHECK:STDOUT: %assoc0: %Z.assoc_type = assoc_entity element0, %Zero.decl [concrete = constants.%assoc0.534] // CHECK:STDOUT: impl_decl @impl.6b5 [concrete] {} { // CHECK:STDOUT: %Self.ref: type = name_ref Self, [concrete = ] // CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type] @@ -223,7 +241,7 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: generic impl @impl.6b5(@Z.%Self: %Z.type) { // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Self: %Z.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self: %Z.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.6e6)] // CHECK:STDOUT: %Zero.type: type = fn_type @Zero.2, @impl.6b5(%Self) [symbolic = %Zero.type (constants.%Zero.type.db4)] // CHECK:STDOUT: %Zero: @impl.6b5.%Zero.type (%Zero.type.db4) = struct_value () [symbolic = %Zero (constants.%Zero.8fb)] // CHECK:STDOUT: @@ -288,22 +306,28 @@ fn F() { // CHECK:STDOUT: %.loc25_5.3: init %Point = class_init (), %.loc25_5.2 [concrete = constants.%Point.val] // CHECK:STDOUT: %.loc25_5.4: ref %Point = temporary %.loc25_5.2, %.loc25_5.3 // CHECK:STDOUT: %.loc25_7: ref %Point = converted %.loc25_5.1, %.loc25_5.4 -// CHECK:STDOUT: %Zero.ref: %Z.assoc_type = name_ref Zero, @Z.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0: %.766 = impl_witness_access constants.%Z.impl_witness, element0 [concrete = constants.%Zero.dec] -// CHECK:STDOUT: %Zero.call: init %empty_tuple.type = call %impl.elem0() +// CHECK:STDOUT: %Zero.ref: %Z.assoc_type = name_ref Zero, @Z.%assoc0 [concrete = constants.%assoc0.534] +// CHECK:STDOUT: %impl.elem0.loc25_16: %.766 = impl_witness_access constants.%Z.impl_witness, element0 [concrete = constants.%Zero.dec] +// CHECK:STDOUT: %Zero.call: init %empty_tuple.type = call %impl.elem0.loc25_16() +// CHECK:STDOUT: %impl.elem0.loc25_5: %.038 = impl_witness_access constants.%Destroy.impl_witness.ea4, element0 [concrete = constants.%Op.d2d] +// CHECK:STDOUT: %bound_method.loc25_5.1: = bound_method %.loc25_5.2, %impl.elem0.loc25_5 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0.loc25_5, @Op.2(constants.%Point) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc25_5.2: = bound_method %.loc25_5.2, %specific_fn +// CHECK:STDOUT: %.loc25_5.5: %Point = bind_value %.loc25_5.2 +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc25_5.2(%.loc25_5.5) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Zero.1(constants.%Self) {} +// CHECK:STDOUT: specific @Zero.1(constants.%Self.6e6) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @impl.6b5(constants.%Self) { +// CHECK:STDOUT: specific @impl.6b5(constants.%Self.6e6) { // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self => constants.%Self.6e6 // CHECK:STDOUT: %Zero.type => constants.%Zero.type.db4 // CHECK:STDOUT: %Zero => constants.%Zero.8fb // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Zero.2(constants.%Self) {} +// CHECK:STDOUT: specific @Zero.2(constants.%Self.6e6) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @Zero.1(constants.%Z.facet) {} // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/fail_impl_as_scope.carbon b/toolchain/check/testdata/impl/fail_impl_as_scope.carbon index 6b573f34aa76..d47b7b40d921 100644 --- a/toolchain/check/testdata/impl/fail_impl_as_scope.carbon +++ b/toolchain/check/testdata/impl/fail_impl_as_scope.carbon @@ -114,6 +114,7 @@ class X { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -174,6 +175,7 @@ class X { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -223,22 +225,22 @@ class X { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete] -// CHECK:STDOUT: %Self: %Z.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self.6e6: %Z.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %Zero.type.822: type = fn_type @Zero.1 [concrete] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Zero.d14: %Zero.type.822 = struct_value () [concrete] // CHECK:STDOUT: %Z.assoc_type: type = assoc_entity_type @Z [concrete] -// CHECK:STDOUT: %assoc0: %Z.assoc_type = assoc_entity element0, @Z.%Zero.decl [concrete] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] -// CHECK:STDOUT: %pattern_type.a40: type = pattern_type %Self.as_type [symbolic] +// CHECK:STDOUT: %assoc0.534: %Z.assoc_type = assoc_entity element0, @Z.%Zero.decl [concrete] +// CHECK:STDOUT: %Self.as_type.cd1: type = facet_access_type %Self.6e6 [symbolic] +// CHECK:STDOUT: %pattern_type.a40: type = pattern_type %Self.as_type.cd1 [symbolic] // CHECK:STDOUT: %Method.type.f12: type = fn_type @Method.1 [concrete] // CHECK:STDOUT: %Method.724: %Method.type.f12 = struct_value () [concrete] // CHECK:STDOUT: %assoc1: %Z.assoc_type = assoc_entity element1, @Z.%Method.decl [concrete] -// CHECK:STDOUT: %Zero.type.db4: type = fn_type @Zero.2, @impl.6b5(%Self) [symbolic] +// CHECK:STDOUT: %Zero.type.db4: type = fn_type @Zero.2, @impl.6b5(%Self.6e6) [symbolic] // CHECK:STDOUT: %Zero.8fb: %Zero.type.db4 = struct_value () [symbolic] -// CHECK:STDOUT: %Method.type.163: type = fn_type @Method.2, @impl.6b5(%Self) [symbolic] +// CHECK:STDOUT: %Method.type.163: type = fn_type @Method.2, @impl.6b5(%Self.6e6) [symbolic] // CHECK:STDOUT: %Method.84d: %Method.type.163 = struct_value () [symbolic] -// CHECK:STDOUT: %require_complete: = require_complete_type %Self.as_type [symbolic] +// CHECK:STDOUT: %require_complete.dbd: = require_complete_type %Self.as_type.cd1 [symbolic] // CHECK:STDOUT: %Point: type = class_type @Point [concrete] // CHECK:STDOUT: %Z.impl_witness: = impl_witness @Point.%Z.impl_witness_table [concrete] // CHECK:STDOUT: %Zero.type.e33: type = fn_type @Zero.3 [concrete] @@ -254,12 +256,28 @@ class X { // CHECK:STDOUT: %.d52: type = fn_type_with_self_type %Zero.type.822, %Z.facet [concrete] // CHECK:STDOUT: %Point.val: %Point = struct_value () [concrete] // CHECK:STDOUT: %.462: type = fn_type_with_self_type %Method.type.f12, %Z.facet [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.ea4: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%Point) [concrete] +// CHECK:STDOUT: %Op.type.003: type = fn_type @Op.2, @impl.49c(%Point) [concrete] +// CHECK:STDOUT: %Op.d2d: %Op.type.003 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %Point, (%Destroy.impl_witness.ea4) [concrete] +// CHECK:STDOUT: %.038: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.d2d, @Op.2(%Point) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -276,20 +294,20 @@ class X { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Z { -// CHECK:STDOUT: %Self: %Z.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] +// CHECK:STDOUT: %Self: %Z.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.6e6] // CHECK:STDOUT: %Zero.decl: %Zero.type.822 = fn_decl @Zero.1 [concrete = constants.%Zero.d14] {} {} -// CHECK:STDOUT: %assoc0: %Z.assoc_type = assoc_entity element0, %Zero.decl [concrete = constants.%assoc0] +// CHECK:STDOUT: %assoc0: %Z.assoc_type = assoc_entity element0, %Zero.decl [concrete = constants.%assoc0.534] // CHECK:STDOUT: %Method.decl: %Method.type.f12 = fn_decl @Method.1 [concrete = constants.%Method.724] { // CHECK:STDOUT: %self.patt: @Method.1.%pattern_type (%pattern_type.a40) = binding_pattern self [concrete] // CHECK:STDOUT: %self.param_patt: @Method.1.%pattern_type (%pattern_type.a40) = value_param_pattern %self.patt, call_param0 [concrete] // CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: @Method.1.%Self.as_type.loc5_19.1 (%Self.as_type) = value_param call_param0 -// CHECK:STDOUT: %.loc5_19.1: type = splice_block %.loc5_19.2 [symbolic = %Self.as_type.loc5_19.1 (constants.%Self.as_type)] { -// CHECK:STDOUT: %Self.ref: %Z.type = name_ref Self, @Z.%Self [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc5_19.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc5_19.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %.loc5_19.2: type = converted %Self.ref, %Self.as_type.loc5_19.2 [symbolic = %Self.as_type.loc5_19.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %self.param: @Method.1.%Self.as_type.loc5_19.1 (%Self.as_type.cd1) = value_param call_param0 +// CHECK:STDOUT: %.loc5_19.1: type = splice_block %.loc5_19.2 [symbolic = %Self.as_type.loc5_19.1 (constants.%Self.as_type.cd1)] { +// CHECK:STDOUT: %Self.ref: %Z.type = name_ref Self, @Z.%Self [symbolic = %Self (constants.%Self.6e6)] +// CHECK:STDOUT: %Self.as_type.loc5_19.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc5_19.1 (constants.%Self.as_type.cd1)] +// CHECK:STDOUT: %.loc5_19.2: type = converted %Self.ref, %Self.as_type.loc5_19.2 [symbolic = %Self.as_type.loc5_19.1 (constants.%Self.as_type.cd1)] // CHECK:STDOUT: } -// CHECK:STDOUT: %self: @Method.1.%Self.as_type.loc5_19.1 (%Self.as_type) = bind_name self, %self.param +// CHECK:STDOUT: %self: @Method.1.%Self.as_type.loc5_19.1 (%Self.as_type.cd1) = bind_name self, %self.param // CHECK:STDOUT: } // CHECK:STDOUT: %assoc1: %Z.assoc_type = assoc_entity element1, %Method.decl [concrete = constants.%assoc1] // CHECK:STDOUT: impl_decl @impl.6b5 [concrete] {} { @@ -307,7 +325,7 @@ class X { // CHECK:STDOUT: // CHECK:STDOUT: generic impl @impl.6b5(@Z.%Self: %Z.type) { // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Self: %Z.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self: %Z.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.6e6)] // CHECK:STDOUT: %Zero.type: type = fn_type @Zero.2, @impl.6b5(%Self) [symbolic = %Zero.type (constants.%Zero.type.db4)] // CHECK:STDOUT: %Zero: @impl.6b5.%Zero.type (%Zero.type.db4) = struct_value () [symbolic = %Zero (constants.%Zero.8fb)] // CHECK:STDOUT: %Method.type: type = fn_type @Method.2, @impl.6b5(%Self) [symbolic = %Method.type (constants.%Method.type.163)] @@ -319,13 +337,13 @@ class X { // CHECK:STDOUT: %self.patt: @Method.2.%pattern_type (%pattern_type.a40) = binding_pattern self [concrete] // CHECK:STDOUT: %self.param_patt: @Method.2.%pattern_type (%pattern_type.a40) = value_param_pattern %self.patt, call_param0 [concrete] // CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: @Method.2.%Self.as_type.loc13_21.1 (%Self.as_type) = value_param call_param0 -// CHECK:STDOUT: %.loc13_21.1: type = splice_block %.loc13_21.2 [symbolic = %Self.as_type.loc13_21.1 (constants.%Self.as_type)] { -// CHECK:STDOUT: %Self.ref: %Z.type = name_ref Self, @Z.%Self [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc13_21.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc13_21.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %.loc13_21.2: type = converted %Self.ref, %Self.as_type.loc13_21.2 [symbolic = %Self.as_type.loc13_21.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %self.param: @Method.2.%Self.as_type.loc13_21.1 (%Self.as_type.cd1) = value_param call_param0 +// CHECK:STDOUT: %.loc13_21.1: type = splice_block %.loc13_21.2 [symbolic = %Self.as_type.loc13_21.1 (constants.%Self.as_type.cd1)] { +// CHECK:STDOUT: %Self.ref: %Z.type = name_ref Self, @Z.%Self [symbolic = %Self (constants.%Self.6e6)] +// CHECK:STDOUT: %Self.as_type.loc13_21.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc13_21.1 (constants.%Self.as_type.cd1)] +// CHECK:STDOUT: %.loc13_21.2: type = converted %Self.ref, %Self.as_type.loc13_21.2 [symbolic = %Self.as_type.loc13_21.1 (constants.%Self.as_type.cd1)] // CHECK:STDOUT: } -// CHECK:STDOUT: %self: @Method.2.%Self.as_type.loc13_21.1 (%Self.as_type) = bind_name self, %self.param +// CHECK:STDOUT: %self: @Method.2.%Self.as_type.loc13_21.1 (%Self.as_type.cd1) = bind_name self, %self.param // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -373,11 +391,11 @@ class X { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @Method.1(@Z.%Self: %Z.type) { -// CHECK:STDOUT: %Self: %Z.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc5_19.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc5_19.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %Self: %Z.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.6e6)] +// CHECK:STDOUT: %Self.as_type.loc5_19.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc5_19.1 (constants.%Self.as_type.cd1)] // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type.loc5_19.1 [symbolic = %pattern_type (constants.%pattern_type.a40)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%self.param: @Method.1.%Self.as_type.loc5_19.1 (%Self.as_type)); +// CHECK:STDOUT: fn(%self.param: @Method.1.%Self.as_type.loc5_19.1 (%Self.as_type.cd1)); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @Zero.2(@Z.%Self: %Z.type) { @@ -390,14 +408,14 @@ class X { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @Method.2(@Z.%Self: %Z.type) { -// CHECK:STDOUT: %Self: %Z.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc13_21.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc13_21.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %Self: %Z.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.6e6)] +// CHECK:STDOUT: %Self.as_type.loc13_21.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc13_21.1 (constants.%Self.as_type.cd1)] // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type.loc13_21.1 [symbolic = %pattern_type (constants.%pattern_type.a40)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type %Self.as_type.loc13_21.1 [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %require_complete: = require_complete_type %Self.as_type.loc13_21.1 [symbolic = %require_complete (constants.%require_complete.dbd)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%self.param: @Method.2.%Self.as_type.loc13_21.1 (%Self.as_type)) { +// CHECK:STDOUT: fn(%self.param: @Method.2.%Self.as_type.loc13_21.1 (%Self.as_type.cd1)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -417,11 +435,11 @@ class X { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Point.ref.loc28: type = name_ref Point, file.%Point.decl [concrete = constants.%Point] // CHECK:STDOUT: %Z.ref.loc28: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type] -// CHECK:STDOUT: %Zero.ref: %Z.assoc_type = name_ref Zero, @Z.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %Zero.ref: %Z.assoc_type = name_ref Zero, @Z.%assoc0 [concrete = constants.%assoc0.534] // CHECK:STDOUT: %Z.facet: %Z.type = facet_value constants.%Point, (constants.%Z.impl_witness) [concrete = constants.%Z.facet] // CHECK:STDOUT: %.loc28: %Z.type = converted %Point.ref.loc28, %Z.facet [concrete = constants.%Z.facet] -// CHECK:STDOUT: %impl.elem0: %.d52 = impl_witness_access constants.%Z.impl_witness, element0 [concrete = constants.%Zero.dec] -// CHECK:STDOUT: %Zero.call: init %empty_tuple.type = call %impl.elem0() +// CHECK:STDOUT: %impl.elem0.loc28: %.d52 = impl_witness_access constants.%Z.impl_witness, element0 [concrete = constants.%Zero.dec] +// CHECK:STDOUT: %Zero.call: init %empty_tuple.type = call %impl.elem0.loc28() // CHECK:STDOUT: %.loc29_5.1: %empty_struct_type = struct_literal () // CHECK:STDOUT: %Point.ref.loc29: type = name_ref Point, file.%Point.decl [concrete = constants.%Point] // CHECK:STDOUT: %.loc29_5.2: ref %Point = temporary_storage @@ -431,34 +449,40 @@ class X { // CHECK:STDOUT: %Z.ref.loc29: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type] // CHECK:STDOUT: %Method.ref: %Z.assoc_type = name_ref Method, @Z.%assoc1 [concrete = constants.%assoc1] // CHECK:STDOUT: %impl.elem1: %.462 = impl_witness_access constants.%Z.impl_witness, element1 [concrete = constants.%Method.2c2] -// CHECK:STDOUT: %bound_method: = bound_method %.loc29_7.1, %impl.elem1 +// CHECK:STDOUT: %bound_method.loc29_16: = bound_method %.loc29_7.1, %impl.elem1 // CHECK:STDOUT: %.loc29_7.2: %Point = bind_value %.loc29_7.1 -// CHECK:STDOUT: %Method.call: init %empty_tuple.type = call %bound_method(%.loc29_7.2) +// CHECK:STDOUT: %Method.call: init %empty_tuple.type = call %bound_method.loc29_16(%.loc29_7.2) +// CHECK:STDOUT: %impl.elem0.loc29: %.038 = impl_witness_access constants.%Destroy.impl_witness.ea4, element0 [concrete = constants.%Op.d2d] +// CHECK:STDOUT: %bound_method.loc29_5.1: = bound_method %.loc29_5.2, %impl.elem0.loc29 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0.loc29, @Op.2(constants.%Point) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc29_5.2: = bound_method %.loc29_5.2, %specific_fn +// CHECK:STDOUT: %.loc29_5.5: %Point = bind_value %.loc29_5.2 +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc29_5.2(%.loc29_5.5) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Zero.1(constants.%Self) {} +// CHECK:STDOUT: specific @Zero.1(constants.%Self.6e6) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @Method.1(constants.%Self) { -// CHECK:STDOUT: %Self => constants.%Self -// CHECK:STDOUT: %Self.as_type.loc5_19.1 => constants.%Self.as_type +// CHECK:STDOUT: specific @Method.1(constants.%Self.6e6) { +// CHECK:STDOUT: %Self => constants.%Self.6e6 +// CHECK:STDOUT: %Self.as_type.loc5_19.1 => constants.%Self.as_type.cd1 // CHECK:STDOUT: %pattern_type => constants.%pattern_type.a40 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @impl.6b5(constants.%Self) { +// CHECK:STDOUT: specific @impl.6b5(constants.%Self.6e6) { // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self => constants.%Self.6e6 // CHECK:STDOUT: %Zero.type => constants.%Zero.type.db4 // CHECK:STDOUT: %Zero => constants.%Zero.8fb // CHECK:STDOUT: %Method.type => constants.%Method.type.163 // CHECK:STDOUT: %Method => constants.%Method.84d // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Zero.2(constants.%Self) {} +// CHECK:STDOUT: specific @Zero.2(constants.%Self.6e6) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @Method.2(constants.%Self) { -// CHECK:STDOUT: %Self => constants.%Self -// CHECK:STDOUT: %Self.as_type.loc13_21.1 => constants.%Self.as_type +// CHECK:STDOUT: specific @Method.2(constants.%Self.6e6) { +// CHECK:STDOUT: %Self => constants.%Self.6e6 +// CHECK:STDOUT: %Self.as_type.loc13_21.1 => constants.%Self.as_type.cd1 // CHECK:STDOUT: %pattern_type => constants.%pattern_type.a40 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -496,6 +520,7 @@ class X { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/generic_redeclaration.carbon b/toolchain/check/testdata/impl/generic_redeclaration.carbon index 5cc98801b4af..5dc5e5e89dbf 100644 --- a/toolchain/check/testdata/impl/generic_redeclaration.carbon +++ b/toolchain/check/testdata/impl/generic_redeclaration.carbon @@ -152,6 +152,7 @@ impl forall [T:! type] T as I { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -392,6 +393,7 @@ impl forall [T:! type] T as I { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -496,6 +498,7 @@ impl forall [T:! type] T as I { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -573,6 +576,7 @@ impl forall [T:! type] T as I { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/impl_as.carbon b/toolchain/check/testdata/impl/impl_as.carbon index 84ca26ed62f4..b840c0c731a5 100644 --- a/toolchain/check/testdata/impl/impl_as.carbon +++ b/toolchain/check/testdata/impl/impl_as.carbon @@ -29,11 +29,12 @@ class C { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Simple.type: type = facet_type <@Simple> [concrete] -// CHECK:STDOUT: %Self: %Simple.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self.3c9: %Simple.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %F.type.e2e: type = fn_type @F.1 [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %F.df8: %F.type.e2e = struct_value () [concrete] // CHECK:STDOUT: %Simple.assoc_type: type = assoc_entity_type @Simple [concrete] -// CHECK:STDOUT: %assoc0: %Simple.assoc_type = assoc_entity element0, @Simple.%F.decl [concrete] +// CHECK:STDOUT: %assoc0.d57: %Simple.assoc_type = assoc_entity element0, @Simple.%F.decl [concrete] // CHECK:STDOUT: %C: type = class_type @C [concrete] // CHECK:STDOUT: %Simple.impl_witness: = impl_witness @C.%Simple.impl_witness_table [concrete] // CHECK:STDOUT: %F.type.e4b: type = fn_type @F.2 [concrete] @@ -41,14 +42,30 @@ class C { // CHECK:STDOUT: %Simple.facet: %Simple.type = facet_value %C, (%Simple.impl_witness) [concrete] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] -// CHECK:STDOUT: %pattern_type: type = pattern_type %C [concrete] +// CHECK:STDOUT: %pattern_type.c48: type = pattern_type %C [concrete] // CHECK:STDOUT: %C.val: %C = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.906: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%C) [concrete] +// CHECK:STDOUT: %Op.type.153: type = fn_type @Op.2, @impl.49c(%C) [concrete] +// CHECK:STDOUT: %Op.5d7: %Op.type.153 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %C, (%Destroy.impl_witness.906) [concrete] +// CHECK:STDOUT: %.b80: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.5d7, @Op.2(%C) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -63,9 +80,9 @@ class C { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Simple { -// CHECK:STDOUT: %Self: %Simple.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] +// CHECK:STDOUT: %Self: %Simple.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.3c9] // CHECK:STDOUT: %F.decl: %F.type.e2e = fn_decl @F.1 [concrete = constants.%F.df8] {} {} -// CHECK:STDOUT: %assoc0: %Simple.assoc_type = assoc_entity element0, %F.decl [concrete = constants.%assoc0] +// CHECK:STDOUT: %assoc0: %Simple.assoc_type = assoc_entity element0, %F.decl [concrete = constants.%assoc0.d57] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self @@ -73,7 +90,7 @@ class C { // CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl: %Self.ref as %Simple.ref { +// CHECK:STDOUT: impl @impl.0ef: %Self.ref as %Simple.ref { // CHECK:STDOUT: %F.decl: %F.type.e4b = fn_decl @F.2 [concrete = constants.%F.c94] {} {} // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -83,11 +100,11 @@ class C { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: impl_decl @impl [concrete] {} { +// CHECK:STDOUT: impl_decl @impl.0ef [concrete] {} { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [concrete = constants.%C] // CHECK:STDOUT: %Simple.ref: type = name_ref Simple, file.%Simple.decl [concrete = constants.%Simple.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %Simple.impl_witness_table = impl_witness_table (@impl.%F.decl), @impl [concrete] +// CHECK:STDOUT: %Simple.impl_witness_table = impl_witness_table (@impl.0ef.%F.decl), @impl.0ef [concrete] // CHECK:STDOUT: %Simple.impl_witness: = impl_witness %Simple.impl_witness_table [concrete = constants.%Simple.impl_witness] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete = constants.%complete_type] @@ -106,20 +123,26 @@ class C { // CHECK:STDOUT: fn @F.2() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %c.patt: %pattern_type = binding_pattern c [concrete] -// CHECK:STDOUT: %c.var_patt: %pattern_type = var_pattern %c.patt [concrete] +// CHECK:STDOUT: %c.patt: %pattern_type.c48 = binding_pattern c [concrete] +// CHECK:STDOUT: %c.var_patt: %pattern_type.c48 = var_pattern %c.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %c.var: ref %C = var %c.var_patt // CHECK:STDOUT: %.loc23_19.1: %empty_struct_type = struct_literal () // CHECK:STDOUT: %.loc23_19.2: init %C = class_init (), %c.var [concrete = constants.%C.val] -// CHECK:STDOUT: %.loc23_7: init %C = converted %.loc23_19.1, %.loc23_19.2 [concrete = constants.%C.val] -// CHECK:STDOUT: assign %c.var, %.loc23_7 +// CHECK:STDOUT: %.loc23_7.1: init %C = converted %.loc23_19.1, %.loc23_19.2 [concrete = constants.%C.val] +// CHECK:STDOUT: assign %c.var, %.loc23_7.1 // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var +// CHECK:STDOUT: %impl.elem0: %.b80 = impl_witness_access constants.%Destroy.impl_witness.906, element0 [concrete = constants.%Op.5d7] +// CHECK:STDOUT: %bound_method.loc23_7.1: = bound_method %c.var, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%C) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc23_7.2: = bound_method %c.var, %specific_fn +// CHECK:STDOUT: %.loc23_7.2: %C = bind_value %c.var +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc23_7.2(%.loc23_7.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%Self) {} +// CHECK:STDOUT: specific @F.1(constants.%Self.3c9) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @F.1(constants.%Simple.facet) {} // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/import_self.carbon b/toolchain/check/testdata/impl/import_self.carbon index b3698200ae02..d3e12b78d3e3 100644 --- a/toolchain/check/testdata/impl/import_self.carbon +++ b/toolchain/check/testdata/impl/import_self.carbon @@ -50,6 +50,7 @@ fn F(x: (), y: ()) -> () { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -141,6 +142,7 @@ fn F(x: (), y: ()) -> () { // CHECK:STDOUT: %Main.Add: type = import_ref Main//a, Add, loaded [concrete = constants.%Add.type] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Main.import_ref.07c = import_ref Main//a, inst19 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.f99: %Add.assoc_type = import_ref Main//a, loc5_41, loaded [concrete = constants.%assoc0] diff --git a/toolchain/check/testdata/impl/import_thunk.carbon b/toolchain/check/testdata/impl/import_thunk.carbon index 1c295042cd72..5e7087cd115c 100644 --- a/toolchain/check/testdata/impl/import_thunk.carbon +++ b/toolchain/check/testdata/impl/import_thunk.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/none.carbon +// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/destroy.carbon // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only". // EXTRA-ARGS: --dump-sem-ir-ranges=if-present // @@ -54,10 +54,19 @@ fn G() { // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%F.decl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: .I = %I.decl // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: @@ -120,17 +129,23 @@ fn G() { // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Main.I: type = import_ref Main//a, I, loaded [concrete = constants.%I.type] -// CHECK:STDOUT: %Main.import_ref.e5d = import_ref Main//a, inst17 [no loc], unloaded +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Main.import_ref.e5d = import_ref Main//a, inst19 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.507 = import_ref Main//a, loc5_14, unloaded // CHECK:STDOUT: %Main.F: %F.type.cf0 = import_ref Main//a, F, loaded [concrete = constants.%F.bc6] -// CHECK:STDOUT: %Main.import_ref.5dd: %I.type = import_ref Main//a, inst17 [no loc], loaded [symbolic = constants.%Self] +// CHECK:STDOUT: %Main.import_ref.5dd: %I.type = import_ref Main//a, inst19 [no loc], loaded [symbolic = constants.%Self] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] { // CHECK:STDOUT: .I = imports.%Main.I +// CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: %C.decl: %C.type = class_decl @C [concrete = constants.%C.generic] { // CHECK:STDOUT: %X.patt: %pattern_type.cb1 = symbolic_binding_pattern X, 0 [concrete] @@ -315,26 +330,26 @@ fn G() { // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] // CHECK:STDOUT: %C.607: type = class_type @C, @C(%empty_tuple) [concrete] // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete] -// CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self.826: %I.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete] -// CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, imports.%Main.import_ref.e03 [concrete] +// CHECK:STDOUT: %assoc0.3f3: %I.assoc_type = assoc_entity element0, imports.%Main.import_ref.e03 [concrete] // CHECK:STDOUT: %F.type.cf0: type = fn_type @F.1 [concrete] // CHECK:STDOUT: %F.bc6: %F.type.cf0 = struct_value () [concrete] // CHECK:STDOUT: %Y: %empty_tuple.type = bind_symbolic_name Y, 0 [symbolic] // CHECK:STDOUT: %C.13320f.2: type = class_type @C, @C(%Y) [symbolic] -// CHECK:STDOUT: %I.impl_witness.7d9: = impl_witness imports.%I.impl_witness_table, @impl(%Y) [symbolic] -// CHECK:STDOUT: %F.type.0daaa1.1: type = fn_type @F.2, @impl(%Y) [symbolic] +// CHECK:STDOUT: %I.impl_witness.7d9: = impl_witness imports.%I.impl_witness_table, @impl.22b(%Y) [symbolic] +// CHECK:STDOUT: %F.type.0daaa1.1: type = fn_type @F.2, @impl.22b(%Y) [symbolic] // CHECK:STDOUT: %F.49c1ac.1: %F.type.0daaa1.1 = struct_value () [symbolic] // CHECK:STDOUT: %pattern_type.ccc: type = pattern_type %C.13320f.2 [symbolic] -// CHECK:STDOUT: %F.type.0daaa1.2: type = fn_type @F.3, @impl(%Y) [symbolic] +// CHECK:STDOUT: %F.type.0daaa1.2: type = fn_type @F.3, @impl.22b(%Y) [symbolic] // CHECK:STDOUT: %F.49c1ac.2: %F.type.0daaa1.2 = struct_value () [symbolic] -// CHECK:STDOUT: %require_complete: = require_complete_type %C.13320f.2 [symbolic] +// CHECK:STDOUT: %require_complete.a35: = require_complete_type %C.13320f.2 [symbolic] // CHECK:STDOUT: %F.specific_fn.8d9: = specific_function %F.49c1ac.1, @F.2(%Y) [symbolic] // CHECK:STDOUT: %C.val.56a: %C.13320f.2 = struct_value () [symbolic] -// CHECK:STDOUT: %I.impl_witness.02b: = impl_witness imports.%I.impl_witness_table, @impl(%empty_tuple) [concrete] -// CHECK:STDOUT: %F.type.af4856.1: type = fn_type @F.2, @impl(%empty_tuple) [concrete] +// CHECK:STDOUT: %I.impl_witness.02b: = impl_witness imports.%I.impl_witness_table, @impl.22b(%empty_tuple) [concrete] +// CHECK:STDOUT: %F.type.af4856.1: type = fn_type @F.2, @impl.22b(%empty_tuple) [concrete] // CHECK:STDOUT: %F.5fa954.1: %F.type.af4856.1 = struct_value () [concrete] -// CHECK:STDOUT: %F.type.af4856.2: type = fn_type @F.3, @impl(%empty_tuple) [concrete] +// CHECK:STDOUT: %F.type.af4856.2: type = fn_type @F.3, @impl.22b(%empty_tuple) [concrete] // CHECK:STDOUT: %F.5fa954.2: %F.type.af4856.2 = struct_value () [concrete] // CHECK:STDOUT: %I.facet: %I.type = facet_value %C.607, (%I.impl_witness.02b) [concrete] // CHECK:STDOUT: %.885: type = fn_type_with_self_type %F.type.cf0, %I.facet [concrete] @@ -343,36 +358,57 @@ fn G() { // CHECK:STDOUT: %pattern_type.186: type = pattern_type %C.607 [concrete] // CHECK:STDOUT: %F.specific_fn.4832e8.2: = specific_function %F.5fa954.1, @F.2(%empty_tuple) [concrete] // CHECK:STDOUT: %C.val.12f: %C.607 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.94b: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%C.607) [concrete] +// CHECK:STDOUT: %Op.type.961: type = fn_type @Op.2, @impl.49c(%C.607) [concrete] +// CHECK:STDOUT: %Op.7ef: %Op.type.961 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %C.607, (%Destroy.impl_witness.94b) [concrete] +// CHECK:STDOUT: %.bb3: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.7ef, @Op.2(%C.607) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Main.I: type = import_ref Main//a, I, loaded [concrete = constants.%I.type] // CHECK:STDOUT: %Main.C: %C.type = import_ref Main//b, C, loaded [concrete = constants.%C.generic] +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } // CHECK:STDOUT: %Main.import_ref.eb1c17.1: %empty_tuple.type = import_ref Main//b, loc5_9, loaded [symbolic = @C.%X (constants.%X)] // CHECK:STDOUT: %Main.import_ref.8f2: = import_ref Main//b, loc5_18, loaded [concrete = constants.%complete_type] -// CHECK:STDOUT: %Main.import_ref.572 = import_ref Main//b, inst29 [no loc], unloaded -// CHECK:STDOUT: %Main.import_ref.e5d = import_ref Main//a, inst17 [no loc], unloaded -// CHECK:STDOUT: %Main.import_ref.c44: %I.assoc_type = import_ref Main//a, loc5_14, loaded [concrete = constants.%assoc0] +// CHECK:STDOUT: %Main.import_ref.572 = import_ref Main//b, inst31 [no loc], unloaded +// CHECK:STDOUT: %Main.import_ref.e5d = import_ref Main//a, inst19 [no loc], unloaded +// CHECK:STDOUT: %Main.import_ref.c44: %I.assoc_type = import_ref Main//a, loc5_14, loaded [concrete = constants.%assoc0.3f3] // CHECK:STDOUT: %Main.F.8b9 = import_ref Main//a, F, unloaded // CHECK:STDOUT: %Main.import_ref.e03: %F.type.cf0 = import_ref Main//a, loc5_14, loaded [concrete = constants.%F.bc6] -// CHECK:STDOUT: %Main.import_ref.5dd: %I.type = import_ref Main//a, inst17 [no loc], loaded [symbolic = constants.%Self] -// CHECK:STDOUT: %Main.import_ref.f89: = import_ref Main//b, loc7_32, loaded [symbolic = @impl.%I.impl_witness (constants.%I.impl_witness.7d9)] -// CHECK:STDOUT: %Main.import_ref.eb1c17.2: %empty_tuple.type = import_ref Main//b, loc7_14, loaded [symbolic = @impl.%Y (constants.%Y)] -// CHECK:STDOUT: %Main.import_ref.dbf: type = import_ref Main//b, loc7_25, loaded [symbolic = @impl.%C (constants.%C.13320f.2)] +// CHECK:STDOUT: %Main.import_ref.5dd: %I.type = import_ref Main//a, inst19 [no loc], loaded [symbolic = constants.%Self.826] +// CHECK:STDOUT: %Main.import_ref.f89: = import_ref Main//b, loc7_32, loaded [symbolic = @impl.22b.%I.impl_witness (constants.%I.impl_witness.7d9)] +// CHECK:STDOUT: %Main.import_ref.eb1c17.2: %empty_tuple.type = import_ref Main//b, loc7_14, loaded [symbolic = @impl.22b.%Y (constants.%Y)] +// CHECK:STDOUT: %Main.import_ref.dbf: type = import_ref Main//b, loc7_25, loaded [symbolic = @impl.22b.%C (constants.%C.13320f.2)] // CHECK:STDOUT: %Main.import_ref.f50: type = import_ref Main//b, loc7_30, loaded [concrete = constants.%I.type] -// CHECK:STDOUT: %Main.import_ref.047: @impl.%F.type.2 (%F.type.0daaa1.2) = import_ref Main//b, loc8_17, loaded [symbolic = @impl.%F.2 (constants.%F.49c1ac.2)] -// CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%Main.import_ref.047), @impl [concrete] -// CHECK:STDOUT: %Main.import_ref.eb1c17.3: %empty_tuple.type = import_ref Main//b, loc7_14, loaded [symbolic = @impl.%Y (constants.%Y)] -// CHECK:STDOUT: %Main.import_ref.eb1c17.4: %empty_tuple.type = import_ref Main//b, loc7_14, loaded [symbolic = @impl.%Y (constants.%Y)] -// CHECK:STDOUT: %Main.F.5a8: @impl.%F.type.1 (%F.type.0daaa1.1) = import_ref Main//b, F, loaded [symbolic = @impl.%F.1 (constants.%F.49c1ac.1)] +// CHECK:STDOUT: %Main.import_ref.047: @impl.22b.%F.type.2 (%F.type.0daaa1.2) = import_ref Main//b, loc8_17, loaded [symbolic = @impl.22b.%F.2 (constants.%F.49c1ac.2)] +// CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%Main.import_ref.047), @impl.22b [concrete] +// CHECK:STDOUT: %Main.import_ref.eb1c17.3: %empty_tuple.type = import_ref Main//b, loc7_14, loaded [symbolic = @impl.22b.%Y (constants.%Y)] +// CHECK:STDOUT: %Main.import_ref.eb1c17.4: %empty_tuple.type = import_ref Main//b, loc7_14, loaded [symbolic = @impl.22b.%Y (constants.%Y)] +// CHECK:STDOUT: %Main.F.5a8: @impl.22b.%F.type.1 (%F.type.0daaa1.1) = import_ref Main//b, F, loaded [symbolic = @impl.22b.%F.1 (constants.%F.49c1ac.1)] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] { // CHECK:STDOUT: .I = imports.%Main.I // CHECK:STDOUT: .C = imports.%Main.C +// CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {} {} // CHECK:STDOUT: } @@ -384,16 +420,16 @@ fn G() { // CHECK:STDOUT: witness = (imports.%Main.F.8b9) // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic impl @impl(imports.%Main.import_ref.eb1c17.2: %empty_tuple.type) [from "b.carbon"] { +// CHECK:STDOUT: generic impl @impl.22b(imports.%Main.import_ref.eb1c17.2: %empty_tuple.type) [from "b.carbon"] { // CHECK:STDOUT: %Y: %empty_tuple.type = bind_symbolic_name Y, 0 [symbolic = %Y (constants.%Y)] // CHECK:STDOUT: %C: type = class_type @C, @C(%Y) [symbolic = %C (constants.%C.13320f.2)] -// CHECK:STDOUT: %I.impl_witness: = impl_witness imports.%I.impl_witness_table, @impl(%Y) [symbolic = %I.impl_witness (constants.%I.impl_witness.7d9)] +// CHECK:STDOUT: %I.impl_witness: = impl_witness imports.%I.impl_witness_table, @impl.22b(%Y) [symbolic = %I.impl_witness (constants.%I.impl_witness.7d9)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %F.type.1: type = fn_type @F.2, @impl(%Y) [symbolic = %F.type.1 (constants.%F.type.0daaa1.1)] -// CHECK:STDOUT: %F.1: @impl.%F.type.1 (%F.type.0daaa1.1) = struct_value () [symbolic = %F.1 (constants.%F.49c1ac.1)] -// CHECK:STDOUT: %F.type.2: type = fn_type @F.3, @impl(%Y) [symbolic = %F.type.2 (constants.%F.type.0daaa1.2)] -// CHECK:STDOUT: %F.2: @impl.%F.type.2 (%F.type.0daaa1.2) = struct_value () [symbolic = %F.2 (constants.%F.49c1ac.2)] +// CHECK:STDOUT: %F.type.1: type = fn_type @F.2, @impl.22b(%Y) [symbolic = %F.type.1 (constants.%F.type.0daaa1.1)] +// CHECK:STDOUT: %F.1: @impl.22b.%F.type.1 (%F.type.0daaa1.1) = struct_value () [symbolic = %F.1 (constants.%F.49c1ac.1)] +// CHECK:STDOUT: %F.type.2: type = fn_type @F.3, @impl.22b(%Y) [symbolic = %F.type.2 (constants.%F.type.0daaa1.2)] +// CHECK:STDOUT: %F.2: @impl.22b.%F.type.2 (%F.type.0daaa1.2) = struct_value () [symbolic = %F.2 (constants.%F.49c1ac.2)] // CHECK:STDOUT: // CHECK:STDOUT: impl: imports.%Main.import_ref.dbf as imports.%Main.import_ref.f50 { // CHECK:STDOUT: !members: @@ -422,17 +458,17 @@ fn G() { // CHECK:STDOUT: %.loc7_7: %empty_tuple.type = converted %.loc7_6, %empty_tuple [concrete = constants.%empty_tuple] // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%empty_tuple) [concrete = constants.%C.607] // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type] -// CHECK:STDOUT: %F.ref.loc7_11: %I.assoc_type = name_ref F, imports.%Main.import_ref.c44 [concrete = constants.%assoc0] +// CHECK:STDOUT: %F.ref.loc7_11: %I.assoc_type = name_ref F, imports.%Main.import_ref.c44 [concrete = constants.%assoc0.3f3] // CHECK:STDOUT: %I.facet: %I.type = facet_value constants.%C.607, (constants.%I.impl_witness.02b) [concrete = constants.%I.facet] // CHECK:STDOUT: %.loc7_8: %I.type = converted %C, %I.facet [concrete = constants.%I.facet] -// CHECK:STDOUT: %impl.elem0: %.885 = impl_witness_access constants.%I.impl_witness.02b, element0 [concrete = constants.%F.5fa954.2] +// CHECK:STDOUT: %impl.elem0.loc7_8: %.885 = impl_witness_access constants.%I.impl_witness.02b, element0 [concrete = constants.%F.5fa954.2] // CHECK:STDOUT: %.loc7_16.1: %empty_struct_type = struct_literal () // CHECK:STDOUT: %empty_struct.loc7_16.1: %empty_struct_type = struct_value () [concrete = constants.%empty_struct] // CHECK:STDOUT: %.loc7_17.1: %empty_struct_type = converted %.loc7_16.1, %empty_struct.loc7_16.1 [concrete = constants.%empty_struct] -// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @F.3(constants.%empty_tuple) [concrete = constants.%F.specific_fn.4832e8.1] +// CHECK:STDOUT: %specific_fn.loc7_8: = specific_function %impl.elem0.loc7_8, @F.3(constants.%empty_tuple) [concrete = constants.%F.specific_fn.4832e8.1] // CHECK:STDOUT: %empty_struct.loc7_16.2: %empty_struct_type = struct_value () [concrete = constants.%empty_struct] // CHECK:STDOUT: %.loc7_16.2: %empty_struct_type = converted %.loc7_16.1, %empty_struct.loc7_16.2 [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc7_17.2: %F.type.af4856.1 = specific_constant imports.%Main.F.5a8, @impl(constants.%empty_tuple) [concrete = constants.%F.5fa954.1] +// CHECK:STDOUT: %.loc7_17.2: %F.type.af4856.1 = specific_constant imports.%Main.F.5a8, @impl.22b(constants.%empty_tuple) [concrete = constants.%F.5fa954.1] // CHECK:STDOUT: %F.ref.loc7_17: %F.type.af4856.1 = name_ref F, %.loc7_17.2 [concrete = constants.%F.5fa954.1] // CHECK:STDOUT: %F.specific_fn: = specific_function %F.ref.loc7_17, @F.2(constants.%empty_tuple) [concrete = constants.%F.specific_fn.4832e8.2] // CHECK:STDOUT: %.loc7_16.3: ref %C.607 = temporary_storage @@ -441,6 +477,12 @@ fn G() { // CHECK:STDOUT: %.loc7_16.6: ref %C.607 = converted %.loc7_16.2, %.loc7_16.5 // CHECK:STDOUT: %.loc7_16.7: %C.607 = bind_value %.loc7_16.6 // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.specific_fn(%.loc7_16.7) +// CHECK:STDOUT: %impl.elem0.loc7_16: %.bb3 = impl_witness_access constants.%Destroy.impl_witness.94b, element0 [concrete = constants.%Op.7ef] +// CHECK:STDOUT: %bound_method.loc7_16.1: = bound_method %.loc7_16.3, %impl.elem0.loc7_16 +// CHECK:STDOUT: %specific_fn.loc7_16: = specific_function %impl.elem0.loc7_16, @Op.2(constants.%C.607) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_16.2: = bound_method %.loc7_16.3, %specific_fn.loc7_16 +// CHECK:STDOUT: %.loc7_16.8: %C.607 = bind_value %.loc7_16.3 +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc7_16.2(%.loc7_16.8) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -454,7 +496,7 @@ fn G() { // CHECK:STDOUT: %pattern_type: type = pattern_type %C [symbolic = %pattern_type (constants.%pattern_type.ccc)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type %C [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %require_complete: = require_complete_type %C [symbolic = %require_complete (constants.%require_complete.a35)] // CHECK:STDOUT: // CHECK:STDOUT: fn; // CHECK:STDOUT: } @@ -462,11 +504,11 @@ fn G() { // CHECK:STDOUT: generic fn @F.3(imports.%Main.import_ref.eb1c17.4: %empty_tuple.type) [from "b.carbon"] { // CHECK:STDOUT: !definition: // CHECK:STDOUT: %Y: %empty_tuple.type = bind_symbolic_name Y, 0 [symbolic = %Y (constants.%Y)] -// CHECK:STDOUT: %F.type: type = fn_type @F.2, @impl(%Y) [symbolic = %F.type (constants.%F.type.0daaa1.1)] +// CHECK:STDOUT: %F.type: type = fn_type @F.2, @impl.22b(%Y) [symbolic = %F.type (constants.%F.type.0daaa1.1)] // CHECK:STDOUT: %F: @F.3.%F.type (%F.type.0daaa1.1) = struct_value () [symbolic = %F (constants.%F.49c1ac.1)] // CHECK:STDOUT: %F.specific_fn: = specific_function %F, @F.2(%Y) [symbolic = %F.specific_fn (constants.%F.specific_fn.8d9)] // CHECK:STDOUT: %C: type = class_type @C, @C(%Y) [symbolic = %C (constants.%C.13320f.2)] -// CHECK:STDOUT: %require_complete: = require_complete_type %C [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %require_complete: = require_complete_type %C [symbolic = %require_complete (constants.%require_complete.a35)] // CHECK:STDOUT: %C.val: @F.3.%C (%C.13320f.2) = struct_value () [symbolic = %C.val (constants.%C.val.56a)] // CHECK:STDOUT: // CHECK:STDOUT: fn [thunk imports.%Main.F.5a8]; @@ -482,7 +524,7 @@ fn G() { // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%Self) {} +// CHECK:STDOUT: specific @F.1(constants.%Self.826) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @C(constants.%Y) { // CHECK:STDOUT: %X => constants.%Y @@ -490,7 +532,7 @@ fn G() { // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @impl(constants.%Y) { +// CHECK:STDOUT: specific @impl.22b(constants.%Y) { // CHECK:STDOUT: %Y => constants.%Y // CHECK:STDOUT: %C => constants.%C.13320f.2 // CHECK:STDOUT: %I.impl_witness => constants.%I.impl_witness.7d9 @@ -508,12 +550,12 @@ fn G() { // CHECK:STDOUT: %pattern_type => constants.%pattern_type.ccc // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete => constants.%require_complete +// CHECK:STDOUT: %require_complete => constants.%require_complete.a35 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @F.3(constants.%Y) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @impl(constants.%empty_tuple) { +// CHECK:STDOUT: specific @impl.22b(constants.%empty_tuple) { // CHECK:STDOUT: %Y => constants.%empty_tuple // CHECK:STDOUT: %C => constants.%C.607 // CHECK:STDOUT: %I.impl_witness => constants.%I.impl_witness.02b diff --git a/toolchain/check/testdata/impl/interface_args.carbon b/toolchain/check/testdata/impl/interface_args.carbon index 32ac40a1010c..cedead70a5e0 100644 --- a/toolchain/check/testdata/impl/interface_args.carbon +++ b/toolchain/check/testdata/impl/interface_args.carbon @@ -241,6 +241,7 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -462,6 +463,7 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: %Main.F = import_ref Main//action, F, unloaded // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Main.import_ref.8f24d3.1: = import_ref Main//action, loc9_10, loaded [concrete = constants.%complete_type] // CHECK:STDOUT: %Main.import_ref.54a = import_ref Main//action, inst64 [no loc], unloaded @@ -641,6 +643,7 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: %Main.F = import_ref Main//action, F, unloaded // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Main.import_ref.8f24d3.1: = import_ref Main//action, loc9_10, loaded [concrete = constants.%complete_type] // CHECK:STDOUT: %Main.import_ref.54a = import_ref Main//action, inst64 [no loc], unloaded @@ -834,6 +837,7 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1088,6 +1092,7 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: %Main.B: type = import_ref Main//factory, B, loaded [concrete = constants.%B] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Main.import_ref.8f24d3.1: = import_ref Main//factory, loc12_10, loaded [concrete = constants.%complete_type] // CHECK:STDOUT: %Main.import_ref.54a = import_ref Main//factory, inst86 [no loc], unloaded @@ -1342,6 +1347,7 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//default +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Main.import_ref.8f24d3.1: = import_ref Main//factory, loc12_10, loaded [concrete = constants.%complete_type] // CHECK:STDOUT: %Main.import_ref.54a = import_ref Main//factory, inst86 [no loc], unloaded diff --git a/toolchain/check/testdata/impl/lookup/canonical_query_self.carbon b/toolchain/check/testdata/impl/lookup/canonical_query_self.carbon index e6dcee91842d..42da8ac965ad 100644 --- a/toolchain/check/testdata/impl/lookup/canonical_query_self.carbon +++ b/toolchain/check/testdata/impl/lookup/canonical_query_self.carbon @@ -77,16 +77,16 @@ fn G() { // CHECK:STDOUT: %Op.ff4: %Op.type.1cc = struct_value () [concrete] // CHECK:STDOUT: %Op.bound: = bound_method %I.type, %Op.ff4 [concrete] // CHECK:STDOUT: %facet_type: type = facet_type <@I & @J> [concrete] -// CHECK:STDOUT: %T: %facet_type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %T.527: %facet_type = bind_symbolic_name T, 0 [symbolic] // CHECK:STDOUT: %pattern_type.f8f: type = pattern_type %facet_type [concrete] -// CHECK:STDOUT: %T.as_type: type = facet_access_type %T [symbolic] +// CHECK:STDOUT: %T.as_type: type = facet_access_type %T.527 [symbolic] // CHECK:STDOUT: %pattern_type.a4f: type = pattern_type %T.as_type [symbolic] // CHECK:STDOUT: %F.type: type = fn_type @F [concrete] // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] -// CHECK:STDOUT: %require_complete: = require_complete_type %T.as_type [symbolic] -// CHECK:STDOUT: %I.lookup_impl_witness: = lookup_impl_witness %T, @I [symbolic] +// CHECK:STDOUT: %require_complete.df2: = require_complete_type %T.as_type [symbolic] +// CHECK:STDOUT: %I.lookup_impl_witness: = lookup_impl_witness %T.527, @I [symbolic] // CHECK:STDOUT: %I.facet.e75: %I.type = facet_value %T.as_type, (%I.lookup_impl_witness) [symbolic] -// CHECK:STDOUT: %J.lookup_impl_witness: = lookup_impl_witness %T, @J [symbolic] +// CHECK:STDOUT: %J.lookup_impl_witness: = lookup_impl_witness %T.527, @J [symbolic] // CHECK:STDOUT: %J.facet.fa4: %J.type = facet_value %T.as_type, (%J.lookup_impl_witness) [symbolic] // CHECK:STDOUT: %.935: type = fn_type_with_self_type %JJ.type.622, %J.facet.fa4 [symbolic] // CHECK:STDOUT: %impl.elem0: %.935 = impl_witness_access %J.lookup_impl_witness, element0 [symbolic] @@ -109,17 +109,32 @@ fn G() { // CHECK:STDOUT: %.638: type = fn_type_with_self_type %JJ.type.622, %J.facet.5df [concrete] // CHECK:STDOUT: %facet_value: %facet_type = facet_value %C, (%I.impl_witness, %J.impl_witness) [concrete] // CHECK:STDOUT: %F.specific_fn: = specific_function %F, @F(%facet_value) [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.3 [concrete] +// CHECK:STDOUT: %T.8b3: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.4, @impl.49c(%T.8b3) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.c4a: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%C) [concrete] +// CHECK:STDOUT: %Op.type.8e9: type = fn_type @Op.4, @impl.49c(%C) [concrete] +// CHECK:STDOUT: %Op.ddb: %Op.type.8e9 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %C, (%Destroy.impl_witness.c4a) [concrete] +// CHECK:STDOUT: %.40c: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.ddb, @Op.4(%C) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .BitAndWith = %Core.BitAndWith +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Core.BitAndWith: %BitAndWith.type.f2e = import_ref Core//prelude, BitAndWith, loaded [concrete = constants.%BitAndWith.generic] // CHECK:STDOUT: %Core.import_ref.012: %Op.type.1cc = import_ref Core//prelude, loc13_42, loaded [concrete = constants.%Op.ff4] // CHECK:STDOUT: %BitAndWith.impl_witness_table = impl_witness_table (%Core.import_ref.012), @impl.865 [concrete] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -147,10 +162,10 @@ fn G() { // CHECK:STDOUT: %.loc22_12.2: type = value_of_initializer %type.and [concrete = constants.%facet_type] // CHECK:STDOUT: %.loc22_12.3: type = converted %type.and, %.loc22_12.2 [concrete = constants.%facet_type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc22_6.1: %facet_type = bind_symbolic_name T, 0 [symbolic = %T.loc22_6.2 (constants.%T)] +// CHECK:STDOUT: %T.loc22_6.1: %facet_type = bind_symbolic_name T, 0 [symbolic = %T.loc22_6.2 (constants.%T.527)] // CHECK:STDOUT: %t.param: @F.%T.as_type.loc22_20.2 (%T.as_type) = value_param call_param0 // CHECK:STDOUT: %.loc22_20.1: type = splice_block %.loc22_20.2 [symbolic = %T.as_type.loc22_20.2 (constants.%T.as_type)] { -// CHECK:STDOUT: %T.ref.loc22: %facet_type = name_ref T, %T.loc22_6.1 [symbolic = %T.loc22_6.2 (constants.%T)] +// CHECK:STDOUT: %T.ref.loc22: %facet_type = name_ref T, %T.loc22_6.1 [symbolic = %T.loc22_6.2 (constants.%T.527)] // CHECK:STDOUT: %T.as_type.loc22_20.1: type = facet_access_type %T.ref.loc22 [symbolic = %T.as_type.loc22_20.2 (constants.%T.as_type)] // CHECK:STDOUT: %.loc22_20.2: type = converted %T.ref.loc22, %T.as_type.loc22_20.1 [symbolic = %T.as_type.loc22_20.2 (constants.%T.as_type)] // CHECK:STDOUT: } @@ -278,12 +293,12 @@ fn G() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @F(%T.loc22_6.1: %facet_type) { -// CHECK:STDOUT: %T.loc22_6.2: %facet_type = bind_symbolic_name T, 0 [symbolic = %T.loc22_6.2 (constants.%T)] +// CHECK:STDOUT: %T.loc22_6.2: %facet_type = bind_symbolic_name T, 0 [symbolic = %T.loc22_6.2 (constants.%T.527)] // CHECK:STDOUT: %T.as_type.loc22_20.2: type = facet_access_type %T.loc22_6.2 [symbolic = %T.as_type.loc22_20.2 (constants.%T.as_type)] // CHECK:STDOUT: %pattern_type: type = pattern_type %T.as_type.loc22_20.2 [symbolic = %pattern_type (constants.%pattern_type.a4f)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type %T.as_type.loc22_20.2 [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %require_complete: = require_complete_type %T.as_type.loc22_20.2 [symbolic = %require_complete (constants.%require_complete.df2)] // CHECK:STDOUT: %I.lookup_impl_witness: = lookup_impl_witness %T.loc22_6.2, @I [symbolic = %I.lookup_impl_witness (constants.%I.lookup_impl_witness)] // CHECK:STDOUT: %I.facet.loc26_18.2: %I.type = facet_value %T.as_type.loc22_20.2, (%I.lookup_impl_witness) [symbolic = %I.facet.loc26_18.2 (constants.%I.facet.e75)] // CHECK:STDOUT: %J.lookup_impl_witness: = lookup_impl_witness %T.loc22_6.2, @J [symbolic = %J.lookup_impl_witness (constants.%J.lookup_impl_witness)] @@ -295,9 +310,9 @@ fn G() { // CHECK:STDOUT: fn(%t.param: @F.%T.as_type.loc22_20.2 (%T.as_type)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %t.ref: @F.%T.as_type.loc22_20.2 (%T.as_type) = name_ref t, %t -// CHECK:STDOUT: %T.ref.loc26: %facet_type = name_ref T, %T.loc22_6.1 [symbolic = %T.loc22_6.2 (constants.%T)] +// CHECK:STDOUT: %T.ref.loc26: %facet_type = name_ref T, %T.loc22_6.1 [symbolic = %T.loc22_6.2 (constants.%T.527)] // CHECK:STDOUT: %I.ref.loc26_21: type = name_ref I, file.%I.decl [concrete = constants.%I.type] -// CHECK:STDOUT: %T.as_type.loc26_18: type = facet_access_type constants.%T [symbolic = %T.as_type.loc22_20.2 (constants.%T.as_type)] +// CHECK:STDOUT: %T.as_type.loc26_18: type = facet_access_type constants.%T.527 [symbolic = %T.as_type.loc22_20.2 (constants.%T.as_type)] // CHECK:STDOUT: %I.facet.loc26_18.1: %I.type = facet_value %T.as_type.loc26_18, (constants.%I.lookup_impl_witness) [symbolic = %I.facet.loc26_18.2 (constants.%I.facet.e75)] // CHECK:STDOUT: %.loc26_18: %I.type = converted %T.ref.loc26, %I.facet.loc26_18.1 [symbolic = %I.facet.loc26_18.2 (constants.%I.facet.e75)] // CHECK:STDOUT: %as_type.loc26_24: type = facet_access_type %.loc26_18 [symbolic = %T.as_type.loc22_20.2 (constants.%T.as_type)] @@ -318,8 +333,8 @@ fn G() { // CHECK:STDOUT: %as_type.loc26_67: type = facet_access_type %.loc26_63 [symbolic = %T.as_type.loc22_20.2 (constants.%T.as_type)] // CHECK:STDOUT: %.loc26_67: type = converted %.loc26_63, %as_type.loc26_67 [symbolic = %T.as_type.loc22_20.2 (constants.%T.as_type)] // CHECK:STDOUT: %JJ.ref: %J.assoc_type = name_ref JJ, @J.%assoc0 [concrete = constants.%assoc0.78c] -// CHECK:STDOUT: %T.as_type.loc26_69: type = facet_access_type constants.%T [symbolic = %T.as_type.loc22_20.2 (constants.%T.as_type)] -// CHECK:STDOUT: %.loc26_69.1: type = converted constants.%T, %T.as_type.loc26_69 [symbolic = %T.as_type.loc22_20.2 (constants.%T.as_type)] +// CHECK:STDOUT: %T.as_type.loc26_69: type = facet_access_type constants.%T.527 [symbolic = %T.as_type.loc22_20.2 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc26_69.1: type = converted constants.%T.527, %T.as_type.loc26_69 [symbolic = %T.as_type.loc22_20.2 (constants.%T.as_type)] // CHECK:STDOUT: %impl.elem0.loc26_69.1: @F.%.loc26_69.2 (%.935) = impl_witness_access constants.%J.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc26_69.2 (constants.%impl.elem0)] // CHECK:STDOUT: %bound_method.loc26_69: = bound_method %t.ref, %impl.elem0.loc26_69.1 // CHECK:STDOUT: %specific_impl_fn.loc26_69.1: = specific_impl_function %impl.elem0.loc26_69.1, @JJ.1(constants.%J.facet.fa4) [symbolic = %specific_impl_fn.loc26_69.2 (constants.%specific_impl_fn)] @@ -360,10 +375,10 @@ fn G() { // CHECK:STDOUT: %as_type.loc40_75: type = facet_access_type %.loc40_71 [concrete = constants.%C] // CHECK:STDOUT: %.loc40_75: type = converted %.loc40_71, %as_type.loc40_75 [concrete = constants.%C] // CHECK:STDOUT: %JJ.ref: %J.assoc_type = name_ref JJ, @J.%assoc0 [concrete = constants.%assoc0.78c] -// CHECK:STDOUT: %impl.elem0: %.638 = impl_witness_access constants.%J.impl_witness, element0 [concrete = constants.%JJ.9c9] -// CHECK:STDOUT: %bound_method: = bound_method %.loc40_8.1, %impl.elem0 +// CHECK:STDOUT: %impl.elem0.loc40_77: %.638 = impl_witness_access constants.%J.impl_witness, element0 [concrete = constants.%JJ.9c9] +// CHECK:STDOUT: %bound_method.loc40_77: = bound_method %.loc40_8.1, %impl.elem0.loc40_77 // CHECK:STDOUT: %.loc40_8.2: %C = bind_value %.loc40_8.1 -// CHECK:STDOUT: %JJ.call: init %empty_tuple.type = call %bound_method(%.loc40_8.2) +// CHECK:STDOUT: %JJ.call: init %empty_tuple.type = call %bound_method.loc40_77(%.loc40_8.2) // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] // CHECK:STDOUT: %C.ref.loc46_5: type = name_ref C, %C.decl [concrete = constants.%C] // CHECK:STDOUT: %.loc46_9.1: %empty_struct_type = struct_literal () @@ -381,6 +396,18 @@ fn G() { // CHECK:STDOUT: %F.specific_fn: = specific_function %F.ref, @F(constants.%facet_value) [concrete = constants.%F.specific_fn] // CHECK:STDOUT: %.loc46_11.2: %C = bind_value %.loc46_11.1 // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.specific_fn(%.loc46_11.2) +// CHECK:STDOUT: %impl.elem0.loc46: %.40c = impl_witness_access constants.%Destroy.impl_witness.c4a, element0 [concrete = constants.%Op.ddb] +// CHECK:STDOUT: %bound_method.loc46_9.1: = bound_method %.loc46_9.2, %impl.elem0.loc46 +// CHECK:STDOUT: %specific_fn.loc46: = specific_function %impl.elem0.loc46, @Op.4(constants.%C) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc46_9.2: = bound_method %.loc46_9.2, %specific_fn.loc46 +// CHECK:STDOUT: %.loc46_9.5: %C = bind_value %.loc46_9.2 +// CHECK:STDOUT: %no_op.loc46: init %empty_tuple.type = call %bound_method.loc46_9.2(%.loc46_9.5) +// CHECK:STDOUT: %impl.elem0.loc40_6: %.40c = impl_witness_access constants.%Destroy.impl_witness.c4a, element0 [concrete = constants.%Op.ddb] +// CHECK:STDOUT: %bound_method.loc40_6.1: = bound_method %.loc40_6.2, %impl.elem0.loc40_6 +// CHECK:STDOUT: %specific_fn.loc40: = specific_function %impl.elem0.loc40_6, @Op.4(constants.%C) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc40_6.2: = bound_method %.loc40_6.2, %specific_fn.loc40 +// CHECK:STDOUT: %.loc40_6.5: %C = bind_value %.loc40_6.2 +// CHECK:STDOUT: %no_op.loc40: init %empty_tuple.type = call %bound_method.loc40_6.2(%.loc40_6.5) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -406,8 +433,8 @@ fn G() { // CHECK:STDOUT: %pattern_type => constants.%pattern_type.4ca // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F(constants.%T) { -// CHECK:STDOUT: %T.loc22_6.2 => constants.%T +// CHECK:STDOUT: specific @F(constants.%T.527) { +// CHECK:STDOUT: %T.loc22_6.2 => constants.%T.527 // CHECK:STDOUT: %T.as_type.loc22_20.2 => constants.%T.as_type // CHECK:STDOUT: %pattern_type => constants.%pattern_type.a4f // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/impl/lookup/generic.carbon b/toolchain/check/testdata/impl/lookup/generic.carbon index 3db6671c1dee..7406df098acb 100644 --- a/toolchain/check/testdata/impl/lookup/generic.carbon +++ b/toolchain/check/testdata/impl/lookup/generic.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/none.carbon +// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/destroy.carbon // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only". // EXTRA-ARGS: --dump-sem-ir-ranges=if-present // @@ -160,11 +160,20 @@ fn G(x: A) { // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: .HasF = %HasF.decl // CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %HasF.decl: type = interface_decl @HasF [concrete = constants.%HasF.type] {} {} // CHECK:STDOUT: impl_decl @impl [concrete] { // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete] @@ -344,11 +353,20 @@ fn G(x: A) { // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: .HasF = %HasF.decl // CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %HasF.decl: type = interface_decl @HasF [concrete = constants.%HasF.type] {} {} // CHECK:STDOUT: impl_decl @impl [concrete] { // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete] @@ -556,12 +574,21 @@ fn G(x: A) { // CHECK:STDOUT: %F.specific_fn: = specific_function %F.c77, @F.2(%empty_struct_type) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: .HasF = %HasF.decl // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %HasF.decl: type = interface_decl @HasF [concrete = constants.%HasF.type] {} {} // CHECK:STDOUT: %C.decl: %C.type = class_decl @C [concrete = constants.%C.generic] { // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete] @@ -790,11 +817,20 @@ fn G(x: A) { // CHECK:STDOUT: %F.specific_fn: = specific_function %F.8c6, @F.2(%empty_struct_type) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: .HasF = %HasF.decl // CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %HasF.decl: %HasF.type.fe3 = interface_decl @HasF [concrete = constants.%HasF.generic] { // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete] // CHECK:STDOUT: } { @@ -1015,11 +1051,20 @@ fn G(x: A) { // CHECK:STDOUT: %G: %G.type = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: .HasF = %HasF.decl // CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %HasF.decl: type = interface_decl @HasF [concrete = constants.%HasF.type] {} {} // CHECK:STDOUT: impl_decl @impl [concrete] { // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete] @@ -1179,13 +1224,22 @@ fn G(x: A) { // CHECK:STDOUT: %assoc0.402: %HasF.assoc_type.1af = assoc_entity element0, @HasF.%F.decl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: .HasF = %HasF.decl // CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: .B = %B.decl // CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %HasF.decl: %HasF.type.fe3 = interface_decl @HasF [concrete = constants.%HasF.generic] { // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete] // CHECK:STDOUT: } { diff --git a/toolchain/check/testdata/impl/lookup/impl_forall.carbon b/toolchain/check/testdata/impl/lookup/impl_forall.carbon index d648bc171dfa..127e9ac259b7 100644 --- a/toolchain/check/testdata/impl/lookup/impl_forall.carbon +++ b/toolchain/check/testdata/impl/lookup/impl_forall.carbon @@ -136,6 +136,7 @@ fn TestSpecific(a: A({})) -> {} { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/lookup/import.carbon b/toolchain/check/testdata/impl/lookup/import.carbon index eafe5d1f1472..20272a050943 100644 --- a/toolchain/check/testdata/impl/lookup/import.carbon +++ b/toolchain/check/testdata/impl/lookup/import.carbon @@ -247,6 +247,7 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -378,6 +379,7 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %PackageA: = namespace file.%PackageA.import, [concrete] { // CHECK:STDOUT: .C = %PackageA.C @@ -606,6 +608,7 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %PackageA: = namespace file.%PackageA.import, [concrete] { // CHECK:STDOUT: .C = %PackageA.C @@ -726,6 +729,7 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %PackageA: = namespace file.%PackageA.import, [concrete] { // CHECK:STDOUT: .HasF = %PackageA.HasF @@ -894,6 +898,7 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %PackageA: = namespace file.%PackageA.import, [concrete] { // CHECK:STDOUT: .C = %PackageA.C @@ -1062,6 +1067,7 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %PackageB: = namespace file.%PackageB.import, [concrete] { // CHECK:STDOUT: .D = %PackageB.D @@ -1209,6 +1215,7 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1315,6 +1322,7 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %PackageAssociatedInterface: = namespace file.%PackageAssociatedInterface.import, [concrete] { // CHECK:STDOUT: .Z = %PackageAssociatedInterface.Z @@ -1412,6 +1420,7 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1521,9 +1530,9 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %Self.f64: %Y.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %K.type.311: type = fn_type @K.1 [concrete] // CHECK:STDOUT: %K.7a1: %K.type.311 = struct_value () [concrete] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.f64 [symbolic] -// CHECK:STDOUT: %pattern_type.cb4: type = pattern_type %Self.as_type [symbolic] -// CHECK:STDOUT: %require_complete: = require_complete_type %Self.as_type [symbolic] +// CHECK:STDOUT: %Self.as_type.61d: type = facet_access_type %Self.f64 [symbolic] +// CHECK:STDOUT: %pattern_type.cb4: type = pattern_type %Self.as_type.61d [symbolic] +// CHECK:STDOUT: %require_complete.b14: = require_complete_type %Self.as_type.61d [symbolic] // CHECK:STDOUT: %Y.impl_witness: = impl_witness file.%Y.impl_witness_table [concrete] // CHECK:STDOUT: %pattern_type.004: type = pattern_type %AnyParam.241 [concrete] // CHECK:STDOUT: %K.type.dcd: type = fn_type @K.2 [concrete] @@ -1533,13 +1542,25 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %L: %L.type = struct_value () [concrete] // CHECK:STDOUT: %AnyParam.val: %AnyParam.241 = struct_value () [concrete] // CHECK:STDOUT: %Y.assoc_type: type = assoc_entity_type @Y [concrete] -// CHECK:STDOUT: %assoc0: %Y.assoc_type = assoc_entity element0, imports.%PackageHasParam.import_ref.ce2 [concrete] +// CHECK:STDOUT: %assoc0.494: %Y.assoc_type = assoc_entity element0, imports.%PackageHasParam.import_ref.ce2 [concrete] // CHECK:STDOUT: %.0fb: type = fn_type_with_self_type %K.type.311, %Y.facet [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.98b: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%AnyParam.241) [concrete] +// CHECK:STDOUT: %Op.type.5fc: type = fn_type @Op.2, @impl.49c(%AnyParam.241) [concrete] +// CHECK:STDOUT: %Op.6f3: %Op.type.5fc = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %AnyParam.241, (%Destroy.impl_witness.98b) [concrete] +// CHECK:STDOUT: %.644: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.6f3, @Op.2(%AnyParam.241) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %PackageHasParam: = namespace file.%PackageHasParam.import, [concrete] { // CHECK:STDOUT: .AnyParam = %PackageHasParam.AnyParam @@ -1553,10 +1574,13 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %PackageHasParam.import_ref.601 = import_ref PackageHasParam//default, inst33 [no loc], unloaded // CHECK:STDOUT: %PackageHasParam.Y: type = import_ref PackageHasParam//default, Y, loaded [concrete = constants.%Y.type] // CHECK:STDOUT: %PackageHasParam.import_ref.dc1 = import_ref PackageHasParam//default, inst40 [no loc], unloaded -// CHECK:STDOUT: %PackageHasParam.import_ref.f69: %Y.assoc_type = import_ref PackageHasParam//default, loc7_22, loaded [concrete = constants.%assoc0] +// CHECK:STDOUT: %PackageHasParam.import_ref.f69: %Y.assoc_type = import_ref PackageHasParam//default, loc7_22, loaded [concrete = constants.%assoc0.494] // CHECK:STDOUT: %PackageHasParam.K: %K.type.311 = import_ref PackageHasParam//default, K, loaded [concrete = constants.%K.7a1] // CHECK:STDOUT: %PackageHasParam.import_ref.292: %Y.type = import_ref PackageHasParam//default, inst40 [no loc], loaded [symbolic = constants.%Self.f64] // CHECK:STDOUT: %PackageHasParam.import_ref.ce2: %K.type.311 = import_ref PackageHasParam//default, loc7_22, loaded [concrete = constants.%K.7a1] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -1573,7 +1597,7 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: } { // CHECK:STDOUT: %U.loc6_28.1: type = bind_symbolic_name U, 0 [symbolic = %U.loc6_28.2 (constants.%U)] // CHECK:STDOUT: } -// CHECK:STDOUT: impl_decl @impl [concrete] {} { +// CHECK:STDOUT: impl_decl @impl.dbd [concrete] {} { // CHECK:STDOUT: %PackageHasParam.ref.loc8_6: = name_ref PackageHasParam, imports.%PackageHasParam [concrete = imports.%PackageHasParam] // CHECK:STDOUT: %AnyParam.ref: %AnyParam.type = name_ref AnyParam, imports.%PackageHasParam.AnyParam [concrete = constants.%AnyParam.generic] // CHECK:STDOUT: %GenericInterface.ref: %GenericInterface.type.c92 = name_ref GenericInterface, file.%GenericInterface.decl [concrete = constants.%GenericInterface.generic] @@ -1581,7 +1605,7 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %PackageHasParam.ref.loc8_52: = name_ref PackageHasParam, imports.%PackageHasParam [concrete = imports.%PackageHasParam] // CHECK:STDOUT: %Y.ref: type = name_ref Y, imports.%PackageHasParam.Y [concrete = constants.%Y.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %Y.impl_witness_table = impl_witness_table (@impl.%K.decl), @impl [concrete] +// CHECK:STDOUT: %Y.impl_witness_table = impl_witness_table (@impl.dbd.%K.decl), @impl.dbd [concrete] // CHECK:STDOUT: %Y.impl_witness: = impl_witness %Y.impl_witness_table [concrete = constants.%Y.impl_witness] // CHECK:STDOUT: %L.decl: %L.type = fn_decl @L [concrete = constants.%L] {} {} // CHECK:STDOUT: } @@ -1609,13 +1633,13 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: witness = (imports.%PackageHasParam.K) // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl: %AnyParam as %Y.ref { +// CHECK:STDOUT: impl @impl.dbd: %AnyParam as %Y.ref { // CHECK:STDOUT: %K.decl: %K.type.dcd = fn_decl @K.2 [concrete = constants.%K.2e9] { // CHECK:STDOUT: %self.patt: %pattern_type.004 = binding_pattern self [concrete] // CHECK:STDOUT: %self.param_patt: %pattern_type.004 = value_param_pattern %self.patt, call_param0 [concrete] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: %AnyParam.241 = value_param call_param0 -// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.%AnyParam [concrete = constants.%AnyParam.241] +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.dbd.%AnyParam [concrete = constants.%AnyParam.241] // CHECK:STDOUT: %self: %AnyParam.241 = bind_name self, %self.param // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1641,11 +1665,11 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: // CHECK:STDOUT: generic fn @K.1(imports.%PackageHasParam.import_ref.292: %Y.type) [from "has_param.carbon"] { // CHECK:STDOUT: %Self: %Y.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.f64)] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type)] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type.61d)] // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type [symbolic = %pattern_type (constants.%pattern_type.cb4)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type %Self.as_type [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %require_complete: = require_complete_type %Self.as_type [symbolic = %require_complete (constants.%require_complete.b14)] // CHECK:STDOUT: // CHECK:STDOUT: fn; // CHECK:STDOUT: } @@ -1664,8 +1688,8 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %obj.var: ref %AnyParam.241 = var %obj.var_patt // CHECK:STDOUT: %.loc13_58.1: %empty_struct_type = struct_literal () // CHECK:STDOUT: %.loc13_58.2: init %AnyParam.241 = class_init (), %obj.var [concrete = constants.%AnyParam.val] -// CHECK:STDOUT: %.loc13_3: init %AnyParam.241 = converted %.loc13_58.1, %.loc13_58.2 [concrete = constants.%AnyParam.val] -// CHECK:STDOUT: assign %obj.var, %.loc13_3 +// CHECK:STDOUT: %.loc13_3.1: init %AnyParam.241 = converted %.loc13_58.1, %.loc13_58.2 [concrete = constants.%AnyParam.val] +// CHECK:STDOUT: assign %obj.var, %.loc13_3.1 // CHECK:STDOUT: %.loc13_53: type = splice_block %AnyParam [concrete = constants.%AnyParam.241] { // CHECK:STDOUT: %PackageHasParam.ref.loc13: = name_ref PackageHasParam, imports.%PackageHasParam [concrete = imports.%PackageHasParam] // CHECK:STDOUT: %AnyParam.ref: %AnyParam.type = name_ref AnyParam, imports.%PackageHasParam.AnyParam [concrete = constants.%AnyParam.generic] @@ -1676,11 +1700,17 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %obj.ref: ref %AnyParam.241 = name_ref obj, %obj // CHECK:STDOUT: %PackageHasParam.ref.loc14: = name_ref PackageHasParam, imports.%PackageHasParam [concrete = imports.%PackageHasParam] // CHECK:STDOUT: %Y.ref: type = name_ref Y, imports.%PackageHasParam.Y [concrete = constants.%Y.type] -// CHECK:STDOUT: %K.ref: %Y.assoc_type = name_ref K, imports.%PackageHasParam.import_ref.f69 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0: %.0fb = impl_witness_access constants.%Y.impl_witness, element0 [concrete = constants.%K.2e9] -// CHECK:STDOUT: %bound_method: = bound_method %obj.ref, %impl.elem0 +// CHECK:STDOUT: %K.ref: %Y.assoc_type = name_ref K, imports.%PackageHasParam.import_ref.f69 [concrete = constants.%assoc0.494] +// CHECK:STDOUT: %impl.elem0.loc14: %.0fb = impl_witness_access constants.%Y.impl_witness, element0 [concrete = constants.%K.2e9] +// CHECK:STDOUT: %bound_method.loc14: = bound_method %obj.ref, %impl.elem0.loc14 // CHECK:STDOUT: %.loc14: %AnyParam.241 = bind_value %obj.ref -// CHECK:STDOUT: %K.call: init %empty_tuple.type = call %bound_method(%.loc14) +// CHECK:STDOUT: %K.call: init %empty_tuple.type = call %bound_method.loc14(%.loc14) +// CHECK:STDOUT: %impl.elem0.loc13: %.644 = impl_witness_access constants.%Destroy.impl_witness.98b, element0 [concrete = constants.%Op.6f3] +// CHECK:STDOUT: %bound_method.loc13_3.1: = bound_method %obj.var, %impl.elem0.loc13 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0.loc13, @Op.2(constants.%AnyParam.241) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc13_3.2: = bound_method %obj.var, %specific_fn +// CHECK:STDOUT: %.loc13_3.2: %AnyParam.241 = bind_value %obj.var +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc13_3.2(%.loc13_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1704,7 +1734,7 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: // CHECK:STDOUT: specific @K.1(constants.%Self.f64) { // CHECK:STDOUT: %Self => constants.%Self.f64 -// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type +// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type.61d // CHECK:STDOUT: %pattern_type => constants.%pattern_type.cb4 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1739,22 +1769,34 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %Y.type: type = facet_type <@Y> [concrete] // CHECK:STDOUT: %Self.f64: %Y.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %Y.assoc_type: type = assoc_entity_type @Y [concrete] -// CHECK:STDOUT: %assoc0: %Y.assoc_type = assoc_entity element0, imports.%PackageHasParam.import_ref.ce2 [concrete] +// CHECK:STDOUT: %assoc0.494: %Y.assoc_type = assoc_entity element0, imports.%PackageHasParam.import_ref.ce2 [concrete] // CHECK:STDOUT: %K.type.311: type = fn_type @K.1 [concrete] // CHECK:STDOUT: %K.7a1: %K.type.311 = struct_value () [concrete] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.f64 [symbolic] -// CHECK:STDOUT: %pattern_type.cb4: type = pattern_type %Self.as_type [symbolic] -// CHECK:STDOUT: %require_complete: = require_complete_type %Self.as_type [symbolic] +// CHECK:STDOUT: %Self.as_type.61d: type = facet_access_type %Self.f64 [symbolic] +// CHECK:STDOUT: %pattern_type.cb4: type = pattern_type %Self.as_type.61d [symbolic] +// CHECK:STDOUT: %require_complete.b14: = require_complete_type %Self.as_type.61d [symbolic] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.92c: type = fn_type @Op.1, @impl.4b5(%T) [symbolic] +// CHECK:STDOUT: %Op.b8f: %Op.type.92c = struct_value () [symbolic] // CHECK:STDOUT: %Y.impl_witness: = impl_witness imports.%Y.impl_witness_table [concrete] // CHECK:STDOUT: %Y.facet: %Y.type = facet_value %AnyParam.861, (%Y.impl_witness) [concrete] // CHECK:STDOUT: %.e17: type = fn_type_with_self_type %K.type.311, %Y.facet [concrete] // CHECK:STDOUT: %K.type.7f9: type = fn_type @K.2 [concrete] // CHECK:STDOUT: %K.c3c: %K.type.7f9 = struct_value () [concrete] +// CHECK:STDOUT: %Op.type.f00: type = fn_type @Op.2 [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.c49: = impl_witness imports.%Destroy.impl_witness_table, @impl.4b5(%AnyParam.861) [concrete] +// CHECK:STDOUT: %Op.type.77e: type = fn_type @Op.1, @impl.4b5(%AnyParam.861) [concrete] +// CHECK:STDOUT: %Op.49f: %Op.type.77e = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %AnyParam.861, (%Destroy.impl_witness.c49) [concrete] +// CHECK:STDOUT: %.a90: type = fn_type_with_self_type %Op.type.f00, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.49f, @Op.1(%AnyParam.861) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: %Core.ece: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %PackageHasParam: = namespace file.%PackageHasParam.import, [concrete] { // CHECK:STDOUT: .AnyParam = %PackageHasParam.AnyParam @@ -1775,20 +1817,23 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %PackageGenericInterface.import_ref.c3b = import_ref PackageGenericInterface//default, inst29 [no loc], unloaded // CHECK:STDOUT: %PackageHasParam.Y: type = import_ref PackageHasParam//default, Y, loaded [concrete = constants.%Y.type] // CHECK:STDOUT: %PackageHasParam.import_ref.dc1 = import_ref PackageHasParam//default, inst40 [no loc], unloaded -// CHECK:STDOUT: %PackageHasParam.import_ref.f69: %Y.assoc_type = import_ref PackageHasParam//default, loc7_22, loaded [concrete = constants.%assoc0] +// CHECK:STDOUT: %PackageHasParam.import_ref.f69: %Y.assoc_type = import_ref PackageHasParam//default, loc7_22, loaded [concrete = constants.%assoc0.494] // CHECK:STDOUT: %PackageHasParam.K = import_ref PackageHasParam//default, K, unloaded // CHECK:STDOUT: %PackageHasParam.import_ref.ce2: %K.type.311 = import_ref PackageHasParam//default, loc7_22, loaded [concrete = constants.%K.7a1] // CHECK:STDOUT: %PackageHasParam.import_ref.292: %Y.type = import_ref PackageHasParam//default, inst40 [no loc], loaded [symbolic = constants.%Self.f64] // CHECK:STDOUT: %PackageGenericInterface.import_ref.53c: = import_ref PackageGenericInterface//default, loc8_70, loaded [concrete = constants.%Y.impl_witness] // CHECK:STDOUT: %PackageGenericInterface.import_ref.321: type = import_ref PackageGenericInterface//default, loc8_47, loaded [concrete = constants.%AnyParam.861] // CHECK:STDOUT: %PackageGenericInterface.import_ref.ca6: type = import_ref PackageGenericInterface//default, loc8_67, loaded [concrete = constants.%Y.type] +// CHECK:STDOUT: %PackageGenericInterface.import_ref.01e: @impl.4b5.%Op.type (%Op.type.92c) = import_ref PackageGenericInterface//default, inst154 [indirect], loaded [symbolic = @impl.4b5.%Op (constants.%Op.b8f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%PackageGenericInterface.import_ref.01e), @impl.4b5 [concrete] // CHECK:STDOUT: %PackageGenericInterface.import_ref.456: %K.type.7f9 = import_ref PackageGenericInterface//default, loc9_22, loaded [concrete = constants.%K.c3c] -// CHECK:STDOUT: %Y.impl_witness_table = impl_witness_table (%PackageGenericInterface.import_ref.456), @impl [concrete] +// CHECK:STDOUT: %Y.impl_witness_table = impl_witness_table (%PackageGenericInterface.import_ref.456), @impl.02a [concrete] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Core = imports.%Core.ece // CHECK:STDOUT: .PackageHasParam = imports.%PackageHasParam // CHECK:STDOUT: .PackageGenericInterface = imports.%PackageGenericInterface // CHECK:STDOUT: .M = %M.decl @@ -1820,7 +1865,7 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: witness = (imports.%PackageHasParam.K) // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl: imports.%PackageGenericInterface.import_ref.321 as imports.%PackageGenericInterface.import_ref.ca6 [from "has_generic_interface.carbon"] { +// CHECK:STDOUT: impl @impl.02a: imports.%PackageGenericInterface.import_ref.321 as imports.%PackageGenericInterface.import_ref.ca6 [from "has_generic_interface.carbon"] { // CHECK:STDOUT: !members: // CHECK:STDOUT: witness = imports.%PackageGenericInterface.import_ref.53c // CHECK:STDOUT: } @@ -1849,8 +1894,8 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %obj.var: ref %AnyParam.861 = var %obj.var_patt // CHECK:STDOUT: %.loc9_50.1: %empty_struct_type = struct_literal () // CHECK:STDOUT: %.loc9_50.2: init %AnyParam.861 = class_init (), %obj.var [concrete = constants.%AnyParam.val] -// CHECK:STDOUT: %.loc8: init %AnyParam.861 = converted %.loc9_50.1, %.loc9_50.2 [concrete = constants.%AnyParam.val] -// CHECK:STDOUT: assign %obj.var, %.loc8 +// CHECK:STDOUT: %.loc8_3.1: init %AnyParam.861 = converted %.loc9_50.1, %.loc9_50.2 [concrete = constants.%AnyParam.val] +// CHECK:STDOUT: assign %obj.var, %.loc8_3.1 // CHECK:STDOUT: %.loc9_45: type = splice_block %AnyParam [concrete = constants.%AnyParam.861] { // CHECK:STDOUT: %PackageHasParam.ref.loc8: = name_ref PackageHasParam, imports.%PackageHasParam [concrete = imports.%PackageHasParam] // CHECK:STDOUT: %AnyParam.ref: %AnyParam.type = name_ref AnyParam, imports.%PackageHasParam.AnyParam [concrete = constants.%AnyParam.generic] @@ -1862,21 +1907,27 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %obj.ref: ref %AnyParam.861 = name_ref obj, %obj // CHECK:STDOUT: %PackageHasParam.ref.loc10: = name_ref PackageHasParam, imports.%PackageHasParam [concrete = imports.%PackageHasParam] // CHECK:STDOUT: %Y.ref: type = name_ref Y, imports.%PackageHasParam.Y [concrete = constants.%Y.type] -// CHECK:STDOUT: %K.ref: %Y.assoc_type = name_ref K, imports.%PackageHasParam.import_ref.f69 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0: %.e17 = impl_witness_access constants.%Y.impl_witness, element0 [concrete = constants.%K.c3c] -// CHECK:STDOUT: %bound_method: = bound_method %obj.ref, %impl.elem0 +// CHECK:STDOUT: %K.ref: %Y.assoc_type = name_ref K, imports.%PackageHasParam.import_ref.f69 [concrete = constants.%assoc0.494] +// CHECK:STDOUT: %impl.elem0.loc10: %.e17 = impl_witness_access constants.%Y.impl_witness, element0 [concrete = constants.%K.c3c] +// CHECK:STDOUT: %bound_method.loc10: = bound_method %obj.ref, %impl.elem0.loc10 // CHECK:STDOUT: %.loc10: %AnyParam.861 = bind_value %obj.ref -// CHECK:STDOUT: %K.call: init %empty_tuple.type = call %bound_method(%.loc10) +// CHECK:STDOUT: %K.call: init %empty_tuple.type = call %bound_method.loc10(%.loc10) +// CHECK:STDOUT: %impl.elem0.loc8: %.a90 = impl_witness_access constants.%Destroy.impl_witness.c49, element0 [concrete = constants.%Op.49f] +// CHECK:STDOUT: %bound_method.loc8_3.1: = bound_method %obj.var, %impl.elem0.loc8 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0.loc8, @Op.1(constants.%AnyParam.861) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc8_3.2: = bound_method %obj.var, %specific_fn +// CHECK:STDOUT: %.loc8_3.2: %AnyParam.861 = bind_value %obj.var +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc8_3.2(%.loc8_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @K.1(imports.%PackageHasParam.import_ref.292: %Y.type) [from "has_param.carbon"] { // CHECK:STDOUT: %Self: %Y.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.f64)] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type)] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type.61d)] // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type [symbolic = %pattern_type (constants.%pattern_type.cb4)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type %Self.as_type [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %require_complete: = require_complete_type %Self.as_type [symbolic = %require_complete (constants.%require_complete.b14)] // CHECK:STDOUT: // CHECK:STDOUT: fn; // CHECK:STDOUT: } @@ -1903,7 +1954,7 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: // CHECK:STDOUT: specific @K.1(constants.%Self.f64) { // CHECK:STDOUT: %Self => constants.%Self.f64 -// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type +// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type.61d // CHECK:STDOUT: %pattern_type => constants.%pattern_type.cb4 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1926,12 +1977,12 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %pattern_type.17e: type = pattern_type %GenericClass.type [concrete] // CHECK:STDOUT: %AnyParam.0dd: type = class_type @AnyParam, @AnyParam(%GenericClass.type, %GenericClass.generic) [concrete] // CHECK:STDOUT: %Y.type: type = facet_type <@Y> [concrete] -// CHECK:STDOUT: %Self: %Y.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self.f64: %Y.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %K.type.311: type = fn_type @K.1 [concrete] // CHECK:STDOUT: %K.7a1: %K.type.311 = struct_value () [concrete] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] -// CHECK:STDOUT: %pattern_type.cb4: type = pattern_type %Self.as_type [symbolic] -// CHECK:STDOUT: %require_complete: = require_complete_type %Self.as_type [symbolic] +// CHECK:STDOUT: %Self.as_type.61d: type = facet_access_type %Self.f64 [symbolic] +// CHECK:STDOUT: %pattern_type.cb4: type = pattern_type %Self.as_type.61d [symbolic] +// CHECK:STDOUT: %require_complete.b14: = require_complete_type %Self.as_type.61d [symbolic] // CHECK:STDOUT: %Y.impl_witness: = impl_witness file.%Y.impl_witness_table [concrete] // CHECK:STDOUT: %pattern_type.64f: type = pattern_type %AnyParam.0dd [concrete] // CHECK:STDOUT: %K.type.965: type = fn_type @K.2 [concrete] @@ -1941,13 +1992,25 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %L: %L.type = struct_value () [concrete] // CHECK:STDOUT: %AnyParam.val: %AnyParam.0dd = struct_value () [concrete] // CHECK:STDOUT: %Y.assoc_type: type = assoc_entity_type @Y [concrete] -// CHECK:STDOUT: %assoc0: %Y.assoc_type = assoc_entity element0, imports.%PackageHasParam.import_ref.ce2 [concrete] +// CHECK:STDOUT: %assoc0.494: %Y.assoc_type = assoc_entity element0, imports.%PackageHasParam.import_ref.ce2 [concrete] // CHECK:STDOUT: %.701: type = fn_type_with_self_type %K.type.311, %Y.facet [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.418: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%AnyParam.0dd) [concrete] +// CHECK:STDOUT: %Op.type.f56: type = fn_type @Op.2, @impl.49c(%AnyParam.0dd) [concrete] +// CHECK:STDOUT: %Op.1fa: %Op.type.f56 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %AnyParam.0dd, (%Destroy.impl_witness.418) [concrete] +// CHECK:STDOUT: %.94f: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.1fa, @Op.2(%AnyParam.0dd) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %PackageHasParam: = namespace file.%PackageHasParam.import, [concrete] { // CHECK:STDOUT: .AnyParam = %PackageHasParam.AnyParam @@ -1961,10 +2024,13 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %PackageHasParam.import_ref.601 = import_ref PackageHasParam//default, inst33 [no loc], unloaded // CHECK:STDOUT: %PackageHasParam.Y: type = import_ref PackageHasParam//default, Y, loaded [concrete = constants.%Y.type] // CHECK:STDOUT: %PackageHasParam.import_ref.dc1 = import_ref PackageHasParam//default, inst40 [no loc], unloaded -// CHECK:STDOUT: %PackageHasParam.import_ref.f69: %Y.assoc_type = import_ref PackageHasParam//default, loc7_22, loaded [concrete = constants.%assoc0] +// CHECK:STDOUT: %PackageHasParam.import_ref.f69: %Y.assoc_type = import_ref PackageHasParam//default, loc7_22, loaded [concrete = constants.%assoc0.494] // CHECK:STDOUT: %PackageHasParam.K: %K.type.311 = import_ref PackageHasParam//default, K, loaded [concrete = constants.%K.7a1] -// CHECK:STDOUT: %PackageHasParam.import_ref.292: %Y.type = import_ref PackageHasParam//default, inst40 [no loc], loaded [symbolic = constants.%Self] +// CHECK:STDOUT: %PackageHasParam.import_ref.292: %Y.type = import_ref PackageHasParam//default, inst40 [no loc], loaded [symbolic = constants.%Self.f64] // CHECK:STDOUT: %PackageHasParam.import_ref.ce2: %K.type.311 = import_ref PackageHasParam//default, loc7_22, loaded [concrete = constants.%K.7a1] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -1981,7 +2047,7 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: } { // CHECK:STDOUT: %U.loc6_20.1: type = bind_symbolic_name U, 0 [symbolic = %U.loc6_20.2 (constants.%U)] // CHECK:STDOUT: } -// CHECK:STDOUT: impl_decl @impl [concrete] {} { +// CHECK:STDOUT: impl_decl @impl.4c1 [concrete] {} { // CHECK:STDOUT: %PackageHasParam.ref.loc8_6: = name_ref PackageHasParam, imports.%PackageHasParam [concrete = imports.%PackageHasParam] // CHECK:STDOUT: %AnyParam.ref: %AnyParam.type = name_ref AnyParam, imports.%PackageHasParam.AnyParam [concrete = constants.%AnyParam.generic] // CHECK:STDOUT: %GenericClass.ref: %GenericClass.type = name_ref GenericClass, file.%GenericClass.decl [concrete = constants.%GenericClass.generic] @@ -1989,7 +2055,7 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %PackageHasParam.ref.loc8_48: = name_ref PackageHasParam, imports.%PackageHasParam [concrete = imports.%PackageHasParam] // CHECK:STDOUT: %Y.ref: type = name_ref Y, imports.%PackageHasParam.Y [concrete = constants.%Y.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %Y.impl_witness_table = impl_witness_table (@impl.%K.decl), @impl [concrete] +// CHECK:STDOUT: %Y.impl_witness_table = impl_witness_table (@impl.4c1.%K.decl), @impl.4c1 [concrete] // CHECK:STDOUT: %Y.impl_witness: = impl_witness %Y.impl_witness_table [concrete = constants.%Y.impl_witness] // CHECK:STDOUT: %L.decl: %L.type = fn_decl @L [concrete = constants.%L] {} {} // CHECK:STDOUT: } @@ -2001,13 +2067,13 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: witness = (imports.%PackageHasParam.K) // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl: %AnyParam as %Y.ref { +// CHECK:STDOUT: impl @impl.4c1: %AnyParam as %Y.ref { // CHECK:STDOUT: %K.decl: %K.type.965 = fn_decl @K.2 [concrete = constants.%K.5a9] { // CHECK:STDOUT: %self.patt: %pattern_type.64f = binding_pattern self [concrete] // CHECK:STDOUT: %self.param_patt: %pattern_type.64f = value_param_pattern %self.patt, call_param0 [concrete] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: %AnyParam.0dd = value_param call_param0 -// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.%AnyParam [concrete = constants.%AnyParam.0dd] +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.4c1.%AnyParam [concrete = constants.%AnyParam.0dd] // CHECK:STDOUT: %self: %AnyParam.0dd = bind_name self, %self.param // CHECK:STDOUT: } // CHECK:STDOUT: @@ -2047,12 +2113,12 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @K.1(imports.%PackageHasParam.import_ref.292: %Y.type) [from "has_param.carbon"] { -// CHECK:STDOUT: %Self: %Y.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type)] +// CHECK:STDOUT: %Self: %Y.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.f64)] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type.61d)] // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type [symbolic = %pattern_type (constants.%pattern_type.cb4)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type %Self.as_type [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %require_complete: = require_complete_type %Self.as_type [symbolic = %require_complete (constants.%require_complete.b14)] // CHECK:STDOUT: // CHECK:STDOUT: fn; // CHECK:STDOUT: } @@ -2071,8 +2137,8 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %obj.var: ref %AnyParam.0dd = var %obj.var_patt // CHECK:STDOUT: %.loc13_54.1: %empty_struct_type = struct_literal () // CHECK:STDOUT: %.loc13_54.2: init %AnyParam.0dd = class_init (), %obj.var [concrete = constants.%AnyParam.val] -// CHECK:STDOUT: %.loc13_3: init %AnyParam.0dd = converted %.loc13_54.1, %.loc13_54.2 [concrete = constants.%AnyParam.val] -// CHECK:STDOUT: assign %obj.var, %.loc13_3 +// CHECK:STDOUT: %.loc13_3.1: init %AnyParam.0dd = converted %.loc13_54.1, %.loc13_54.2 [concrete = constants.%AnyParam.val] +// CHECK:STDOUT: assign %obj.var, %.loc13_3.1 // CHECK:STDOUT: %.loc13_49: type = splice_block %AnyParam [concrete = constants.%AnyParam.0dd] { // CHECK:STDOUT: %PackageHasParam.ref.loc13: = name_ref PackageHasParam, imports.%PackageHasParam [concrete = imports.%PackageHasParam] // CHECK:STDOUT: %AnyParam.ref: %AnyParam.type = name_ref AnyParam, imports.%PackageHasParam.AnyParam [concrete = constants.%AnyParam.generic] @@ -2083,11 +2149,17 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %obj.ref: ref %AnyParam.0dd = name_ref obj, %obj // CHECK:STDOUT: %PackageHasParam.ref.loc14: = name_ref PackageHasParam, imports.%PackageHasParam [concrete = imports.%PackageHasParam] // CHECK:STDOUT: %Y.ref: type = name_ref Y, imports.%PackageHasParam.Y [concrete = constants.%Y.type] -// CHECK:STDOUT: %K.ref: %Y.assoc_type = name_ref K, imports.%PackageHasParam.import_ref.f69 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0: %.701 = impl_witness_access constants.%Y.impl_witness, element0 [concrete = constants.%K.5a9] -// CHECK:STDOUT: %bound_method: = bound_method %obj.ref, %impl.elem0 +// CHECK:STDOUT: %K.ref: %Y.assoc_type = name_ref K, imports.%PackageHasParam.import_ref.f69 [concrete = constants.%assoc0.494] +// CHECK:STDOUT: %impl.elem0.loc14: %.701 = impl_witness_access constants.%Y.impl_witness, element0 [concrete = constants.%K.5a9] +// CHECK:STDOUT: %bound_method.loc14: = bound_method %obj.ref, %impl.elem0.loc14 // CHECK:STDOUT: %.loc14: %AnyParam.0dd = bind_value %obj.ref -// CHECK:STDOUT: %K.call: init %empty_tuple.type = call %bound_method(%.loc14) +// CHECK:STDOUT: %K.call: init %empty_tuple.type = call %bound_method.loc14(%.loc14) +// CHECK:STDOUT: %impl.elem0.loc13: %.94f = impl_witness_access constants.%Destroy.impl_witness.418, element0 [concrete = constants.%Op.1fa] +// CHECK:STDOUT: %bound_method.loc13_3.1: = bound_method %obj.var, %impl.elem0.loc13 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0.loc13, @Op.2(constants.%AnyParam.0dd) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc13_3.2: = bound_method %obj.var, %specific_fn +// CHECK:STDOUT: %.loc13_3.2: %AnyParam.0dd = bind_value %obj.var +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc13_3.2(%.loc13_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -2109,9 +2181,9 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @K.1(constants.%Self) { -// CHECK:STDOUT: %Self => constants.%Self -// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type +// CHECK:STDOUT: specific @K.1(constants.%Self.f64) { +// CHECK:STDOUT: %Self => constants.%Self.f64 +// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type.61d // CHECK:STDOUT: %pattern_type => constants.%pattern_type.cb4 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -2142,24 +2214,36 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %pattern_type.312: type = pattern_type %AnyParam.d71 [concrete] // CHECK:STDOUT: %AnyParam.val: %AnyParam.d71 = struct_value () [concrete] // CHECK:STDOUT: %Y.type: type = facet_type <@Y> [concrete] -// CHECK:STDOUT: %Self: %Y.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self.f64: %Y.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %Y.assoc_type: type = assoc_entity_type @Y [concrete] -// CHECK:STDOUT: %assoc0: %Y.assoc_type = assoc_entity element0, imports.%PackageHasParam.import_ref.ce2 [concrete] +// CHECK:STDOUT: %assoc0.494: %Y.assoc_type = assoc_entity element0, imports.%PackageHasParam.import_ref.ce2 [concrete] // CHECK:STDOUT: %K.type.311: type = fn_type @K.1 [concrete] // CHECK:STDOUT: %K.7a1: %K.type.311 = struct_value () [concrete] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] -// CHECK:STDOUT: %pattern_type.cb4: type = pattern_type %Self.as_type [symbolic] -// CHECK:STDOUT: %require_complete: = require_complete_type %Self.as_type [symbolic] +// CHECK:STDOUT: %Self.as_type.61d: type = facet_access_type %Self.f64 [symbolic] +// CHECK:STDOUT: %pattern_type.cb4: type = pattern_type %Self.as_type.61d [symbolic] +// CHECK:STDOUT: %require_complete.b14: = require_complete_type %Self.as_type.61d [symbolic] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.5d4: type = fn_type @Op.1, @impl.1d2(%T) [symbolic] +// CHECK:STDOUT: %Op.ab3: %Op.type.5d4 = struct_value () [symbolic] // CHECK:STDOUT: %Y.impl_witness: = impl_witness imports.%Y.impl_witness_table [concrete] // CHECK:STDOUT: %Y.facet: %Y.type = facet_value %AnyParam.d71, (%Y.impl_witness) [concrete] // CHECK:STDOUT: %.0dd: type = fn_type_with_self_type %K.type.311, %Y.facet [concrete] // CHECK:STDOUT: %K.type.9cf: type = fn_type @K.2 [concrete] // CHECK:STDOUT: %K.039: %K.type.9cf = struct_value () [concrete] +// CHECK:STDOUT: %Op.type.0fd: type = fn_type @Op.2 [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.ea7: = impl_witness imports.%Destroy.impl_witness_table, @impl.1d2(%AnyParam.d71) [concrete] +// CHECK:STDOUT: %Op.type.051: type = fn_type @Op.1, @impl.1d2(%AnyParam.d71) [concrete] +// CHECK:STDOUT: %Op.d0b: %Op.type.051 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %AnyParam.d71, (%Destroy.impl_witness.ea7) [concrete] +// CHECK:STDOUT: %.275: type = fn_type_with_self_type %Op.type.0fd, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.d0b, @Op.1(%AnyParam.d71) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: %Core.ece: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %PackageHasParam: = namespace file.%PackageHasParam.import, [concrete] { // CHECK:STDOUT: .AnyParam = %PackageHasParam.AnyParam @@ -2181,20 +2265,23 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %PackageGenericClass.import_ref.065 = import_ref PackageGenericClass//default, inst28 [no loc], unloaded // CHECK:STDOUT: %PackageHasParam.Y: type = import_ref PackageHasParam//default, Y, loaded [concrete = constants.%Y.type] // CHECK:STDOUT: %PackageHasParam.import_ref.dc1 = import_ref PackageHasParam//default, inst40 [no loc], unloaded -// CHECK:STDOUT: %PackageHasParam.import_ref.f69: %Y.assoc_type = import_ref PackageHasParam//default, loc7_22, loaded [concrete = constants.%assoc0] +// CHECK:STDOUT: %PackageHasParam.import_ref.f69: %Y.assoc_type = import_ref PackageHasParam//default, loc7_22, loaded [concrete = constants.%assoc0.494] // CHECK:STDOUT: %PackageHasParam.K = import_ref PackageHasParam//default, K, unloaded // CHECK:STDOUT: %PackageHasParam.import_ref.ce2: %K.type.311 = import_ref PackageHasParam//default, loc7_22, loaded [concrete = constants.%K.7a1] -// CHECK:STDOUT: %PackageHasParam.import_ref.292: %Y.type = import_ref PackageHasParam//default, inst40 [no loc], loaded [symbolic = constants.%Self] +// CHECK:STDOUT: %PackageHasParam.import_ref.292: %Y.type = import_ref PackageHasParam//default, inst40 [no loc], loaded [symbolic = constants.%Self.f64] // CHECK:STDOUT: %PackageGenericClass.import_ref.246: = import_ref PackageGenericClass//default, loc8_66, loaded [concrete = constants.%Y.impl_witness] // CHECK:STDOUT: %PackageGenericClass.import_ref.a0e: type = import_ref PackageGenericClass//default, loc8_43, loaded [concrete = constants.%AnyParam.d71] // CHECK:STDOUT: %PackageGenericClass.import_ref.ca6: type = import_ref PackageGenericClass//default, loc8_63, loaded [concrete = constants.%Y.type] +// CHECK:STDOUT: %PackageGenericClass.import_ref.9fa: @impl.1d2.%Op.type (%Op.type.5d4) = import_ref PackageGenericClass//default, inst152 [indirect], loaded [symbolic = @impl.1d2.%Op (constants.%Op.ab3)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%PackageGenericClass.import_ref.9fa), @impl.1d2 [concrete] // CHECK:STDOUT: %PackageGenericClass.import_ref.fbf: %K.type.9cf = import_ref PackageGenericClass//default, loc9_22, loaded [concrete = constants.%K.039] -// CHECK:STDOUT: %Y.impl_witness_table = impl_witness_table (%PackageGenericClass.import_ref.fbf), @impl [concrete] +// CHECK:STDOUT: %Y.impl_witness_table = impl_witness_table (%PackageGenericClass.import_ref.fbf), @impl.421 [concrete] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Core = imports.%Core.ece // CHECK:STDOUT: .PackageHasParam = imports.%PackageHasParam // CHECK:STDOUT: .PackageGenericClass = imports.%PackageGenericClass // CHECK:STDOUT: .M = %M.decl @@ -2212,7 +2299,7 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: witness = (imports.%PackageHasParam.K) // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl: imports.%PackageGenericClass.import_ref.a0e as imports.%PackageGenericClass.import_ref.ca6 [from "has_generic_class.carbon"] { +// CHECK:STDOUT: impl @impl.421: imports.%PackageGenericClass.import_ref.a0e as imports.%PackageGenericClass.import_ref.ca6 [from "has_generic_class.carbon"] { // CHECK:STDOUT: !members: // CHECK:STDOUT: witness = imports.%PackageGenericClass.import_ref.246 // CHECK:STDOUT: } @@ -2254,8 +2341,8 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %obj.var: ref %AnyParam.d71 = var %obj.var_patt // CHECK:STDOUT: %.loc8_74.1: %empty_struct_type = struct_literal () // CHECK:STDOUT: %.loc8_74.2: init %AnyParam.d71 = class_init (), %obj.var [concrete = constants.%AnyParam.val] -// CHECK:STDOUT: %.loc8_3: init %AnyParam.d71 = converted %.loc8_74.1, %.loc8_74.2 [concrete = constants.%AnyParam.val] -// CHECK:STDOUT: assign %obj.var, %.loc8_3 +// CHECK:STDOUT: %.loc8_3.1: init %AnyParam.d71 = converted %.loc8_74.1, %.loc8_74.2 [concrete = constants.%AnyParam.val] +// CHECK:STDOUT: assign %obj.var, %.loc8_3.1 // CHECK:STDOUT: %.loc8_69: type = splice_block %AnyParam [concrete = constants.%AnyParam.d71] { // CHECK:STDOUT: %PackageHasParam.ref.loc8: = name_ref PackageHasParam, imports.%PackageHasParam [concrete = imports.%PackageHasParam] // CHECK:STDOUT: %AnyParam.ref: %AnyParam.type = name_ref AnyParam, imports.%PackageHasParam.AnyParam [concrete = constants.%AnyParam.generic] @@ -2267,21 +2354,27 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %obj.ref: ref %AnyParam.d71 = name_ref obj, %obj // CHECK:STDOUT: %PackageHasParam.ref.loc9: = name_ref PackageHasParam, imports.%PackageHasParam [concrete = imports.%PackageHasParam] // CHECK:STDOUT: %Y.ref: type = name_ref Y, imports.%PackageHasParam.Y [concrete = constants.%Y.type] -// CHECK:STDOUT: %K.ref: %Y.assoc_type = name_ref K, imports.%PackageHasParam.import_ref.f69 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0: %.0dd = impl_witness_access constants.%Y.impl_witness, element0 [concrete = constants.%K.039] -// CHECK:STDOUT: %bound_method: = bound_method %obj.ref, %impl.elem0 +// CHECK:STDOUT: %K.ref: %Y.assoc_type = name_ref K, imports.%PackageHasParam.import_ref.f69 [concrete = constants.%assoc0.494] +// CHECK:STDOUT: %impl.elem0.loc9: %.0dd = impl_witness_access constants.%Y.impl_witness, element0 [concrete = constants.%K.039] +// CHECK:STDOUT: %bound_method.loc9: = bound_method %obj.ref, %impl.elem0.loc9 // CHECK:STDOUT: %.loc9: %AnyParam.d71 = bind_value %obj.ref -// CHECK:STDOUT: %K.call: init %empty_tuple.type = call %bound_method(%.loc9) +// CHECK:STDOUT: %K.call: init %empty_tuple.type = call %bound_method.loc9(%.loc9) +// CHECK:STDOUT: %impl.elem0.loc8: %.275 = impl_witness_access constants.%Destroy.impl_witness.ea7, element0 [concrete = constants.%Op.d0b] +// CHECK:STDOUT: %bound_method.loc8_3.1: = bound_method %obj.var, %impl.elem0.loc8 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0.loc8, @Op.1(constants.%AnyParam.d71) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc8_3.2: = bound_method %obj.var, %specific_fn +// CHECK:STDOUT: %.loc8_3.2: %AnyParam.d71 = bind_value %obj.var +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc8_3.2(%.loc8_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @K.1(imports.%PackageHasParam.import_ref.292: %Y.type) [from "has_param.carbon"] { -// CHECK:STDOUT: %Self: %Y.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type)] +// CHECK:STDOUT: %Self: %Y.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.f64)] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type.61d)] // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type [symbolic = %pattern_type (constants.%pattern_type.cb4)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type %Self.as_type [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %require_complete: = require_complete_type %Self.as_type [symbolic = %require_complete (constants.%require_complete.b14)] // CHECK:STDOUT: // CHECK:STDOUT: fn; // CHECK:STDOUT: } @@ -2306,9 +2399,9 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @K.1(constants.%Self) { -// CHECK:STDOUT: %Self => constants.%Self -// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type +// CHECK:STDOUT: specific @K.1(constants.%Self.f64) { +// CHECK:STDOUT: %Self => constants.%Self.f64 +// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type.61d // CHECK:STDOUT: %pattern_type => constants.%pattern_type.cb4 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -2359,6 +2452,7 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -2596,6 +2690,7 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %HasExtraInterfaces: = namespace file.%HasExtraInterfaces.import, [concrete] { // CHECK:STDOUT: .C = %HasExtraInterfaces.C diff --git a/toolchain/check/testdata/impl/lookup/specialization_with_symbolic_rewrite.carbon b/toolchain/check/testdata/impl/lookup/specialization_with_symbolic_rewrite.carbon index a572a68ff4e3..b377a933fd0e 100644 --- a/toolchain/check/testdata/impl/lookup/specialization_with_symbolic_rewrite.carbon +++ b/toolchain/check/testdata/impl/lookup/specialization_with_symbolic_rewrite.carbon @@ -486,9 +486,9 @@ fn F[T:! Ptr](var t: T) -> T.(Ptr.Type) { // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] -// CHECK:STDOUT: %Core.import_ref.492: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.ca0) = import_ref Core//prelude/parts/as, loc10_35, loaded [symbolic = @ImplicitAs.%assoc0 (constants.%assoc0.dc0)] -// CHECK:STDOUT: %Core.import_ref.1c7: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//prelude/parts/as, loc10_35, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] -// CHECK:STDOUT: %Core.import_ref.207 = import_ref Core//prelude/parts/as, loc10_35, unloaded +// CHECK:STDOUT: %Core.import_ref.492: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.ca0) = import_ref Core//prelude/parts/as, loc12_35, loaded [symbolic = @ImplicitAs.%assoc0 (constants.%assoc0.dc0)] +// CHECK:STDOUT: %Core.import_ref.1c7: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//prelude/parts/as, loc12_35, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] +// CHECK:STDOUT: %Core.import_ref.207 = import_ref Core//prelude/parts/as, loc12_35, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { diff --git a/toolchain/check/testdata/impl/lookup/transitive.carbon b/toolchain/check/testdata/impl/lookup/transitive.carbon index 77928d7cbab7..96c83388d1eb 100644 --- a/toolchain/check/testdata/impl/lookup/transitive.carbon +++ b/toolchain/check/testdata/impl/lookup/transitive.carbon @@ -275,39 +275,54 @@ fn Call() { // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete] -// CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self.826: %I.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete] -// CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, imports.%Main.import_ref.e03 [concrete] +// CHECK:STDOUT: %assoc0.3f3: %I.assoc_type = assoc_entity element0, imports.%Main.import_ref.e03 [concrete] // CHECK:STDOUT: %F.type.cf0: type = fn_type @F.1 [concrete] // CHECK:STDOUT: %F.bc6: %F.type.cf0 = struct_value () [concrete] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] -// CHECK:STDOUT: %pattern_type.6de: type = pattern_type %Self.as_type [symbolic] +// CHECK:STDOUT: %Self.as_type.b70: type = facet_access_type %Self.826 [symbolic] +// CHECK:STDOUT: %pattern_type.6de: type = pattern_type %Self.as_type.b70 [symbolic] // CHECK:STDOUT: %I.impl_witness: = impl_witness imports.%I.impl_witness_table [concrete] // CHECK:STDOUT: %I.facet: %I.type = facet_value %C, (%I.impl_witness) [concrete] // CHECK:STDOUT: %.1b3: type = fn_type_with_self_type %F.type.cf0, %I.facet [concrete] // CHECK:STDOUT: %F.type.5d6: type = fn_type @F.2 [concrete] // CHECK:STDOUT: %F.a2e: %F.type.5d6 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.906: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%C) [concrete] +// CHECK:STDOUT: %Op.type.153: type = fn_type @Op.2, @impl.49c(%C) [concrete] +// CHECK:STDOUT: %Op.5d7: %Op.type.153 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %C, (%Destroy.impl_witness.906) [concrete] +// CHECK:STDOUT: %.b80: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.5d7, @Op.2(%C) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Main.Get: %Get.type = import_ref Main//get, Get, loaded [concrete = constants.%Get] // CHECK:STDOUT: %Main.I: type = import_ref Main//i, I, loaded [concrete = constants.%I.type] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Main.import_ref.8db: = import_ref Main//get, inst23 [indirect], loaded [concrete = constants.%complete_type] // CHECK:STDOUT: %Main.import_ref.6a9 = import_ref Main//get, inst24 [indirect], unloaded // CHECK:STDOUT: %Main.import_ref.e5d = import_ref Main//i, inst19 [no loc], unloaded -// CHECK:STDOUT: %Main.import_ref.c44: %I.assoc_type = import_ref Main//i, loc4_33, loaded [concrete = constants.%assoc0] +// CHECK:STDOUT: %Main.import_ref.c44: %I.assoc_type = import_ref Main//i, loc4_33, loaded [concrete = constants.%assoc0.3f3] // CHECK:STDOUT: %Main.F = import_ref Main//i, F, unloaded // CHECK:STDOUT: %Main.import_ref.e03: %F.type.cf0 = import_ref Main//i, loc4_33, loaded [concrete = constants.%F.bc6] -// CHECK:STDOUT: %Main.import_ref.5dd: %I.type = import_ref Main//i, inst19 [no loc], loaded [symbolic = constants.%Self] +// CHECK:STDOUT: %Main.import_ref.5dd: %I.type = import_ref Main//i, inst19 [no loc], loaded [symbolic = constants.%Self.826] // CHECK:STDOUT: %Main.import_ref.f0d: = import_ref Main//c, loc7_13, loaded [concrete = constants.%I.impl_witness] // CHECK:STDOUT: %Main.import_ref.29a: type = import_ref Main//c, loc7_6, loaded [concrete = constants.%C] // CHECK:STDOUT: %Main.import_ref.f50: type = import_ref Main//c, loc7_11, loaded [concrete = constants.%I.type] // CHECK:STDOUT: %Main.import_ref.742: %F.type.5d6 = import_ref Main//c, loc7_34, loaded [concrete = constants.%F.a2e] -// CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%Main.import_ref.742), @impl [concrete] +// CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%Main.import_ref.742), @impl.770 [concrete] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/destroy, loc15_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -329,7 +344,7 @@ fn Call() { // CHECK:STDOUT: witness = (imports.%Main.F) // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl: imports.%Main.import_ref.29a as imports.%Main.import_ref.f50 [from "c.carbon"] { +// CHECK:STDOUT: impl @impl.770: imports.%Main.import_ref.29a as imports.%Main.import_ref.f50 [from "c.carbon"] { // CHECK:STDOUT: !members: // CHECK:STDOUT: witness = imports.%Main.import_ref.f0d // CHECK:STDOUT: } @@ -347,20 +362,26 @@ fn Call() { // CHECK:STDOUT: %.loc9_7.1: ref %C = temporary_storage // CHECK:STDOUT: %Get.call: init %C = call %Get.ref() to %.loc9_7.1 // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type] -// CHECK:STDOUT: %F.ref: %I.assoc_type = name_ref F, imports.%Main.import_ref.c44 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0: %.1b3 = impl_witness_access constants.%I.impl_witness, element0 [concrete = constants.%F.a2e] -// CHECK:STDOUT: %bound_method: = bound_method %Get.call, %impl.elem0 +// CHECK:STDOUT: %F.ref: %I.assoc_type = name_ref F, imports.%Main.import_ref.c44 [concrete = constants.%assoc0.3f3] +// CHECK:STDOUT: %impl.elem0.loc9_8: %.1b3 = impl_witness_access constants.%I.impl_witness, element0 [concrete = constants.%F.a2e] +// CHECK:STDOUT: %bound_method.loc9_8: = bound_method %Get.call, %impl.elem0.loc9_8 // CHECK:STDOUT: %.loc9_7.2: ref %C = temporary %.loc9_7.1, %Get.call // CHECK:STDOUT: %.loc9_7.3: %C = bind_value %.loc9_7.2 -// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %bound_method(%.loc9_7.3) +// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %bound_method.loc9_8(%.loc9_7.3) +// CHECK:STDOUT: %impl.elem0.loc9_7: %.b80 = impl_witness_access constants.%Destroy.impl_witness.906, element0 [concrete = constants.%Op.5d7] +// CHECK:STDOUT: %bound_method.loc9_7.1: = bound_method %.loc9_7.1, %impl.elem0.loc9_7 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0.loc9_7, @Op.2(constants.%C) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc9_7.2: = bound_method %.loc9_7.1, %specific_fn +// CHECK:STDOUT: %.loc9_7.4: %C = bind_value %.loc9_7.1 +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc9_7.2(%.loc9_7.4) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Get [from "get.carbon"]; // CHECK:STDOUT: // CHECK:STDOUT: generic fn @F.1(imports.%Main.import_ref.5dd: %I.type) [from "i.carbon"] { -// CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type)] +// CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.826)] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type.b70)] // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type [symbolic = %pattern_type (constants.%pattern_type.6de)] // CHECK:STDOUT: // CHECK:STDOUT: fn; @@ -368,9 +389,9 @@ fn Call() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F.2 [from "c.carbon"]; // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%Self) { -// CHECK:STDOUT: %Self => constants.%Self -// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type +// CHECK:STDOUT: specific @F.1(constants.%Self.826) { +// CHECK:STDOUT: %Self => constants.%Self.826 +// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type.b70 // CHECK:STDOUT: %pattern_type => constants.%pattern_type.6de // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/use_assoc_const.carbon b/toolchain/check/testdata/impl/use_assoc_const.carbon index d8632397c992..d5ea026a0825 100644 --- a/toolchain/check/testdata/impl/use_assoc_const.carbon +++ b/toolchain/check/testdata/impl/use_assoc_const.carbon @@ -3612,12 +3612,13 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete] -// CHECK:STDOUT: %Self: %Z.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self.6e6: %Z.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %Z.assoc_type: type = assoc_entity_type @Z [concrete] -// CHECK:STDOUT: %assoc0: %Z.assoc_type = assoc_entity element0, @Z.%X [concrete] +// CHECK:STDOUT: %assoc0.659: %Z.assoc_type = assoc_entity element0, @Z.%X [concrete] // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete] // CHECK:STDOUT: %C.type: type = generic_class_type @C [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %C.generic: %C.type = struct_value () [concrete] // CHECK:STDOUT: %C.f2e: type = class_type @C, @C(%T) [symbolic] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] @@ -3629,24 +3630,38 @@ fn F() { // CHECK:STDOUT: %Z.facet.2a2: %Z.type = facet_value %.Self.as_type, (%Z.lookup_impl_witness) [symbolic_self] // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %Z.lookup_impl_witness, element0 [symbolic_self] // CHECK:STDOUT: %Z_where.type.585: type = facet_type <@Z where %impl.elem0 = %C.f2e> [symbolic] -// CHECK:STDOUT: %require_complete: = require_complete_type %Z_where.type.585 [symbolic] -// CHECK:STDOUT: %Z.impl_witness.8bc: = impl_witness file.%Z.impl_witness_table, @impl(%T) [symbolic] +// CHECK:STDOUT: %require_complete.747: = require_complete_type %Z_where.type.585 [symbolic] +// CHECK:STDOUT: %Z.impl_witness.8bc: = impl_witness file.%Z.impl_witness_table, @impl.560(%T) [symbolic] // CHECK:STDOUT: %F.type: type = fn_type @F [concrete] // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] // CHECK:STDOUT: %C.131: type = class_type @C, @C(%D) [concrete] // CHECK:STDOUT: %Z_where.type.1a6: type = facet_type <@Z where %impl.elem0 = %C.131> [concrete] // CHECK:STDOUT: %complete_type.00b: = complete_type_witness %Z_where.type.1a6 [concrete] -// CHECK:STDOUT: %Z.impl_witness.19e: = impl_witness file.%Z.impl_witness_table, @impl(%D) [concrete] +// CHECK:STDOUT: %Z.impl_witness.19e: = impl_witness file.%Z.impl_witness_table, @impl.560(%D) [concrete] // CHECK:STDOUT: %Z.facet.f2a: %Z.type = facet_value %D, (%Z.impl_witness.19e) [concrete] // CHECK:STDOUT: %pattern_type.7f8: type = pattern_type %C.131 [concrete] // CHECK:STDOUT: %C.val: %C.131 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.ee0: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%C.131) [concrete] +// CHECK:STDOUT: %Op.type.b84: type = fn_type @Op.2, @impl.49c(%C.131) [concrete] +// CHECK:STDOUT: %Op.e16: %Op.type.b84 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %C.131, (%Destroy.impl_witness.ee0) [concrete] +// CHECK:STDOUT: %.04b: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.e16, @Op.2(%C.131) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -3665,14 +3680,14 @@ fn F() { // CHECK:STDOUT: %T.loc6_9.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc6_9.2 (constants.%T)] // CHECK:STDOUT: } // CHECK:STDOUT: %D.decl: type = class_decl @D [concrete = constants.%D] {} {} -// CHECK:STDOUT: impl_decl @impl [concrete] { +// CHECK:STDOUT: impl_decl @impl.560 [concrete] { // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete] // CHECK:STDOUT: } { // CHECK:STDOUT: %T.ref.loc9_24: type = name_ref T, %T.loc9_14.1 [symbolic = %T.loc9_14.2 (constants.%T)] // CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type] // CHECK:STDOUT: %.Self: %Z.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self] // CHECK:STDOUT: %.Self.ref: %Z.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %X.ref: %Z.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %X.ref: %Z.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0.659] // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.as_type] // CHECK:STDOUT: %.loc9_37: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.as_type] // CHECK:STDOUT: %impl.elem0: type = impl_witness_access constants.%Z.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0] @@ -3684,16 +3699,16 @@ fn F() { // CHECK:STDOUT: } // CHECK:STDOUT: %T.loc9_14.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc9_14.2 (constants.%T)] // CHECK:STDOUT: } -// CHECK:STDOUT: %Z.impl_witness_table = impl_witness_table (%impl_witness_assoc_constant), @impl [concrete] -// CHECK:STDOUT: %Z.impl_witness: = impl_witness %Z.impl_witness_table, @impl(constants.%T) [symbolic = @impl.%Z.impl_witness (constants.%Z.impl_witness.8bc)] -// CHECK:STDOUT: %impl_witness_assoc_constant: type = impl_witness_assoc_constant constants.%C.f2e [symbolic = @impl.%C.loc9_45.2 (constants.%C.f2e)] +// CHECK:STDOUT: %Z.impl_witness_table = impl_witness_table (%impl_witness_assoc_constant), @impl.560 [concrete] +// CHECK:STDOUT: %Z.impl_witness: = impl_witness %Z.impl_witness_table, @impl.560(constants.%T) [symbolic = @impl.560.%Z.impl_witness (constants.%Z.impl_witness.8bc)] +// CHECK:STDOUT: %impl_witness_assoc_constant: type = impl_witness_assoc_constant constants.%C.f2e [symbolic = @impl.560.%C.loc9_45.2 (constants.%C.f2e)] // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Z { -// CHECK:STDOUT: %Self: %Z.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] +// CHECK:STDOUT: %Self: %Z.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.6e6] // CHECK:STDOUT: %X: type = assoc_const_decl @X [concrete] { -// CHECK:STDOUT: %assoc0: %Z.assoc_type = assoc_entity element0, @Z.%X [concrete = constants.%assoc0] +// CHECK:STDOUT: %assoc0: %Z.assoc_type = assoc_entity element0, @Z.%X [concrete = constants.%assoc0.659] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -3706,12 +3721,12 @@ fn F() { // CHECK:STDOUT: assoc_const X:! type; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic impl @impl(%T.loc9_14.1: type) { +// CHECK:STDOUT: generic impl @impl.560(%T.loc9_14.1: type) { // CHECK:STDOUT: %T.loc9_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc9_14.2 (constants.%T)] // CHECK:STDOUT: %C.loc9_45.2: type = class_type @C, @C(%T.loc9_14.2) [symbolic = %C.loc9_45.2 (constants.%C.f2e)] // CHECK:STDOUT: %Z_where.type: type = facet_type <@Z where constants.%impl.elem0 = %C.loc9_45.2> [symbolic = %Z_where.type (constants.%Z_where.type.585)] -// CHECK:STDOUT: %require_complete: = require_complete_type %Z_where.type [symbolic = %require_complete (constants.%require_complete)] -// CHECK:STDOUT: %Z.impl_witness: = impl_witness file.%Z.impl_witness_table, @impl(%T.loc9_14.2) [symbolic = %Z.impl_witness (constants.%Z.impl_witness.8bc)] +// CHECK:STDOUT: %require_complete: = require_complete_type %Z_where.type [symbolic = %require_complete (constants.%require_complete.747)] +// CHECK:STDOUT: %Z.impl_witness: = impl_witness file.%Z.impl_witness_table, @impl.560(%T.loc9_14.2) [symbolic = %Z.impl_witness (constants.%Z.impl_witness.8bc)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -3758,20 +3773,26 @@ fn F() { // CHECK:STDOUT: %.loc12_21.3: init %C.131 = class_init (), %.loc12_21.2 [concrete = constants.%C.val] // CHECK:STDOUT: %.loc12_21.4: ref %C.131 = temporary %.loc12_21.2, %.loc12_21.3 // CHECK:STDOUT: %.loc12_23.1: ref %C.131 = converted %.loc12_21.1, %.loc12_21.4 -// CHECK:STDOUT: %.loc12_11.1: type = splice_block %impl.elem0 [concrete = constants.%C.131] { +// CHECK:STDOUT: %.loc12_11.1: type = splice_block %impl.elem0.loc12_11 [concrete = constants.%C.131] { // CHECK:STDOUT: %D.ref.loc12_10: type = name_ref D, file.%D.decl [concrete = constants.%D] // CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type] -// CHECK:STDOUT: %X.ref: %Z.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %X.ref: %Z.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0.659] // CHECK:STDOUT: %Z.facet: %Z.type = facet_value constants.%D, (constants.%Z.impl_witness.19e) [concrete = constants.%Z.facet.f2a] // CHECK:STDOUT: %.loc12_11.2: %Z.type = converted %D.ref.loc12_10, %Z.facet [concrete = constants.%Z.facet.f2a] -// CHECK:STDOUT: %impl.elem0: type = impl_witness_access constants.%Z.impl_witness.19e, element0 [concrete = constants.%C.131] +// CHECK:STDOUT: %impl.elem0.loc12_11: type = impl_witness_access constants.%Z.impl_witness.19e, element0 [concrete = constants.%C.131] // CHECK:STDOUT: } // CHECK:STDOUT: %.loc12_23.2: %C.131 = bind_value %.loc12_23.1 // CHECK:STDOUT: %a: %C.131 = bind_name a, %.loc12_23.2 +// CHECK:STDOUT: %impl.elem0.loc12_21: %.04b = impl_witness_access constants.%Destroy.impl_witness.ee0, element0 [concrete = constants.%Op.e16] +// CHECK:STDOUT: %bound_method.loc12_21.1: = bound_method %.loc12_21.2, %impl.elem0.loc12_21 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0.loc12_21, @Op.2(constants.%C.131) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc12_21.2: = bound_method %.loc12_21.2, %specific_fn +// CHECK:STDOUT: %.loc12_21.5: %C.131 = bind_value %.loc12_21.2 +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc12_21.2(%.loc12_21.5) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @X(constants.%Self) {} +// CHECK:STDOUT: specific @X(constants.%Self.6e6) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @C(constants.%T) { // CHECK:STDOUT: %T.loc6_9.2 => constants.%T @@ -3779,15 +3800,15 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: specific @X(constants.%Z.facet.2a2) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @impl(constants.%T) { +// CHECK:STDOUT: specific @impl.560(constants.%T) { // CHECK:STDOUT: %T.loc9_14.2 => constants.%T // CHECK:STDOUT: %C.loc9_45.2 => constants.%C.f2e // CHECK:STDOUT: %Z_where.type => constants.%Z_where.type.585 -// CHECK:STDOUT: %require_complete => constants.%require_complete +// CHECK:STDOUT: %require_complete => constants.%require_complete.747 // CHECK:STDOUT: %Z.impl_witness => constants.%Z.impl_witness.8bc // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @impl(constants.%D) { +// CHECK:STDOUT: specific @impl.560(constants.%D) { // CHECK:STDOUT: %T.loc9_14.2 => constants.%D // CHECK:STDOUT: %C.loc9_45.2 => constants.%C.131 // CHECK:STDOUT: %Z_where.type => constants.%Z_where.type.1a6 diff --git a/toolchain/check/testdata/index/expr_category.carbon b/toolchain/check/testdata/index/expr_category.carbon index 8a8383dfeb3f..10a441e6fbce 100644 --- a/toolchain/check/testdata/index/expr_category.carbon +++ b/toolchain/check/testdata/index/expr_category.carbon @@ -37,6 +37,7 @@ fn ValueBinding(b: array(i32, 3)) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] // CHECK:STDOUT: %int_3.1ba: Core.IntLiteral = int_value 3 [concrete] @@ -82,6 +83,23 @@ fn ValueBinding(b: array(i32, 3)) { // CHECK:STDOUT: %Convert.bound.ac3: = bound_method %int_4.0c1, %Convert.956 [concrete] // CHECK:STDOUT: %bound_method.1da: = bound_method %int_4.0c1, %Convert.specific_fn [concrete] // CHECK:STDOUT: %int_4.940: %i32 = int_value 4 [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.2 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.3, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.711: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%ptr.235) [concrete] +// CHECK:STDOUT: %Op.type.ba2: type = fn_type @Op.3, @impl.49c(%ptr.235) [concrete] +// CHECK:STDOUT: %Op.649: %Op.type.ba2 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.2bf: %Destroy.type = facet_value %ptr.235, (%Destroy.impl_witness.711) [concrete] +// CHECK:STDOUT: %.a79: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.2bf [concrete] +// CHECK:STDOUT: %Op.specific_fn.829: = specific_function %Op.649, @Op.3(%ptr.235) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.14a: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%array_type) [concrete] +// CHECK:STDOUT: %Op.type.1e4: type = fn_type @Op.3, @impl.49c(%array_type) [concrete] +// CHECK:STDOUT: %Op.f0b: %Op.type.1e4 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.75f: %Destroy.type = facet_value %array_type, (%Destroy.impl_witness.14a) [concrete] +// CHECK:STDOUT: %.9c9: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.75f [concrete] +// CHECK:STDOUT: %Op.specific_fn.c51: = specific_function %Op.f0b, @Op.3(%array_type) [concrete] // CHECK:STDOUT: %ValueBinding.type: type = fn_type @ValueBinding [concrete] // CHECK:STDOUT: %ValueBinding: %ValueBinding.type = struct_value () [concrete] // CHECK:STDOUT: } @@ -90,6 +108,7 @@ fn ValueBinding(b: array(i32, 3)) { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Int = %Core.Int // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -97,6 +116,9 @@ fn ValueBinding(b: array(i32, 3)) { // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -187,8 +209,8 @@ fn ValueBinding(b: array(i32, 3)) { // CHECK:STDOUT: %.loc18_34.9: ref %i32 = array_index %a.var, %int_2.loc18_34 // CHECK:STDOUT: %.loc18_34.10: init %i32 = initialize_from %.loc18_34.8 to %.loc18_34.9 [concrete = constants.%int_3.822] // CHECK:STDOUT: %.loc18_34.11: init %array_type = array_init (%.loc18_34.4, %.loc18_34.7, %.loc18_34.10) to %a.var [concrete = constants.%array] -// CHECK:STDOUT: %.loc18_3: init %array_type = converted %.loc18_34.1, %.loc18_34.11 [concrete = constants.%array] -// CHECK:STDOUT: assign %a.var, %.loc18_3 +// CHECK:STDOUT: %.loc18_3.1: init %array_type = converted %.loc18_34.1, %.loc18_34.11 [concrete = constants.%array] +// CHECK:STDOUT: assign %a.var, %.loc18_3.1 // CHECK:STDOUT: %.loc18_22: type = splice_block %array_type.loc18 [concrete = constants.%array_type] { // CHECK:STDOUT: %int_32.loc18: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32.loc18: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] @@ -205,10 +227,10 @@ fn ValueBinding(b: array(i32, 3)) { // CHECK:STDOUT: %int_0.loc21: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] // CHECK:STDOUT: %int_32.loc21_22: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32.loc21_22: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %impl.elem0.loc21: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] -// CHECK:STDOUT: %bound_method.loc21_21.1: = bound_method %int_0.loc21, %impl.elem0.loc21 [concrete = constants.%Convert.bound.d04] -// CHECK:STDOUT: %specific_fn.loc21: = specific_function %impl.elem0.loc21, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc21_21.2: = bound_method %int_0.loc21, %specific_fn.loc21 [concrete = constants.%bound_method.b6e] +// CHECK:STDOUT: %impl.elem0.loc21_21: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc21_21.1: = bound_method %int_0.loc21, %impl.elem0.loc21_21 [concrete = constants.%Convert.bound.d04] +// CHECK:STDOUT: %specific_fn.loc21_21: = specific_function %impl.elem0.loc21_21, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc21_21.2: = bound_method %int_0.loc21, %specific_fn.loc21_21 [concrete = constants.%bound_method.b6e] // CHECK:STDOUT: %int.convert_checked.loc21: init %i32 = call %bound_method.loc21_21.2(%int_0.loc21) [concrete = constants.%int_0.6a9] // CHECK:STDOUT: %.loc21_21.1: %i32 = value_of_initializer %int.convert_checked.loc21 [concrete = constants.%int_0.6a9] // CHECK:STDOUT: %.loc21_21.2: %i32 = converted %int_0.loc21, %.loc21_21.1 [concrete = constants.%int_0.6a9] @@ -241,6 +263,18 @@ fn ValueBinding(b: array(i32, 3)) { // CHECK:STDOUT: %int.convert_checked.loc22_8: init %i32 = call %bound_method.loc22_8.2(%int_4) [concrete = constants.%int_4.940] // CHECK:STDOUT: %.loc22_8: init %i32 = converted %int_4, %int.convert_checked.loc22_8 [concrete = constants.%int_4.940] // CHECK:STDOUT: assign %.loc22_6, %.loc22_8 +// CHECK:STDOUT: %impl.elem0.loc21_3: %.a79 = impl_witness_access constants.%Destroy.impl_witness.711, element0 [concrete = constants.%Op.649] +// CHECK:STDOUT: %bound_method.loc21_3.1: = bound_method %pa.var, %impl.elem0.loc21_3 +// CHECK:STDOUT: %specific_fn.loc21_3: = specific_function %impl.elem0.loc21_3, @Op.3(constants.%ptr.235) [concrete = constants.%Op.specific_fn.829] +// CHECK:STDOUT: %bound_method.loc21_3.2: = bound_method %pa.var, %specific_fn.loc21_3 +// CHECK:STDOUT: %.loc21_3: %ptr.235 = bind_value %pa.var +// CHECK:STDOUT: %no_op.loc21: init %empty_tuple.type = call %bound_method.loc21_3.2(%.loc21_3) +// CHECK:STDOUT: %impl.elem0.loc18_3: %.9c9 = impl_witness_access constants.%Destroy.impl_witness.14a, element0 [concrete = constants.%Op.f0b] +// CHECK:STDOUT: %bound_method.loc18_3.1: = bound_method %a.var, %impl.elem0.loc18_3 +// CHECK:STDOUT: %specific_fn.loc18_3: = specific_function %impl.elem0.loc18_3, @Op.3(constants.%array_type) [concrete = constants.%Op.specific_fn.c51] +// CHECK:STDOUT: %bound_method.loc18_3.2: = bound_method %a.var, %specific_fn.loc18_3 +// CHECK:STDOUT: %.loc18_3.2: %array_type = bind_value %a.var +// CHECK:STDOUT: %no_op.loc18: init %empty_tuple.type = call %bound_method.loc18_3.2(%.loc18_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -283,8 +317,8 @@ fn ValueBinding(b: array(i32, 3)) { // CHECK:STDOUT: %.loc26_34.9: ref %i32 = array_index %a.var, %int_2.loc26_34 // CHECK:STDOUT: %.loc26_34.10: init %i32 = initialize_from %.loc26_34.8 to %.loc26_34.9 [concrete = constants.%int_3.822] // CHECK:STDOUT: %.loc26_34.11: init %array_type = array_init (%.loc26_34.4, %.loc26_34.7, %.loc26_34.10) to %a.var [concrete = constants.%array] -// CHECK:STDOUT: %.loc26_3: init %array_type = converted %.loc26_34.1, %.loc26_34.11 [concrete = constants.%array] -// CHECK:STDOUT: assign %a.var, %.loc26_3 +// CHECK:STDOUT: %.loc26_3.1: init %array_type = converted %.loc26_34.1, %.loc26_34.11 [concrete = constants.%array] +// CHECK:STDOUT: assign %a.var, %.loc26_3.1 // CHECK:STDOUT: %.loc26_22: type = splice_block %array_type.loc26 [concrete = constants.%array_type] { // CHECK:STDOUT: %int_32.loc26: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32.loc26: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] @@ -325,15 +359,27 @@ fn ValueBinding(b: array(i32, 3)) { // CHECK:STDOUT: %.loc32_5.2: ref %array_type = temporary %.loc32_5.1, %F.call // CHECK:STDOUT: %int_32.loc32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32.loc32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %impl.elem0.loc32: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] -// CHECK:STDOUT: %bound_method.loc32_7.1: = bound_method %int_0.loc32, %impl.elem0.loc32 [concrete = constants.%Convert.bound.d04] -// CHECK:STDOUT: %specific_fn.loc32: = specific_function %impl.elem0.loc32, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc32_7.2: = bound_method %int_0.loc32, %specific_fn.loc32 [concrete = constants.%bound_method.b6e] +// CHECK:STDOUT: %impl.elem0.loc32_7: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc32_7.1: = bound_method %int_0.loc32, %impl.elem0.loc32_7 [concrete = constants.%Convert.bound.d04] +// CHECK:STDOUT: %specific_fn.loc32_7: = specific_function %impl.elem0.loc32_7, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc32_7.2: = bound_method %int_0.loc32, %specific_fn.loc32_7 [concrete = constants.%bound_method.b6e] // CHECK:STDOUT: %int.convert_checked.loc32: init %i32 = call %bound_method.loc32_7.2(%int_0.loc32) [concrete = constants.%int_0.6a9] // CHECK:STDOUT: %.loc32_7.1: %i32 = value_of_initializer %int.convert_checked.loc32 [concrete = constants.%int_0.6a9] // CHECK:STDOUT: %.loc32_7.2: %i32 = converted %int_0.loc32, %.loc32_7.1 [concrete = constants.%int_0.6a9] // CHECK:STDOUT: %.loc32_8.1: ref %i32 = array_index %.loc32_5.2, %.loc32_7.2 // CHECK:STDOUT: %.loc32_8.2: %i32 = bind_value %.loc32_8.1 +// CHECK:STDOUT: %impl.elem0.loc32_5: %.9c9 = impl_witness_access constants.%Destroy.impl_witness.14a, element0 [concrete = constants.%Op.f0b] +// CHECK:STDOUT: %bound_method.loc32_5.1: = bound_method %.loc32_5.1, %impl.elem0.loc32_5 +// CHECK:STDOUT: %specific_fn.loc32_5: = specific_function %impl.elem0.loc32_5, @Op.3(constants.%array_type) [concrete = constants.%Op.specific_fn.c51] +// CHECK:STDOUT: %bound_method.loc32_5.2: = bound_method %.loc32_5.1, %specific_fn.loc32_5 +// CHECK:STDOUT: %.loc32_5.3: %array_type = bind_value %.loc32_5.1 +// CHECK:STDOUT: %no_op.loc32: init %empty_tuple.type = call %bound_method.loc32_5.2(%.loc32_5.3) +// CHECK:STDOUT: %impl.elem0.loc26_3: %.9c9 = impl_witness_access constants.%Destroy.impl_witness.14a, element0 [concrete = constants.%Op.f0b] +// CHECK:STDOUT: %bound_method.loc26_3.1: = bound_method %a.var, %impl.elem0.loc26_3 +// CHECK:STDOUT: %specific_fn.loc26_3: = specific_function %impl.elem0.loc26_3, @Op.3(constants.%array_type) [concrete = constants.%Op.specific_fn.c51] +// CHECK:STDOUT: %bound_method.loc26_3.2: = bound_method %a.var, %specific_fn.loc26_3 +// CHECK:STDOUT: %.loc26_3.2: %array_type = bind_value %a.var +// CHECK:STDOUT: %no_op.loc26: init %empty_tuple.type = call %bound_method.loc26_3.2(%.loc26_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/index/fail_expr_category.carbon b/toolchain/check/testdata/index/fail_expr_category.carbon index f28ead6e4d57..68e2f3e21825 100644 --- a/toolchain/check/testdata/index/fail_expr_category.carbon +++ b/toolchain/check/testdata/index/fail_expr_category.carbon @@ -46,6 +46,7 @@ fn G(b: array(i32, 3)) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete] @@ -78,12 +79,30 @@ fn G(b: array(i32, 3)) { // CHECK:STDOUT: %Convert.bound.ac3: = bound_method %int_4.0c1, %Convert.956 [concrete] // CHECK:STDOUT: %bound_method.1da: = bound_method %int_4.0c1, %Convert.specific_fn [concrete] // CHECK:STDOUT: %int_4.940: %i32 = int_value 4 [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.2 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.3, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.14a: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%array_type) [concrete] +// CHECK:STDOUT: %Op.type.1e4: type = fn_type @Op.3, @impl.49c(%array_type) [concrete] +// CHECK:STDOUT: %Op.f0b: %Op.type.1e4 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.75f: %Destroy.type = facet_value %array_type, (%Destroy.impl_witness.14a) [concrete] +// CHECK:STDOUT: %.9c9: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.75f [concrete] +// CHECK:STDOUT: %Op.specific_fn.c51: = specific_function %Op.f0b, @Op.3(%array_type) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.711: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%ptr.235) [concrete] +// CHECK:STDOUT: %Op.type.ba2: type = fn_type @Op.3, @impl.49c(%ptr.235) [concrete] +// CHECK:STDOUT: %Op.649: %Op.type.ba2 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.2bf: %Destroy.type = facet_value %ptr.235, (%Destroy.impl_witness.711) [concrete] +// CHECK:STDOUT: %.a79: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.2bf [concrete] +// CHECK:STDOUT: %Op.specific_fn.829: = specific_function %Op.649, @Op.3(%ptr.235) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Int = %Core.Int // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -91,6 +110,9 @@ fn G(b: array(i32, 3)) { // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -139,10 +161,10 @@ fn G(b: array(i32, 3)) { // CHECK:STDOUT: %int_0.loc23: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] // CHECK:STDOUT: %int_32.loc23_22: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32.loc23_22: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %impl.elem0.loc23: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] -// CHECK:STDOUT: %bound_method.loc23_21.1: = bound_method %int_0.loc23, %impl.elem0.loc23 [concrete = constants.%Convert.bound.d04] -// CHECK:STDOUT: %specific_fn.loc23: = specific_function %impl.elem0.loc23, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc23_21.2: = bound_method %int_0.loc23, %specific_fn.loc23 [concrete = constants.%bound_method.b6e] +// CHECK:STDOUT: %impl.elem0.loc23_21: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc23_21.1: = bound_method %int_0.loc23, %impl.elem0.loc23_21 [concrete = constants.%Convert.bound.d04] +// CHECK:STDOUT: %specific_fn.loc23_21: = specific_function %impl.elem0.loc23_21, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc23_21.2: = bound_method %int_0.loc23, %specific_fn.loc23_21 [concrete = constants.%bound_method.b6e] // CHECK:STDOUT: %int.convert_checked.loc23: init %i32 = call %bound_method.loc23_21.2(%int_0.loc23) [concrete = constants.%int_0.6a9] // CHECK:STDOUT: %.loc23_21.1: %i32 = value_of_initializer %int.convert_checked.loc23 [concrete = constants.%int_0.6a9] // CHECK:STDOUT: %.loc23_21.2: %i32 = converted %int_0.loc23, %.loc23_21.1 [concrete = constants.%int_0.6a9] @@ -191,10 +213,10 @@ fn G(b: array(i32, 3)) { // CHECK:STDOUT: %.loc36_21.2: ref %array_type = temporary %.loc36_21.1, %F.call.loc36 // CHECK:STDOUT: %int_32.loc36_24: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32.loc36_24: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %impl.elem0.loc36: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] -// CHECK:STDOUT: %bound_method.loc36_23.1: = bound_method %int_0.loc36, %impl.elem0.loc36 [concrete = constants.%Convert.bound.d04] -// CHECK:STDOUT: %specific_fn.loc36: = specific_function %impl.elem0.loc36, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc36_23.2: = bound_method %int_0.loc36, %specific_fn.loc36 [concrete = constants.%bound_method.b6e] +// CHECK:STDOUT: %impl.elem0.loc36_23: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc36_23.1: = bound_method %int_0.loc36, %impl.elem0.loc36_23 [concrete = constants.%Convert.bound.d04] +// CHECK:STDOUT: %specific_fn.loc36_23: = specific_function %impl.elem0.loc36_23, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc36_23.2: = bound_method %int_0.loc36, %specific_fn.loc36_23 [concrete = constants.%bound_method.b6e] // CHECK:STDOUT: %int.convert_checked.loc36: init %i32 = call %bound_method.loc36_23.2(%int_0.loc36) [concrete = constants.%int_0.6a9] // CHECK:STDOUT: %.loc36_23.1: %i32 = value_of_initializer %int.convert_checked.loc36 [concrete = constants.%int_0.6a9] // CHECK:STDOUT: %.loc36_23.2: %i32 = converted %int_0.loc36, %.loc36_23.1 [concrete = constants.%int_0.6a9] @@ -232,6 +254,30 @@ fn G(b: array(i32, 3)) { // CHECK:STDOUT: %int.convert_checked.loc41_10: init %i32 = call %bound_method.loc41_10.2(%int_4.loc41) [concrete = constants.%int_4.940] // CHECK:STDOUT: %.loc41_10: init %i32 = converted %int_4.loc41, %int.convert_checked.loc41_10 [concrete = constants.%int_4.940] // CHECK:STDOUT: assign %.loc41_8.2, %.loc41_10 +// CHECK:STDOUT: %impl.elem0.loc41_5: %.9c9 = impl_witness_access constants.%Destroy.impl_witness.14a, element0 [concrete = constants.%Op.f0b] +// CHECK:STDOUT: %bound_method.loc41_5.1: = bound_method %.loc41_5.1, %impl.elem0.loc41_5 +// CHECK:STDOUT: %specific_fn.loc41_5: = specific_function %impl.elem0.loc41_5, @Op.3(constants.%array_type) [concrete = constants.%Op.specific_fn.c51] +// CHECK:STDOUT: %bound_method.loc41_5.2: = bound_method %.loc41_5.1, %specific_fn.loc41_5 +// CHECK:STDOUT: %.loc41_5.3: %array_type = bind_value %.loc41_5.1 +// CHECK:STDOUT: %no_op.loc41: init %empty_tuple.type = call %bound_method.loc41_5.2(%.loc41_5.3) +// CHECK:STDOUT: %impl.elem0.loc36_21: %.9c9 = impl_witness_access constants.%Destroy.impl_witness.14a, element0 [concrete = constants.%Op.f0b] +// CHECK:STDOUT: %bound_method.loc36_21.1: = bound_method %.loc36_21.1, %impl.elem0.loc36_21 +// CHECK:STDOUT: %specific_fn.loc36_21: = specific_function %impl.elem0.loc36_21, @Op.3(constants.%array_type) [concrete = constants.%Op.specific_fn.c51] +// CHECK:STDOUT: %bound_method.loc36_21.2: = bound_method %.loc36_21.1, %specific_fn.loc36_21 +// CHECK:STDOUT: %.loc36_21.3: %array_type = bind_value %.loc36_21.1 +// CHECK:STDOUT: %no_op.loc36_21: init %empty_tuple.type = call %bound_method.loc36_21.2(%.loc36_21.3) +// CHECK:STDOUT: %impl.elem0.loc36_3: %.a79 = impl_witness_access constants.%Destroy.impl_witness.711, element0 [concrete = constants.%Op.649] +// CHECK:STDOUT: %bound_method.loc36_3.1: = bound_method %pf.var, %impl.elem0.loc36_3 +// CHECK:STDOUT: %specific_fn.loc36_3: = specific_function %impl.elem0.loc36_3, @Op.3(constants.%ptr.235) [concrete = constants.%Op.specific_fn.829] +// CHECK:STDOUT: %bound_method.loc36_3.2: = bound_method %pf.var, %specific_fn.loc36_3 +// CHECK:STDOUT: %.loc36_3: %ptr.235 = bind_value %pf.var +// CHECK:STDOUT: %no_op.loc36_3: init %empty_tuple.type = call %bound_method.loc36_3.2(%.loc36_3) +// CHECK:STDOUT: %impl.elem0.loc23_3: %.a79 = impl_witness_access constants.%Destroy.impl_witness.711, element0 [concrete = constants.%Op.649] +// CHECK:STDOUT: %bound_method.loc23_3.1: = bound_method %pb.var, %impl.elem0.loc23_3 +// CHECK:STDOUT: %specific_fn.loc23_3: = specific_function %impl.elem0.loc23_3, @Op.3(constants.%ptr.235) [concrete = constants.%Op.specific_fn.829] +// CHECK:STDOUT: %bound_method.loc23_3.2: = bound_method %pb.var, %specific_fn.loc23_3 +// CHECK:STDOUT: %.loc23_3: %ptr.235 = bind_value %pb.var +// CHECK:STDOUT: %no_op.loc23: init %empty_tuple.type = call %bound_method.loc23_3.2(%.loc23_3) // CHECK:STDOUT: return // CHECK:STDOUT: } // 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 4a688db83a65..70e4d31af23e 100644 --- a/toolchain/check/testdata/index/fail_name_not_found.carbon +++ b/toolchain/check/testdata/index/fail_name_not_found.carbon @@ -24,6 +24,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Main.type: type = fn_type @Main [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Main: %Main.type = struct_value () [concrete] // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] @@ -31,15 +32,30 @@ fn Main() { // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete] // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.3, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.64e: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.type.a17: type = fn_type @Op.3, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.e6a: %Op.type.a17 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %i32, (%Destroy.impl_witness.64e) [concrete] +// CHECK:STDOUT: %.ab7: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.e6a, @Op.3(%i32) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -62,11 +78,17 @@ fn Main() { // CHECK:STDOUT: %a.ref: = name_ref a, [concrete = ] // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] // CHECK:STDOUT: assign %b.var, -// CHECK:STDOUT: %.loc20: type = splice_block %i32 [concrete = constants.%i32] { +// CHECK:STDOUT: %.loc20_10: type = splice_block %i32 [concrete = constants.%i32] { // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: %b: ref %i32 = bind_name b, %b.var +// CHECK:STDOUT: %impl.elem0: %.ab7 = impl_witness_access constants.%Destroy.impl_witness.64e, element0 [concrete = constants.%Op.e6a] +// CHECK:STDOUT: %bound_method.loc20_3.1: = bound_method %b.var, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.3(constants.%i32) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc20_3.2: = bound_method %b.var, %specific_fn +// CHECK:STDOUT: %.loc20_3: %i32 = bind_value %b.var +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc20_3.2(%.loc20_3) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/as_type_of_type.carbon b/toolchain/check/testdata/interface/as_type_of_type.carbon index f0b9a016a2ff..52b78c3563ef 100644 --- a/toolchain/check/testdata/interface/as_type_of_type.carbon +++ b/toolchain/check/testdata/interface/as_type_of_type.carbon @@ -22,20 +22,31 @@ fn F(T:! Empty) { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Empty.type: type = facet_type <@Empty> [concrete] -// CHECK:STDOUT: %Self: %Empty.type = bind_symbolic_name Self, 0 [symbolic] -// CHECK:STDOUT: %T: %Empty.type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Self.193: %Empty.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %T.193: %Empty.type = bind_symbolic_name T, 0 [symbolic] // CHECK:STDOUT: %pattern_type.6c3: type = pattern_type %Empty.type [concrete] // CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] -// CHECK:STDOUT: %T.as_type: type = facet_access_type %T [symbolic] -// CHECK:STDOUT: %require_complete: = require_complete_type %T.as_type [symbolic] +// CHECK:STDOUT: %T.as_type: type = facet_access_type %T.193 [symbolic] +// CHECK:STDOUT: %require_complete.449: = require_complete_type %T.as_type [symbolic] // CHECK:STDOUT: %pattern_type.dad: type = pattern_type %T.as_type [symbolic] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %T.193, @Destroy [symbolic] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %T.as_type, (%Destroy.lookup_impl_witness) [symbolic] +// CHECK:STDOUT: %.868: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [symbolic] +// CHECK:STDOUT: %impl.elem0: %.868 = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic] +// CHECK:STDOUT: %specific_impl_fn: = specific_impl_function %impl.elem0, @Op.1(%Destroy.facet) [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -50,12 +61,12 @@ fn F(T:! Empty) { // CHECK:STDOUT: %T.patt: %pattern_type.6c3 = symbolic_binding_pattern T, 0 [concrete] // CHECK:STDOUT: } { // CHECK:STDOUT: %Empty.ref: type = name_ref Empty, file.%Empty.decl [concrete = constants.%Empty.type] -// CHECK:STDOUT: %T.loc17_6.1: %Empty.type = bind_symbolic_name T, 0 [symbolic = %T.loc17_6.2 (constants.%T)] +// CHECK:STDOUT: %T.loc17_6.1: %Empty.type = bind_symbolic_name T, 0 [symbolic = %T.loc17_6.2 (constants.%T.193)] // CHECK:STDOUT: } // 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.193] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self @@ -63,12 +74,17 @@ fn F(T:! Empty) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @F(%T.loc17_6.1: %Empty.type) { -// CHECK:STDOUT: %T.loc17_6.2: %Empty.type = bind_symbolic_name T, 0 [symbolic = %T.loc17_6.2 (constants.%T)] +// CHECK:STDOUT: %T.loc17_6.2: %Empty.type = bind_symbolic_name T, 0 [symbolic = %T.loc17_6.2 (constants.%T.193)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %T.as_type.loc18_10.2: type = facet_access_type %T.loc17_6.2 [symbolic = %T.as_type.loc18_10.2 (constants.%T.as_type)] -// CHECK:STDOUT: %require_complete: = require_complete_type %T.as_type.loc18_10.2 [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %require_complete: = require_complete_type %T.as_type.loc18_10.2 [symbolic = %require_complete (constants.%require_complete.449)] // CHECK:STDOUT: %pattern_type: type = pattern_type %T.as_type.loc18_10.2 [symbolic = %pattern_type (constants.%pattern_type.dad)] +// CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %T.loc17_6.2, @Destroy [symbolic = %Destroy.lookup_impl_witness (constants.%Destroy.lookup_impl_witness)] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %T.as_type.loc18_10.2, (%Destroy.lookup_impl_witness) [symbolic = %Destroy.facet (constants.%Destroy.facet)] +// CHECK:STDOUT: %.loc18_3.4: type = fn_type_with_self_type constants.%Op.type.bae, %Destroy.facet [symbolic = %.loc18_3.4 (constants.%.868)] +// CHECK:STDOUT: %impl.elem0.loc18_3.2: @F.%.loc18_3.4 (%.868) = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc18_3.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %specific_impl_fn.loc18_3.2: = specific_impl_function %impl.elem0.loc18_3.2, @Op.1(%Destroy.facet) [symbolic = %specific_impl_fn.loc18_3.2 (constants.%specific_impl_fn)] // CHECK:STDOUT: // CHECK:STDOUT: fn() { // CHECK:STDOUT: !entry: @@ -78,16 +94,24 @@ fn F(T:! Empty) { // CHECK:STDOUT: } // CHECK:STDOUT: %x.var: ref @F.%T.as_type.loc18_10.2 (%T.as_type) = var %x.var_patt // CHECK:STDOUT: %.loc18_10.1: type = splice_block %.loc18_10.2 [symbolic = %T.as_type.loc18_10.2 (constants.%T.as_type)] { -// CHECK:STDOUT: %T.ref: %Empty.type = name_ref T, %T.loc17_6.1 [symbolic = %T.loc17_6.2 (constants.%T)] +// CHECK:STDOUT: %T.ref: %Empty.type = name_ref T, %T.loc17_6.1 [symbolic = %T.loc17_6.2 (constants.%T.193)] // CHECK:STDOUT: %T.as_type.loc18_10.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc18_10.2 (constants.%T.as_type)] // CHECK:STDOUT: %.loc18_10.2: type = converted %T.ref, %T.as_type.loc18_10.1 [symbolic = %T.as_type.loc18_10.2 (constants.%T.as_type)] // CHECK:STDOUT: } // CHECK:STDOUT: %x: ref @F.%T.as_type.loc18_10.2 (%T.as_type) = bind_name x, %x.var +// CHECK:STDOUT: %T.as_type.loc18_3: type = facet_access_type constants.%T.193 [symbolic = %T.as_type.loc18_10.2 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc18_3.1: type = converted constants.%T.193, %T.as_type.loc18_3 [symbolic = %T.as_type.loc18_10.2 (constants.%T.as_type)] +// CHECK:STDOUT: %impl.elem0.loc18_3.1: @F.%.loc18_3.4 (%.868) = impl_witness_access constants.%Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc18_3.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %bound_method.loc18_3.1: = bound_method %x.var, %impl.elem0.loc18_3.1 +// CHECK:STDOUT: %specific_impl_fn.loc18_3.1: = specific_impl_function %impl.elem0.loc18_3.1, @Op.1(constants.%Destroy.facet) [symbolic = %specific_impl_fn.loc18_3.2 (constants.%specific_impl_fn)] +// CHECK:STDOUT: %bound_method.loc18_3.2: = bound_method %x.var, %specific_impl_fn.loc18_3.1 +// CHECK:STDOUT: %.loc18_3.2: @F.%T.as_type.loc18_10.2 (%T.as_type) = bind_value %x.var +// CHECK:STDOUT: %.loc18_3.3: init %empty_tuple.type = call %bound_method.loc18_3.2(%.loc18_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F(constants.%T) { -// CHECK:STDOUT: %T.loc17_6.2 => constants.%T +// CHECK:STDOUT: specific @F(constants.%T.193) { +// CHECK:STDOUT: %T.loc17_6.2 => constants.%T.193 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/compound_member_access.carbon b/toolchain/check/testdata/interface/compound_member_access.carbon index ac944454e2b1..abf6d23d77be 100644 --- a/toolchain/check/testdata/interface/compound_member_access.carbon +++ b/toolchain/check/testdata/interface/compound_member_access.carbon @@ -634,28 +634,28 @@ fn Works() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %L1.type: type = facet_type <@L1> [concrete] -// CHECK:STDOUT: %Self: %L1.type = bind_symbolic_name Self, 0 [symbolic] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] -// CHECK:STDOUT: %pattern_type.ad3e89.1: type = pattern_type %Self.as_type [symbolic] +// CHECK:STDOUT: %Self.04c: %L1.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self.as_type.759: type = facet_access_type %Self.04c [symbolic] +// CHECK:STDOUT: %pattern_type.ad3e89.1: type = pattern_type %Self.as_type.759 [symbolic] // CHECK:STDOUT: %R1.type: type = fn_type @R1 [concrete] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %R1: %R1.type = struct_value () [concrete] // CHECK:STDOUT: %L1.assoc_type: type = assoc_entity_type @L1 [concrete] -// CHECK:STDOUT: %assoc0: %L1.assoc_type = assoc_entity element0, @L1.%R1.decl [concrete] -// CHECK:STDOUT: %ptr.72f01d.1: type = ptr_type %Self.as_type [symbolic] +// CHECK:STDOUT: %assoc0.8b4: %L1.assoc_type = assoc_entity element0, @L1.%R1.decl [concrete] +// CHECK:STDOUT: %ptr.72f01d.1: type = ptr_type %Self.as_type.759 [symbolic] // CHECK:STDOUT: %pattern_type.53384b.1: type = pattern_type %ptr.72f01d.1 [symbolic] // CHECK:STDOUT: %pattern_type.f6d: type = pattern_type auto [concrete] // CHECK:STDOUT: %S1.type: type = fn_type @S1 [concrete] // CHECK:STDOUT: %S1: %S1.type = struct_value () [concrete] // CHECK:STDOUT: %assoc1: %L1.assoc_type = assoc_entity element1, @L1.%S1.decl [concrete] -// CHECK:STDOUT: %T: %L1.type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %T.04c: %L1.type = bind_symbolic_name T, 0 [symbolic] // CHECK:STDOUT: %pattern_type.5da: type = pattern_type %L1.type [concrete] -// CHECK:STDOUT: %T.as_type: type = facet_access_type %T [symbolic] +// CHECK:STDOUT: %T.as_type: type = facet_access_type %T.04c [symbolic] // CHECK:STDOUT: %pattern_type.ad3e89.2: type = pattern_type %T.as_type [symbolic] // CHECK:STDOUT: %Simple4.type: type = fn_type @Simple4 [concrete] // CHECK:STDOUT: %Simple4: %Simple4.type = struct_value () [concrete] // CHECK:STDOUT: %require_complete.97cd40.1: = require_complete_type %T.as_type [symbolic] -// CHECK:STDOUT: %L1.lookup_impl_witness.0a136b.1: = lookup_impl_witness %T, @L1 [symbolic] +// CHECK:STDOUT: %L1.lookup_impl_witness.0a136b.1: = lookup_impl_witness %T.04c, @L1 [symbolic] // CHECK:STDOUT: %L1.facet.ed78cc.1: %L1.type = facet_value %T.as_type, (%L1.lookup_impl_witness.0a136b.1) [symbolic] // CHECK:STDOUT: %.3b7304.1: type = fn_type_with_self_type %R1.type, %L1.facet.ed78cc.1 [symbolic] // CHECK:STDOUT: %impl.elem0.a7f881.1: %.3b7304.1 = impl_witness_access %L1.lookup_impl_witness.0a136b.1, element0 [symbolic] @@ -666,6 +666,13 @@ fn Works() { // CHECK:STDOUT: %pattern_type.53384b.2: type = pattern_type %ptr.72f01d.2 [symbolic] // CHECK:STDOUT: %specific_impl_fn.bbb82e.1: = specific_impl_function %impl.elem1.a8c6e3.1, @S1(%L1.facet.ed78cc.1) [symbolic] // CHECK:STDOUT: %require_complete.9326df.1: = require_complete_type %ptr.72f01d.2 [symbolic] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %Destroy.lookup_impl_witness.87177a.1: = lookup_impl_witness %T.04c, @Destroy [symbolic] +// CHECK:STDOUT: %Destroy.facet.a7da23.1: %Destroy.type = facet_value %T.as_type, (%Destroy.lookup_impl_witness.87177a.1) [symbolic] +// CHECK:STDOUT: %.0f4deb.1: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.a7da23.1 [symbolic] +// CHECK:STDOUT: %impl.elem0.71dfa9.1: %.0f4deb.1 = impl_witness_access %Destroy.lookup_impl_witness.87177a.1, element0 [symbolic] +// CHECK:STDOUT: %specific_impl_fn.5803ed.1: = specific_impl_function %impl.elem0.71dfa9.1, @Op.1(%Destroy.facet.a7da23.1) [symbolic] // CHECK:STDOUT: %V: %L1.type = bind_symbolic_name V, 0 [symbolic] // CHECK:STDOUT: %V.as_type: type = facet_access_type %V [symbolic] // CHECK:STDOUT: %pattern_type.ad3e89.3: type = pattern_type %V.as_type [symbolic] @@ -683,13 +690,20 @@ fn Works() { // CHECK:STDOUT: %pattern_type.53384b.3: type = pattern_type %ptr.72f01d.3 [symbolic] // CHECK:STDOUT: %specific_impl_fn.bbb82e.2: = specific_impl_function %impl.elem1.a8c6e3.2, @S1(%L1.facet.ed78cc.2) [symbolic] // CHECK:STDOUT: %require_complete.9326df.2: = require_complete_type %ptr.72f01d.3 [symbolic] +// CHECK:STDOUT: %Destroy.lookup_impl_witness.87177a.2: = lookup_impl_witness %V, @Destroy [symbolic] +// CHECK:STDOUT: %Destroy.facet.a7da23.2: %Destroy.type = facet_value %V.as_type, (%Destroy.lookup_impl_witness.87177a.2) [symbolic] +// CHECK:STDOUT: %.0f4deb.2: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.a7da23.2 [symbolic] +// CHECK:STDOUT: %impl.elem0.71dfa9.2: %.0f4deb.2 = impl_witness_access %Destroy.lookup_impl_witness.87177a.2, element0 [symbolic] +// CHECK:STDOUT: %specific_impl_fn.5803ed.2: = specific_impl_function %impl.elem0.71dfa9.2, @Op.1(%Destroy.facet.a7da23.2) [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -707,10 +721,10 @@ fn Works() { // CHECK:STDOUT: %x.param_patt: @Simple4.%pattern_type (%pattern_type.ad3e89.2) = value_param_pattern %x.patt, call_param0 [concrete] // CHECK:STDOUT: } { // CHECK:STDOUT: %L1.ref: type = name_ref L1, file.%L1.decl [concrete = constants.%L1.type] -// CHECK:STDOUT: %T.loc9_12.1: %L1.type = bind_symbolic_name T, 0 [symbolic = %T.loc9_12.2 (constants.%T)] +// CHECK:STDOUT: %T.loc9_12.1: %L1.type = bind_symbolic_name T, 0 [symbolic = %T.loc9_12.2 (constants.%T.04c)] // CHECK:STDOUT: %x.param: @Simple4.%T.as_type.loc9_23.2 (%T.as_type) = value_param call_param0 // CHECK:STDOUT: %.loc9_23.1: type = splice_block %.loc9_23.2 [symbolic = %T.as_type.loc9_23.2 (constants.%T.as_type)] { -// CHECK:STDOUT: %T.ref.loc9: %L1.type = name_ref T, %T.loc9_12.1 [symbolic = %T.loc9_12.2 (constants.%T)] +// CHECK:STDOUT: %T.ref.loc9: %L1.type = name_ref T, %T.loc9_12.1 [symbolic = %T.loc9_12.2 (constants.%T.04c)] // CHECK:STDOUT: %T.as_type.loc9_23.1: type = facet_access_type %T.ref.loc9 [symbolic = %T.as_type.loc9_23.2 (constants.%T.as_type)] // CHECK:STDOUT: %.loc9_23.2: type = converted %T.ref.loc9, %T.as_type.loc9_23.1 [symbolic = %T.as_type.loc9_23.2 (constants.%T.as_type)] // CHECK:STDOUT: } @@ -734,20 +748,20 @@ fn Works() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @L1 { -// CHECK:STDOUT: %Self: %L1.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] +// CHECK:STDOUT: %Self: %L1.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.04c] // CHECK:STDOUT: %R1.decl: %R1.type = fn_decl @R1 [concrete = constants.%R1] { // CHECK:STDOUT: %self.patt: @R1.%pattern_type (%pattern_type.ad3e89.1) = binding_pattern self [concrete] // CHECK:STDOUT: %self.param_patt: @R1.%pattern_type (%pattern_type.ad3e89.1) = value_param_pattern %self.patt, call_param0 [concrete] // CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: @R1.%Self.as_type.loc4_15.1 (%Self.as_type) = value_param call_param0 -// CHECK:STDOUT: %.loc4_15.1: type = splice_block %.loc4_15.2 [symbolic = %Self.as_type.loc4_15.1 (constants.%Self.as_type)] { -// CHECK:STDOUT: %Self.ref: %L1.type = name_ref Self, @L1.%Self [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc4_15.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc4_15.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %.loc4_15.2: type = converted %Self.ref, %Self.as_type.loc4_15.2 [symbolic = %Self.as_type.loc4_15.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %self.param: @R1.%Self.as_type.loc4_15.1 (%Self.as_type.759) = value_param call_param0 +// CHECK:STDOUT: %.loc4_15.1: type = splice_block %.loc4_15.2 [symbolic = %Self.as_type.loc4_15.1 (constants.%Self.as_type.759)] { +// CHECK:STDOUT: %Self.ref: %L1.type = name_ref Self, @L1.%Self [symbolic = %Self (constants.%Self.04c)] +// CHECK:STDOUT: %Self.as_type.loc4_15.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc4_15.1 (constants.%Self.as_type.759)] +// CHECK:STDOUT: %.loc4_15.2: type = converted %Self.ref, %Self.as_type.loc4_15.2 [symbolic = %Self.as_type.loc4_15.1 (constants.%Self.as_type.759)] // CHECK:STDOUT: } -// CHECK:STDOUT: %self: @R1.%Self.as_type.loc4_15.1 (%Self.as_type) = bind_name self, %self.param +// CHECK:STDOUT: %self: @R1.%Self.as_type.loc4_15.1 (%Self.as_type.759) = bind_name self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %assoc0: %L1.assoc_type = assoc_entity element0, %R1.decl [concrete = constants.%assoc0] +// CHECK:STDOUT: %assoc0: %L1.assoc_type = assoc_entity element0, %R1.decl [concrete = constants.%assoc0.8b4] // CHECK:STDOUT: %S1.decl: %S1.type = fn_decl @S1 [concrete = constants.%S1] { // CHECK:STDOUT: %self.patt: @S1.%pattern_type (%pattern_type.53384b.1) = binding_pattern self [concrete] // CHECK:STDOUT: %self.param_patt: @S1.%pattern_type (%pattern_type.53384b.1) = value_param_pattern %self.patt, call_param0 [concrete] @@ -755,9 +769,9 @@ fn Works() { // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: @S1.%ptr.loc5_24.1 (%ptr.72f01d.1) = value_param call_param0 // CHECK:STDOUT: %.loc5_24.1: type = splice_block %ptr.loc5_24.2 [symbolic = %ptr.loc5_24.1 (constants.%ptr.72f01d.1)] { -// CHECK:STDOUT: %Self.ref: %L1.type = name_ref Self, @L1.%Self [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc5_24.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc5_24.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %.loc5_24.2: type = converted %Self.ref, %Self.as_type.loc5_24.2 [symbolic = %Self.as_type.loc5_24.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %Self.ref: %L1.type = name_ref Self, @L1.%Self [symbolic = %Self (constants.%Self.04c)] +// CHECK:STDOUT: %Self.as_type.loc5_24.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc5_24.1 (constants.%Self.as_type.759)] +// CHECK:STDOUT: %.loc5_24.2: type = converted %Self.ref, %Self.as_type.loc5_24.2 [symbolic = %Self.as_type.loc5_24.1 (constants.%Self.as_type.759)] // CHECK:STDOUT: %ptr.loc5_24.2: type = ptr_type %.loc5_24.2 [symbolic = %ptr.loc5_24.1 (constants.%ptr.72f01d.1)] // CHECK:STDOUT: } // CHECK:STDOUT: %self: @S1.%ptr.loc5_24.1 (%ptr.72f01d.1) = bind_name self, %self.param @@ -772,16 +786,16 @@ fn Works() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @R1(@L1.%Self: %L1.type) { -// CHECK:STDOUT: %Self: %L1.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc4_15.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc4_15.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %Self: %L1.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.04c)] +// CHECK:STDOUT: %Self.as_type.loc4_15.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc4_15.1 (constants.%Self.as_type.759)] // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type.loc4_15.1 [symbolic = %pattern_type (constants.%pattern_type.ad3e89.1)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%self.param: @R1.%Self.as_type.loc4_15.1 (%Self.as_type)); +// CHECK:STDOUT: fn(%self.param: @R1.%Self.as_type.loc4_15.1 (%Self.as_type.759)); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @S1(@L1.%Self: %L1.type) { -// CHECK:STDOUT: %Self: %L1.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc5_24.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc5_24.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %Self: %L1.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.04c)] +// CHECK:STDOUT: %Self.as_type.loc5_24.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc5_24.1 (constants.%Self.as_type.759)] // CHECK:STDOUT: %ptr.loc5_24.1: type = ptr_type %Self.as_type.loc5_24.1 [symbolic = %ptr.loc5_24.1 (constants.%ptr.72f01d.1)] // CHECK:STDOUT: %pattern_type: type = pattern_type %ptr.loc5_24.1 [symbolic = %pattern_type (constants.%pattern_type.53384b.1)] // CHECK:STDOUT: @@ -789,7 +803,7 @@ fn Works() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @Simple4(%T.loc9_12.1: %L1.type) { -// CHECK:STDOUT: %T.loc9_12.2: %L1.type = bind_symbolic_name T, 0 [symbolic = %T.loc9_12.2 (constants.%T)] +// CHECK:STDOUT: %T.loc9_12.2: %L1.type = bind_symbolic_name T, 0 [symbolic = %T.loc9_12.2 (constants.%T.04c)] // CHECK:STDOUT: %T.as_type.loc9_23.2: type = facet_access_type %T.loc9_12.2 [symbolic = %T.as_type.loc9_23.2 (constants.%T.as_type)] // CHECK:STDOUT: %pattern_type: type = pattern_type %T.as_type.loc9_23.2 [symbolic = %pattern_type (constants.%pattern_type.ad3e89.2)] // CHECK:STDOUT: @@ -805,13 +819,18 @@ fn Works() { // CHECK:STDOUT: %specific_impl_fn.loc12_8.2: = specific_impl_function %impl.elem1.loc12_8.2, @S1(%L1.facet) [symbolic = %specific_impl_fn.loc12_8.2 (constants.%specific_impl_fn.bbb82e.1)] // CHECK:STDOUT: %ptr: type = ptr_type %T.as_type.loc9_23.2 [symbolic = %ptr (constants.%ptr.72f01d.2)] // CHECK:STDOUT: %require_complete.loc12: = require_complete_type %ptr [symbolic = %require_complete.loc12 (constants.%require_complete.9326df.1)] +// CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %T.loc9_12.2, @Destroy [symbolic = %Destroy.lookup_impl_witness (constants.%Destroy.lookup_impl_witness.87177a.1)] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %T.as_type.loc9_23.2, (%Destroy.lookup_impl_witness) [symbolic = %Destroy.facet (constants.%Destroy.facet.a7da23.1)] +// CHECK:STDOUT: %.loc11_3.4: type = fn_type_with_self_type constants.%Op.type.bae, %Destroy.facet [symbolic = %.loc11_3.4 (constants.%.0f4deb.1)] +// CHECK:STDOUT: %impl.elem0.loc11_3.2: @Simple4.%.loc11_3.4 (%.0f4deb.1) = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc11_3.2 (constants.%impl.elem0.71dfa9.1)] +// CHECK:STDOUT: %specific_impl_fn.loc11_3.2: = specific_impl_function %impl.elem0.loc11_3.2, @Op.1(%Destroy.facet) [symbolic = %specific_impl_fn.loc11_3.2 (constants.%specific_impl_fn.5803ed.1)] // CHECK:STDOUT: // CHECK:STDOUT: fn(%x.param: @Simple4.%T.as_type.loc9_23.2 (%T.as_type)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %x.ref.loc10: @Simple4.%T.as_type.loc9_23.2 (%T.as_type) = name_ref x, %x -// CHECK:STDOUT: %R1.ref: %L1.assoc_type = name_ref R1, @L1.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %T.as_type.loc10: type = facet_access_type constants.%T [symbolic = %T.as_type.loc9_23.2 (constants.%T.as_type)] -// CHECK:STDOUT: %.loc10_4.1: type = converted constants.%T, %T.as_type.loc10 [symbolic = %T.as_type.loc9_23.2 (constants.%T.as_type)] +// CHECK:STDOUT: %R1.ref: %L1.assoc_type = name_ref R1, @L1.%assoc0 [concrete = constants.%assoc0.8b4] +// CHECK:STDOUT: %T.as_type.loc10: type = facet_access_type constants.%T.04c [symbolic = %T.as_type.loc9_23.2 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc10_4.1: type = converted constants.%T.04c, %T.as_type.loc10 [symbolic = %T.as_type.loc9_23.2 (constants.%T.as_type)] // CHECK:STDOUT: %impl.elem0.loc10_4.1: @Simple4.%.loc10_4.2 (%.3b7304.1) = impl_witness_access constants.%L1.lookup_impl_witness.0a136b.1, element0 [symbolic = %impl.elem0.loc10_4.2 (constants.%impl.elem0.a7f881.1)] // CHECK:STDOUT: %bound_method.loc10_4: = bound_method %x.ref.loc10, %impl.elem0.loc10_4.1 // CHECK:STDOUT: %specific_impl_fn.loc10_4.1: = specific_impl_function %impl.elem0.loc10_4.1, @R1(constants.%L1.facet.ed78cc.1) [symbolic = %specific_impl_fn.loc10_4.2 (constants.%specific_impl_fn.f11365.1)] @@ -825,21 +844,29 @@ fn Works() { // CHECK:STDOUT: %x.ref.loc11: @Simple4.%T.as_type.loc9_23.2 (%T.as_type) = name_ref x, %x // CHECK:STDOUT: assign %xcopy.var, %x.ref.loc11 // CHECK:STDOUT: %.loc11_14.1: type = splice_block %.loc11_14.2 [symbolic = %T.as_type.loc9_23.2 (constants.%T.as_type)] { -// CHECK:STDOUT: %T.ref.loc11: %L1.type = name_ref T, %T.loc9_12.1 [symbolic = %T.loc9_12.2 (constants.%T)] -// CHECK:STDOUT: %T.as_type.loc11: type = facet_access_type %T.ref.loc11 [symbolic = %T.as_type.loc9_23.2 (constants.%T.as_type)] -// CHECK:STDOUT: %.loc11_14.2: type = converted %T.ref.loc11, %T.as_type.loc11 [symbolic = %T.as_type.loc9_23.2 (constants.%T.as_type)] +// CHECK:STDOUT: %T.ref.loc11: %L1.type = name_ref T, %T.loc9_12.1 [symbolic = %T.loc9_12.2 (constants.%T.04c)] +// CHECK:STDOUT: %T.as_type.loc11_14: type = facet_access_type %T.ref.loc11 [symbolic = %T.as_type.loc9_23.2 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc11_14.2: type = converted %T.ref.loc11, %T.as_type.loc11_14 [symbolic = %T.as_type.loc9_23.2 (constants.%T.as_type)] // CHECK:STDOUT: } // CHECK:STDOUT: %xcopy: ref @Simple4.%T.as_type.loc9_23.2 (%T.as_type) = bind_name xcopy, %xcopy.var // CHECK:STDOUT: %xcopy.ref: ref @Simple4.%T.as_type.loc9_23.2 (%T.as_type) = name_ref xcopy, %xcopy // CHECK:STDOUT: %S1.ref: %L1.assoc_type = name_ref S1, @L1.%assoc1 [concrete = constants.%assoc1] -// CHECK:STDOUT: %T.as_type.loc12: type = facet_access_type constants.%T [symbolic = %T.as_type.loc9_23.2 (constants.%T.as_type)] -// CHECK:STDOUT: %.loc12_8.1: type = converted constants.%T, %T.as_type.loc12 [symbolic = %T.as_type.loc9_23.2 (constants.%T.as_type)] +// CHECK:STDOUT: %T.as_type.loc12: type = facet_access_type constants.%T.04c [symbolic = %T.as_type.loc9_23.2 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc12_8.1: type = converted constants.%T.04c, %T.as_type.loc12 [symbolic = %T.as_type.loc9_23.2 (constants.%T.as_type)] // CHECK:STDOUT: %impl.elem1.loc12_8.1: @Simple4.%.loc12_8.2 (%.e9a411.1) = impl_witness_access constants.%L1.lookup_impl_witness.0a136b.1, element1 [symbolic = %impl.elem1.loc12_8.2 (constants.%impl.elem1.a8c6e3.1)] // CHECK:STDOUT: %bound_method.loc12_8: = bound_method %xcopy.ref, %impl.elem1.loc12_8.1 // CHECK:STDOUT: %specific_impl_fn.loc12_8.1: = specific_impl_function %impl.elem1.loc12_8.1, @S1(constants.%L1.facet.ed78cc.1) [symbolic = %specific_impl_fn.loc12_8.2 (constants.%specific_impl_fn.bbb82e.1)] // CHECK:STDOUT: %bound_method.loc12_12: = bound_method %xcopy.ref, %specific_impl_fn.loc12_8.1 // CHECK:STDOUT: %addr: @Simple4.%ptr (%ptr.72f01d.2) = addr_of %xcopy.ref // CHECK:STDOUT: %.loc12_12: init %empty_tuple.type = call %bound_method.loc12_12(%addr) +// CHECK:STDOUT: %T.as_type.loc11_3: type = facet_access_type constants.%T.04c [symbolic = %T.as_type.loc9_23.2 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc11_3.1: type = converted constants.%T.04c, %T.as_type.loc11_3 [symbolic = %T.as_type.loc9_23.2 (constants.%T.as_type)] +// CHECK:STDOUT: %impl.elem0.loc11_3.1: @Simple4.%.loc11_3.4 (%.0f4deb.1) = impl_witness_access constants.%Destroy.lookup_impl_witness.87177a.1, element0 [symbolic = %impl.elem0.loc11_3.2 (constants.%impl.elem0.71dfa9.1)] +// CHECK:STDOUT: %bound_method.loc11_3.1: = bound_method %xcopy.var, %impl.elem0.loc11_3.1 +// CHECK:STDOUT: %specific_impl_fn.loc11_3.1: = specific_impl_function %impl.elem0.loc11_3.1, @Op.1(constants.%Destroy.facet.a7da23.1) [symbolic = %specific_impl_fn.loc11_3.2 (constants.%specific_impl_fn.5803ed.1)] +// CHECK:STDOUT: %bound_method.loc11_3.2: = bound_method %xcopy.var, %specific_impl_fn.loc11_3.1 +// CHECK:STDOUT: %.loc11_3.2: @Simple4.%T.as_type.loc9_23.2 (%T.as_type) = bind_value %xcopy.var +// CHECK:STDOUT: %.loc11_3.3: init %empty_tuple.type = call %bound_method.loc11_3.2(%.loc11_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -861,12 +888,17 @@ fn Works() { // CHECK:STDOUT: %specific_impl_fn.loc19_8.2: = specific_impl_function %impl.elem1.loc19_8.2, @S1(%L1.facet) [symbolic = %specific_impl_fn.loc19_8.2 (constants.%specific_impl_fn.bbb82e.2)] // CHECK:STDOUT: %ptr: type = ptr_type %V.as_type.loc16_25.2 [symbolic = %ptr (constants.%ptr.72f01d.3)] // CHECK:STDOUT: %require_complete.loc19: = require_complete_type %ptr [symbolic = %require_complete.loc19 (constants.%require_complete.9326df.2)] +// CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %V.loc16_14.2, @Destroy [symbolic = %Destroy.lookup_impl_witness (constants.%Destroy.lookup_impl_witness.87177a.2)] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %V.as_type.loc16_25.2, (%Destroy.lookup_impl_witness) [symbolic = %Destroy.facet (constants.%Destroy.facet.a7da23.2)] +// CHECK:STDOUT: %.loc18_3.4: type = fn_type_with_self_type constants.%Op.type.bae, %Destroy.facet [symbolic = %.loc18_3.4 (constants.%.0f4deb.2)] +// CHECK:STDOUT: %impl.elem0.loc18_3.2: @Compound4.%.loc18_3.4 (%.0f4deb.2) = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc18_3.2 (constants.%impl.elem0.71dfa9.2)] +// CHECK:STDOUT: %specific_impl_fn.loc18_3.2: = specific_impl_function %impl.elem0.loc18_3.2, @Op.1(%Destroy.facet) [symbolic = %specific_impl_fn.loc18_3.2 (constants.%specific_impl_fn.5803ed.2)] // CHECK:STDOUT: // CHECK:STDOUT: fn(%y.param: @Compound4.%V.as_type.loc16_25.2 (%V.as_type)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %y.ref.loc17: @Compound4.%V.as_type.loc16_25.2 (%V.as_type) = name_ref y, %y // CHECK:STDOUT: %L1.ref.loc17: type = name_ref L1, file.%L1.decl [concrete = constants.%L1.type] -// CHECK:STDOUT: %R1.ref: %L1.assoc_type = name_ref R1, @L1.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %R1.ref: %L1.assoc_type = name_ref R1, @L1.%assoc0 [concrete = constants.%assoc0.8b4] // CHECK:STDOUT: %impl.elem0.loc17_4.1: @Compound4.%.loc17_4 (%.3b7304.2) = impl_witness_access constants.%L1.lookup_impl_witness.0a136b.2, element0 [symbolic = %impl.elem0.loc17_4.2 (constants.%impl.elem0.a7f881.2)] // CHECK:STDOUT: %bound_method.loc17_4: = bound_method %y.ref.loc17, %impl.elem0.loc17_4.1 // CHECK:STDOUT: %specific_impl_fn.loc17_4.1: = specific_impl_function %impl.elem0.loc17_4.1, @R1(constants.%L1.facet.ed78cc.2) [symbolic = %specific_impl_fn.loc17_4.2 (constants.%specific_impl_fn.f11365.2)] @@ -881,8 +913,8 @@ fn Works() { // CHECK:STDOUT: assign %ycopy.var, %y.ref.loc18 // CHECK:STDOUT: %.loc18_14.1: type = splice_block %.loc18_14.2 [symbolic = %V.as_type.loc16_25.2 (constants.%V.as_type)] { // CHECK:STDOUT: %V.ref.loc18: %L1.type = name_ref V, %V.loc16_14.1 [symbolic = %V.loc16_14.2 (constants.%V)] -// CHECK:STDOUT: %V.as_type.loc18: type = facet_access_type %V.ref.loc18 [symbolic = %V.as_type.loc16_25.2 (constants.%V.as_type)] -// CHECK:STDOUT: %.loc18_14.2: type = converted %V.ref.loc18, %V.as_type.loc18 [symbolic = %V.as_type.loc16_25.2 (constants.%V.as_type)] +// CHECK:STDOUT: %V.as_type.loc18_14: type = facet_access_type %V.ref.loc18 [symbolic = %V.as_type.loc16_25.2 (constants.%V.as_type)] +// CHECK:STDOUT: %.loc18_14.2: type = converted %V.ref.loc18, %V.as_type.loc18_14 [symbolic = %V.as_type.loc16_25.2 (constants.%V.as_type)] // CHECK:STDOUT: } // CHECK:STDOUT: %ycopy: ref @Compound4.%V.as_type.loc16_25.2 (%V.as_type) = bind_name ycopy, %ycopy.var // CHECK:STDOUT: %ycopy.ref: ref @Compound4.%V.as_type.loc16_25.2 (%V.as_type) = name_ref ycopy, %ycopy @@ -894,25 +926,33 @@ fn Works() { // CHECK:STDOUT: %bound_method.loc19_17: = bound_method %ycopy.ref, %specific_impl_fn.loc19_8.1 // CHECK:STDOUT: %addr: @Compound4.%ptr (%ptr.72f01d.3) = addr_of %ycopy.ref // CHECK:STDOUT: %.loc19_17: init %empty_tuple.type = call %bound_method.loc19_17(%addr) +// CHECK:STDOUT: %V.as_type.loc18_3: type = facet_access_type constants.%V [symbolic = %V.as_type.loc16_25.2 (constants.%V.as_type)] +// CHECK:STDOUT: %.loc18_3.1: type = converted constants.%V, %V.as_type.loc18_3 [symbolic = %V.as_type.loc16_25.2 (constants.%V.as_type)] +// CHECK:STDOUT: %impl.elem0.loc18_3.1: @Compound4.%.loc18_3.4 (%.0f4deb.2) = impl_witness_access constants.%Destroy.lookup_impl_witness.87177a.2, element0 [symbolic = %impl.elem0.loc18_3.2 (constants.%impl.elem0.71dfa9.2)] +// CHECK:STDOUT: %bound_method.loc18_3.1: = bound_method %ycopy.var, %impl.elem0.loc18_3.1 +// CHECK:STDOUT: %specific_impl_fn.loc18_3.1: = specific_impl_function %impl.elem0.loc18_3.1, @Op.1(constants.%Destroy.facet.a7da23.2) [symbolic = %specific_impl_fn.loc18_3.2 (constants.%specific_impl_fn.5803ed.2)] +// CHECK:STDOUT: %bound_method.loc18_3.2: = bound_method %ycopy.var, %specific_impl_fn.loc18_3.1 +// CHECK:STDOUT: %.loc18_3.2: @Compound4.%V.as_type.loc16_25.2 (%V.as_type) = bind_value %ycopy.var +// CHECK:STDOUT: %.loc18_3.3: init %empty_tuple.type = call %bound_method.loc18_3.2(%.loc18_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @R1(constants.%Self) { -// CHECK:STDOUT: %Self => constants.%Self -// CHECK:STDOUT: %Self.as_type.loc4_15.1 => constants.%Self.as_type +// CHECK:STDOUT: specific @R1(constants.%Self.04c) { +// CHECK:STDOUT: %Self => constants.%Self.04c +// CHECK:STDOUT: %Self.as_type.loc4_15.1 => constants.%Self.as_type.759 // CHECK:STDOUT: %pattern_type => constants.%pattern_type.ad3e89.1 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @S1(constants.%Self) { -// CHECK:STDOUT: %Self => constants.%Self -// CHECK:STDOUT: %Self.as_type.loc5_24.1 => constants.%Self.as_type +// CHECK:STDOUT: specific @S1(constants.%Self.04c) { +// CHECK:STDOUT: %Self => constants.%Self.04c +// CHECK:STDOUT: %Self.as_type.loc5_24.1 => constants.%Self.as_type.759 // CHECK:STDOUT: %ptr.loc5_24.1 => constants.%ptr.72f01d.1 // CHECK:STDOUT: %pattern_type => constants.%pattern_type.53384b.1 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Simple4(constants.%T) { -// CHECK:STDOUT: %T.loc9_12.2 => constants.%T +// CHECK:STDOUT: specific @Simple4(constants.%T.04c) { +// CHECK:STDOUT: %T.loc9_12.2 => constants.%T.04c // CHECK:STDOUT: %T.as_type.loc9_23.2 => constants.%T.as_type // CHECK:STDOUT: %pattern_type => constants.%pattern_type.ad3e89.2 // CHECK:STDOUT: } @@ -1165,6 +1205,7 @@ fn Works() { // CHECK:STDOUT: %A.type: type = facet_type <@A> [concrete] // CHECK:STDOUT: %Self.31d: %A.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %G.type.c3a: type = fn_type @G.1 [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %G.11a: %G.type.c3a = struct_value () [concrete] // CHECK:STDOUT: %A.assoc_type: type = assoc_entity_type @A [concrete] // CHECK:STDOUT: %assoc0.d52: %A.assoc_type = assoc_entity element0, @A.%G.decl [concrete] @@ -1190,12 +1231,24 @@ fn Works() { // CHECK:STDOUT: %Op.bound: = bound_method %A.type, %Op.ff4 [concrete] // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete] // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.3 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.4, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.906: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%C) [concrete] +// CHECK:STDOUT: %Op.type.153: type = fn_type @Op.4, @impl.49c(%C) [concrete] +// CHECK:STDOUT: %Op.5d7: %Op.type.153 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %C, (%Destroy.impl_witness.906) [concrete] +// CHECK:STDOUT: %.b80: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.5d7, @Op.4(%C) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .BitAndWith = %Core.BitAndWith // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -1203,6 +1256,9 @@ fn Works() { // CHECK:STDOUT: %Core.import_ref.012: %Op.type.1cc = import_ref Core//prelude, loc13_42, loaded [concrete = constants.%Op.ff4] // CHECK:STDOUT: %BitAndWith.impl_witness_table = impl_witness_table (%Core.import_ref.012), @impl.865 [concrete] // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -1271,9 +1327,9 @@ fn Works() { // CHECK:STDOUT: %.loc22_7: ref %C = converted %.loc22_5.1, %.loc22_5.4 // CHECK:STDOUT: %A.ref.loc22_15: type = name_ref A, file.%A.decl [concrete = constants.%A.type] // CHECK:STDOUT: %A.ref.loc22_19: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %impl.elem0.loc22: %.2af = impl_witness_access constants.%BitAndWith.impl_witness, element0 [concrete = constants.%Op.ff4] -// CHECK:STDOUT: %bound_method.loc22: = bound_method %A.ref.loc22_15, %impl.elem0.loc22 [concrete = constants.%Op.bound] -// CHECK:STDOUT: %type.and.loc22: init type = call %bound_method.loc22(%A.ref.loc22_15, %A.ref.loc22_19) [concrete = constants.%A.type] +// CHECK:STDOUT: %impl.elem0.loc22_17: %.2af = impl_witness_access constants.%BitAndWith.impl_witness, element0 [concrete = constants.%Op.ff4] +// CHECK:STDOUT: %bound_method.loc22_17: = bound_method %A.ref.loc22_15, %impl.elem0.loc22_17 [concrete = constants.%Op.bound] +// CHECK:STDOUT: %type.and.loc22: init type = call %bound_method.loc22_17(%A.ref.loc22_15, %A.ref.loc22_19) [concrete = constants.%A.type] // CHECK:STDOUT: %G.ref.loc22: %A.assoc_type = name_ref G, @A.%assoc0 [concrete = constants.%assoc0.d52] // CHECK:STDOUT: %.loc22_12: %A.type = converted %.loc22_7, [concrete = ] // CHECK:STDOUT: %.loc30_6.1: %empty_struct_type = struct_literal () @@ -1310,9 +1366,9 @@ fn Works() { // CHECK:STDOUT: %C.ref.loc38_18: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %A.ref.loc38_24: type = name_ref A, file.%A.decl [concrete = constants.%A.type] // CHECK:STDOUT: %A.ref.loc38_28: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %impl.elem0.loc38: %.2af = impl_witness_access constants.%BitAndWith.impl_witness, element0 [concrete = constants.%Op.ff4] -// CHECK:STDOUT: %bound_method.loc38: = bound_method %A.ref.loc38_24, %impl.elem0.loc38 [concrete = constants.%Op.bound] -// CHECK:STDOUT: %type.and.loc38: init type = call %bound_method.loc38(%A.ref.loc38_24, %A.ref.loc38_28) [concrete = constants.%A.type] +// CHECK:STDOUT: %impl.elem0.loc38_26: %.2af = impl_witness_access constants.%BitAndWith.impl_witness, element0 [concrete = constants.%Op.ff4] +// CHECK:STDOUT: %bound_method.loc38_26: = bound_method %A.ref.loc38_24, %impl.elem0.loc38_26 [concrete = constants.%Op.bound] +// CHECK:STDOUT: %type.and.loc38: init type = call %bound_method.loc38_26(%A.ref.loc38_24, %A.ref.loc38_28) [concrete = constants.%A.type] // CHECK:STDOUT: %.loc38_29.1: type = value_of_initializer %type.and.loc38 [concrete = constants.%A.type] // CHECK:STDOUT: %.loc38_29.2: type = converted %type.and.loc38, %.loc38_29.1 [concrete = constants.%A.type] // CHECK:STDOUT: %A.facet.loc38: %A.type = facet_value constants.%C, (constants.%A.impl_witness) [concrete = constants.%A.facet] @@ -1322,6 +1378,24 @@ fn Works() { // CHECK:STDOUT: %A.ref.loc38_34: type = name_ref A, file.%A.decl [concrete = constants.%A.type] // CHECK:STDOUT: %G.ref.loc38: %A.assoc_type = name_ref G, @A.%assoc0 [concrete = constants.%assoc0.d52] // CHECK:STDOUT: %.loc38_32: %A.type = converted %.loc38_8, [concrete = ] +// CHECK:STDOUT: %impl.elem0.loc38_6: %.b80 = impl_witness_access constants.%Destroy.impl_witness.906, element0 [concrete = constants.%Op.5d7] +// CHECK:STDOUT: %bound_method.loc38_6.1: = bound_method %.loc38_6.2, %impl.elem0.loc38_6 +// CHECK:STDOUT: %specific_fn.loc38: = specific_function %impl.elem0.loc38_6, @Op.4(constants.%C) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc38_6.2: = bound_method %.loc38_6.2, %specific_fn.loc38 +// CHECK:STDOUT: %.loc38_6.5: %C = bind_value %.loc38_6.2 +// CHECK:STDOUT: %no_op.loc38: init %empty_tuple.type = call %bound_method.loc38_6.2(%.loc38_6.5) +// CHECK:STDOUT: %impl.elem0.loc30_6: %.b80 = impl_witness_access constants.%Destroy.impl_witness.906, element0 [concrete = constants.%Op.5d7] +// CHECK:STDOUT: %bound_method.loc30_6.1: = bound_method %.loc30_6.2, %impl.elem0.loc30_6 +// CHECK:STDOUT: %specific_fn.loc30: = specific_function %impl.elem0.loc30_6, @Op.4(constants.%C) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc30_6.2: = bound_method %.loc30_6.2, %specific_fn.loc30 +// CHECK:STDOUT: %.loc30_6.5: %C = bind_value %.loc30_6.2 +// CHECK:STDOUT: %no_op.loc30: init %empty_tuple.type = call %bound_method.loc30_6.2(%.loc30_6.5) +// CHECK:STDOUT: %impl.elem0.loc22_5: %.b80 = impl_witness_access constants.%Destroy.impl_witness.906, element0 [concrete = constants.%Op.5d7] +// CHECK:STDOUT: %bound_method.loc22_5.1: = bound_method %.loc22_5.2, %impl.elem0.loc22_5 +// CHECK:STDOUT: %specific_fn.loc22: = specific_function %impl.elem0.loc22_5, @Op.4(constants.%C) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc22_5.2: = bound_method %.loc22_5.2, %specific_fn.loc22 +// CHECK:STDOUT: %.loc22_5.5: %C = bind_value %.loc22_5.2 +// CHECK:STDOUT: %no_op.loc22: init %empty_tuple.type = call %bound_method.loc22_5.2(%.loc22_5.5) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/default_fn.carbon b/toolchain/check/testdata/interface/default_fn.carbon index 9cb8a84d2779..8bc2f3cbe880 100644 --- a/toolchain/check/testdata/interface/default_fn.carbon +++ b/toolchain/check/testdata/interface/default_fn.carbon @@ -32,14 +32,14 @@ class C { // CHECK:STDOUT: constants { // CHECK:STDOUT: %C: type = class_type @C [concrete] // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete] -// CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] -// CHECK:STDOUT: %pattern_type.b2f: type = pattern_type %Self.as_type [symbolic] +// CHECK:STDOUT: %Self.6ef: %I.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self.as_type.390: type = facet_access_type %Self.6ef [symbolic] +// CHECK:STDOUT: %pattern_type.b2f: type = pattern_type %Self.as_type.390 [symbolic] // CHECK:STDOUT: %F.type.0b5: type = fn_type @F.1 [concrete] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %F.20c: %F.type.0b5 = struct_value () [concrete] // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete] -// CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%F.decl [concrete] +// CHECK:STDOUT: %assoc0.a33: %I.assoc_type = assoc_entity element0, @I.%F.decl [concrete] // CHECK:STDOUT: %I.impl_witness: = impl_witness @C.%I.impl_witness_table [concrete] // CHECK:STDOUT: %pattern_type.c48: type = pattern_type %C [concrete] // CHECK:STDOUT: %F.type.4a2: type = fn_type @F.2 [concrete] @@ -47,16 +47,31 @@ class C { // CHECK:STDOUT: %I.facet: %I.type = facet_value %C, (%I.impl_witness) [concrete] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] -// CHECK:STDOUT: %require_complete: = require_complete_type %Self.as_type [symbolic] +// CHECK:STDOUT: %require_complete.8cb: = require_complete_type %Self.as_type.390 [symbolic] // CHECK:STDOUT: %C.val: %C = struct_value () [concrete] // CHECK:STDOUT: %.e5b: type = fn_type_with_self_type %F.type.0b5, %I.facet [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.906: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%C) [concrete] +// CHECK:STDOUT: %Op.type.153: type = fn_type @Op.2, @impl.49c(%C) [concrete] +// CHECK:STDOUT: %Op.5d7: %Op.type.153 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %C, (%Destroy.impl_witness.906) [concrete] +// CHECK:STDOUT: %.b80: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.5d7, @Op.2(%C) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -69,20 +84,20 @@ class C { // 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.6ef] // CHECK:STDOUT: %F.decl: %F.type.0b5 = fn_decl @F.1 [concrete = constants.%F.20c] { // CHECK:STDOUT: %self.patt: @F.1.%pattern_type (%pattern_type.b2f) = binding_pattern self [concrete] // CHECK:STDOUT: %self.param_patt: @F.1.%pattern_type (%pattern_type.b2f) = value_param_pattern %self.patt, call_param0 [concrete] // CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: @F.1.%Self.as_type.loc18_16.1 (%Self.as_type) = value_param call_param0 -// CHECK:STDOUT: %.loc18_16.1: type = splice_block %.loc18_16.2 [symbolic = %Self.as_type.loc18_16.1 (constants.%Self.as_type)] { -// CHECK:STDOUT: %Self.ref: %I.type = name_ref Self, @I.%Self [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc18_16.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc18_16.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %.loc18_16.2: type = converted %Self.ref, %Self.as_type.loc18_16.2 [symbolic = %Self.as_type.loc18_16.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %self.param: @F.1.%Self.as_type.loc18_16.1 (%Self.as_type.390) = value_param call_param0 +// CHECK:STDOUT: %.loc18_16.1: type = splice_block %.loc18_16.2 [symbolic = %Self.as_type.loc18_16.1 (constants.%Self.as_type.390)] { +// CHECK:STDOUT: %Self.ref: %I.type = name_ref Self, @I.%Self [symbolic = %Self (constants.%Self.6ef)] +// CHECK:STDOUT: %Self.as_type.loc18_16.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc18_16.1 (constants.%Self.as_type.390)] +// CHECK:STDOUT: %.loc18_16.2: type = converted %Self.ref, %Self.as_type.loc18_16.2 [symbolic = %Self.as_type.loc18_16.1 (constants.%Self.as_type.390)] // CHECK:STDOUT: } -// CHECK:STDOUT: %self: @F.1.%Self.as_type.loc18_16.1 (%Self.as_type) = bind_name self, %self.param +// CHECK:STDOUT: %self: @F.1.%Self.as_type.loc18_16.1 (%Self.as_type.390) = bind_name self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, %F.decl [concrete = constants.%assoc0] +// CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, %F.decl [concrete = constants.%assoc0.a33] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self @@ -92,13 +107,13 @@ class C { // CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl: %C.ref as %I.ref { +// CHECK:STDOUT: impl @impl.c1a: %C.ref as %I.ref { // CHECK:STDOUT: %F.decl: %F.type.4a2 = fn_decl @F.2 [concrete = constants.%F.eb2] { // CHECK:STDOUT: %self.patt: %pattern_type.c48 = binding_pattern self [concrete] // CHECK:STDOUT: %self.param_patt: %pattern_type.c48 = value_param_pattern %self.patt, call_param0 [concrete] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: %C = value_param call_param0 -// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.%C.ref [concrete = constants.%C] +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.c1a.%C.ref [concrete = constants.%C] // CHECK:STDOUT: %self: %C = bind_name self, %self.param // CHECK:STDOUT: } // CHECK:STDOUT: @@ -109,11 +124,11 @@ class C { // CHECK:STDOUT: // CHECK:STDOUT: class @C { // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {} -// CHECK:STDOUT: impl_decl @impl [concrete] {} { +// CHECK:STDOUT: impl_decl @impl.c1a [concrete] {} { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %I.ref: type = name_ref I, @C.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (@impl.%F.decl), @impl [concrete] +// CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (@impl.c1a.%F.decl), @impl.c1a [concrete] // CHECK:STDOUT: %I.impl_witness: = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete = constants.%complete_type] @@ -126,14 +141,14 @@ class C { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @F.1(@I.%Self: %I.type) { -// CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc18_16.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc18_16.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.6ef)] +// CHECK:STDOUT: %Self.as_type.loc18_16.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc18_16.1 (constants.%Self.as_type.390)] // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type.loc18_16.1 [symbolic = %pattern_type (constants.%pattern_type.b2f)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type %Self.as_type.loc18_16.1 [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %require_complete: = require_complete_type %Self.as_type.loc18_16.1 [symbolic = %require_complete (constants.%require_complete.8cb)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%self.param: @F.1.%Self.as_type.loc18_16.1 (%Self.as_type)) { +// CHECK:STDOUT: fn(%self.param: @F.1.%Self.as_type.loc18_16.1 (%Self.as_type.390)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %c.patt: %pattern_type.c48 = binding_pattern c [concrete] @@ -142,17 +157,23 @@ class C { // CHECK:STDOUT: %c.var: ref %C = var %c.var_patt // CHECK:STDOUT: %.loc20_19.1: %empty_struct_type = struct_literal () // CHECK:STDOUT: %.loc20_19.2: init %C = class_init (), %c.var [concrete = constants.%C.val] -// CHECK:STDOUT: %.loc20_7: init %C = converted %.loc20_19.1, %.loc20_19.2 [concrete = constants.%C.val] -// CHECK:STDOUT: assign %c.var, %.loc20_7 +// CHECK:STDOUT: %.loc20_7.1: init %C = converted %.loc20_19.1, %.loc20_19.2 [concrete = constants.%C.val] +// CHECK:STDOUT: assign %c.var, %.loc20_7.1 // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var // CHECK:STDOUT: %c.ref: ref %C = name_ref c, %c // CHECK:STDOUT: %I.ref: type = name_ref I, @C.%I.decl [concrete = constants.%I.type] -// CHECK:STDOUT: %F.ref: %I.assoc_type = name_ref F, @I.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0: %.e5b = impl_witness_access constants.%I.impl_witness, element0 [concrete = constants.%F.eb2] -// CHECK:STDOUT: %bound_method: = bound_method %c.ref, %impl.elem0 +// CHECK:STDOUT: %F.ref: %I.assoc_type = name_ref F, @I.%assoc0 [concrete = constants.%assoc0.a33] +// CHECK:STDOUT: %impl.elem0.loc21: %.e5b = impl_witness_access constants.%I.impl_witness, element0 [concrete = constants.%F.eb2] +// CHECK:STDOUT: %bound_method.loc21: = bound_method %c.ref, %impl.elem0.loc21 // CHECK:STDOUT: %.loc21: %C = bind_value %c.ref -// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %bound_method(%.loc21) +// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %bound_method.loc21(%.loc21) +// CHECK:STDOUT: %impl.elem0.loc20: %.b80 = impl_witness_access constants.%Destroy.impl_witness.906, element0 [concrete = constants.%Op.5d7] +// CHECK:STDOUT: %bound_method.loc20_7.1: = bound_method %c.var, %impl.elem0.loc20 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0.loc20, @Op.2(constants.%C) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc20_7.2: = bound_method %c.var, %specific_fn +// CHECK:STDOUT: %.loc20_7.2: %C = bind_value %c.var +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc20_7.2(%.loc20_7.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -162,9 +183,9 @@ class C { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%Self) { -// CHECK:STDOUT: %Self => constants.%Self -// CHECK:STDOUT: %Self.as_type.loc18_16.1 => constants.%Self.as_type +// CHECK:STDOUT: specific @F.1(constants.%Self.6ef) { +// CHECK:STDOUT: %Self => constants.%Self.6ef +// CHECK:STDOUT: %Self.as_type.loc18_16.1 => constants.%Self.as_type.390 // CHECK:STDOUT: %pattern_type => constants.%pattern_type.b2f // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/fail_member_lookup.carbon b/toolchain/check/testdata/interface/fail_member_lookup.carbon index 90b4e02e61ad..489b073e738f 100644 --- a/toolchain/check/testdata/interface/fail_member_lookup.carbon +++ b/toolchain/check/testdata/interface/fail_member_lookup.carbon @@ -60,6 +60,7 @@ fn G(U:! Different) -> U.(Interface.T); // CHECK:STDOUT: %F.c41: %F.type.b25 = struct_value () [concrete] // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete] // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] // CHECK:STDOUT: %Different.type: type = facet_type <@Different> [concrete] // CHECK:STDOUT: %Self.e7f: %Different.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %U: %Different.type = bind_symbolic_name U, 0 [symbolic] @@ -71,10 +72,12 @@ fn G(U:! Different) -> U.(Interface.T); // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -150,6 +153,7 @@ fn G(U:! Different) -> U.(Interface.T); // CHECK:STDOUT: %.loc23: type = converted %T.ref, [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %v: = bind_name v, [concrete = ] +// CHECK:STDOUT: %impl.elem0: = impl_witness_access , element0 [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/generic_method.carbon b/toolchain/check/testdata/interface/generic_method.carbon index f49e2f8a5901..d19f4644769b 100644 --- a/toolchain/check/testdata/interface/generic_method.carbon +++ b/toolchain/check/testdata/interface/generic_method.carbon @@ -94,8 +94,8 @@ fn CallIndirect() { // CHECK:STDOUT: %U.2cb: type = bind_symbolic_name U, 2 [symbolic] // CHECK:STDOUT: %pattern_type.20f: type = pattern_type %U.2cb [symbolic] // CHECK:STDOUT: %tuple.type.e59: type = tuple_type (type, %A.type.75a, type) [symbolic] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.753 [symbolic] -// CHECK:STDOUT: %tuple.type.bd2: type = tuple_type (%T.8b3, %Self.as_type, %U.2cb) [symbolic] +// CHECK:STDOUT: %Self.as_type.81d: type = facet_access_type %Self.753 [symbolic] +// CHECK:STDOUT: %tuple.type.bd2: type = tuple_type (%T.8b3, %Self.as_type.81d, %U.2cb) [symbolic] // CHECK:STDOUT: %pattern_type.44c: type = pattern_type %tuple.type.bd2 [symbolic] // CHECK:STDOUT: %F.type.17a: type = fn_type @F.1, @A(%T.8b3) [symbolic] // CHECK:STDOUT: %F.0d8: %F.type.17a = struct_value () [symbolic] @@ -114,7 +114,7 @@ fn CallIndirect() { // CHECK:STDOUT: %assoc0.5f6: %A.assoc_type.296 = assoc_entity element0, @A.%F.decl [concrete] // CHECK:STDOUT: %A.impl_witness: = impl_witness file.%A.impl_witness_table [concrete] // CHECK:STDOUT: %U.8b3: type = bind_symbolic_name U, 0 [symbolic] -// CHECK:STDOUT: %pattern_type.7dc: type = pattern_type %U.8b3 [symbolic] +// CHECK:STDOUT: %pattern_type.7dcd0a.1: type = pattern_type %U.8b3 [symbolic] // CHECK:STDOUT: %tuple.type.ff9: type = tuple_type (type, type, type) [concrete] // CHECK:STDOUT: %tuple.type.765: type = tuple_type (%X, %Y, %U.8b3) [symbolic] // CHECK:STDOUT: %pattern_type.340: type = pattern_type %tuple.type.765 [symbolic] @@ -123,7 +123,7 @@ fn CallIndirect() { // CHECK:STDOUT: %A.facet.552: %A.type.91f = facet_value %Y, (%A.impl_witness) [concrete] // CHECK:STDOUT: %tuple.type.a0c: type = tuple_type (type, %A.type.91f, type) [concrete] // CHECK:STDOUT: %require_complete.816: = require_complete_type %tuple.type.765 [symbolic] -// CHECK:STDOUT: %require_complete.4ae: = require_complete_type %U.8b3 [symbolic] +// CHECK:STDOUT: %require_complete.4aeca8.1: = require_complete_type %U.8b3 [symbolic] // CHECK:STDOUT: %tuple.type.a41: type = tuple_type (%empty_struct_type, %empty_struct_type, %U.8b3) [symbolic] // CHECK:STDOUT: %X.val: %X = struct_value () [concrete] // CHECK:STDOUT: %Y.val: %Y = struct_value () [concrete] @@ -135,6 +135,23 @@ fn CallIndirect() { // CHECK:STDOUT: %pattern_type.ef1: type = pattern_type %tuple.type.f6b [concrete] // CHECK:STDOUT: %F.specific_fn: = specific_function %F.ce9, @F.2(%Z) [concrete] // CHECK:STDOUT: %Z.val: %Z = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl.49c(%T.8b3) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.347: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%Z) [concrete] +// CHECK:STDOUT: %Op.type.f73: type = fn_type @Op.2, @impl.49c(%Z) [concrete] +// CHECK:STDOUT: %Op.6e3: %Op.type.f73 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.26a: %Destroy.type = facet_value %Z, (%Destroy.impl_witness.347) [concrete] +// CHECK:STDOUT: %.b91: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.26a [concrete] +// CHECK:STDOUT: %Op.specific_fn.3b7: = specific_function %Op.6e3, @Op.2(%Z) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.955: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%tuple.type.f6b) [concrete] +// CHECK:STDOUT: %Op.type.495: type = fn_type @Op.2, @impl.49c(%tuple.type.f6b) [concrete] +// CHECK:STDOUT: %Op.51a: %Op.type.495 = struct_value () [concrete] +// CHECK:STDOUT: %complete_type.a64: = complete_type_witness %tuple.type.f6b [concrete] +// CHECK:STDOUT: %Destroy.facet.1f2: %Destroy.type = facet_value %tuple.type.f6b, (%Destroy.impl_witness.955) [concrete] +// CHECK:STDOUT: %.a86: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.1f2 [concrete] +// CHECK:STDOUT: %Op.specific_fn.8e5: = specific_function %Op.51a, @Op.2(%tuple.type.f6b) [concrete] // CHECK:STDOUT: %T.9c2: %A.type.91f = bind_symbolic_name T, 0 [symbolic] // CHECK:STDOUT: %pattern_type.817: type = pattern_type %A.type.91f [concrete] // CHECK:STDOUT: %CallGeneric.type: type = fn_type @CallGeneric [concrete] @@ -143,23 +160,32 @@ fn CallIndirect() { // CHECK:STDOUT: %A.lookup_impl_witness: = lookup_impl_witness %T.9c2, @A, @A(%X) [symbolic] // CHECK:STDOUT: %A.facet.11f: %A.type.91f = facet_value %T.as_type, (%A.lookup_impl_witness) [symbolic] // CHECK:STDOUT: %.ffa: type = fn_type_with_self_type %F.type.13d, %A.facet.11f [symbolic] -// CHECK:STDOUT: %impl.elem0: %.ffa = impl_witness_access %A.lookup_impl_witness, element0 [symbolic] +// CHECK:STDOUT: %impl.elem0.0e5: %.ffa = impl_witness_access %A.lookup_impl_witness, element0 [symbolic] // CHECK:STDOUT: %tuple.type.e28: type = tuple_type (%X, %T.as_type, %Z) [symbolic] // CHECK:STDOUT: %pattern_type.f25: type = pattern_type %tuple.type.e28 [symbolic] -// CHECK:STDOUT: %specific_impl_fn: = specific_impl_function %impl.elem0, @F.1(%X, %A.facet.11f, %Z) [symbolic] +// CHECK:STDOUT: %specific_impl_fn.e7e: = specific_impl_function %impl.elem0.0e5, @F.1(%X, %A.facet.11f, %Z) [symbolic] // CHECK:STDOUT: %require_complete.500: = require_complete_type %tuple.type.e28 [symbolic] +// CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %tuple.type.e28, @Destroy [symbolic] +// CHECK:STDOUT: %Destroy.facet.1a6: %Destroy.type = facet_value %tuple.type.e28, (%Destroy.lookup_impl_witness) [symbolic] +// CHECK:STDOUT: %.efa: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.1a6 [symbolic] +// CHECK:STDOUT: %impl.elem0.305: %.efa = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic] +// CHECK:STDOUT: %specific_impl_fn.52a: = specific_impl_function %impl.elem0.305, @Op.1(%Destroy.facet.1a6) [symbolic] +// CHECK:STDOUT: %require_complete.19f: = require_complete_type %T.as_type [symbolic] // CHECK:STDOUT: %CallIndirect.type: type = fn_type @CallIndirect [concrete] // CHECK:STDOUT: %CallIndirect: %CallIndirect.type = struct_value () [concrete] // CHECK:STDOUT: %CallGeneric.specific_fn: = specific_function %CallGeneric, @CallGeneric(%A.facet.552) [concrete] -// CHECK:STDOUT: %complete_type.a64: = complete_type_witness %tuple.type.f6b [concrete] // CHECK:STDOUT: %tuple.type.9c8: type = tuple_type (%empty_struct_type, %empty_struct_type, %Z) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -182,13 +208,13 @@ fn CallIndirect() { // CHECK:STDOUT: %X.decl: type = class_decl @X [concrete = constants.%X] {} {} // CHECK:STDOUT: %Y.decl: type = class_decl @Y [concrete = constants.%Y] {} {} // CHECK:STDOUT: %Z.decl: type = class_decl @Z [concrete = constants.%Z] {} {} -// CHECK:STDOUT: impl_decl @impl [concrete] {} { +// CHECK:STDOUT: impl_decl @impl.5ec [concrete] {} { // CHECK:STDOUT: %Y.ref: type = name_ref Y, file.%Y.decl [concrete = constants.%Y] // CHECK:STDOUT: %A.ref: %A.type.495 = name_ref A, file.%A.decl [concrete = constants.%A.generic] // CHECK:STDOUT: %X.ref: type = name_ref X, file.%X.decl [concrete = constants.%X] // CHECK:STDOUT: %A.type: type = facet_type <@A, @A(constants.%X)> [concrete = constants.%A.type.91f] // CHECK:STDOUT: } -// CHECK:STDOUT: %A.impl_witness_table = impl_witness_table (@impl.%F.decl), @impl [concrete] +// CHECK:STDOUT: %A.impl_witness_table = impl_witness_table (@impl.5ec.%F.decl), @impl.5ec [concrete] // CHECK:STDOUT: %A.impl_witness: = impl_witness %A.impl_witness_table [concrete = constants.%A.impl_witness] // CHECK:STDOUT: %Call.decl: %Call.type = fn_decl @Call [concrete = constants.%Call] {} {} // CHECK:STDOUT: %CallGeneric.decl: %CallGeneric.type = fn_decl @CallGeneric [concrete = constants.%CallGeneric] { @@ -229,8 +255,8 @@ fn CallIndirect() { // CHECK:STDOUT: %Self.ref: @F.1.%A.type (%A.type.75a) = name_ref Self, %.loc6_31 [symbolic = %Self (constants.%Self.753)] // CHECK:STDOUT: %U.ref.loc6_37: type = name_ref U, %U.loc6_8.2 [symbolic = %U.loc6_8.1 (constants.%U.2cb)] // CHECK:STDOUT: %.loc6_38.1: @F.1.%tuple.type.loc6_38.1 (%tuple.type.e59) = tuple_literal (%T.ref, %Self.ref, %U.ref.loc6_37) -// CHECK:STDOUT: %Self.as_type.loc6_38.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc6_38.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %.loc6_38.2: type = converted %Self.ref, %Self.as_type.loc6_38.2 [symbolic = %Self.as_type.loc6_38.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %Self.as_type.loc6_38.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc6_38.1 (constants.%Self.as_type.81d)] +// CHECK:STDOUT: %.loc6_38.2: type = converted %Self.ref, %Self.as_type.loc6_38.2 [symbolic = %Self.as_type.loc6_38.1 (constants.%Self.as_type.81d)] // CHECK:STDOUT: %.loc6_38.3: type = converted %.loc6_38.1, constants.%tuple.type.bd2 [symbolic = %tuple.type.loc6_38.2 (constants.%tuple.type.bd2)] // CHECK:STDOUT: %U.loc6_8.2: type = bind_symbolic_name U, 2 [symbolic = %U.loc6_8.1 (constants.%U.2cb)] // CHECK:STDOUT: %u.param: @F.1.%U.loc6_8.1 (%U.2cb) = value_param call_param0 @@ -249,11 +275,11 @@ fn CallIndirect() { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl: %Y.ref as %A.type { +// CHECK:STDOUT: impl @impl.5ec: %Y.ref as %A.type { // CHECK:STDOUT: %F.decl: %F.type.436 = fn_decl @F.2 [concrete = constants.%F.ce9] { // CHECK:STDOUT: %U.patt: %pattern_type.98f = symbolic_binding_pattern U, 0 [concrete] -// CHECK:STDOUT: %u.patt: @F.2.%pattern_type.loc16_18 (%pattern_type.7dc) = binding_pattern u [concrete] -// CHECK:STDOUT: %u.param_patt: @F.2.%pattern_type.loc16_18 (%pattern_type.7dc) = value_param_pattern %u.patt, call_param0 [concrete] +// CHECK:STDOUT: %u.patt: @F.2.%pattern_type.loc16_18 (%pattern_type.7dcd0a.1) = binding_pattern u [concrete] +// CHECK:STDOUT: %u.param_patt: @F.2.%pattern_type.loc16_18 (%pattern_type.7dcd0a.1) = value_param_pattern %u.patt, call_param0 [concrete] // CHECK:STDOUT: %return.patt: @F.2.%pattern_type.loc16_24 (%pattern_type.340) = return_slot_pattern [concrete] // CHECK:STDOUT: %return.param_patt: @F.2.%pattern_type.loc16_24 (%pattern_type.340) = out_param_pattern %return.patt, call_param1 [concrete] // CHECK:STDOUT: } { @@ -311,7 +337,7 @@ fn CallIndirect() { // CHECK:STDOUT: %A.type: type = facet_type <@A, @A(%T)> [symbolic = %A.type (constants.%A.type.75a)] // CHECK:STDOUT: %Self: @F.1.%A.type (%A.type.75a) = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.753)] // CHECK:STDOUT: %tuple.type.loc6_38.1: type = tuple_type (type, %A.type, type) [symbolic = %tuple.type.loc6_38.1 (constants.%tuple.type.e59)] -// CHECK:STDOUT: %Self.as_type.loc6_38.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc6_38.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %Self.as_type.loc6_38.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc6_38.1 (constants.%Self.as_type.81d)] // CHECK:STDOUT: %tuple.type.loc6_38.2: type = tuple_type (%T, %Self.as_type.loc6_38.1, %U.loc6_8.1) [symbolic = %tuple.type.loc6_38.2 (constants.%tuple.type.bd2)] // CHECK:STDOUT: %pattern_type.loc6_24: type = pattern_type %tuple.type.loc6_38.2 [symbolic = %pattern_type.loc6_24 (constants.%pattern_type.44c)] // CHECK:STDOUT: @@ -320,13 +346,13 @@ fn CallIndirect() { // CHECK:STDOUT: // CHECK:STDOUT: generic fn @F.2(%U.loc16_8.2: type) { // CHECK:STDOUT: %U.loc16_8.1: type = bind_symbolic_name U, 0 [symbolic = %U.loc16_8.1 (constants.%U.8b3)] -// CHECK:STDOUT: %pattern_type.loc16_18: type = pattern_type %U.loc16_8.1 [symbolic = %pattern_type.loc16_18 (constants.%pattern_type.7dc)] +// CHECK:STDOUT: %pattern_type.loc16_18: type = pattern_type %U.loc16_8.1 [symbolic = %pattern_type.loc16_18 (constants.%pattern_type.7dcd0a.1)] // CHECK:STDOUT: %tuple.type.loc16: type = tuple_type (constants.%X, constants.%Y, %U.loc16_8.1) [symbolic = %tuple.type.loc16 (constants.%tuple.type.765)] // CHECK:STDOUT: %pattern_type.loc16_24: type = pattern_type %tuple.type.loc16 [symbolic = %pattern_type.loc16_24 (constants.%pattern_type.340)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete.loc16_24: = require_complete_type %tuple.type.loc16 [symbolic = %require_complete.loc16_24 (constants.%require_complete.816)] -// CHECK:STDOUT: %require_complete.loc16_19: = require_complete_type %U.loc16_8.1 [symbolic = %require_complete.loc16_19 (constants.%require_complete.4ae)] +// CHECK:STDOUT: %require_complete.loc16_19: = require_complete_type %U.loc16_8.1 [symbolic = %require_complete.loc16_19 (constants.%require_complete.4aeca8.1)] // CHECK:STDOUT: %tuple.type.loc17: type = tuple_type (constants.%empty_struct_type, constants.%empty_struct_type, %U.loc16_8.1) [symbolic = %tuple.type.loc17 (constants.%tuple.type.a41)] // CHECK:STDOUT: // CHECK:STDOUT: fn(%u.param: @F.2.%U.loc16_8.1 (%U.8b3)) -> %return.param: @F.2.%tuple.type.loc16 (%tuple.type.765) { @@ -361,18 +387,37 @@ fn CallIndirect() { // CHECK:STDOUT: %F.ref: %A.assoc_type.296 = name_ref F, %.loc22_14.1 [concrete = constants.%assoc0.5f6] // CHECK:STDOUT: %as_type: type = facet_access_type %.loc22_6 [concrete = constants.%Y] // CHECK:STDOUT: %.loc22_14.2: type = converted %.loc22_6, %as_type [concrete = constants.%Y] -// CHECK:STDOUT: %impl.elem0: %.a60 = impl_witness_access constants.%A.impl_witness, element0 [concrete = constants.%F.ce9] +// CHECK:STDOUT: %impl.elem0.loc22_14: %.a60 = impl_witness_access constants.%A.impl_witness, element0 [concrete = constants.%F.ce9] // CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z] // CHECK:STDOUT: %.loc22_21.1: %empty_struct_type = struct_literal () -// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @F.2(constants.%Z) [concrete = constants.%F.specific_fn] +// CHECK:STDOUT: %specific_fn.loc22_14: = specific_function %impl.elem0.loc22_14, @F.2(constants.%Z) [concrete = constants.%F.specific_fn] // CHECK:STDOUT: %.loc22_22.1: ref %tuple.type.f6b = temporary_storage // CHECK:STDOUT: %.loc22_21.2: ref %Z = temporary_storage // CHECK:STDOUT: %.loc22_21.3: init %Z = class_init (), %.loc22_21.2 [concrete = constants.%Z.val] // CHECK:STDOUT: %.loc22_21.4: ref %Z = temporary %.loc22_21.2, %.loc22_21.3 // CHECK:STDOUT: %.loc22_21.5: ref %Z = converted %.loc22_21.1, %.loc22_21.4 // CHECK:STDOUT: %.loc22_21.6: %Z = bind_value %.loc22_21.5 -// CHECK:STDOUT: %F.call: init %tuple.type.f6b = call %specific_fn(%.loc22_21.6) to %.loc22_22.1 +// CHECK:STDOUT: %F.call: init %tuple.type.f6b = call %specific_fn.loc22_14(%.loc22_21.6) to %.loc22_22.1 // CHECK:STDOUT: %.loc22_22.2: ref %tuple.type.f6b = temporary %.loc22_22.1, %F.call +// CHECK:STDOUT: %impl.elem0.loc22_21: %.b91 = impl_witness_access constants.%Destroy.impl_witness.347, element0 [concrete = constants.%Op.6e3] +// CHECK:STDOUT: %bound_method.loc22_21.1: = bound_method %.loc22_21.2, %impl.elem0.loc22_21 +// CHECK:STDOUT: %specific_fn.loc22_21: = specific_function %impl.elem0.loc22_21, @Op.2(constants.%Z) [concrete = constants.%Op.specific_fn.3b7] +// CHECK:STDOUT: %bound_method.loc22_21.2: = bound_method %.loc22_21.2, %specific_fn.loc22_21 +// CHECK:STDOUT: %.loc22_21.7: %Z = bind_value %.loc22_21.2 +// CHECK:STDOUT: %no_op.loc22_21: init %empty_tuple.type = call %bound_method.loc22_21.2(%.loc22_21.7) +// CHECK:STDOUT: %impl.elem0.loc22_22: %.a86 = impl_witness_access constants.%Destroy.impl_witness.955, element0 [concrete = constants.%Op.51a] +// CHECK:STDOUT: %bound_method.loc22_22.1: = bound_method %.loc22_22.1, %impl.elem0.loc22_22 +// CHECK:STDOUT: %specific_fn.loc22_22: = specific_function %impl.elem0.loc22_22, @Op.2(constants.%tuple.type.f6b) [concrete = constants.%Op.specific_fn.8e5] +// CHECK:STDOUT: %bound_method.loc22_22.2: = bound_method %.loc22_22.1, %specific_fn.loc22_22 +// CHECK:STDOUT: %tuple.elem0: ref %X = tuple_access %.loc22_22.1, element0 +// CHECK:STDOUT: %.loc22_22.3: %X = bind_value %tuple.elem0 +// CHECK:STDOUT: %tuple.elem1: ref %Y = tuple_access %.loc22_22.1, element1 +// CHECK:STDOUT: %.loc22_22.4: %Y = bind_value %tuple.elem1 +// CHECK:STDOUT: %tuple.elem2: ref %Z = tuple_access %.loc22_22.1, element2 +// CHECK:STDOUT: %.loc22_22.5: %Z = bind_value %tuple.elem2 +// CHECK:STDOUT: %tuple: %tuple.type.f6b = tuple_value (%.loc22_22.3, %.loc22_22.4, %.loc22_22.5) +// CHECK:STDOUT: %.loc22_22.6: %tuple.type.f6b = converted %.loc22_22.1, %tuple +// CHECK:STDOUT: %no_op.loc22_22: init %empty_tuple.type = call %bound_method.loc22_22.2(%.loc22_22.6) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -384,10 +429,16 @@ fn CallIndirect() { // CHECK:STDOUT: %A.lookup_impl_witness: = lookup_impl_witness %T.loc25_16.2, @A, @A(constants.%X) [symbolic = %A.lookup_impl_witness (constants.%A.lookup_impl_witness)] // CHECK:STDOUT: %A.facet: %A.type.91f = facet_value %T.as_type.loc26_4.2, (%A.lookup_impl_witness) [symbolic = %A.facet (constants.%A.facet.11f)] // CHECK:STDOUT: %.loc26_4.3: type = fn_type_with_self_type constants.%F.type.13d, %A.facet [symbolic = %.loc26_4.3 (constants.%.ffa)] -// CHECK:STDOUT: %impl.elem0.loc26_4.2: @CallGeneric.%.loc26_4.3 (%.ffa) = impl_witness_access %A.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc26_4.2 (constants.%impl.elem0)] -// CHECK:STDOUT: %specific_impl_fn.loc26_4.2: = specific_impl_function %impl.elem0.loc26_4.2, @F.1(constants.%X, %A.facet, constants.%Z) [symbolic = %specific_impl_fn.loc26_4.2 (constants.%specific_impl_fn)] +// CHECK:STDOUT: %impl.elem0.loc26_4.2: @CallGeneric.%.loc26_4.3 (%.ffa) = impl_witness_access %A.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc26_4.2 (constants.%impl.elem0.0e5)] +// CHECK:STDOUT: %specific_impl_fn.loc26_4.2: = specific_impl_function %impl.elem0.loc26_4.2, @F.1(constants.%X, %A.facet, constants.%Z) [symbolic = %specific_impl_fn.loc26_4.2 (constants.%specific_impl_fn.e7e)] // CHECK:STDOUT: %tuple.type: type = tuple_type (constants.%X, %T.as_type.loc26_4.2, constants.%Z) [symbolic = %tuple.type (constants.%tuple.type.e28)] -// CHECK:STDOUT: %require_complete: = require_complete_type %tuple.type [symbolic = %require_complete (constants.%require_complete.500)] +// CHECK:STDOUT: %require_complete.loc26_12.1: = require_complete_type %tuple.type [symbolic = %require_complete.loc26_12.1 (constants.%require_complete.500)] +// CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %tuple.type, @Destroy [symbolic = %Destroy.lookup_impl_witness (constants.%Destroy.lookup_impl_witness)] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %tuple.type, (%Destroy.lookup_impl_witness) [symbolic = %Destroy.facet (constants.%Destroy.facet.1a6)] +// CHECK:STDOUT: %.loc26_12.9: type = fn_type_with_self_type constants.%Op.type.bae, %Destroy.facet [symbolic = %.loc26_12.9 (constants.%.efa)] +// CHECK:STDOUT: %impl.elem0.loc26_12.2: @CallGeneric.%.loc26_12.9 (%.efa) = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc26_12.2 (constants.%impl.elem0.305)] +// CHECK:STDOUT: %specific_impl_fn.loc26_12.2: = specific_impl_function %impl.elem0.loc26_12.2, @Op.1(%Destroy.facet) [symbolic = %specific_impl_fn.loc26_12.2 (constants.%specific_impl_fn.52a)] +// CHECK:STDOUT: %require_complete.loc26_12.2: = require_complete_type %T.as_type.loc26_4.2 [symbolic = %require_complete.loc26_12.2 (constants.%require_complete.19f)] // CHECK:STDOUT: // CHECK:STDOUT: fn() { // CHECK:STDOUT: !entry: @@ -396,10 +447,10 @@ fn CallIndirect() { // CHECK:STDOUT: %F.ref: %A.assoc_type.296 = name_ref F, %.loc26_4.1 [concrete = constants.%assoc0.5f6] // CHECK:STDOUT: %T.as_type.loc26_4.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc26_4.2 (constants.%T.as_type)] // CHECK:STDOUT: %.loc26_4.2: type = converted %T.ref, %T.as_type.loc26_4.1 [symbolic = %T.as_type.loc26_4.2 (constants.%T.as_type)] -// CHECK:STDOUT: %impl.elem0.loc26_4.1: @CallGeneric.%.loc26_4.3 (%.ffa) = impl_witness_access constants.%A.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc26_4.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %impl.elem0.loc26_4.1: @CallGeneric.%.loc26_4.3 (%.ffa) = impl_witness_access constants.%A.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc26_4.2 (constants.%impl.elem0.0e5)] // CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z] // CHECK:STDOUT: %.loc26_11.1: %empty_struct_type = struct_literal () -// CHECK:STDOUT: %specific_impl_fn.loc26_4.1: = specific_impl_function %impl.elem0.loc26_4.1, @F.1(constants.%X, constants.%A.facet.11f, constants.%Z) [symbolic = %specific_impl_fn.loc26_4.2 (constants.%specific_impl_fn)] +// CHECK:STDOUT: %specific_impl_fn.loc26_4.1: = specific_impl_function %impl.elem0.loc26_4.1, @F.1(constants.%X, constants.%A.facet.11f, constants.%Z) [symbolic = %specific_impl_fn.loc26_4.2 (constants.%specific_impl_fn.e7e)] // CHECK:STDOUT: %.loc26_12.1: ref @CallGeneric.%tuple.type (%tuple.type.e28) = temporary_storage // CHECK:STDOUT: %.loc26_11.2: ref %Z = temporary_storage // CHECK:STDOUT: %.loc26_11.3: init %Z = class_init (), %.loc26_11.2 [concrete = constants.%Z.val] @@ -408,6 +459,25 @@ fn CallIndirect() { // CHECK:STDOUT: %.loc26_11.6: %Z = bind_value %.loc26_11.5 // CHECK:STDOUT: %.loc26_12.2: init @CallGeneric.%tuple.type (%tuple.type.e28) = call %specific_impl_fn.loc26_4.1(%.loc26_11.6) to %.loc26_12.1 // CHECK:STDOUT: %.loc26_12.3: ref @CallGeneric.%tuple.type (%tuple.type.e28) = temporary %.loc26_12.1, %.loc26_12.2 +// CHECK:STDOUT: %impl.elem0.loc26_11: %.b91 = impl_witness_access constants.%Destroy.impl_witness.347, element0 [concrete = constants.%Op.6e3] +// CHECK:STDOUT: %bound_method.loc26_11.1: = bound_method %.loc26_11.2, %impl.elem0.loc26_11 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0.loc26_11, @Op.2(constants.%Z) [concrete = constants.%Op.specific_fn.3b7] +// CHECK:STDOUT: %bound_method.loc26_11.2: = bound_method %.loc26_11.2, %specific_fn +// CHECK:STDOUT: %.loc26_11.7: %Z = bind_value %.loc26_11.2 +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc26_11.2(%.loc26_11.7) +// CHECK:STDOUT: %impl.elem0.loc26_12.1: @CallGeneric.%.loc26_12.9 (%.efa) = impl_witness_access constants.%Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc26_12.2 (constants.%impl.elem0.305)] +// CHECK:STDOUT: %bound_method.loc26_12.1: = bound_method %.loc26_12.1, %impl.elem0.loc26_12.1 +// CHECK:STDOUT: %specific_impl_fn.loc26_12.1: = specific_impl_function %impl.elem0.loc26_12.1, @Op.1(constants.%Destroy.facet.1a6) [symbolic = %specific_impl_fn.loc26_12.2 (constants.%specific_impl_fn.52a)] +// CHECK:STDOUT: %bound_method.loc26_12.2: = bound_method %.loc26_12.1, %specific_impl_fn.loc26_12.1 +// CHECK:STDOUT: %tuple.elem0: ref %X = tuple_access %.loc26_12.1, element0 +// CHECK:STDOUT: %.loc26_12.4: %X = bind_value %tuple.elem0 +// CHECK:STDOUT: %tuple.elem1: ref @CallGeneric.%T.as_type.loc26_4.2 (%T.as_type) = tuple_access %.loc26_12.1, element1 +// CHECK:STDOUT: %.loc26_12.5: @CallGeneric.%T.as_type.loc26_4.2 (%T.as_type) = bind_value %tuple.elem1 +// CHECK:STDOUT: %tuple.elem2: ref %Z = tuple_access %.loc26_12.1, element2 +// CHECK:STDOUT: %.loc26_12.6: %Z = bind_value %tuple.elem2 +// CHECK:STDOUT: %tuple: @CallGeneric.%tuple.type (%tuple.type.e28) = tuple_value (%.loc26_12.4, %.loc26_12.5, %.loc26_12.6) +// CHECK:STDOUT: %.loc26_12.7: @CallGeneric.%tuple.type (%tuple.type.e28) = converted %.loc26_12.1, %tuple +// CHECK:STDOUT: %.loc26_12.8: init %empty_tuple.type = call %bound_method.loc26_12.2(%.loc26_12.7) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -434,7 +504,7 @@ fn CallIndirect() { // CHECK:STDOUT: %A.type => constants.%A.type.75a // CHECK:STDOUT: %Self => constants.%Self.753 // CHECK:STDOUT: %tuple.type.loc6_38.1 => constants.%tuple.type.e59 -// CHECK:STDOUT: %Self.as_type.loc6_38.1 => constants.%Self.as_type +// CHECK:STDOUT: %Self.as_type.loc6_38.1 => constants.%Self.as_type.81d // CHECK:STDOUT: %tuple.type.loc6_38.2 => constants.%tuple.type.bd2 // CHECK:STDOUT: %pattern_type.loc6_24 => constants.%pattern_type.44c // CHECK:STDOUT: } @@ -453,14 +523,14 @@ fn CallIndirect() { // CHECK:STDOUT: // CHECK:STDOUT: specific @F.2(constants.%U.8b3) { // CHECK:STDOUT: %U.loc16_8.1 => constants.%U.8b3 -// CHECK:STDOUT: %pattern_type.loc16_18 => constants.%pattern_type.7dc +// CHECK:STDOUT: %pattern_type.loc16_18 => constants.%pattern_type.7dcd0a.1 // CHECK:STDOUT: %tuple.type.loc16 => constants.%tuple.type.765 // CHECK:STDOUT: %pattern_type.loc16_24 => constants.%pattern_type.340 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @F.1(constants.%X, constants.%A.facet.552, constants.%U.8b3) { // CHECK:STDOUT: %U.loc6_8.1 => constants.%U.8b3 -// CHECK:STDOUT: %pattern_type.loc6_18 => constants.%pattern_type.7dc +// CHECK:STDOUT: %pattern_type.loc6_18 => constants.%pattern_type.7dcd0a.1 // CHECK:STDOUT: %T => constants.%X // CHECK:STDOUT: %A.type => constants.%A.type.91f // CHECK:STDOUT: %Self => constants.%A.facet.552 @@ -509,7 +579,13 @@ fn CallIndirect() { // CHECK:STDOUT: %impl.elem0.loc26_4.2 => constants.%F.ce9 // CHECK:STDOUT: %specific_impl_fn.loc26_4.2 => constants.%F.specific_fn // CHECK:STDOUT: %tuple.type => constants.%tuple.type.f6b -// CHECK:STDOUT: %require_complete => constants.%complete_type.a64 +// CHECK:STDOUT: %require_complete.loc26_12.1 => constants.%complete_type.a64 +// CHECK:STDOUT: %Destroy.lookup_impl_witness => constants.%Destroy.impl_witness.955 +// CHECK:STDOUT: %Destroy.facet => constants.%Destroy.facet.1f2 +// CHECK:STDOUT: %.loc26_12.9 => constants.%.a86 +// CHECK:STDOUT: %impl.elem0.loc26_12.2 => constants.%Op.51a +// CHECK:STDOUT: %specific_impl_fn.loc26_12.2 => constants.%Op.specific_fn.8e5 +// CHECK:STDOUT: %require_complete.loc26_12.2 => constants.%complete_type.357 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @F.1(constants.%X, constants.%A.facet.552, constants.%Z) { @@ -537,8 +613,8 @@ fn CallIndirect() { // CHECK:STDOUT: %U.2cb: type = bind_symbolic_name U, 2 [symbolic] // CHECK:STDOUT: %pattern_type.20f: type = pattern_type %U.2cb [symbolic] // CHECK:STDOUT: %tuple.type.e59: type = tuple_type (type, %A.type.75a, type) [symbolic] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.753 [symbolic] -// CHECK:STDOUT: %tuple.type.bd2: type = tuple_type (%T.8b3, %Self.as_type, %U.2cb) [symbolic] +// CHECK:STDOUT: %Self.as_type.81d: type = facet_access_type %Self.753 [symbolic] +// CHECK:STDOUT: %tuple.type.bd2: type = tuple_type (%T.8b3, %Self.as_type.81d, %U.2cb) [symbolic] // CHECK:STDOUT: %pattern_type.44c: type = pattern_type %tuple.type.bd2 [symbolic] // CHECK:STDOUT: %F.type.17a: type = fn_type @F.1, @A(%T.8b3) [symbolic] // CHECK:STDOUT: %F.0d8: %F.type.17a = struct_value () [symbolic] @@ -562,13 +638,13 @@ fn CallIndirect() { // CHECK:STDOUT: %A.assoc_type.b05: type = assoc_entity_type @A, @A(%W) [symbolic] // CHECK:STDOUT: %assoc0.c82: %A.assoc_type.b05 = assoc_entity element0, @A.%F.decl [symbolic] // CHECK:STDOUT: %require_complete.796: = require_complete_type %A.type.f21 [symbolic] -// CHECK:STDOUT: %A.impl_witness.f15: = impl_witness file.%A.impl_witness_table, @impl(%V1, %V2, %W) [symbolic] +// CHECK:STDOUT: %A.impl_witness.f15: = impl_witness file.%A.impl_witness_table, @impl.220(%V1, %V2, %W) [symbolic] // CHECK:STDOUT: %U.753: type = bind_symbolic_name U, 3 [symbolic] // CHECK:STDOUT: %pattern_type.549: type = pattern_type %U.753 [symbolic] // CHECK:STDOUT: %tuple.type.11f: type = tuple_type (type, %tuple.type.24b, type) [concrete] // CHECK:STDOUT: %tuple.type.8ae: type = tuple_type (%W, %tuple.type.30b, %U.753) [symbolic] // CHECK:STDOUT: %pattern_type.d4a: type = pattern_type %tuple.type.8ae [symbolic] -// CHECK:STDOUT: %F.type.b3e: type = fn_type @F.2, @impl(%V1, %V2, %W) [symbolic] +// CHECK:STDOUT: %F.type.b3e: type = fn_type @F.2, @impl.220(%V1, %V2, %W) [symbolic] // CHECK:STDOUT: %F.d79: %F.type.b3e = struct_value () [symbolic] // CHECK:STDOUT: %A.facet.461: %A.type.f21 = facet_value %tuple.type.30b, (%A.impl_witness.f15) [symbolic] // CHECK:STDOUT: %tuple.type.136: type = tuple_type (type, %A.type.f21, type) [symbolic] @@ -585,8 +661,8 @@ fn CallIndirect() { // CHECK:STDOUT: %A.assoc_type.296: type = assoc_entity_type @A, @A(%X) [concrete] // CHECK:STDOUT: %assoc0.5f6: %A.assoc_type.296 = assoc_entity element0, @A.%F.decl [concrete] // CHECK:STDOUT: %complete_type.d76: = complete_type_witness %A.type.91f [concrete] -// CHECK:STDOUT: %A.impl_witness.8ac: = impl_witness file.%A.impl_witness_table, @impl(%Y1, %Y2, %X) [concrete] -// CHECK:STDOUT: %F.type.bf7: type = fn_type @F.2, @impl(%Y1, %Y2, %X) [concrete] +// CHECK:STDOUT: %A.impl_witness.8ac: = impl_witness file.%A.impl_witness_table, @impl.220(%Y1, %Y2, %X) [concrete] +// CHECK:STDOUT: %F.type.bf7: type = fn_type @F.2, @impl.220(%Y1, %Y2, %X) [concrete] // CHECK:STDOUT: %F.93b: %F.type.bf7 = struct_value () [concrete] // CHECK:STDOUT: %A.facet.414: %A.type.91f = facet_value %tuple.type.a46, (%A.impl_witness.8ac) [concrete] // CHECK:STDOUT: %.406: type = fn_type_with_self_type %F.type.13d, %A.facet.414 [concrete] @@ -595,6 +671,23 @@ fn CallIndirect() { // CHECK:STDOUT: %pattern_type.0b2: type = pattern_type %tuple.type.415 [concrete] // CHECK:STDOUT: %F.specific_fn.79b: = specific_function %F.93b, @F.2(%Y1, %Y2, %X, %Z) [concrete] // CHECK:STDOUT: %Z.val: %Z = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl.49c(%T.8b3) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.347: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%Z) [concrete] +// CHECK:STDOUT: %Op.type.f73: type = fn_type @Op.2, @impl.49c(%Z) [concrete] +// CHECK:STDOUT: %Op.6e3: %Op.type.f73 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.26a: %Destroy.type = facet_value %Z, (%Destroy.impl_witness.347) [concrete] +// CHECK:STDOUT: %.b91: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.26a [concrete] +// CHECK:STDOUT: %Op.specific_fn.3b7: = specific_function %Op.6e3, @Op.2(%Z) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.c80: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%tuple.type.415) [concrete] +// CHECK:STDOUT: %Op.type.2a3: type = fn_type @Op.2, @impl.49c(%tuple.type.415) [concrete] +// CHECK:STDOUT: %Op.66e: %Op.type.2a3 = struct_value () [concrete] +// CHECK:STDOUT: %complete_type.aa8: = complete_type_witness %tuple.type.415 [concrete] +// CHECK:STDOUT: %Destroy.facet.2b1: %Destroy.type = facet_value %tuple.type.415, (%Destroy.impl_witness.c80) [concrete] +// CHECK:STDOUT: %.1b7: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.2b1 [concrete] +// CHECK:STDOUT: %Op.specific_fn.ce9: = specific_function %Op.66e, @Op.2(%tuple.type.415) [concrete] // CHECK:STDOUT: %T.9c2: %A.type.91f = bind_symbolic_name T, 0 [symbolic] // CHECK:STDOUT: %pattern_type.817: type = pattern_type %A.type.91f [concrete] // CHECK:STDOUT: %CallGeneric.type: type = fn_type @CallGeneric [concrete] @@ -603,23 +696,33 @@ fn CallIndirect() { // CHECK:STDOUT: %A.lookup_impl_witness: = lookup_impl_witness %T.9c2, @A, @A(%X) [symbolic] // CHECK:STDOUT: %A.facet.11f: %A.type.91f = facet_value %T.as_type, (%A.lookup_impl_witness) [symbolic] // CHECK:STDOUT: %.ffa: type = fn_type_with_self_type %F.type.13d, %A.facet.11f [symbolic] -// CHECK:STDOUT: %impl.elem0: %.ffa = impl_witness_access %A.lookup_impl_witness, element0 [symbolic] +// CHECK:STDOUT: %impl.elem0.0e5: %.ffa = impl_witness_access %A.lookup_impl_witness, element0 [symbolic] // CHECK:STDOUT: %tuple.type.a0c: type = tuple_type (type, %A.type.91f, type) [concrete] // CHECK:STDOUT: %tuple.type.e28: type = tuple_type (%X, %T.as_type, %Z) [symbolic] // CHECK:STDOUT: %pattern_type.f25: type = pattern_type %tuple.type.e28 [symbolic] -// CHECK:STDOUT: %specific_impl_fn: = specific_impl_function %impl.elem0, @F.1(%X, %A.facet.11f, %Z) [symbolic] +// CHECK:STDOUT: %specific_impl_fn.e7e: = specific_impl_function %impl.elem0.0e5, @F.1(%X, %A.facet.11f, %Z) [symbolic] // CHECK:STDOUT: %require_complete.500: = require_complete_type %tuple.type.e28 [symbolic] +// CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %tuple.type.e28, @Destroy [symbolic] +// CHECK:STDOUT: %Destroy.facet.1a6: %Destroy.type = facet_value %tuple.type.e28, (%Destroy.lookup_impl_witness) [symbolic] +// CHECK:STDOUT: %.efa: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.1a6 [symbolic] +// CHECK:STDOUT: %impl.elem0.305: %.efa = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic] +// CHECK:STDOUT: %specific_impl_fn.52a: = specific_impl_function %impl.elem0.305, @Op.1(%Destroy.facet.1a6) [symbolic] +// CHECK:STDOUT: %require_complete.19f: = require_complete_type %T.as_type [symbolic] // CHECK:STDOUT: %CallIndirect.type: type = fn_type @CallIndirect [concrete] // CHECK:STDOUT: %CallIndirect: %CallIndirect.type = struct_value () [concrete] // CHECK:STDOUT: %CallGeneric.specific_fn: = specific_function %CallGeneric, @CallGeneric(%A.facet.414) [concrete] -// CHECK:STDOUT: %complete_type.aa8: = complete_type_witness %tuple.type.415 [concrete] +// CHECK:STDOUT: %complete_type.4d1: = complete_type_witness %tuple.type.a46 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -644,7 +747,7 @@ fn CallIndirect() { // CHECK:STDOUT: %Y1.decl: type = class_decl @Y1 [concrete = constants.%Y1] {} {} // CHECK:STDOUT: %Y2.decl: type = class_decl @Y2 [concrete = constants.%Y2] {} {} // CHECK:STDOUT: %Z.decl: type = class_decl @Z [concrete = constants.%Z] {} {} -// CHECK:STDOUT: impl_decl @impl [concrete] { +// CHECK:STDOUT: impl_decl @impl.220 [concrete] { // CHECK:STDOUT: %V1.patt: %pattern_type.98f = symbolic_binding_pattern V1, 0 [concrete] // CHECK:STDOUT: %V2.patt: %pattern_type.98f = symbolic_binding_pattern V2, 1 [concrete] // CHECK:STDOUT: %W.patt: %pattern_type.98f = symbolic_binding_pattern W, 2 [concrete] @@ -660,8 +763,8 @@ fn CallIndirect() { // CHECK:STDOUT: %V2.loc14_25.1: type = bind_symbolic_name V2, 1 [symbolic = %V2.loc14_25.2 (constants.%V2)] // CHECK:STDOUT: %W.loc14_36.1: type = bind_symbolic_name W, 2 [symbolic = %W.loc14_36.2 (constants.%W)] // CHECK:STDOUT: } -// CHECK:STDOUT: %A.impl_witness_table = impl_witness_table (@impl.%F.decl), @impl [concrete] -// CHECK:STDOUT: %A.impl_witness: = impl_witness %A.impl_witness_table, @impl(constants.%V1, constants.%V2, constants.%W) [symbolic = @impl.%A.impl_witness (constants.%A.impl_witness.f15)] +// CHECK:STDOUT: %A.impl_witness_table = impl_witness_table (@impl.220.%F.decl), @impl.220 [concrete] +// CHECK:STDOUT: %A.impl_witness: = impl_witness %A.impl_witness_table, @impl.220(constants.%V1, constants.%V2, constants.%W) [symbolic = @impl.220.%A.impl_witness (constants.%A.impl_witness.f15)] // CHECK:STDOUT: %Call.decl: %Call.type = fn_decl @Call [concrete = constants.%Call] {} {} // CHECK:STDOUT: %CallGeneric.decl: %CallGeneric.type = fn_decl @CallGeneric [concrete = constants.%CallGeneric] { // CHECK:STDOUT: %T.patt: %pattern_type.817 = symbolic_binding_pattern T, 0 [concrete] @@ -701,8 +804,8 @@ fn CallIndirect() { // CHECK:STDOUT: %Self.ref: @F.1.%A.type (%A.type.75a) = name_ref Self, %.loc6_31 [symbolic = %Self (constants.%Self.753)] // CHECK:STDOUT: %U.ref.loc6_37: type = name_ref U, %U.loc6_8.2 [symbolic = %U.loc6_8.1 (constants.%U.2cb)] // CHECK:STDOUT: %.loc6_38.1: @F.1.%tuple.type.loc6_38.1 (%tuple.type.e59) = tuple_literal (%T.ref, %Self.ref, %U.ref.loc6_37) -// CHECK:STDOUT: %Self.as_type.loc6_38.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc6_38.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %.loc6_38.2: type = converted %Self.ref, %Self.as_type.loc6_38.2 [symbolic = %Self.as_type.loc6_38.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %Self.as_type.loc6_38.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc6_38.1 (constants.%Self.as_type.81d)] +// CHECK:STDOUT: %.loc6_38.2: type = converted %Self.ref, %Self.as_type.loc6_38.2 [symbolic = %Self.as_type.loc6_38.1 (constants.%Self.as_type.81d)] // CHECK:STDOUT: %.loc6_38.3: type = converted %.loc6_38.1, constants.%tuple.type.bd2 [symbolic = %tuple.type.loc6_38.2 (constants.%tuple.type.bd2)] // CHECK:STDOUT: %U.loc6_8.2: type = bind_symbolic_name U, 2 [symbolic = %U.loc6_8.1 (constants.%U.2cb)] // CHECK:STDOUT: %u.param: @F.1.%U.loc6_8.1 (%U.2cb) = value_param call_param0 @@ -721,30 +824,30 @@ fn CallIndirect() { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic impl @impl(%V1.loc14_14.1: type, %V2.loc14_25.1: type, %W.loc14_36.1: type) { +// CHECK:STDOUT: generic impl @impl.220(%V1.loc14_14.1: type, %V2.loc14_25.1: type, %W.loc14_36.1: type) { // CHECK:STDOUT: %V1.loc14_14.2: type = bind_symbolic_name V1, 0 [symbolic = %V1.loc14_14.2 (constants.%V1)] // CHECK:STDOUT: %V2.loc14_25.2: type = bind_symbolic_name V2, 1 [symbolic = %V2.loc14_25.2 (constants.%V2)] // CHECK:STDOUT: %W.loc14_36.2: type = bind_symbolic_name W, 2 [symbolic = %W.loc14_36.2 (constants.%W)] // CHECK:STDOUT: %tuple.type: type = tuple_type (%V1.loc14_14.2, %V2.loc14_25.2) [symbolic = %tuple.type (constants.%tuple.type.30b)] // CHECK:STDOUT: %A.type.loc14_61.2: type = facet_type <@A, @A(%W.loc14_36.2)> [symbolic = %A.type.loc14_61.2 (constants.%A.type.f21)] // CHECK:STDOUT: %require_complete: = require_complete_type %A.type.loc14_61.2 [symbolic = %require_complete (constants.%require_complete.796)] -// CHECK:STDOUT: %A.impl_witness: = impl_witness file.%A.impl_witness_table, @impl(%V1.loc14_14.2, %V2.loc14_25.2, %W.loc14_36.2) [symbolic = %A.impl_witness (constants.%A.impl_witness.f15)] +// CHECK:STDOUT: %A.impl_witness: = impl_witness file.%A.impl_witness_table, @impl.220(%V1.loc14_14.2, %V2.loc14_25.2, %W.loc14_36.2) [symbolic = %A.impl_witness (constants.%A.impl_witness.f15)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %F.type: type = fn_type @F.2, @impl(%V1.loc14_14.2, %V2.loc14_25.2, %W.loc14_36.2) [symbolic = %F.type (constants.%F.type.b3e)] -// CHECK:STDOUT: %F: @impl.%F.type (%F.type.b3e) = struct_value () [symbolic = %F (constants.%F.d79)] +// CHECK:STDOUT: %F.type: type = fn_type @F.2, @impl.220(%V1.loc14_14.2, %V2.loc14_25.2, %W.loc14_36.2) [symbolic = %F.type (constants.%F.type.b3e)] +// CHECK:STDOUT: %F: @impl.220.%F.type (%F.type.b3e) = struct_value () [symbolic = %F (constants.%F.d79)] // CHECK:STDOUT: // CHECK:STDOUT: impl: %.loc14_53.2 as %A.type.loc14_61.1 { -// CHECK:STDOUT: %F.decl: @impl.%F.type (%F.type.b3e) = fn_decl @F.2 [symbolic = @impl.%F (constants.%F.d79)] { +// CHECK:STDOUT: %F.decl: @impl.220.%F.type (%F.type.b3e) = fn_decl @F.2 [symbolic = @impl.220.%F (constants.%F.d79)] { // CHECK:STDOUT: %U.patt: %pattern_type.98f = symbolic_binding_pattern U, 3 [concrete] // CHECK:STDOUT: %u.patt: @F.2.%pattern_type.loc17_18 (%pattern_type.549) = binding_pattern u [concrete] // CHECK:STDOUT: %u.param_patt: @F.2.%pattern_type.loc17_18 (%pattern_type.549) = value_param_pattern %u.patt, call_param0 [concrete] // CHECK:STDOUT: %return.patt: @F.2.%pattern_type.loc17_24 (%pattern_type.d4a) = return_slot_pattern [concrete] // CHECK:STDOUT: %return.param_patt: @F.2.%pattern_type.loc17_24 (%pattern_type.d4a) = out_param_pattern %return.patt, call_param1 [concrete] // CHECK:STDOUT: } { -// CHECK:STDOUT: %W.ref: type = name_ref W, @impl.%W.loc14_36.1 [symbolic = %W (constants.%W)] -// CHECK:STDOUT: %V1.ref: type = name_ref V1, @impl.%V1.loc14_14.1 [symbolic = %V1 (constants.%V1)] -// CHECK:STDOUT: %V2.ref: type = name_ref V2, @impl.%V2.loc14_25.1 [symbolic = %V2 (constants.%V2)] +// CHECK:STDOUT: %W.ref: type = name_ref W, @impl.220.%W.loc14_36.1 [symbolic = %W (constants.%W)] +// CHECK:STDOUT: %V1.ref: type = name_ref V1, @impl.220.%V1.loc14_14.1 [symbolic = %V1 (constants.%V1)] +// CHECK:STDOUT: %V2.ref: type = name_ref V2, @impl.220.%V2.loc14_25.1 [symbolic = %V2 (constants.%V2)] // CHECK:STDOUT: %.loc17_38: %tuple.type.24b = tuple_literal (%V1.ref, %V2.ref) // CHECK:STDOUT: %U.ref.loc17_41: type = name_ref U, %U.loc17_8.2 [symbolic = %U.loc17_8.1 (constants.%U.753)] // CHECK:STDOUT: %.loc17_42.1: %tuple.type.11f = tuple_literal (%W.ref, %.loc17_38, %U.ref.loc17_41) @@ -810,14 +913,14 @@ fn CallIndirect() { // CHECK:STDOUT: %A.type: type = facet_type <@A, @A(%T)> [symbolic = %A.type (constants.%A.type.75a)] // CHECK:STDOUT: %Self: @F.1.%A.type (%A.type.75a) = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.753)] // CHECK:STDOUT: %tuple.type.loc6_38.1: type = tuple_type (type, %A.type, type) [symbolic = %tuple.type.loc6_38.1 (constants.%tuple.type.e59)] -// CHECK:STDOUT: %Self.as_type.loc6_38.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc6_38.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %Self.as_type.loc6_38.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc6_38.1 (constants.%Self.as_type.81d)] // CHECK:STDOUT: %tuple.type.loc6_38.2: type = tuple_type (%T, %Self.as_type.loc6_38.1, %U.loc6_8.1) [symbolic = %tuple.type.loc6_38.2 (constants.%tuple.type.bd2)] // CHECK:STDOUT: %pattern_type.loc6_24: type = pattern_type %tuple.type.loc6_38.2 [symbolic = %pattern_type.loc6_24 (constants.%pattern_type.44c)] // CHECK:STDOUT: // CHECK:STDOUT: fn(%u.param: @F.1.%U.loc6_8.1 (%U.2cb)) -> @F.1.%tuple.type.loc6_38.2 (%tuple.type.bd2); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @F.2(@impl.%V1.loc14_14.1: type, @impl.%V2.loc14_25.1: type, @impl.%W.loc14_36.1: type, %U.loc17_8.2: type) { +// CHECK:STDOUT: generic fn @F.2(@impl.220.%V1.loc14_14.1: type, @impl.220.%V2.loc14_25.1: type, @impl.220.%W.loc14_36.1: type, %U.loc17_8.2: type) { // CHECK:STDOUT: %U.loc17_8.1: type = bind_symbolic_name U, 3 [symbolic = %U.loc17_8.1 (constants.%U.753)] // CHECK:STDOUT: %pattern_type.loc17_18: type = pattern_type %U.loc17_8.1 [symbolic = %pattern_type.loc17_18 (constants.%pattern_type.549)] // CHECK:STDOUT: %W: type = bind_symbolic_name W, 2 [symbolic = %W (constants.%W)] @@ -830,13 +933,13 @@ fn CallIndirect() { // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete.loc17_24: = require_complete_type %tuple.type.loc17_42.2 [symbolic = %require_complete.loc17_24 (constants.%require_complete.d4d)] // CHECK:STDOUT: %require_complete.loc17_19: = require_complete_type %U.loc17_8.1 [symbolic = %require_complete.loc17_19 (constants.%require_complete.ed4)] -// CHECK:STDOUT: %F.type: type = fn_type @F.2, @impl(%V1, %V2, %W) [symbolic = %F.type (constants.%F.type.b3e)] +// CHECK:STDOUT: %F.type: type = fn_type @F.2, @impl.220(%V1, %V2, %W) [symbolic = %F.type (constants.%F.type.b3e)] // CHECK:STDOUT: %F: @F.2.%F.type (%F.type.b3e) = struct_value () [symbolic = %F (constants.%F.d79)] // CHECK:STDOUT: %F.specific_fn.loc18_12.2: = specific_function %F, @F.2(%V1, %V2, %W, %U.loc17_8.1) [symbolic = %F.specific_fn.loc18_12.2 (constants.%F.specific_fn.7d9)] // CHECK:STDOUT: // CHECK:STDOUT: fn(%u.param: @F.2.%U.loc17_8.1 (%U.753)) -> %return.param: @F.2.%tuple.type.loc17_42.2 (%tuple.type.8ae) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc18: @F.2.%F.type (%F.type.b3e) = specific_constant @impl.%F.decl, @impl(constants.%V1, constants.%V2, constants.%W) [symbolic = %F (constants.%F.d79)] +// CHECK:STDOUT: %.loc18: @F.2.%F.type (%F.type.b3e) = specific_constant @impl.220.%F.decl, @impl.220(constants.%V1, constants.%V2, constants.%W) [symbolic = %F (constants.%F.d79)] // CHECK:STDOUT: %F.ref: @F.2.%F.type (%F.type.b3e) = name_ref F, %.loc18 [symbolic = %F (constants.%F.d79)] // CHECK:STDOUT: %U.ref.loc18: type = name_ref U, %U.loc17_8.2 [symbolic = %U.loc17_8.1 (constants.%U.753)] // CHECK:STDOUT: %u.ref: @F.2.%U.loc17_8.1 (%U.753) = name_ref u, %u @@ -862,18 +965,42 @@ fn CallIndirect() { // CHECK:STDOUT: %F.ref: %A.assoc_type.296 = name_ref F, %.loc24_31.1 [concrete = constants.%assoc0.5f6] // CHECK:STDOUT: %as_type: type = facet_access_type %.loc24_23 [concrete = constants.%tuple.type.a46] // CHECK:STDOUT: %.loc24_31.2: type = converted %.loc24_23, %as_type [concrete = constants.%tuple.type.a46] -// CHECK:STDOUT: %impl.elem0: %.406 = impl_witness_access constants.%A.impl_witness.8ac, element0 [concrete = constants.%F.93b] +// CHECK:STDOUT: %impl.elem0.loc24_31: %.406 = impl_witness_access constants.%A.impl_witness.8ac, element0 [concrete = constants.%F.93b] // CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z] // CHECK:STDOUT: %.loc24_38.1: %empty_struct_type = struct_literal () -// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @F.2(constants.%Y1, constants.%Y2, constants.%X, constants.%Z) [concrete = constants.%F.specific_fn.79b] +// CHECK:STDOUT: %specific_fn.loc24_31: = specific_function %impl.elem0.loc24_31, @F.2(constants.%Y1, constants.%Y2, constants.%X, constants.%Z) [concrete = constants.%F.specific_fn.79b] // CHECK:STDOUT: %.loc24_39.1: ref %tuple.type.415 = temporary_storage // CHECK:STDOUT: %.loc24_38.2: ref %Z = temporary_storage // CHECK:STDOUT: %.loc24_38.3: init %Z = class_init (), %.loc24_38.2 [concrete = constants.%Z.val] // CHECK:STDOUT: %.loc24_38.4: ref %Z = temporary %.loc24_38.2, %.loc24_38.3 // CHECK:STDOUT: %.loc24_38.5: ref %Z = converted %.loc24_38.1, %.loc24_38.4 // CHECK:STDOUT: %.loc24_38.6: %Z = bind_value %.loc24_38.5 -// CHECK:STDOUT: %F.call: init %tuple.type.415 = call %specific_fn(%.loc24_38.6) to %.loc24_39.1 +// CHECK:STDOUT: %F.call: init %tuple.type.415 = call %specific_fn.loc24_31(%.loc24_38.6) to %.loc24_39.1 // CHECK:STDOUT: %.loc24_39.2: ref %tuple.type.415 = temporary %.loc24_39.1, %F.call +// CHECK:STDOUT: %impl.elem0.loc24_38: %.b91 = impl_witness_access constants.%Destroy.impl_witness.347, element0 [concrete = constants.%Op.6e3] +// CHECK:STDOUT: %bound_method.loc24_38.1: = bound_method %.loc24_38.2, %impl.elem0.loc24_38 +// CHECK:STDOUT: %specific_fn.loc24_38: = specific_function %impl.elem0.loc24_38, @Op.2(constants.%Z) [concrete = constants.%Op.specific_fn.3b7] +// CHECK:STDOUT: %bound_method.loc24_38.2: = bound_method %.loc24_38.2, %specific_fn.loc24_38 +// CHECK:STDOUT: %.loc24_38.7: %Z = bind_value %.loc24_38.2 +// CHECK:STDOUT: %no_op.loc24_38: init %empty_tuple.type = call %bound_method.loc24_38.2(%.loc24_38.7) +// CHECK:STDOUT: %impl.elem0.loc24_39: %.1b7 = impl_witness_access constants.%Destroy.impl_witness.c80, element0 [concrete = constants.%Op.66e] +// CHECK:STDOUT: %bound_method.loc24_39.1: = bound_method %.loc24_39.1, %impl.elem0.loc24_39 +// CHECK:STDOUT: %specific_fn.loc24_39: = specific_function %impl.elem0.loc24_39, @Op.2(constants.%tuple.type.415) [concrete = constants.%Op.specific_fn.ce9] +// CHECK:STDOUT: %bound_method.loc24_39.2: = bound_method %.loc24_39.1, %specific_fn.loc24_39 +// CHECK:STDOUT: %tuple.elem0.loc24_39.1: ref %X = tuple_access %.loc24_39.1, element0 +// CHECK:STDOUT: %.loc24_39.3: %X = bind_value %tuple.elem0.loc24_39.1 +// CHECK:STDOUT: %tuple.elem1.loc24_39.1: ref %tuple.type.a46 = tuple_access %.loc24_39.1, element1 +// CHECK:STDOUT: %tuple.elem0.loc24_39.2: ref %Y1 = tuple_access %tuple.elem1.loc24_39.1, element0 +// CHECK:STDOUT: %.loc24_39.4: %Y1 = bind_value %tuple.elem0.loc24_39.2 +// CHECK:STDOUT: %tuple.elem1.loc24_39.2: ref %Y2 = tuple_access %tuple.elem1.loc24_39.1, element1 +// CHECK:STDOUT: %.loc24_39.5: %Y2 = bind_value %tuple.elem1.loc24_39.2 +// CHECK:STDOUT: %tuple.loc24_39.1: %tuple.type.a46 = tuple_value (%.loc24_39.4, %.loc24_39.5) +// CHECK:STDOUT: %.loc24_39.6: %tuple.type.a46 = converted %tuple.elem1.loc24_39.1, %tuple.loc24_39.1 +// CHECK:STDOUT: %tuple.elem2: ref %Z = tuple_access %.loc24_39.1, element2 +// CHECK:STDOUT: %.loc24_39.7: %Z = bind_value %tuple.elem2 +// CHECK:STDOUT: %tuple.loc24_39.2: %tuple.type.415 = tuple_value (%.loc24_39.3, %.loc24_39.6, %.loc24_39.7) +// CHECK:STDOUT: %.loc24_39.8: %tuple.type.415 = converted %.loc24_39.1, %tuple.loc24_39.2 +// CHECK:STDOUT: %no_op.loc24_39: init %empty_tuple.type = call %bound_method.loc24_39.2(%.loc24_39.8) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -885,10 +1012,16 @@ fn CallIndirect() { // CHECK:STDOUT: %A.lookup_impl_witness: = lookup_impl_witness %T.loc27_16.2, @A, @A(constants.%X) [symbolic = %A.lookup_impl_witness (constants.%A.lookup_impl_witness)] // CHECK:STDOUT: %A.facet: %A.type.91f = facet_value %T.as_type.loc28_4.2, (%A.lookup_impl_witness) [symbolic = %A.facet (constants.%A.facet.11f)] // CHECK:STDOUT: %.loc28_4.3: type = fn_type_with_self_type constants.%F.type.13d, %A.facet [symbolic = %.loc28_4.3 (constants.%.ffa)] -// CHECK:STDOUT: %impl.elem0.loc28_4.2: @CallGeneric.%.loc28_4.3 (%.ffa) = impl_witness_access %A.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc28_4.2 (constants.%impl.elem0)] -// CHECK:STDOUT: %specific_impl_fn.loc28_4.2: = specific_impl_function %impl.elem0.loc28_4.2, @F.1(constants.%X, %A.facet, constants.%Z) [symbolic = %specific_impl_fn.loc28_4.2 (constants.%specific_impl_fn)] +// CHECK:STDOUT: %impl.elem0.loc28_4.2: @CallGeneric.%.loc28_4.3 (%.ffa) = impl_witness_access %A.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc28_4.2 (constants.%impl.elem0.0e5)] +// CHECK:STDOUT: %specific_impl_fn.loc28_4.2: = specific_impl_function %impl.elem0.loc28_4.2, @F.1(constants.%X, %A.facet, constants.%Z) [symbolic = %specific_impl_fn.loc28_4.2 (constants.%specific_impl_fn.e7e)] // CHECK:STDOUT: %tuple.type: type = tuple_type (constants.%X, %T.as_type.loc28_4.2, constants.%Z) [symbolic = %tuple.type (constants.%tuple.type.e28)] -// CHECK:STDOUT: %require_complete: = require_complete_type %tuple.type [symbolic = %require_complete (constants.%require_complete.500)] +// CHECK:STDOUT: %require_complete.loc28_12.1: = require_complete_type %tuple.type [symbolic = %require_complete.loc28_12.1 (constants.%require_complete.500)] +// CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %tuple.type, @Destroy [symbolic = %Destroy.lookup_impl_witness (constants.%Destroy.lookup_impl_witness)] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %tuple.type, (%Destroy.lookup_impl_witness) [symbolic = %Destroy.facet (constants.%Destroy.facet.1a6)] +// CHECK:STDOUT: %.loc28_12.9: type = fn_type_with_self_type constants.%Op.type.bae, %Destroy.facet [symbolic = %.loc28_12.9 (constants.%.efa)] +// CHECK:STDOUT: %impl.elem0.loc28_12.2: @CallGeneric.%.loc28_12.9 (%.efa) = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc28_12.2 (constants.%impl.elem0.305)] +// CHECK:STDOUT: %specific_impl_fn.loc28_12.2: = specific_impl_function %impl.elem0.loc28_12.2, @Op.1(%Destroy.facet) [symbolic = %specific_impl_fn.loc28_12.2 (constants.%specific_impl_fn.52a)] +// CHECK:STDOUT: %require_complete.loc28_12.2: = require_complete_type %T.as_type.loc28_4.2 [symbolic = %require_complete.loc28_12.2 (constants.%require_complete.19f)] // CHECK:STDOUT: // CHECK:STDOUT: fn() { // CHECK:STDOUT: !entry: @@ -897,10 +1030,10 @@ fn CallIndirect() { // CHECK:STDOUT: %F.ref: %A.assoc_type.296 = name_ref F, %.loc28_4.1 [concrete = constants.%assoc0.5f6] // CHECK:STDOUT: %T.as_type.loc28_4.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc28_4.2 (constants.%T.as_type)] // CHECK:STDOUT: %.loc28_4.2: type = converted %T.ref, %T.as_type.loc28_4.1 [symbolic = %T.as_type.loc28_4.2 (constants.%T.as_type)] -// CHECK:STDOUT: %impl.elem0.loc28_4.1: @CallGeneric.%.loc28_4.3 (%.ffa) = impl_witness_access constants.%A.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc28_4.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %impl.elem0.loc28_4.1: @CallGeneric.%.loc28_4.3 (%.ffa) = impl_witness_access constants.%A.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc28_4.2 (constants.%impl.elem0.0e5)] // CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z] // CHECK:STDOUT: %.loc28_11.1: %empty_struct_type = struct_literal () -// CHECK:STDOUT: %specific_impl_fn.loc28_4.1: = specific_impl_function %impl.elem0.loc28_4.1, @F.1(constants.%X, constants.%A.facet.11f, constants.%Z) [symbolic = %specific_impl_fn.loc28_4.2 (constants.%specific_impl_fn)] +// CHECK:STDOUT: %specific_impl_fn.loc28_4.1: = specific_impl_function %impl.elem0.loc28_4.1, @F.1(constants.%X, constants.%A.facet.11f, constants.%Z) [symbolic = %specific_impl_fn.loc28_4.2 (constants.%specific_impl_fn.e7e)] // CHECK:STDOUT: %.loc28_12.1: ref @CallGeneric.%tuple.type (%tuple.type.e28) = temporary_storage // CHECK:STDOUT: %.loc28_11.2: ref %Z = temporary_storage // CHECK:STDOUT: %.loc28_11.3: init %Z = class_init (), %.loc28_11.2 [concrete = constants.%Z.val] @@ -909,6 +1042,25 @@ fn CallIndirect() { // CHECK:STDOUT: %.loc28_11.6: %Z = bind_value %.loc28_11.5 // CHECK:STDOUT: %.loc28_12.2: init @CallGeneric.%tuple.type (%tuple.type.e28) = call %specific_impl_fn.loc28_4.1(%.loc28_11.6) to %.loc28_12.1 // CHECK:STDOUT: %.loc28_12.3: ref @CallGeneric.%tuple.type (%tuple.type.e28) = temporary %.loc28_12.1, %.loc28_12.2 +// CHECK:STDOUT: %impl.elem0.loc28_11: %.b91 = impl_witness_access constants.%Destroy.impl_witness.347, element0 [concrete = constants.%Op.6e3] +// CHECK:STDOUT: %bound_method.loc28_11.1: = bound_method %.loc28_11.2, %impl.elem0.loc28_11 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0.loc28_11, @Op.2(constants.%Z) [concrete = constants.%Op.specific_fn.3b7] +// CHECK:STDOUT: %bound_method.loc28_11.2: = bound_method %.loc28_11.2, %specific_fn +// CHECK:STDOUT: %.loc28_11.7: %Z = bind_value %.loc28_11.2 +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc28_11.2(%.loc28_11.7) +// CHECK:STDOUT: %impl.elem0.loc28_12.1: @CallGeneric.%.loc28_12.9 (%.efa) = impl_witness_access constants.%Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc28_12.2 (constants.%impl.elem0.305)] +// CHECK:STDOUT: %bound_method.loc28_12.1: = bound_method %.loc28_12.1, %impl.elem0.loc28_12.1 +// CHECK:STDOUT: %specific_impl_fn.loc28_12.1: = specific_impl_function %impl.elem0.loc28_12.1, @Op.1(constants.%Destroy.facet.1a6) [symbolic = %specific_impl_fn.loc28_12.2 (constants.%specific_impl_fn.52a)] +// CHECK:STDOUT: %bound_method.loc28_12.2: = bound_method %.loc28_12.1, %specific_impl_fn.loc28_12.1 +// CHECK:STDOUT: %tuple.elem0: ref %X = tuple_access %.loc28_12.1, element0 +// CHECK:STDOUT: %.loc28_12.4: %X = bind_value %tuple.elem0 +// CHECK:STDOUT: %tuple.elem1: ref @CallGeneric.%T.as_type.loc28_4.2 (%T.as_type) = tuple_access %.loc28_12.1, element1 +// CHECK:STDOUT: %.loc28_12.5: @CallGeneric.%T.as_type.loc28_4.2 (%T.as_type) = bind_value %tuple.elem1 +// CHECK:STDOUT: %tuple.elem2: ref %Z = tuple_access %.loc28_12.1, element2 +// CHECK:STDOUT: %.loc28_12.6: %Z = bind_value %tuple.elem2 +// CHECK:STDOUT: %tuple: @CallGeneric.%tuple.type (%tuple.type.e28) = tuple_value (%.loc28_12.4, %.loc28_12.5, %.loc28_12.6) +// CHECK:STDOUT: %.loc28_12.7: @CallGeneric.%tuple.type (%tuple.type.e28) = converted %.loc28_12.1, %tuple +// CHECK:STDOUT: %.loc28_12.8: init %empty_tuple.type = call %bound_method.loc28_12.2(%.loc28_12.7) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -938,7 +1090,7 @@ fn CallIndirect() { // CHECK:STDOUT: %A.type => constants.%A.type.75a // CHECK:STDOUT: %Self => constants.%Self.753 // CHECK:STDOUT: %tuple.type.loc6_38.1 => constants.%tuple.type.e59 -// CHECK:STDOUT: %Self.as_type.loc6_38.1 => constants.%Self.as_type +// CHECK:STDOUT: %Self.as_type.loc6_38.1 => constants.%Self.as_type.81d // CHECK:STDOUT: %tuple.type.loc6_38.2 => constants.%tuple.type.bd2 // CHECK:STDOUT: %pattern_type.loc6_24 => constants.%pattern_type.44c // CHECK:STDOUT: } @@ -955,7 +1107,7 @@ fn CallIndirect() { // CHECK:STDOUT: %assoc0.loc6_39.2 => constants.%assoc0.c82 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @impl(constants.%V1, constants.%V2, constants.%W) { +// CHECK:STDOUT: specific @impl.220(constants.%V1, constants.%V2, constants.%W) { // CHECK:STDOUT: %V1.loc14_14.2 => constants.%V1 // CHECK:STDOUT: %V2.loc14_25.2 => constants.%V2 // CHECK:STDOUT: %W.loc14_36.2 => constants.%W @@ -1011,7 +1163,7 @@ fn CallIndirect() { // CHECK:STDOUT: %assoc0.loc6_39.2 => constants.%assoc0.5f6 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @impl(constants.%Y1, constants.%Y2, constants.%X) { +// CHECK:STDOUT: specific @impl.220(constants.%Y1, constants.%Y2, constants.%X) { // CHECK:STDOUT: %V1.loc14_14.2 => constants.%Y1 // CHECK:STDOUT: %V2.loc14_25.2 => constants.%Y2 // CHECK:STDOUT: %W.loc14_36.2 => constants.%X @@ -1070,7 +1222,13 @@ fn CallIndirect() { // CHECK:STDOUT: %impl.elem0.loc28_4.2 => constants.%F.93b // CHECK:STDOUT: %specific_impl_fn.loc28_4.2 => constants.%F.specific_fn.79b // CHECK:STDOUT: %tuple.type => constants.%tuple.type.415 -// CHECK:STDOUT: %require_complete => constants.%complete_type.aa8 +// CHECK:STDOUT: %require_complete.loc28_12.1 => constants.%complete_type.aa8 +// CHECK:STDOUT: %Destroy.lookup_impl_witness => constants.%Destroy.impl_witness.c80 +// CHECK:STDOUT: %Destroy.facet => constants.%Destroy.facet.2b1 +// CHECK:STDOUT: %.loc28_12.9 => constants.%.1b7 +// CHECK:STDOUT: %impl.elem0.loc28_12.2 => constants.%Op.66e +// CHECK:STDOUT: %specific_impl_fn.loc28_12.2 => constants.%Op.specific_fn.ce9 +// CHECK:STDOUT: %require_complete.loc28_12.2 => constants.%complete_type.4d1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @F.1(constants.%X, constants.%A.facet.414, constants.%Z) { diff --git a/toolchain/check/testdata/interop/cpp/function/class.carbon b/toolchain/check/testdata/interop/cpp/function/class.carbon index fe0788ac1fe5..6cbd78bebebe 100644 --- a/toolchain/check/testdata/interop/cpp/function/class.carbon +++ b/toolchain/check/testdata/interop/cpp/function/class.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/none.carbon +// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/destroy.carbon // // AUTOUPDATE // TIP: To test this file alone, run: @@ -391,6 +391,17 @@ fn F() { // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] // CHECK:STDOUT: %C.val: %C = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.4f0: = impl_witness imports.%Destroy.impl_witness_table, @impl(%C) [concrete] +// CHECK:STDOUT: %Op.type.1b3: type = fn_type @Op.2, @impl(%C) [concrete] +// CHECK:STDOUT: %Op.21b: %Op.type.1b3 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %C, (%Destroy.impl_witness.4f0) [concrete] +// CHECK:STDOUT: %.b20: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.21b, @Op.2(%C) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -405,6 +416,8 @@ fn F() { // CHECK:STDOUT: } { // CHECK:STDOUT: // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { @@ -418,6 +431,12 @@ fn F() { // CHECK:STDOUT: %.loc8_12.5: ref %C = converted %.loc8_12.1, %.loc8_12.4 // CHECK:STDOUT: %.loc8_12.6: %C = bind_value %.loc8_12.5 // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc8_12.6) +// CHECK:STDOUT: %impl.elem0: %.b20 = impl_witness_access constants.%Destroy.impl_witness.4f0, element0 [concrete = constants.%Op.21b] +// CHECK:STDOUT: %bound_method.loc8_12.1: = bound_method %.loc8_12.2, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%C) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc8_12.2: = bound_method %.loc8_12.2, %specific_fn +// CHECK:STDOUT: %.loc8_12.7: %C = bind_value %.loc8_12.2 +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc8_12.2(%.loc8_12.7) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -430,6 +449,17 @@ fn F() { // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] // CHECK:STDOUT: %C.val: %C = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.4f0: = impl_witness imports.%Destroy.impl_witness_table, @impl(%C) [concrete] +// CHECK:STDOUT: %Op.type.1b3: type = fn_type @Op.2, @impl(%C) [concrete] +// CHECK:STDOUT: %Op.21b: %Op.type.1b3 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %C, (%Destroy.impl_witness.4f0) [concrete] +// CHECK:STDOUT: %.b20: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.21b, @Op.2(%C) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -444,6 +474,8 @@ fn F() { // CHECK:STDOUT: } { // CHECK:STDOUT: // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { @@ -457,6 +489,12 @@ fn F() { // CHECK:STDOUT: %.loc8_12.5: ref %C = converted %.loc8_12.1, %.loc8_12.4 // CHECK:STDOUT: %.loc8_12.6: %C = bind_value %.loc8_12.5 // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc8_12.6) +// CHECK:STDOUT: %impl.elem0: %.b20 = impl_witness_access constants.%Destroy.impl_witness.4f0, element0 [concrete = constants.%Op.21b] +// CHECK:STDOUT: %bound_method.loc8_12.1: = bound_method %.loc8_12.2, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%C) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc8_12.2: = bound_method %.loc8_12.2, %specific_fn +// CHECK:STDOUT: %.loc8_12.7: %C = bind_value %.loc8_12.2 +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc8_12.2(%.loc8_12.7) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -469,6 +507,17 @@ fn F() { // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] // CHECK:STDOUT: %C.val: %C = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.4f0: = impl_witness imports.%Destroy.impl_witness_table, @impl(%C) [concrete] +// CHECK:STDOUT: %Op.type.1b3: type = fn_type @Op.2, @impl(%C) [concrete] +// CHECK:STDOUT: %Op.21b: %Op.type.1b3 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %C, (%Destroy.impl_witness.4f0) [concrete] +// CHECK:STDOUT: %.b20: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.21b, @Op.2(%C) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -483,6 +532,8 @@ fn F() { // CHECK:STDOUT: } { // CHECK:STDOUT: // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { @@ -496,6 +547,12 @@ fn F() { // CHECK:STDOUT: %.loc8_12.5: ref %C = converted %.loc8_12.1, %.loc8_12.4 // CHECK:STDOUT: %.loc8_12.6: %C = bind_value %.loc8_12.5 // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc8_12.6) +// CHECK:STDOUT: %impl.elem0: %.b20 = impl_witness_access constants.%Destroy.impl_witness.4f0, element0 [concrete = constants.%Op.21b] +// CHECK:STDOUT: %bound_method.loc8_12.1: = bound_method %.loc8_12.2, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%C) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc8_12.2: = bound_method %.loc8_12.2, %specific_fn +// CHECK:STDOUT: %.loc8_12.7: %C = bind_value %.loc8_12.2 +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc8_12.2(%.loc8_12.7) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -508,6 +565,17 @@ fn F() { // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] // CHECK:STDOUT: %C.val: %C = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.86f: = impl_witness imports.%Destroy.impl_witness_table, @impl(%C) [concrete] +// CHECK:STDOUT: %Op.type.9ae: type = fn_type @Op.2, @impl(%C) [concrete] +// CHECK:STDOUT: %Op.dbb: %Op.type.9ae = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %C, (%Destroy.impl_witness.86f) [concrete] +// CHECK:STDOUT: %.268: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.dbb, @Op.2(%C) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -520,6 +588,8 @@ fn F() { // CHECK:STDOUT: } { // CHECK:STDOUT: // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { @@ -533,6 +603,12 @@ fn F() { // CHECK:STDOUT: %.loc8_12.5: ref %C = converted %.loc8_12.1, %.loc8_12.4 // CHECK:STDOUT: %.loc8_12.6: %C = bind_value %.loc8_12.5 // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc8_12.6) +// CHECK:STDOUT: %impl.elem0: %.268 = impl_witness_access constants.%Destroy.impl_witness.86f, element0 [concrete = constants.%Op.dbb] +// CHECK:STDOUT: %bound_method.loc8_12.1: = bound_method %.loc8_12.2, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%C) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc8_12.2: = bound_method %.loc8_12.2, %specific_fn +// CHECK:STDOUT: %.loc8_12.7: %C = bind_value %.loc8_12.2 +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc8_12.2(%.loc8_12.7) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -545,6 +621,17 @@ fn F() { // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] // CHECK:STDOUT: %C.val: %C = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.5c3: = impl_witness imports.%Destroy.impl_witness_table, @impl(%C) [concrete] +// CHECK:STDOUT: %Op.type.b28: type = fn_type @Op.2, @impl(%C) [concrete] +// CHECK:STDOUT: %Op.f48: %Op.type.b28 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %C, (%Destroy.impl_witness.5c3) [concrete] +// CHECK:STDOUT: %.f7d: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.f48, @Op.2(%C) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -561,6 +648,8 @@ fn F() { // CHECK:STDOUT: } { // CHECK:STDOUT: // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { @@ -575,6 +664,12 @@ fn F() { // CHECK:STDOUT: %.loc8_15.5: ref %C = converted %.loc8_15.1, %.loc8_15.4 // CHECK:STDOUT: %.loc8_15.6: %C = bind_value %.loc8_15.5 // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc8_15.6) +// CHECK:STDOUT: %impl.elem0: %.f7d = impl_witness_access constants.%Destroy.impl_witness.5c3, element0 [concrete = constants.%Op.f48] +// CHECK:STDOUT: %bound_method.loc8_15.1: = bound_method %.loc8_15.2, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%C) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc8_15.2: = bound_method %.loc8_15.2, %specific_fn +// CHECK:STDOUT: %.loc8_15.7: %C = bind_value %.loc8_15.2 +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc8_15.2(%.loc8_15.7) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -589,6 +684,17 @@ fn F() { // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] // CHECK:STDOUT: %C.val: %C = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.4f0: = impl_witness imports.%Destroy.impl_witness_table, @impl(%C) [concrete] +// CHECK:STDOUT: %Op.type.1b3: type = fn_type @Op.2, @impl(%C) [concrete] +// CHECK:STDOUT: %Op.21b: %Op.type.1b3 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %C, (%Destroy.impl_witness.4f0) [concrete] +// CHECK:STDOUT: %.b20: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.21b, @Op.2(%C) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -604,6 +710,8 @@ fn F() { // CHECK:STDOUT: } { // CHECK:STDOUT: // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { @@ -622,6 +730,12 @@ fn F() { // CHECK:STDOUT: %.loc9_12.5: ref %C = converted %.loc9_12.1, %.loc9_12.4 // CHECK:STDOUT: %.loc9_12.6: %C = bind_value %.loc9_12.5 // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc9_12.6) +// CHECK:STDOUT: %impl.elem0: %.b20 = impl_witness_access constants.%Destroy.impl_witness.4f0, element0 [concrete = constants.%Op.21b] +// CHECK:STDOUT: %bound_method.loc9_12.1: = bound_method %.loc9_12.2, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%C) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc9_12.2: = bound_method %.loc9_12.2, %specific_fn +// CHECK:STDOUT: %.loc9_12.7: %C = bind_value %.loc9_12.2 +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc9_12.2(%.loc9_12.7) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -636,6 +750,17 @@ fn F() { // CHECK:STDOUT: %C.val: %C = struct_value () [concrete] // CHECK:STDOUT: %bar.type: type = fn_type @bar [concrete] // CHECK:STDOUT: %bar: %bar.type = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.4f0: = impl_witness imports.%Destroy.impl_witness_table, @impl(%C) [concrete] +// CHECK:STDOUT: %Op.type.1b3: type = fn_type @Op.2, @impl(%C) [concrete] +// CHECK:STDOUT: %Op.21b: %Op.type.1b3 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %C, (%Destroy.impl_witness.4f0) [concrete] +// CHECK:STDOUT: %.b20: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.21b, @Op.2(%C) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -651,6 +776,8 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: %bar.decl: %bar.type = fn_decl @bar [concrete = constants.%bar] {} {} +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { @@ -668,6 +795,12 @@ fn F() { // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %bar.ref: %bar.type = name_ref bar, imports.%bar.decl [concrete = constants.%bar] // CHECK:STDOUT: %bar.call: init %empty_tuple.type = call %bar.ref() +// CHECK:STDOUT: %impl.elem0: %.b20 = impl_witness_access constants.%Destroy.impl_witness.4f0, element0 [concrete = constants.%Op.21b] +// CHECK:STDOUT: %bound_method.loc8_12.1: = bound_method %.loc8_12.2, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%C) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc8_12.2: = bound_method %.loc8_12.2, %specific_fn +// CHECK:STDOUT: %.loc8_12.7: %C = bind_value %.loc8_12.2 +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc8_12.2(%.loc8_12.7) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -719,9 +852,21 @@ fn F() { // CHECK:STDOUT: --- import_definition_value_return_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %C: type = class_type @C [concrete] // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.4f0: = impl_witness imports.%Destroy.impl_witness_table, @impl(%C) [concrete] +// CHECK:STDOUT: %Op.type.1b3: type = fn_type @Op.2, @impl(%C) [concrete] +// CHECK:STDOUT: %Op.21b: %Op.type.1b3 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %C, (%Destroy.impl_witness.4f0) [concrete] +// CHECK:STDOUT: %.b20: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.21b, @Op.2(%C) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -736,6 +881,8 @@ fn F() { // CHECK:STDOUT: } { // CHECK:STDOUT: // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { @@ -745,6 +892,12 @@ fn F() { // CHECK:STDOUT: %.loc8_11.1: ref %C = temporary_storage // CHECK:STDOUT: %foo.call: init %C = call %foo.ref() to %.loc8_11.1 // CHECK:STDOUT: %.loc8_11.2: ref %C = temporary %.loc8_11.1, %foo.call +// CHECK:STDOUT: %impl.elem0: %.b20 = impl_witness_access constants.%Destroy.impl_witness.4f0, element0 [concrete = constants.%Op.21b] +// CHECK:STDOUT: %bound_method.loc8_11.1: = bound_method %.loc8_11.1, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%C) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc8_11.2: = bound_method %.loc8_11.1, %specific_fn +// CHECK:STDOUT: %.loc8_11.3: %C = bind_value %.loc8_11.1 +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc8_11.2(%.loc8_11.3) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interop/cpp/function/struct.carbon b/toolchain/check/testdata/interop/cpp/function/struct.carbon index 935a8daaffe7..a21ecac79482 100644 --- a/toolchain/check/testdata/interop/cpp/function/struct.carbon +++ b/toolchain/check/testdata/interop/cpp/function/struct.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/none.carbon +// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/destroy.carbon // // AUTOUPDATE // TIP: To test this file alone, run: @@ -391,6 +391,17 @@ fn F() { // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] // CHECK:STDOUT: %S.val: %S = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.2d2: = impl_witness imports.%Destroy.impl_witness_table, @impl(%S) [concrete] +// CHECK:STDOUT: %Op.type.642: type = fn_type @Op.2, @impl(%S) [concrete] +// CHECK:STDOUT: %Op.ab5: %Op.type.642 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %S, (%Destroy.impl_witness.2d2) [concrete] +// CHECK:STDOUT: %.271: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.ab5, @Op.2(%S) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -405,6 +416,8 @@ fn F() { // CHECK:STDOUT: } { // CHECK:STDOUT: // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { @@ -418,6 +431,12 @@ fn F() { // CHECK:STDOUT: %.loc8_12.5: ref %S = converted %.loc8_12.1, %.loc8_12.4 // CHECK:STDOUT: %.loc8_12.6: %S = bind_value %.loc8_12.5 // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc8_12.6) +// CHECK:STDOUT: %impl.elem0: %.271 = impl_witness_access constants.%Destroy.impl_witness.2d2, element0 [concrete = constants.%Op.ab5] +// CHECK:STDOUT: %bound_method.loc8_12.1: = bound_method %.loc8_12.2, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%S) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc8_12.2: = bound_method %.loc8_12.2, %specific_fn +// CHECK:STDOUT: %.loc8_12.7: %S = bind_value %.loc8_12.2 +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc8_12.2(%.loc8_12.7) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -430,6 +449,17 @@ fn F() { // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] // CHECK:STDOUT: %S.val: %S = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.2d2: = impl_witness imports.%Destroy.impl_witness_table, @impl(%S) [concrete] +// CHECK:STDOUT: %Op.type.642: type = fn_type @Op.2, @impl(%S) [concrete] +// CHECK:STDOUT: %Op.ab5: %Op.type.642 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %S, (%Destroy.impl_witness.2d2) [concrete] +// CHECK:STDOUT: %.271: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.ab5, @Op.2(%S) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -444,6 +474,8 @@ fn F() { // CHECK:STDOUT: } { // CHECK:STDOUT: // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { @@ -457,6 +489,12 @@ fn F() { // CHECK:STDOUT: %.loc8_12.5: ref %S = converted %.loc8_12.1, %.loc8_12.4 // CHECK:STDOUT: %.loc8_12.6: %S = bind_value %.loc8_12.5 // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc8_12.6) +// CHECK:STDOUT: %impl.elem0: %.271 = impl_witness_access constants.%Destroy.impl_witness.2d2, element0 [concrete = constants.%Op.ab5] +// CHECK:STDOUT: %bound_method.loc8_12.1: = bound_method %.loc8_12.2, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%S) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc8_12.2: = bound_method %.loc8_12.2, %specific_fn +// CHECK:STDOUT: %.loc8_12.7: %S = bind_value %.loc8_12.2 +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc8_12.2(%.loc8_12.7) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -469,6 +507,17 @@ fn F() { // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] // CHECK:STDOUT: %S.val: %S = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.2d2: = impl_witness imports.%Destroy.impl_witness_table, @impl(%S) [concrete] +// CHECK:STDOUT: %Op.type.642: type = fn_type @Op.2, @impl(%S) [concrete] +// CHECK:STDOUT: %Op.ab5: %Op.type.642 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %S, (%Destroy.impl_witness.2d2) [concrete] +// CHECK:STDOUT: %.271: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.ab5, @Op.2(%S) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -483,6 +532,8 @@ fn F() { // CHECK:STDOUT: } { // CHECK:STDOUT: // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { @@ -496,6 +547,12 @@ fn F() { // CHECK:STDOUT: %.loc8_12.5: ref %S = converted %.loc8_12.1, %.loc8_12.4 // CHECK:STDOUT: %.loc8_12.6: %S = bind_value %.loc8_12.5 // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc8_12.6) +// CHECK:STDOUT: %impl.elem0: %.271 = impl_witness_access constants.%Destroy.impl_witness.2d2, element0 [concrete = constants.%Op.ab5] +// CHECK:STDOUT: %bound_method.loc8_12.1: = bound_method %.loc8_12.2, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%S) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc8_12.2: = bound_method %.loc8_12.2, %specific_fn +// CHECK:STDOUT: %.loc8_12.7: %S = bind_value %.loc8_12.2 +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc8_12.2(%.loc8_12.7) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -508,6 +565,17 @@ fn F() { // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] // CHECK:STDOUT: %S.val: %S = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.0f8: = impl_witness imports.%Destroy.impl_witness_table, @impl(%S) [concrete] +// CHECK:STDOUT: %Op.type.2b5: type = fn_type @Op.2, @impl(%S) [concrete] +// CHECK:STDOUT: %Op.9b3: %Op.type.2b5 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %S, (%Destroy.impl_witness.0f8) [concrete] +// CHECK:STDOUT: %.f1f: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.9b3, @Op.2(%S) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -520,6 +588,8 @@ fn F() { // CHECK:STDOUT: } { // CHECK:STDOUT: // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { @@ -533,6 +603,12 @@ fn F() { // CHECK:STDOUT: %.loc8_12.5: ref %S = converted %.loc8_12.1, %.loc8_12.4 // CHECK:STDOUT: %.loc8_12.6: %S = bind_value %.loc8_12.5 // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc8_12.6) +// CHECK:STDOUT: %impl.elem0: %.f1f = impl_witness_access constants.%Destroy.impl_witness.0f8, element0 [concrete = constants.%Op.9b3] +// CHECK:STDOUT: %bound_method.loc8_12.1: = bound_method %.loc8_12.2, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%S) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc8_12.2: = bound_method %.loc8_12.2, %specific_fn +// CHECK:STDOUT: %.loc8_12.7: %S = bind_value %.loc8_12.2 +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc8_12.2(%.loc8_12.7) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -545,6 +621,17 @@ fn F() { // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] // CHECK:STDOUT: %S.val: %S = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.1b1: = impl_witness imports.%Destroy.impl_witness_table, @impl(%S) [concrete] +// CHECK:STDOUT: %Op.type.17f: type = fn_type @Op.2, @impl(%S) [concrete] +// CHECK:STDOUT: %Op.463: %Op.type.17f = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %S, (%Destroy.impl_witness.1b1) [concrete] +// CHECK:STDOUT: %.74f: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.463, @Op.2(%S) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -561,6 +648,8 @@ fn F() { // CHECK:STDOUT: } { // CHECK:STDOUT: // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { @@ -575,6 +664,12 @@ fn F() { // CHECK:STDOUT: %.loc8_15.5: ref %S = converted %.loc8_15.1, %.loc8_15.4 // CHECK:STDOUT: %.loc8_15.6: %S = bind_value %.loc8_15.5 // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc8_15.6) +// CHECK:STDOUT: %impl.elem0: %.74f = impl_witness_access constants.%Destroy.impl_witness.1b1, element0 [concrete = constants.%Op.463] +// CHECK:STDOUT: %bound_method.loc8_15.1: = bound_method %.loc8_15.2, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%S) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc8_15.2: = bound_method %.loc8_15.2, %specific_fn +// CHECK:STDOUT: %.loc8_15.7: %S = bind_value %.loc8_15.2 +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc8_15.2(%.loc8_15.7) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -589,6 +684,17 @@ fn F() { // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] // CHECK:STDOUT: %S.val: %S = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.2d2: = impl_witness imports.%Destroy.impl_witness_table, @impl(%S) [concrete] +// CHECK:STDOUT: %Op.type.642: type = fn_type @Op.2, @impl(%S) [concrete] +// CHECK:STDOUT: %Op.ab5: %Op.type.642 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %S, (%Destroy.impl_witness.2d2) [concrete] +// CHECK:STDOUT: %.271: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.ab5, @Op.2(%S) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -604,6 +710,8 @@ fn F() { // CHECK:STDOUT: } { // CHECK:STDOUT: // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { @@ -622,6 +730,12 @@ fn F() { // CHECK:STDOUT: %.loc9_12.5: ref %S = converted %.loc9_12.1, %.loc9_12.4 // CHECK:STDOUT: %.loc9_12.6: %S = bind_value %.loc9_12.5 // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc9_12.6) +// CHECK:STDOUT: %impl.elem0: %.271 = impl_witness_access constants.%Destroy.impl_witness.2d2, element0 [concrete = constants.%Op.ab5] +// CHECK:STDOUT: %bound_method.loc9_12.1: = bound_method %.loc9_12.2, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%S) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc9_12.2: = bound_method %.loc9_12.2, %specific_fn +// CHECK:STDOUT: %.loc9_12.7: %S = bind_value %.loc9_12.2 +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc9_12.2(%.loc9_12.7) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -636,6 +750,17 @@ fn F() { // CHECK:STDOUT: %S.val: %S = struct_value () [concrete] // CHECK:STDOUT: %bar.type: type = fn_type @bar [concrete] // CHECK:STDOUT: %bar: %bar.type = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.2d2: = impl_witness imports.%Destroy.impl_witness_table, @impl(%S) [concrete] +// CHECK:STDOUT: %Op.type.642: type = fn_type @Op.2, @impl(%S) [concrete] +// CHECK:STDOUT: %Op.ab5: %Op.type.642 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %S, (%Destroy.impl_witness.2d2) [concrete] +// CHECK:STDOUT: %.271: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.ab5, @Op.2(%S) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -651,6 +776,8 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: %bar.decl: %bar.type = fn_decl @bar [concrete = constants.%bar] {} {} +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { @@ -668,6 +795,12 @@ fn F() { // CHECK:STDOUT: %S.ref: type = name_ref S, imports.%S.decl [concrete = constants.%S] // CHECK:STDOUT: %bar.ref: %bar.type = name_ref bar, imports.%bar.decl [concrete = constants.%bar] // CHECK:STDOUT: %bar.call: init %empty_tuple.type = call %bar.ref() +// CHECK:STDOUT: %impl.elem0: %.271 = impl_witness_access constants.%Destroy.impl_witness.2d2, element0 [concrete = constants.%Op.ab5] +// CHECK:STDOUT: %bound_method.loc8_12.1: = bound_method %.loc8_12.2, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%S) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc8_12.2: = bound_method %.loc8_12.2, %specific_fn +// CHECK:STDOUT: %.loc8_12.7: %S = bind_value %.loc8_12.2 +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc8_12.2(%.loc8_12.7) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -719,9 +852,21 @@ fn F() { // CHECK:STDOUT: --- import_definition_value_return_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %S: type = class_type @S [concrete] // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.2d2: = impl_witness imports.%Destroy.impl_witness_table, @impl(%S) [concrete] +// CHECK:STDOUT: %Op.type.642: type = fn_type @Op.2, @impl(%S) [concrete] +// CHECK:STDOUT: %Op.ab5: %Op.type.642 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %S, (%Destroy.impl_witness.2d2) [concrete] +// CHECK:STDOUT: %.271: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.ab5, @Op.2(%S) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -736,6 +881,8 @@ fn F() { // CHECK:STDOUT: } { // CHECK:STDOUT: // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { @@ -745,6 +892,12 @@ fn F() { // CHECK:STDOUT: %.loc8_11.1: ref %S = temporary_storage // CHECK:STDOUT: %foo.call: init %S = call %foo.ref() to %.loc8_11.1 // CHECK:STDOUT: %.loc8_11.2: ref %S = temporary %.loc8_11.1, %foo.call +// CHECK:STDOUT: %impl.elem0: %.271 = impl_witness_access constants.%Destroy.impl_witness.2d2, element0 [concrete = constants.%Op.ab5] +// CHECK:STDOUT: %bound_method.loc8_11.1: = bound_method %.loc8_11.1, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%S) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc8_11.2: = bound_method %.loc8_11.1, %specific_fn +// CHECK:STDOUT: %.loc8_11.3: %S = bind_value %.loc8_11.1 +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc8_11.2(%.loc8_11.3) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interop/cpp/function_param_int16.carbon b/toolchain/check/testdata/interop/cpp/function_param_int16.carbon new file mode 100644 index 000000000000..f7bdf593ed2c --- /dev/null +++ b/toolchain/check/testdata/interop/cpp/function_param_int16.carbon @@ -0,0 +1,1790 @@ +// Part of the Carbon Language project, under the Apache License v2.0 with LLVM +// Exceptions. See /LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only". +// EXTRA-ARGS: --dump-sem-ir-ranges=if-present +// +// AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function_param_int16.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function_param_int16.carbon + +// ============================================================================ +// short +// ============================================================================ + +// --- short.h + +auto foo(short a) -> void; + +// --- import_short.carbon + +library "[[@TEST_NAME]]"; + +import Cpp library "short.h"; + +fn F() { + Cpp.foo(1 as i16); +} + +// --- import_short_max.carbon + +library "[[@TEST_NAME]]"; + +import Cpp library "short.h"; + +fn F() { + Cpp.foo(0x7FFF); +} + +// --- fail_import_short_overflow_max.carbon + +library "[[@TEST_NAME]]"; + +import Cpp library "short.h"; + +fn F() { + // CHECK:STDERR: fail_import_short_overflow_max.carbon:[[@LINE+5]]:11: error: integer value 32768 too large for type `i16` [IntTooLargeForType] + // CHECK:STDERR: Cpp.foo(0x8000); + // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_import_short_overflow_max.carbon: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: + Cpp.foo(0x8000); +} + +// --- import_short_min.carbon + +library "[[@TEST_NAME]]"; + +import Cpp library "short.h"; + +fn F() { + Cpp.foo(-0x8000); +} + +// --- fail_import_short_overflow_min.carbon + +library "[[@TEST_NAME]]"; + +import Cpp library "short.h"; + +fn F() { + // CHECK:STDERR: fail_import_short_overflow_min.carbon:[[@LINE+5]]:11: error: integer value -32769 too large for type `i16` [IntTooLargeForType] + // CHECK:STDERR: Cpp.foo(-0x8001); + // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_import_short_overflow_min.carbon: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: + Cpp.foo(-0x8001); +} + +// --- fail_import_short_int32_arg.carbon + +library "[[@TEST_NAME]]"; + +import Cpp library "short.h"; + +fn F() { + // CHECK:STDERR: fail_import_short_int32_arg.carbon:[[@LINE+8]]:11: error: cannot implicitly convert expression of type `i32` to `i16` [ConversionFailure] + // CHECK:STDERR: Cpp.foo(1 as i32); + // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_import_short_int32_arg.carbon:[[@LINE+5]]:11: note: type `i32` does not implement interface `Core.ImplicitAs(i16)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: Cpp.foo(1 as i32); + // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_import_short_int32_arg.carbon: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: + Cpp.foo(1 as i32); +} + +// ============================================================================ +// short int +// ============================================================================ + +// --- short_int.h + +auto foo(short int a) -> void; + +// --- import_short_int.carbon + +library "[[@TEST_NAME]]"; + +import Cpp library "short_int.h"; + +fn F() { + Cpp.foo(1 as i16); +} + +// ============================================================================ +// signed short +// ============================================================================ + +// --- signed_short.h + +auto foo(signed short a) -> void; + +// --- import_signed_short.carbon + +library "[[@TEST_NAME]]"; + +import Cpp library "signed_short.h"; + +fn F() { + Cpp.foo(1 as i16); +} + +// ============================================================================ +// signed short int +// ============================================================================ + +// --- signed_short_int.h + +auto foo(signed short int a) -> void; + +// --- import_signed_short_int.carbon + +library "[[@TEST_NAME]]"; + +import Cpp library "signed_short_int.h"; + +fn F() { + Cpp.foo(1 as i16); +} + +// ============================================================================ +// typedef for short +// ============================================================================ + +// --- int16_t.h + +namespace std { + // Mimicking glibc definition for int16_t: https://codebrowser.dev/glibc/glibc/posix/bits/types.h.html#__int16_t + typedef signed short int int16_t; +} // namespace std + +auto foo(std::int16_t a) -> void; + +// --- import_int16_t.carbon + +library "[[@TEST_NAME]]"; + +import Cpp library "int16_t.h"; + +fn F() { + Cpp.foo(1 as i16); +} + +// ============================================================================ +// const short +// ============================================================================ + +// --- const_short.h + +auto foo(const short a) -> void; + +// --- import_const_short.carbon + +library "[[@TEST_NAME]]"; + +import Cpp library "const_short.h"; + +fn F() { + Cpp.foo(1 as i16); +} + +// ============================================================================ +// short reference +// ============================================================================ + +// --- short_ref.h + +auto foo(short& a) -> void; + +// --- fail_todo_import_short_ref.carbon + +library "[[@TEST_NAME]]"; + +import Cpp library "short_ref.h"; + +fn F() { + var a: i16 = 1; + // CHECK:STDERR: fail_todo_import_short_ref.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: parameter type: short &` [SemanticsTodo] + // CHECK:STDERR: Cpp.foo(a); + // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_todo_import_short_ref.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `foo` [InCppNameLookup] + // CHECK:STDERR: Cpp.foo(a); + // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: + Cpp.foo(a); +} + +// ============================================================================ +// const short reference +// ============================================================================ + +// --- const_short_ref.h + +auto foo(const short& a) -> void; + +// --- fail_todo_import_const_short_ref.carbon + +library "[[@TEST_NAME]]"; + +import Cpp library "const_short_ref.h"; + +fn F() { + var a: i16 = 1; + // CHECK:STDERR: fail_todo_import_const_short_ref.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: parameter type: const short &` [SemanticsTodo] + // CHECK:STDERR: Cpp.foo(a); + // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_todo_import_const_short_ref.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `foo` [InCppNameLookup] + // CHECK:STDERR: Cpp.foo(a); + // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: + Cpp.foo(a); +} + +// ============================================================================ +// short pointer +// ============================================================================ + +// --- short_pointer.h + +auto foo(short* a) -> void; + +// --- fail_todo_import_short_pointer.carbon + +library "[[@TEST_NAME]]"; + +import Cpp library "short_pointer.h"; + +fn F() { + var a: i16 = 1; + // CHECK:STDERR: fail_todo_import_short_pointer.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: parameter type: short *` [SemanticsTodo] + // CHECK:STDERR: Cpp.foo(&a); + // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_todo_import_short_pointer.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `foo` [InCppNameLookup] + // CHECK:STDERR: Cpp.foo(&a); + // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: + Cpp.foo(&a); +} + +// ============================================================================ +// const short pointer +// ============================================================================ + +// --- const_short_pointer.h + +auto foo(const short* a) -> void; + +// --- fail_todo_import_const_short_pointer.carbon + +library "[[@TEST_NAME]]"; + +import Cpp library "const_short_pointer.h"; + +fn F() { + var a: i16 = 1; + // CHECK:STDERR: fail_todo_import_const_short_pointer.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: parameter type: const short *` [SemanticsTodo] + // CHECK:STDERR: Cpp.foo(&a); + // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_todo_import_const_short_pointer.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `foo` [InCppNameLookup] + // CHECK:STDERR: Cpp.foo(&a); + // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: + Cpp.foo(&a); +} + +// CHECK:STDOUT: --- import_short.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete] +// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] +// CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete] +// CHECK:STDOUT: %pattern_type.2f8: type = pattern_type %i16 [concrete] +// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] +// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] +// CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete] +// CHECK:STDOUT: %As.type.90f: type = generic_interface_type @As [concrete] +// CHECK:STDOUT: %As.generic: %As.type.90f = struct_value () [concrete] +// CHECK:STDOUT: %As.type.a96: type = facet_type <@As, @As(%i16)> [concrete] +// CHECK:STDOUT: %Convert.type.be5: type = fn_type @Convert.1, @As(%i16) [concrete] +// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.062: type = fn_type @Convert.6, @impl.686(%To.c80) [symbolic] +// CHECK:STDOUT: %Convert.527: %Convert.type.062 = struct_value () [symbolic] +// CHECK:STDOUT: %As.impl_witness.0ef: = impl_witness imports.%As.impl_witness_table.eb4, @impl.686(%int_16) [concrete] +// CHECK:STDOUT: %Convert.type.172: type = fn_type @Convert.6, @impl.686(%int_16) [concrete] +// CHECK:STDOUT: %Convert.489: %Convert.type.172 = struct_value () [concrete] +// CHECK:STDOUT: %As.facet: %As.type.a96 = facet_value Core.IntLiteral, (%As.impl_witness.0ef) [concrete] +// CHECK:STDOUT: %.91d: type = fn_type_with_self_type %Convert.type.be5, %As.facet [concrete] +// CHECK:STDOUT: %Convert.bound: = bound_method %int_1.5b8, %Convert.489 [concrete] +// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.489, @Convert.6(%int_16) [concrete] +// CHECK:STDOUT: %bound_method: = bound_method %int_1.5b8, %Convert.specific_fn [concrete] +// CHECK:STDOUT: %int_1.f90: %i16 = int_value 1 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .As = %Core.As +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Cpp: = namespace file.%Cpp.import_cpp, [concrete] { +// CHECK:STDOUT: .foo = %foo.decl +// CHECK:STDOUT: import Cpp//... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] { +// CHECK:STDOUT: %a.patt: %pattern_type.2f8 = binding_pattern a [concrete] +// CHECK:STDOUT: %a.param_patt: %pattern_type.2f8 = value_param_pattern %a.patt, call_param0 [concrete] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %a.param: %i16 = value_param call_param0 +// CHECK:STDOUT: %.1: type = splice_block %i16 [concrete = constants.%i16] { +// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16] +// CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: %i16 = bind_name a, %a.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.As: %As.type.90f = import_ref Core//prelude/operators/as, As, loaded [concrete = constants.%As.generic] +// CHECK:STDOUT: %Core.import_ref.78a: @impl.686.%Convert.type (%Convert.type.062) = import_ref Core//prelude/types/int, loc28_39, loaded [symbolic = @impl.686.%Convert (constants.%Convert.527)] +// CHECK:STDOUT: %As.impl_witness_table.eb4 = impl_witness_table (%Core.import_ref.78a), @impl.686 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Cpp = imports.%Cpp +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Cpp.import_cpp = import_cpp { +// CHECK:STDOUT: import Cpp "short.h" +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, imports.%foo.decl [concrete = constants.%foo] +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16] +// CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16] +// CHECK:STDOUT: %impl.elem0: %.91d = impl_witness_access constants.%As.impl_witness.0ef, element0 [concrete = constants.%Convert.489] +// CHECK:STDOUT: %bound_method.loc7_13.1: = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Convert.6(constants.%int_16) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_13.2: = bound_method %int_1, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc7_13.2(%int_1) [concrete = constants.%int_1.f90] +// CHECK:STDOUT: %.loc7_13.1: %i16 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.f90] +// CHECK:STDOUT: %.loc7_13.2: %i16 = converted %int_1, %.loc7_13.1 [concrete = constants.%int_1.f90] +// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_13.2) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @foo(%a.param: %i16); +// CHECK:STDOUT: +// CHECK:STDOUT: --- import_short_max.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete] +// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] +// CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete] +// CHECK:STDOUT: %pattern_type.2f8: type = pattern_type %i16 [concrete] +// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] +// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] +// CHECK:STDOUT: %int_32767.f4b: Core.IntLiteral = int_value 32767 [concrete] +// CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete] +// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.type.adb: type = facet_type <@ImplicitAs, @ImplicitAs(%i16)> [concrete] +// CHECK:STDOUT: %Convert.type.fa6: type = fn_type @Convert.1, @ImplicitAs(%i16) [concrete] +// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.3, @impl.4f9(%To.c80) [symbolic] +// CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic] +// CHECK:STDOUT: %ImplicitAs.impl_witness.97b: = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_16) [concrete] +// CHECK:STDOUT: %Convert.type.33c: type = fn_type @Convert.3, @impl.4f9(%int_16) [concrete] +// CHECK:STDOUT: %Convert.d0a: %Convert.type.33c = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.facet.6f2: %ImplicitAs.type.adb = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.97b) [concrete] +// CHECK:STDOUT: %.236: type = fn_type_with_self_type %Convert.type.fa6, %ImplicitAs.facet.6f2 [concrete] +// CHECK:STDOUT: %Convert.bound: = bound_method %int_32767.f4b, %Convert.d0a [concrete] +// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.d0a, @Convert.3(%int_16) [concrete] +// CHECK:STDOUT: %bound_method: = bound_method %int_32767.f4b, %Convert.specific_fn [concrete] +// CHECK:STDOUT: %int_32767.faa: %i16 = int_value 32767 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Cpp: = namespace file.%Cpp.import_cpp, [concrete] { +// CHECK:STDOUT: .foo = %foo.decl +// CHECK:STDOUT: import Cpp//... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] { +// CHECK:STDOUT: %a.patt: %pattern_type.2f8 = binding_pattern a [concrete] +// CHECK:STDOUT: %a.param_patt: %pattern_type.2f8 = value_param_pattern %a.patt, call_param0 [concrete] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %a.param: %i16 = value_param call_param0 +// CHECK:STDOUT: %.1: type = splice_block %i16 [concrete = constants.%i16] { +// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16] +// CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: %i16 = bind_name a, %a.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] +// CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] +// CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Cpp = imports.%Cpp +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Cpp.import_cpp = import_cpp { +// CHECK:STDOUT: import Cpp "short.h" +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, imports.%foo.decl [concrete = constants.%foo] +// CHECK:STDOUT: %int_32767: Core.IntLiteral = int_value 32767 [concrete = constants.%int_32767.f4b] +// CHECK:STDOUT: %impl.elem0: %.236 = impl_witness_access constants.%ImplicitAs.impl_witness.97b, element0 [concrete = constants.%Convert.d0a] +// CHECK:STDOUT: %bound_method.loc7_11.1: = bound_method %int_32767, %impl.elem0 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Convert.3(constants.%int_16) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_11.2: = bound_method %int_32767, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc7_11.2(%int_32767) [concrete = constants.%int_32767.faa] +// CHECK:STDOUT: %.loc7_11.1: %i16 = value_of_initializer %int.convert_checked [concrete = constants.%int_32767.faa] +// CHECK:STDOUT: %.loc7_11.2: %i16 = converted %int_32767, %.loc7_11.1 [concrete = constants.%int_32767.faa] +// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_11.2) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @foo(%a.param: %i16); +// CHECK:STDOUT: +// CHECK:STDOUT: --- fail_import_short_overflow_max.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete] +// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] +// CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete] +// CHECK:STDOUT: %pattern_type.2f8: type = pattern_type %i16 [concrete] +// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] +// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] +// CHECK:STDOUT: %int_32768.4d0: Core.IntLiteral = int_value 32768 [concrete] +// CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete] +// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.type.adb: type = facet_type <@ImplicitAs, @ImplicitAs(%i16)> [concrete] +// CHECK:STDOUT: %Convert.type.fa6: type = fn_type @Convert.1, @ImplicitAs(%i16) [concrete] +// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.3, @impl.4f9(%To.c80) [symbolic] +// CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic] +// CHECK:STDOUT: %ImplicitAs.impl_witness.97b: = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_16) [concrete] +// CHECK:STDOUT: %Convert.type.33c: type = fn_type @Convert.3, @impl.4f9(%int_16) [concrete] +// CHECK:STDOUT: %Convert.d0a: %Convert.type.33c = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.facet.6f2: %ImplicitAs.type.adb = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.97b) [concrete] +// CHECK:STDOUT: %.236: type = fn_type_with_self_type %Convert.type.fa6, %ImplicitAs.facet.6f2 [concrete] +// CHECK:STDOUT: %Convert.bound: = bound_method %int_32768.4d0, %Convert.d0a [concrete] +// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.d0a, @Convert.3(%int_16) [concrete] +// CHECK:STDOUT: %bound_method: = bound_method %int_32768.4d0, %Convert.specific_fn [concrete] +// CHECK:STDOUT: %int_32768.e7f: %i16 = int_value 32768 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Cpp: = namespace file.%Cpp.import_cpp, [concrete] { +// CHECK:STDOUT: .foo = %foo.decl +// CHECK:STDOUT: import Cpp//... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] { +// CHECK:STDOUT: %a.patt: %pattern_type.2f8 = binding_pattern a [concrete] +// CHECK:STDOUT: %a.param_patt: %pattern_type.2f8 = value_param_pattern %a.patt, call_param0 [concrete] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %a.param: %i16 = value_param call_param0 +// CHECK:STDOUT: %.1: type = splice_block %i16 [concrete = constants.%i16] { +// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16] +// CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: %i16 = bind_name a, %a.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] +// CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] +// CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Cpp = imports.%Cpp +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Cpp.import_cpp = import_cpp { +// CHECK:STDOUT: import Cpp "short.h" +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, imports.%foo.decl [concrete = constants.%foo] +// CHECK:STDOUT: %int_32768: Core.IntLiteral = int_value 32768 [concrete = constants.%int_32768.4d0] +// CHECK:STDOUT: %impl.elem0: %.236 = impl_witness_access constants.%ImplicitAs.impl_witness.97b, element0 [concrete = constants.%Convert.d0a] +// CHECK:STDOUT: %bound_method.loc12_11.1: = bound_method %int_32768, %impl.elem0 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Convert.3(constants.%int_16) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc12_11.2: = bound_method %int_32768, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc12_11.2(%int_32768) [concrete = constants.%int_32768.e7f] +// CHECK:STDOUT: %.loc12_11.1: %i16 = value_of_initializer %int.convert_checked [concrete = constants.%int_32768.e7f] +// CHECK:STDOUT: %.loc12_11.2: %i16 = converted %int_32768, %.loc12_11.1 [concrete = constants.%int_32768.e7f] +// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc12_11.2) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @foo(%a.param: %i16); +// CHECK:STDOUT: +// CHECK:STDOUT: --- import_short_min.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete] +// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] +// CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete] +// CHECK:STDOUT: %pattern_type.2f8: type = pattern_type %i16 [concrete] +// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] +// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] +// CHECK:STDOUT: %int_32768: Core.IntLiteral = int_value 32768 [concrete] +// CHECK:STDOUT: %Negate.type: type = facet_type <@Negate> [concrete] +// CHECK:STDOUT: %Op.type.e42: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %Negate.impl_witness.973: = impl_witness imports.%Negate.impl_witness_table.b22 [concrete] +// CHECK:STDOUT: %Negate.facet: %Negate.type = facet_value Core.IntLiteral, (%Negate.impl_witness.973) [concrete] +// CHECK:STDOUT: %.d3d: type = fn_type_with_self_type %Op.type.e42, %Negate.facet [concrete] +// CHECK:STDOUT: %Op.type.18a: type = fn_type @Op.7 [concrete] +// CHECK:STDOUT: %Op.99f: %Op.type.18a = struct_value () [concrete] +// CHECK:STDOUT: %Op.bound: = bound_method %int_32768, %Op.99f [concrete] +// CHECK:STDOUT: %int_-32768.882: Core.IntLiteral = int_value -32768 [concrete] +// CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete] +// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.type.adb: type = facet_type <@ImplicitAs, @ImplicitAs(%i16)> [concrete] +// CHECK:STDOUT: %Convert.type.fa6: type = fn_type @Convert.1, @ImplicitAs(%i16) [concrete] +// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.3, @impl.4f9(%To.c80) [symbolic] +// CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic] +// CHECK:STDOUT: %ImplicitAs.impl_witness.97b: = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_16) [concrete] +// CHECK:STDOUT: %Convert.type.33c: type = fn_type @Convert.3, @impl.4f9(%int_16) [concrete] +// CHECK:STDOUT: %Convert.d0a: %Convert.type.33c = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.facet.6f2: %ImplicitAs.type.adb = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.97b) [concrete] +// CHECK:STDOUT: %.236: type = fn_type_with_self_type %Convert.type.fa6, %ImplicitAs.facet.6f2 [concrete] +// CHECK:STDOUT: %Convert.bound: = bound_method %int_-32768.882, %Convert.d0a [concrete] +// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.d0a, @Convert.3(%int_16) [concrete] +// CHECK:STDOUT: %bound_method: = bound_method %int_-32768.882, %Convert.specific_fn [concrete] +// CHECK:STDOUT: %int_-32768.7e5: %i16 = int_value -32768 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .Negate = %Core.Negate +// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Cpp: = namespace file.%Cpp.import_cpp, [concrete] { +// CHECK:STDOUT: .foo = %foo.decl +// CHECK:STDOUT: import Cpp//... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] { +// CHECK:STDOUT: %a.patt: %pattern_type.2f8 = binding_pattern a [concrete] +// CHECK:STDOUT: %a.param_patt: %pattern_type.2f8 = value_param_pattern %a.patt, call_param0 [concrete] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %a.param: %i16 = value_param call_param0 +// CHECK:STDOUT: %.1: type = splice_block %i16 [concrete = constants.%i16] { +// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16] +// CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: %i16 = bind_name a, %a.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Negate: type = import_ref Core//prelude/operators/arithmetic, Negate, loaded [concrete = constants.%Negate.type] +// CHECK:STDOUT: %Core.import_ref.abd9 = import_ref Core//prelude/operators/arithmetic, loc111_50, unloaded +// CHECK:STDOUT: %Core.import_ref.5e6a: %Op.type.18a = import_ref Core//prelude/operators/arithmetic, loc112_31, loaded [concrete = constants.%Op.99f] +// CHECK:STDOUT: %Negate.impl_witness_table.b22 = impl_witness_table (%Core.import_ref.abd9, %Core.import_ref.5e6a), @impl.0ef [concrete] +// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] +// CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] +// CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Cpp = imports.%Cpp +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Cpp.import_cpp = import_cpp { +// CHECK:STDOUT: import Cpp "short.h" +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, imports.%foo.decl [concrete = constants.%foo] +// CHECK:STDOUT: %int_32768: Core.IntLiteral = int_value 32768 [concrete = constants.%int_32768] +// CHECK:STDOUT: %impl.elem1: %.d3d = impl_witness_access constants.%Negate.impl_witness.973, element1 [concrete = constants.%Op.99f] +// CHECK:STDOUT: %bound_method.loc7_11.1: = bound_method %int_32768, %impl.elem1 [concrete = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate: init Core.IntLiteral = call %bound_method.loc7_11.1(%int_32768) [concrete = constants.%int_-32768.882] +// CHECK:STDOUT: %impl.elem0: %.236 = impl_witness_access constants.%ImplicitAs.impl_witness.97b, element0 [concrete = constants.%Convert.d0a] +// CHECK:STDOUT: %bound_method.loc7_11.2: = bound_method %int.snegate, %impl.elem0 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Convert.3(constants.%int_16) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_11.3: = bound_method %int.snegate, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %.loc7_11.1: Core.IntLiteral = value_of_initializer %int.snegate [concrete = constants.%int_-32768.882] +// CHECK:STDOUT: %.loc7_11.2: Core.IntLiteral = converted %int.snegate, %.loc7_11.1 [concrete = constants.%int_-32768.882] +// CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc7_11.3(%.loc7_11.2) [concrete = constants.%int_-32768.7e5] +// CHECK:STDOUT: %.loc7_11.3: %i16 = value_of_initializer %int.convert_checked [concrete = constants.%int_-32768.7e5] +// CHECK:STDOUT: %.loc7_11.4: %i16 = converted %int.snegate, %.loc7_11.3 [concrete = constants.%int_-32768.7e5] +// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_11.4) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @foo(%a.param: %i16); +// CHECK:STDOUT: +// CHECK:STDOUT: --- fail_import_short_overflow_min.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete] +// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] +// CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete] +// CHECK:STDOUT: %pattern_type.2f8: type = pattern_type %i16 [concrete] +// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] +// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] +// CHECK:STDOUT: %int_32769: Core.IntLiteral = int_value 32769 [concrete] +// CHECK:STDOUT: %Negate.type: type = facet_type <@Negate> [concrete] +// CHECK:STDOUT: %Op.type.e42: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %Negate.impl_witness.973: = impl_witness imports.%Negate.impl_witness_table.b22 [concrete] +// CHECK:STDOUT: %Negate.facet: %Negate.type = facet_value Core.IntLiteral, (%Negate.impl_witness.973) [concrete] +// CHECK:STDOUT: %.d3d: type = fn_type_with_self_type %Op.type.e42, %Negate.facet [concrete] +// CHECK:STDOUT: %Op.type.18a: type = fn_type @Op.7 [concrete] +// CHECK:STDOUT: %Op.99f: %Op.type.18a = struct_value () [concrete] +// CHECK:STDOUT: %Op.bound: = bound_method %int_32769, %Op.99f [concrete] +// CHECK:STDOUT: %int_-32769.5a5: Core.IntLiteral = int_value -32769 [concrete] +// CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete] +// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.type.adb: type = facet_type <@ImplicitAs, @ImplicitAs(%i16)> [concrete] +// CHECK:STDOUT: %Convert.type.fa6: type = fn_type @Convert.1, @ImplicitAs(%i16) [concrete] +// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.3, @impl.4f9(%To.c80) [symbolic] +// CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic] +// CHECK:STDOUT: %ImplicitAs.impl_witness.97b: = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_16) [concrete] +// CHECK:STDOUT: %Convert.type.33c: type = fn_type @Convert.3, @impl.4f9(%int_16) [concrete] +// CHECK:STDOUT: %Convert.d0a: %Convert.type.33c = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.facet.6f2: %ImplicitAs.type.adb = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.97b) [concrete] +// CHECK:STDOUT: %.236: type = fn_type_with_self_type %Convert.type.fa6, %ImplicitAs.facet.6f2 [concrete] +// CHECK:STDOUT: %Convert.bound: = bound_method %int_-32769.5a5, %Convert.d0a [concrete] +// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.d0a, @Convert.3(%int_16) [concrete] +// CHECK:STDOUT: %bound_method: = bound_method %int_-32769.5a5, %Convert.specific_fn [concrete] +// CHECK:STDOUT: %int_-32769.883: %i16 = int_value -32769 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .Negate = %Core.Negate +// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Cpp: = namespace file.%Cpp.import_cpp, [concrete] { +// CHECK:STDOUT: .foo = %foo.decl +// CHECK:STDOUT: import Cpp//... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] { +// CHECK:STDOUT: %a.patt: %pattern_type.2f8 = binding_pattern a [concrete] +// CHECK:STDOUT: %a.param_patt: %pattern_type.2f8 = value_param_pattern %a.patt, call_param0 [concrete] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %a.param: %i16 = value_param call_param0 +// CHECK:STDOUT: %.1: type = splice_block %i16 [concrete = constants.%i16] { +// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16] +// CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: %i16 = bind_name a, %a.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Negate: type = import_ref Core//prelude/operators/arithmetic, Negate, loaded [concrete = constants.%Negate.type] +// CHECK:STDOUT: %Core.import_ref.abd9 = import_ref Core//prelude/operators/arithmetic, loc111_50, unloaded +// CHECK:STDOUT: %Core.import_ref.5e6a: %Op.type.18a = import_ref Core//prelude/operators/arithmetic, loc112_31, loaded [concrete = constants.%Op.99f] +// CHECK:STDOUT: %Negate.impl_witness_table.b22 = impl_witness_table (%Core.import_ref.abd9, %Core.import_ref.5e6a), @impl.0ef [concrete] +// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] +// CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] +// CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Cpp = imports.%Cpp +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Cpp.import_cpp = import_cpp { +// CHECK:STDOUT: import Cpp "short.h" +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, imports.%foo.decl [concrete = constants.%foo] +// CHECK:STDOUT: %int_32769: Core.IntLiteral = int_value 32769 [concrete = constants.%int_32769] +// CHECK:STDOUT: %impl.elem1: %.d3d = impl_witness_access constants.%Negate.impl_witness.973, element1 [concrete = constants.%Op.99f] +// CHECK:STDOUT: %bound_method.loc12_11.1: = bound_method %int_32769, %impl.elem1 [concrete = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate: init Core.IntLiteral = call %bound_method.loc12_11.1(%int_32769) [concrete = constants.%int_-32769.5a5] +// CHECK:STDOUT: %impl.elem0: %.236 = impl_witness_access constants.%ImplicitAs.impl_witness.97b, element0 [concrete = constants.%Convert.d0a] +// CHECK:STDOUT: %bound_method.loc12_11.2: = bound_method %int.snegate, %impl.elem0 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Convert.3(constants.%int_16) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc12_11.3: = bound_method %int.snegate, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %.loc12_11.1: Core.IntLiteral = value_of_initializer %int.snegate [concrete = constants.%int_-32769.5a5] +// CHECK:STDOUT: %.loc12_11.2: Core.IntLiteral = converted %int.snegate, %.loc12_11.1 [concrete = constants.%int_-32769.5a5] +// CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc12_11.3(%.loc12_11.2) [concrete = constants.%int_-32769.883] +// CHECK:STDOUT: %.loc12_11.3: %i16 = value_of_initializer %int.convert_checked [concrete = constants.%int_-32769.883] +// CHECK:STDOUT: %.loc12_11.4: %i16 = converted %int.snegate, %.loc12_11.3 [concrete = constants.%int_-32769.883] +// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc12_11.4) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @foo(%a.param: %i16); +// CHECK:STDOUT: +// CHECK:STDOUT: --- fail_import_short_int32_arg.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete] +// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] +// CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete] +// CHECK:STDOUT: %pattern_type.2f8: type = pattern_type %i16 [concrete] +// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] +// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] +// CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete] +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] +// CHECK:STDOUT: %As.type.90f: type = generic_interface_type @As [concrete] +// CHECK:STDOUT: %As.generic: %As.type.90f = struct_value () [concrete] +// CHECK:STDOUT: %As.type.fd4: type = facet_type <@As, @As(%i32)> [concrete] +// CHECK:STDOUT: %Convert.type.99b: type = fn_type @Convert.1, @As(%i32) [concrete] +// CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete] +// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete] +// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.062: type = fn_type @Convert.6, @impl.686(%To.c80) [symbolic] +// CHECK:STDOUT: %Convert.527: %Convert.type.062 = struct_value () [symbolic] +// CHECK:STDOUT: %As.impl_witness.6b4: = impl_witness imports.%As.impl_witness_table.eb4, @impl.686(%int_32) [concrete] +// CHECK:STDOUT: %Convert.type.4fd: type = fn_type @Convert.6, @impl.686(%int_32) [concrete] +// CHECK:STDOUT: %Convert.197: %Convert.type.4fd = struct_value () [concrete] +// CHECK:STDOUT: %As.facet: %As.type.fd4 = facet_value Core.IntLiteral, (%As.impl_witness.6b4) [concrete] +// CHECK:STDOUT: %.982: type = fn_type_with_self_type %Convert.type.99b, %As.facet [concrete] +// CHECK:STDOUT: %Convert.bound: = bound_method %int_1.5b8, %Convert.197 [concrete] +// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.197, @Convert.6(%int_32) [concrete] +// CHECK:STDOUT: %bound_method: = bound_method %int_1.5b8, %Convert.specific_fn [concrete] +// CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .As = %Core.As +// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Cpp: = namespace file.%Cpp.import_cpp, [concrete] { +// CHECK:STDOUT: .foo = %foo.decl +// CHECK:STDOUT: import Cpp//... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] { +// CHECK:STDOUT: %a.patt: %pattern_type.2f8 = binding_pattern a [concrete] +// CHECK:STDOUT: %a.param_patt: %pattern_type.2f8 = value_param_pattern %a.patt, call_param0 [concrete] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %a.param: %i16 = value_param call_param0 +// CHECK:STDOUT: %.1: type = splice_block %i16 [concrete = constants.%i16] { +// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16] +// CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: %i16 = bind_name a, %a.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.As: %As.type.90f = import_ref Core//prelude/operators/as, As, loaded [concrete = constants.%As.generic] +// CHECK:STDOUT: %Core.import_ref.78a: @impl.686.%Convert.type (%Convert.type.062) = import_ref Core//prelude/types/int, loc28_39, loaded [symbolic = @impl.686.%Convert (constants.%Convert.527)] +// CHECK:STDOUT: %As.impl_witness_table.eb4 = impl_witness_table (%Core.import_ref.78a), @impl.686 [concrete] +// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Cpp = imports.%Cpp +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Cpp.import_cpp = import_cpp { +// CHECK:STDOUT: import Cpp "short.h" +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, imports.%foo.decl [concrete = constants.%foo] +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %impl.elem0: %.982 = impl_witness_access constants.%As.impl_witness.6b4, element0 [concrete = constants.%Convert.197] +// CHECK:STDOUT: %bound_method.loc15_13.1: = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Convert.6(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc15_13.2: = bound_method %int_1, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc15_13.2(%int_1) [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %.loc15_13.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %.loc15_13.2: %i32 = converted %int_1, %.loc15_13.1 [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %.loc15_13.3: %i16 = converted %.loc15_13.2, [concrete = ] +// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref() +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @foo(%a.param: %i16); +// CHECK:STDOUT: +// CHECK:STDOUT: --- import_short_int.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete] +// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] +// CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete] +// CHECK:STDOUT: %pattern_type.2f8: type = pattern_type %i16 [concrete] +// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] +// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] +// CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete] +// CHECK:STDOUT: %As.type.90f: type = generic_interface_type @As [concrete] +// CHECK:STDOUT: %As.generic: %As.type.90f = struct_value () [concrete] +// CHECK:STDOUT: %As.type.a96: type = facet_type <@As, @As(%i16)> [concrete] +// CHECK:STDOUT: %Convert.type.be5: type = fn_type @Convert.1, @As(%i16) [concrete] +// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.062: type = fn_type @Convert.6, @impl.686(%To.c80) [symbolic] +// CHECK:STDOUT: %Convert.527: %Convert.type.062 = struct_value () [symbolic] +// CHECK:STDOUT: %As.impl_witness.0ef: = impl_witness imports.%As.impl_witness_table.eb4, @impl.686(%int_16) [concrete] +// CHECK:STDOUT: %Convert.type.172: type = fn_type @Convert.6, @impl.686(%int_16) [concrete] +// CHECK:STDOUT: %Convert.489: %Convert.type.172 = struct_value () [concrete] +// CHECK:STDOUT: %As.facet: %As.type.a96 = facet_value Core.IntLiteral, (%As.impl_witness.0ef) [concrete] +// CHECK:STDOUT: %.91d: type = fn_type_with_self_type %Convert.type.be5, %As.facet [concrete] +// CHECK:STDOUT: %Convert.bound: = bound_method %int_1.5b8, %Convert.489 [concrete] +// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.489, @Convert.6(%int_16) [concrete] +// CHECK:STDOUT: %bound_method: = bound_method %int_1.5b8, %Convert.specific_fn [concrete] +// CHECK:STDOUT: %int_1.f90: %i16 = int_value 1 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .As = %Core.As +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Cpp: = namespace file.%Cpp.import_cpp, [concrete] { +// CHECK:STDOUT: .foo = %foo.decl +// CHECK:STDOUT: import Cpp//... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] { +// CHECK:STDOUT: %a.patt: %pattern_type.2f8 = binding_pattern a [concrete] +// CHECK:STDOUT: %a.param_patt: %pattern_type.2f8 = value_param_pattern %a.patt, call_param0 [concrete] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %a.param: %i16 = value_param call_param0 +// CHECK:STDOUT: %.1: type = splice_block %i16 [concrete = constants.%i16] { +// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16] +// CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: %i16 = bind_name a, %a.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.As: %As.type.90f = import_ref Core//prelude/operators/as, As, loaded [concrete = constants.%As.generic] +// CHECK:STDOUT: %Core.import_ref.78a: @impl.686.%Convert.type (%Convert.type.062) = import_ref Core//prelude/types/int, loc28_39, loaded [symbolic = @impl.686.%Convert (constants.%Convert.527)] +// CHECK:STDOUT: %As.impl_witness_table.eb4 = impl_witness_table (%Core.import_ref.78a), @impl.686 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Cpp = imports.%Cpp +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Cpp.import_cpp = import_cpp { +// CHECK:STDOUT: import Cpp "short_int.h" +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, imports.%foo.decl [concrete = constants.%foo] +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16] +// CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16] +// CHECK:STDOUT: %impl.elem0: %.91d = impl_witness_access constants.%As.impl_witness.0ef, element0 [concrete = constants.%Convert.489] +// CHECK:STDOUT: %bound_method.loc7_13.1: = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Convert.6(constants.%int_16) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_13.2: = bound_method %int_1, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc7_13.2(%int_1) [concrete = constants.%int_1.f90] +// CHECK:STDOUT: %.loc7_13.1: %i16 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.f90] +// CHECK:STDOUT: %.loc7_13.2: %i16 = converted %int_1, %.loc7_13.1 [concrete = constants.%int_1.f90] +// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_13.2) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @foo(%a.param: %i16); +// CHECK:STDOUT: +// CHECK:STDOUT: --- import_signed_short.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete] +// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] +// CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete] +// CHECK:STDOUT: %pattern_type.2f8: type = pattern_type %i16 [concrete] +// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] +// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] +// CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete] +// CHECK:STDOUT: %As.type.90f: type = generic_interface_type @As [concrete] +// CHECK:STDOUT: %As.generic: %As.type.90f = struct_value () [concrete] +// CHECK:STDOUT: %As.type.a96: type = facet_type <@As, @As(%i16)> [concrete] +// CHECK:STDOUT: %Convert.type.be5: type = fn_type @Convert.1, @As(%i16) [concrete] +// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.062: type = fn_type @Convert.6, @impl.686(%To.c80) [symbolic] +// CHECK:STDOUT: %Convert.527: %Convert.type.062 = struct_value () [symbolic] +// CHECK:STDOUT: %As.impl_witness.0ef: = impl_witness imports.%As.impl_witness_table.eb4, @impl.686(%int_16) [concrete] +// CHECK:STDOUT: %Convert.type.172: type = fn_type @Convert.6, @impl.686(%int_16) [concrete] +// CHECK:STDOUT: %Convert.489: %Convert.type.172 = struct_value () [concrete] +// CHECK:STDOUT: %As.facet: %As.type.a96 = facet_value Core.IntLiteral, (%As.impl_witness.0ef) [concrete] +// CHECK:STDOUT: %.91d: type = fn_type_with_self_type %Convert.type.be5, %As.facet [concrete] +// CHECK:STDOUT: %Convert.bound: = bound_method %int_1.5b8, %Convert.489 [concrete] +// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.489, @Convert.6(%int_16) [concrete] +// CHECK:STDOUT: %bound_method: = bound_method %int_1.5b8, %Convert.specific_fn [concrete] +// CHECK:STDOUT: %int_1.f90: %i16 = int_value 1 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .As = %Core.As +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Cpp: = namespace file.%Cpp.import_cpp, [concrete] { +// CHECK:STDOUT: .foo = %foo.decl +// CHECK:STDOUT: import Cpp//... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] { +// CHECK:STDOUT: %a.patt: %pattern_type.2f8 = binding_pattern a [concrete] +// CHECK:STDOUT: %a.param_patt: %pattern_type.2f8 = value_param_pattern %a.patt, call_param0 [concrete] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %a.param: %i16 = value_param call_param0 +// CHECK:STDOUT: %.1: type = splice_block %i16 [concrete = constants.%i16] { +// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16] +// CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: %i16 = bind_name a, %a.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.As: %As.type.90f = import_ref Core//prelude/operators/as, As, loaded [concrete = constants.%As.generic] +// CHECK:STDOUT: %Core.import_ref.78a: @impl.686.%Convert.type (%Convert.type.062) = import_ref Core//prelude/types/int, loc28_39, loaded [symbolic = @impl.686.%Convert (constants.%Convert.527)] +// CHECK:STDOUT: %As.impl_witness_table.eb4 = impl_witness_table (%Core.import_ref.78a), @impl.686 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Cpp = imports.%Cpp +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Cpp.import_cpp = import_cpp { +// CHECK:STDOUT: import Cpp "signed_short.h" +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, imports.%foo.decl [concrete = constants.%foo] +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16] +// CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16] +// CHECK:STDOUT: %impl.elem0: %.91d = impl_witness_access constants.%As.impl_witness.0ef, element0 [concrete = constants.%Convert.489] +// CHECK:STDOUT: %bound_method.loc7_13.1: = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Convert.6(constants.%int_16) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_13.2: = bound_method %int_1, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc7_13.2(%int_1) [concrete = constants.%int_1.f90] +// CHECK:STDOUT: %.loc7_13.1: %i16 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.f90] +// CHECK:STDOUT: %.loc7_13.2: %i16 = converted %int_1, %.loc7_13.1 [concrete = constants.%int_1.f90] +// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_13.2) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @foo(%a.param: %i16); +// CHECK:STDOUT: +// CHECK:STDOUT: --- import_signed_short_int.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete] +// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] +// CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete] +// CHECK:STDOUT: %pattern_type.2f8: type = pattern_type %i16 [concrete] +// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] +// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] +// CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete] +// CHECK:STDOUT: %As.type.90f: type = generic_interface_type @As [concrete] +// CHECK:STDOUT: %As.generic: %As.type.90f = struct_value () [concrete] +// CHECK:STDOUT: %As.type.a96: type = facet_type <@As, @As(%i16)> [concrete] +// CHECK:STDOUT: %Convert.type.be5: type = fn_type @Convert.1, @As(%i16) [concrete] +// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.062: type = fn_type @Convert.6, @impl.686(%To.c80) [symbolic] +// CHECK:STDOUT: %Convert.527: %Convert.type.062 = struct_value () [symbolic] +// CHECK:STDOUT: %As.impl_witness.0ef: = impl_witness imports.%As.impl_witness_table.eb4, @impl.686(%int_16) [concrete] +// CHECK:STDOUT: %Convert.type.172: type = fn_type @Convert.6, @impl.686(%int_16) [concrete] +// CHECK:STDOUT: %Convert.489: %Convert.type.172 = struct_value () [concrete] +// CHECK:STDOUT: %As.facet: %As.type.a96 = facet_value Core.IntLiteral, (%As.impl_witness.0ef) [concrete] +// CHECK:STDOUT: %.91d: type = fn_type_with_self_type %Convert.type.be5, %As.facet [concrete] +// CHECK:STDOUT: %Convert.bound: = bound_method %int_1.5b8, %Convert.489 [concrete] +// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.489, @Convert.6(%int_16) [concrete] +// CHECK:STDOUT: %bound_method: = bound_method %int_1.5b8, %Convert.specific_fn [concrete] +// CHECK:STDOUT: %int_1.f90: %i16 = int_value 1 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .As = %Core.As +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Cpp: = namespace file.%Cpp.import_cpp, [concrete] { +// CHECK:STDOUT: .foo = %foo.decl +// CHECK:STDOUT: import Cpp//... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] { +// CHECK:STDOUT: %a.patt: %pattern_type.2f8 = binding_pattern a [concrete] +// CHECK:STDOUT: %a.param_patt: %pattern_type.2f8 = value_param_pattern %a.patt, call_param0 [concrete] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %a.param: %i16 = value_param call_param0 +// CHECK:STDOUT: %.1: type = splice_block %i16 [concrete = constants.%i16] { +// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16] +// CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: %i16 = bind_name a, %a.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.As: %As.type.90f = import_ref Core//prelude/operators/as, As, loaded [concrete = constants.%As.generic] +// CHECK:STDOUT: %Core.import_ref.78a: @impl.686.%Convert.type (%Convert.type.062) = import_ref Core//prelude/types/int, loc28_39, loaded [symbolic = @impl.686.%Convert (constants.%Convert.527)] +// CHECK:STDOUT: %As.impl_witness_table.eb4 = impl_witness_table (%Core.import_ref.78a), @impl.686 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Cpp = imports.%Cpp +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Cpp.import_cpp = import_cpp { +// CHECK:STDOUT: import Cpp "signed_short_int.h" +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, imports.%foo.decl [concrete = constants.%foo] +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16] +// CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16] +// CHECK:STDOUT: %impl.elem0: %.91d = impl_witness_access constants.%As.impl_witness.0ef, element0 [concrete = constants.%Convert.489] +// CHECK:STDOUT: %bound_method.loc7_13.1: = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Convert.6(constants.%int_16) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_13.2: = bound_method %int_1, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc7_13.2(%int_1) [concrete = constants.%int_1.f90] +// CHECK:STDOUT: %.loc7_13.1: %i16 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.f90] +// CHECK:STDOUT: %.loc7_13.2: %i16 = converted %int_1, %.loc7_13.1 [concrete = constants.%int_1.f90] +// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_13.2) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @foo(%a.param: %i16); +// CHECK:STDOUT: +// CHECK:STDOUT: --- import_int16_t.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete] +// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] +// CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete] +// CHECK:STDOUT: %pattern_type.2f8: type = pattern_type %i16 [concrete] +// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] +// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] +// CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete] +// CHECK:STDOUT: %As.type.90f: type = generic_interface_type @As [concrete] +// CHECK:STDOUT: %As.generic: %As.type.90f = struct_value () [concrete] +// CHECK:STDOUT: %As.type.a96: type = facet_type <@As, @As(%i16)> [concrete] +// CHECK:STDOUT: %Convert.type.be5: type = fn_type @Convert.1, @As(%i16) [concrete] +// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.062: type = fn_type @Convert.6, @impl.686(%To.c80) [symbolic] +// CHECK:STDOUT: %Convert.527: %Convert.type.062 = struct_value () [symbolic] +// CHECK:STDOUT: %As.impl_witness.0ef: = impl_witness imports.%As.impl_witness_table.eb4, @impl.686(%int_16) [concrete] +// CHECK:STDOUT: %Convert.type.172: type = fn_type @Convert.6, @impl.686(%int_16) [concrete] +// CHECK:STDOUT: %Convert.489: %Convert.type.172 = struct_value () [concrete] +// CHECK:STDOUT: %As.facet: %As.type.a96 = facet_value Core.IntLiteral, (%As.impl_witness.0ef) [concrete] +// CHECK:STDOUT: %.91d: type = fn_type_with_self_type %Convert.type.be5, %As.facet [concrete] +// CHECK:STDOUT: %Convert.bound: = bound_method %int_1.5b8, %Convert.489 [concrete] +// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.489, @Convert.6(%int_16) [concrete] +// CHECK:STDOUT: %bound_method: = bound_method %int_1.5b8, %Convert.specific_fn [concrete] +// CHECK:STDOUT: %int_1.f90: %i16 = int_value 1 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .As = %Core.As +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Cpp: = namespace file.%Cpp.import_cpp, [concrete] { +// CHECK:STDOUT: .foo = %foo.decl +// CHECK:STDOUT: import Cpp//... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] { +// CHECK:STDOUT: %a.patt: %pattern_type.2f8 = binding_pattern a [concrete] +// CHECK:STDOUT: %a.param_patt: %pattern_type.2f8 = value_param_pattern %a.patt, call_param0 [concrete] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %a.param: %i16 = value_param call_param0 +// CHECK:STDOUT: %.1: type = splice_block %i16 [concrete = constants.%i16] { +// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16] +// CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: %i16 = bind_name a, %a.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.As: %As.type.90f = import_ref Core//prelude/operators/as, As, loaded [concrete = constants.%As.generic] +// CHECK:STDOUT: %Core.import_ref.78a: @impl.686.%Convert.type (%Convert.type.062) = import_ref Core//prelude/types/int, loc28_39, loaded [symbolic = @impl.686.%Convert (constants.%Convert.527)] +// CHECK:STDOUT: %As.impl_witness_table.eb4 = impl_witness_table (%Core.import_ref.78a), @impl.686 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Cpp = imports.%Cpp +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Cpp.import_cpp = import_cpp { +// CHECK:STDOUT: import Cpp "int16_t.h" +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, imports.%foo.decl [concrete = constants.%foo] +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16] +// CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16] +// CHECK:STDOUT: %impl.elem0: %.91d = impl_witness_access constants.%As.impl_witness.0ef, element0 [concrete = constants.%Convert.489] +// CHECK:STDOUT: %bound_method.loc7_13.1: = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Convert.6(constants.%int_16) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_13.2: = bound_method %int_1, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc7_13.2(%int_1) [concrete = constants.%int_1.f90] +// CHECK:STDOUT: %.loc7_13.1: %i16 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.f90] +// CHECK:STDOUT: %.loc7_13.2: %i16 = converted %int_1, %.loc7_13.1 [concrete = constants.%int_1.f90] +// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_13.2) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @foo(%a.param: %i16); +// CHECK:STDOUT: +// CHECK:STDOUT: --- import_const_short.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete] +// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] +// CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete] +// CHECK:STDOUT: %pattern_type.2f8: type = pattern_type %i16 [concrete] +// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] +// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] +// CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete] +// CHECK:STDOUT: %As.type.90f: type = generic_interface_type @As [concrete] +// CHECK:STDOUT: %As.generic: %As.type.90f = struct_value () [concrete] +// CHECK:STDOUT: %As.type.a96: type = facet_type <@As, @As(%i16)> [concrete] +// CHECK:STDOUT: %Convert.type.be5: type = fn_type @Convert.1, @As(%i16) [concrete] +// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.062: type = fn_type @Convert.6, @impl.686(%To.c80) [symbolic] +// CHECK:STDOUT: %Convert.527: %Convert.type.062 = struct_value () [symbolic] +// CHECK:STDOUT: %As.impl_witness.0ef: = impl_witness imports.%As.impl_witness_table.eb4, @impl.686(%int_16) [concrete] +// CHECK:STDOUT: %Convert.type.172: type = fn_type @Convert.6, @impl.686(%int_16) [concrete] +// CHECK:STDOUT: %Convert.489: %Convert.type.172 = struct_value () [concrete] +// CHECK:STDOUT: %As.facet: %As.type.a96 = facet_value Core.IntLiteral, (%As.impl_witness.0ef) [concrete] +// CHECK:STDOUT: %.91d: type = fn_type_with_self_type %Convert.type.be5, %As.facet [concrete] +// CHECK:STDOUT: %Convert.bound: = bound_method %int_1.5b8, %Convert.489 [concrete] +// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.489, @Convert.6(%int_16) [concrete] +// CHECK:STDOUT: %bound_method: = bound_method %int_1.5b8, %Convert.specific_fn [concrete] +// CHECK:STDOUT: %int_1.f90: %i16 = int_value 1 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .As = %Core.As +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Cpp: = namespace file.%Cpp.import_cpp, [concrete] { +// CHECK:STDOUT: .foo = %foo.decl +// CHECK:STDOUT: import Cpp//... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] { +// CHECK:STDOUT: %a.patt: %pattern_type.2f8 = binding_pattern a [concrete] +// CHECK:STDOUT: %a.param_patt: %pattern_type.2f8 = value_param_pattern %a.patt, call_param0 [concrete] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %a.param: %i16 = value_param call_param0 +// CHECK:STDOUT: %.1: type = splice_block %i16 [concrete = constants.%i16] { +// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16] +// CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: %i16 = bind_name a, %a.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.As: %As.type.90f = import_ref Core//prelude/operators/as, As, loaded [concrete = constants.%As.generic] +// CHECK:STDOUT: %Core.import_ref.78a: @impl.686.%Convert.type (%Convert.type.062) = import_ref Core//prelude/types/int, loc28_39, loaded [symbolic = @impl.686.%Convert (constants.%Convert.527)] +// CHECK:STDOUT: %As.impl_witness_table.eb4 = impl_witness_table (%Core.import_ref.78a), @impl.686 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Cpp = imports.%Cpp +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Cpp.import_cpp = import_cpp { +// CHECK:STDOUT: import Cpp "const_short.h" +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, imports.%foo.decl [concrete = constants.%foo] +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16] +// CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16] +// CHECK:STDOUT: %impl.elem0: %.91d = impl_witness_access constants.%As.impl_witness.0ef, element0 [concrete = constants.%Convert.489] +// CHECK:STDOUT: %bound_method.loc7_13.1: = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Convert.6(constants.%int_16) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_13.2: = bound_method %int_1, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc7_13.2(%int_1) [concrete = constants.%int_1.f90] +// CHECK:STDOUT: %.loc7_13.1: %i16 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.f90] +// CHECK:STDOUT: %.loc7_13.2: %i16 = converted %int_1, %.loc7_13.1 [concrete = constants.%int_1.f90] +// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_13.2) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @foo(%a.param: %i16); +// CHECK:STDOUT: +// CHECK:STDOUT: --- fail_todo_import_short_ref.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete] +// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] +// CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete] +// CHECK:STDOUT: %pattern_type.2f8: type = pattern_type %i16 [concrete] +// CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete] +// CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete] +// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.type.adb: type = facet_type <@ImplicitAs, @ImplicitAs(%i16)> [concrete] +// CHECK:STDOUT: %Convert.type.fa6: type = fn_type @Convert.1, @ImplicitAs(%i16) [concrete] +// CHECK:STDOUT: %T.8b3: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.3, @impl.4f9(%To.c80) [symbolic] +// CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic] +// CHECK:STDOUT: %ImplicitAs.impl_witness.97b: = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_16) [concrete] +// CHECK:STDOUT: %Convert.type.33c: type = fn_type @Convert.3, @impl.4f9(%int_16) [concrete] +// CHECK:STDOUT: %Convert.d0a: %Convert.type.33c = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.facet.6f2: %ImplicitAs.type.adb = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.97b) [concrete] +// CHECK:STDOUT: %.236: type = fn_type_with_self_type %Convert.type.fa6, %ImplicitAs.facet.6f2 [concrete] +// CHECK:STDOUT: %Convert.bound: = bound_method %int_1.5b8, %Convert.d0a [concrete] +// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.d0a, @Convert.3(%int_16) [concrete] +// CHECK:STDOUT: %bound_method: = bound_method %int_1.5b8, %Convert.specific_fn [concrete] +// CHECK:STDOUT: %int_1.f90: %i16 = int_value 1 [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.95 [concrete] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.96, @impl.49c(%T.8b3) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.d4a: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%i16) [concrete] +// CHECK:STDOUT: %Op.type.23c: type = fn_type @Op.96, @impl.49c(%i16) [concrete] +// CHECK:STDOUT: %Op.507: %Op.type.23c = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %i16, (%Destroy.impl_witness.d4a) [concrete] +// CHECK:STDOUT: %.8f2: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn.c10: = specific_function %Op.507, @Op.96(%i16) [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Cpp: = namespace file.%Cpp.import_cpp, [concrete] { +// CHECK:STDOUT: .foo = +// CHECK:STDOUT: import Cpp//... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] +// CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] +// CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/destroy, loc15_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Cpp = imports.%Cpp +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Cpp.import_cpp = import_cpp { +// CHECK:STDOUT: import Cpp "short_ref.h" +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: name_binding_decl { +// CHECK:STDOUT: %a.patt: %pattern_type.2f8 = binding_pattern a [concrete] +// CHECK:STDOUT: %a.var_patt: %pattern_type.2f8 = var_pattern %a.patt [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a.var: ref %i16 = var %a.var_patt +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %impl.elem0.loc7_3.1: %.236 = impl_witness_access constants.%ImplicitAs.impl_witness.97b, element0 [concrete = constants.%Convert.d0a] +// CHECK:STDOUT: %bound_method.loc7_3.1: = bound_method %int_1, %impl.elem0.loc7_3.1 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %specific_fn.loc7_3.1: = specific_function %impl.elem0.loc7_3.1, @Convert.3(constants.%int_16) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_3.2: = bound_method %int_1, %specific_fn.loc7_3.1 [concrete = constants.%bound_method] +// CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc7_3.2(%int_1) [concrete = constants.%int_1.f90] +// CHECK:STDOUT: %.loc7_3.1: init %i16 = converted %int_1, %int.convert_checked [concrete = constants.%int_1.f90] +// CHECK:STDOUT: assign %a.var, %.loc7_3.1 +// CHECK:STDOUT: %.loc7_10: type = splice_block %i16 [concrete = constants.%i16] { +// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16] +// CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: ref %i16 = bind_name a, %a.var +// CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %foo.ref: = name_ref foo, [concrete = ] +// CHECK:STDOUT: %a.ref: ref %i16 = name_ref a, %a +// CHECK:STDOUT: %impl.elem0.loc7_3.2: %.8f2 = impl_witness_access constants.%Destroy.impl_witness.d4a, element0 [concrete = constants.%Op.507] +// CHECK:STDOUT: %bound_method.loc7_3.3: = bound_method %a.var, %impl.elem0.loc7_3.2 +// CHECK:STDOUT: %specific_fn.loc7_3.2: = specific_function %impl.elem0.loc7_3.2, @Op.96(constants.%i16) [concrete = constants.%Op.specific_fn.c10] +// CHECK:STDOUT: %bound_method.loc7_3.4: = bound_method %a.var, %specific_fn.loc7_3.2 +// CHECK:STDOUT: %.loc7_3.2: %i16 = bind_value %a.var +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc7_3.4(%.loc7_3.2) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- fail_todo_import_const_short_ref.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete] +// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] +// CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete] +// CHECK:STDOUT: %pattern_type.2f8: type = pattern_type %i16 [concrete] +// CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete] +// CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete] +// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.type.adb: type = facet_type <@ImplicitAs, @ImplicitAs(%i16)> [concrete] +// CHECK:STDOUT: %Convert.type.fa6: type = fn_type @Convert.1, @ImplicitAs(%i16) [concrete] +// CHECK:STDOUT: %T.8b3: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.3, @impl.4f9(%To.c80) [symbolic] +// CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic] +// CHECK:STDOUT: %ImplicitAs.impl_witness.97b: = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_16) [concrete] +// CHECK:STDOUT: %Convert.type.33c: type = fn_type @Convert.3, @impl.4f9(%int_16) [concrete] +// CHECK:STDOUT: %Convert.d0a: %Convert.type.33c = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.facet.6f2: %ImplicitAs.type.adb = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.97b) [concrete] +// CHECK:STDOUT: %.236: type = fn_type_with_self_type %Convert.type.fa6, %ImplicitAs.facet.6f2 [concrete] +// CHECK:STDOUT: %Convert.bound: = bound_method %int_1.5b8, %Convert.d0a [concrete] +// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.d0a, @Convert.3(%int_16) [concrete] +// CHECK:STDOUT: %bound_method: = bound_method %int_1.5b8, %Convert.specific_fn [concrete] +// CHECK:STDOUT: %int_1.f90: %i16 = int_value 1 [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.95 [concrete] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.96, @impl.49c(%T.8b3) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.d4a: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%i16) [concrete] +// CHECK:STDOUT: %Op.type.23c: type = fn_type @Op.96, @impl.49c(%i16) [concrete] +// CHECK:STDOUT: %Op.507: %Op.type.23c = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %i16, (%Destroy.impl_witness.d4a) [concrete] +// CHECK:STDOUT: %.8f2: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn.c10: = specific_function %Op.507, @Op.96(%i16) [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Cpp: = namespace file.%Cpp.import_cpp, [concrete] { +// CHECK:STDOUT: .foo = +// CHECK:STDOUT: import Cpp//... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] +// CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] +// CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/destroy, loc15_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Cpp = imports.%Cpp +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Cpp.import_cpp = import_cpp { +// CHECK:STDOUT: import Cpp "const_short_ref.h" +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: name_binding_decl { +// CHECK:STDOUT: %a.patt: %pattern_type.2f8 = binding_pattern a [concrete] +// CHECK:STDOUT: %a.var_patt: %pattern_type.2f8 = var_pattern %a.patt [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a.var: ref %i16 = var %a.var_patt +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %impl.elem0.loc7_3.1: %.236 = impl_witness_access constants.%ImplicitAs.impl_witness.97b, element0 [concrete = constants.%Convert.d0a] +// CHECK:STDOUT: %bound_method.loc7_3.1: = bound_method %int_1, %impl.elem0.loc7_3.1 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %specific_fn.loc7_3.1: = specific_function %impl.elem0.loc7_3.1, @Convert.3(constants.%int_16) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_3.2: = bound_method %int_1, %specific_fn.loc7_3.1 [concrete = constants.%bound_method] +// CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc7_3.2(%int_1) [concrete = constants.%int_1.f90] +// CHECK:STDOUT: %.loc7_3.1: init %i16 = converted %int_1, %int.convert_checked [concrete = constants.%int_1.f90] +// CHECK:STDOUT: assign %a.var, %.loc7_3.1 +// CHECK:STDOUT: %.loc7_10: type = splice_block %i16 [concrete = constants.%i16] { +// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16] +// CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: ref %i16 = bind_name a, %a.var +// CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %foo.ref: = name_ref foo, [concrete = ] +// CHECK:STDOUT: %a.ref: ref %i16 = name_ref a, %a +// CHECK:STDOUT: %impl.elem0.loc7_3.2: %.8f2 = impl_witness_access constants.%Destroy.impl_witness.d4a, element0 [concrete = constants.%Op.507] +// CHECK:STDOUT: %bound_method.loc7_3.3: = bound_method %a.var, %impl.elem0.loc7_3.2 +// CHECK:STDOUT: %specific_fn.loc7_3.2: = specific_function %impl.elem0.loc7_3.2, @Op.96(constants.%i16) [concrete = constants.%Op.specific_fn.c10] +// CHECK:STDOUT: %bound_method.loc7_3.4: = bound_method %a.var, %specific_fn.loc7_3.2 +// CHECK:STDOUT: %.loc7_3.2: %i16 = bind_value %a.var +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc7_3.4(%.loc7_3.2) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- fail_todo_import_short_pointer.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete] +// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] +// CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete] +// CHECK:STDOUT: %pattern_type.2f8: type = pattern_type %i16 [concrete] +// CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete] +// CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete] +// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.type.adb: type = facet_type <@ImplicitAs, @ImplicitAs(%i16)> [concrete] +// CHECK:STDOUT: %Convert.type.fa6: type = fn_type @Convert.1, @ImplicitAs(%i16) [concrete] +// CHECK:STDOUT: %T.8b3: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.3, @impl.4f9(%To.c80) [symbolic] +// CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic] +// CHECK:STDOUT: %ImplicitAs.impl_witness.97b: = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_16) [concrete] +// CHECK:STDOUT: %Convert.type.33c: type = fn_type @Convert.3, @impl.4f9(%int_16) [concrete] +// CHECK:STDOUT: %Convert.d0a: %Convert.type.33c = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.facet.6f2: %ImplicitAs.type.adb = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.97b) [concrete] +// CHECK:STDOUT: %.236: type = fn_type_with_self_type %Convert.type.fa6, %ImplicitAs.facet.6f2 [concrete] +// CHECK:STDOUT: %Convert.bound: = bound_method %int_1.5b8, %Convert.d0a [concrete] +// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.d0a, @Convert.3(%int_16) [concrete] +// CHECK:STDOUT: %bound_method: = bound_method %int_1.5b8, %Convert.specific_fn [concrete] +// CHECK:STDOUT: %int_1.f90: %i16 = int_value 1 [concrete] +// CHECK:STDOUT: %ptr.251: type = ptr_type %i16 [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.95 [concrete] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.96, @impl.49c(%T.8b3) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.d4a: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%i16) [concrete] +// CHECK:STDOUT: %Op.type.23c: type = fn_type @Op.96, @impl.49c(%i16) [concrete] +// CHECK:STDOUT: %Op.507: %Op.type.23c = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %i16, (%Destroy.impl_witness.d4a) [concrete] +// CHECK:STDOUT: %.8f2: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn.c10: = specific_function %Op.507, @Op.96(%i16) [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Cpp: = namespace file.%Cpp.import_cpp, [concrete] { +// CHECK:STDOUT: .foo = +// CHECK:STDOUT: import Cpp//... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] +// CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] +// CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/destroy, loc15_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Cpp = imports.%Cpp +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Cpp.import_cpp = import_cpp { +// CHECK:STDOUT: import Cpp "short_pointer.h" +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: name_binding_decl { +// CHECK:STDOUT: %a.patt: %pattern_type.2f8 = binding_pattern a [concrete] +// CHECK:STDOUT: %a.var_patt: %pattern_type.2f8 = var_pattern %a.patt [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a.var: ref %i16 = var %a.var_patt +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %impl.elem0.loc7_3.1: %.236 = impl_witness_access constants.%ImplicitAs.impl_witness.97b, element0 [concrete = constants.%Convert.d0a] +// CHECK:STDOUT: %bound_method.loc7_3.1: = bound_method %int_1, %impl.elem0.loc7_3.1 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %specific_fn.loc7_3.1: = specific_function %impl.elem0.loc7_3.1, @Convert.3(constants.%int_16) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_3.2: = bound_method %int_1, %specific_fn.loc7_3.1 [concrete = constants.%bound_method] +// CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc7_3.2(%int_1) [concrete = constants.%int_1.f90] +// CHECK:STDOUT: %.loc7_3.1: init %i16 = converted %int_1, %int.convert_checked [concrete = constants.%int_1.f90] +// CHECK:STDOUT: assign %a.var, %.loc7_3.1 +// CHECK:STDOUT: %.loc7_10: type = splice_block %i16 [concrete = constants.%i16] { +// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16] +// CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: ref %i16 = bind_name a, %a.var +// CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %foo.ref: = name_ref foo, [concrete = ] +// CHECK:STDOUT: %a.ref: ref %i16 = name_ref a, %a +// CHECK:STDOUT: %addr: %ptr.251 = addr_of %a.ref +// CHECK:STDOUT: %impl.elem0.loc7_3.2: %.8f2 = impl_witness_access constants.%Destroy.impl_witness.d4a, element0 [concrete = constants.%Op.507] +// CHECK:STDOUT: %bound_method.loc7_3.3: = bound_method %a.var, %impl.elem0.loc7_3.2 +// CHECK:STDOUT: %specific_fn.loc7_3.2: = specific_function %impl.elem0.loc7_3.2, @Op.96(constants.%i16) [concrete = constants.%Op.specific_fn.c10] +// CHECK:STDOUT: %bound_method.loc7_3.4: = bound_method %a.var, %specific_fn.loc7_3.2 +// CHECK:STDOUT: %.loc7_3.2: %i16 = bind_value %a.var +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc7_3.4(%.loc7_3.2) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- fail_todo_import_const_short_pointer.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete] +// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] +// CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete] +// CHECK:STDOUT: %pattern_type.2f8: type = pattern_type %i16 [concrete] +// CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete] +// CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete] +// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.type.adb: type = facet_type <@ImplicitAs, @ImplicitAs(%i16)> [concrete] +// CHECK:STDOUT: %Convert.type.fa6: type = fn_type @Convert.1, @ImplicitAs(%i16) [concrete] +// CHECK:STDOUT: %T.8b3: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.3, @impl.4f9(%To.c80) [symbolic] +// CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic] +// CHECK:STDOUT: %ImplicitAs.impl_witness.97b: = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_16) [concrete] +// CHECK:STDOUT: %Convert.type.33c: type = fn_type @Convert.3, @impl.4f9(%int_16) [concrete] +// CHECK:STDOUT: %Convert.d0a: %Convert.type.33c = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.facet.6f2: %ImplicitAs.type.adb = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.97b) [concrete] +// CHECK:STDOUT: %.236: type = fn_type_with_self_type %Convert.type.fa6, %ImplicitAs.facet.6f2 [concrete] +// CHECK:STDOUT: %Convert.bound: = bound_method %int_1.5b8, %Convert.d0a [concrete] +// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.d0a, @Convert.3(%int_16) [concrete] +// CHECK:STDOUT: %bound_method: = bound_method %int_1.5b8, %Convert.specific_fn [concrete] +// CHECK:STDOUT: %int_1.f90: %i16 = int_value 1 [concrete] +// CHECK:STDOUT: %ptr.251: type = ptr_type %i16 [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.95 [concrete] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.96, @impl.49c(%T.8b3) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.d4a: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%i16) [concrete] +// CHECK:STDOUT: %Op.type.23c: type = fn_type @Op.96, @impl.49c(%i16) [concrete] +// CHECK:STDOUT: %Op.507: %Op.type.23c = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %i16, (%Destroy.impl_witness.d4a) [concrete] +// CHECK:STDOUT: %.8f2: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn.c10: = specific_function %Op.507, @Op.96(%i16) [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Cpp: = namespace file.%Cpp.import_cpp, [concrete] { +// CHECK:STDOUT: .foo = +// CHECK:STDOUT: import Cpp//... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] +// CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] +// CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/destroy, loc15_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Cpp = imports.%Cpp +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Cpp.import_cpp = import_cpp { +// CHECK:STDOUT: import Cpp "const_short_pointer.h" +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: name_binding_decl { +// CHECK:STDOUT: %a.patt: %pattern_type.2f8 = binding_pattern a [concrete] +// CHECK:STDOUT: %a.var_patt: %pattern_type.2f8 = var_pattern %a.patt [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a.var: ref %i16 = var %a.var_patt +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %impl.elem0.loc7_3.1: %.236 = impl_witness_access constants.%ImplicitAs.impl_witness.97b, element0 [concrete = constants.%Convert.d0a] +// CHECK:STDOUT: %bound_method.loc7_3.1: = bound_method %int_1, %impl.elem0.loc7_3.1 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %specific_fn.loc7_3.1: = specific_function %impl.elem0.loc7_3.1, @Convert.3(constants.%int_16) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_3.2: = bound_method %int_1, %specific_fn.loc7_3.1 [concrete = constants.%bound_method] +// CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc7_3.2(%int_1) [concrete = constants.%int_1.f90] +// CHECK:STDOUT: %.loc7_3.1: init %i16 = converted %int_1, %int.convert_checked [concrete = constants.%int_1.f90] +// CHECK:STDOUT: assign %a.var, %.loc7_3.1 +// CHECK:STDOUT: %.loc7_10: type = splice_block %i16 [concrete = constants.%i16] { +// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16] +// CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: ref %i16 = bind_name a, %a.var +// CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %foo.ref: = name_ref foo, [concrete = ] +// CHECK:STDOUT: %a.ref: ref %i16 = name_ref a, %a +// CHECK:STDOUT: %addr: %ptr.251 = addr_of %a.ref +// CHECK:STDOUT: %impl.elem0.loc7_3.2: %.8f2 = impl_witness_access constants.%Destroy.impl_witness.d4a, element0 [concrete = constants.%Op.507] +// CHECK:STDOUT: %bound_method.loc7_3.3: = bound_method %a.var, %impl.elem0.loc7_3.2 +// CHECK:STDOUT: %specific_fn.loc7_3.2: = specific_function %impl.elem0.loc7_3.2, @Op.96(constants.%i16) [concrete = constants.%Op.specific_fn.c10] +// CHECK:STDOUT: %bound_method.loc7_3.4: = bound_method %a.var, %specific_fn.loc7_3.2 +// CHECK:STDOUT: %.loc7_3.2: %i16 = bind_value %a.var +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc7_3.4(%.loc7_3.2) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/interop/cpp/function_param_int32.carbon b/toolchain/check/testdata/interop/cpp/function_param_int32.carbon new file mode 100644 index 000000000000..3bb3e7b2c5c6 --- /dev/null +++ b/toolchain/check/testdata/interop/cpp/function_param_int32.carbon @@ -0,0 +1,2156 @@ +// Part of the Carbon Language project, under the Apache License v2.0 with LLVM +// Exceptions. See /LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only". +// EXTRA-ARGS: --dump-sem-ir-ranges=if-present +// +// AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function_param_int32.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function_param_int32.carbon + +// ============================================================================ +// int +// ============================================================================ + +// --- int.h + +auto foo(int a) -> void; + +// --- import_int.carbon + +library "[[@TEST_NAME]]"; + +import Cpp library "int.h"; + +fn F() { + Cpp.foo(1); +} + +// --- import_int_max.carbon + +library "[[@TEST_NAME]]"; + +import Cpp library "int.h"; + +fn F() { + Cpp.foo(0x7FFF_FFFF); +} + +// --- fail_import_int_overflow_max.carbon + +library "[[@TEST_NAME]]"; + +import Cpp library "int.h"; + +fn F() { + // CHECK:STDERR: fail_import_int_overflow_max.carbon:[[@LINE+5]]:11: error: integer value 2147483648 too large for type `i32` [IntTooLargeForType] + // CHECK:STDERR: Cpp.foo(0x8000_0000); + // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_import_int_overflow_max.carbon: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: + Cpp.foo(0x8000_0000); +} + +// --- import_int_min.carbon + +library "[[@TEST_NAME]]"; + +import Cpp library "int.h"; + +fn F() { + Cpp.foo(-0x8000_0000); +} + +// --- fail_import_int_overflow_min.carbon + +library "[[@TEST_NAME]]"; + +import Cpp library "int.h"; + +fn F() { + // CHECK:STDERR: fail_import_int_overflow_min.carbon:[[@LINE+5]]:11: error: integer value -2147483649 too large for type `i32` [IntTooLargeForType] + // CHECK:STDERR: Cpp.foo(-0x8000_0001); + // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_import_int_overflow_min.carbon: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: + Cpp.foo(-0x8000_0001); +} + +// ============================================================================ +// signed int +// ============================================================================ + +// --- signed_int.h + +auto foo(signed int a) -> void; + +// --- import_signed_int.carbon + +library "[[@TEST_NAME]]"; + +import Cpp library "signed_int.h"; + +fn F() { + Cpp.foo(1); +} + +// ============================================================================ +// signed +// ============================================================================ + +// --- signed.h + +auto foo(signed a) -> void; + +// --- import_signed.carbon + +library "[[@TEST_NAME]]"; + +import Cpp library "signed.h"; + +fn F() { + Cpp.foo(1); +} + +// ============================================================================ +// typedef for int +// ============================================================================ + +// --- int32_t.h + +namespace std { + // Mimicking glibc definition for int32_t: https://codebrowser.dev/glibc/glibc/posix/bits/types.h.html#__int32_t + typedef signed int int32_t; +} + +auto foo(std::int32_t a) -> void; + +// --- import_int32_t.carbon + +library "[[@TEST_NAME]]"; + +import Cpp library "int32_t.h"; + +fn F() { + Cpp.foo(1); +} + +// ============================================================================ +// ints +// ============================================================================ + +// --- ints.h + +auto foo(int a, int b) -> void; + +// --- import_ints.carbon + +library "[[@TEST_NAME]]"; + +import Cpp library "ints.h"; + +fn F() { + Cpp.foo(1, 2); +} + +// ============================================================================ +// Multiple ints +// ============================================================================ + +// --- multiple_ints.h + +auto foo1(int a, int b) -> void; + +auto foo2(int c, int b) -> void; + +// --- import_multiple_ints.carbon + +library "[[@TEST_NAME]]"; + +import Cpp library "multiple_ints.h"; + +fn F() { + Cpp.foo1(1, 2); + Cpp.foo2(3, 4); +} + +// ============================================================================ +// Unnamed int +// ============================================================================ + +// --- unnamed_int.h + +auto foo(int) -> void; + +// --- import_unnamed_int.carbon + +library "[[@TEST_NAME]]"; + +import Cpp library "unnamed_int.h"; + +fn F() { + Cpp.foo(1); +} + +// ============================================================================ +// int default +// ============================================================================ + +// --- int_default.h + +auto foo(int a = 0) -> void; + +// --- fail_todo_import_int_default_parameterless_call.carbon + +library "[[@TEST_NAME]]"; + +import Cpp library "int_default.h"; + +fn F() { + // CHECK:STDERR: fail_todo_import_int_default_parameterless_call.carbon:[[@LINE+5]]:3: error: 0 arguments passed to function expecting 1 argument [CallArgCountMismatch] + // CHECK:STDERR: Cpp.foo(); + // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_todo_import_int_default_parameterless_call.carbon: note: calling function declared here [InCallToEntity] + // CHECK:STDERR: + Cpp.foo(); +} + +// --- import_int_default_sucessful_call.carbon + +library "[[@TEST_NAME]]"; + +import Cpp library "int_default.h"; + +fn F() { + Cpp.foo(1); +} + +// ============================================================================ +// const int +// ============================================================================ + +// --- const_int.h + +auto foo(const int a) -> void; + +// --- import_const_int.carbon + +library "[[@TEST_NAME]]"; + +import Cpp library "const_int.h"; + +fn F() { + Cpp.foo(1); +} + +// ============================================================================ +// int reference +// ============================================================================ + +// --- int_ref.h + +auto foo(int& a) -> int; + +// --- fail_todo_import_int_ref.carbon + +library "[[@TEST_NAME]]"; + +import Cpp library "int_ref.h"; + +fn F() { + var a: i32 = 1; + // CHECK:STDERR: fail_todo_import_int_ref.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: parameter type: int &` [SemanticsTodo] + // CHECK:STDERR: Cpp.foo(a); + // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_todo_import_int_ref.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `foo` [InCppNameLookup] + // CHECK:STDERR: Cpp.foo(a); + // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: + Cpp.foo(a); +} + +// ============================================================================ +// const int reference +// ============================================================================ + +// --- const_int_ref.h + +auto foo(const int& a) -> int; + +// --- fail_todo_import_const_int_ref.carbon + +library "[[@TEST_NAME]]"; + +import Cpp library "const_int_ref.h"; + +fn F() { + var a : i32 = 1; + // CHECK:STDERR: fail_todo_import_const_int_ref.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: parameter type: const int &` [SemanticsTodo] + // CHECK:STDERR: Cpp.foo(a); + // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_todo_import_const_int_ref.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `foo` [InCppNameLookup] + // CHECK:STDERR: Cpp.foo(a); + // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: + Cpp.foo(a); +} + +// ============================================================================ +// int pointer +// ============================================================================ + +// --- int_pointer.h + +auto foo(int* a) -> void; + +// --- fail_todo_import_int_pointer.carbon + +library "[[@TEST_NAME]]"; + +import Cpp library "int_pointer.h"; + +fn F() { + var a: i32 = 1; + // CHECK:STDERR: fail_todo_import_int_pointer.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: parameter type: int *` [SemanticsTodo] + // CHECK:STDERR: Cpp.foo(&a); + // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_todo_import_int_pointer.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `foo` [InCppNameLookup] + // CHECK:STDERR: Cpp.foo(&a); + // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: + Cpp.foo(&a); +} + +// ============================================================================ +// const int pointer +// ============================================================================ + +// --- const_int_pointer.h + +auto foo(const int* a) -> int; + +// --- fail_todo_import_const_int_pointer.carbon + +library "[[@TEST_NAME]]"; + +import Cpp library "const_int_pointer.h"; + +fn F() { + var a : i32 = 1; + // CHECK:STDERR: fail_todo_import_const_int_pointer.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: parameter type: const int *` [SemanticsTodo] + // CHECK:STDERR: Cpp.foo(&a); + // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: fail_todo_import_const_int_pointer.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `foo` [InCppNameLookup] + // CHECK:STDERR: Cpp.foo(&a); + // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: + Cpp.foo(&a); +} + +// CHECK:STDOUT: --- import_int.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] +// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] +// CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete] +// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] +// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] +// CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete] +// CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete] +// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete] +// CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete] +// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.3, @impl.4f9(%To.c80) [symbolic] +// CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic] +// CHECK:STDOUT: %ImplicitAs.impl_witness.c75: = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete] +// CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.3, @impl.4f9(%int_32) [concrete] +// CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.facet.921: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete] +// CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet.921 [concrete] +// CHECK:STDOUT: %Convert.bound: = bound_method %int_1.5b8, %Convert.956 [concrete] +// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.956, @Convert.3(%int_32) [concrete] +// CHECK:STDOUT: %bound_method: = bound_method %int_1.5b8, %Convert.specific_fn [concrete] +// CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Cpp: = namespace file.%Cpp.import_cpp, [concrete] { +// CHECK:STDOUT: .foo = %foo.decl +// CHECK:STDOUT: import Cpp//... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] { +// CHECK:STDOUT: %a.patt: %pattern_type.7ce = binding_pattern a [concrete] +// CHECK:STDOUT: %a.param_patt: %pattern_type.7ce = value_param_pattern %a.patt, call_param0 [concrete] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %a.param: %i32 = value_param call_param0 +// CHECK:STDOUT: %.1: type = splice_block %i32 [concrete = constants.%i32] { +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] +// CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] +// CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Cpp = imports.%Cpp +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Cpp.import_cpp = import_cpp { +// CHECK:STDOUT: import Cpp "int.h" +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, imports.%foo.decl [concrete = constants.%foo] +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc7_11.1: = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Convert.3(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_11.2: = bound_method %int_1, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc7_11.2(%int_1) [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %.loc7_11.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %.loc7_11.2: %i32 = converted %int_1, %.loc7_11.1 [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_11.2) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @foo(%a.param: %i32); +// CHECK:STDOUT: +// CHECK:STDOUT: --- import_int_max.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] +// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] +// CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete] +// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] +// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] +// CHECK:STDOUT: %int_2147483647.d89: Core.IntLiteral = int_value 2147483647 [concrete] +// CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete] +// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete] +// CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete] +// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.3, @impl.4f9(%To.c80) [symbolic] +// CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic] +// CHECK:STDOUT: %ImplicitAs.impl_witness.c75: = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete] +// CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.3, @impl.4f9(%int_32) [concrete] +// CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.facet.921: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete] +// CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet.921 [concrete] +// CHECK:STDOUT: %Convert.bound: = bound_method %int_2147483647.d89, %Convert.956 [concrete] +// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.956, @Convert.3(%int_32) [concrete] +// CHECK:STDOUT: %bound_method: = bound_method %int_2147483647.d89, %Convert.specific_fn [concrete] +// CHECK:STDOUT: %int_2147483647.a74: %i32 = int_value 2147483647 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Cpp: = namespace file.%Cpp.import_cpp, [concrete] { +// CHECK:STDOUT: .foo = %foo.decl +// CHECK:STDOUT: import Cpp//... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] { +// CHECK:STDOUT: %a.patt: %pattern_type.7ce = binding_pattern a [concrete] +// CHECK:STDOUT: %a.param_patt: %pattern_type.7ce = value_param_pattern %a.patt, call_param0 [concrete] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %a.param: %i32 = value_param call_param0 +// CHECK:STDOUT: %.1: type = splice_block %i32 [concrete = constants.%i32] { +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] +// CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] +// CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Cpp = imports.%Cpp +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Cpp.import_cpp = import_cpp { +// CHECK:STDOUT: import Cpp "int.h" +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, imports.%foo.decl [concrete = constants.%foo] +// CHECK:STDOUT: %int_2147483647: Core.IntLiteral = int_value 2147483647 [concrete = constants.%int_2147483647.d89] +// CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc7_11.1: = bound_method %int_2147483647, %impl.elem0 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Convert.3(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_11.2: = bound_method %int_2147483647, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc7_11.2(%int_2147483647) [concrete = constants.%int_2147483647.a74] +// CHECK:STDOUT: %.loc7_11.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_2147483647.a74] +// CHECK:STDOUT: %.loc7_11.2: %i32 = converted %int_2147483647, %.loc7_11.1 [concrete = constants.%int_2147483647.a74] +// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_11.2) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @foo(%a.param: %i32); +// CHECK:STDOUT: +// CHECK:STDOUT: --- fail_import_int_overflow_max.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] +// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] +// CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete] +// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] +// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] +// CHECK:STDOUT: %int_2147483648.1db: Core.IntLiteral = int_value 2147483648 [concrete] +// CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete] +// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete] +// CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete] +// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.3, @impl.4f9(%To.c80) [symbolic] +// CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic] +// CHECK:STDOUT: %ImplicitAs.impl_witness.c75: = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete] +// CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.3, @impl.4f9(%int_32) [concrete] +// CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.facet.921: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete] +// CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet.921 [concrete] +// CHECK:STDOUT: %Convert.bound: = bound_method %int_2147483648.1db, %Convert.956 [concrete] +// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.956, @Convert.3(%int_32) [concrete] +// CHECK:STDOUT: %bound_method: = bound_method %int_2147483648.1db, %Convert.specific_fn [concrete] +// CHECK:STDOUT: %int_2147483648.8df: %i32 = int_value 2147483648 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Cpp: = namespace file.%Cpp.import_cpp, [concrete] { +// CHECK:STDOUT: .foo = %foo.decl +// CHECK:STDOUT: import Cpp//... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] { +// CHECK:STDOUT: %a.patt: %pattern_type.7ce = binding_pattern a [concrete] +// CHECK:STDOUT: %a.param_patt: %pattern_type.7ce = value_param_pattern %a.patt, call_param0 [concrete] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %a.param: %i32 = value_param call_param0 +// CHECK:STDOUT: %.1: type = splice_block %i32 [concrete = constants.%i32] { +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] +// CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] +// CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Cpp = imports.%Cpp +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Cpp.import_cpp = import_cpp { +// CHECK:STDOUT: import Cpp "int.h" +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, imports.%foo.decl [concrete = constants.%foo] +// CHECK:STDOUT: %int_2147483648: Core.IntLiteral = int_value 2147483648 [concrete = constants.%int_2147483648.1db] +// CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc12_11.1: = bound_method %int_2147483648, %impl.elem0 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Convert.3(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc12_11.2: = bound_method %int_2147483648, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc12_11.2(%int_2147483648) [concrete = constants.%int_2147483648.8df] +// CHECK:STDOUT: %.loc12_11.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_2147483648.8df] +// CHECK:STDOUT: %.loc12_11.2: %i32 = converted %int_2147483648, %.loc12_11.1 [concrete = constants.%int_2147483648.8df] +// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc12_11.2) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @foo(%a.param: %i32); +// CHECK:STDOUT: +// CHECK:STDOUT: --- import_int_min.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] +// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] +// CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete] +// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] +// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] +// CHECK:STDOUT: %int_2147483648: Core.IntLiteral = int_value 2147483648 [concrete] +// CHECK:STDOUT: %Negate.type: type = facet_type <@Negate> [concrete] +// CHECK:STDOUT: %Op.type.e42: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %Negate.impl_witness.973: = impl_witness imports.%Negate.impl_witness_table.b22 [concrete] +// CHECK:STDOUT: %Negate.facet: %Negate.type = facet_value Core.IntLiteral, (%Negate.impl_witness.973) [concrete] +// CHECK:STDOUT: %.d3d: type = fn_type_with_self_type %Op.type.e42, %Negate.facet [concrete] +// CHECK:STDOUT: %Op.type.18a: type = fn_type @Op.7 [concrete] +// CHECK:STDOUT: %Op.99f: %Op.type.18a = struct_value () [concrete] +// CHECK:STDOUT: %Op.bound: = bound_method %int_2147483648, %Op.99f [concrete] +// CHECK:STDOUT: %int_-2147483648.3b9: Core.IntLiteral = int_value -2147483648 [concrete] +// CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete] +// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete] +// CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete] +// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.3, @impl.4f9(%To.c80) [symbolic] +// CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic] +// CHECK:STDOUT: %ImplicitAs.impl_witness.c75: = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete] +// CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.3, @impl.4f9(%int_32) [concrete] +// CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.facet.921: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete] +// CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet.921 [concrete] +// CHECK:STDOUT: %Convert.bound: = bound_method %int_-2147483648.3b9, %Convert.956 [concrete] +// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.956, @Convert.3(%int_32) [concrete] +// CHECK:STDOUT: %bound_method: = bound_method %int_-2147483648.3b9, %Convert.specific_fn [concrete] +// CHECK:STDOUT: %int_-2147483648.95c: %i32 = int_value -2147483648 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .Negate = %Core.Negate +// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Cpp: = namespace file.%Cpp.import_cpp, [concrete] { +// CHECK:STDOUT: .foo = %foo.decl +// CHECK:STDOUT: import Cpp//... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] { +// CHECK:STDOUT: %a.patt: %pattern_type.7ce = binding_pattern a [concrete] +// CHECK:STDOUT: %a.param_patt: %pattern_type.7ce = value_param_pattern %a.patt, call_param0 [concrete] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %a.param: %i32 = value_param call_param0 +// CHECK:STDOUT: %.1: type = splice_block %i32 [concrete = constants.%i32] { +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Negate: type = import_ref Core//prelude/operators/arithmetic, Negate, loaded [concrete = constants.%Negate.type] +// CHECK:STDOUT: %Core.import_ref.abd9 = import_ref Core//prelude/operators/arithmetic, loc111_50, unloaded +// CHECK:STDOUT: %Core.import_ref.5e6a: %Op.type.18a = import_ref Core//prelude/operators/arithmetic, loc112_31, loaded [concrete = constants.%Op.99f] +// CHECK:STDOUT: %Negate.impl_witness_table.b22 = impl_witness_table (%Core.import_ref.abd9, %Core.import_ref.5e6a), @impl.0ef [concrete] +// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] +// CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] +// CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Cpp = imports.%Cpp +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Cpp.import_cpp = import_cpp { +// CHECK:STDOUT: import Cpp "int.h" +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, imports.%foo.decl [concrete = constants.%foo] +// CHECK:STDOUT: %int_2147483648: Core.IntLiteral = int_value 2147483648 [concrete = constants.%int_2147483648] +// CHECK:STDOUT: %impl.elem1: %.d3d = impl_witness_access constants.%Negate.impl_witness.973, element1 [concrete = constants.%Op.99f] +// CHECK:STDOUT: %bound_method.loc7_11.1: = bound_method %int_2147483648, %impl.elem1 [concrete = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate: init Core.IntLiteral = call %bound_method.loc7_11.1(%int_2147483648) [concrete = constants.%int_-2147483648.3b9] +// CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc7_11.2: = bound_method %int.snegate, %impl.elem0 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Convert.3(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_11.3: = bound_method %int.snegate, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %.loc7_11.1: Core.IntLiteral = value_of_initializer %int.snegate [concrete = constants.%int_-2147483648.3b9] +// CHECK:STDOUT: %.loc7_11.2: Core.IntLiteral = converted %int.snegate, %.loc7_11.1 [concrete = constants.%int_-2147483648.3b9] +// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc7_11.3(%.loc7_11.2) [concrete = constants.%int_-2147483648.95c] +// CHECK:STDOUT: %.loc7_11.3: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_-2147483648.95c] +// CHECK:STDOUT: %.loc7_11.4: %i32 = converted %int.snegate, %.loc7_11.3 [concrete = constants.%int_-2147483648.95c] +// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_11.4) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @foo(%a.param: %i32); +// CHECK:STDOUT: +// CHECK:STDOUT: --- fail_import_int_overflow_min.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] +// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] +// CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete] +// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] +// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] +// CHECK:STDOUT: %int_2147483649: Core.IntLiteral = int_value 2147483649 [concrete] +// CHECK:STDOUT: %Negate.type: type = facet_type <@Negate> [concrete] +// CHECK:STDOUT: %Op.type.e42: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %Negate.impl_witness.973: = impl_witness imports.%Negate.impl_witness_table.b22 [concrete] +// CHECK:STDOUT: %Negate.facet: %Negate.type = facet_value Core.IntLiteral, (%Negate.impl_witness.973) [concrete] +// CHECK:STDOUT: %.d3d: type = fn_type_with_self_type %Op.type.e42, %Negate.facet [concrete] +// CHECK:STDOUT: %Op.type.18a: type = fn_type @Op.7 [concrete] +// CHECK:STDOUT: %Op.99f: %Op.type.18a = struct_value () [concrete] +// CHECK:STDOUT: %Op.bound: = bound_method %int_2147483649, %Op.99f [concrete] +// CHECK:STDOUT: %int_-2147483649.df1: Core.IntLiteral = int_value -2147483649 [concrete] +// CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete] +// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete] +// CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete] +// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.3, @impl.4f9(%To.c80) [symbolic] +// CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic] +// CHECK:STDOUT: %ImplicitAs.impl_witness.c75: = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete] +// CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.3, @impl.4f9(%int_32) [concrete] +// CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.facet.921: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete] +// CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet.921 [concrete] +// CHECK:STDOUT: %Convert.bound: = bound_method %int_-2147483649.df1, %Convert.956 [concrete] +// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.956, @Convert.3(%int_32) [concrete] +// CHECK:STDOUT: %bound_method: = bound_method %int_-2147483649.df1, %Convert.specific_fn [concrete] +// CHECK:STDOUT: %int_-2147483649.74e: %i32 = int_value -2147483649 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .Negate = %Core.Negate +// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Cpp: = namespace file.%Cpp.import_cpp, [concrete] { +// CHECK:STDOUT: .foo = %foo.decl +// CHECK:STDOUT: import Cpp//... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] { +// CHECK:STDOUT: %a.patt: %pattern_type.7ce = binding_pattern a [concrete] +// CHECK:STDOUT: %a.param_patt: %pattern_type.7ce = value_param_pattern %a.patt, call_param0 [concrete] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %a.param: %i32 = value_param call_param0 +// CHECK:STDOUT: %.1: type = splice_block %i32 [concrete = constants.%i32] { +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Negate: type = import_ref Core//prelude/operators/arithmetic, Negate, loaded [concrete = constants.%Negate.type] +// CHECK:STDOUT: %Core.import_ref.abd9 = import_ref Core//prelude/operators/arithmetic, loc111_50, unloaded +// CHECK:STDOUT: %Core.import_ref.5e6a: %Op.type.18a = import_ref Core//prelude/operators/arithmetic, loc112_31, loaded [concrete = constants.%Op.99f] +// CHECK:STDOUT: %Negate.impl_witness_table.b22 = impl_witness_table (%Core.import_ref.abd9, %Core.import_ref.5e6a), @impl.0ef [concrete] +// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] +// CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] +// CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Cpp = imports.%Cpp +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Cpp.import_cpp = import_cpp { +// CHECK:STDOUT: import Cpp "int.h" +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, imports.%foo.decl [concrete = constants.%foo] +// CHECK:STDOUT: %int_2147483649: Core.IntLiteral = int_value 2147483649 [concrete = constants.%int_2147483649] +// CHECK:STDOUT: %impl.elem1: %.d3d = impl_witness_access constants.%Negate.impl_witness.973, element1 [concrete = constants.%Op.99f] +// CHECK:STDOUT: %bound_method.loc12_11.1: = bound_method %int_2147483649, %impl.elem1 [concrete = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate: init Core.IntLiteral = call %bound_method.loc12_11.1(%int_2147483649) [concrete = constants.%int_-2147483649.df1] +// CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc12_11.2: = bound_method %int.snegate, %impl.elem0 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Convert.3(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc12_11.3: = bound_method %int.snegate, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %.loc12_11.1: Core.IntLiteral = value_of_initializer %int.snegate [concrete = constants.%int_-2147483649.df1] +// CHECK:STDOUT: %.loc12_11.2: Core.IntLiteral = converted %int.snegate, %.loc12_11.1 [concrete = constants.%int_-2147483649.df1] +// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc12_11.3(%.loc12_11.2) [concrete = constants.%int_-2147483649.74e] +// CHECK:STDOUT: %.loc12_11.3: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_-2147483649.74e] +// CHECK:STDOUT: %.loc12_11.4: %i32 = converted %int.snegate, %.loc12_11.3 [concrete = constants.%int_-2147483649.74e] +// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc12_11.4) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @foo(%a.param: %i32); +// CHECK:STDOUT: +// CHECK:STDOUT: --- import_signed_int.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] +// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] +// CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete] +// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] +// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] +// CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete] +// CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete] +// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete] +// CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete] +// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.3, @impl.4f9(%To.c80) [symbolic] +// CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic] +// CHECK:STDOUT: %ImplicitAs.impl_witness.c75: = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete] +// CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.3, @impl.4f9(%int_32) [concrete] +// CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.facet.921: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete] +// CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet.921 [concrete] +// CHECK:STDOUT: %Convert.bound: = bound_method %int_1.5b8, %Convert.956 [concrete] +// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.956, @Convert.3(%int_32) [concrete] +// CHECK:STDOUT: %bound_method: = bound_method %int_1.5b8, %Convert.specific_fn [concrete] +// CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Cpp: = namespace file.%Cpp.import_cpp, [concrete] { +// CHECK:STDOUT: .foo = %foo.decl +// CHECK:STDOUT: import Cpp//... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] { +// CHECK:STDOUT: %a.patt: %pattern_type.7ce = binding_pattern a [concrete] +// CHECK:STDOUT: %a.param_patt: %pattern_type.7ce = value_param_pattern %a.patt, call_param0 [concrete] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %a.param: %i32 = value_param call_param0 +// CHECK:STDOUT: %.1: type = splice_block %i32 [concrete = constants.%i32] { +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] +// CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] +// CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Cpp = imports.%Cpp +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Cpp.import_cpp = import_cpp { +// CHECK:STDOUT: import Cpp "signed_int.h" +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, imports.%foo.decl [concrete = constants.%foo] +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc7_11.1: = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Convert.3(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_11.2: = bound_method %int_1, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc7_11.2(%int_1) [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %.loc7_11.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %.loc7_11.2: %i32 = converted %int_1, %.loc7_11.1 [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_11.2) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @foo(%a.param: %i32); +// CHECK:STDOUT: +// CHECK:STDOUT: --- import_signed.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] +// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] +// CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete] +// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] +// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] +// CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete] +// CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete] +// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete] +// CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete] +// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.3, @impl.4f9(%To.c80) [symbolic] +// CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic] +// CHECK:STDOUT: %ImplicitAs.impl_witness.c75: = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete] +// CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.3, @impl.4f9(%int_32) [concrete] +// CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.facet.921: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete] +// CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet.921 [concrete] +// CHECK:STDOUT: %Convert.bound: = bound_method %int_1.5b8, %Convert.956 [concrete] +// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.956, @Convert.3(%int_32) [concrete] +// CHECK:STDOUT: %bound_method: = bound_method %int_1.5b8, %Convert.specific_fn [concrete] +// CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Cpp: = namespace file.%Cpp.import_cpp, [concrete] { +// CHECK:STDOUT: .foo = %foo.decl +// CHECK:STDOUT: import Cpp//... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] { +// CHECK:STDOUT: %a.patt: %pattern_type.7ce = binding_pattern a [concrete] +// CHECK:STDOUT: %a.param_patt: %pattern_type.7ce = value_param_pattern %a.patt, call_param0 [concrete] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %a.param: %i32 = value_param call_param0 +// CHECK:STDOUT: %.1: type = splice_block %i32 [concrete = constants.%i32] { +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] +// CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] +// CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Cpp = imports.%Cpp +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Cpp.import_cpp = import_cpp { +// CHECK:STDOUT: import Cpp "signed.h" +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, imports.%foo.decl [concrete = constants.%foo] +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc7_11.1: = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Convert.3(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_11.2: = bound_method %int_1, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc7_11.2(%int_1) [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %.loc7_11.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %.loc7_11.2: %i32 = converted %int_1, %.loc7_11.1 [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_11.2) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @foo(%a.param: %i32); +// CHECK:STDOUT: +// CHECK:STDOUT: --- import_int32_t.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] +// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] +// CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete] +// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] +// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] +// CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete] +// CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete] +// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete] +// CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete] +// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.3, @impl.4f9(%To.c80) [symbolic] +// CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic] +// CHECK:STDOUT: %ImplicitAs.impl_witness.c75: = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete] +// CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.3, @impl.4f9(%int_32) [concrete] +// CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.facet.921: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete] +// CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet.921 [concrete] +// CHECK:STDOUT: %Convert.bound: = bound_method %int_1.5b8, %Convert.956 [concrete] +// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.956, @Convert.3(%int_32) [concrete] +// CHECK:STDOUT: %bound_method: = bound_method %int_1.5b8, %Convert.specific_fn [concrete] +// CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Cpp: = namespace file.%Cpp.import_cpp, [concrete] { +// CHECK:STDOUT: .foo = %foo.decl +// CHECK:STDOUT: import Cpp//... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] { +// CHECK:STDOUT: %a.patt: %pattern_type.7ce = binding_pattern a [concrete] +// CHECK:STDOUT: %a.param_patt: %pattern_type.7ce = value_param_pattern %a.patt, call_param0 [concrete] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %a.param: %i32 = value_param call_param0 +// CHECK:STDOUT: %.1: type = splice_block %i32 [concrete = constants.%i32] { +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] +// CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] +// CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Cpp = imports.%Cpp +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Cpp.import_cpp = import_cpp { +// CHECK:STDOUT: import Cpp "int32_t.h" +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, imports.%foo.decl [concrete = constants.%foo] +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc7_11.1: = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Convert.3(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_11.2: = bound_method %int_1, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc7_11.2(%int_1) [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %.loc7_11.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %.loc7_11.2: %i32 = converted %int_1, %.loc7_11.1 [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_11.2) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @foo(%a.param: %i32); +// CHECK:STDOUT: +// CHECK:STDOUT: --- import_ints.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] +// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] +// CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete] +// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] +// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] +// CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete] +// CHECK:STDOUT: %int_2.ecc: Core.IntLiteral = int_value 2 [concrete] +// CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete] +// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete] +// CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete] +// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.3, @impl.4f9(%To.c80) [symbolic] +// CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic] +// CHECK:STDOUT: %ImplicitAs.impl_witness.c75: = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete] +// CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.3, @impl.4f9(%int_32) [concrete] +// CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.facet.921: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete] +// CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet.921 [concrete] +// CHECK:STDOUT: %Convert.bound.ab5: = bound_method %int_1.5b8, %Convert.956 [concrete] +// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.956, @Convert.3(%int_32) [concrete] +// CHECK:STDOUT: %bound_method.9a1: = bound_method %int_1.5b8, %Convert.specific_fn [concrete] +// CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete] +// CHECK:STDOUT: %Convert.bound.ef9: = bound_method %int_2.ecc, %Convert.956 [concrete] +// CHECK:STDOUT: %bound_method.b92: = bound_method %int_2.ecc, %Convert.specific_fn [concrete] +// CHECK:STDOUT: %int_2.ef8: %i32 = int_value 2 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Cpp: = namespace file.%Cpp.import_cpp, [concrete] { +// CHECK:STDOUT: .foo = %foo.decl +// CHECK:STDOUT: import Cpp//... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] { +// CHECK:STDOUT: %a.patt: %pattern_type.7ce = binding_pattern a [concrete] +// CHECK:STDOUT: %a.param_patt: %pattern_type.7ce = value_param_pattern %a.patt, call_param0 [concrete] +// CHECK:STDOUT: %b.patt: %pattern_type.7ce = binding_pattern b [concrete] +// CHECK:STDOUT: %b.param_patt: %pattern_type.7ce = value_param_pattern %b.patt, call_param1 [concrete] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %a.param: %i32 = value_param call_param0 +// CHECK:STDOUT: %.1: type = splice_block %i32.1 [concrete = constants.%i32] { +// CHECK:STDOUT: %int_32.1: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.1: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param +// CHECK:STDOUT: %b.param: %i32 = value_param call_param1 +// CHECK:STDOUT: %.2: type = splice_block %i32.2 [concrete = constants.%i32] { +// CHECK:STDOUT: %int_32.2: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.2: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: } +// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] +// CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] +// CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Cpp = imports.%Cpp +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Cpp.import_cpp = import_cpp { +// CHECK:STDOUT: import Cpp "ints.h" +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, imports.%foo.decl [concrete = constants.%foo] +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] +// CHECK:STDOUT: %impl.elem0.loc7_11: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc7_11.1: = bound_method %int_1, %impl.elem0.loc7_11 [concrete = constants.%Convert.bound.ab5] +// CHECK:STDOUT: %specific_fn.loc7_11: = specific_function %impl.elem0.loc7_11, @Convert.3(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_11.2: = bound_method %int_1, %specific_fn.loc7_11 [concrete = constants.%bound_method.9a1] +// CHECK:STDOUT: %int.convert_checked.loc7_11: init %i32 = call %bound_method.loc7_11.2(%int_1) [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %.loc7_11.1: %i32 = value_of_initializer %int.convert_checked.loc7_11 [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %.loc7_11.2: %i32 = converted %int_1, %.loc7_11.1 [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %impl.elem0.loc7_14: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc7_14.1: = bound_method %int_2, %impl.elem0.loc7_14 [concrete = constants.%Convert.bound.ef9] +// CHECK:STDOUT: %specific_fn.loc7_14: = specific_function %impl.elem0.loc7_14, @Convert.3(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_14.2: = bound_method %int_2, %specific_fn.loc7_14 [concrete = constants.%bound_method.b92] +// CHECK:STDOUT: %int.convert_checked.loc7_14: init %i32 = call %bound_method.loc7_14.2(%int_2) [concrete = constants.%int_2.ef8] +// CHECK:STDOUT: %.loc7_14.1: %i32 = value_of_initializer %int.convert_checked.loc7_14 [concrete = constants.%int_2.ef8] +// CHECK:STDOUT: %.loc7_14.2: %i32 = converted %int_2, %.loc7_14.1 [concrete = constants.%int_2.ef8] +// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_11.2, %.loc7_14.2) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @foo(%a.param: %i32, %b.param: %i32); +// CHECK:STDOUT: +// CHECK:STDOUT: --- import_multiple_ints.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] +// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] +// CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete] +// CHECK:STDOUT: %foo1.type: type = fn_type @foo1 [concrete] +// CHECK:STDOUT: %foo1: %foo1.type = struct_value () [concrete] +// CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete] +// CHECK:STDOUT: %int_2.ecc: Core.IntLiteral = int_value 2 [concrete] +// CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete] +// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete] +// CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete] +// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.3, @impl.4f9(%To.c80) [symbolic] +// CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic] +// CHECK:STDOUT: %ImplicitAs.impl_witness.c75: = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete] +// CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.3, @impl.4f9(%int_32) [concrete] +// CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.facet.921: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete] +// CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet.921 [concrete] +// CHECK:STDOUT: %Convert.bound.ab5: = bound_method %int_1.5b8, %Convert.956 [concrete] +// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.956, @Convert.3(%int_32) [concrete] +// CHECK:STDOUT: %bound_method.9a1: = bound_method %int_1.5b8, %Convert.specific_fn [concrete] +// CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete] +// CHECK:STDOUT: %Convert.bound.ef9: = bound_method %int_2.ecc, %Convert.956 [concrete] +// CHECK:STDOUT: %bound_method.b92: = bound_method %int_2.ecc, %Convert.specific_fn [concrete] +// CHECK:STDOUT: %int_2.ef8: %i32 = int_value 2 [concrete] +// CHECK:STDOUT: %foo2.type: type = fn_type @foo2 [concrete] +// CHECK:STDOUT: %foo2: %foo2.type = struct_value () [concrete] +// CHECK:STDOUT: %int_3.1ba: Core.IntLiteral = int_value 3 [concrete] +// CHECK:STDOUT: %int_4.0c1: Core.IntLiteral = int_value 4 [concrete] +// CHECK:STDOUT: %Convert.bound.b30: = bound_method %int_3.1ba, %Convert.956 [concrete] +// CHECK:STDOUT: %bound_method.047: = bound_method %int_3.1ba, %Convert.specific_fn [concrete] +// CHECK:STDOUT: %int_3.822: %i32 = int_value 3 [concrete] +// CHECK:STDOUT: %Convert.bound.ac3: = bound_method %int_4.0c1, %Convert.956 [concrete] +// CHECK:STDOUT: %bound_method.1da: = bound_method %int_4.0c1, %Convert.specific_fn [concrete] +// CHECK:STDOUT: %int_4.940: %i32 = int_value 4 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Cpp: = namespace file.%Cpp.import_cpp, [concrete] { +// CHECK:STDOUT: .foo1 = %foo1.decl +// CHECK:STDOUT: .foo2 = %foo2.decl +// CHECK:STDOUT: import Cpp//... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %foo1.decl: %foo1.type = fn_decl @foo1 [concrete = constants.%foo1] { +// CHECK:STDOUT: %a.patt: %pattern_type.7ce = binding_pattern a [concrete] +// CHECK:STDOUT: %a.param_patt: %pattern_type.7ce = value_param_pattern %a.patt, call_param0 [concrete] +// CHECK:STDOUT: %b.patt: %pattern_type.7ce = binding_pattern b [concrete] +// CHECK:STDOUT: %b.param_patt: %pattern_type.7ce = value_param_pattern %b.patt, call_param1 [concrete] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %a.param: %i32 = value_param call_param0 +// CHECK:STDOUT: %.1: type = splice_block %i32.1 [concrete = constants.%i32] { +// CHECK:STDOUT: %int_32.1: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.1: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param +// CHECK:STDOUT: %b.param: %i32 = value_param call_param1 +// CHECK:STDOUT: %.2: type = splice_block %i32.2 [concrete = constants.%i32] { +// CHECK:STDOUT: %int_32.2: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.2: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: } +// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] +// CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] +// CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: %foo2.decl: %foo2.type = fn_decl @foo2 [concrete = constants.%foo2] { +// CHECK:STDOUT: %c.patt: %pattern_type.7ce = binding_pattern c [concrete] +// CHECK:STDOUT: %c.param_patt: %pattern_type.7ce = value_param_pattern %c.patt, call_param0 [concrete] +// CHECK:STDOUT: %b.patt: %pattern_type.7ce = binding_pattern b [concrete] +// CHECK:STDOUT: %b.param_patt: %pattern_type.7ce = value_param_pattern %b.patt, call_param1 [concrete] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %c.param: %i32 = value_param call_param0 +// CHECK:STDOUT: %.1: type = splice_block %i32.1 [concrete = constants.%i32] { +// CHECK:STDOUT: %int_32.1: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.1: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: } +// CHECK:STDOUT: %c: %i32 = bind_name c, %c.param +// CHECK:STDOUT: %b.param: %i32 = value_param call_param1 +// CHECK:STDOUT: %.2: type = splice_block %i32.2 [concrete = constants.%i32] { +// CHECK:STDOUT: %int_32.2: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.2: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: } +// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Cpp = imports.%Cpp +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Cpp.import_cpp = import_cpp { +// CHECK:STDOUT: import Cpp "multiple_ints.h" +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Cpp.ref.loc7: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %foo1.ref: %foo1.type = name_ref foo1, imports.%foo1.decl [concrete = constants.%foo1] +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] +// CHECK:STDOUT: %impl.elem0.loc7_12: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc7_12.1: = bound_method %int_1, %impl.elem0.loc7_12 [concrete = constants.%Convert.bound.ab5] +// CHECK:STDOUT: %specific_fn.loc7_12: = specific_function %impl.elem0.loc7_12, @Convert.3(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_12.2: = bound_method %int_1, %specific_fn.loc7_12 [concrete = constants.%bound_method.9a1] +// CHECK:STDOUT: %int.convert_checked.loc7_12: init %i32 = call %bound_method.loc7_12.2(%int_1) [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %.loc7_12.1: %i32 = value_of_initializer %int.convert_checked.loc7_12 [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %.loc7_12.2: %i32 = converted %int_1, %.loc7_12.1 [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %impl.elem0.loc7_15: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc7_15.1: = bound_method %int_2, %impl.elem0.loc7_15 [concrete = constants.%Convert.bound.ef9] +// CHECK:STDOUT: %specific_fn.loc7_15: = specific_function %impl.elem0.loc7_15, @Convert.3(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_15.2: = bound_method %int_2, %specific_fn.loc7_15 [concrete = constants.%bound_method.b92] +// CHECK:STDOUT: %int.convert_checked.loc7_15: init %i32 = call %bound_method.loc7_15.2(%int_2) [concrete = constants.%int_2.ef8] +// CHECK:STDOUT: %.loc7_15.1: %i32 = value_of_initializer %int.convert_checked.loc7_15 [concrete = constants.%int_2.ef8] +// CHECK:STDOUT: %.loc7_15.2: %i32 = converted %int_2, %.loc7_15.1 [concrete = constants.%int_2.ef8] +// CHECK:STDOUT: %foo1.call: init %empty_tuple.type = call %foo1.ref(%.loc7_12.2, %.loc7_15.2) +// CHECK:STDOUT: %Cpp.ref.loc8: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %foo2.ref: %foo2.type = name_ref foo2, imports.%foo2.decl [concrete = constants.%foo2] +// CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3.1ba] +// CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [concrete = constants.%int_4.0c1] +// CHECK:STDOUT: %impl.elem0.loc8_12: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc8_12.1: = bound_method %int_3, %impl.elem0.loc8_12 [concrete = constants.%Convert.bound.b30] +// CHECK:STDOUT: %specific_fn.loc8_12: = specific_function %impl.elem0.loc8_12, @Convert.3(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc8_12.2: = bound_method %int_3, %specific_fn.loc8_12 [concrete = constants.%bound_method.047] +// CHECK:STDOUT: %int.convert_checked.loc8_12: init %i32 = call %bound_method.loc8_12.2(%int_3) [concrete = constants.%int_3.822] +// CHECK:STDOUT: %.loc8_12.1: %i32 = value_of_initializer %int.convert_checked.loc8_12 [concrete = constants.%int_3.822] +// CHECK:STDOUT: %.loc8_12.2: %i32 = converted %int_3, %.loc8_12.1 [concrete = constants.%int_3.822] +// CHECK:STDOUT: %impl.elem0.loc8_15: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc8_15.1: = bound_method %int_4, %impl.elem0.loc8_15 [concrete = constants.%Convert.bound.ac3] +// CHECK:STDOUT: %specific_fn.loc8_15: = specific_function %impl.elem0.loc8_15, @Convert.3(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc8_15.2: = bound_method %int_4, %specific_fn.loc8_15 [concrete = constants.%bound_method.1da] +// CHECK:STDOUT: %int.convert_checked.loc8_15: init %i32 = call %bound_method.loc8_15.2(%int_4) [concrete = constants.%int_4.940] +// CHECK:STDOUT: %.loc8_15.1: %i32 = value_of_initializer %int.convert_checked.loc8_15 [concrete = constants.%int_4.940] +// CHECK:STDOUT: %.loc8_15.2: %i32 = converted %int_4, %.loc8_15.1 [concrete = constants.%int_4.940] +// CHECK:STDOUT: %foo2.call: init %empty_tuple.type = call %foo2.ref(%.loc8_12.2, %.loc8_15.2) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @foo1(%a.param: %i32, %b.param: %i32); +// CHECK:STDOUT: +// CHECK:STDOUT: fn @foo2(%c.param: %i32, %b.param: %i32); +// CHECK:STDOUT: +// CHECK:STDOUT: --- import_unnamed_int.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] +// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] +// CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete] +// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] +// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] +// CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete] +// CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete] +// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete] +// CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete] +// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.3, @impl.4f9(%To.c80) [symbolic] +// CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic] +// CHECK:STDOUT: %ImplicitAs.impl_witness.c75: = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete] +// CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.3, @impl.4f9(%int_32) [concrete] +// CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.facet.921: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete] +// CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet.921 [concrete] +// CHECK:STDOUT: %Convert.bound: = bound_method %int_1.5b8, %Convert.956 [concrete] +// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.956, @Convert.3(%int_32) [concrete] +// CHECK:STDOUT: %bound_method: = bound_method %int_1.5b8, %Convert.specific_fn [concrete] +// CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Cpp: = namespace file.%Cpp.import_cpp, [concrete] { +// CHECK:STDOUT: .foo = %foo.decl +// CHECK:STDOUT: import Cpp//... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] { +// CHECK:STDOUT: %_.patt: %pattern_type.7ce = binding_pattern _ [concrete] +// CHECK:STDOUT: %_.param_patt: %pattern_type.7ce = value_param_pattern %_.patt, call_param0 [concrete] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %_.param: %i32 = value_param call_param0 +// CHECK:STDOUT: %.1: type = splice_block %i32 [concrete = constants.%i32] { +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: } +// CHECK:STDOUT: %_: %i32 = bind_name _, %_.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] +// CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] +// CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Cpp = imports.%Cpp +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Cpp.import_cpp = import_cpp { +// CHECK:STDOUT: import Cpp "unnamed_int.h" +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, imports.%foo.decl [concrete = constants.%foo] +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc7_11.1: = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Convert.3(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_11.2: = bound_method %int_1, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc7_11.2(%int_1) [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %.loc7_11.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %.loc7_11.2: %i32 = converted %int_1, %.loc7_11.1 [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_11.2) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @foo(%_.param: %i32); +// CHECK:STDOUT: +// CHECK:STDOUT: --- fail_todo_import_int_default_parameterless_call.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] +// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] +// CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete] +// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] +// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Cpp: = namespace file.%Cpp.import_cpp, [concrete] { +// CHECK:STDOUT: .foo = %foo.decl +// CHECK:STDOUT: import Cpp//... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] { +// CHECK:STDOUT: %a.patt: %pattern_type.7ce = binding_pattern a [concrete] +// CHECK:STDOUT: %a.param_patt: %pattern_type.7ce = value_param_pattern %a.patt, call_param0 [concrete] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %a.param: %i32 = value_param call_param0 +// CHECK:STDOUT: %.1: type = splice_block %i32 [concrete = constants.%i32] { +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Cpp = imports.%Cpp +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Cpp.import_cpp = import_cpp { +// CHECK:STDOUT: import Cpp "int_default.h" +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, imports.%foo.decl [concrete = constants.%foo] +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @foo(%a.param: %i32); +// CHECK:STDOUT: +// CHECK:STDOUT: --- import_int_default_sucessful_call.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] +// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] +// CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete] +// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] +// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] +// CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete] +// CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete] +// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete] +// CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete] +// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.3, @impl.4f9(%To.c80) [symbolic] +// CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic] +// CHECK:STDOUT: %ImplicitAs.impl_witness.c75: = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete] +// CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.3, @impl.4f9(%int_32) [concrete] +// CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.facet.921: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete] +// CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet.921 [concrete] +// CHECK:STDOUT: %Convert.bound: = bound_method %int_1.5b8, %Convert.956 [concrete] +// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.956, @Convert.3(%int_32) [concrete] +// CHECK:STDOUT: %bound_method: = bound_method %int_1.5b8, %Convert.specific_fn [concrete] +// CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Cpp: = namespace file.%Cpp.import_cpp, [concrete] { +// CHECK:STDOUT: .foo = %foo.decl +// CHECK:STDOUT: import Cpp//... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] { +// CHECK:STDOUT: %a.patt: %pattern_type.7ce = binding_pattern a [concrete] +// CHECK:STDOUT: %a.param_patt: %pattern_type.7ce = value_param_pattern %a.patt, call_param0 [concrete] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %a.param: %i32 = value_param call_param0 +// CHECK:STDOUT: %.1: type = splice_block %i32 [concrete = constants.%i32] { +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] +// CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] +// CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Cpp = imports.%Cpp +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Cpp.import_cpp = import_cpp { +// CHECK:STDOUT: import Cpp "int_default.h" +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, imports.%foo.decl [concrete = constants.%foo] +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc7_11.1: = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Convert.3(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_11.2: = bound_method %int_1, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc7_11.2(%int_1) [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %.loc7_11.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %.loc7_11.2: %i32 = converted %int_1, %.loc7_11.1 [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_11.2) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @foo(%a.param: %i32); +// CHECK:STDOUT: +// CHECK:STDOUT: --- import_const_int.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] +// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] +// CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete] +// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] +// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] +// CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete] +// CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete] +// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete] +// CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete] +// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.3, @impl.4f9(%To.c80) [symbolic] +// CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic] +// CHECK:STDOUT: %ImplicitAs.impl_witness.c75: = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete] +// CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.3, @impl.4f9(%int_32) [concrete] +// CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.facet.921: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete] +// CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet.921 [concrete] +// CHECK:STDOUT: %Convert.bound: = bound_method %int_1.5b8, %Convert.956 [concrete] +// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.956, @Convert.3(%int_32) [concrete] +// CHECK:STDOUT: %bound_method: = bound_method %int_1.5b8, %Convert.specific_fn [concrete] +// CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Cpp: = namespace file.%Cpp.import_cpp, [concrete] { +// CHECK:STDOUT: .foo = %foo.decl +// CHECK:STDOUT: import Cpp//... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] { +// CHECK:STDOUT: %a.patt: %pattern_type.7ce = binding_pattern a [concrete] +// CHECK:STDOUT: %a.param_patt: %pattern_type.7ce = value_param_pattern %a.patt, call_param0 [concrete] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %a.param: %i32 = value_param call_param0 +// CHECK:STDOUT: %.1: type = splice_block %i32 [concrete = constants.%i32] { +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] +// CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] +// CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Cpp = imports.%Cpp +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Cpp.import_cpp = import_cpp { +// CHECK:STDOUT: import Cpp "const_int.h" +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, imports.%foo.decl [concrete = constants.%foo] +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc7_11.1: = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Convert.3(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_11.2: = bound_method %int_1, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc7_11.2(%int_1) [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %.loc7_11.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %.loc7_11.2: %i32 = converted %int_1, %.loc7_11.1 [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_11.2) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @foo(%a.param: %i32); +// CHECK:STDOUT: +// CHECK:STDOUT: --- fail_todo_import_int_ref.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] +// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] +// CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete] +// CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete] +// CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete] +// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete] +// CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete] +// CHECK:STDOUT: %T.8b3: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.3, @impl.4f9(%To.c80) [symbolic] +// CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic] +// CHECK:STDOUT: %ImplicitAs.impl_witness.c75: = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete] +// CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.3, @impl.4f9(%int_32) [concrete] +// CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.facet.921: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete] +// CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet.921 [concrete] +// CHECK:STDOUT: %Convert.bound: = bound_method %int_1.5b8, %Convert.956 [concrete] +// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.956, @Convert.3(%int_32) [concrete] +// CHECK:STDOUT: %bound_method: = bound_method %int_1.5b8, %Convert.specific_fn [concrete] +// CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.95 [concrete] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.96, @impl.49c(%T.8b3) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.64e: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.type.a17: type = fn_type @Op.96, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.e6a: %Op.type.a17 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %i32, (%Destroy.impl_witness.64e) [concrete] +// CHECK:STDOUT: %.ab7: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn.014: = specific_function %Op.e6a, @Op.96(%i32) [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Cpp: = namespace file.%Cpp.import_cpp, [concrete] { +// CHECK:STDOUT: .foo = +// CHECK:STDOUT: import Cpp//... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] +// CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] +// CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/destroy, loc15_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Cpp = imports.%Cpp +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Cpp.import_cpp = import_cpp { +// CHECK:STDOUT: import Cpp "int_ref.h" +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: name_binding_decl { +// CHECK:STDOUT: %a.patt: %pattern_type.7ce = binding_pattern a [concrete] +// CHECK:STDOUT: %a.var_patt: %pattern_type.7ce = var_pattern %a.patt [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a.var: ref %i32 = var %a.var_patt +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %impl.elem0.loc7_3.1: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc7_3.1: = bound_method %int_1, %impl.elem0.loc7_3.1 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %specific_fn.loc7_3.1: = specific_function %impl.elem0.loc7_3.1, @Convert.3(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_3.2: = bound_method %int_1, %specific_fn.loc7_3.1 [concrete = constants.%bound_method] +// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc7_3.2(%int_1) [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %.loc7_3.1: init %i32 = converted %int_1, %int.convert_checked [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: assign %a.var, %.loc7_3.1 +// CHECK:STDOUT: %.loc7_10: type = splice_block %i32 [concrete = constants.%i32] { +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: ref %i32 = bind_name a, %a.var +// CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %foo.ref: = name_ref foo, [concrete = ] +// CHECK:STDOUT: %a.ref: ref %i32 = name_ref a, %a +// CHECK:STDOUT: %impl.elem0.loc7_3.2: %.ab7 = impl_witness_access constants.%Destroy.impl_witness.64e, element0 [concrete = constants.%Op.e6a] +// CHECK:STDOUT: %bound_method.loc7_3.3: = bound_method %a.var, %impl.elem0.loc7_3.2 +// CHECK:STDOUT: %specific_fn.loc7_3.2: = specific_function %impl.elem0.loc7_3.2, @Op.96(constants.%i32) [concrete = constants.%Op.specific_fn.014] +// CHECK:STDOUT: %bound_method.loc7_3.4: = bound_method %a.var, %specific_fn.loc7_3.2 +// CHECK:STDOUT: %.loc7_3.2: %i32 = bind_value %a.var +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc7_3.4(%.loc7_3.2) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- fail_todo_import_const_int_ref.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] +// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] +// CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete] +// CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete] +// CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete] +// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete] +// CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete] +// CHECK:STDOUT: %T.8b3: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.3, @impl.4f9(%To.c80) [symbolic] +// CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic] +// CHECK:STDOUT: %ImplicitAs.impl_witness.c75: = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete] +// CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.3, @impl.4f9(%int_32) [concrete] +// CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.facet.921: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete] +// CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet.921 [concrete] +// CHECK:STDOUT: %Convert.bound: = bound_method %int_1.5b8, %Convert.956 [concrete] +// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.956, @Convert.3(%int_32) [concrete] +// CHECK:STDOUT: %bound_method: = bound_method %int_1.5b8, %Convert.specific_fn [concrete] +// CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.95 [concrete] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.96, @impl.49c(%T.8b3) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.64e: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.type.a17: type = fn_type @Op.96, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.e6a: %Op.type.a17 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %i32, (%Destroy.impl_witness.64e) [concrete] +// CHECK:STDOUT: %.ab7: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn.014: = specific_function %Op.e6a, @Op.96(%i32) [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Cpp: = namespace file.%Cpp.import_cpp, [concrete] { +// CHECK:STDOUT: .foo = +// CHECK:STDOUT: import Cpp//... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] +// CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] +// CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/destroy, loc15_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Cpp = imports.%Cpp +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Cpp.import_cpp = import_cpp { +// CHECK:STDOUT: import Cpp "const_int_ref.h" +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: name_binding_decl { +// CHECK:STDOUT: %a.patt: %pattern_type.7ce = binding_pattern a [concrete] +// CHECK:STDOUT: %a.var_patt: %pattern_type.7ce = var_pattern %a.patt [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a.var: ref %i32 = var %a.var_patt +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %impl.elem0.loc7_3.1: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc7_3.1: = bound_method %int_1, %impl.elem0.loc7_3.1 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %specific_fn.loc7_3.1: = specific_function %impl.elem0.loc7_3.1, @Convert.3(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_3.2: = bound_method %int_1, %specific_fn.loc7_3.1 [concrete = constants.%bound_method] +// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc7_3.2(%int_1) [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %.loc7_3.1: init %i32 = converted %int_1, %int.convert_checked [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: assign %a.var, %.loc7_3.1 +// CHECK:STDOUT: %.loc7_11: type = splice_block %i32 [concrete = constants.%i32] { +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: ref %i32 = bind_name a, %a.var +// CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %foo.ref: = name_ref foo, [concrete = ] +// CHECK:STDOUT: %a.ref: ref %i32 = name_ref a, %a +// CHECK:STDOUT: %impl.elem0.loc7_3.2: %.ab7 = impl_witness_access constants.%Destroy.impl_witness.64e, element0 [concrete = constants.%Op.e6a] +// CHECK:STDOUT: %bound_method.loc7_3.3: = bound_method %a.var, %impl.elem0.loc7_3.2 +// CHECK:STDOUT: %specific_fn.loc7_3.2: = specific_function %impl.elem0.loc7_3.2, @Op.96(constants.%i32) [concrete = constants.%Op.specific_fn.014] +// CHECK:STDOUT: %bound_method.loc7_3.4: = bound_method %a.var, %specific_fn.loc7_3.2 +// CHECK:STDOUT: %.loc7_3.2: %i32 = bind_value %a.var +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc7_3.4(%.loc7_3.2) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- fail_todo_import_int_pointer.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] +// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] +// CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete] +// CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete] +// CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete] +// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete] +// CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete] +// CHECK:STDOUT: %T.8b3: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.3, @impl.4f9(%To.c80) [symbolic] +// CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic] +// CHECK:STDOUT: %ImplicitAs.impl_witness.c75: = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete] +// CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.3, @impl.4f9(%int_32) [concrete] +// CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.facet.921: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete] +// CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet.921 [concrete] +// CHECK:STDOUT: %Convert.bound: = bound_method %int_1.5b8, %Convert.956 [concrete] +// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.956, @Convert.3(%int_32) [concrete] +// CHECK:STDOUT: %bound_method: = bound_method %int_1.5b8, %Convert.specific_fn [concrete] +// CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete] +// CHECK:STDOUT: %ptr.235: type = ptr_type %i32 [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.95 [concrete] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.96, @impl.49c(%T.8b3) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.64e: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.type.a17: type = fn_type @Op.96, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.e6a: %Op.type.a17 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %i32, (%Destroy.impl_witness.64e) [concrete] +// CHECK:STDOUT: %.ab7: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn.014: = specific_function %Op.e6a, @Op.96(%i32) [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Cpp: = namespace file.%Cpp.import_cpp, [concrete] { +// CHECK:STDOUT: .foo = +// CHECK:STDOUT: import Cpp//... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] +// CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] +// CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/destroy, loc15_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Cpp = imports.%Cpp +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Cpp.import_cpp = import_cpp { +// CHECK:STDOUT: import Cpp "int_pointer.h" +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: name_binding_decl { +// CHECK:STDOUT: %a.patt: %pattern_type.7ce = binding_pattern a [concrete] +// CHECK:STDOUT: %a.var_patt: %pattern_type.7ce = var_pattern %a.patt [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a.var: ref %i32 = var %a.var_patt +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %impl.elem0.loc7_3.1: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc7_3.1: = bound_method %int_1, %impl.elem0.loc7_3.1 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %specific_fn.loc7_3.1: = specific_function %impl.elem0.loc7_3.1, @Convert.3(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_3.2: = bound_method %int_1, %specific_fn.loc7_3.1 [concrete = constants.%bound_method] +// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc7_3.2(%int_1) [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %.loc7_3.1: init %i32 = converted %int_1, %int.convert_checked [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: assign %a.var, %.loc7_3.1 +// CHECK:STDOUT: %.loc7_10: type = splice_block %i32 [concrete = constants.%i32] { +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: ref %i32 = bind_name a, %a.var +// CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %foo.ref: = name_ref foo, [concrete = ] +// CHECK:STDOUT: %a.ref: ref %i32 = name_ref a, %a +// CHECK:STDOUT: %addr: %ptr.235 = addr_of %a.ref +// CHECK:STDOUT: %impl.elem0.loc7_3.2: %.ab7 = impl_witness_access constants.%Destroy.impl_witness.64e, element0 [concrete = constants.%Op.e6a] +// CHECK:STDOUT: %bound_method.loc7_3.3: = bound_method %a.var, %impl.elem0.loc7_3.2 +// CHECK:STDOUT: %specific_fn.loc7_3.2: = specific_function %impl.elem0.loc7_3.2, @Op.96(constants.%i32) [concrete = constants.%Op.specific_fn.014] +// CHECK:STDOUT: %bound_method.loc7_3.4: = bound_method %a.var, %specific_fn.loc7_3.2 +// CHECK:STDOUT: %.loc7_3.2: %i32 = bind_value %a.var +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc7_3.4(%.loc7_3.2) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- fail_todo_import_const_int_pointer.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] +// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] +// CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete] +// CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete] +// CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete] +// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete] +// CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete] +// CHECK:STDOUT: %T.8b3: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.3, @impl.4f9(%To.c80) [symbolic] +// CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic] +// CHECK:STDOUT: %ImplicitAs.impl_witness.c75: = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete] +// CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.3, @impl.4f9(%int_32) [concrete] +// CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.facet.921: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete] +// CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet.921 [concrete] +// CHECK:STDOUT: %Convert.bound: = bound_method %int_1.5b8, %Convert.956 [concrete] +// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.956, @Convert.3(%int_32) [concrete] +// CHECK:STDOUT: %bound_method: = bound_method %int_1.5b8, %Convert.specific_fn [concrete] +// CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete] +// CHECK:STDOUT: %ptr.235: type = ptr_type %i32 [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.95 [concrete] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.96, @impl.49c(%T.8b3) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.64e: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.type.a17: type = fn_type @Op.96, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.e6a: %Op.type.a17 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %i32, (%Destroy.impl_witness.64e) [concrete] +// CHECK:STDOUT: %.ab7: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn.014: = specific_function %Op.e6a, @Op.96(%i32) [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Cpp: = namespace file.%Cpp.import_cpp, [concrete] { +// CHECK:STDOUT: .foo = +// CHECK:STDOUT: import Cpp//... +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] +// CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] +// CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/destroy, loc15_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Cpp = imports.%Cpp +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Cpp.import_cpp = import_cpp { +// CHECK:STDOUT: import Cpp "const_int_pointer.h" +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: name_binding_decl { +// CHECK:STDOUT: %a.patt: %pattern_type.7ce = binding_pattern a [concrete] +// CHECK:STDOUT: %a.var_patt: %pattern_type.7ce = var_pattern %a.patt [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a.var: ref %i32 = var %a.var_patt +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %impl.elem0.loc7_3.1: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc7_3.1: = bound_method %int_1, %impl.elem0.loc7_3.1 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %specific_fn.loc7_3.1: = specific_function %impl.elem0.loc7_3.1, @Convert.3(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_3.2: = bound_method %int_1, %specific_fn.loc7_3.1 [concrete = constants.%bound_method] +// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc7_3.2(%int_1) [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %.loc7_3.1: init %i32 = converted %int_1, %int.convert_checked [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: assign %a.var, %.loc7_3.1 +// CHECK:STDOUT: %.loc7_11: type = splice_block %i32 [concrete = constants.%i32] { +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: ref %i32 = bind_name a, %a.var +// CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %foo.ref: = name_ref foo, [concrete = ] +// CHECK:STDOUT: %a.ref: ref %i32 = name_ref a, %a +// CHECK:STDOUT: %addr: %ptr.235 = addr_of %a.ref +// CHECK:STDOUT: %impl.elem0.loc7_3.2: %.ab7 = impl_witness_access constants.%Destroy.impl_witness.64e, element0 [concrete = constants.%Op.e6a] +// CHECK:STDOUT: %bound_method.loc7_3.3: = bound_method %a.var, %impl.elem0.loc7_3.2 +// CHECK:STDOUT: %specific_fn.loc7_3.2: = specific_function %impl.elem0.loc7_3.2, @Op.96(constants.%i32) [concrete = constants.%Op.specific_fn.014] +// CHECK:STDOUT: %bound_method.loc7_3.4: = bound_method %a.var, %specific_fn.loc7_3.2 +// CHECK:STDOUT: %.loc7_3.2: %i32 = bind_value %a.var +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc7_3.4(%.loc7_3.2) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/let/compile_time_bindings.carbon b/toolchain/check/testdata/let/compile_time_bindings.carbon index 09670047e8b4..c4b7618fff51 100644 --- a/toolchain/check/testdata/let/compile_time_bindings.carbon +++ b/toolchain/check/testdata/let/compile_time_bindings.carbon @@ -308,7 +308,7 @@ impl i32 as Empty { // CHECK:STDOUT: %pattern_type.8c1: type = pattern_type %tuple.type.2d5 [concrete] // CHECK:STDOUT: %tuple.7e4: %tuple.type.2d5 = tuple_value (%empty_tuple, %empty_tuple, %empty_tuple) [concrete] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] +// CHECK:STDOUT: %complete_type.357: = complete_type_witness %empty_struct_type [concrete] // CHECK:STDOUT: %tuple.type.bcd: type = tuple_type (%empty_tuple.type, %empty_tuple.type) [concrete] // CHECK:STDOUT: %c: %tuple.type.bcd = bind_symbolic_name c, 1 [symbolic] // CHECK:STDOUT: %pattern_type.5b8: type = pattern_type %tuple.type.bcd [concrete] @@ -317,13 +317,46 @@ impl i32 as Empty { // CHECK:STDOUT: %tuple.f41: %tuple.type.9fb = tuple_value (%empty_tuple) [concrete] // CHECK:STDOUT: %tuple.elem0.eaf: %empty_tuple.type = tuple_access %c, element0 [symbolic] // CHECK:STDOUT: %tuple.elem1: %empty_tuple.type = tuple_access %c, element1 [symbolic] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.5b3: = impl_witness imports.%Destroy.impl_witness_table, @impl(%tuple.type.2d5) [concrete] +// CHECK:STDOUT: %Op.type.073: type = fn_type @Op.2, @impl(%tuple.type.2d5) [concrete] +// CHECK:STDOUT: %Op.dce: %Op.type.073 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.d28: %Destroy.type = facet_value %tuple.type.2d5, (%Destroy.impl_witness.5b3) [concrete] +// CHECK:STDOUT: %.886: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.d28 [concrete] +// CHECK:STDOUT: %Op.specific_fn.234: = specific_function %Op.dce, @Op.2(%tuple.type.2d5) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.585: = impl_witness imports.%Destroy.impl_witness_table, @impl(%tuple.type.bcd) [concrete] +// CHECK:STDOUT: %Op.type.4e8: type = fn_type @Op.2, @impl(%tuple.type.bcd) [concrete] +// CHECK:STDOUT: %Op.166: %Op.type.4e8 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.65b: %Destroy.type = facet_value %tuple.type.bcd, (%Destroy.impl_witness.585) [concrete] +// CHECK:STDOUT: %.b6c: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.65b [concrete] +// CHECK:STDOUT: %Op.specific_fn.48a: = specific_function %Op.166, @Op.2(%tuple.type.bcd) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.511: = impl_witness imports.%Destroy.impl_witness_table, @impl(%tuple.type.9fb) [concrete] +// CHECK:STDOUT: %Op.type.23e: type = fn_type @Op.2, @impl(%tuple.type.9fb) [concrete] +// CHECK:STDOUT: %Op.f19: %Op.type.23e = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.108: %Destroy.type = facet_value %tuple.type.9fb, (%Destroy.impl_witness.511) [concrete] +// CHECK:STDOUT: %.2cd: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.108 [concrete] +// CHECK:STDOUT: %Op.specific_fn.d2b: = specific_function %Op.f19, @Op.2(%tuple.type.9fb) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.1dc: = impl_witness imports.%Destroy.impl_witness_table, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.type.a63: type = fn_type @Op.2, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.ea3: %Op.type.a63 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.926: %Destroy.type = facet_value %empty_tuple.type, (%Destroy.impl_witness.1dc) [concrete] +// CHECK:STDOUT: %.346: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.926 [concrete] +// CHECK:STDOUT: %Op.specific_fn.393: = specific_function %Op.ea3, @Op.2(%empty_tuple.type) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -385,7 +418,7 @@ impl i32 as Empty { // CHECK:STDOUT: %.loc22_37.5: %tuple.type.2d5 = converted %.loc22_37.1, %tuple [concrete = constants.%tuple.7e4] // CHECK:STDOUT: %d: %tuple.type.2d5 = bind_name d, %.loc22_37.5 // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete = constants.%complete_type] +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete = constants.%complete_type.357] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -424,8 +457,8 @@ impl i32 as Empty { // CHECK:STDOUT: %.loc11_31.2: %empty_tuple.type = converted %.loc11_26, %empty_tuple.loc11_26 [concrete = constants.%empty_tuple] // CHECK:STDOUT: %empty_tuple.loc11_30: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] // CHECK:STDOUT: %.loc11_31.3: %empty_tuple.type = converted %.loc11_30, %empty_tuple.loc11_30 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %tuple: %tuple.type.bcd = tuple_value (%.loc11_31.2, %.loc11_31.3) [concrete = constants.%tuple.d8f] -// CHECK:STDOUT: %.loc11_31.4: %tuple.type.bcd = converted %.loc11_31.1, %tuple [concrete = constants.%tuple.d8f] +// CHECK:STDOUT: %tuple.loc11: %tuple.type.bcd = tuple_value (%.loc11_31.2, %.loc11_31.3) [concrete = constants.%tuple.d8f] +// CHECK:STDOUT: %.loc11_31.4: %tuple.type.bcd = converted %.loc11_31.1, %tuple.loc11 [concrete = constants.%tuple.d8f] // CHECK:STDOUT: %c.loc11_9.1: %tuple.type.bcd = bind_symbolic_name c, 1, %.loc11_31.4 [symbolic = %c.loc11_9.2 (constants.%c)] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %a1.patt: %pattern_type.cb1 = binding_pattern a1 [concrete] @@ -434,8 +467,8 @@ impl i32 as Empty { // CHECK:STDOUT: %a1.var: ref %empty_tuple.type = var %a1.var_patt // CHECK:STDOUT: %a.ref: %empty_tuple.type = name_ref a, @C.%a // CHECK:STDOUT: %.loc13_18: init %empty_tuple.type = tuple_init () to %a1.var [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc13_5: init %empty_tuple.type = converted %a.ref, %.loc13_18 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: assign %a1.var, %.loc13_5 +// CHECK:STDOUT: %.loc13_5.1: init %empty_tuple.type = converted %a.ref, %.loc13_18 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: assign %a1.var, %.loc13_5.1 // CHECK:STDOUT: %.loc13_14.1: type = splice_block %.loc13_14.3 [concrete = constants.%empty_tuple.type] { // CHECK:STDOUT: %.loc13_14.2: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc13_14.3: type = converted %.loc13_14.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] @@ -452,8 +485,8 @@ impl i32 as Empty { // CHECK:STDOUT: %.loc14_21.1: init %empty_tuple.type = tuple_init () to %tuple.elem0.loc14_21.2 [concrete = constants.%empty_tuple] // CHECK:STDOUT: %.loc14_21.2: init %empty_tuple.type = converted %tuple.elem0.loc14_21.1, %.loc14_21.1 [concrete = constants.%empty_tuple] // CHECK:STDOUT: %.loc14_21.3: init %tuple.type.9fb = tuple_init (%.loc14_21.2) to %b1.var [concrete = constants.%tuple.f41] -// CHECK:STDOUT: %.loc14_5: init %tuple.type.9fb = converted %b.ref, %.loc14_21.3 [concrete = constants.%tuple.f41] -// CHECK:STDOUT: assign %b1.var, %.loc14_5 +// CHECK:STDOUT: %.loc14_5.1: init %tuple.type.9fb = converted %b.ref, %.loc14_21.3 [concrete = constants.%tuple.f41] +// CHECK:STDOUT: assign %b1.var, %.loc14_5.1 // CHECK:STDOUT: %.loc14_17.1: type = splice_block %.loc14_17.4 [concrete = constants.%tuple.type.9fb] { // CHECK:STDOUT: %.loc14_15: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc14_17.2: %tuple.type.9fb = tuple_literal (%.loc14_15) @@ -476,8 +509,8 @@ impl i32 as Empty { // CHECK:STDOUT: %.loc15_24.3: init %empty_tuple.type = tuple_init () to %tuple.elem1.loc15_24.2 [concrete = constants.%empty_tuple] // CHECK:STDOUT: %.loc15_24.4: init %empty_tuple.type = converted %tuple.elem1.loc15_24.1, %.loc15_24.3 [concrete = constants.%empty_tuple] // CHECK:STDOUT: %.loc15_24.5: init %tuple.type.bcd = tuple_init (%.loc15_24.2, %.loc15_24.4) to %c1.var [concrete = constants.%tuple.d8f] -// CHECK:STDOUT: %.loc15_5: init %tuple.type.bcd = converted %c.ref, %.loc15_24.5 [concrete = constants.%tuple.d8f] -// CHECK:STDOUT: assign %c1.var, %.loc15_5 +// CHECK:STDOUT: %.loc15_5.1: init %tuple.type.bcd = converted %c.ref, %.loc15_24.5 [concrete = constants.%tuple.d8f] +// CHECK:STDOUT: assign %c1.var, %.loc15_5.1 // CHECK:STDOUT: %.loc15_20.1: type = splice_block %.loc15_20.5 [concrete = constants.%tuple.type.bcd] { // CHECK:STDOUT: %.loc15_15: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc15_19: %empty_tuple.type = tuple_literal () @@ -506,8 +539,8 @@ impl i32 as Empty { // CHECK:STDOUT: %.loc16_28.5: init %empty_tuple.type = tuple_init () to %tuple.elem2.loc16_28.2 [concrete = constants.%empty_tuple] // CHECK:STDOUT: %.loc16_28.6: init %empty_tuple.type = converted %tuple.elem2.loc16_28.1, %.loc16_28.5 [concrete = constants.%empty_tuple] // CHECK:STDOUT: %.loc16_28.7: init %tuple.type.2d5 = tuple_init (%.loc16_28.2, %.loc16_28.4, %.loc16_28.6) to %d1.var [concrete = constants.%tuple.7e4] -// CHECK:STDOUT: %.loc16_5: init %tuple.type.2d5 = converted %d.ref, %.loc16_28.7 [concrete = constants.%tuple.7e4] -// CHECK:STDOUT: assign %d1.var, %.loc16_5 +// CHECK:STDOUT: %.loc16_5.1: init %tuple.type.2d5 = converted %d.ref, %.loc16_28.7 [concrete = constants.%tuple.7e4] +// CHECK:STDOUT: assign %d1.var, %.loc16_5.1 // CHECK:STDOUT: %.loc16_24.1: type = splice_block %.loc16_24.6 [concrete = constants.%tuple.type.2d5] { // CHECK:STDOUT: %.loc16_15: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc16_19: %empty_tuple.type = tuple_literal () @@ -519,6 +552,52 @@ impl i32 as Empty { // CHECK:STDOUT: %.loc16_24.6: type = converted %.loc16_24.2, constants.%tuple.type.2d5 [concrete = constants.%tuple.type.2d5] // CHECK:STDOUT: } // CHECK:STDOUT: %d1: ref %tuple.type.2d5 = bind_name d1, %d1.var +// CHECK:STDOUT: %impl.elem0.loc16: %.886 = impl_witness_access constants.%Destroy.impl_witness.5b3, element0 [concrete = constants.%Op.dce] +// CHECK:STDOUT: %bound_method.loc16_5.1: = bound_method %d1.var, %impl.elem0.loc16 +// CHECK:STDOUT: %specific_fn.loc16: = specific_function %impl.elem0.loc16, @Op.2(constants.%tuple.type.2d5) [concrete = constants.%Op.specific_fn.234] +// CHECK:STDOUT: %bound_method.loc16_5.2: = bound_method %d1.var, %specific_fn.loc16 +// CHECK:STDOUT: %tuple.elem0.loc16_5: ref %empty_tuple.type = tuple_access %d1.var, element0 +// CHECK:STDOUT: %tuple.loc16_5.1: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc16_5.2: %empty_tuple.type = converted %tuple.elem0.loc16_5, %tuple.loc16_5.1 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %tuple.elem1.loc16_5: ref %empty_tuple.type = tuple_access %d1.var, element1 +// CHECK:STDOUT: %tuple.loc16_5.2: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc16_5.3: %empty_tuple.type = converted %tuple.elem1.loc16_5, %tuple.loc16_5.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %tuple.elem2.loc16_5: ref %empty_tuple.type = tuple_access %d1.var, element2 +// CHECK:STDOUT: %tuple.loc16_5.3: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc16_5.4: %empty_tuple.type = converted %tuple.elem2.loc16_5, %tuple.loc16_5.3 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %tuple.loc16_5.4: %tuple.type.2d5 = tuple_value (%.loc16_5.2, %.loc16_5.3, %.loc16_5.4) [concrete = constants.%tuple.7e4] +// CHECK:STDOUT: %.loc16_5.5: %tuple.type.2d5 = converted %d1.var, %tuple.loc16_5.4 [concrete = constants.%tuple.7e4] +// CHECK:STDOUT: %no_op.loc16: init %empty_tuple.type = call %bound_method.loc16_5.2(%.loc16_5.5) +// CHECK:STDOUT: %impl.elem0.loc15: %.b6c = impl_witness_access constants.%Destroy.impl_witness.585, element0 [concrete = constants.%Op.166] +// CHECK:STDOUT: %bound_method.loc15_5.1: = bound_method %c1.var, %impl.elem0.loc15 +// CHECK:STDOUT: %specific_fn.loc15: = specific_function %impl.elem0.loc15, @Op.2(constants.%tuple.type.bcd) [concrete = constants.%Op.specific_fn.48a] +// CHECK:STDOUT: %bound_method.loc15_5.2: = bound_method %c1.var, %specific_fn.loc15 +// CHECK:STDOUT: %tuple.elem0.loc15_5: ref %empty_tuple.type = tuple_access %c1.var, element0 +// CHECK:STDOUT: %tuple.loc15_5.1: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc15_5.2: %empty_tuple.type = converted %tuple.elem0.loc15_5, %tuple.loc15_5.1 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %tuple.elem1.loc15_5: ref %empty_tuple.type = tuple_access %c1.var, element1 +// CHECK:STDOUT: %tuple.loc15_5.2: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc15_5.3: %empty_tuple.type = converted %tuple.elem1.loc15_5, %tuple.loc15_5.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %tuple.loc15_5.3: %tuple.type.bcd = tuple_value (%.loc15_5.2, %.loc15_5.3) [concrete = constants.%tuple.d8f] +// CHECK:STDOUT: %.loc15_5.4: %tuple.type.bcd = converted %c1.var, %tuple.loc15_5.3 [concrete = constants.%tuple.d8f] +// CHECK:STDOUT: %no_op.loc15: init %empty_tuple.type = call %bound_method.loc15_5.2(%.loc15_5.4) +// CHECK:STDOUT: %impl.elem0.loc14: %.2cd = impl_witness_access constants.%Destroy.impl_witness.511, element0 [concrete = constants.%Op.f19] +// CHECK:STDOUT: %bound_method.loc14_5.1: = bound_method %b1.var, %impl.elem0.loc14 +// CHECK:STDOUT: %specific_fn.loc14: = specific_function %impl.elem0.loc14, @Op.2(constants.%tuple.type.9fb) [concrete = constants.%Op.specific_fn.d2b] +// CHECK:STDOUT: %bound_method.loc14_5.2: = bound_method %b1.var, %specific_fn.loc14 +// CHECK:STDOUT: %tuple.elem0.loc14_5: ref %empty_tuple.type = tuple_access %b1.var, element0 +// CHECK:STDOUT: %tuple.loc14_5.1: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc14_5.2: %empty_tuple.type = converted %tuple.elem0.loc14_5, %tuple.loc14_5.1 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %tuple.loc14_5.2: %tuple.type.9fb = tuple_value (%.loc14_5.2) [concrete = constants.%tuple.f41] +// CHECK:STDOUT: %.loc14_5.3: %tuple.type.9fb = converted %b1.var, %tuple.loc14_5.2 [concrete = constants.%tuple.f41] +// CHECK:STDOUT: %no_op.loc14: init %empty_tuple.type = call %bound_method.loc14_5.2(%.loc14_5.3) +// CHECK:STDOUT: %impl.elem0.loc13: %.346 = impl_witness_access constants.%Destroy.impl_witness.1dc, element0 [concrete = constants.%Op.ea3] +// CHECK:STDOUT: %bound_method.loc13_5.1: = bound_method %a1.var, %impl.elem0.loc13 +// CHECK:STDOUT: %specific_fn.loc13: = specific_function %impl.elem0.loc13, @Op.2(constants.%empty_tuple.type) [concrete = constants.%Op.specific_fn.393] +// CHECK:STDOUT: %bound_method.loc13_5.2: = bound_method %a1.var, %specific_fn.loc13 +// CHECK:STDOUT: %tuple.loc13: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc13_5.2: %empty_tuple.type = converted %a1.var, %tuple.loc13 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %no_op.loc13: init %empty_tuple.type = call %bound_method.loc13_5.2(%.loc13_5.2) // 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 c85b13dcfb0a..1da1f8212023 100644 --- a/toolchain/check/testdata/let/fail_generic.carbon +++ b/toolchain/check/testdata/let/fail_generic.carbon @@ -68,9 +68,9 @@ fn F(a: i32) -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic] // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] -// CHECK:STDOUT: %Core.import_ref.492: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.ca0d85.1) = import_ref Core//prelude/parts/as, loc10_35, loaded [symbolic = @ImplicitAs.%assoc0 (constants.%assoc0.dc0)] -// CHECK:STDOUT: %Core.import_ref.1c7: @ImplicitAs.%Convert.type (%Convert.type.2751f3.1) = import_ref Core//prelude/parts/as, loc10_35, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42ebb8.1)] -// CHECK:STDOUT: %Core.import_ref.207 = import_ref Core//prelude/parts/as, loc10_35, unloaded +// CHECK:STDOUT: %Core.import_ref.492: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.ca0d85.1) = import_ref Core//prelude/parts/as, loc12_35, loaded [symbolic = @ImplicitAs.%assoc0 (constants.%assoc0.dc0)] +// CHECK:STDOUT: %Core.import_ref.1c7: @ImplicitAs.%Convert.type (%Convert.type.2751f3.1) = import_ref Core//prelude/parts/as, loc12_35, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42ebb8.1)] +// CHECK:STDOUT: %Core.import_ref.207 = import_ref Core//prelude/parts/as, loc12_35, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { diff --git a/toolchain/check/testdata/let/generic.carbon b/toolchain/check/testdata/let/generic.carbon index 34c11c90373d..cd2e69d19ad6 100644 --- a/toolchain/check/testdata/let/generic.carbon +++ b/toolchain/check/testdata/let/generic.carbon @@ -22,6 +22,7 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete] @@ -32,15 +33,29 @@ fn F() { // CHECK:STDOUT: %ptr: type = ptr_type %T [symbolic] // CHECK:STDOUT: %pattern_type.afe: type = pattern_type %ptr [symbolic] // CHECK:STDOUT: %pattern_type.7dc: type = pattern_type %T [symbolic] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %Destroy.lookup_impl_witness.de0: = lookup_impl_witness %T, @Destroy [symbolic] +// CHECK:STDOUT: %Destroy.facet.713: %Destroy.type = facet_value %T, (%Destroy.lookup_impl_witness.de0) [symbolic] +// CHECK:STDOUT: %.a63: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.713 [symbolic] +// CHECK:STDOUT: %impl.elem0.538: %.a63 = impl_witness_access %Destroy.lookup_impl_witness.de0, element0 [symbolic] +// CHECK:STDOUT: %specific_impl_fn.1af: = specific_impl_function %impl.elem0.538, @Op.1(%Destroy.facet.713) [symbolic] +// CHECK:STDOUT: %Destroy.lookup_impl_witness.3af: = lookup_impl_witness %ptr, @Destroy [symbolic] +// CHECK:STDOUT: %Destroy.facet.7d0: %Destroy.type = facet_value %ptr, (%Destroy.lookup_impl_witness.3af) [symbolic] +// CHECK:STDOUT: %.ea9: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.7d0 [symbolic] +// CHECK:STDOUT: %impl.elem0.63c: %.ea9 = impl_witness_access %Destroy.lookup_impl_witness.3af, element0 [symbolic] +// CHECK:STDOUT: %specific_impl_fn.e4a: = specific_impl_function %impl.elem0.63c, @Op.1(%Destroy.facet.7d0) [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -65,7 +80,7 @@ fn F() { // CHECK:STDOUT: %p.var_patt: %pattern_type.afe = var_pattern %p.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %p.var: ref %ptr = var %p.var_patt -// CHECK:STDOUT: %.loc17: type = splice_block %ptr [symbolic = constants.%ptr] { +// CHECK:STDOUT: %.loc17_11: type = splice_block %ptr [symbolic = constants.%ptr] { // CHECK:STDOUT: %T.ref.loc17: type = name_ref T, %T [symbolic = constants.%T] // CHECK:STDOUT: %ptr: type = ptr_type %T.ref.loc17 [symbolic = constants.%ptr] // CHECK:STDOUT: } @@ -82,6 +97,18 @@ fn F() { // CHECK:STDOUT: assign %a.var, %.loc18_14.2 // CHECK:STDOUT: %T.ref.loc18: type = name_ref T, %T [symbolic = constants.%T] // CHECK:STDOUT: %a: ref %T = bind_name a, %a.var +// CHECK:STDOUT: %impl.elem0.loc18: %.a63 = impl_witness_access constants.%Destroy.lookup_impl_witness.de0, element0 [symbolic = constants.%impl.elem0.538] +// CHECK:STDOUT: %bound_method.loc18_3.1: = bound_method %a.var, %impl.elem0.loc18 +// CHECK:STDOUT: %specific_impl_fn.loc18: = specific_impl_function %impl.elem0.loc18, @Op.1(constants.%Destroy.facet.713) [symbolic = constants.%specific_impl_fn.1af] +// CHECK:STDOUT: %bound_method.loc18_3.2: = bound_method %a.var, %specific_impl_fn.loc18 +// CHECK:STDOUT: %.loc18_3.1: %T = bind_value %a.var +// CHECK:STDOUT: %.loc18_3.2: init %empty_tuple.type = call %bound_method.loc18_3.2(%.loc18_3.1) +// CHECK:STDOUT: %impl.elem0.loc17: %.ea9 = impl_witness_access constants.%Destroy.lookup_impl_witness.3af, element0 [symbolic = constants.%impl.elem0.63c] +// CHECK:STDOUT: %bound_method.loc17_3.1: = bound_method %p.var, %impl.elem0.loc17 +// CHECK:STDOUT: %specific_impl_fn.loc17: = specific_impl_function %impl.elem0.loc17, @Op.1(constants.%Destroy.facet.7d0) [symbolic = constants.%specific_impl_fn.e4a] +// CHECK:STDOUT: %bound_method.loc17_3.2: = bound_method %p.var, %specific_impl_fn.loc17 +// CHECK:STDOUT: %.loc17_3.1: %ptr = bind_value %p.var +// CHECK:STDOUT: %.loc17_3.2: init %empty_tuple.type = call %bound_method.loc17_3.2(%.loc17_3.1) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/namespace/merging_with_indirections.carbon b/toolchain/check/testdata/namespace/merging_with_indirections.carbon index b1acf0ffdf1b..f261871705de 100644 --- a/toolchain/check/testdata/namespace/merging_with_indirections.carbon +++ b/toolchain/check/testdata/namespace/merging_with_indirections.carbon @@ -161,17 +161,30 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Run.type: type = fn_type @Run [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Run: %Run.type = struct_value () [concrete] // CHECK:STDOUT: %F.type: type = fn_type @F [concrete] // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] // CHECK:STDOUT: %A: type = class_type @A [concrete] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] -// CHECK:STDOUT: %pattern_type: type = pattern_type %A [concrete] +// CHECK:STDOUT: %pattern_type.272: type = pattern_type %A [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.f31: = impl_witness imports.%Destroy.impl_witness_table, @impl(%A) [concrete] +// CHECK:STDOUT: %Op.type.d74: type = fn_type @Op.2, @impl(%A) [concrete] +// CHECK:STDOUT: %Op.478: %Op.type.d74 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %A, (%Destroy.impl_witness.f31) [concrete] +// CHECK:STDOUT: %.8ba: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.478, @Op.2(%A) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -191,6 +204,9 @@ fn Run() { // CHECK:STDOUT: import Other//a // CHECK:STDOUT: } // CHECK:STDOUT: %Other.A: type = import_ref Other//a, A, loaded [concrete = constants.%A] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -219,11 +235,11 @@ fn Run() { // CHECK:STDOUT: %F.call.loc7: init %A = call %F.ref.loc7() to %.loc7_11.1 // CHECK:STDOUT: %.loc7_11.2: ref %A = temporary %.loc7_11.1, %F.call.loc7 // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %a.patt: %pattern_type = binding_pattern a [concrete] -// CHECK:STDOUT: %a.var_patt: %pattern_type = var_pattern %a.patt [concrete] +// CHECK:STDOUT: %a.patt: %pattern_type.272 = binding_pattern a [concrete] +// CHECK:STDOUT: %a.var_patt: %pattern_type.272 = var_pattern %a.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %a.var: ref %A = var %a.var_patt -// CHECK:STDOUT: %.loc10: type = splice_block %A.ref [concrete = constants.%A] { +// CHECK:STDOUT: %.loc10_19: type = splice_block %A.ref [concrete = constants.%A] { // CHECK:STDOUT: %Other.ref.loc10: = name_ref Other, imports.%Other [concrete = imports.%Other] // CHECK:STDOUT: %NS1.ref: = name_ref NS1, imports.%NS1.b9a [concrete = imports.%NS1.b9a] // CHECK:STDOUT: %A.ref: type = name_ref A, imports.%Other.A [concrete = constants.%A] @@ -232,9 +248,27 @@ fn Run() { // CHECK:STDOUT: %a.ref: ref %A = name_ref a, %a // CHECK:STDOUT: %Other.ref.loc13: = name_ref Other, imports.%Other [concrete = imports.%Other] // CHECK:STDOUT: %F.ref.loc13: %F.type = name_ref F, imports.%Other.F [concrete = constants.%F] -// CHECK:STDOUT: %.loc13: ref %A = splice_block %a.ref {} -// CHECK:STDOUT: %F.call.loc13: init %A = call %F.ref.loc13() to %.loc13 +// CHECK:STDOUT: %.loc13_3.1: ref %A = splice_block %a.ref {} +// CHECK:STDOUT: %F.call.loc13: init %A = call %F.ref.loc13() to %.loc13_3.1 // CHECK:STDOUT: assign %a.ref, %F.call.loc13 +// CHECK:STDOUT: %impl.elem0.loc13: %.8ba = impl_witness_access constants.%Destroy.impl_witness.f31, element0 [concrete = constants.%Op.478] +// CHECK:STDOUT: %bound_method.loc13_3.1: = bound_method %.loc13_3.1, %impl.elem0.loc13 +// CHECK:STDOUT: %specific_fn.loc13: = specific_function %impl.elem0.loc13, @Op.2(constants.%A) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc13_3.2: = bound_method %.loc13_3.1, %specific_fn.loc13 +// CHECK:STDOUT: %.loc13_3.2: %A = bind_value %.loc13_3.1 +// CHECK:STDOUT: %no_op.loc13: init %empty_tuple.type = call %bound_method.loc13_3.2(%.loc13_3.2) +// CHECK:STDOUT: %impl.elem0.loc10: %.8ba = impl_witness_access constants.%Destroy.impl_witness.f31, element0 [concrete = constants.%Op.478] +// CHECK:STDOUT: %bound_method.loc10_3.1: = bound_method %a.var, %impl.elem0.loc10 +// CHECK:STDOUT: %specific_fn.loc10: = specific_function %impl.elem0.loc10, @Op.2(constants.%A) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc10_3.2: = bound_method %a.var, %specific_fn.loc10 +// CHECK:STDOUT: %.loc10_3: %A = bind_value %a.var +// CHECK:STDOUT: %no_op.loc10: init %empty_tuple.type = call %bound_method.loc10_3.2(%.loc10_3) +// CHECK:STDOUT: %impl.elem0.loc7: %.8ba = impl_witness_access constants.%Destroy.impl_witness.f31, element0 [concrete = constants.%Op.478] +// CHECK:STDOUT: %bound_method.loc7_11.1: = bound_method %.loc7_11.1, %impl.elem0.loc7 +// CHECK:STDOUT: %specific_fn.loc7: = specific_function %impl.elem0.loc7, @Op.2(constants.%A) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_11.2: = bound_method %.loc7_11.1, %specific_fn.loc7 +// CHECK:STDOUT: %.loc7_11.3: %A = bind_value %.loc7_11.1 +// CHECK:STDOUT: %no_op.loc7: init %empty_tuple.type = call %bound_method.loc7_11.2(%.loc7_11.3) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/builtin/and.carbon b/toolchain/check/testdata/operators/builtin/and.carbon index 1128841feae0..eade5d98df55 100644 --- a/toolchain/check/testdata/operators/builtin/and.carbon +++ b/toolchain/check/testdata/operators/builtin/and.carbon @@ -49,6 +49,23 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: %Constant: %Constant.type = struct_value () [concrete] // CHECK:STDOUT: %pattern_type.cb1: type = pattern_type %empty_tuple.type [concrete] // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.1dc: = impl_witness imports.%Destroy.impl_witness_table, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.type.a63: type = fn_type @Op.2, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.ea3: %Op.type.a63 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.926: %Destroy.type = facet_value %empty_tuple.type, (%Destroy.impl_witness.1dc) [concrete] +// CHECK:STDOUT: %.346: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.926 [concrete] +// CHECK:STDOUT: %Op.specific_fn.393: = specific_function %Op.ea3, @Op.2(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.862: = impl_witness imports.%Destroy.impl_witness_table, @impl(bool) [concrete] +// CHECK:STDOUT: %Op.type.655: type = fn_type @Op.2, @impl(bool) [concrete] +// CHECK:STDOUT: %Op.8b7: %Op.type.655 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.2aa: %Destroy.type = facet_value bool, (%Destroy.impl_witness.862) [concrete] +// CHECK:STDOUT: %.0d4: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.2aa [concrete] +// CHECK:STDOUT: %Op.specific_fn.c3f: = specific_function %Op.8b7, @Op.2(bool) [concrete] // CHECK:STDOUT: %PartialConstant.type: type = fn_type @PartialConstant [concrete] // CHECK:STDOUT: %PartialConstant: %PartialConstant.type = struct_value () [concrete] // CHECK:STDOUT: } @@ -56,10 +73,14 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Bool = %Core.Bool +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Core.Bool: %Bool.type = import_ref Core//prelude/parts/bool, Bool, loaded [concrete = constants.%Bool] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -198,8 +219,8 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: %b.var: ref %empty_tuple.type = var %b.var_patt // CHECK:STDOUT: %.loc24_49.1: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc24_49.2: init %empty_tuple.type = tuple_init () to %b.var [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc24_3: init %empty_tuple.type = converted %.loc24_49.1, %.loc24_49.2 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: assign %b.var, %.loc24_3 +// CHECK:STDOUT: %.loc24_3.1: init %empty_tuple.type = converted %.loc24_49.1, %.loc24_49.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: assign %b.var, %.loc24_3.1 // CHECK:STDOUT: br !.loc24_13 // CHECK:STDOUT: // CHECK:STDOUT: !.loc24_13: @@ -239,8 +260,8 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: %c.var: ref %empty_tuple.type = var %c.var_patt // CHECK:STDOUT: %.loc25_49.1: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc25_49.2: init %empty_tuple.type = tuple_init () to %c.var [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc25_3: init %empty_tuple.type = converted %.loc25_49.1, %.loc25_49.2 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: assign %c.var, %.loc25_3 +// CHECK:STDOUT: %.loc25_3.1: init %empty_tuple.type = converted %.loc25_49.1, %.loc25_49.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: assign %c.var, %.loc25_3.1 // CHECK:STDOUT: br !.loc25_13 // CHECK:STDOUT: // CHECK:STDOUT: !.loc25_13: @@ -280,8 +301,8 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: %d.var: ref %empty_tuple.type = var %d.var_patt // CHECK:STDOUT: %.loc26_50.1: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc26_50.2: init %empty_tuple.type = tuple_init () to %d.var [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc26_3: init %empty_tuple.type = converted %.loc26_50.1, %.loc26_50.2 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: assign %d.var, %.loc26_3 +// CHECK:STDOUT: %.loc26_3.1: init %empty_tuple.type = converted %.loc26_50.1, %.loc26_50.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: assign %d.var, %.loc26_3.1 // CHECK:STDOUT: br !.loc26_13 // CHECK:STDOUT: // CHECK:STDOUT: !.loc26_13: @@ -314,6 +335,33 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: // CHECK:STDOUT: !.loc26_7: // CHECK:STDOUT: %d: ref %empty_tuple.type = bind_name d, %d.var +// CHECK:STDOUT: %impl.elem0.loc26: %.346 = impl_witness_access constants.%Destroy.impl_witness.1dc, element0 [concrete = constants.%Op.ea3] +// CHECK:STDOUT: %bound_method.loc26_3.1: = bound_method %d.var, %impl.elem0.loc26 +// CHECK:STDOUT: %specific_fn.loc26: = specific_function %impl.elem0.loc26, @Op.2(constants.%empty_tuple.type) [concrete = constants.%Op.specific_fn.393] +// CHECK:STDOUT: %bound_method.loc26_3.2: = bound_method %d.var, %specific_fn.loc26 +// CHECK:STDOUT: %tuple.loc26: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc26_3.2: %empty_tuple.type = converted %d.var, %tuple.loc26 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %no_op.loc26: init %empty_tuple.type = call %bound_method.loc26_3.2(%.loc26_3.2) +// CHECK:STDOUT: %impl.elem0.loc25: %.346 = impl_witness_access constants.%Destroy.impl_witness.1dc, element0 [concrete = constants.%Op.ea3] +// CHECK:STDOUT: %bound_method.loc25_3.1: = bound_method %c.var, %impl.elem0.loc25 +// CHECK:STDOUT: %specific_fn.loc25: = specific_function %impl.elem0.loc25, @Op.2(constants.%empty_tuple.type) [concrete = constants.%Op.specific_fn.393] +// CHECK:STDOUT: %bound_method.loc25_3.2: = bound_method %c.var, %specific_fn.loc25 +// CHECK:STDOUT: %tuple.loc25: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc25_3.2: %empty_tuple.type = converted %c.var, %tuple.loc25 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %no_op.loc25: init %empty_tuple.type = call %bound_method.loc25_3.2(%.loc25_3.2) +// CHECK:STDOUT: %impl.elem0.loc24: %.346 = impl_witness_access constants.%Destroy.impl_witness.1dc, element0 [concrete = constants.%Op.ea3] +// CHECK:STDOUT: %bound_method.loc24_3.1: = bound_method %b.var, %impl.elem0.loc24 +// CHECK:STDOUT: %specific_fn.loc24: = specific_function %impl.elem0.loc24, @Op.2(constants.%empty_tuple.type) [concrete = constants.%Op.specific_fn.393] +// CHECK:STDOUT: %bound_method.loc24_3.2: = bound_method %b.var, %specific_fn.loc24 +// CHECK:STDOUT: %tuple.loc24: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc24_3.2: %empty_tuple.type = converted %b.var, %tuple.loc24 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %no_op.loc24: init %empty_tuple.type = call %bound_method.loc24_3.2(%.loc24_3.2) +// CHECK:STDOUT: %impl.elem0.loc23: %.0d4 = impl_witness_access constants.%Destroy.impl_witness.862, element0 [concrete = constants.%Op.8b7] +// CHECK:STDOUT: %bound_method.loc23_3.1: = bound_method %a.var, %impl.elem0.loc23 +// CHECK:STDOUT: %specific_fn.loc23: = specific_function %impl.elem0.loc23, @Op.2(bool) [concrete = constants.%Op.specific_fn.c3f] +// CHECK:STDOUT: %bound_method.loc23_3.2: = bound_method %a.var, %specific_fn.loc23 +// CHECK:STDOUT: %.loc23_3: bool = bind_value %a.var +// CHECK:STDOUT: %no_op.loc23: init %empty_tuple.type = call %bound_method.loc23_3.2(%.loc23_3) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -326,8 +374,8 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: %a.var: ref %empty_tuple.type = var %a.var_patt // CHECK:STDOUT: %.loc30_46.1: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc30_46.2: init %empty_tuple.type = tuple_init () to %a.var [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc30_3: init %empty_tuple.type = converted %.loc30_46.1, %.loc30_46.2 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: assign %a.var, %.loc30_3 +// CHECK:STDOUT: %.loc30_3.1: init %empty_tuple.type = converted %.loc30_46.1, %.loc30_46.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: assign %a.var, %.loc30_3.1 // CHECK:STDOUT: br !.loc30_13 // CHECK:STDOUT: // CHECK:STDOUT: !.loc30_13: @@ -360,6 +408,13 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: // CHECK:STDOUT: !.loc30_7: // CHECK:STDOUT: %a: ref %empty_tuple.type = bind_name a, %a.var +// CHECK:STDOUT: %impl.elem0: %.346 = impl_witness_access constants.%Destroy.impl_witness.1dc, element0 [concrete = constants.%Op.ea3] +// CHECK:STDOUT: %bound_method.loc30_3.1: = bound_method %a.var, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%empty_tuple.type) [concrete = constants.%Op.specific_fn.393] +// CHECK:STDOUT: %bound_method.loc30_3.2: = bound_method %a.var, %specific_fn +// CHECK:STDOUT: %tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc30_3.2: %empty_tuple.type = converted %a.var, %tuple [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc30_3.2(%.loc30_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/builtin/assignment.carbon b/toolchain/check/testdata/operators/builtin/assignment.carbon index 1d997dec1700..de5f9ce6f3e3 100644 --- a/toolchain/check/testdata/operators/builtin/assignment.carbon +++ b/toolchain/check/testdata/operators/builtin/assignment.carbon @@ -34,6 +34,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Main.type: type = fn_type @Main [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Main: %Main.type = struct_value () [concrete] // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] @@ -98,12 +99,42 @@ fn Main() { // CHECK:STDOUT: %Convert.bound.491: = bound_method %int_10.64f, %Convert.956 [concrete] // CHECK:STDOUT: %bound_method.5ba: = bound_method %int_10.64f, %Convert.specific_fn [concrete] // CHECK:STDOUT: %int_10.265: %i32 = int_value 10 [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.2 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.3, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.711: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%ptr.235) [concrete] +// CHECK:STDOUT: %Op.type.ba2: type = fn_type @Op.3, @impl.49c(%ptr.235) [concrete] +// CHECK:STDOUT: %Op.649: %Op.type.ba2 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.2bf: %Destroy.type = facet_value %ptr.235, (%Destroy.impl_witness.711) [concrete] +// CHECK:STDOUT: %.a79: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.2bf [concrete] +// CHECK:STDOUT: %Op.specific_fn.829: = specific_function %Op.649, @Op.3(%ptr.235) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.ad1: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%struct_type.a.b.501) [concrete] +// CHECK:STDOUT: %Op.type.da3: type = fn_type @Op.3, @impl.49c(%struct_type.a.b.501) [concrete] +// CHECK:STDOUT: %Op.9db: %Op.type.da3 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.807: %Destroy.type = facet_value %struct_type.a.b.501, (%Destroy.impl_witness.ad1) [concrete] +// CHECK:STDOUT: %.8e0: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.807 [concrete] +// CHECK:STDOUT: %Op.specific_fn.1e0: = specific_function %Op.9db, @Op.3(%struct_type.a.b.501) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.5a7: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%tuple.type.d07) [concrete] +// CHECK:STDOUT: %Op.type.a4a: type = fn_type @Op.3, @impl.49c(%tuple.type.d07) [concrete] +// CHECK:STDOUT: %Op.7c6: %Op.type.a4a = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.167: %Destroy.type = facet_value %tuple.type.d07, (%Destroy.impl_witness.5a7) [concrete] +// CHECK:STDOUT: %.b68: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.167 [concrete] +// CHECK:STDOUT: %Op.specific_fn.bbb: = specific_function %Op.7c6, @Op.3(%tuple.type.d07) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.64e: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.type.a17: type = fn_type @Op.3, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.e6a: %Op.type.a17 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.5f7: %Destroy.type = facet_value %i32, (%Destroy.impl_witness.64e) [concrete] +// CHECK:STDOUT: %.ab7: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.5f7 [concrete] +// CHECK:STDOUT: %Op.specific_fn.014: = specific_function %Op.e6a, @Op.3(%i32) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Int = %Core.Int // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -111,6 +142,9 @@ fn Main() { // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -130,13 +164,13 @@ fn Main() { // CHECK:STDOUT: } // CHECK:STDOUT: %a.var: ref %i32 = var %a.var_patt // CHECK:STDOUT: %int_12: Core.IntLiteral = int_value 12 [concrete = constants.%int_12.6a3] -// CHECK:STDOUT: %impl.elem0.loc16: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] -// CHECK:STDOUT: %bound_method.loc16_3.1: = bound_method %int_12, %impl.elem0.loc16 [concrete = constants.%Convert.bound.221] -// CHECK:STDOUT: %specific_fn.loc16: = specific_function %impl.elem0.loc16, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc16_3.2: = bound_method %int_12, %specific_fn.loc16 [concrete = constants.%bound_method.dae] +// CHECK:STDOUT: %impl.elem0.loc16_3.1: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc16_3.1: = bound_method %int_12, %impl.elem0.loc16_3.1 [concrete = constants.%Convert.bound.221] +// CHECK:STDOUT: %specific_fn.loc16_3.1: = specific_function %impl.elem0.loc16_3.1, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc16_3.2: = bound_method %int_12, %specific_fn.loc16_3.1 [concrete = constants.%bound_method.dae] // CHECK:STDOUT: %int.convert_checked.loc16: init %i32 = call %bound_method.loc16_3.2(%int_12) [concrete = constants.%int_12.1e1] -// CHECK:STDOUT: %.loc16_3: init %i32 = converted %int_12, %int.convert_checked.loc16 [concrete = constants.%int_12.1e1] -// CHECK:STDOUT: assign %a.var, %.loc16_3 +// CHECK:STDOUT: %.loc16_3.1: init %i32 = converted %int_12, %int.convert_checked.loc16 [concrete = constants.%int_12.1e1] +// CHECK:STDOUT: assign %a.var, %.loc16_3.1 // CHECK:STDOUT: %.loc16_10: type = splice_block %i32.loc16 [concrete = constants.%i32] { // CHECK:STDOUT: %int_32.loc16: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32.loc16: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] @@ -165,19 +199,19 @@ fn Main() { // CHECK:STDOUT: %bound_method.loc19_28.2: = bound_method %int_1.loc19, %specific_fn.loc19_28.1 [concrete = constants.%bound_method.9a1] // CHECK:STDOUT: %int.convert_checked.loc19_28.1: init %i32 = call %bound_method.loc19_28.2(%int_1.loc19) [concrete = constants.%int_1.5d2] // CHECK:STDOUT: %.loc19_28.2: init %i32 = converted %int_1.loc19, %int.convert_checked.loc19_28.1 [concrete = constants.%int_1.5d2] -// CHECK:STDOUT: %tuple.elem0.loc19: ref %i32 = tuple_access %b.var, element0 -// CHECK:STDOUT: %.loc19_28.3: init %i32 = initialize_from %.loc19_28.2 to %tuple.elem0.loc19 [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %tuple.elem0.loc19_28: ref %i32 = tuple_access %b.var, element0 +// CHECK:STDOUT: %.loc19_28.3: init %i32 = initialize_from %.loc19_28.2 to %tuple.elem0.loc19_28 [concrete = constants.%int_1.5d2] // CHECK:STDOUT: %impl.elem0.loc19_28.2: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] // CHECK:STDOUT: %bound_method.loc19_28.3: = bound_method %int_2.loc19, %impl.elem0.loc19_28.2 [concrete = constants.%Convert.bound.ef9] // CHECK:STDOUT: %specific_fn.loc19_28.2: = specific_function %impl.elem0.loc19_28.2, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] // CHECK:STDOUT: %bound_method.loc19_28.4: = bound_method %int_2.loc19, %specific_fn.loc19_28.2 [concrete = constants.%bound_method.b92] // CHECK:STDOUT: %int.convert_checked.loc19_28.2: init %i32 = call %bound_method.loc19_28.4(%int_2.loc19) [concrete = constants.%int_2.ef8] // CHECK:STDOUT: %.loc19_28.4: init %i32 = converted %int_2.loc19, %int.convert_checked.loc19_28.2 [concrete = constants.%int_2.ef8] -// CHECK:STDOUT: %tuple.elem1.loc19: ref %i32 = tuple_access %b.var, element1 -// CHECK:STDOUT: %.loc19_28.5: init %i32 = initialize_from %.loc19_28.4 to %tuple.elem1.loc19 [concrete = constants.%int_2.ef8] +// CHECK:STDOUT: %tuple.elem1.loc19_28: ref %i32 = tuple_access %b.var, element1 +// CHECK:STDOUT: %.loc19_28.5: init %i32 = initialize_from %.loc19_28.4 to %tuple.elem1.loc19_28 [concrete = constants.%int_2.ef8] // CHECK:STDOUT: %.loc19_28.6: init %tuple.type.d07 = tuple_init (%.loc19_28.3, %.loc19_28.5) to %b.var [concrete = constants.%tuple] -// CHECK:STDOUT: %.loc19_3: init %tuple.type.d07 = converted %.loc19_28.1, %.loc19_28.6 [concrete = constants.%tuple] -// CHECK:STDOUT: assign %b.var, %.loc19_3 +// CHECK:STDOUT: %.loc19_3.1: init %tuple.type.d07 = converted %.loc19_28.1, %.loc19_28.6 [concrete = constants.%tuple] +// CHECK:STDOUT: assign %b.var, %.loc19_3.1 // CHECK:STDOUT: %.loc19_19.1: type = splice_block %.loc19_19.3 [concrete = constants.%tuple.type.d07] { // CHECK:STDOUT: %int_32.loc19_11: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32.loc19_11: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] @@ -234,8 +268,8 @@ fn Main() { // CHECK:STDOUT: %.loc23_46.6: ref %i32 = struct_access %c.var, element1 // CHECK:STDOUT: %.loc23_46.7: init %i32 = initialize_from %.loc23_46.5 to %.loc23_46.6 [concrete = constants.%int_2.ef8] // CHECK:STDOUT: %.loc23_46.8: init %struct_type.a.b.501 = struct_init (%.loc23_46.4, %.loc23_46.7) to %c.var [concrete = constants.%struct] -// CHECK:STDOUT: %.loc23_3: init %struct_type.a.b.501 = converted %.loc23_46.1, %.loc23_46.8 [concrete = constants.%struct] -// CHECK:STDOUT: assign %c.var, %.loc23_3 +// CHECK:STDOUT: %.loc23_3.1: init %struct_type.a.b.501 = converted %.loc23_46.1, %.loc23_46.8 [concrete = constants.%struct] +// CHECK:STDOUT: assign %c.var, %.loc23_3.1 // CHECK:STDOUT: %.loc23_27: type = splice_block %struct_type.a.b [concrete = constants.%struct_type.a.b.501] { // CHECK:STDOUT: %int_32.loc23_15: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32.loc23_15: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] @@ -272,7 +306,7 @@ fn Main() { // CHECK:STDOUT: %a.ref.loc27: ref %i32 = name_ref a, %a // CHECK:STDOUT: %addr.loc27: %ptr.235 = addr_of %a.ref.loc27 // CHECK:STDOUT: assign %p.var, %addr.loc27 -// CHECK:STDOUT: %.loc27: type = splice_block %ptr [concrete = constants.%ptr.235] { +// CHECK:STDOUT: %.loc27_13: type = splice_block %ptr [concrete = constants.%ptr.235] { // CHECK:STDOUT: %int_32.loc27: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32.loc27: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: %ptr: type = ptr_type %i32.loc27 [concrete = constants.%ptr.235] @@ -313,6 +347,40 @@ fn Main() { // CHECK:STDOUT: %int.convert_checked.loc30: init %i32 = call %bound_method.loc30_29.2(%int_10) [concrete = constants.%int_10.265] // CHECK:STDOUT: %.loc30_29: init %i32 = converted %int_10, %int.convert_checked.loc30 [concrete = constants.%int_10.265] // CHECK:STDOUT: assign %.loc30_3, %.loc30_29 +// CHECK:STDOUT: %impl.elem0.loc27: %.a79 = impl_witness_access constants.%Destroy.impl_witness.711, element0 [concrete = constants.%Op.649] +// CHECK:STDOUT: %bound_method.loc27_3.1: = bound_method %p.var, %impl.elem0.loc27 +// CHECK:STDOUT: %specific_fn.loc27: = specific_function %impl.elem0.loc27, @Op.3(constants.%ptr.235) [concrete = constants.%Op.specific_fn.829] +// CHECK:STDOUT: %bound_method.loc27_3.2: = bound_method %p.var, %specific_fn.loc27 +// CHECK:STDOUT: %.loc27_3: %ptr.235 = bind_value %p.var +// CHECK:STDOUT: %no_op.loc27: init %empty_tuple.type = call %bound_method.loc27_3.2(%.loc27_3) +// CHECK:STDOUT: %impl.elem0.loc23_3: %.8e0 = impl_witness_access constants.%Destroy.impl_witness.ad1, element0 [concrete = constants.%Op.9db] +// CHECK:STDOUT: %bound_method.loc23_3.1: = bound_method %c.var, %impl.elem0.loc23_3 +// CHECK:STDOUT: %specific_fn.loc23_3: = specific_function %impl.elem0.loc23_3, @Op.3(constants.%struct_type.a.b.501) [concrete = constants.%Op.specific_fn.1e0] +// CHECK:STDOUT: %bound_method.loc23_3.2: = bound_method %c.var, %specific_fn.loc23_3 +// CHECK:STDOUT: %.loc23_3.2: ref %i32 = struct_access %c.var, element0 +// CHECK:STDOUT: %.loc23_3.3: %i32 = bind_value %.loc23_3.2 +// CHECK:STDOUT: %.loc23_3.4: ref %i32 = struct_access %c.var, element1 +// CHECK:STDOUT: %.loc23_3.5: %i32 = bind_value %.loc23_3.4 +// CHECK:STDOUT: %struct: %struct_type.a.b.501 = struct_value (%.loc23_3.3, %.loc23_3.5) +// CHECK:STDOUT: %.loc23_3.6: %struct_type.a.b.501 = converted %c.var, %struct +// CHECK:STDOUT: %no_op.loc23: init %empty_tuple.type = call %bound_method.loc23_3.2(%.loc23_3.6) +// CHECK:STDOUT: %impl.elem0.loc19_3: %.b68 = impl_witness_access constants.%Destroy.impl_witness.5a7, element0 [concrete = constants.%Op.7c6] +// CHECK:STDOUT: %bound_method.loc19_3.1: = bound_method %b.var, %impl.elem0.loc19_3 +// CHECK:STDOUT: %specific_fn.loc19_3: = specific_function %impl.elem0.loc19_3, @Op.3(constants.%tuple.type.d07) [concrete = constants.%Op.specific_fn.bbb] +// CHECK:STDOUT: %bound_method.loc19_3.2: = bound_method %b.var, %specific_fn.loc19_3 +// CHECK:STDOUT: %tuple.elem0.loc19_3: ref %i32 = tuple_access %b.var, element0 +// CHECK:STDOUT: %.loc19_3.2: %i32 = bind_value %tuple.elem0.loc19_3 +// CHECK:STDOUT: %tuple.elem1.loc19_3: ref %i32 = tuple_access %b.var, element1 +// CHECK:STDOUT: %.loc19_3.3: %i32 = bind_value %tuple.elem1.loc19_3 +// CHECK:STDOUT: %tuple: %tuple.type.d07 = tuple_value (%.loc19_3.2, %.loc19_3.3) +// CHECK:STDOUT: %.loc19_3.4: %tuple.type.d07 = converted %b.var, %tuple +// CHECK:STDOUT: %no_op.loc19: init %empty_tuple.type = call %bound_method.loc19_3.2(%.loc19_3.4) +// CHECK:STDOUT: %impl.elem0.loc16_3.2: %.ab7 = impl_witness_access constants.%Destroy.impl_witness.64e, element0 [concrete = constants.%Op.e6a] +// CHECK:STDOUT: %bound_method.loc16_3.3: = bound_method %a.var, %impl.elem0.loc16_3.2 +// CHECK:STDOUT: %specific_fn.loc16_3.2: = specific_function %impl.elem0.loc16_3.2, @Op.3(constants.%i32) [concrete = constants.%Op.specific_fn.014] +// CHECK:STDOUT: %bound_method.loc16_3.4: = bound_method %a.var, %specific_fn.loc16_3.2 +// CHECK:STDOUT: %.loc16_3.2: %i32 = bind_value %a.var +// CHECK:STDOUT: %no_op.loc16: init %empty_tuple.type = call %bound_method.loc16_3.4(%.loc16_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/builtin/fail_and_or_partial_constant.carbon b/toolchain/check/testdata/operators/builtin/fail_and_or_partial_constant.carbon index 1f75aa0cdcea..471c041a908d 100644 --- a/toolchain/check/testdata/operators/builtin/fail_and_or_partial_constant.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_and_or_partial_constant.carbon @@ -59,15 +59,18 @@ fn KnownValueButNonConstantCondition(x: bool) { // CHECK:STDOUT: %PartialConstant: %PartialConstant.type = struct_value () [concrete] // CHECK:STDOUT: %true: bool = bool_literal true [concrete] // CHECK:STDOUT: %false: bool = bool_literal false [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Bool = %Core.Bool +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Core.Bool: %Bool.type = import_ref Core//prelude/parts/bool, Bool, loaded [concrete = constants.%Bool] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -167,6 +170,8 @@ fn KnownValueButNonConstantCondition(x: bool) { // CHECK:STDOUT: // CHECK:STDOUT: !.loc14_7: // CHECK:STDOUT: %b: = bind_name b, [concrete = ] +// CHECK:STDOUT: %impl.elem0.loc14: = impl_witness_access , element0 [concrete = ] +// CHECK:STDOUT: %impl.elem0.loc9: = impl_witness_access , element0 [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -181,15 +186,18 @@ fn KnownValueButNonConstantCondition(x: bool) { // CHECK:STDOUT: %KnownValueButNonConstantCondition: %KnownValueButNonConstantCondition.type = struct_value () [concrete] // CHECK:STDOUT: %false: bool = bool_literal false [concrete] // CHECK:STDOUT: %true: bool = bool_literal true [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Bool = %Core.Bool +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Core.Bool: %Bool.type = import_ref Core//prelude/parts/bool, Bool, loaded [concrete = constants.%Bool] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -289,6 +297,8 @@ fn KnownValueButNonConstantCondition(x: bool) { // CHECK:STDOUT: // CHECK:STDOUT: !.loc16_7: // CHECK:STDOUT: %d: = bind_name d, [concrete = ] +// CHECK:STDOUT: %impl.elem0.loc16: = impl_witness_access , element0 [concrete = ] +// CHECK:STDOUT: %impl.elem0.loc11: = impl_witness_access , element0 [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // 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 8d31f00cba10..c86d57ed3c63 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 @@ -66,6 +66,7 @@ fn Main() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete] @@ -117,12 +118,24 @@ fn Main() { // CHECK:STDOUT: %Convert.bound.491: = bound_method %int_10.64f, %Convert.956 [concrete] // CHECK:STDOUT: %bound_method.5ba: = bound_method %int_10.64f, %Convert.specific_fn [concrete] // CHECK:STDOUT: %int_10.265: %i32 = int_value 10 [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.2 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.3, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.64e: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.type.a17: type = fn_type @Op.3, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.e6a: %Op.type.a17 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %i32, (%Destroy.impl_witness.64e) [concrete] +// CHECK:STDOUT: %.ab7: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.e6a, @Op.3(%i32) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Int = %Core.Int // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -130,6 +143,9 @@ fn Main() { // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -189,13 +205,13 @@ fn Main() { // CHECK:STDOUT: } // CHECK:STDOUT: %n.var: ref %i32 = var %n.var_patt // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] -// CHECK:STDOUT: %impl.elem0.loc33: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] -// CHECK:STDOUT: %bound_method.loc33_3.1: = bound_method %int_0, %impl.elem0.loc33 [concrete = constants.%Convert.bound.d04] -// CHECK:STDOUT: %specific_fn.loc33: = specific_function %impl.elem0.loc33, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc33_3.2: = bound_method %int_0, %specific_fn.loc33 [concrete = constants.%bound_method.b6e] +// CHECK:STDOUT: %impl.elem0.loc33_3.1: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc33_3.1: = bound_method %int_0, %impl.elem0.loc33_3.1 [concrete = constants.%Convert.bound.d04] +// CHECK:STDOUT: %specific_fn.loc33_3.1: = specific_function %impl.elem0.loc33_3.1, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc33_3.2: = bound_method %int_0, %specific_fn.loc33_3.1 [concrete = constants.%bound_method.b6e] // CHECK:STDOUT: %int.convert_checked.loc33: init %i32 = call %bound_method.loc33_3.2(%int_0) [concrete = constants.%int_0.6a9] -// CHECK:STDOUT: %.loc33_3: init %i32 = converted %int_0, %int.convert_checked.loc33 [concrete = constants.%int_0.6a9] -// CHECK:STDOUT: assign %n.var, %.loc33_3 +// CHECK:STDOUT: %.loc33_3.1: init %i32 = converted %int_0, %int.convert_checked.loc33 [concrete = constants.%int_0.6a9] +// CHECK:STDOUT: assign %n.var, %.loc33_3.1 // CHECK:STDOUT: %.loc33_10: type = splice_block %i32.loc33 [concrete = constants.%i32] { // CHECK:STDOUT: %int_32.loc33: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32.loc33: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] @@ -293,7 +309,7 @@ fn Main() { // CHECK:STDOUT: %a.var_patt: %pattern_type.7ce = var_pattern %a.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %a.var: ref %i32 = var %a.var_patt -// CHECK:STDOUT: %.loc56: type = splice_block %i32.loc56 [concrete = constants.%i32] { +// CHECK:STDOUT: %.loc56_10: type = splice_block %i32.loc56 [concrete = constants.%i32] { // CHECK:STDOUT: %int_32.loc56: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32.loc56: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: } @@ -321,6 +337,18 @@ fn Main() { // CHECK:STDOUT: %int.convert_checked.loc61: init %i32 = call %bound_method.loc61_27.2(%int_10) [concrete = constants.%int_10.265] // CHECK:STDOUT: %.loc61_27: init %i32 = converted %int_10, %int.convert_checked.loc61 [concrete = constants.%int_10.265] // CHECK:STDOUT: assign %.loc61_4, %.loc61_27 +// CHECK:STDOUT: %impl.elem0.loc56: %.ab7 = impl_witness_access constants.%Destroy.impl_witness.64e, element0 [concrete = constants.%Op.e6a] +// CHECK:STDOUT: %bound_method.loc56_3.1: = bound_method %a.var, %impl.elem0.loc56 +// CHECK:STDOUT: %specific_fn.loc56: = specific_function %impl.elem0.loc56, @Op.3(constants.%i32) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc56_3.2: = bound_method %a.var, %specific_fn.loc56 +// CHECK:STDOUT: %.loc56_3: %i32 = bind_value %a.var +// CHECK:STDOUT: %no_op.loc56: init %empty_tuple.type = call %bound_method.loc56_3.2(%.loc56_3) +// CHECK:STDOUT: %impl.elem0.loc33_3.2: %.ab7 = impl_witness_access constants.%Destroy.impl_witness.64e, element0 [concrete = constants.%Op.e6a] +// CHECK:STDOUT: %bound_method.loc33_3.3: = bound_method %n.var, %impl.elem0.loc33_3.2 +// CHECK:STDOUT: %specific_fn.loc33_3.2: = specific_function %impl.elem0.loc33_3.2, @Op.3(constants.%i32) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc33_3.4: = bound_method %n.var, %specific_fn.loc33_3.2 +// CHECK:STDOUT: %.loc33_3.2: %i32 = bind_value %n.var +// CHECK:STDOUT: %no_op.loc33: init %empty_tuple.type = call %bound_method.loc33_3.4(%.loc33_3.2) // 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 2df22b5ab7df..3e6bd15686a2 100644 --- a/toolchain/check/testdata/operators/builtin/fail_redundant_compound_access.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_redundant_compound_access.carbon @@ -33,6 +33,7 @@ fn Main() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete] @@ -61,12 +62,24 @@ fn Main() { // CHECK:STDOUT: %Convert.bound.b30: = bound_method %int_3.1ba, %Convert.956 [concrete] // CHECK:STDOUT: %bound_method.047: = bound_method %int_3.1ba, %Convert.specific_fn [concrete] // CHECK:STDOUT: %int_3.822: %i32 = int_value 3 [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.2 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.3, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.64e: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.type.a17: type = fn_type @Op.3, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.e6a: %Op.type.a17 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %i32, (%Destroy.impl_witness.64e) [concrete] +// CHECK:STDOUT: %.ab7: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.e6a, @Op.3(%i32) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Int = %Core.Int // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -74,6 +87,9 @@ fn Main() { // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -116,13 +132,13 @@ fn Main() { // CHECK:STDOUT: } // CHECK:STDOUT: %a.var: ref %i32 = var %a.var_patt // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3.1ba] -// CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] -// CHECK:STDOUT: %bound_method.loc18_3.1: = bound_method %int_3, %impl.elem0 [concrete = constants.%Convert.bound.b30] -// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc18_3.2: = bound_method %int_3, %specific_fn [concrete = constants.%bound_method.047] +// CHECK:STDOUT: %impl.elem0.loc18_3.1: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc18_3.1: = bound_method %int_3, %impl.elem0.loc18_3.1 [concrete = constants.%Convert.bound.b30] +// CHECK:STDOUT: %specific_fn.loc18_3.1: = specific_function %impl.elem0.loc18_3.1, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc18_3.2: = bound_method %int_3, %specific_fn.loc18_3.1 [concrete = constants.%bound_method.047] // CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc18_3.2(%int_3) [concrete = constants.%int_3.822] -// CHECK:STDOUT: %.loc18_3: init %i32 = converted %int_3, %int.convert_checked [concrete = constants.%int_3.822] -// CHECK:STDOUT: assign %a.var, %.loc18_3 +// CHECK:STDOUT: %.loc18_3.1: init %i32 = converted %int_3, %int.convert_checked [concrete = constants.%int_3.822] +// CHECK:STDOUT: assign %a.var, %.loc18_3.1 // CHECK:STDOUT: %.loc18_10: type = splice_block %i32 [concrete = constants.%i32] { // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] @@ -138,6 +154,12 @@ fn Main() { // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] // CHECK:STDOUT: %F.call: init %i32 = call %F.ref() // CHECK:STDOUT: assign %a.ref.loc28_3, %F.call +// CHECK:STDOUT: %impl.elem0.loc18_3.2: %.ab7 = impl_witness_access constants.%Destroy.impl_witness.64e, element0 [concrete = constants.%Op.e6a] +// CHECK:STDOUT: %bound_method.loc18_3.3: = bound_method %a.var, %impl.elem0.loc18_3.2 +// CHECK:STDOUT: %specific_fn.loc18_3.2: = specific_function %impl.elem0.loc18_3.2, @Op.3(constants.%i32) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc18_3.4: = bound_method %a.var, %specific_fn.loc18_3.2 +// CHECK:STDOUT: %.loc18_3.2: %i32 = bind_value %a.var +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc18_3.4(%.loc18_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon b/toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon index 28dc7dbad84e..41e146dc201b 100644 --- a/toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon @@ -26,6 +26,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Main.type: type = fn_type @Main [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Main: %Main.type = struct_value () [concrete] // CHECK:STDOUT: %Bool.type: type = fn_type @Bool [concrete] // CHECK:STDOUT: %Bool: %Bool.type = struct_value () [concrete] @@ -33,17 +34,32 @@ fn Main() { // CHECK:STDOUT: %int_12: Core.IntLiteral = int_value 12 [concrete] // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete] // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.862: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(bool) [concrete] +// CHECK:STDOUT: %Op.type.655: type = fn_type @Op.2, @impl.49c(bool) [concrete] +// CHECK:STDOUT: %Op.8b7: %Op.type.655 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value bool, (%Destroy.impl_witness.862) [concrete] +// CHECK:STDOUT: %.0d4: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.8b7, @Op.2(bool) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Bool = %Core.Bool // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Core.Bool: %Bool.type = import_ref Core//prelude/types/bool, Bool, loaded [concrete = constants.%Bool] // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/destroy, loc15_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -72,6 +88,12 @@ fn Main() { // CHECK:STDOUT: %.loc22_10.3: type = converted %bool.make_type, %.loc22_10.2 [concrete = bool] // CHECK:STDOUT: } // CHECK:STDOUT: %x: ref bool = bind_name x, %x.var +// CHECK:STDOUT: %impl.elem0: %.0d4 = impl_witness_access constants.%Destroy.impl_witness.862, element0 [concrete = constants.%Op.8b7] +// CHECK:STDOUT: %bound_method.loc22_3.1: = bound_method %x.var, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(bool) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc22_3.2: = bound_method %x.var, %specific_fn +// CHECK:STDOUT: %.loc22_3: bool = bind_value %x.var +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc22_3.2(%.loc22_3) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: 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 8b616c9da56c..520e7b3d6c8e 100644 --- a/toolchain/check/testdata/operators/builtin/fail_type_mismatch_assignment.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_type_mismatch_assignment.carbon @@ -28,6 +28,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Main.type: type = fn_type @Main [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Main: %Main.type = struct_value () [concrete] // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] @@ -52,12 +53,24 @@ fn Main() { // CHECK:STDOUT: %bound_method: = bound_method %int_3.1ba, %Convert.specific_fn [concrete] // CHECK:STDOUT: %int_3.822: %i32 = int_value 3 [concrete] // CHECK:STDOUT: %float: f64 = float_literal 5.6000000000000005 [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.2 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.3, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.64e: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.type.a17: type = fn_type @Op.3, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.e6a: %Op.type.a17 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %i32, (%Destroy.impl_witness.64e) [concrete] +// CHECK:STDOUT: %.ab7: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.e6a, @Op.3(%i32) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Int = %Core.Int // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -65,6 +78,9 @@ fn Main() { // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -84,13 +100,13 @@ fn Main() { // CHECK:STDOUT: } // CHECK:STDOUT: %a.var: ref %i32 = var %a.var_patt // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3.1ba] -// CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] -// CHECK:STDOUT: %bound_method.loc16_3.1: = bound_method %int_3, %impl.elem0 [concrete = constants.%Convert.bound] -// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc16_3.2: = bound_method %int_3, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %impl.elem0.loc16_3.1: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc16_3.1: = bound_method %int_3, %impl.elem0.loc16_3.1 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %specific_fn.loc16_3.1: = specific_function %impl.elem0.loc16_3.1, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc16_3.2: = bound_method %int_3, %specific_fn.loc16_3.1 [concrete = constants.%bound_method] // CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc16_3.2(%int_3) [concrete = constants.%int_3.822] -// CHECK:STDOUT: %.loc16_3: init %i32 = converted %int_3, %int.convert_checked [concrete = constants.%int_3.822] -// CHECK:STDOUT: assign %a.var, %.loc16_3 +// CHECK:STDOUT: %.loc16_3.1: init %i32 = converted %int_3, %int.convert_checked [concrete = constants.%int_3.822] +// CHECK:STDOUT: assign %a.var, %.loc16_3.1 // CHECK:STDOUT: %.loc16_10: type = splice_block %i32 [concrete = constants.%i32] { // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] @@ -100,6 +116,12 @@ fn Main() { // CHECK:STDOUT: %float: f64 = float_literal 5.6000000000000005 [concrete = constants.%float] // CHECK:STDOUT: %.loc24: %i32 = converted %float, [concrete = ] // CHECK:STDOUT: assign %a.ref, +// CHECK:STDOUT: %impl.elem0.loc16_3.2: %.ab7 = impl_witness_access constants.%Destroy.impl_witness.64e, element0 [concrete = constants.%Op.e6a] +// CHECK:STDOUT: %bound_method.loc16_3.3: = bound_method %a.var, %impl.elem0.loc16_3.2 +// CHECK:STDOUT: %specific_fn.loc16_3.2: = specific_function %impl.elem0.loc16_3.2, @Op.3(constants.%i32) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc16_3.4: = bound_method %a.var, %specific_fn.loc16_3.2 +// CHECK:STDOUT: %.loc16_3.2: %i32 = bind_value %a.var +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc16_3.4(%.loc16_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/builtin/or.carbon b/toolchain/check/testdata/operators/builtin/or.carbon index 118a2187a6dd..6afab5215eb5 100644 --- a/toolchain/check/testdata/operators/builtin/or.carbon +++ b/toolchain/check/testdata/operators/builtin/or.carbon @@ -48,6 +48,23 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: %false: bool = bool_literal false [concrete] // CHECK:STDOUT: %pattern_type.cb1: type = pattern_type %empty_tuple.type [concrete] // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.1dc: = impl_witness imports.%Destroy.impl_witness_table, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.type.a63: type = fn_type @Op.2, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.ea3: %Op.type.a63 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.926: %Destroy.type = facet_value %empty_tuple.type, (%Destroy.impl_witness.1dc) [concrete] +// CHECK:STDOUT: %.346: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.926 [concrete] +// CHECK:STDOUT: %Op.specific_fn.393: = specific_function %Op.ea3, @Op.2(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.862: = impl_witness imports.%Destroy.impl_witness_table, @impl(bool) [concrete] +// CHECK:STDOUT: %Op.type.655: type = fn_type @Op.2, @impl(bool) [concrete] +// CHECK:STDOUT: %Op.8b7: %Op.type.655 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.2aa: %Destroy.type = facet_value bool, (%Destroy.impl_witness.862) [concrete] +// CHECK:STDOUT: %.0d4: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.2aa [concrete] +// CHECK:STDOUT: %Op.specific_fn.c3f: = specific_function %Op.8b7, @Op.2(bool) [concrete] // CHECK:STDOUT: %PartialConstant.type: type = fn_type @PartialConstant [concrete] // CHECK:STDOUT: %PartialConstant: %PartialConstant.type = struct_value () [concrete] // CHECK:STDOUT: } @@ -55,10 +72,14 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Bool = %Core.Bool +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Core.Bool: %Bool.type = import_ref Core//prelude/types/bool, Bool, loaded [concrete = constants.%Bool] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/destroy, loc15_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -279,8 +300,8 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: %d.var: ref %empty_tuple.type = var %d.var_patt // CHECK:STDOUT: %.loc25_49.1: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc25_49.2: init %empty_tuple.type = tuple_init () to %d.var [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc25_3: init %empty_tuple.type = converted %.loc25_49.1, %.loc25_49.2 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: assign %d.var, %.loc25_3 +// CHECK:STDOUT: %.loc25_3.1: init %empty_tuple.type = converted %.loc25_49.1, %.loc25_49.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: assign %d.var, %.loc25_3.1 // CHECK:STDOUT: br !.loc25_13 // CHECK:STDOUT: // CHECK:STDOUT: !.loc25_13: @@ -314,6 +335,31 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: // CHECK:STDOUT: !.loc25_7: // CHECK:STDOUT: %d: ref %empty_tuple.type = bind_name d, %d.var +// CHECK:STDOUT: %impl.elem0.loc25: %.346 = impl_witness_access constants.%Destroy.impl_witness.1dc, element0 [concrete = constants.%Op.ea3] +// CHECK:STDOUT: %bound_method.loc25_3.1: = bound_method %d.var, %impl.elem0.loc25 +// CHECK:STDOUT: %specific_fn.loc25: = specific_function %impl.elem0.loc25, @Op.2(constants.%empty_tuple.type) [concrete = constants.%Op.specific_fn.393] +// CHECK:STDOUT: %bound_method.loc25_3.2: = bound_method %d.var, %specific_fn.loc25 +// CHECK:STDOUT: %tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc25_3.2: %empty_tuple.type = converted %d.var, %tuple [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %no_op.loc25: init %empty_tuple.type = call %bound_method.loc25_3.2(%.loc25_3.2) +// CHECK:STDOUT: %impl.elem0.loc24: %.0d4 = impl_witness_access constants.%Destroy.impl_witness.862, element0 [concrete = constants.%Op.8b7] +// CHECK:STDOUT: %bound_method.loc24_3.1: = bound_method %c.var, %impl.elem0.loc24 +// CHECK:STDOUT: %specific_fn.loc24: = specific_function %impl.elem0.loc24, @Op.2(bool) [concrete = constants.%Op.specific_fn.c3f] +// CHECK:STDOUT: %bound_method.loc24_3.2: = bound_method %c.var, %specific_fn.loc24 +// CHECK:STDOUT: %.loc24_3: bool = bind_value %c.var +// CHECK:STDOUT: %no_op.loc24: init %empty_tuple.type = call %bound_method.loc24_3.2(%.loc24_3) +// CHECK:STDOUT: %impl.elem0.loc23: %.0d4 = impl_witness_access constants.%Destroy.impl_witness.862, element0 [concrete = constants.%Op.8b7] +// CHECK:STDOUT: %bound_method.loc23_3.1: = bound_method %b.var, %impl.elem0.loc23 +// CHECK:STDOUT: %specific_fn.loc23: = specific_function %impl.elem0.loc23, @Op.2(bool) [concrete = constants.%Op.specific_fn.c3f] +// CHECK:STDOUT: %bound_method.loc23_3.2: = bound_method %b.var, %specific_fn.loc23 +// CHECK:STDOUT: %.loc23_3: bool = bind_value %b.var +// CHECK:STDOUT: %no_op.loc23: init %empty_tuple.type = call %bound_method.loc23_3.2(%.loc23_3) +// CHECK:STDOUT: %impl.elem0.loc22: %.0d4 = impl_witness_access constants.%Destroy.impl_witness.862, element0 [concrete = constants.%Op.8b7] +// CHECK:STDOUT: %bound_method.loc22_3.1: = bound_method %a.var, %impl.elem0.loc22 +// CHECK:STDOUT: %specific_fn.loc22: = specific_function %impl.elem0.loc22, @Op.2(bool) [concrete = constants.%Op.specific_fn.c3f] +// CHECK:STDOUT: %bound_method.loc22_3.2: = bound_method %a.var, %specific_fn.loc22 +// CHECK:STDOUT: %.loc22_3: bool = bind_value %a.var +// CHECK:STDOUT: %no_op.loc22: init %empty_tuple.type = call %bound_method.loc22_3.2(%.loc22_3) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -359,6 +405,12 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: // CHECK:STDOUT: !.loc29_7: // CHECK:STDOUT: %a: ref bool = bind_name a, %a.var +// CHECK:STDOUT: %impl.elem0: %.0d4 = impl_witness_access constants.%Destroy.impl_witness.862, element0 [concrete = constants.%Op.8b7] +// CHECK:STDOUT: %bound_method.loc29_3.1: = bound_method %a.var, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(bool) [concrete = constants.%Op.specific_fn.c3f] +// CHECK:STDOUT: %bound_method.loc29_3.2: = bound_method %a.var, %specific_fn +// CHECK:STDOUT: %.loc29_3: bool = bind_value %a.var +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc29_3.2(%.loc29_3) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/builtin/unary_op.carbon b/toolchain/check/testdata/operators/builtin/unary_op.carbon index fc23b5b18dbe..bedc1d05dced 100644 --- a/toolchain/check/testdata/operators/builtin/unary_op.carbon +++ b/toolchain/check/testdata/operators/builtin/unary_op.carbon @@ -38,15 +38,36 @@ fn Constant() { // CHECK:STDOUT: %Constant: %Constant.type = struct_value () [concrete] // CHECK:STDOUT: %pattern_type.cb1: type = pattern_type %empty_tuple.type [concrete] // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.862: = impl_witness imports.%Destroy.impl_witness_table, @impl(bool) [concrete] +// CHECK:STDOUT: %Op.type.655: type = fn_type @Op.2, @impl(bool) [concrete] +// CHECK:STDOUT: %Op.8b7: %Op.type.655 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.2aa: %Destroy.type = facet_value bool, (%Destroy.impl_witness.862) [concrete] +// CHECK:STDOUT: %.0d4: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.2aa [concrete] +// CHECK:STDOUT: %Op.specific_fn.c3f: = specific_function %Op.8b7, @Op.2(bool) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.1dc: = impl_witness imports.%Destroy.impl_witness_table, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.type.a63: type = fn_type @Op.2, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.ea3: %Op.type.a63 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.926: %Destroy.type = facet_value %empty_tuple.type, (%Destroy.impl_witness.1dc) [concrete] +// CHECK:STDOUT: %.346: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.926 [concrete] +// CHECK:STDOUT: %Op.specific_fn.393: = specific_function %Op.ea3, @Op.2(%empty_tuple.type) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Bool = %Core.Bool +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Core.Bool: %Bool.type = import_ref Core//prelude/types/bool, Bool, loaded [concrete = constants.%Bool] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/destroy, loc15_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -114,8 +135,8 @@ fn Constant() { // CHECK:STDOUT: %a.var: ref %empty_tuple.type = var %a.var_patt // CHECK:STDOUT: %.loc22_43.1: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc22_43.2: init %empty_tuple.type = tuple_init () to %a.var [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc22_3: init %empty_tuple.type = converted %.loc22_43.1, %.loc22_43.2 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: assign %a.var, %.loc22_3 +// CHECK:STDOUT: %.loc22_3.1: init %empty_tuple.type = converted %.loc22_43.1, %.loc22_43.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: assign %a.var, %.loc22_3.1 // CHECK:STDOUT: br !.loc22_17 // CHECK:STDOUT: // CHECK:STDOUT: !.loc22_17: @@ -171,6 +192,19 @@ fn Constant() { // CHECK:STDOUT: // CHECK:STDOUT: !.loc23_7: // CHECK:STDOUT: %b: ref bool = bind_name b, %b.var +// CHECK:STDOUT: %impl.elem0.loc23: %.0d4 = impl_witness_access constants.%Destroy.impl_witness.862, element0 [concrete = constants.%Op.8b7] +// CHECK:STDOUT: %bound_method.loc23_3.1: = bound_method %b.var, %impl.elem0.loc23 +// CHECK:STDOUT: %specific_fn.loc23: = specific_function %impl.elem0.loc23, @Op.2(bool) [concrete = constants.%Op.specific_fn.c3f] +// CHECK:STDOUT: %bound_method.loc23_3.2: = bound_method %b.var, %specific_fn.loc23 +// CHECK:STDOUT: %.loc23_3: bool = bind_value %b.var +// CHECK:STDOUT: %no_op.loc23: init %empty_tuple.type = call %bound_method.loc23_3.2(%.loc23_3) +// CHECK:STDOUT: %impl.elem0.loc22: %.346 = impl_witness_access constants.%Destroy.impl_witness.1dc, element0 [concrete = constants.%Op.ea3] +// CHECK:STDOUT: %bound_method.loc22_3.1: = bound_method %a.var, %impl.elem0.loc22 +// CHECK:STDOUT: %specific_fn.loc22: = specific_function %impl.elem0.loc22, @Op.2(constants.%empty_tuple.type) [concrete = constants.%Op.specific_fn.393] +// CHECK:STDOUT: %bound_method.loc22_3.2: = bound_method %a.var, %specific_fn.loc22 +// CHECK:STDOUT: %tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc22_3.2: %empty_tuple.type = converted %a.var, %tuple [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %no_op.loc22: init %empty_tuple.type = call %bound_method.loc22_3.2(%.loc22_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/dec.carbon b/toolchain/check/testdata/operators/overloaded/dec.carbon index 31d3c546a017..32c28c8fb10e 100644 --- a/toolchain/check/testdata/operators/overloaded/dec.carbon +++ b/toolchain/check/testdata/operators/overloaded/dec.carbon @@ -50,10 +50,10 @@ fn TestOp() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: // CHECK:STDOUT: %c.ref: ref %C = name_ref c, %c -// CHECK:STDOUT: %impl.elem0: %.859 = impl_witness_access constants.%Dec.impl_witness, element0 [concrete = constants.%Op.cf9] -// CHECK:STDOUT: %bound_method: = bound_method %c.ref, %impl.elem0 +// CHECK:STDOUT: %impl.elem0.loc27: %.859 = impl_witness_access constants.%Dec.impl_witness, element0 [concrete = constants.%Op.cf9] +// CHECK:STDOUT: %bound_method.loc27: = bound_method %c.ref, %impl.elem0.loc27 // CHECK:STDOUT: %addr: %ptr.019 = addr_of %c.ref -// CHECK:STDOUT: %Op.call: init %empty_tuple.type = call %bound_method(%addr) +// CHECK:STDOUT: %Op.call: init %empty_tuple.type = call %bound_method.loc27(%addr) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/fail_assign_non_ref.carbon b/toolchain/check/testdata/operators/overloaded/fail_assign_non_ref.carbon index c0894dec2ea1..a9ad6d57840d 100644 --- a/toolchain/check/testdata/operators/overloaded/fail_assign_non_ref.carbon +++ b/toolchain/check/testdata/operators/overloaded/fail_assign_non_ref.carbon @@ -72,6 +72,17 @@ fn TestAddAssignNonRef(a: C, b: C) { // CHECK:STDOUT: %TestIncNonRef.type: type = fn_type @TestIncNonRef [concrete] // CHECK:STDOUT: %TestIncNonRef: %TestIncNonRef.type = struct_value () [concrete] // CHECK:STDOUT: %.bc7: type = fn_type_with_self_type %Op.type.e3a, %Inc.facet [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.10 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.11, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.906: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%C) [concrete] +// CHECK:STDOUT: %Op.type.153: type = fn_type @Op.11, @impl.49c(%C) [concrete] +// CHECK:STDOUT: %Op.5d7: %Op.type.153 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %C, (%Destroy.impl_witness.906) [concrete] +// CHECK:STDOUT: %.b80: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.5d7, @Op.11(%C) [concrete] // CHECK:STDOUT: %TestAddAssignNonRef.type: type = fn_type @TestAddAssignNonRef [concrete] // CHECK:STDOUT: %TestAddAssignNonRef: %TestAddAssignNonRef.type = struct_value () [concrete] // CHECK:STDOUT: %.e2d: type = fn_type_with_self_type %Op.type.5af, %AddAssignWith.facet [concrete] @@ -81,11 +92,15 @@ fn TestAddAssignNonRef(a: C, b: C) { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Inc = %Core.Inc // CHECK:STDOUT: .AddAssignWith = %Core.AddAssignWith +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Core.Inc: type = import_ref Core//prelude/operators/arithmetic, Inc, loaded [concrete = constants.%Inc.type] // CHECK:STDOUT: %Core.AddAssignWith: %AddAssignWith.type.fc6 = import_ref Core//prelude/operators/arithmetic, AddAssignWith, loaded [concrete = constants.%AddAssignWith.generic] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/destroy, loc15_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -197,11 +212,17 @@ fn TestAddAssignNonRef(a: C, b: C) { // CHECK:STDOUT: fn @TestIncNonRef(%a.param: %C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: %C = name_ref a, %a -// CHECK:STDOUT: %impl.elem0: %.bc7 = impl_witness_access constants.%Inc.impl_witness, element0 [concrete = constants.%Op.0c9] -// CHECK:STDOUT: %bound_method: = bound_method %a.ref, %impl.elem0 -// CHECK:STDOUT: %.loc33: ref %C = temporary_storage -// CHECK:STDOUT: %addr: %ptr.019 = addr_of %.loc33 -// CHECK:STDOUT: %Op.call: init %empty_tuple.type = call %bound_method(%addr) +// CHECK:STDOUT: %impl.elem0.loc33_3: %.bc7 = impl_witness_access constants.%Inc.impl_witness, element0 [concrete = constants.%Op.0c9] +// CHECK:STDOUT: %bound_method.loc33_3: = bound_method %a.ref, %impl.elem0.loc33_3 +// CHECK:STDOUT: %.loc33_5.1: ref %C = temporary_storage +// CHECK:STDOUT: %addr: %ptr.019 = addr_of %.loc33_5.1 +// CHECK:STDOUT: %Op.call: init %empty_tuple.type = call %bound_method.loc33_3(%addr) +// CHECK:STDOUT: %impl.elem0.loc33_5: %.b80 = impl_witness_access constants.%Destroy.impl_witness.906, element0 [concrete = constants.%Op.5d7] +// CHECK:STDOUT: %bound_method.loc33_5.1: = bound_method %.loc33_5.1, %impl.elem0.loc33_5 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0.loc33_5, @Op.11(constants.%C) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc33_5.2: = bound_method %.loc33_5.1, %specific_fn +// CHECK:STDOUT: %.loc33_5.2: %C = bind_value %.loc33_5.1 +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc33_5.2(%.loc33_5.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -209,11 +230,17 @@ fn TestAddAssignNonRef(a: C, b: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: %C = name_ref a, %a // CHECK:STDOUT: %b.ref: %C = name_ref b, %b -// CHECK:STDOUT: %impl.elem0: %.e2d = impl_witness_access constants.%AddAssignWith.impl_witness, element0 [concrete = constants.%Op.572] -// CHECK:STDOUT: %bound_method: = bound_method %a.ref, %impl.elem0 -// CHECK:STDOUT: %.loc44: ref %C = temporary_storage -// CHECK:STDOUT: %addr: %ptr.019 = addr_of %.loc44 -// CHECK:STDOUT: %Op.call: init %empty_tuple.type = call %bound_method(%addr, %b.ref) +// CHECK:STDOUT: %impl.elem0.loc44_5: %.e2d = impl_witness_access constants.%AddAssignWith.impl_witness, element0 [concrete = constants.%Op.572] +// CHECK:STDOUT: %bound_method.loc44_5: = bound_method %a.ref, %impl.elem0.loc44_5 +// CHECK:STDOUT: %.loc44_3.1: ref %C = temporary_storage +// CHECK:STDOUT: %addr: %ptr.019 = addr_of %.loc44_3.1 +// CHECK:STDOUT: %Op.call: init %empty_tuple.type = call %bound_method.loc44_5(%addr, %b.ref) +// CHECK:STDOUT: %impl.elem0.loc44_3: %.b80 = impl_witness_access constants.%Destroy.impl_witness.906, element0 [concrete = constants.%Op.5d7] +// CHECK:STDOUT: %bound_method.loc44_3.1: = bound_method %.loc44_3.1, %impl.elem0.loc44_3 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0.loc44_3, @Op.11(constants.%C) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc44_3.2: = bound_method %.loc44_3.1, %specific_fn +// CHECK:STDOUT: %.loc44_3.2: %C = bind_value %.loc44_3.1 +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc44_3.2(%.loc44_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/fail_no_impl.carbon b/toolchain/check/testdata/operators/overloaded/fail_no_impl.carbon index 578f97794f85..40ae96e51ead 100644 --- a/toolchain/check/testdata/operators/overloaded/fail_no_impl.carbon +++ b/toolchain/check/testdata/operators/overloaded/fail_no_impl.carbon @@ -53,6 +53,7 @@ fn TestRef(b: C) { // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] // CHECK:STDOUT: %pattern_type.c48: type = pattern_type %C [concrete] // CHECK:STDOUT: %TestUnary.type: type = fn_type @TestUnary [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %TestUnary: %TestUnary.type = struct_value () [concrete] // CHECK:STDOUT: %Negate.type: type = facet_type <@Negate> [concrete] // CHECK:STDOUT: %AddWith.type.e05: type = generic_interface_type @AddWith [concrete] @@ -65,6 +66,17 @@ fn TestRef(b: C) { // CHECK:STDOUT: %AddAssignWith.type.fc6: type = generic_interface_type @AddAssignWith [concrete] // CHECK:STDOUT: %AddAssignWith.generic: %AddAssignWith.type.fc6 = struct_value () [concrete] // CHECK:STDOUT: %Inc.type: type = facet_type <@Inc> [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.9 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.10, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.906: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%C) [concrete] +// CHECK:STDOUT: %Op.type.153: type = fn_type @Op.10, @impl.49c(%C) [concrete] +// CHECK:STDOUT: %Op.5d7: %Op.type.153 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %C, (%Destroy.impl_witness.906) [concrete] +// CHECK:STDOUT: %.b80: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.5d7, @Op.10(%C) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -73,6 +85,7 @@ fn TestRef(b: C) { // CHECK:STDOUT: .AddWith = %Core.AddWith // CHECK:STDOUT: .AddAssignWith = %Core.AddAssignWith // CHECK:STDOUT: .Inc = %Core.Inc +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -80,6 +93,9 @@ fn TestRef(b: C) { // CHECK:STDOUT: %Core.AddWith: %AddWith.type.e05 = import_ref Core//prelude/operators/arithmetic, AddWith, loaded [concrete = constants.%AddWith.generic] // CHECK:STDOUT: %Core.AddAssignWith: %AddAssignWith.type.fc6 = import_ref Core//prelude/operators/arithmetic, AddAssignWith, loaded [concrete = constants.%AddAssignWith.generic] // CHECK:STDOUT: %Core.Inc: type = import_ref Core//prelude/operators/arithmetic, Inc, loaded [concrete = constants.%Inc.type] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/destroy, loc15_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -164,13 +180,19 @@ fn TestRef(b: C) { // CHECK:STDOUT: %a.var: ref %C = var %a.var_patt // CHECK:STDOUT: %.loc35_15.1: %empty_struct_type = struct_literal () // CHECK:STDOUT: %.loc35_15.2: init %C = class_init (), %a.var [concrete = constants.%C.val] -// CHECK:STDOUT: %.loc35_3: init %C = converted %.loc35_15.1, %.loc35_15.2 [concrete = constants.%C.val] -// CHECK:STDOUT: assign %a.var, %.loc35_3 +// CHECK:STDOUT: %.loc35_3.1: init %C = converted %.loc35_15.1, %.loc35_15.2 [concrete = constants.%C.val] +// CHECK:STDOUT: assign %a.var, %.loc35_3.1 // CHECK:STDOUT: %C.ref.loc35: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %a: ref %C = bind_name a, %a.var // CHECK:STDOUT: %a.ref.loc40: ref %C = name_ref a, %a // CHECK:STDOUT: %b.ref: %C = name_ref b, %b // CHECK:STDOUT: %a.ref.loc45: ref %C = name_ref a, %a +// CHECK:STDOUT: %impl.elem0: %.b80 = impl_witness_access constants.%Destroy.impl_witness.906, element0 [concrete = constants.%Op.5d7] +// CHECK:STDOUT: %bound_method.loc35_3.1: = bound_method %a.var, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.10(constants.%C) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc35_3.2: = bound_method %a.var, %specific_fn +// CHECK:STDOUT: %.loc35_3.2: %C = bind_value %a.var +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc35_3.2(%.loc35_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/implicit_as.carbon b/toolchain/check/testdata/operators/overloaded/implicit_as.carbon index fffb11e83a64..27baa8f922c1 100644 --- a/toolchain/check/testdata/operators/overloaded/implicit_as.carbon +++ b/toolchain/check/testdata/operators/overloaded/implicit_as.carbon @@ -82,17 +82,31 @@ fn Test() { // CHECK:STDOUT: %.2ea: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet.bf9 [concrete] // CHECK:STDOUT: %Source.specific_fn.cc7: = specific_function %Source, @Source(%i32) [concrete] // CHECK:STDOUT: %.9b4: type = fn_type_with_self_type %Convert.type.665, %ImplicitAs.facet.d80 [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.2 [concrete] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.3, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.599: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%X) [concrete] +// CHECK:STDOUT: %Op.type.9e1: type = fn_type @Op.3, @impl.49c(%X) [concrete] +// CHECK:STDOUT: %Op.33a: %Op.type.9e1 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %X, (%Destroy.impl_witness.599) [concrete] +// CHECK:STDOUT: %.bfc: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.33a, @Op.3(%X) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Int = %Core.Int // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic] // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -269,11 +283,11 @@ fn Test() { // CHECK:STDOUT: %Source.specific_fn.loc34: = specific_function %Source.ref.loc34, @Source(constants.%X) [concrete = constants.%Source.specific_fn.363] // CHECK:STDOUT: %.loc34_20.1: ref %X = temporary_storage // CHECK:STDOUT: %Source.call.loc34: init %X = call %Source.specific_fn.loc34() to %.loc34_20.1 -// CHECK:STDOUT: %impl.elem0.loc34: %.2ea = impl_witness_access constants.%ImplicitAs.impl_witness.b30, element0 [concrete = constants.%Convert.c7a] -// CHECK:STDOUT: %bound_method.loc34: = bound_method %Source.call.loc34, %impl.elem0.loc34 +// CHECK:STDOUT: %impl.elem0.loc34_20.1: %.2ea = impl_witness_access constants.%ImplicitAs.impl_witness.b30, element0 [concrete = constants.%Convert.c7a] +// CHECK:STDOUT: %bound_method.loc34_20.1: = bound_method %Source.call.loc34, %impl.elem0.loc34_20.1 // CHECK:STDOUT: %.loc34_20.2: ref %X = temporary %.loc34_20.1, %Source.call.loc34 // CHECK:STDOUT: %.loc34_20.3: %X = bind_value %.loc34_20.2 -// CHECK:STDOUT: %Convert.call.loc34: init %i32 = call %bound_method.loc34(%.loc34_20.3) +// CHECK:STDOUT: %Convert.call.loc34: init %i32 = call %bound_method.loc34_20.1(%.loc34_20.3) // CHECK:STDOUT: %.loc34_20.4: %i32 = value_of_initializer %Convert.call.loc34 // CHECK:STDOUT: %.loc34_20.5: %i32 = converted %Source.call.loc34, %.loc34_20.4 // CHECK:STDOUT: %Sink_i32.call: init %empty_tuple.type = call %Sink_i32.ref(%.loc34_20.5) @@ -283,16 +297,28 @@ fn Test() { // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: %Source.specific_fn.loc35: = specific_function %Source.ref.loc35, @Source(constants.%i32) [concrete = constants.%Source.specific_fn.cc7] // CHECK:STDOUT: %Source.call.loc35: init %i32 = call %Source.specific_fn.loc35() -// CHECK:STDOUT: %impl.elem0.loc35: %.9b4 = impl_witness_access constants.%ImplicitAs.impl_witness.aa3, element0 [concrete = constants.%Convert.08a] -// CHECK:STDOUT: %bound_method.loc35: = bound_method %Source.call.loc35, %impl.elem0.loc35 +// CHECK:STDOUT: %impl.elem0.loc35_20.1: %.9b4 = impl_witness_access constants.%ImplicitAs.impl_witness.aa3, element0 [concrete = constants.%Convert.08a] +// CHECK:STDOUT: %bound_method.loc35_20.1: = bound_method %Source.call.loc35, %impl.elem0.loc35_20.1 // CHECK:STDOUT: %.loc35_20.1: ref %X = temporary_storage // CHECK:STDOUT: %.loc35_20.2: %i32 = value_of_initializer %Source.call.loc35 // CHECK:STDOUT: %.loc35_20.3: %i32 = converted %Source.call.loc35, %.loc35_20.2 -// CHECK:STDOUT: %Convert.call.loc35: init %X = call %bound_method.loc35(%.loc35_20.3) to %.loc35_20.1 +// CHECK:STDOUT: %Convert.call.loc35: init %X = call %bound_method.loc35_20.1(%.loc35_20.3) to %.loc35_20.1 // CHECK:STDOUT: %.loc35_20.4: init %X = converted %Source.call.loc35, %Convert.call.loc35 // CHECK:STDOUT: %.loc35_20.5: ref %X = temporary %.loc35_20.1, %.loc35_20.4 // CHECK:STDOUT: %.loc35_20.6: %X = bind_value %.loc35_20.5 // CHECK:STDOUT: %Sink_X.call: init %empty_tuple.type = call %Sink_X.ref(%.loc35_20.6) +// CHECK:STDOUT: %impl.elem0.loc35_20.2: %.bfc = impl_witness_access constants.%Destroy.impl_witness.599, element0 [concrete = constants.%Op.33a] +// CHECK:STDOUT: %bound_method.loc35_20.2: = bound_method %.loc35_20.1, %impl.elem0.loc35_20.2 +// CHECK:STDOUT: %specific_fn.loc35: = specific_function %impl.elem0.loc35_20.2, @Op.3(constants.%X) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc35_20.3: = bound_method %.loc35_20.1, %specific_fn.loc35 +// CHECK:STDOUT: %.loc35_20.7: %X = bind_value %.loc35_20.1 +// CHECK:STDOUT: %no_op.loc35: init %empty_tuple.type = call %bound_method.loc35_20.3(%.loc35_20.7) +// CHECK:STDOUT: %impl.elem0.loc34_20.2: %.bfc = impl_witness_access constants.%Destroy.impl_witness.599, element0 [concrete = constants.%Op.33a] +// CHECK:STDOUT: %bound_method.loc34_20.2: = bound_method %.loc34_20.1, %impl.elem0.loc34_20.2 +// CHECK:STDOUT: %specific_fn.loc34: = specific_function %impl.elem0.loc34_20.2, @Op.3(constants.%X) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc34_20.3: = bound_method %.loc34_20.1, %specific_fn.loc34 +// CHECK:STDOUT: %.loc34_20.6: %X = bind_value %.loc34_20.1 +// CHECK:STDOUT: %no_op.loc34: init %empty_tuple.type = call %bound_method.loc34_20.3(%.loc34_20.6) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/inc.carbon b/toolchain/check/testdata/operators/overloaded/inc.carbon index 435eb1d3e75d..0b9561927ac3 100644 --- a/toolchain/check/testdata/operators/overloaded/inc.carbon +++ b/toolchain/check/testdata/operators/overloaded/inc.carbon @@ -50,10 +50,10 @@ fn TestOp() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: // CHECK:STDOUT: %c.ref: ref %C = name_ref c, %c -// CHECK:STDOUT: %impl.elem0: %.bc7 = impl_witness_access constants.%Inc.impl_witness, element0 [concrete = constants.%Op.0c9] -// CHECK:STDOUT: %bound_method: = bound_method %c.ref, %impl.elem0 +// CHECK:STDOUT: %impl.elem0.loc27: %.bc7 = impl_witness_access constants.%Inc.impl_witness, element0 [concrete = constants.%Op.0c9] +// CHECK:STDOUT: %bound_method.loc27: = bound_method %c.ref, %impl.elem0.loc27 // CHECK:STDOUT: %addr: %ptr.019 = addr_of %c.ref -// CHECK:STDOUT: %Op.call: init %empty_tuple.type = call %bound_method(%addr) +// CHECK:STDOUT: %Op.call: init %empty_tuple.type = call %bound_method.loc27(%addr) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/package_expr/fail_not_found.carbon b/toolchain/check/testdata/package_expr/fail_not_found.carbon index 7dc719e545dd..558ab6e34b01 100644 --- a/toolchain/check/testdata/package_expr/fail_not_found.carbon +++ b/toolchain/check/testdata/package_expr/fail_not_found.carbon @@ -24,21 +24,37 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Main.type: type = fn_type @Main [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Main: %Main.type = struct_value () [concrete] // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.3, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.64e: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.type.a17: type = fn_type @Op.3, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.e6a: %Op.type.a17 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %i32, (%Destroy.impl_witness.64e) [concrete] +// CHECK:STDOUT: %.ab7: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.e6a, @Op.3(%i32) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -61,11 +77,17 @@ fn Main() { // CHECK:STDOUT: %package.ref: = name_ref package, package [concrete = package] // CHECK:STDOUT: %x.ref: = name_ref x, [concrete = ] // CHECK:STDOUT: assign %y.var, -// CHECK:STDOUT: %.loc20: type = splice_block %i32 [concrete = constants.%i32] { +// CHECK:STDOUT: %.loc20_10: type = splice_block %i32 [concrete = constants.%i32] { // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: %y: ref %i32 = bind_name y, %y.var +// CHECK:STDOUT: %impl.elem0: %.ab7 = impl_witness_access constants.%Destroy.impl_witness.64e, element0 [concrete = constants.%Op.e6a] +// CHECK:STDOUT: %bound_method.loc20_3.1: = bound_method %y.var, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.3(constants.%i32) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc20_3.2: = bound_method %y.var, %specific_fn +// CHECK:STDOUT: %.loc20_3: %i32 = bind_value %y.var +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc20_3.2(%.loc20_3) // 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 f0f693e6ee40..e75a0ef85497 100644 --- a/toolchain/check/testdata/package_expr/syntax.carbon +++ b/toolchain/check/testdata/package_expr/syntax.carbon @@ -136,6 +136,7 @@ fn Main() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete] @@ -162,12 +163,24 @@ fn Main() { // CHECK:STDOUT: %Convert.bound.ab5: = bound_method %int_1.5b8, %Convert.956 [concrete] // CHECK:STDOUT: %bound_method.9a1: = bound_method %int_1.5b8, %Convert.specific_fn [concrete] // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.2 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.3, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.64e: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.type.a17: type = fn_type @Op.3, @impl.49c(%i32) [concrete] +// CHECK:STDOUT: %Op.e6a: %Op.type.a17 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %i32, (%Destroy.impl_witness.64e) [concrete] +// CHECK:STDOUT: %.ab7: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.e6a, @Op.3(%i32) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Int = %Core.Int // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -175,6 +188,9 @@ fn Main() { // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -205,13 +221,13 @@ fn Main() { // CHECK:STDOUT: } // CHECK:STDOUT: %x.var: ref %i32 = var %x.var_patt // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] -// CHECK:STDOUT: %bound_method.loc7_3.1: = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound.ab5] -// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc7_3.2: = bound_method %int_1, %specific_fn [concrete = constants.%bound_method.9a1] +// CHECK:STDOUT: %impl.elem0.loc7_3.1: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc7_3.1: = bound_method %int_1, %impl.elem0.loc7_3.1 [concrete = constants.%Convert.bound.ab5] +// CHECK:STDOUT: %specific_fn.loc7_3.1: = specific_function %impl.elem0.loc7_3.1, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_3.2: = bound_method %int_1, %specific_fn.loc7_3.1 [concrete = constants.%bound_method.9a1] // CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc7_3.2(%int_1) [concrete = constants.%int_1.5d2] -// CHECK:STDOUT: %.loc7_3: init %i32 = converted %int_1, %int.convert_checked [concrete = constants.%int_1.5d2] -// CHECK:STDOUT: assign %x.var, %.loc7_3 +// CHECK:STDOUT: %.loc7_3.1: init %i32 = converted %int_1, %int.convert_checked [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: assign %x.var, %.loc7_3.1 // CHECK:STDOUT: %.loc7_10: type = splice_block %i32.loc7 [concrete = constants.%i32] { // CHECK:STDOUT: %int_32.loc7: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32.loc7: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] @@ -231,6 +247,18 @@ fn Main() { // CHECK:STDOUT: %i32.loc9: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: %y: ref %i32 = bind_name y, %y.var +// CHECK:STDOUT: %impl.elem0.loc9: %.ab7 = impl_witness_access constants.%Destroy.impl_witness.64e, element0 [concrete = constants.%Op.e6a] +// CHECK:STDOUT: %bound_method.loc9_3.1: = bound_method %y.var, %impl.elem0.loc9 +// CHECK:STDOUT: %specific_fn.loc9: = specific_function %impl.elem0.loc9, @Op.3(constants.%i32) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc9_3.2: = bound_method %y.var, %specific_fn.loc9 +// CHECK:STDOUT: %.loc9_3: %i32 = bind_value %y.var +// CHECK:STDOUT: %no_op.loc9: init %empty_tuple.type = call %bound_method.loc9_3.2(%.loc9_3) +// CHECK:STDOUT: %impl.elem0.loc7_3.2: %.ab7 = impl_witness_access constants.%Destroy.impl_witness.64e, element0 [concrete = constants.%Op.e6a] +// CHECK:STDOUT: %bound_method.loc7_3.3: = bound_method %x.var, %impl.elem0.loc7_3.2 +// CHECK:STDOUT: %specific_fn.loc7_3.2: = specific_function %impl.elem0.loc7_3.2, @Op.3(constants.%i32) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_3.4: = bound_method %x.var, %specific_fn.loc7_3.2 +// CHECK:STDOUT: %.loc7_3.2: %i32 = bind_value %x.var +// CHECK:STDOUT: %no_op.loc7: init %empty_tuple.type = call %bound_method.loc7_3.4(%.loc7_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/patterns/underscore.carbon b/toolchain/check/testdata/patterns/underscore.carbon index 631e0d80c36f..c61cff59f1dd 100644 --- a/toolchain/check/testdata/patterns/underscore.carbon +++ b/toolchain/check/testdata/patterns/underscore.carbon @@ -125,17 +125,33 @@ fn F() -> {} { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] -// CHECK:STDOUT: %pattern_type: type = pattern_type %empty_struct_type [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %pattern_type.a96: type = pattern_type %empty_struct_type [concrete] // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete] // CHECK:STDOUT: %F.type: type = fn_type @F [concrete] // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.eb8: = impl_witness imports.%Destroy.impl_witness_table, @impl(%empty_struct_type) [concrete] +// CHECK:STDOUT: %Op.type.069: type = fn_type @Op.2, @impl(%empty_struct_type) [concrete] +// CHECK:STDOUT: %Op.d5a: %Op.type.069 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %empty_struct_type, (%Destroy.impl_witness.eb8) [concrete] +// CHECK:STDOUT: %.9da: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.d5a, @Op.2(%empty_struct_type) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -145,7 +161,7 @@ fn F() -> {} { // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %_.patt.loc4: %pattern_type = binding_pattern _ [concrete] +// CHECK:STDOUT: %_.patt.loc4: %pattern_type.a96 = binding_pattern _ [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %.loc4_9.1: type = splice_block %.loc4_9.3 [concrete = constants.%empty_struct_type] { // CHECK:STDOUT: %.loc4_9.2: %empty_struct_type = struct_literal () @@ -155,8 +171,8 @@ fn F() -> {} { // CHECK:STDOUT: %.loc4_14: %empty_struct_type = converted @__global_init.%.loc4, %empty_struct [concrete = constants.%empty_struct] // CHECK:STDOUT: %_.loc4: %empty_struct_type = bind_name _, %.loc4_14 // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %_.patt.loc5: %pattern_type = binding_pattern _ [concrete] -// CHECK:STDOUT: %_.var_patt: %pattern_type = var_pattern %_.patt.loc5 [concrete] +// CHECK:STDOUT: %_.patt.loc5: %pattern_type.a96 = binding_pattern _ [concrete] +// CHECK:STDOUT: %_.var_patt: %pattern_type.a96 = var_pattern %_.patt.loc5 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %_.var: ref %empty_struct_type = var %_.var_patt // CHECK:STDOUT: %.loc5_9.1: type = splice_block %.loc5_9.3 [concrete = constants.%empty_struct_type] { @@ -170,30 +186,37 @@ fn F() -> {} { // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %_.patt.loc8: %pattern_type = binding_pattern _ [concrete] +// CHECK:STDOUT: %_.patt.loc8: %pattern_type.a96 = binding_pattern _ [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %.loc8_16.1: %empty_struct_type = struct_literal () // CHECK:STDOUT: %.loc8_11.1: type = splice_block %.loc8_11.3 [concrete = constants.%empty_struct_type] { // CHECK:STDOUT: %.loc8_11.2: %empty_struct_type = struct_literal () // CHECK:STDOUT: %.loc8_11.3: type = converted %.loc8_11.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: } -// CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc8_16.2: %empty_struct_type = converted %.loc8_16.1, %empty_struct [concrete = constants.%empty_struct] +// CHECK:STDOUT: %empty_struct.loc8: %empty_struct_type = struct_value () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc8_16.2: %empty_struct_type = converted %.loc8_16.1, %empty_struct.loc8 [concrete = constants.%empty_struct] // CHECK:STDOUT: %_.loc8: %empty_struct_type = bind_name _, %.loc8_16.2 // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %_.patt.loc9: %pattern_type = binding_pattern _ [concrete] -// CHECK:STDOUT: %_.var_patt: %pattern_type = var_pattern %_.patt.loc9 [concrete] +// CHECK:STDOUT: %_.patt.loc9: %pattern_type.a96 = binding_pattern _ [concrete] +// CHECK:STDOUT: %_.var_patt: %pattern_type.a96 = var_pattern %_.patt.loc9 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %_.var: ref %empty_struct_type = var %_.var_patt // CHECK:STDOUT: %.loc9_16.1: %empty_struct_type = struct_literal () // CHECK:STDOUT: %.loc9_16.2: init %empty_struct_type = struct_init () to %_.var [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc9_3: init %empty_struct_type = converted %.loc9_16.1, %.loc9_16.2 [concrete = constants.%empty_struct] -// CHECK:STDOUT: assign %_.var, %.loc9_3 +// CHECK:STDOUT: %.loc9_3.1: init %empty_struct_type = converted %.loc9_16.1, %.loc9_16.2 [concrete = constants.%empty_struct] +// CHECK:STDOUT: assign %_.var, %.loc9_3.1 // CHECK:STDOUT: %.loc9_11.1: type = splice_block %.loc9_11.3 [concrete = constants.%empty_struct_type] { // CHECK:STDOUT: %.loc9_11.2: %empty_struct_type = struct_literal () // CHECK:STDOUT: %.loc9_11.3: type = converted %.loc9_11.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: } // CHECK:STDOUT: %_.loc9: ref %empty_struct_type = bind_name _, %_.var +// CHECK:STDOUT: %impl.elem0: %.9da = impl_witness_access constants.%Destroy.impl_witness.eb8, element0 [concrete = constants.%Op.d5a] +// CHECK:STDOUT: %bound_method.loc9_3.1: = bound_method %_.var, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%empty_struct_type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc9_3.2: = bound_method %_.var, %specific_fn +// CHECK:STDOUT: %empty_struct.loc9: %empty_struct_type = struct_value () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc9_3.2: %empty_struct_type = converted %_.var, %empty_struct.loc9 [concrete = constants.%empty_struct] +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc9_3.2(%.loc9_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/pointer/address_of_lvalue.carbon b/toolchain/check/testdata/pointer/address_of_lvalue.carbon index ba1060343d96..38cc539bb0f4 100644 --- a/toolchain/check/testdata/pointer/address_of_lvalue.carbon +++ b/toolchain/check/testdata/pointer/address_of_lvalue.carbon @@ -28,6 +28,7 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] @@ -68,12 +69,42 @@ fn F() { // CHECK:STDOUT: %tuple.type.f94: type = tuple_type (Core.IntLiteral, Core.IntLiteral) [concrete] // CHECK:STDOUT: %tuple: %tuple.type.d07 = tuple_value (%int_1.5d2, %int_2.ef8) [concrete] // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.2 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.3, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.711: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%ptr.235) [concrete] +// CHECK:STDOUT: %Op.type.ba2: type = fn_type @Op.3, @impl.49c(%ptr.235) [concrete] +// CHECK:STDOUT: %Op.649: %Op.type.ba2 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.2bf: %Destroy.type = facet_value %ptr.235, (%Destroy.impl_witness.711) [concrete] +// CHECK:STDOUT: %.a79: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.2bf [concrete] +// CHECK:STDOUT: %Op.specific_fn.829: = specific_function %Op.649, @Op.3(%ptr.235) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.5a7: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%tuple.type.d07) [concrete] +// CHECK:STDOUT: %Op.type.a4a: type = fn_type @Op.3, @impl.49c(%tuple.type.d07) [concrete] +// CHECK:STDOUT: %Op.7c6: %Op.type.a4a = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.167: %Destroy.type = facet_value %tuple.type.d07, (%Destroy.impl_witness.5a7) [concrete] +// CHECK:STDOUT: %.b68: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.167 [concrete] +// CHECK:STDOUT: %Op.specific_fn.bbb: = specific_function %Op.7c6, @Op.3(%tuple.type.d07) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.ff6: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%ptr.3ee) [concrete] +// CHECK:STDOUT: %Op.type.757: type = fn_type @Op.3, @impl.49c(%ptr.3ee) [concrete] +// CHECK:STDOUT: %Op.e22: %Op.type.757 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.ed3: %Destroy.type = facet_value %ptr.3ee, (%Destroy.impl_witness.ff6) [concrete] +// CHECK:STDOUT: %.f93: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.ed3 [concrete] +// CHECK:STDOUT: %Op.specific_fn.ce1: = specific_function %Op.e22, @Op.3(%ptr.3ee) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.ad1: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%struct_type.a.b.501) [concrete] +// CHECK:STDOUT: %Op.type.da3: type = fn_type @Op.3, @impl.49c(%struct_type.a.b.501) [concrete] +// CHECK:STDOUT: %Op.9db: %Op.type.da3 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.807: %Destroy.type = facet_value %struct_type.a.b.501, (%Destroy.impl_witness.ad1) [concrete] +// CHECK:STDOUT: %.8e0: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.807 [concrete] +// CHECK:STDOUT: %Op.specific_fn.1e0: = specific_function %Op.9db, @Op.3(%struct_type.a.b.501) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Int = %Core.Int // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -81,6 +112,9 @@ fn F() { // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -119,8 +153,8 @@ fn F() { // CHECK:STDOUT: %.loc16_46.6: ref %i32 = struct_access %s.var, element1 // CHECK:STDOUT: %.loc16_46.7: init %i32 = initialize_from %.loc16_46.5 to %.loc16_46.6 [concrete = constants.%int_2.ef8] // CHECK:STDOUT: %.loc16_46.8: init %struct_type.a.b.501 = struct_init (%.loc16_46.4, %.loc16_46.7) to %s.var [concrete = constants.%struct] -// CHECK:STDOUT: %.loc16_3: init %struct_type.a.b.501 = converted %.loc16_46.1, %.loc16_46.8 [concrete = constants.%struct] -// CHECK:STDOUT: assign %s.var, %.loc16_3 +// CHECK:STDOUT: %.loc16_3.1: init %struct_type.a.b.501 = converted %.loc16_46.1, %.loc16_46.8 [concrete = constants.%struct] +// CHECK:STDOUT: assign %s.var, %.loc16_3.1 // CHECK:STDOUT: %.loc16_27: type = splice_block %struct_type.a.b.loc16 [concrete = constants.%struct_type.a.b.501] { // CHECK:STDOUT: %int_32.loc16_15: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32.loc16_15: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] @@ -137,7 +171,7 @@ fn F() { // CHECK:STDOUT: %s.ref.loc18: ref %struct_type.a.b.501 = name_ref s, %s // CHECK:STDOUT: %addr.loc18: %ptr.3ee = addr_of %s.ref.loc18 // CHECK:STDOUT: assign %p.var, %addr.loc18 -// CHECK:STDOUT: %.loc18: type = splice_block %ptr.loc18 [concrete = constants.%ptr.3ee] { +// CHECK:STDOUT: %.loc18_28: type = splice_block %ptr.loc18 [concrete = constants.%ptr.3ee] { // CHECK:STDOUT: %int_32.loc18_15: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32.loc18_15: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: %int_32.loc18_24: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] @@ -190,19 +224,19 @@ fn F() { // CHECK:STDOUT: %bound_method.loc22_28.2: = bound_method %int_1.loc22, %specific_fn.loc22_28.1 [concrete = constants.%bound_method.9a1] // CHECK:STDOUT: %int.convert_checked.loc22_28.1: init %i32 = call %bound_method.loc22_28.2(%int_1.loc22) [concrete = constants.%int_1.5d2] // CHECK:STDOUT: %.loc22_28.2: init %i32 = converted %int_1.loc22, %int.convert_checked.loc22_28.1 [concrete = constants.%int_1.5d2] -// CHECK:STDOUT: %tuple.elem0.loc22: ref %i32 = tuple_access %t.var, element0 -// CHECK:STDOUT: %.loc22_28.3: init %i32 = initialize_from %.loc22_28.2 to %tuple.elem0.loc22 [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %tuple.elem0.loc22_28: ref %i32 = tuple_access %t.var, element0 +// CHECK:STDOUT: %.loc22_28.3: init %i32 = initialize_from %.loc22_28.2 to %tuple.elem0.loc22_28 [concrete = constants.%int_1.5d2] // CHECK:STDOUT: %impl.elem0.loc22_28.2: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] // CHECK:STDOUT: %bound_method.loc22_28.3: = bound_method %int_2.loc22, %impl.elem0.loc22_28.2 [concrete = constants.%Convert.bound.ef9] // CHECK:STDOUT: %specific_fn.loc22_28.2: = specific_function %impl.elem0.loc22_28.2, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] // CHECK:STDOUT: %bound_method.loc22_28.4: = bound_method %int_2.loc22, %specific_fn.loc22_28.2 [concrete = constants.%bound_method.b92] // CHECK:STDOUT: %int.convert_checked.loc22_28.2: init %i32 = call %bound_method.loc22_28.4(%int_2.loc22) [concrete = constants.%int_2.ef8] // CHECK:STDOUT: %.loc22_28.4: init %i32 = converted %int_2.loc22, %int.convert_checked.loc22_28.2 [concrete = constants.%int_2.ef8] -// CHECK:STDOUT: %tuple.elem1.loc22: ref %i32 = tuple_access %t.var, element1 -// CHECK:STDOUT: %.loc22_28.5: init %i32 = initialize_from %.loc22_28.4 to %tuple.elem1.loc22 [concrete = constants.%int_2.ef8] +// CHECK:STDOUT: %tuple.elem1.loc22_28: ref %i32 = tuple_access %t.var, element1 +// CHECK:STDOUT: %.loc22_28.5: init %i32 = initialize_from %.loc22_28.4 to %tuple.elem1.loc22_28 [concrete = constants.%int_2.ef8] // CHECK:STDOUT: %.loc22_28.6: init %tuple.type.d07 = tuple_init (%.loc22_28.3, %.loc22_28.5) to %t.var [concrete = constants.%tuple] -// CHECK:STDOUT: %.loc22_3: init %tuple.type.d07 = converted %.loc22_28.1, %.loc22_28.6 [concrete = constants.%tuple] -// CHECK:STDOUT: assign %t.var, %.loc22_3 +// CHECK:STDOUT: %.loc22_3.1: init %tuple.type.d07 = converted %.loc22_28.1, %.loc22_28.6 [concrete = constants.%tuple] +// CHECK:STDOUT: assign %t.var, %.loc22_3.1 // CHECK:STDOUT: %.loc22_19.1: type = splice_block %.loc22_19.3 [concrete = constants.%tuple.type.d07] { // CHECK:STDOUT: %int_32.loc22_11: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32.loc22_11: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] @@ -222,7 +256,7 @@ fn F() { // CHECK:STDOUT: %tuple.elem0.loc23: ref %i32 = tuple_access %t.ref.loc23, element0 // CHECK:STDOUT: %addr.loc23: %ptr.235 = addr_of %tuple.elem0.loc23 // CHECK:STDOUT: assign %t0.var, %addr.loc23 -// CHECK:STDOUT: %.loc23: type = splice_block %ptr.loc23 [concrete = constants.%ptr.235] { +// CHECK:STDOUT: %.loc23_14: type = splice_block %ptr.loc23 [concrete = constants.%ptr.235] { // CHECK:STDOUT: %int_32.loc23: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32.loc23: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: %ptr.loc23: type = ptr_type %i32.loc23 [concrete = constants.%ptr.235] @@ -238,12 +272,64 @@ fn F() { // CHECK:STDOUT: %tuple.elem1.loc24: ref %i32 = tuple_access %t.ref.loc24, element1 // CHECK:STDOUT: %addr.loc24: %ptr.235 = addr_of %tuple.elem1.loc24 // CHECK:STDOUT: assign %t1.var, %addr.loc24 -// CHECK:STDOUT: %.loc24: type = splice_block %ptr.loc24 [concrete = constants.%ptr.235] { +// CHECK:STDOUT: %.loc24_14: type = splice_block %ptr.loc24 [concrete = constants.%ptr.235] { // CHECK:STDOUT: %int_32.loc24: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32.loc24: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: %ptr.loc24: type = ptr_type %i32.loc24 [concrete = constants.%ptr.235] // CHECK:STDOUT: } // CHECK:STDOUT: %t1: ref %ptr.235 = bind_name t1, %t1.var +// CHECK:STDOUT: %impl.elem0.loc24: %.a79 = impl_witness_access constants.%Destroy.impl_witness.711, element0 [concrete = constants.%Op.649] +// CHECK:STDOUT: %bound_method.loc24_3.1: = bound_method %t1.var, %impl.elem0.loc24 +// CHECK:STDOUT: %specific_fn.loc24: = specific_function %impl.elem0.loc24, @Op.3(constants.%ptr.235) [concrete = constants.%Op.specific_fn.829] +// CHECK:STDOUT: %bound_method.loc24_3.2: = bound_method %t1.var, %specific_fn.loc24 +// CHECK:STDOUT: %.loc24_3: %ptr.235 = bind_value %t1.var +// CHECK:STDOUT: %no_op.loc24: init %empty_tuple.type = call %bound_method.loc24_3.2(%.loc24_3) +// CHECK:STDOUT: %impl.elem0.loc23: %.a79 = impl_witness_access constants.%Destroy.impl_witness.711, element0 [concrete = constants.%Op.649] +// CHECK:STDOUT: %bound_method.loc23_3.1: = bound_method %t0.var, %impl.elem0.loc23 +// CHECK:STDOUT: %specific_fn.loc23: = specific_function %impl.elem0.loc23, @Op.3(constants.%ptr.235) [concrete = constants.%Op.specific_fn.829] +// CHECK:STDOUT: %bound_method.loc23_3.2: = bound_method %t0.var, %specific_fn.loc23 +// CHECK:STDOUT: %.loc23_3: %ptr.235 = bind_value %t0.var +// CHECK:STDOUT: %no_op.loc23: init %empty_tuple.type = call %bound_method.loc23_3.2(%.loc23_3) +// CHECK:STDOUT: %impl.elem0.loc22_3: %.b68 = impl_witness_access constants.%Destroy.impl_witness.5a7, element0 [concrete = constants.%Op.7c6] +// CHECK:STDOUT: %bound_method.loc22_3.1: = bound_method %t.var, %impl.elem0.loc22_3 +// CHECK:STDOUT: %specific_fn.loc22_3: = specific_function %impl.elem0.loc22_3, @Op.3(constants.%tuple.type.d07) [concrete = constants.%Op.specific_fn.bbb] +// CHECK:STDOUT: %bound_method.loc22_3.2: = bound_method %t.var, %specific_fn.loc22_3 +// CHECK:STDOUT: %tuple.elem0.loc22_3: ref %i32 = tuple_access %t.var, element0 +// CHECK:STDOUT: %.loc22_3.2: %i32 = bind_value %tuple.elem0.loc22_3 +// CHECK:STDOUT: %tuple.elem1.loc22_3: ref %i32 = tuple_access %t.var, element1 +// CHECK:STDOUT: %.loc22_3.3: %i32 = bind_value %tuple.elem1.loc22_3 +// CHECK:STDOUT: %tuple: %tuple.type.d07 = tuple_value (%.loc22_3.2, %.loc22_3.3) +// CHECK:STDOUT: %.loc22_3.4: %tuple.type.d07 = converted %t.var, %tuple +// CHECK:STDOUT: %no_op.loc22: init %empty_tuple.type = call %bound_method.loc22_3.2(%.loc22_3.4) +// CHECK:STDOUT: %impl.elem0.loc20: %.a79 = impl_witness_access constants.%Destroy.impl_witness.711, element0 [concrete = constants.%Op.649] +// CHECK:STDOUT: %bound_method.loc20_3.1: = bound_method %r.var, %impl.elem0.loc20 +// CHECK:STDOUT: %specific_fn.loc20: = specific_function %impl.elem0.loc20, @Op.3(constants.%ptr.235) [concrete = constants.%Op.specific_fn.829] +// CHECK:STDOUT: %bound_method.loc20_3.2: = bound_method %r.var, %specific_fn.loc20 +// CHECK:STDOUT: %.loc20_3: %ptr.235 = bind_value %r.var +// CHECK:STDOUT: %no_op.loc20: init %empty_tuple.type = call %bound_method.loc20_3.2(%.loc20_3) +// CHECK:STDOUT: %impl.elem0.loc19: %.a79 = impl_witness_access constants.%Destroy.impl_witness.711, element0 [concrete = constants.%Op.649] +// CHECK:STDOUT: %bound_method.loc19_3.1: = bound_method %q.var, %impl.elem0.loc19 +// CHECK:STDOUT: %specific_fn.loc19: = specific_function %impl.elem0.loc19, @Op.3(constants.%ptr.235) [concrete = constants.%Op.specific_fn.829] +// CHECK:STDOUT: %bound_method.loc19_3.2: = bound_method %q.var, %specific_fn.loc19 +// CHECK:STDOUT: %.loc19_3: %ptr.235 = bind_value %q.var +// CHECK:STDOUT: %no_op.loc19: init %empty_tuple.type = call %bound_method.loc19_3.2(%.loc19_3) +// CHECK:STDOUT: %impl.elem0.loc18: %.f93 = impl_witness_access constants.%Destroy.impl_witness.ff6, element0 [concrete = constants.%Op.e22] +// CHECK:STDOUT: %bound_method.loc18_3.1: = bound_method %p.var, %impl.elem0.loc18 +// CHECK:STDOUT: %specific_fn.loc18: = specific_function %impl.elem0.loc18, @Op.3(constants.%ptr.3ee) [concrete = constants.%Op.specific_fn.ce1] +// CHECK:STDOUT: %bound_method.loc18_3.2: = bound_method %p.var, %specific_fn.loc18 +// CHECK:STDOUT: %.loc18_3: %ptr.3ee = bind_value %p.var +// CHECK:STDOUT: %no_op.loc18: init %empty_tuple.type = call %bound_method.loc18_3.2(%.loc18_3) +// CHECK:STDOUT: %impl.elem0.loc16_3: %.8e0 = impl_witness_access constants.%Destroy.impl_witness.ad1, element0 [concrete = constants.%Op.9db] +// CHECK:STDOUT: %bound_method.loc16_3.1: = bound_method %s.var, %impl.elem0.loc16_3 +// CHECK:STDOUT: %specific_fn.loc16_3: = specific_function %impl.elem0.loc16_3, @Op.3(constants.%struct_type.a.b.501) [concrete = constants.%Op.specific_fn.1e0] +// CHECK:STDOUT: %bound_method.loc16_3.2: = bound_method %s.var, %specific_fn.loc16_3 +// CHECK:STDOUT: %.loc16_3.2: ref %i32 = struct_access %s.var, element0 +// CHECK:STDOUT: %.loc16_3.3: %i32 = bind_value %.loc16_3.2 +// CHECK:STDOUT: %.loc16_3.4: ref %i32 = struct_access %s.var, element1 +// CHECK:STDOUT: %.loc16_3.5: %i32 = bind_value %.loc16_3.4 +// CHECK:STDOUT: %struct: %struct_type.a.b.501 = struct_value (%.loc16_3.3, %.loc16_3.5) +// CHECK:STDOUT: %.loc16_3.6: %struct_type.a.b.501 = converted %s.var, %struct +// CHECK:STDOUT: %no_op.loc16: init %empty_tuple.type = call %bound_method.loc16_3.2(%.loc16_3.6) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/pointer/fail_address_of_value.carbon b/toolchain/check/testdata/pointer/fail_address_of_value.carbon index 3bb878477086..912453a08d36 100644 --- a/toolchain/check/testdata/pointer/fail_address_of_value.carbon +++ b/toolchain/check/testdata/pointer/fail_address_of_value.carbon @@ -109,6 +109,7 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete] @@ -139,6 +140,17 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: %AddressOfOperator: %AddressOfOperator.type = struct_value () [concrete] // CHECK:STDOUT: %false: bool = bool_literal false [concrete] // CHECK:STDOUT: %ptr.235: type = ptr_type %i32 [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.6d2: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%struct_type.a.ba9) [concrete] +// CHECK:STDOUT: %Op.type.c80: type = fn_type @Op.2, @impl.49c(%struct_type.a.ba9) [concrete] +// CHECK:STDOUT: %Op.691: %Op.type.c80 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.16e: %Destroy.type = facet_value %struct_type.a.ba9, (%Destroy.impl_witness.6d2) [concrete] +// CHECK:STDOUT: %.a8f: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.16e [concrete] +// CHECK:STDOUT: %Op.specific_fn.51b: = specific_function %Op.691, @Op.2(%struct_type.a.ba9) [concrete] // CHECK:STDOUT: %AddressOfCall.type: type = fn_type @AddressOfCall [concrete] // CHECK:STDOUT: %AddressOfCall: %AddressOfCall.type = struct_value () [concrete] // CHECK:STDOUT: %AddressOfType.type: type = fn_type @AddressOfType [concrete] @@ -152,15 +164,25 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: %AddressOfParam.type: type = fn_type @AddressOfParam [concrete] // CHECK:STDOUT: %AddressOfParam: %AddressOfParam.type = struct_value () [concrete] // CHECK:STDOUT: %pattern_type.fe8: type = pattern_type %ptr.235 [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.711: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%ptr.235) [concrete] +// CHECK:STDOUT: %Op.type.ba2: type = fn_type @Op.2, @impl.49c(%ptr.235) [concrete] +// CHECK:STDOUT: %Op.649: %Op.type.ba2 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.2bf: %Destroy.type = facet_value %ptr.235, (%Destroy.impl_witness.711) [concrete] +// CHECK:STDOUT: %.a79: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.2bf [concrete] +// CHECK:STDOUT: %Op.specific_fn.829: = specific_function %Op.649, @Op.2(%ptr.235) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -259,6 +281,15 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: %true.loc67: bool = bool_literal true [concrete = constants.%true] // CHECK:STDOUT: %.loc67: bool = not %true.loc67 [concrete = constants.%false] // CHECK:STDOUT: %addr.loc67: %ptr.bb2 = addr_of [concrete = ] +// CHECK:STDOUT: %impl.elem0: %.a8f = impl_witness_access constants.%Destroy.impl_witness.6d2, element0 [concrete = constants.%Op.691] +// CHECK:STDOUT: %bound_method.loc62_6.1: = bound_method %.loc62_6.1, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%struct_type.a.ba9) [concrete = constants.%Op.specific_fn.51b] +// CHECK:STDOUT: %bound_method.loc62_6.2: = bound_method %.loc62_6.1, %specific_fn +// CHECK:STDOUT: %.loc62_6.3: ref %i32 = struct_access %.loc62_6.1, element0 +// CHECK:STDOUT: %.loc62_6.4: %i32 = bind_value %.loc62_6.3 +// CHECK:STDOUT: %struct: %struct_type.a.ba9 = struct_value (%.loc62_6.4) +// CHECK:STDOUT: %.loc62_6.5: %struct_type.a.ba9 = converted %.loc62_6.1, %struct +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc62_6.2(%.loc62_6.5) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -306,12 +337,18 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: %param.ref: %i32 = name_ref param, %param // CHECK:STDOUT: %addr: %ptr.235 = addr_of [concrete = ] // CHECK:STDOUT: assign %param_addr.var, %addr -// CHECK:STDOUT: %.loc104: type = splice_block %ptr [concrete = constants.%ptr.235] { +// CHECK:STDOUT: %.loc104_22: type = splice_block %ptr [concrete = constants.%ptr.235] { // CHECK:STDOUT: %int_32.loc104: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32.loc104: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: %ptr: type = ptr_type %i32.loc104 [concrete = constants.%ptr.235] // CHECK:STDOUT: } // CHECK:STDOUT: %param_addr: ref %ptr.235 = bind_name param_addr, %param_addr.var +// CHECK:STDOUT: %impl.elem0: %.a79 = impl_witness_access constants.%Destroy.impl_witness.711, element0 [concrete = constants.%Op.649] +// CHECK:STDOUT: %bound_method.loc104_3.1: = bound_method %param_addr.var, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%ptr.235) [concrete = constants.%Op.specific_fn.829] +// CHECK:STDOUT: %bound_method.loc104_3.2: = bound_method %param_addr.var, %specific_fn +// CHECK:STDOUT: %.loc104_3: %ptr.235 = bind_value %param_addr.var +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc104_3.2(%.loc104_3) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/struct/nested_struct_in_place.carbon b/toolchain/check/testdata/struct/nested_struct_in_place.carbon index e8cd4dc245af..456f307a13bb 100644 --- a/toolchain/check/testdata/struct/nested_struct_in_place.carbon +++ b/toolchain/check/testdata/struct/nested_struct_in_place.carbon @@ -23,6 +23,7 @@ fn G() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] // CHECK:STDOUT: %tuple.type.ff9: type = tuple_type (type, type, type) [concrete] @@ -34,15 +35,36 @@ fn G() { // CHECK:STDOUT: %G: %G.type = struct_value () [concrete] // CHECK:STDOUT: %struct_type.a.b.2f9: type = struct_type {.a: %tuple.type.189, .b: %tuple.type.189} [concrete] // CHECK:STDOUT: %pattern_type.3c2: type = pattern_type %struct_type.a.b.2f9 [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.3, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.c0f: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%tuple.type.189) [concrete] +// CHECK:STDOUT: %Op.type.19f: type = fn_type @Op.3, @impl.49c(%tuple.type.189) [concrete] +// CHECK:STDOUT: %Op.672: %Op.type.19f = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.ba8: %Destroy.type = facet_value %tuple.type.189, (%Destroy.impl_witness.c0f) [concrete] +// CHECK:STDOUT: %.cce: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.ba8 [concrete] +// CHECK:STDOUT: %Op.specific_fn.cf9: = specific_function %Op.672, @Op.3(%tuple.type.189) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.0dd: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%struct_type.a.b.2f9) [concrete] +// CHECK:STDOUT: %Op.type.840: type = fn_type @Op.3, @impl.49c(%struct_type.a.b.2f9) [concrete] +// CHECK:STDOUT: %Op.52b: %Op.type.840 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.4f2: %Destroy.type = facet_value %struct_type.a.b.2f9, (%Destroy.impl_witness.0dd) [concrete] +// CHECK:STDOUT: %.1a1: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.4f2 [concrete] +// CHECK:STDOUT: %Op.specific_fn.c7e: = specific_function %Op.52b, @Op.3(%struct_type.a.b.2f9) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -87,8 +109,8 @@ fn G() { // CHECK:STDOUT: %F.call.loc18_73: init %tuple.type.189 = call %F.ref.loc18_71() to %.loc18_74.2 // CHECK:STDOUT: %.loc18_74.3: %struct_type.a.b.2f9 = struct_literal (%F.call.loc18_63, %F.call.loc18_73) // CHECK:STDOUT: %.loc18_74.4: init %struct_type.a.b.2f9 = struct_init (%F.call.loc18_63, %F.call.loc18_73) to %v.var -// CHECK:STDOUT: %.loc18_3: init %struct_type.a.b.2f9 = converted %.loc18_74.3, %.loc18_74.4 -// CHECK:STDOUT: assign %v.var, %.loc18_3 +// CHECK:STDOUT: %.loc18_3.1: init %struct_type.a.b.2f9 = converted %.loc18_74.3, %.loc18_74.4 +// CHECK:STDOUT: assign %v.var, %.loc18_3.1 // CHECK:STDOUT: %.loc18_51: type = splice_block %struct_type.a.b [concrete = constants.%struct_type.a.b.2f9] { // CHECK:STDOUT: %int_32.loc18_16: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32.loc18_16: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] @@ -109,6 +131,57 @@ fn G() { // CHECK:STDOUT: %struct_type.a.b: type = struct_type {.a: %tuple.type.189, .b: %tuple.type.189} [concrete = constants.%struct_type.a.b.2f9] // CHECK:STDOUT: } // CHECK:STDOUT: %v: ref %struct_type.a.b.2f9 = bind_name v, %v.var +// CHECK:STDOUT: %impl.elem0.loc18_74.1: %.cce = impl_witness_access constants.%Destroy.impl_witness.c0f, element0 [concrete = constants.%Op.672] +// CHECK:STDOUT: %bound_method.loc18_74.1: = bound_method %.loc18_74.2, %impl.elem0.loc18_74.1 +// CHECK:STDOUT: %specific_fn.loc18_74.1: = specific_function %impl.elem0.loc18_74.1, @Op.3(constants.%tuple.type.189) [concrete = constants.%Op.specific_fn.cf9] +// CHECK:STDOUT: %bound_method.loc18_74.2: = bound_method %.loc18_74.2, %specific_fn.loc18_74.1 +// CHECK:STDOUT: %tuple.elem0.loc18_74.1: ref %i32 = tuple_access %.loc18_74.2, element0 +// CHECK:STDOUT: %.loc18_74.5: %i32 = bind_value %tuple.elem0.loc18_74.1 +// CHECK:STDOUT: %tuple.elem1.loc18_74.1: ref %i32 = tuple_access %.loc18_74.2, element1 +// CHECK:STDOUT: %.loc18_74.6: %i32 = bind_value %tuple.elem1.loc18_74.1 +// CHECK:STDOUT: %tuple.elem2.loc18_74.1: ref %i32 = tuple_access %.loc18_74.2, element2 +// CHECK:STDOUT: %.loc18_74.7: %i32 = bind_value %tuple.elem2.loc18_74.1 +// CHECK:STDOUT: %tuple.loc18_74.1: %tuple.type.189 = tuple_value (%.loc18_74.5, %.loc18_74.6, %.loc18_74.7) +// CHECK:STDOUT: %.loc18_74.8: %tuple.type.189 = converted %.loc18_74.2, %tuple.loc18_74.1 +// CHECK:STDOUT: %no_op.loc18_74.1: init %empty_tuple.type = call %bound_method.loc18_74.2(%.loc18_74.8) +// CHECK:STDOUT: %impl.elem0.loc18_74.2: %.cce = impl_witness_access constants.%Destroy.impl_witness.c0f, element0 [concrete = constants.%Op.672] +// CHECK:STDOUT: %bound_method.loc18_74.3: = bound_method %.loc18_74.1, %impl.elem0.loc18_74.2 +// CHECK:STDOUT: %specific_fn.loc18_74.2: = specific_function %impl.elem0.loc18_74.2, @Op.3(constants.%tuple.type.189) [concrete = constants.%Op.specific_fn.cf9] +// CHECK:STDOUT: %bound_method.loc18_74.4: = bound_method %.loc18_74.1, %specific_fn.loc18_74.2 +// CHECK:STDOUT: %tuple.elem0.loc18_74.2: ref %i32 = tuple_access %.loc18_74.1, element0 +// CHECK:STDOUT: %.loc18_74.9: %i32 = bind_value %tuple.elem0.loc18_74.2 +// CHECK:STDOUT: %tuple.elem1.loc18_74.2: ref %i32 = tuple_access %.loc18_74.1, element1 +// CHECK:STDOUT: %.loc18_74.10: %i32 = bind_value %tuple.elem1.loc18_74.2 +// CHECK:STDOUT: %tuple.elem2.loc18_74.2: ref %i32 = tuple_access %.loc18_74.1, element2 +// CHECK:STDOUT: %.loc18_74.11: %i32 = bind_value %tuple.elem2.loc18_74.2 +// CHECK:STDOUT: %tuple.loc18_74.2: %tuple.type.189 = tuple_value (%.loc18_74.9, %.loc18_74.10, %.loc18_74.11) +// CHECK:STDOUT: %.loc18_74.12: %tuple.type.189 = converted %.loc18_74.1, %tuple.loc18_74.2 +// CHECK:STDOUT: %no_op.loc18_74.2: init %empty_tuple.type = call %bound_method.loc18_74.4(%.loc18_74.12) +// CHECK:STDOUT: %impl.elem0.loc18_3: %.1a1 = impl_witness_access constants.%Destroy.impl_witness.0dd, element0 [concrete = constants.%Op.52b] +// CHECK:STDOUT: %bound_method.loc18_3.1: = bound_method %v.var, %impl.elem0.loc18_3 +// CHECK:STDOUT: %specific_fn.loc18_3: = specific_function %impl.elem0.loc18_3, @Op.3(constants.%struct_type.a.b.2f9) [concrete = constants.%Op.specific_fn.c7e] +// CHECK:STDOUT: %bound_method.loc18_3.2: = bound_method %v.var, %specific_fn.loc18_3 +// CHECK:STDOUT: %.loc18_3.2: ref %tuple.type.189 = struct_access %v.var, element0 +// CHECK:STDOUT: %tuple.elem0.loc18_3.1: ref %i32 = tuple_access %.loc18_3.2, element0 +// CHECK:STDOUT: %.loc18_3.3: %i32 = bind_value %tuple.elem0.loc18_3.1 +// CHECK:STDOUT: %tuple.elem1.loc18_3.1: ref %i32 = tuple_access %.loc18_3.2, element1 +// CHECK:STDOUT: %.loc18_3.4: %i32 = bind_value %tuple.elem1.loc18_3.1 +// CHECK:STDOUT: %tuple.elem2.loc18_3.1: ref %i32 = tuple_access %.loc18_3.2, element2 +// CHECK:STDOUT: %.loc18_3.5: %i32 = bind_value %tuple.elem2.loc18_3.1 +// CHECK:STDOUT: %tuple.loc18_3.1: %tuple.type.189 = tuple_value (%.loc18_3.3, %.loc18_3.4, %.loc18_3.5) +// CHECK:STDOUT: %.loc18_3.6: %tuple.type.189 = converted %.loc18_3.2, %tuple.loc18_3.1 +// CHECK:STDOUT: %.loc18_3.7: ref %tuple.type.189 = struct_access %v.var, element1 +// CHECK:STDOUT: %tuple.elem0.loc18_3.2: ref %i32 = tuple_access %.loc18_3.7, element0 +// CHECK:STDOUT: %.loc18_3.8: %i32 = bind_value %tuple.elem0.loc18_3.2 +// CHECK:STDOUT: %tuple.elem1.loc18_3.2: ref %i32 = tuple_access %.loc18_3.7, element1 +// CHECK:STDOUT: %.loc18_3.9: %i32 = bind_value %tuple.elem1.loc18_3.2 +// CHECK:STDOUT: %tuple.elem2.loc18_3.2: ref %i32 = tuple_access %.loc18_3.7, element2 +// CHECK:STDOUT: %.loc18_3.10: %i32 = bind_value %tuple.elem2.loc18_3.2 +// CHECK:STDOUT: %tuple.loc18_3.2: %tuple.type.189 = tuple_value (%.loc18_3.8, %.loc18_3.9, %.loc18_3.10) +// CHECK:STDOUT: %.loc18_3.11: %tuple.type.189 = converted %.loc18_3.7, %tuple.loc18_3.2 +// CHECK:STDOUT: %struct: %struct_type.a.b.2f9 = struct_value (%.loc18_3.6, %.loc18_3.11) +// CHECK:STDOUT: %.loc18_3.12: %struct_type.a.b.2f9 = converted %v.var, %struct +// CHECK:STDOUT: %no_op.loc18_3: init %empty_tuple.type = call %bound_method.loc18_3.2(%.loc18_3.12) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/tuple/in_place_tuple_init.carbon b/toolchain/check/testdata/tuple/in_place_tuple_init.carbon index 9dafd26e89e8..ed1bb9926f06 100644 --- a/toolchain/check/testdata/tuple/in_place_tuple_init.carbon +++ b/toolchain/check/testdata/tuple/in_place_tuple_init.carbon @@ -111,6 +111,7 @@ fn H() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] // CHECK:STDOUT: %tuple.type.ff9: type = tuple_type (type, type, type) [concrete] // CHECK:STDOUT: %tuple.type.189: type = tuple_type (%i32, %i32, %i32) [concrete] @@ -119,6 +120,26 @@ fn H() { // CHECK:STDOUT: %tuple.type.f9f: type = tuple_type (%tuple.type.ff9, %tuple.type.ff9) [concrete] // CHECK:STDOUT: %tuple.type.99b: type = tuple_type (%tuple.type.189, %tuple.type.189) [concrete] // CHECK:STDOUT: %pattern_type.d88: type = pattern_type %tuple.type.99b [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %To: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To) [symbolic] +// CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.3, @impl.49c(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.c0f: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%tuple.type.189) [concrete] +// CHECK:STDOUT: %Op.type.19f: type = fn_type @Op.3, @impl.49c(%tuple.type.189) [concrete] +// CHECK:STDOUT: %Op.672: %Op.type.19f = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.ba8: %Destroy.type = facet_value %tuple.type.189, (%Destroy.impl_witness.c0f) [concrete] +// CHECK:STDOUT: %.cce: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.ba8 [concrete] +// CHECK:STDOUT: %Op.specific_fn.cf9: = specific_function %Op.672, @Op.3(%tuple.type.189) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.2c6: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%tuple.type.99b) [concrete] +// CHECK:STDOUT: %Op.type.387: type = fn_type @Op.3, @impl.49c(%tuple.type.99b) [concrete] +// CHECK:STDOUT: %Op.b09: %Op.type.387 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.e74: %Destroy.type = facet_value %tuple.type.99b, (%Destroy.impl_witness.2c6) [concrete] +// CHECK:STDOUT: %.41d: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.e74 [concrete] +// CHECK:STDOUT: %Op.specific_fn.852: = specific_function %Op.b09, @Op.3(%tuple.type.99b) [concrete] // CHECK:STDOUT: %tuple.type.3a3: type = tuple_type (type, %tuple.type.ff9, type) [concrete] // CHECK:STDOUT: %tuple.type.516: type = tuple_type (%i32, %tuple.type.189, %i32) [concrete] // CHECK:STDOUT: %pattern_type.6b5: type = pattern_type %tuple.type.516 [concrete] @@ -127,9 +148,6 @@ fn H() { // CHECK:STDOUT: %tuple.type.667: type = tuple_type (Core.IntLiteral, %tuple.type.189, Core.IntLiteral) [concrete] // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete] // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete] -// CHECK:STDOUT: %To: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic] -// CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To) [symbolic] -// CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic] // CHECK:STDOUT: %ImplicitAs.impl_witness.c75: = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete] // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete] // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete] @@ -142,11 +160,19 @@ fn H() { // CHECK:STDOUT: %Convert.bound.ef9: = bound_method %int_2.ecc, %Convert.956 [concrete] // CHECK:STDOUT: %bound_method.b92: = bound_method %int_2.ecc, %Convert.specific_fn [concrete] // CHECK:STDOUT: %int_2.ef8: %i32 = int_value 2 [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.78c: = impl_witness imports.%Destroy.impl_witness_table, @impl.49c(%tuple.type.516) [concrete] +// CHECK:STDOUT: %Op.type.701: type = fn_type @Op.3, @impl.49c(%tuple.type.516) [concrete] +// CHECK:STDOUT: %Op.dfb: %Op.type.701 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.d6c: %Destroy.type = facet_value %tuple.type.516, (%Destroy.impl_witness.78c) [concrete] +// CHECK:STDOUT: %.1fa: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.d6c [concrete] +// CHECK:STDOUT: %Op.specific_fn.922: = specific_function %Op.dfb, @Op.3(%tuple.type.516) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)] // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.49c.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.49c.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl.49c [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G() { @@ -157,15 +183,15 @@ fn H() { // CHECK:STDOUT: } // CHECK:STDOUT: %v.var: ref %tuple.type.99b = var %v.var_patt // CHECK:STDOUT: %F.ref.loc7_48: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] -// CHECK:STDOUT: %tuple.elem0: ref %tuple.type.189 = tuple_access %v.var, element0 -// CHECK:STDOUT: %F.call.loc7_50: init %tuple.type.189 = call %F.ref.loc7_48() to %tuple.elem0 +// CHECK:STDOUT: %tuple.elem0.loc7_56.1: ref %tuple.type.189 = tuple_access %v.var, element0 +// CHECK:STDOUT: %F.call.loc7_50: init %tuple.type.189 = call %F.ref.loc7_48() to %tuple.elem0.loc7_56.1 // CHECK:STDOUT: %F.ref.loc7_53: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] -// CHECK:STDOUT: %tuple.elem1: ref %tuple.type.189 = tuple_access %v.var, element1 -// CHECK:STDOUT: %F.call.loc7_55: init %tuple.type.189 = call %F.ref.loc7_53() to %tuple.elem1 +// CHECK:STDOUT: %tuple.elem1.loc7_56.1: ref %tuple.type.189 = tuple_access %v.var, element1 +// CHECK:STDOUT: %F.call.loc7_55: init %tuple.type.189 = call %F.ref.loc7_53() to %tuple.elem1.loc7_56.1 // CHECK:STDOUT: %.loc7_56.1: %tuple.type.99b = tuple_literal (%F.call.loc7_50, %F.call.loc7_55) // CHECK:STDOUT: %.loc7_56.2: init %tuple.type.99b = tuple_init (%F.call.loc7_50, %F.call.loc7_55) to %v.var -// CHECK:STDOUT: %.loc7_3: init %tuple.type.99b = converted %.loc7_56.1, %.loc7_56.2 -// CHECK:STDOUT: assign %v.var, %.loc7_3 +// CHECK:STDOUT: %.loc7_3.1: init %tuple.type.99b = converted %.loc7_56.1, %.loc7_56.2 +// CHECK:STDOUT: assign %v.var, %.loc7_3.1 // CHECK:STDOUT: %.loc7_43.1: type = splice_block %.loc7_43.5 [concrete = constants.%tuple.type.99b] { // CHECK:STDOUT: %int_32.loc7_12: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32.loc7_12: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] @@ -187,6 +213,57 @@ fn H() { // CHECK:STDOUT: %.loc7_43.5: type = converted %.loc7_43.2, constants.%tuple.type.99b [concrete = constants.%tuple.type.99b] // CHECK:STDOUT: } // CHECK:STDOUT: %v: ref %tuple.type.99b = bind_name v, %v.var +// CHECK:STDOUT: %impl.elem0.loc7_56.1: %.cce = impl_witness_access constants.%Destroy.impl_witness.c0f, element0 [concrete = constants.%Op.672] +// CHECK:STDOUT: %bound_method.loc7_56.1: = bound_method %tuple.elem1.loc7_56.1, %impl.elem0.loc7_56.1 +// CHECK:STDOUT: %specific_fn.loc7_56.1: = specific_function %impl.elem0.loc7_56.1, @Op.3(constants.%tuple.type.189) [concrete = constants.%Op.specific_fn.cf9] +// CHECK:STDOUT: %bound_method.loc7_56.2: = bound_method %tuple.elem1.loc7_56.1, %specific_fn.loc7_56.1 +// CHECK:STDOUT: %tuple.elem0.loc7_56.2: ref %i32 = tuple_access %tuple.elem1.loc7_56.1, element0 +// CHECK:STDOUT: %.loc7_56.3: %i32 = bind_value %tuple.elem0.loc7_56.2 +// CHECK:STDOUT: %tuple.elem1.loc7_56.2: ref %i32 = tuple_access %tuple.elem1.loc7_56.1, element1 +// CHECK:STDOUT: %.loc7_56.4: %i32 = bind_value %tuple.elem1.loc7_56.2 +// CHECK:STDOUT: %tuple.elem2.loc7_56.1: ref %i32 = tuple_access %tuple.elem1.loc7_56.1, element2 +// CHECK:STDOUT: %.loc7_56.5: %i32 = bind_value %tuple.elem2.loc7_56.1 +// CHECK:STDOUT: %tuple.loc7_56.1: %tuple.type.189 = tuple_value (%.loc7_56.3, %.loc7_56.4, %.loc7_56.5) +// CHECK:STDOUT: %.loc7_56.6: %tuple.type.189 = converted %tuple.elem1.loc7_56.1, %tuple.loc7_56.1 +// CHECK:STDOUT: %no_op.loc7_56.1: init %empty_tuple.type = call %bound_method.loc7_56.2(%.loc7_56.6) +// CHECK:STDOUT: %impl.elem0.loc7_56.2: %.cce = impl_witness_access constants.%Destroy.impl_witness.c0f, element0 [concrete = constants.%Op.672] +// CHECK:STDOUT: %bound_method.loc7_56.3: = bound_method %tuple.elem0.loc7_56.1, %impl.elem0.loc7_56.2 +// CHECK:STDOUT: %specific_fn.loc7_56.2: = specific_function %impl.elem0.loc7_56.2, @Op.3(constants.%tuple.type.189) [concrete = constants.%Op.specific_fn.cf9] +// CHECK:STDOUT: %bound_method.loc7_56.4: = bound_method %tuple.elem0.loc7_56.1, %specific_fn.loc7_56.2 +// CHECK:STDOUT: %tuple.elem0.loc7_56.3: ref %i32 = tuple_access %tuple.elem0.loc7_56.1, element0 +// CHECK:STDOUT: %.loc7_56.7: %i32 = bind_value %tuple.elem0.loc7_56.3 +// CHECK:STDOUT: %tuple.elem1.loc7_56.3: ref %i32 = tuple_access %tuple.elem0.loc7_56.1, element1 +// CHECK:STDOUT: %.loc7_56.8: %i32 = bind_value %tuple.elem1.loc7_56.3 +// CHECK:STDOUT: %tuple.elem2.loc7_56.2: ref %i32 = tuple_access %tuple.elem0.loc7_56.1, element2 +// CHECK:STDOUT: %.loc7_56.9: %i32 = bind_value %tuple.elem2.loc7_56.2 +// CHECK:STDOUT: %tuple.loc7_56.2: %tuple.type.189 = tuple_value (%.loc7_56.7, %.loc7_56.8, %.loc7_56.9) +// CHECK:STDOUT: %.loc7_56.10: %tuple.type.189 = converted %tuple.elem0.loc7_56.1, %tuple.loc7_56.2 +// CHECK:STDOUT: %no_op.loc7_56.2: init %empty_tuple.type = call %bound_method.loc7_56.4(%.loc7_56.10) +// CHECK:STDOUT: %impl.elem0.loc7_3: %.41d = impl_witness_access constants.%Destroy.impl_witness.2c6, element0 [concrete = constants.%Op.b09] +// CHECK:STDOUT: %bound_method.loc7_3.1: = bound_method %v.var, %impl.elem0.loc7_3 +// CHECK:STDOUT: %specific_fn.loc7_3: = specific_function %impl.elem0.loc7_3, @Op.3(constants.%tuple.type.99b) [concrete = constants.%Op.specific_fn.852] +// CHECK:STDOUT: %bound_method.loc7_3.2: = bound_method %v.var, %specific_fn.loc7_3 +// CHECK:STDOUT: %tuple.elem0.loc7_3.1: ref %tuple.type.189 = tuple_access %v.var, element0 +// CHECK:STDOUT: %tuple.elem0.loc7_3.2: ref %i32 = tuple_access %tuple.elem0.loc7_3.1, element0 +// CHECK:STDOUT: %.loc7_3.2: %i32 = bind_value %tuple.elem0.loc7_3.2 +// CHECK:STDOUT: %tuple.elem1.loc7_3.1: ref %i32 = tuple_access %tuple.elem0.loc7_3.1, element1 +// CHECK:STDOUT: %.loc7_3.3: %i32 = bind_value %tuple.elem1.loc7_3.1 +// CHECK:STDOUT: %tuple.elem2.loc7_3.1: ref %i32 = tuple_access %tuple.elem0.loc7_3.1, element2 +// CHECK:STDOUT: %.loc7_3.4: %i32 = bind_value %tuple.elem2.loc7_3.1 +// CHECK:STDOUT: %tuple.loc7_3.1: %tuple.type.189 = tuple_value (%.loc7_3.2, %.loc7_3.3, %.loc7_3.4) +// CHECK:STDOUT: %.loc7_3.5: %tuple.type.189 = converted %tuple.elem0.loc7_3.1, %tuple.loc7_3.1 +// CHECK:STDOUT: %tuple.elem1.loc7_3.2: ref %tuple.type.189 = tuple_access %v.var, element1 +// CHECK:STDOUT: %tuple.elem0.loc7_3.3: ref %i32 = tuple_access %tuple.elem1.loc7_3.2, element0 +// CHECK:STDOUT: %.loc7_3.6: %i32 = bind_value %tuple.elem0.loc7_3.3 +// CHECK:STDOUT: %tuple.elem1.loc7_3.3: ref %i32 = tuple_access %tuple.elem1.loc7_3.2, element1 +// CHECK:STDOUT: %.loc7_3.7: %i32 = bind_value %tuple.elem1.loc7_3.3 +// CHECK:STDOUT: %tuple.elem2.loc7_3.2: ref %i32 = tuple_access %tuple.elem1.loc7_3.2, element2 +// CHECK:STDOUT: %.loc7_3.8: %i32 = bind_value %tuple.elem2.loc7_3.2 +// CHECK:STDOUT: %tuple.loc7_3.2: %tuple.type.189 = tuple_value (%.loc7_3.6, %.loc7_3.7, %.loc7_3.8) +// CHECK:STDOUT: %.loc7_3.9: %tuple.type.189 = converted %tuple.elem1.loc7_3.2, %tuple.loc7_3.2 +// CHECK:STDOUT: %tuple.loc7_3.3: %tuple.type.99b = tuple_value (%.loc7_3.5, %.loc7_3.9) +// CHECK:STDOUT: %.loc7_3.10: %tuple.type.99b = converted %v.var, %tuple.loc7_3.3 +// CHECK:STDOUT: %no_op.loc7_3: init %empty_tuple.type = call %bound_method.loc7_3.2(%.loc7_3.10) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -199,8 +276,8 @@ fn H() { // CHECK:STDOUT: %v.var: ref %tuple.type.516 = var %v.var_patt // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] -// CHECK:STDOUT: %tuple.elem1: ref %tuple.type.189 = tuple_access %v.var, element1 -// CHECK:STDOUT: %F.call: init %tuple.type.189 = call %F.ref() to %tuple.elem1 +// CHECK:STDOUT: %tuple.elem1.loc13_50.1: ref %tuple.type.189 = tuple_access %v.var, element1 +// CHECK:STDOUT: %F.call: init %tuple.type.189 = call %F.ref() to %tuple.elem1.loc13_50.1 // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] // CHECK:STDOUT: %.loc13_50.1: %tuple.type.667 = tuple_literal (%int_1, %F.call, %int_2) // CHECK:STDOUT: %impl.elem0.loc13_50.1: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] @@ -209,19 +286,19 @@ fn H() { // CHECK:STDOUT: %bound_method.loc13_50.2: = bound_method %int_1, %specific_fn.loc13_50.1 [concrete = constants.%bound_method.9a1] // CHECK:STDOUT: %int.convert_checked.loc13_50.1: init %i32 = call %bound_method.loc13_50.2(%int_1) [concrete = constants.%int_1.5d2] // CHECK:STDOUT: %.loc13_50.2: init %i32 = converted %int_1, %int.convert_checked.loc13_50.1 [concrete = constants.%int_1.5d2] -// CHECK:STDOUT: %tuple.elem0: ref %i32 = tuple_access %v.var, element0 -// CHECK:STDOUT: %.loc13_50.3: init %i32 = initialize_from %.loc13_50.2 to %tuple.elem0 [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %tuple.elem0.loc13_50.1: ref %i32 = tuple_access %v.var, element0 +// CHECK:STDOUT: %.loc13_50.3: init %i32 = initialize_from %.loc13_50.2 to %tuple.elem0.loc13_50.1 [concrete = constants.%int_1.5d2] // CHECK:STDOUT: %impl.elem0.loc13_50.2: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] // CHECK:STDOUT: %bound_method.loc13_50.3: = bound_method %int_2, %impl.elem0.loc13_50.2 [concrete = constants.%Convert.bound.ef9] // CHECK:STDOUT: %specific_fn.loc13_50.2: = specific_function %impl.elem0.loc13_50.2, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] // CHECK:STDOUT: %bound_method.loc13_50.4: = bound_method %int_2, %specific_fn.loc13_50.2 [concrete = constants.%bound_method.b92] // CHECK:STDOUT: %int.convert_checked.loc13_50.2: init %i32 = call %bound_method.loc13_50.4(%int_2) [concrete = constants.%int_2.ef8] // CHECK:STDOUT: %.loc13_50.4: init %i32 = converted %int_2, %int.convert_checked.loc13_50.2 [concrete = constants.%int_2.ef8] -// CHECK:STDOUT: %tuple.elem2: ref %i32 = tuple_access %v.var, element2 -// CHECK:STDOUT: %.loc13_50.5: init %i32 = initialize_from %.loc13_50.4 to %tuple.elem2 [concrete = constants.%int_2.ef8] +// CHECK:STDOUT: %tuple.elem2.loc13_50.1: ref %i32 = tuple_access %v.var, element2 +// CHECK:STDOUT: %.loc13_50.5: init %i32 = initialize_from %.loc13_50.4 to %tuple.elem2.loc13_50.1 [concrete = constants.%int_2.ef8] // CHECK:STDOUT: %.loc13_50.6: init %tuple.type.516 = tuple_init (%.loc13_50.3, %F.call, %.loc13_50.5) to %v.var -// CHECK:STDOUT: %.loc13_3: init %tuple.type.516 = converted %.loc13_50.1, %.loc13_50.6 -// CHECK:STDOUT: assign %v.var, %.loc13_3 +// CHECK:STDOUT: %.loc13_3.1: init %tuple.type.516 = converted %.loc13_50.1, %.loc13_50.6 +// CHECK:STDOUT: assign %v.var, %.loc13_3.1 // CHECK:STDOUT: %.loc13_36.1: type = splice_block %.loc13_36.4 [concrete = constants.%tuple.type.516] { // CHECK:STDOUT: %int_32.loc13_11: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32.loc13_11: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] @@ -239,6 +316,39 @@ fn H() { // CHECK:STDOUT: %.loc13_36.4: type = converted %.loc13_36.2, constants.%tuple.type.516 [concrete = constants.%tuple.type.516] // CHECK:STDOUT: } // CHECK:STDOUT: %v: ref %tuple.type.516 = bind_name v, %v.var +// CHECK:STDOUT: %impl.elem0.loc13_50.3: %.cce = impl_witness_access constants.%Destroy.impl_witness.c0f, element0 [concrete = constants.%Op.672] +// CHECK:STDOUT: %bound_method.loc13_50.5: = bound_method %tuple.elem1.loc13_50.1, %impl.elem0.loc13_50.3 +// CHECK:STDOUT: %specific_fn.loc13_50.3: = specific_function %impl.elem0.loc13_50.3, @Op.3(constants.%tuple.type.189) [concrete = constants.%Op.specific_fn.cf9] +// CHECK:STDOUT: %bound_method.loc13_50.6: = bound_method %tuple.elem1.loc13_50.1, %specific_fn.loc13_50.3 +// CHECK:STDOUT: %tuple.elem0.loc13_50.2: ref %i32 = tuple_access %tuple.elem1.loc13_50.1, element0 +// CHECK:STDOUT: %.loc13_50.7: %i32 = bind_value %tuple.elem0.loc13_50.2 +// CHECK:STDOUT: %tuple.elem1.loc13_50.2: ref %i32 = tuple_access %tuple.elem1.loc13_50.1, element1 +// CHECK:STDOUT: %.loc13_50.8: %i32 = bind_value %tuple.elem1.loc13_50.2 +// CHECK:STDOUT: %tuple.elem2.loc13_50.2: ref %i32 = tuple_access %tuple.elem1.loc13_50.1, element2 +// CHECK:STDOUT: %.loc13_50.9: %i32 = bind_value %tuple.elem2.loc13_50.2 +// CHECK:STDOUT: %tuple.loc13_50: %tuple.type.189 = tuple_value (%.loc13_50.7, %.loc13_50.8, %.loc13_50.9) +// CHECK:STDOUT: %.loc13_50.10: %tuple.type.189 = converted %tuple.elem1.loc13_50.1, %tuple.loc13_50 +// CHECK:STDOUT: %no_op.loc13_50: init %empty_tuple.type = call %bound_method.loc13_50.6(%.loc13_50.10) +// CHECK:STDOUT: %impl.elem0.loc13_3: %.1fa = impl_witness_access constants.%Destroy.impl_witness.78c, element0 [concrete = constants.%Op.dfb] +// CHECK:STDOUT: %bound_method.loc13_3.1: = bound_method %v.var, %impl.elem0.loc13_3 +// CHECK:STDOUT: %specific_fn.loc13_3: = specific_function %impl.elem0.loc13_3, @Op.3(constants.%tuple.type.516) [concrete = constants.%Op.specific_fn.922] +// CHECK:STDOUT: %bound_method.loc13_3.2: = bound_method %v.var, %specific_fn.loc13_3 +// CHECK:STDOUT: %tuple.elem0.loc13_3.1: ref %i32 = tuple_access %v.var, element0 +// CHECK:STDOUT: %.loc13_3.2: %i32 = bind_value %tuple.elem0.loc13_3.1 +// CHECK:STDOUT: %tuple.elem1.loc13_3.1: ref %tuple.type.189 = tuple_access %v.var, element1 +// CHECK:STDOUT: %tuple.elem0.loc13_3.2: ref %i32 = tuple_access %tuple.elem1.loc13_3.1, element0 +// CHECK:STDOUT: %.loc13_3.3: %i32 = bind_value %tuple.elem0.loc13_3.2 +// CHECK:STDOUT: %tuple.elem1.loc13_3.2: ref %i32 = tuple_access %tuple.elem1.loc13_3.1, element1 +// CHECK:STDOUT: %.loc13_3.4: %i32 = bind_value %tuple.elem1.loc13_3.2 +// CHECK:STDOUT: %tuple.elem2.loc13_3.1: ref %i32 = tuple_access %tuple.elem1.loc13_3.1, element2 +// CHECK:STDOUT: %.loc13_3.5: %i32 = bind_value %tuple.elem2.loc13_3.1 +// CHECK:STDOUT: %tuple.loc13_3.1: %tuple.type.189 = tuple_value (%.loc13_3.3, %.loc13_3.4, %.loc13_3.5) +// CHECK:STDOUT: %.loc13_3.6: %tuple.type.189 = converted %tuple.elem1.loc13_3.1, %tuple.loc13_3.1 +// CHECK:STDOUT: %tuple.elem2.loc13_3.2: ref %i32 = tuple_access %v.var, element2 +// CHECK:STDOUT: %.loc13_3.7: %i32 = bind_value %tuple.elem2.loc13_3.2 +// CHECK:STDOUT: %tuple.loc13_3.2: %tuple.type.516 = tuple_value (%.loc13_3.2, %.loc13_3.6, %.loc13_3.7) +// CHECK:STDOUT: %.loc13_3.8: %tuple.type.516 = converted %v.var, %tuple.loc13_3.2 +// CHECK:STDOUT: %no_op.loc13_3: init %empty_tuple.type = call %bound_method.loc13_3.2(%.loc13_3.8) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/tuple/tuple_pattern.carbon b/toolchain/check/testdata/tuple/tuple_pattern.carbon index 26ff91067415..d93063686470 100644 --- a/toolchain/check/testdata/tuple/tuple_pattern.carbon +++ b/toolchain/check/testdata/tuple/tuple_pattern.carbon @@ -122,15 +122,29 @@ let (a: {}, b: {}) = ({}, {}, {}); // CHECK:STDOUT: --- basic.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %pattern_type.a96: type = pattern_type %empty_struct_type [concrete] // CHECK:STDOUT: %tuple.type.b6b: type = tuple_type (%empty_struct_type, %empty_struct_type) [concrete] // CHECK:STDOUT: %pattern_type.de4: type = pattern_type %tuple.type.b6b [concrete] // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete] // CHECK:STDOUT: %tuple: %tuple.type.b6b = tuple_value (%empty_struct, %empty_struct) [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.9c2: = impl_witness imports.%Destroy.impl_witness_table, @impl(%tuple.type.b6b) [concrete] +// CHECK:STDOUT: %Op.type.72a: type = fn_type @Op.2, @impl(%tuple.type.b6b) [concrete] +// CHECK:STDOUT: %Op.973: %Op.type.72a = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %tuple.type.b6b, (%Destroy.impl_witness.9c2) [concrete] +// CHECK:STDOUT: %.8ce: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.973, @Op.2(%tuple.type.b6b) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { @@ -164,18 +178,18 @@ let (a: {}, b: {}) = ({}, {}, {}); // CHECK:STDOUT: %.var_patt.loc7: %pattern_type.de4 = var_pattern %.loc7_20 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %.var.loc7: ref %tuple.type.b6b = var %.var_patt.loc7 -// CHECK:STDOUT: %tuple.elem0.loc7: ref %empty_struct_type = tuple_access %.var.loc7, element0 -// CHECK:STDOUT: %tuple.elem1.loc7: ref %empty_struct_type = tuple_access %.var.loc7, element1 +// CHECK:STDOUT: %tuple.elem0.loc7_3.1: ref %empty_struct_type = tuple_access %.var.loc7, element0 +// CHECK:STDOUT: %tuple.elem1.loc7_3.1: ref %empty_struct_type = tuple_access %.var.loc7, element1 // CHECK:STDOUT: %.loc7_12.1: type = splice_block %.loc7_12.3 [concrete = constants.%empty_struct_type] { // CHECK:STDOUT: %.loc7_12.2: %empty_struct_type = struct_literal () // CHECK:STDOUT: %.loc7_12.3: type = converted %.loc7_12.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: } -// CHECK:STDOUT: %a: ref %empty_struct_type = bind_name a, %tuple.elem0.loc7 +// CHECK:STDOUT: %a: ref %empty_struct_type = bind_name a, %tuple.elem0.loc7_3.1 // CHECK:STDOUT: %.loc7_19.1: type = splice_block %.loc7_19.3 [concrete = constants.%empty_struct_type] { // CHECK:STDOUT: %.loc7_19.2: %empty_struct_type = struct_literal () // CHECK:STDOUT: %.loc7_19.3: type = converted %.loc7_19.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: } -// CHECK:STDOUT: %b: ref %empty_struct_type = bind_name b, %tuple.elem1.loc7 +// CHECK:STDOUT: %b: ref %empty_struct_type = bind_name b, %tuple.elem1.loc7_3.1 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %c.patt: %pattern_type.a96 = binding_pattern c [concrete] // CHECK:STDOUT: %d.patt: %pattern_type.a96 = binding_pattern d [concrete] @@ -193,37 +207,77 @@ let (a: {}, b: {}) = ({}, {}, {}); // CHECK:STDOUT: %.loc8_30.2: init %empty_struct_type = struct_init () to %tuple.elem1.loc8_31 [concrete = constants.%empty_struct] // CHECK:STDOUT: %.loc8_31.3: init %empty_struct_type = converted %.loc8_30.1, %.loc8_30.2 [concrete = constants.%empty_struct] // CHECK:STDOUT: %.loc8_31.4: init %tuple.type.b6b = tuple_init (%.loc8_31.2, %.loc8_31.3) to %.var.loc8 [concrete = constants.%tuple] -// CHECK:STDOUT: %.loc8_3: init %tuple.type.b6b = converted %.loc8_31.1, %.loc8_31.4 [concrete = constants.%tuple] -// CHECK:STDOUT: assign %.var.loc8, %.loc8_3 -// CHECK:STDOUT: %tuple.elem0.loc8_3: ref %empty_struct_type = tuple_access %.var.loc8, element0 -// CHECK:STDOUT: %tuple.elem1.loc8_3: ref %empty_struct_type = tuple_access %.var.loc8, element1 +// CHECK:STDOUT: %.loc8_3.1: init %tuple.type.b6b = converted %.loc8_31.1, %.loc8_31.4 [concrete = constants.%tuple] +// CHECK:STDOUT: assign %.var.loc8, %.loc8_3.1 +// CHECK:STDOUT: %tuple.elem0.loc8_3.1: ref %empty_struct_type = tuple_access %.var.loc8, element0 +// CHECK:STDOUT: %tuple.elem1.loc8_3.1: ref %empty_struct_type = tuple_access %.var.loc8, element1 // CHECK:STDOUT: %.loc8_12.1: type = splice_block %.loc8_12.3 [concrete = constants.%empty_struct_type] { // CHECK:STDOUT: %.loc8_12.2: %empty_struct_type = struct_literal () // CHECK:STDOUT: %.loc8_12.3: type = converted %.loc8_12.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: } -// CHECK:STDOUT: %c: ref %empty_struct_type = bind_name c, %tuple.elem0.loc8_3 +// CHECK:STDOUT: %c: ref %empty_struct_type = bind_name c, %tuple.elem0.loc8_3.1 // CHECK:STDOUT: %.loc8_19.1: type = splice_block %.loc8_19.3 [concrete = constants.%empty_struct_type] { // CHECK:STDOUT: %.loc8_19.2: %empty_struct_type = struct_literal () // CHECK:STDOUT: %.loc8_19.3: type = converted %.loc8_19.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: } -// CHECK:STDOUT: %d: ref %empty_struct_type = bind_name d, %tuple.elem1.loc8_3 +// CHECK:STDOUT: %d: ref %empty_struct_type = bind_name d, %tuple.elem1.loc8_3.1 +// CHECK:STDOUT: %impl.elem0.loc8: %.8ce = impl_witness_access constants.%Destroy.impl_witness.9c2, element0 [concrete = constants.%Op.973] +// CHECK:STDOUT: %bound_method.loc8_3.1: = bound_method %.var.loc8, %impl.elem0.loc8 +// CHECK:STDOUT: %specific_fn.loc8: = specific_function %impl.elem0.loc8, @Op.2(constants.%tuple.type.b6b) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc8_3.2: = bound_method %.var.loc8, %specific_fn.loc8 +// CHECK:STDOUT: %tuple.elem0.loc8_3.2: ref %empty_struct_type = tuple_access %.var.loc8, element0 +// CHECK:STDOUT: %empty_struct.loc8_3.1: %empty_struct_type = struct_value () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc8_3.2: %empty_struct_type = converted %tuple.elem0.loc8_3.2, %empty_struct.loc8_3.1 [concrete = constants.%empty_struct] +// CHECK:STDOUT: %tuple.elem1.loc8_3.2: ref %empty_struct_type = tuple_access %.var.loc8, element1 +// CHECK:STDOUT: %empty_struct.loc8_3.2: %empty_struct_type = struct_value () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc8_3.3: %empty_struct_type = converted %tuple.elem1.loc8_3.2, %empty_struct.loc8_3.2 [concrete = constants.%empty_struct] +// CHECK:STDOUT: %tuple.loc8: %tuple.type.b6b = tuple_value (%.loc8_3.2, %.loc8_3.3) [concrete = constants.%tuple] +// CHECK:STDOUT: %.loc8_3.4: %tuple.type.b6b = converted %.var.loc8, %tuple.loc8 [concrete = constants.%tuple] +// CHECK:STDOUT: %no_op.loc8: init %empty_tuple.type = call %bound_method.loc8_3.2(%.loc8_3.4) +// CHECK:STDOUT: %impl.elem0.loc7: %.8ce = impl_witness_access constants.%Destroy.impl_witness.9c2, element0 [concrete = constants.%Op.973] +// CHECK:STDOUT: %bound_method.loc7_3.1: = bound_method %.var.loc7, %impl.elem0.loc7 +// CHECK:STDOUT: %specific_fn.loc7: = specific_function %impl.elem0.loc7, @Op.2(constants.%tuple.type.b6b) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_3.2: = bound_method %.var.loc7, %specific_fn.loc7 +// CHECK:STDOUT: %tuple.elem0.loc7_3.2: ref %empty_struct_type = tuple_access %.var.loc7, element0 +// CHECK:STDOUT: %empty_struct.loc7_3.1: %empty_struct_type = struct_value () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc7_3.1: %empty_struct_type = converted %tuple.elem0.loc7_3.2, %empty_struct.loc7_3.1 [concrete = constants.%empty_struct] +// CHECK:STDOUT: %tuple.elem1.loc7_3.2: ref %empty_struct_type = tuple_access %.var.loc7, element1 +// CHECK:STDOUT: %empty_struct.loc7_3.2: %empty_struct_type = struct_value () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc7_3.2: %empty_struct_type = converted %tuple.elem1.loc7_3.2, %empty_struct.loc7_3.2 [concrete = constants.%empty_struct] +// CHECK:STDOUT: %tuple.loc7: %tuple.type.b6b = tuple_value (%.loc7_3.1, %.loc7_3.2) [concrete = constants.%tuple] +// CHECK:STDOUT: %.loc7_3.3: %tuple.type.b6b = converted %.var.loc7, %tuple.loc7 [concrete = constants.%tuple] +// CHECK:STDOUT: %no_op.loc7: init %empty_tuple.type = call %bound_method.loc7_3.2(%.loc7_3.3) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- variable.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %tuple.type.b6b: type = tuple_type (%empty_struct_type, %empty_struct_type) [concrete] // CHECK:STDOUT: %pattern_type.de4: type = pattern_type %tuple.type.b6b [concrete] // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete] // CHECK:STDOUT: %tuple: %tuple.type.b6b = tuple_value (%empty_struct, %empty_struct) [concrete] // CHECK:STDOUT: %pattern_type.a96: type = pattern_type %empty_struct_type [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.9c2: = impl_witness imports.%Destroy.impl_witness_table, @impl(%tuple.type.b6b) [concrete] +// CHECK:STDOUT: %Op.type.72a: type = fn_type @Op.2, @impl(%tuple.type.b6b) [concrete] +// CHECK:STDOUT: %Op.973: %Op.type.72a = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %tuple.type.b6b, (%Destroy.impl_witness.9c2) [concrete] +// CHECK:STDOUT: %.8ce: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.973, @Op.2(%tuple.type.b6b) [concrete] // CHECK:STDOUT: %MakeTuple.type: type = fn_type @MakeTuple [concrete] // CHECK:STDOUT: %MakeTuple: %MakeTuple.type = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { @@ -236,15 +290,15 @@ let (a: {}, b: {}) = ({}, {}, {}); // CHECK:STDOUT: %.loc6_27.1: %empty_struct_type = struct_literal () // CHECK:STDOUT: %.loc6_31.1: %empty_struct_type = struct_literal () // CHECK:STDOUT: %.loc6_32.1: %tuple.type.b6b = tuple_literal (%.loc6_27.1, %.loc6_31.1) -// CHECK:STDOUT: %tuple.elem0.loc6: ref %empty_struct_type = tuple_access %tuple.var, element0 -// CHECK:STDOUT: %.loc6_27.2: init %empty_struct_type = struct_init () to %tuple.elem0.loc6 [concrete = constants.%empty_struct] +// CHECK:STDOUT: %tuple.elem0.loc6_32: ref %empty_struct_type = tuple_access %tuple.var, element0 +// CHECK:STDOUT: %.loc6_27.2: init %empty_struct_type = struct_init () to %tuple.elem0.loc6_32 [concrete = constants.%empty_struct] // CHECK:STDOUT: %.loc6_32.2: init %empty_struct_type = converted %.loc6_27.1, %.loc6_27.2 [concrete = constants.%empty_struct] -// CHECK:STDOUT: %tuple.elem1.loc6: ref %empty_struct_type = tuple_access %tuple.var, element1 -// CHECK:STDOUT: %.loc6_31.2: init %empty_struct_type = struct_init () to %tuple.elem1.loc6 [concrete = constants.%empty_struct] +// CHECK:STDOUT: %tuple.elem1.loc6_32: ref %empty_struct_type = tuple_access %tuple.var, element1 +// CHECK:STDOUT: %.loc6_31.2: init %empty_struct_type = struct_init () to %tuple.elem1.loc6_32 [concrete = constants.%empty_struct] // CHECK:STDOUT: %.loc6_32.3: init %empty_struct_type = converted %.loc6_31.1, %.loc6_31.2 [concrete = constants.%empty_struct] // CHECK:STDOUT: %.loc6_32.4: init %tuple.type.b6b = tuple_init (%.loc6_32.2, %.loc6_32.3) to %tuple.var [concrete = constants.%tuple] -// CHECK:STDOUT: %.loc6_3: init %tuple.type.b6b = converted %.loc6_32.1, %.loc6_32.4 [concrete = constants.%tuple] -// CHECK:STDOUT: assign %tuple.var, %.loc6_3 +// CHECK:STDOUT: %.loc6_3.1: init %tuple.type.b6b = converted %.loc6_32.1, %.loc6_32.4 [concrete = constants.%tuple] +// CHECK:STDOUT: assign %tuple.var, %.loc6_3.1 // CHECK:STDOUT: %.loc6_21.1: type = splice_block %.loc6_21.5 [concrete = constants.%tuple.type.b6b] { // CHECK:STDOUT: %.loc6_16: %empty_struct_type = struct_literal () // CHECK:STDOUT: %.loc6_20: %empty_struct_type = struct_literal () @@ -253,7 +307,7 @@ let (a: {}, b: {}) = ({}, {}, {}); // CHECK:STDOUT: %.loc6_21.4: type = converted %.loc6_20, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: %.loc6_21.5: type = converted %.loc6_21.2, constants.%tuple.type.b6b [concrete = constants.%tuple.type.b6b] // CHECK:STDOUT: } -// CHECK:STDOUT: %tuple: ref %tuple.type.b6b = bind_name tuple, %tuple.var +// CHECK:STDOUT: %tuple.loc6_7: ref %tuple.type.b6b = bind_name tuple, %tuple.var // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %x.patt: %pattern_type.a96 = binding_pattern x [concrete] // CHECK:STDOUT: %y.patt: %pattern_type.a96 = binding_pattern y [concrete] @@ -261,7 +315,7 @@ let (a: {}, b: {}) = ({}, {}, {}); // CHECK:STDOUT: %.var_patt: %pattern_type.de4 = var_pattern %.loc7_20 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %.var: ref %tuple.type.b6b = var %.var_patt -// CHECK:STDOUT: %tuple.ref: ref %tuple.type.b6b = name_ref tuple, %tuple +// CHECK:STDOUT: %tuple.ref: ref %tuple.type.b6b = name_ref tuple, %tuple.loc6_7 // CHECK:STDOUT: %tuple.elem0.loc7_24.1: ref %empty_struct_type = tuple_access %tuple.ref, element0 // CHECK:STDOUT: %tuple.elem0.loc7_24.2: ref %empty_struct_type = tuple_access %.var, element0 // CHECK:STDOUT: %.loc7_24.1: init %empty_struct_type = struct_init () to %tuple.elem0.loc7_24.2 [concrete = constants.%empty_struct] @@ -271,20 +325,46 @@ let (a: {}, b: {}) = ({}, {}, {}); // CHECK:STDOUT: %.loc7_24.3: init %empty_struct_type = struct_init () to %tuple.elem1.loc7_24.2 [concrete = constants.%empty_struct] // CHECK:STDOUT: %.loc7_24.4: init %empty_struct_type = converted %tuple.elem1.loc7_24.1, %.loc7_24.3 [concrete = constants.%empty_struct] // CHECK:STDOUT: %.loc7_24.5: init %tuple.type.b6b = tuple_init (%.loc7_24.2, %.loc7_24.4) to %.var [concrete = constants.%tuple] -// CHECK:STDOUT: %.loc7_3: init %tuple.type.b6b = converted %tuple.ref, %.loc7_24.5 [concrete = constants.%tuple] -// CHECK:STDOUT: assign %.var, %.loc7_3 -// CHECK:STDOUT: %tuple.elem0.loc7_3: ref %empty_struct_type = tuple_access %.var, element0 -// CHECK:STDOUT: %tuple.elem1.loc7_3: ref %empty_struct_type = tuple_access %.var, element1 +// CHECK:STDOUT: %.loc7_3.1: init %tuple.type.b6b = converted %tuple.ref, %.loc7_24.5 [concrete = constants.%tuple] +// CHECK:STDOUT: assign %.var, %.loc7_3.1 +// CHECK:STDOUT: %tuple.elem0.loc7_3.1: ref %empty_struct_type = tuple_access %.var, element0 +// CHECK:STDOUT: %tuple.elem1.loc7_3.1: ref %empty_struct_type = tuple_access %.var, element1 // CHECK:STDOUT: %.loc7_12.1: type = splice_block %.loc7_12.3 [concrete = constants.%empty_struct_type] { // CHECK:STDOUT: %.loc7_12.2: %empty_struct_type = struct_literal () // CHECK:STDOUT: %.loc7_12.3: type = converted %.loc7_12.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: } -// CHECK:STDOUT: %x: ref %empty_struct_type = bind_name x, %tuple.elem0.loc7_3 +// CHECK:STDOUT: %x: ref %empty_struct_type = bind_name x, %tuple.elem0.loc7_3.1 // CHECK:STDOUT: %.loc7_19.1: type = splice_block %.loc7_19.3 [concrete = constants.%empty_struct_type] { // CHECK:STDOUT: %.loc7_19.2: %empty_struct_type = struct_literal () // CHECK:STDOUT: %.loc7_19.3: type = converted %.loc7_19.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: } -// CHECK:STDOUT: %y: ref %empty_struct_type = bind_name y, %tuple.elem1.loc7_3 +// CHECK:STDOUT: %y: ref %empty_struct_type = bind_name y, %tuple.elem1.loc7_3.1 +// CHECK:STDOUT: %impl.elem0.loc7: %.8ce = impl_witness_access constants.%Destroy.impl_witness.9c2, element0 [concrete = constants.%Op.973] +// CHECK:STDOUT: %bound_method.loc7_3.1: = bound_method %.var, %impl.elem0.loc7 +// CHECK:STDOUT: %specific_fn.loc7: = specific_function %impl.elem0.loc7, @Op.2(constants.%tuple.type.b6b) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_3.2: = bound_method %.var, %specific_fn.loc7 +// CHECK:STDOUT: %tuple.elem0.loc7_3.2: ref %empty_struct_type = tuple_access %.var, element0 +// CHECK:STDOUT: %empty_struct.loc7_3.1: %empty_struct_type = struct_value () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc7_3.2: %empty_struct_type = converted %tuple.elem0.loc7_3.2, %empty_struct.loc7_3.1 [concrete = constants.%empty_struct] +// CHECK:STDOUT: %tuple.elem1.loc7_3.2: ref %empty_struct_type = tuple_access %.var, element1 +// CHECK:STDOUT: %empty_struct.loc7_3.2: %empty_struct_type = struct_value () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc7_3.3: %empty_struct_type = converted %tuple.elem1.loc7_3.2, %empty_struct.loc7_3.2 [concrete = constants.%empty_struct] +// CHECK:STDOUT: %tuple.loc7: %tuple.type.b6b = tuple_value (%.loc7_3.2, %.loc7_3.3) [concrete = constants.%tuple] +// CHECK:STDOUT: %.loc7_3.4: %tuple.type.b6b = converted %.var, %tuple.loc7 [concrete = constants.%tuple] +// CHECK:STDOUT: %no_op.loc7: init %empty_tuple.type = call %bound_method.loc7_3.2(%.loc7_3.4) +// CHECK:STDOUT: %impl.elem0.loc6: %.8ce = impl_witness_access constants.%Destroy.impl_witness.9c2, element0 [concrete = constants.%Op.973] +// CHECK:STDOUT: %bound_method.loc6_3.1: = bound_method %tuple.var, %impl.elem0.loc6 +// CHECK:STDOUT: %specific_fn.loc6: = specific_function %impl.elem0.loc6, @Op.2(constants.%tuple.type.b6b) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc6_3.2: = bound_method %tuple.var, %specific_fn.loc6 +// CHECK:STDOUT: %tuple.elem0.loc6_3: ref %empty_struct_type = tuple_access %tuple.var, element0 +// CHECK:STDOUT: %empty_struct.loc6_3.1: %empty_struct_type = struct_value () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc6_3.2: %empty_struct_type = converted %tuple.elem0.loc6_3, %empty_struct.loc6_3.1 [concrete = constants.%empty_struct] +// CHECK:STDOUT: %tuple.elem1.loc6_3: ref %empty_struct_type = tuple_access %tuple.var, element1 +// CHECK:STDOUT: %empty_struct.loc6_3.2: %empty_struct_type = struct_value () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc6_3.3: %empty_struct_type = converted %tuple.elem1.loc6_3, %empty_struct.loc6_3.2 [concrete = constants.%empty_struct] +// CHECK:STDOUT: %tuple.loc6_3: %tuple.type.b6b = tuple_value (%.loc6_3.2, %.loc6_3.3) [concrete = constants.%tuple] +// CHECK:STDOUT: %.loc6_3.4: %tuple.type.b6b = converted %tuple.var, %tuple.loc6_3 [concrete = constants.%tuple] +// CHECK:STDOUT: %no_op.loc6: init %empty_tuple.type = call %bound_method.loc6_3.2(%.loc6_3.4) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -328,20 +408,33 @@ let (a: {}, b: {}) = ({}, {}, {}); // CHECK:STDOUT: %.loc14_24.3: init %empty_struct_type = struct_init () to %tuple.elem1.loc14_24.2 [concrete = constants.%empty_struct] // CHECK:STDOUT: %.loc14_24.4: init %empty_struct_type = converted %tuple.elem1.loc14_24.1, %.loc14_24.3 [concrete = constants.%empty_struct] // CHECK:STDOUT: %.loc14_24.5: init %tuple.type.b6b = tuple_init (%.loc14_24.2, %.loc14_24.4) to %.var [concrete = constants.%tuple] -// CHECK:STDOUT: %.loc14_3: init %tuple.type.b6b = converted %tuple.ref, %.loc14_24.5 [concrete = constants.%tuple] -// CHECK:STDOUT: assign %.var, %.loc14_3 -// CHECK:STDOUT: %tuple.elem0.loc14_3: ref %empty_struct_type = tuple_access %.var, element0 -// CHECK:STDOUT: %tuple.elem1.loc14_3: ref %empty_struct_type = tuple_access %.var, element1 +// CHECK:STDOUT: %.loc14_3.1: init %tuple.type.b6b = converted %tuple.ref, %.loc14_24.5 [concrete = constants.%tuple] +// CHECK:STDOUT: assign %.var, %.loc14_3.1 +// CHECK:STDOUT: %tuple.elem0.loc14_3.1: ref %empty_struct_type = tuple_access %.var, element0 +// CHECK:STDOUT: %tuple.elem1.loc14_3.1: ref %empty_struct_type = tuple_access %.var, element1 // CHECK:STDOUT: %.loc14_12.1: type = splice_block %.loc14_12.3 [concrete = constants.%empty_struct_type] { // CHECK:STDOUT: %.loc14_12.2: %empty_struct_type = struct_literal () // CHECK:STDOUT: %.loc14_12.3: type = converted %.loc14_12.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: } -// CHECK:STDOUT: %x: ref %empty_struct_type = bind_name x, %tuple.elem0.loc14_3 +// CHECK:STDOUT: %x: ref %empty_struct_type = bind_name x, %tuple.elem0.loc14_3.1 // CHECK:STDOUT: %.loc14_19.1: type = splice_block %.loc14_19.3 [concrete = constants.%empty_struct_type] { // CHECK:STDOUT: %.loc14_19.2: %empty_struct_type = struct_literal () // CHECK:STDOUT: %.loc14_19.3: type = converted %.loc14_19.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: } -// CHECK:STDOUT: %y: ref %empty_struct_type = bind_name y, %tuple.elem1.loc14_3 +// CHECK:STDOUT: %y: ref %empty_struct_type = bind_name y, %tuple.elem1.loc14_3.1 +// CHECK:STDOUT: %impl.elem0: %.8ce = impl_witness_access constants.%Destroy.impl_witness.9c2, element0 [concrete = constants.%Op.973] +// CHECK:STDOUT: %bound_method.loc14_3.1: = bound_method %.var, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%tuple.type.b6b) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc14_3.2: = bound_method %.var, %specific_fn +// CHECK:STDOUT: %tuple.elem0.loc14_3.2: ref %empty_struct_type = tuple_access %.var, element0 +// CHECK:STDOUT: %empty_struct.loc14_3.1: %empty_struct_type = struct_value () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc14_3.2: %empty_struct_type = converted %tuple.elem0.loc14_3.2, %empty_struct.loc14_3.1 [concrete = constants.%empty_struct] +// CHECK:STDOUT: %tuple.elem1.loc14_3.2: ref %empty_struct_type = tuple_access %.var, element1 +// CHECK:STDOUT: %empty_struct.loc14_3.2: %empty_struct_type = struct_value () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc14_3.3: %empty_struct_type = converted %tuple.elem1.loc14_3.2, %empty_struct.loc14_3.2 [concrete = constants.%empty_struct] +// CHECK:STDOUT: %tuple.loc14: %tuple.type.b6b = tuple_value (%.loc14_3.2, %.loc14_3.3) [concrete = constants.%tuple] +// CHECK:STDOUT: %.loc14_3.4: %tuple.type.b6b = converted %.var, %tuple.loc14 [concrete = constants.%tuple] +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc14_3.2(%.loc14_3.4) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -355,21 +448,47 @@ let (a: {}, b: {}) = ({}, {}, {}); // CHECK:STDOUT: } // CHECK:STDOUT: %.var: ref %tuple.type.b6b = var %.var_patt // CHECK:STDOUT: %MakeTuple.ref: %MakeTuple.type = name_ref MakeTuple, file.%MakeTuple.decl [concrete = constants.%MakeTuple] -// CHECK:STDOUT: %.loc22_3: ref %tuple.type.b6b = splice_block %.var {} -// CHECK:STDOUT: %MakeTuple.call: init %tuple.type.b6b = call %MakeTuple.ref() to %.loc22_3 +// CHECK:STDOUT: %.loc22_3.1: ref %tuple.type.b6b = splice_block %.var {} +// CHECK:STDOUT: %MakeTuple.call: init %tuple.type.b6b = call %MakeTuple.ref() to %.loc22_3.1 // CHECK:STDOUT: assign %.var, %MakeTuple.call -// CHECK:STDOUT: %tuple.elem0: ref %empty_struct_type = tuple_access %.var, element0 -// CHECK:STDOUT: %tuple.elem1: ref %empty_struct_type = tuple_access %.var, element1 +// CHECK:STDOUT: %tuple.elem0.loc22_3.1: ref %empty_struct_type = tuple_access %.var, element0 +// CHECK:STDOUT: %tuple.elem1.loc22_3.1: ref %empty_struct_type = tuple_access %.var, element1 // CHECK:STDOUT: %.loc22_12.1: type = splice_block %.loc22_12.3 [concrete = constants.%empty_struct_type] { // CHECK:STDOUT: %.loc22_12.2: %empty_struct_type = struct_literal () // CHECK:STDOUT: %.loc22_12.3: type = converted %.loc22_12.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: } -// CHECK:STDOUT: %x: ref %empty_struct_type = bind_name x, %tuple.elem0 +// CHECK:STDOUT: %x: ref %empty_struct_type = bind_name x, %tuple.elem0.loc22_3.1 // CHECK:STDOUT: %.loc22_19.1: type = splice_block %.loc22_19.3 [concrete = constants.%empty_struct_type] { // CHECK:STDOUT: %.loc22_19.2: %empty_struct_type = struct_literal () // CHECK:STDOUT: %.loc22_19.3: type = converted %.loc22_19.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: } -// CHECK:STDOUT: %y: ref %empty_struct_type = bind_name y, %tuple.elem1 +// CHECK:STDOUT: %y: ref %empty_struct_type = bind_name y, %tuple.elem1.loc22_3.1 +// CHECK:STDOUT: %impl.elem0.loc22_3.1: %.8ce = impl_witness_access constants.%Destroy.impl_witness.9c2, element0 [concrete = constants.%Op.973] +// CHECK:STDOUT: %bound_method.loc22_3.1: = bound_method %.loc22_3.1, %impl.elem0.loc22_3.1 +// CHECK:STDOUT: %specific_fn.loc22_3.1: = specific_function %impl.elem0.loc22_3.1, @Op.2(constants.%tuple.type.b6b) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc22_3.2: = bound_method %.loc22_3.1, %specific_fn.loc22_3.1 +// CHECK:STDOUT: %tuple.elem0.loc22_3.2: ref %empty_struct_type = tuple_access %.loc22_3.1, element0 +// CHECK:STDOUT: %empty_struct.loc22_3.1: %empty_struct_type = struct_value () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc22_3.2: %empty_struct_type = converted %tuple.elem0.loc22_3.2, %empty_struct.loc22_3.1 [concrete = constants.%empty_struct] +// CHECK:STDOUT: %tuple.elem1.loc22_3.2: ref %empty_struct_type = tuple_access %.loc22_3.1, element1 +// CHECK:STDOUT: %empty_struct.loc22_3.2: %empty_struct_type = struct_value () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc22_3.3: %empty_struct_type = converted %tuple.elem1.loc22_3.2, %empty_struct.loc22_3.2 [concrete = constants.%empty_struct] +// CHECK:STDOUT: %tuple.loc22_3.1: %tuple.type.b6b = tuple_value (%.loc22_3.2, %.loc22_3.3) [concrete = constants.%tuple] +// CHECK:STDOUT: %.loc22_3.4: %tuple.type.b6b = converted %.loc22_3.1, %tuple.loc22_3.1 [concrete = constants.%tuple] +// CHECK:STDOUT: %no_op.loc22_3.1: init %empty_tuple.type = call %bound_method.loc22_3.2(%.loc22_3.4) +// CHECK:STDOUT: %impl.elem0.loc22_3.2: %.8ce = impl_witness_access constants.%Destroy.impl_witness.9c2, element0 [concrete = constants.%Op.973] +// CHECK:STDOUT: %bound_method.loc22_3.3: = bound_method %.var, %impl.elem0.loc22_3.2 +// CHECK:STDOUT: %specific_fn.loc22_3.2: = specific_function %impl.elem0.loc22_3.2, @Op.2(constants.%tuple.type.b6b) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc22_3.4: = bound_method %.var, %specific_fn.loc22_3.2 +// CHECK:STDOUT: %tuple.elem0.loc22_3.3: ref %empty_struct_type = tuple_access %.var, element0 +// CHECK:STDOUT: %empty_struct.loc22_3.3: %empty_struct_type = struct_value () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc22_3.5: %empty_struct_type = converted %tuple.elem0.loc22_3.3, %empty_struct.loc22_3.3 [concrete = constants.%empty_struct] +// CHECK:STDOUT: %tuple.elem1.loc22_3.3: ref %empty_struct_type = tuple_access %.var, element1 +// CHECK:STDOUT: %empty_struct.loc22_3.4: %empty_struct_type = struct_value () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc22_3.6: %empty_struct_type = converted %tuple.elem1.loc22_3.3, %empty_struct.loc22_3.4 [concrete = constants.%empty_struct] +// CHECK:STDOUT: %tuple.loc22_3.2: %tuple.type.b6b = tuple_value (%.loc22_3.5, %.loc22_3.6) [concrete = constants.%tuple] +// CHECK:STDOUT: %.loc22_3.7: %tuple.type.b6b = converted %.var, %tuple.loc22_3.2 [concrete = constants.%tuple] +// CHECK:STDOUT: %no_op.loc22_3.2: init %empty_tuple.type = call %bound_method.loc22_3.4(%.loc22_3.7) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/var/decl.carbon b/toolchain/check/testdata/var/decl.carbon index 61185211ef56..432121144cc2 100644 --- a/toolchain/check/testdata/var/decl.carbon +++ b/toolchain/check/testdata/var/decl.carbon @@ -24,13 +24,30 @@ fn Main() { // CHECK:STDOUT: %Main.type: type = fn_type @Main [concrete] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Main: %Main.type = struct_value () [concrete] -// CHECK:STDOUT: %pattern_type: type = pattern_type %empty_tuple.type [concrete] +// CHECK:STDOUT: %pattern_type.cb1: type = pattern_type %empty_tuple.type [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.1dc: = impl_witness imports.%Destroy.impl_witness_table, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.type.a63: type = fn_type @Op.2, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.ea3: %Op.type.a63 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %empty_tuple.type, (%Destroy.impl_witness.1dc) [concrete] +// CHECK:STDOUT: %.346: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.ea3, @Op.2(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -45,8 +62,8 @@ fn Main() { // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %x.patt: %pattern_type = binding_pattern x [concrete] -// CHECK:STDOUT: %x.var_patt: %pattern_type = var_pattern %x.patt [concrete] +// CHECK:STDOUT: %x.patt: %pattern_type.cb1 = binding_pattern x [concrete] +// CHECK:STDOUT: %x.var_patt: %pattern_type.cb1 = var_pattern %x.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %x.var: ref %empty_tuple.type = var %x.var_patt // CHECK:STDOUT: %.loc3_11.1: type = splice_block %.loc3_11.3 [concrete = constants.%empty_tuple.type] { @@ -54,6 +71,13 @@ fn Main() { // CHECK:STDOUT: %.loc3_11.3: type = converted %.loc3_11.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %x: ref %empty_tuple.type = bind_name x, %x.var +// CHECK:STDOUT: %impl.elem0: %.346 = impl_witness_access constants.%Destroy.impl_witness.1dc, element0 [concrete = constants.%Op.ea3] +// CHECK:STDOUT: %bound_method.loc3_3.1: = bound_method %x.var, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%empty_tuple.type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc3_3.2: = bound_method %x.var, %specific_fn +// CHECK:STDOUT: %tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc3_3: %empty_tuple.type = converted %x.var, %tuple [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc3_3.2(%.loc3_3) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/var/decl_with_init.carbon b/toolchain/check/testdata/var/decl_with_init.carbon index 3a517f527975..7e73d8bf6318 100644 --- a/toolchain/check/testdata/var/decl_with_init.carbon +++ b/toolchain/check/testdata/var/decl_with_init.carbon @@ -24,14 +24,30 @@ fn Main() { // CHECK:STDOUT: %Main.type: type = fn_type @Main [concrete] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Main: %Main.type = struct_value () [concrete] -// CHECK:STDOUT: %pattern_type: type = pattern_type %empty_tuple.type [concrete] +// CHECK:STDOUT: %pattern_type.cb1: type = pattern_type %empty_tuple.type [concrete] // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.1dc: = impl_witness imports.%Destroy.impl_witness_table, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.type.a63: type = fn_type @Op.2, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.ea3: %Op.type.a63 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %empty_tuple.type, (%Destroy.impl_witness.1dc) [concrete] +// CHECK:STDOUT: %.346: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.ea3, @Op.2(%empty_tuple.type) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -46,19 +62,26 @@ fn Main() { // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %x.patt: %pattern_type = binding_pattern x [concrete] -// CHECK:STDOUT: %x.var_patt: %pattern_type = var_pattern %x.patt [concrete] +// CHECK:STDOUT: %x.patt: %pattern_type.cb1 = binding_pattern x [concrete] +// CHECK:STDOUT: %x.var_patt: %pattern_type.cb1 = var_pattern %x.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %x.var: ref %empty_tuple.type = var %x.var_patt // CHECK:STDOUT: %.loc3_16.1: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc3_16.2: init %empty_tuple.type = tuple_init () to %x.var [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc3_3: init %empty_tuple.type = converted %.loc3_16.1, %.loc3_16.2 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: assign %x.var, %.loc3_3 +// CHECK:STDOUT: %.loc3_3.1: init %empty_tuple.type = converted %.loc3_16.1, %.loc3_16.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: assign %x.var, %.loc3_3.1 // CHECK:STDOUT: %.loc3_11.1: type = splice_block %.loc3_11.3 [concrete = constants.%empty_tuple.type] { // CHECK:STDOUT: %.loc3_11.2: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc3_11.3: type = converted %.loc3_11.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %x: ref %empty_tuple.type = bind_name x, %x.var +// CHECK:STDOUT: %impl.elem0: %.346 = impl_witness_access constants.%Destroy.impl_witness.1dc, element0 [concrete = constants.%Op.ea3] +// CHECK:STDOUT: %bound_method.loc3_3.1: = bound_method %x.var, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%empty_tuple.type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc3_3.2: = bound_method %x.var, %specific_fn +// CHECK:STDOUT: %tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc3_3.2: %empty_tuple.type = converted %x.var, %tuple [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc3_3.2(%.loc3_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/var/fail_duplicate_decl.carbon b/toolchain/check/testdata/var/fail_duplicate_decl.carbon index 1beb5f33e525..354605b426de 100644 --- a/toolchain/check/testdata/var/fail_duplicate_decl.carbon +++ b/toolchain/check/testdata/var/fail_duplicate_decl.carbon @@ -32,14 +32,30 @@ fn Main() { // CHECK:STDOUT: %Main.type: type = fn_type @Main [concrete] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Main: %Main.type = struct_value () [concrete] -// CHECK:STDOUT: %pattern_type: type = pattern_type %empty_tuple.type [concrete] +// CHECK:STDOUT: %pattern_type.cb1: type = pattern_type %empty_tuple.type [concrete] // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.1dc: = impl_witness imports.%Destroy.impl_witness_table, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.type.a63: type = fn_type @Op.2, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.ea3: %Op.type.a63 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %empty_tuple.type, (%Destroy.impl_witness.1dc) [concrete] +// CHECK:STDOUT: %.346: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.ea3, @Op.2(%empty_tuple.type) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -54,33 +70,47 @@ fn Main() { // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %x.patt.loc3: %pattern_type = binding_pattern x [concrete] -// CHECK:STDOUT: %x.var_patt.loc3: %pattern_type = var_pattern %x.patt.loc3 [concrete] +// CHECK:STDOUT: %x.patt.loc3: %pattern_type.cb1 = binding_pattern x [concrete] +// CHECK:STDOUT: %x.var_patt.loc3: %pattern_type.cb1 = var_pattern %x.patt.loc3 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %x.var.loc3: ref %empty_tuple.type = var %x.var_patt.loc3 // CHECK:STDOUT: %.loc3_16.1: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc3_16.2: init %empty_tuple.type = tuple_init () to %x.var.loc3 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc3_3: init %empty_tuple.type = converted %.loc3_16.1, %.loc3_16.2 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: assign %x.var.loc3, %.loc3_3 +// CHECK:STDOUT: %.loc3_3.1: init %empty_tuple.type = converted %.loc3_16.1, %.loc3_16.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: assign %x.var.loc3, %.loc3_3.1 // CHECK:STDOUT: %.loc3_11.1: type = splice_block %.loc3_11.3 [concrete = constants.%empty_tuple.type] { // CHECK:STDOUT: %.loc3_11.2: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc3_11.3: type = converted %.loc3_11.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %x.loc3: ref %empty_tuple.type = bind_name x, %x.var.loc3 // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %x.patt.loc11: %pattern_type = binding_pattern x [concrete] -// CHECK:STDOUT: %x.var_patt.loc11: %pattern_type = var_pattern %x.patt.loc11 [concrete] +// CHECK:STDOUT: %x.patt.loc11: %pattern_type.cb1 = binding_pattern x [concrete] +// CHECK:STDOUT: %x.var_patt.loc11: %pattern_type.cb1 = var_pattern %x.patt.loc11 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %x.var.loc11: ref %empty_tuple.type = var %x.var_patt.loc11 // CHECK:STDOUT: %.loc11_16.1: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc11_16.2: init %empty_tuple.type = tuple_init () to %x.var.loc11 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc11_3: init %empty_tuple.type = converted %.loc11_16.1, %.loc11_16.2 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: assign %x.var.loc11, %.loc11_3 +// CHECK:STDOUT: %.loc11_3.1: init %empty_tuple.type = converted %.loc11_16.1, %.loc11_16.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: assign %x.var.loc11, %.loc11_3.1 // CHECK:STDOUT: %.loc11_11.1: type = splice_block %.loc11_11.3 [concrete = constants.%empty_tuple.type] { // CHECK:STDOUT: %.loc11_11.2: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc11_11.3: type = converted %.loc11_11.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %x.loc11: ref %empty_tuple.type = bind_name x, %x.var.loc11 +// CHECK:STDOUT: %impl.elem0.loc11: %.346 = impl_witness_access constants.%Destroy.impl_witness.1dc, element0 [concrete = constants.%Op.ea3] +// CHECK:STDOUT: %bound_method.loc11_3.1: = bound_method %x.var.loc11, %impl.elem0.loc11 +// CHECK:STDOUT: %specific_fn.loc11: = specific_function %impl.elem0.loc11, @Op.2(constants.%empty_tuple.type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc11_3.2: = bound_method %x.var.loc11, %specific_fn.loc11 +// CHECK:STDOUT: %tuple.loc11: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc11_3.2: %empty_tuple.type = converted %x.var.loc11, %tuple.loc11 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %no_op.loc11: init %empty_tuple.type = call %bound_method.loc11_3.2(%.loc11_3.2) +// CHECK:STDOUT: %impl.elem0.loc3: %.346 = impl_witness_access constants.%Destroy.impl_witness.1dc, element0 [concrete = constants.%Op.ea3] +// CHECK:STDOUT: %bound_method.loc3_3.1: = bound_method %x.var.loc3, %impl.elem0.loc3 +// CHECK:STDOUT: %specific_fn.loc3: = specific_function %impl.elem0.loc3, @Op.2(constants.%empty_tuple.type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc3_3.2: = bound_method %x.var.loc3, %specific_fn.loc3 +// CHECK:STDOUT: %tuple.loc3: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc3_3.2: %empty_tuple.type = converted %x.var.loc3, %tuple.loc3 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %no_op.loc3: init %empty_tuple.type = call %bound_method.loc3_3.2(%.loc3_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/var/fail_init_with_self.carbon b/toolchain/check/testdata/var/fail_init_with_self.carbon index 48a9b1444540..1d50b2fe616e 100644 --- a/toolchain/check/testdata/var/fail_init_with_self.carbon +++ b/toolchain/check/testdata/var/fail_init_with_self.carbon @@ -28,13 +28,30 @@ fn Main() { // CHECK:STDOUT: %Main.type: type = fn_type @Main [concrete] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Main: %Main.type = struct_value () [concrete] -// CHECK:STDOUT: %pattern_type: type = pattern_type %empty_tuple.type [concrete] +// CHECK:STDOUT: %pattern_type.cb1: type = pattern_type %empty_tuple.type [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.1dc: = impl_witness imports.%Destroy.impl_witness_table, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.type.a63: type = fn_type @Op.2, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.ea3: %Op.type.a63 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %empty_tuple.type, (%Destroy.impl_witness.1dc) [concrete] +// CHECK:STDOUT: %.346: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.ea3, @Op.2(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -49,8 +66,8 @@ fn Main() { // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %x.patt: %pattern_type = binding_pattern x [concrete] -// CHECK:STDOUT: %x.var_patt: %pattern_type = var_pattern %x.patt [concrete] +// CHECK:STDOUT: %x.patt: %pattern_type.cb1 = binding_pattern x [concrete] +// CHECK:STDOUT: %x.var_patt: %pattern_type.cb1 = var_pattern %x.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %x.var: ref %empty_tuple.type = var %x.var_patt // CHECK:STDOUT: %x.ref: = name_ref x, [concrete = ] @@ -60,6 +77,13 @@ fn Main() { // CHECK:STDOUT: %.loc7_11.3: type = converted %.loc7_11.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %x: ref %empty_tuple.type = bind_name x, %x.var +// CHECK:STDOUT: %impl.elem0: %.346 = impl_witness_access constants.%Destroy.impl_witness.1dc, element0 [concrete = constants.%Op.ea3] +// CHECK:STDOUT: %bound_method.loc7_3.1: = bound_method %x.var, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%empty_tuple.type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_3.2: = bound_method %x.var, %specific_fn +// CHECK:STDOUT: %tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc7_3: %empty_tuple.type = converted %x.var, %tuple [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc7_3.2(%.loc7_3) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/var/fail_lookup_outside_scope.carbon b/toolchain/check/testdata/var/fail_lookup_outside_scope.carbon index 68976d272426..768a49167a79 100644 --- a/toolchain/check/testdata/var/fail_lookup_outside_scope.carbon +++ b/toolchain/check/testdata/var/fail_lookup_outside_scope.carbon @@ -30,13 +30,30 @@ var y: () = x; // CHECK:STDOUT: %Main.type: type = fn_type @Main [concrete] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Main: %Main.type = struct_value () [concrete] -// CHECK:STDOUT: %pattern_type: type = pattern_type %empty_tuple.type [concrete] +// CHECK:STDOUT: %pattern_type.cb1: type = pattern_type %empty_tuple.type [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.1dc: = impl_witness imports.%Destroy.impl_witness_table, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.type.a63: type = fn_type @Op.2, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.ea3: %Op.type.a63 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %empty_tuple.type, (%Destroy.impl_witness.1dc) [concrete] +// CHECK:STDOUT: %.346: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.ea3, @Op.2(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -49,8 +66,8 @@ var y: () = x; // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %Main.decl: %Main.type = fn_decl @Main [concrete = constants.%Main] {} {} // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %y.patt: %pattern_type = binding_pattern y [concrete] -// CHECK:STDOUT: %y.var_patt: %pattern_type = var_pattern %y.patt [concrete] +// CHECK:STDOUT: %y.patt: %pattern_type.cb1 = binding_pattern y [concrete] +// CHECK:STDOUT: %y.var_patt: %pattern_type.cb1 = var_pattern %y.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %y.var: ref %empty_tuple.type = var %y.var_patt [concrete] // CHECK:STDOUT: %.loc10_9.1: type = splice_block %.loc10_9.3 [concrete = constants.%empty_tuple.type] { @@ -63,8 +80,8 @@ var y: () = x; // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %x.patt: %pattern_type = binding_pattern x [concrete] -// CHECK:STDOUT: %x.var_patt: %pattern_type = var_pattern %x.patt [concrete] +// CHECK:STDOUT: %x.patt: %pattern_type.cb1 = binding_pattern x [concrete] +// CHECK:STDOUT: %x.var_patt: %pattern_type.cb1 = var_pattern %x.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %x.var: ref %empty_tuple.type = var %x.var_patt // CHECK:STDOUT: %.loc3_11.1: type = splice_block %.loc3_11.3 [concrete = constants.%empty_tuple.type] { @@ -72,6 +89,13 @@ var y: () = x; // CHECK:STDOUT: %.loc3_11.3: type = converted %.loc3_11.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %x: ref %empty_tuple.type = bind_name x, %x.var +// CHECK:STDOUT: %impl.elem0: %.346 = impl_witness_access constants.%Destroy.impl_witness.1dc, element0 [concrete = constants.%Op.ea3] +// CHECK:STDOUT: %bound_method.loc3_3.1: = bound_method %x.var, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%empty_tuple.type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc3_3.2: = bound_method %x.var, %specific_fn +// CHECK:STDOUT: %tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc3_3: %empty_tuple.type = converted %x.var, %tuple [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc3_3.2(%.loc3_3) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/var/fail_not_copyable.carbon b/toolchain/check/testdata/var/fail_not_copyable.carbon index e9dc42594c06..6cfec0cb5671 100644 --- a/toolchain/check/testdata/var/fail_not_copyable.carbon +++ b/toolchain/check/testdata/var/fail_not_copyable.carbon @@ -36,19 +36,41 @@ fn F(x: X) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %X: type = class_type @X [concrete] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] +// CHECK:STDOUT: %complete_type.357: = complete_type_witness %empty_struct_type [concrete] // CHECK:STDOUT: %pattern_type.019: type = pattern_type %X [concrete] // CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] // CHECK:STDOUT: %pattern_type.b05: type = pattern_type String [concrete] // CHECK:STDOUT: %str: String = string_literal "hello" [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.599: = impl_witness imports.%Destroy.impl_witness_table, @impl(%X) [concrete] +// CHECK:STDOUT: %Op.type.9e1: type = fn_type @Op.2, @impl(%X) [concrete] +// CHECK:STDOUT: %Op.33a: %Op.type.9e1 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.177: %Destroy.type = facet_value %X, (%Destroy.impl_witness.599) [concrete] +// CHECK:STDOUT: %.bfc: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.177 [concrete] +// CHECK:STDOUT: %Op.specific_fn.d1f: = specific_function %Op.33a, @Op.2(%X) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.35b: = impl_witness imports.%Destroy.impl_witness_table, @impl(String) [concrete] +// CHECK:STDOUT: %Op.type.051: type = fn_type @Op.2, @impl(String) [concrete] +// CHECK:STDOUT: %Op.5ef: %Op.type.051 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.71a: %Destroy.type = facet_value String, (%Destroy.impl_witness.35b) [concrete] +// CHECK:STDOUT: %.c94: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.71a [concrete] +// CHECK:STDOUT: %Op.specific_fn.93f: = specific_function %Op.5ef, @Op.2(String) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/destroy, loc15_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -71,7 +93,7 @@ fn F(x: X) { // CHECK:STDOUT: // CHECK:STDOUT: class @X { // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete = constants.%complete_type] +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete = constants.%complete_type.357] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -97,6 +119,18 @@ fn F(x: X) { // CHECK:STDOUT: assign %y.var, // CHECK:STDOUT: %X.ref.loc31: type = name_ref X, file.%X.decl [concrete = constants.%X] // CHECK:STDOUT: %y: ref %X = bind_name y, %y.var +// CHECK:STDOUT: %impl.elem0.loc31: %.bfc = impl_witness_access constants.%Destroy.impl_witness.599, element0 [concrete = constants.%Op.33a] +// CHECK:STDOUT: %bound_method.loc31_3.1: = bound_method %y.var, %impl.elem0.loc31 +// CHECK:STDOUT: %specific_fn.loc31: = specific_function %impl.elem0.loc31, @Op.2(constants.%X) [concrete = constants.%Op.specific_fn.d1f] +// CHECK:STDOUT: %bound_method.loc31_3.2: = bound_method %y.var, %specific_fn.loc31 +// CHECK:STDOUT: %.loc31: %X = bind_value %y.var +// CHECK:STDOUT: %no_op.loc31: init %empty_tuple.type = call %bound_method.loc31_3.2(%.loc31) +// CHECK:STDOUT: %impl.elem0.loc24: %.c94 = impl_witness_access constants.%Destroy.impl_witness.35b, element0 [concrete = constants.%Op.5ef] +// CHECK:STDOUT: %bound_method.loc24_3.1: = bound_method %s.var, %impl.elem0.loc24 +// CHECK:STDOUT: %specific_fn.loc24: = specific_function %impl.elem0.loc24, @Op.2(String) [concrete = constants.%Op.specific_fn.93f] +// CHECK:STDOUT: %bound_method.loc24_3.2: = bound_method %s.var, %specific_fn.loc24 +// CHECK:STDOUT: %.loc24: String = bind_value %s.var +// CHECK:STDOUT: %no_op.loc24: init %empty_tuple.type = call %bound_method.loc24_3.2(%.loc24) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/var/fail_storage_is_literal.carbon b/toolchain/check/testdata/var/fail_storage_is_literal.carbon index ddb68f601169..d7539d6cf8f8 100644 --- a/toolchain/check/testdata/var/fail_storage_is_literal.carbon +++ b/toolchain/check/testdata/var/fail_storage_is_literal.carbon @@ -31,15 +31,18 @@ fn Main() { // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete] // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete] // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -65,6 +68,7 @@ fn Main() { // CHECK:STDOUT: %.loc23: type = converted %int_1.loc23_10, [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %x: = bind_name x, [concrete = ] +// CHECK:STDOUT: %impl.elem0: = impl_witness_access , element0 [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/var/global_lookup_in_scope.carbon b/toolchain/check/testdata/var/global_lookup_in_scope.carbon index a285267f3fcb..09ab667dea6a 100644 --- a/toolchain/check/testdata/var/global_lookup_in_scope.carbon +++ b/toolchain/check/testdata/var/global_lookup_in_scope.carbon @@ -25,18 +25,34 @@ fn Main() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %struct_type.v: type = struct_type {.v: %empty_tuple.type} [concrete] -// CHECK:STDOUT: %pattern_type: type = pattern_type %struct_type.v [concrete] +// CHECK:STDOUT: %pattern_type.c4c: type = pattern_type %struct_type.v [concrete] // CHECK:STDOUT: %.01b: ref %empty_tuple.type = struct_access file.%x.var, element0 [concrete] // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] // CHECK:STDOUT: %struct: %struct_type.v = struct_value (%empty_tuple) [concrete] // CHECK:STDOUT: %Main.type: type = fn_type @Main [concrete] // CHECK:STDOUT: %Main: %Main.type = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.148: = impl_witness imports.%Destroy.impl_witness_table, @impl(%struct_type.v) [concrete] +// CHECK:STDOUT: %Op.type.7e5: type = fn_type @Op.2, @impl(%struct_type.v) [concrete] +// CHECK:STDOUT: %Op.477: %Op.type.7e5 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %struct_type.v, (%Destroy.impl_witness.148) [concrete] +// CHECK:STDOUT: %.d6c: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.477, @Op.2(%struct_type.v) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -47,8 +63,8 @@ fn Main() { // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %x.patt: %pattern_type = binding_pattern x [concrete] -// CHECK:STDOUT: %x.var_patt: %pattern_type = var_pattern %x.patt [concrete] +// CHECK:STDOUT: %x.patt: %pattern_type.c4c = binding_pattern x [concrete] +// CHECK:STDOUT: %x.var_patt: %pattern_type.c4c = var_pattern %x.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %x.var: ref %struct_type.v = var %x.var_patt [concrete] // CHECK:STDOUT: %.loc2_15: type = splice_block %struct_type.v [concrete = constants.%struct_type.v] { @@ -63,8 +79,8 @@ fn Main() { // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %y.patt: %pattern_type = binding_pattern y [concrete] -// CHECK:STDOUT: %y.var_patt: %pattern_type = var_pattern %y.patt [concrete] +// CHECK:STDOUT: %y.patt: %pattern_type.c4c = binding_pattern y [concrete] +// CHECK:STDOUT: %y.var_patt: %pattern_type.c4c = var_pattern %y.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %y.var: ref %struct_type.v = var %y.var_patt // CHECK:STDOUT: %x.ref: ref %struct_type.v = name_ref x, file.%x [concrete = file.%x.var] @@ -73,14 +89,24 @@ fn Main() { // CHECK:STDOUT: %.loc5_21.3: init %empty_tuple.type = tuple_init () to %.loc5_21.2 [concrete = constants.%empty_tuple] // CHECK:STDOUT: %.loc5_21.4: init %empty_tuple.type = converted %.loc5_21.1, %.loc5_21.3 [concrete = constants.%empty_tuple] // CHECK:STDOUT: %.loc5_21.5: init %struct_type.v = struct_init (%.loc5_21.4) to %y.var [concrete = constants.%struct] -// CHECK:STDOUT: %.loc5_3: init %struct_type.v = converted %x.ref, %.loc5_21.5 [concrete = constants.%struct] -// CHECK:STDOUT: assign %y.var, %.loc5_3 +// CHECK:STDOUT: %.loc5_3.1: init %struct_type.v = converted %x.ref, %.loc5_21.5 [concrete = constants.%struct] +// CHECK:STDOUT: assign %y.var, %.loc5_3.1 // CHECK:STDOUT: %.loc5_17: type = splice_block %struct_type.v [concrete = constants.%struct_type.v] { // CHECK:STDOUT: %.loc5_16.1: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc5_16.2: type = converted %.loc5_16.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %struct_type.v: type = struct_type {.v: %empty_tuple.type} [concrete = constants.%struct_type.v] // CHECK:STDOUT: } // CHECK:STDOUT: %y: ref %struct_type.v = bind_name y, %y.var +// CHECK:STDOUT: %impl.elem0: %.d6c = impl_witness_access constants.%Destroy.impl_witness.148, element0 [concrete = constants.%Op.477] +// CHECK:STDOUT: %bound_method.loc5_3.1: = bound_method %y.var, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%struct_type.v) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc5_3.2: = bound_method %y.var, %specific_fn +// CHECK:STDOUT: %.loc5_3.2: ref %empty_tuple.type = struct_access %y.var, element0 +// CHECK:STDOUT: %tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc5_3.3: %empty_tuple.type = converted %.loc5_3.2, %tuple [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %struct: %struct_type.v = struct_value (%.loc5_3.3) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc5_3.4: %struct_type.v = converted %y.var, %struct [concrete = constants.%struct] +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc5_3.2(%.loc5_3.4) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/var/lookup.carbon b/toolchain/check/testdata/var/lookup.carbon index d4c0f959c486..dac97de4e428 100644 --- a/toolchain/check/testdata/var/lookup.carbon +++ b/toolchain/check/testdata/var/lookup.carbon @@ -23,14 +23,30 @@ fn Main() { // CHECK:STDOUT: %Main.type: type = fn_type @Main [concrete] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Main: %Main.type = struct_value () [concrete] -// CHECK:STDOUT: %pattern_type: type = pattern_type %empty_tuple.type [concrete] +// CHECK:STDOUT: %pattern_type.cb1: type = pattern_type %empty_tuple.type [concrete] // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.1dc: = impl_witness imports.%Destroy.impl_witness_table, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.type.a63: type = fn_type @Op.2, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.ea3: %Op.type.a63 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %empty_tuple.type, (%Destroy.impl_witness.1dc) [concrete] +// CHECK:STDOUT: %.346: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.ea3, @Op.2(%empty_tuple.type) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -45,20 +61,27 @@ fn Main() { // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %x.patt: %pattern_type = binding_pattern x [concrete] -// CHECK:STDOUT: %x.var_patt: %pattern_type = var_pattern %x.patt [concrete] +// CHECK:STDOUT: %x.patt: %pattern_type.cb1 = binding_pattern x [concrete] +// CHECK:STDOUT: %x.var_patt: %pattern_type.cb1 = var_pattern %x.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %x.var: ref %empty_tuple.type = var %x.var_patt // CHECK:STDOUT: %.loc16_16.1: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc16_16.2: init %empty_tuple.type = tuple_init () to %x.var [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc16_3: init %empty_tuple.type = converted %.loc16_16.1, %.loc16_16.2 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: assign %x.var, %.loc16_3 +// CHECK:STDOUT: %.loc16_3.1: init %empty_tuple.type = converted %.loc16_16.1, %.loc16_16.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: assign %x.var, %.loc16_3.1 // CHECK:STDOUT: %.loc16_11.1: type = splice_block %.loc16_11.3 [concrete = constants.%empty_tuple.type] { // CHECK:STDOUT: %.loc16_11.2: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc16_11.3: type = converted %.loc16_11.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %x: ref %empty_tuple.type = bind_name x, %x.var // CHECK:STDOUT: %x.ref: ref %empty_tuple.type = name_ref x, %x +// CHECK:STDOUT: %impl.elem0: %.346 = impl_witness_access constants.%Destroy.impl_witness.1dc, element0 [concrete = constants.%Op.ea3] +// CHECK:STDOUT: %bound_method.loc16_3.1: = bound_method %x.var, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%empty_tuple.type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc16_3.2: = bound_method %x.var, %specific_fn +// CHECK:STDOUT: %tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc16_3.2: %empty_tuple.type = converted %x.var, %tuple [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc16_3.2(%.loc16_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/var/shadowing.carbon b/toolchain/check/testdata/var/shadowing.carbon index 4409f3c1bccc..3a2eadc2b93c 100644 --- a/toolchain/check/testdata/var/shadowing.carbon +++ b/toolchain/check/testdata/var/shadowing.carbon @@ -35,15 +35,31 @@ fn Main() { // CHECK:STDOUT: %Main.type: type = fn_type @Main [concrete] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Main: %Main.type = struct_value () [concrete] -// CHECK:STDOUT: %pattern_type: type = pattern_type %empty_tuple.type [concrete] +// CHECK:STDOUT: %pattern_type.cb1: type = pattern_type %empty_tuple.type [concrete] // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] // CHECK:STDOUT: %true: bool = bool_literal true [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.1dc: = impl_witness imports.%Destroy.impl_witness_table, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.type.a63: type = fn_type @Op.2, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.ea3: %Op.type.a63 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %empty_tuple.type, (%Destroy.impl_witness.1dc) [concrete] +// CHECK:STDOUT: %.346: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.ea3, @Op.2(%empty_tuple.type) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -60,14 +76,14 @@ fn Main() { // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %NS.patt: %pattern_type = binding_pattern NS [concrete] -// CHECK:STDOUT: %NS.var_patt: %pattern_type = var_pattern %NS.patt [concrete] +// CHECK:STDOUT: %NS.patt: %pattern_type.cb1 = binding_pattern NS [concrete] +// CHECK:STDOUT: %NS.var_patt: %pattern_type.cb1 = var_pattern %NS.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %NS.var: ref %empty_tuple.type = var %NS.var_patt // CHECK:STDOUT: %.loc5_17.1: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc5_17.2: init %empty_tuple.type = tuple_init () to %NS.var [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc5_3: init %empty_tuple.type = converted %.loc5_17.1, %.loc5_17.2 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: assign %NS.var, %.loc5_3 +// CHECK:STDOUT: %.loc5_3.1: init %empty_tuple.type = converted %.loc5_17.1, %.loc5_17.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: assign %NS.var, %.loc5_3.1 // CHECK:STDOUT: %.loc5_12.1: type = splice_block %.loc5_12.3 [concrete = constants.%empty_tuple.type] { // CHECK:STDOUT: %.loc5_12.2: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc5_12.3: type = converted %.loc5_12.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] @@ -79,14 +95,14 @@ fn Main() { // CHECK:STDOUT: %.loc6_6: init %empty_tuple.type = converted %.loc6_9.1, %.loc6_9.2 [concrete = constants.%empty_tuple] // CHECK:STDOUT: assign %NS.ref, %.loc6_6 // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %x.patt.loc8: %pattern_type = binding_pattern x [concrete] -// CHECK:STDOUT: %x.var_patt.loc8: %pattern_type = var_pattern %x.patt.loc8 [concrete] +// CHECK:STDOUT: %x.patt.loc8: %pattern_type.cb1 = binding_pattern x [concrete] +// CHECK:STDOUT: %x.var_patt.loc8: %pattern_type.cb1 = var_pattern %x.patt.loc8 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %x.var.loc8: ref %empty_tuple.type = var %x.var_patt.loc8 // CHECK:STDOUT: %.loc8_16.1: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc8_16.2: init %empty_tuple.type = tuple_init () to %x.var.loc8 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_3: init %empty_tuple.type = converted %.loc8_16.1, %.loc8_16.2 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: assign %x.var.loc8, %.loc8_3 +// CHECK:STDOUT: %.loc8_3.1: init %empty_tuple.type = converted %.loc8_16.1, %.loc8_16.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: assign %x.var.loc8, %.loc8_3.1 // CHECK:STDOUT: %.loc8_11.1: type = splice_block %.loc8_11.3 [concrete = constants.%empty_tuple.type] { // CHECK:STDOUT: %.loc8_11.2: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc8_11.3: type = converted %.loc8_11.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] @@ -97,14 +113,14 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: !if.then: // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %x.patt.loc10: %pattern_type = binding_pattern x [concrete] -// CHECK:STDOUT: %x.var_patt.loc10: %pattern_type = var_pattern %x.patt.loc10 [concrete] +// CHECK:STDOUT: %x.patt.loc10: %pattern_type.cb1 = binding_pattern x [concrete] +// CHECK:STDOUT: %x.var_patt.loc10: %pattern_type.cb1 = var_pattern %x.patt.loc10 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %x.var.loc10: ref %empty_tuple.type = var %x.var_patt.loc10 // CHECK:STDOUT: %.loc10_18.1: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc10_18.2: init %empty_tuple.type = tuple_init () to %x.var.loc10 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc10_5: init %empty_tuple.type = converted %.loc10_18.1, %.loc10_18.2 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: assign %x.var.loc10, %.loc10_5 +// CHECK:STDOUT: %.loc10_5.1: init %empty_tuple.type = converted %.loc10_18.1, %.loc10_18.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: assign %x.var.loc10, %.loc10_5.1 // CHECK:STDOUT: %.loc10_13.1: type = splice_block %.loc10_13.3 [concrete = constants.%empty_tuple.type] { // CHECK:STDOUT: %.loc10_13.2: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc10_13.3: type = converted %.loc10_13.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] @@ -118,6 +134,27 @@ fn Main() { // CHECK:STDOUT: br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.else: +// CHECK:STDOUT: %impl.elem0.loc10: %.346 = impl_witness_access constants.%Destroy.impl_witness.1dc, element0 [concrete = constants.%Op.ea3] +// CHECK:STDOUT: %bound_method.loc10_5.1: = bound_method %x.var.loc10, %impl.elem0.loc10 +// CHECK:STDOUT: %specific_fn.loc10: = specific_function %impl.elem0.loc10, @Op.2(constants.%empty_tuple.type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc10_5.2: = bound_method %x.var.loc10, %specific_fn.loc10 +// CHECK:STDOUT: %tuple.loc10: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc10_5.2: %empty_tuple.type = converted %x.var.loc10, %tuple.loc10 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %no_op.loc10: init %empty_tuple.type = call %bound_method.loc10_5.2(%.loc10_5.2) +// CHECK:STDOUT: %impl.elem0.loc8: %.346 = impl_witness_access constants.%Destroy.impl_witness.1dc, element0 [concrete = constants.%Op.ea3] +// CHECK:STDOUT: %bound_method.loc8_3.1: = bound_method %x.var.loc8, %impl.elem0.loc8 +// CHECK:STDOUT: %specific_fn.loc8: = specific_function %impl.elem0.loc8, @Op.2(constants.%empty_tuple.type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc8_3.2: = bound_method %x.var.loc8, %specific_fn.loc8 +// CHECK:STDOUT: %tuple.loc8: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_3.2: %empty_tuple.type = converted %x.var.loc8, %tuple.loc8 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %no_op.loc8: init %empty_tuple.type = call %bound_method.loc8_3.2(%.loc8_3.2) +// CHECK:STDOUT: %impl.elem0.loc5: %.346 = impl_witness_access constants.%Destroy.impl_witness.1dc, element0 [concrete = constants.%Op.ea3] +// CHECK:STDOUT: %bound_method.loc5_3.1: = bound_method %NS.var, %impl.elem0.loc5 +// CHECK:STDOUT: %specific_fn.loc5: = specific_function %impl.elem0.loc5, @Op.2(constants.%empty_tuple.type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc5_3.2: = bound_method %NS.var, %specific_fn.loc5 +// CHECK:STDOUT: %tuple.loc5: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc5_3.2: %empty_tuple.type = converted %NS.var, %tuple.loc5 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %no_op.loc5: init %empty_tuple.type = call %bound_method.loc5_3.2(%.loc5_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/var/var_pattern.carbon b/toolchain/check/testdata/var/var_pattern.carbon index fa9c9e9b3a99..120c39089185 100644 --- a/toolchain/check/testdata/var/var_pattern.carbon +++ b/toolchain/check/testdata/var/var_pattern.carbon @@ -151,15 +151,30 @@ fn G() { // CHECK:STDOUT: %F.type: type = fn_type @F [concrete] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] -// CHECK:STDOUT: %pattern_type: type = pattern_type %empty_tuple.type [concrete] +// CHECK:STDOUT: %pattern_type.cb1: type = pattern_type %empty_tuple.type [concrete] // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.1dc: = impl_witness imports.%Destroy.impl_witness_table, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.type.a63: type = fn_type @Op.2, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.ea3: %Op.type.a63 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %empty_tuple.type, (%Destroy.impl_witness.1dc) [concrete] +// CHECK:STDOUT: %.346: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.ea3, @Op.2(%empty_tuple.type) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -174,19 +189,26 @@ fn G() { // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %x.patt: %pattern_type = binding_pattern x [concrete] -// CHECK:STDOUT: %x.var_patt: %pattern_type = var_pattern %x.patt [concrete] +// CHECK:STDOUT: %x.patt: %pattern_type.cb1 = binding_pattern x [concrete] +// CHECK:STDOUT: %x.var_patt: %pattern_type.cb1 = var_pattern %x.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %x.var: ref %empty_tuple.type = var %x.var_patt // CHECK:STDOUT: %.loc5_20.1: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc5_20.2: init %empty_tuple.type = tuple_init () to %x.var [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc5_7: init %empty_tuple.type = converted %.loc5_20.1, %.loc5_20.2 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: assign %x.var, %.loc5_7 +// CHECK:STDOUT: %.loc5_7.1: init %empty_tuple.type = converted %.loc5_20.1, %.loc5_20.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: assign %x.var, %.loc5_7.1 // CHECK:STDOUT: %.loc5_15.1: type = splice_block %.loc5_15.3 [concrete = constants.%empty_tuple.type] { // CHECK:STDOUT: %.loc5_15.2: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc5_15.3: type = converted %.loc5_15.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %x: ref %empty_tuple.type = bind_name x, %x.var +// CHECK:STDOUT: %impl.elem0: %.346 = impl_witness_access constants.%Destroy.impl_witness.1dc, element0 [concrete = constants.%Op.ea3] +// CHECK:STDOUT: %bound_method.loc5_7.1: = bound_method %x.var, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%empty_tuple.type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc5_7.2: = bound_method %x.var, %specific_fn +// CHECK:STDOUT: %tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc5_7.2: %empty_tuple.type = converted %x.var, %tuple [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc5_7.2(%.loc5_7.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -200,13 +222,28 @@ fn G() { // CHECK:STDOUT: %tuple.type: type = tuple_type (%empty_tuple.type, %empty_tuple.type) [concrete] // CHECK:STDOUT: %pattern_type.5b8: type = pattern_type %tuple.type [concrete] // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.1dc: = impl_witness imports.%Destroy.impl_witness_table, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.type.a63: type = fn_type @Op.2, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.ea3: %Op.type.a63 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %empty_tuple.type, (%Destroy.impl_witness.1dc) [concrete] +// CHECK:STDOUT: %.346: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.ea3, @Op.2(%empty_tuple.type) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -238,13 +275,20 @@ fn G() { // CHECK:STDOUT: %.loc5_30.2: %empty_tuple.type = converted %.loc5_30.1, %empty_tuple [concrete = constants.%empty_tuple] // CHECK:STDOUT: %x: %empty_tuple.type = bind_name x, %.loc5_30.2 // CHECK:STDOUT: %.loc5_34.2: init %empty_tuple.type = tuple_init () to %y.var [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc5_15: init %empty_tuple.type = converted %.loc5_34.1, %.loc5_34.2 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: assign %y.var, %.loc5_15 +// CHECK:STDOUT: %.loc5_15.1: init %empty_tuple.type = converted %.loc5_34.1, %.loc5_34.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: assign %y.var, %.loc5_15.1 // CHECK:STDOUT: %.loc5_23.1: type = splice_block %.loc5_23.3 [concrete = constants.%empty_tuple.type] { // CHECK:STDOUT: %.loc5_23.2: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc5_23.3: type = converted %.loc5_23.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %y: ref %empty_tuple.type = bind_name y, %y.var +// CHECK:STDOUT: %impl.elem0: %.346 = impl_witness_access constants.%Destroy.impl_witness.1dc, element0 [concrete = constants.%Op.ea3] +// CHECK:STDOUT: %bound_method.loc5_15.1: = bound_method %y.var, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%empty_tuple.type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc5_15.2: = bound_method %y.var, %specific_fn +// CHECK:STDOUT: %tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc5_15.2: %empty_tuple.type = converted %y.var, %tuple [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc5_15.2(%.loc5_15.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -259,13 +303,28 @@ fn G() { // CHECK:STDOUT: %pattern_type.5b8: type = pattern_type %tuple.type [concrete] // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] // CHECK:STDOUT: %tuple: %tuple.type = tuple_value (%empty_tuple, %empty_tuple) [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.585: = impl_witness imports.%Destroy.impl_witness_table, @impl(%tuple.type) [concrete] +// CHECK:STDOUT: %Op.type.4e8: type = fn_type @Op.2, @impl(%tuple.type) [concrete] +// CHECK:STDOUT: %Op.166: %Op.type.4e8 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %tuple.type, (%Destroy.impl_witness.585) [concrete] +// CHECK:STDOUT: %.b6c: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.166, @Op.2(%tuple.type) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -296,20 +355,33 @@ fn G() { // CHECK:STDOUT: %.loc5_30.2: init %empty_tuple.type = tuple_init () to %tuple.elem1.loc5_31 [concrete = constants.%empty_tuple] // CHECK:STDOUT: %.loc5_31.3: init %empty_tuple.type = converted %.loc5_30.1, %.loc5_30.2 [concrete = constants.%empty_tuple] // CHECK:STDOUT: %.loc5_31.4: init %tuple.type = tuple_init (%.loc5_31.2, %.loc5_31.3) to %.var [concrete = constants.%tuple] -// CHECK:STDOUT: %.loc5_3: init %tuple.type = converted %.loc5_31.1, %.loc5_31.4 [concrete = constants.%tuple] -// CHECK:STDOUT: assign %.var, %.loc5_3 -// CHECK:STDOUT: %tuple.elem0.loc5_3: ref %empty_tuple.type = tuple_access %.var, element0 -// CHECK:STDOUT: %tuple.elem1.loc5_3: ref %empty_tuple.type = tuple_access %.var, element1 +// CHECK:STDOUT: %.loc5_3.1: init %tuple.type = converted %.loc5_31.1, %.loc5_31.4 [concrete = constants.%tuple] +// CHECK:STDOUT: assign %.var, %.loc5_3.1 +// CHECK:STDOUT: %tuple.elem0.loc5_3.1: ref %empty_tuple.type = tuple_access %.var, element0 +// CHECK:STDOUT: %tuple.elem1.loc5_3.1: ref %empty_tuple.type = tuple_access %.var, element1 // CHECK:STDOUT: %.loc5_12.1: type = splice_block %.loc5_12.3 [concrete = constants.%empty_tuple.type] { // CHECK:STDOUT: %.loc5_12.2: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc5_12.3: type = converted %.loc5_12.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %x: ref %empty_tuple.type = bind_name x, %tuple.elem0.loc5_3 +// CHECK:STDOUT: %x: ref %empty_tuple.type = bind_name x, %tuple.elem0.loc5_3.1 // CHECK:STDOUT: %.loc5_19.1: type = splice_block %.loc5_19.3 [concrete = constants.%empty_tuple.type] { // CHECK:STDOUT: %.loc5_19.2: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc5_19.3: type = converted %.loc5_19.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %y: ref %empty_tuple.type = bind_name y, %tuple.elem1.loc5_3 +// CHECK:STDOUT: %y: ref %empty_tuple.type = bind_name y, %tuple.elem1.loc5_3.1 +// CHECK:STDOUT: %impl.elem0: %.b6c = impl_witness_access constants.%Destroy.impl_witness.585, element0 [concrete = constants.%Op.166] +// CHECK:STDOUT: %bound_method.loc5_3.1: = bound_method %.var, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%tuple.type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc5_3.2: = bound_method %.var, %specific_fn +// CHECK:STDOUT: %tuple.elem0.loc5_3.2: ref %empty_tuple.type = tuple_access %.var, element0 +// CHECK:STDOUT: %tuple.loc5_3.1: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc5_3.2: %empty_tuple.type = converted %tuple.elem0.loc5_3.2, %tuple.loc5_3.1 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %tuple.elem1.loc5_3.2: ref %empty_tuple.type = tuple_access %.var, element1 +// CHECK:STDOUT: %tuple.loc5_3.2: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc5_3.3: %empty_tuple.type = converted %tuple.elem1.loc5_3.2, %tuple.loc5_3.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %tuple.loc5_3.3: %tuple.type = tuple_value (%.loc5_3.2, %.loc5_3.3) [concrete = constants.%tuple] +// CHECK:STDOUT: %.loc5_3.4: %tuple.type = converted %.var, %tuple.loc5_3.3 [concrete = constants.%tuple] +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc5_3.2(%.loc5_3.4) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -324,13 +396,28 @@ fn G() { // CHECK:STDOUT: %pattern_type.5b8: type = pattern_type %tuple.type [concrete] // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] // CHECK:STDOUT: %tuple: %tuple.type = tuple_value (%empty_tuple, %empty_tuple) [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.585: = impl_witness imports.%Destroy.impl_witness_table, @impl(%tuple.type) [concrete] +// CHECK:STDOUT: %Op.type.4e8: type = fn_type @Op.2, @impl(%tuple.type) [concrete] +// CHECK:STDOUT: %Op.166: %Op.type.4e8 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %tuple.type, (%Destroy.impl_witness.585) [concrete] +// CHECK:STDOUT: %.b6c: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.166, @Op.2(%tuple.type) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -361,20 +448,33 @@ fn G() { // CHECK:STDOUT: %.loc5_34.2: init %empty_tuple.type = tuple_init () to %tuple.elem1.loc5_35 [concrete = constants.%empty_tuple] // CHECK:STDOUT: %.loc5_35.3: init %empty_tuple.type = converted %.loc5_34.1, %.loc5_34.2 [concrete = constants.%empty_tuple] // CHECK:STDOUT: %.loc5_35.4: init %tuple.type = tuple_init (%.loc5_35.2, %.loc5_35.3) to %.var [concrete = constants.%tuple] -// CHECK:STDOUT: %.loc5_7: init %tuple.type = converted %.loc5_35.1, %.loc5_35.4 [concrete = constants.%tuple] -// CHECK:STDOUT: assign %.var, %.loc5_7 -// CHECK:STDOUT: %tuple.elem0.loc5_7: ref %empty_tuple.type = tuple_access %.var, element0 -// CHECK:STDOUT: %tuple.elem1.loc5_7: ref %empty_tuple.type = tuple_access %.var, element1 +// CHECK:STDOUT: %.loc5_7.1: init %tuple.type = converted %.loc5_35.1, %.loc5_35.4 [concrete = constants.%tuple] +// CHECK:STDOUT: assign %.var, %.loc5_7.1 +// CHECK:STDOUT: %tuple.elem0.loc5_7.1: ref %empty_tuple.type = tuple_access %.var, element0 +// CHECK:STDOUT: %tuple.elem1.loc5_7.1: ref %empty_tuple.type = tuple_access %.var, element1 // CHECK:STDOUT: %.loc5_16.1: type = splice_block %.loc5_16.3 [concrete = constants.%empty_tuple.type] { // CHECK:STDOUT: %.loc5_16.2: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc5_16.3: type = converted %.loc5_16.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %x: ref %empty_tuple.type = bind_name x, %tuple.elem0.loc5_7 +// CHECK:STDOUT: %x: ref %empty_tuple.type = bind_name x, %tuple.elem0.loc5_7.1 // CHECK:STDOUT: %.loc5_23.1: type = splice_block %.loc5_23.3 [concrete = constants.%empty_tuple.type] { // CHECK:STDOUT: %.loc5_23.2: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc5_23.3: type = converted %.loc5_23.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %y: ref %empty_tuple.type = bind_name y, %tuple.elem1.loc5_7 +// CHECK:STDOUT: %y: ref %empty_tuple.type = bind_name y, %tuple.elem1.loc5_7.1 +// CHECK:STDOUT: %impl.elem0: %.b6c = impl_witness_access constants.%Destroy.impl_witness.585, element0 [concrete = constants.%Op.166] +// CHECK:STDOUT: %bound_method.loc5_7.1: = bound_method %.var, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%tuple.type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc5_7.2: = bound_method %.var, %specific_fn +// CHECK:STDOUT: %tuple.elem0.loc5_7.2: ref %empty_tuple.type = tuple_access %.var, element0 +// CHECK:STDOUT: %tuple.loc5_7.1: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc5_7.2: %empty_tuple.type = converted %tuple.elem0.loc5_7.2, %tuple.loc5_7.1 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %tuple.elem1.loc5_7.2: ref %empty_tuple.type = tuple_access %.var, element1 +// CHECK:STDOUT: %tuple.loc5_7.2: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc5_7.3: %empty_tuple.type = converted %tuple.elem1.loc5_7.2, %tuple.loc5_7.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %tuple.loc5_7.3: %tuple.type = tuple_value (%.loc5_7.2, %.loc5_7.3) [concrete = constants.%tuple] +// CHECK:STDOUT: %.loc5_7.4: %tuple.type = converted %.var, %tuple.loc5_7.3 [concrete = constants.%tuple] +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc5_7.2(%.loc5_7.4) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -382,19 +482,34 @@ fn G() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] -// CHECK:STDOUT: %pattern_type: type = pattern_type %empty_tuple.type [concrete] +// CHECK:STDOUT: %pattern_type.cb1: type = pattern_type %empty_tuple.type [concrete] // CHECK:STDOUT: %F.type: type = fn_type @F [concrete] // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] // CHECK:STDOUT: %G.type: type = fn_type @G [concrete] // CHECK:STDOUT: %G: %G.type = struct_value () [concrete] // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.1dc: = impl_witness imports.%Destroy.impl_witness_table, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.type.a63: type = fn_type @Op.2, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.ea3: %Op.type.a63 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %empty_tuple.type, (%Destroy.impl_witness.1dc) [concrete] +// CHECK:STDOUT: %.346: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.ea3, @Op.2(%empty_tuple.type) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -405,11 +520,11 @@ fn G() { // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] { -// CHECK:STDOUT: %x.patt: %pattern_type = binding_pattern x [concrete] -// CHECK:STDOUT: %x.param_patt: %pattern_type = value_param_pattern %x.patt, call_param0 [concrete] -// CHECK:STDOUT: %y.patt: %pattern_type = binding_pattern y [concrete] -// CHECK:STDOUT: %y.param_patt: %pattern_type = ref_param_pattern %y.patt, call_param1 [concrete] -// CHECK:STDOUT: %y.var_patt: %pattern_type = var_pattern %y.param_patt [concrete] +// CHECK:STDOUT: %x.patt: %pattern_type.cb1 = binding_pattern x [concrete] +// CHECK:STDOUT: %x.param_patt: %pattern_type.cb1 = value_param_pattern %x.patt, call_param0 [concrete] +// CHECK:STDOUT: %y.patt: %pattern_type.cb1 = binding_pattern y [concrete] +// CHECK:STDOUT: %y.param_patt: %pattern_type.cb1 = ref_param_pattern %y.patt, call_param1 [concrete] +// CHECK:STDOUT: %y.var_patt: %pattern_type.cb1 = var_pattern %y.param_patt [concrete] // CHECK:STDOUT: } { // CHECK:STDOUT: %x.param: %empty_tuple.type = value_param call_param0 // CHECK:STDOUT: %.loc4_10.1: type = splice_block %.loc4_10.3 [concrete = constants.%empty_tuple.type] { @@ -432,14 +547,14 @@ fn G() { // CHECK:STDOUT: fn @G() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %v.patt: %pattern_type = binding_pattern v [concrete] -// CHECK:STDOUT: %v.var_patt: %pattern_type = var_pattern %v.patt [concrete] +// CHECK:STDOUT: %v.patt: %pattern_type.cb1 = binding_pattern v [concrete] +// CHECK:STDOUT: %v.var_patt: %pattern_type.cb1 = var_pattern %v.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %v.var: ref %empty_tuple.type = var %v.var_patt // CHECK:STDOUT: %.loc7_16.1: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc7_16.2: init %empty_tuple.type = tuple_init () to %v.var [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc7_3: init %empty_tuple.type = converted %.loc7_16.1, %.loc7_16.2 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: assign %v.var, %.loc7_3 +// CHECK:STDOUT: %.loc7_3.1: init %empty_tuple.type = converted %.loc7_16.1, %.loc7_16.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: assign %v.var, %.loc7_3.1 // CHECK:STDOUT: %.loc7_11.1: type = splice_block %.loc7_11.3 [concrete = constants.%empty_tuple.type] { // CHECK:STDOUT: %.loc7_11.2: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc7_11.3: type = converted %.loc7_11.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] @@ -448,13 +563,27 @@ fn G() { // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] // CHECK:STDOUT: %v.ref: ref %empty_tuple.type = name_ref v, %v // CHECK:STDOUT: %.loc8_9.1: %empty_tuple.type = tuple_literal () -// CHECK:STDOUT: %tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_5: %empty_tuple.type = converted %v.ref, %tuple [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %tuple.loc8: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_5: %empty_tuple.type = converted %v.ref, %tuple.loc8 [concrete = constants.%empty_tuple] // CHECK:STDOUT: %.loc4_13.1: ref %empty_tuple.type = temporary_storage // CHECK:STDOUT: %.loc8_9.2: init %empty_tuple.type = tuple_init () to %.loc4_13.1 [concrete = constants.%empty_tuple] // CHECK:STDOUT: %.loc4_13.2: init %empty_tuple.type = converted %.loc8_9.1, %.loc8_9.2 [concrete = constants.%empty_tuple] // CHECK:STDOUT: assign %.loc4_13.1, %.loc4_13.2 // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.ref(%.loc8_5, %.loc4_13.1) +// CHECK:STDOUT: %impl.elem0.loc4: %.346 = impl_witness_access constants.%Destroy.impl_witness.1dc, element0 [concrete = constants.%Op.ea3] +// CHECK:STDOUT: %bound_method.loc4_13.1: = bound_method %.loc4_13.1, %impl.elem0.loc4 +// CHECK:STDOUT: %specific_fn.loc4: = specific_function %impl.elem0.loc4, @Op.2(constants.%empty_tuple.type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc4_13.2: = bound_method %.loc4_13.1, %specific_fn.loc4 +// CHECK:STDOUT: %tuple.loc4: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc4_13.3: %empty_tuple.type = converted %.loc4_13.1, %tuple.loc4 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %no_op.loc4: init %empty_tuple.type = call %bound_method.loc4_13.2(%.loc4_13.3) +// CHECK:STDOUT: %impl.elem0.loc7: %.346 = impl_witness_access constants.%Destroy.impl_witness.1dc, element0 [concrete = constants.%Op.ea3] +// CHECK:STDOUT: %bound_method.loc7_3.1: = bound_method %v.var, %impl.elem0.loc7 +// CHECK:STDOUT: %specific_fn.loc7: = specific_function %impl.elem0.loc7, @Op.2(constants.%empty_tuple.type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_3.2: = bound_method %v.var, %specific_fn.loc7 +// CHECK:STDOUT: %tuple.loc7: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc7_3.2: %empty_tuple.type = converted %v.var, %tuple.loc7 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %no_op.loc7: init %empty_tuple.type = call %bound_method.loc7_3.2(%.loc7_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -564,10 +693,25 @@ fn G() { // CHECK:STDOUT: %F.type: type = fn_type @F [concrete] // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Destroy.assoc_type: type = assoc_entity_type @Destroy [concrete] +// CHECK:STDOUT: %assoc0: %Destroy.assoc_type = assoc_entity element0, imports.%Core.import_ref.725 [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %Op.651: %Op.type.bae = struct_value () [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.1dc: = impl_witness imports.%Destroy.impl_witness_table, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.type.a63: type = fn_type @Op.2, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.ea3: %Op.type.a63 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %empty_tuple.type, (%Destroy.impl_witness.1dc) [concrete] +// CHECK:STDOUT: %.346: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.ea3, @Op.2(%empty_tuple.type) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -576,6 +720,11 @@ fn G() { // CHECK:STDOUT: import P//default // CHECK:STDOUT: } // CHECK:STDOUT: %P.F: %F.type = import_ref P//default, F, loaded [concrete = constants.%F] +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.f99: %Destroy.assoc_type = import_ref Core//prelude/parts/destroy, loc5_22, loaded [concrete = constants.%assoc0] +// CHECK:STDOUT: %Core.import_ref.725: %Op.type.bae = import_ref Core//prelude/parts/destroy, loc5_22, loaded [concrete = constants.%Op.651] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -602,6 +751,14 @@ fn G() { // CHECK:STDOUT: %.2: init %empty_tuple.type = converted %.loc7_12.1, %.loc7_12.2 [concrete = constants.%empty_tuple] // CHECK:STDOUT: assign %.1, %.2 // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.ref(%.loc7_8.2, %.1) +// CHECK:STDOUT: %Op.ref: %Destroy.assoc_type = name_ref Op, imports.%Core.import_ref.f99 [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0: %.346 = impl_witness_access constants.%Destroy.impl_witness.1dc, element0 [concrete = constants.%Op.ea3] +// CHECK:STDOUT: %bound_method.1: = bound_method %.1, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Op.2(constants.%empty_tuple.type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.2: = bound_method %.1, %specific_fn +// CHECK:STDOUT: %tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.3: %empty_tuple.type = converted %.1, %tuple [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.2(%.3) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -620,13 +777,34 @@ fn G() { // CHECK:STDOUT: %pattern_type.c6c: type = pattern_type %tuple.type.a21 [concrete] // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] // CHECK:STDOUT: %tuple: %tuple.type.bcd = tuple_value (%empty_tuple, %empty_tuple) [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.585: = impl_witness imports.%Destroy.impl_witness_table, @impl(%tuple.type.bcd) [concrete] +// CHECK:STDOUT: %Op.type.4e8: type = fn_type @Op.2, @impl(%tuple.type.bcd) [concrete] +// CHECK:STDOUT: %Op.166: %Op.type.4e8 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.65b: %Destroy.type = facet_value %tuple.type.bcd, (%Destroy.impl_witness.585) [concrete] +// CHECK:STDOUT: %.b6c: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.65b [concrete] +// CHECK:STDOUT: %Op.specific_fn.48a: = specific_function %Op.166, @Op.2(%tuple.type.bcd) [concrete] +// CHECK:STDOUT: %Destroy.impl_witness.1dc: = impl_witness imports.%Destroy.impl_witness_table, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.type.a63: type = fn_type @Op.2, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.ea3: %Op.type.a63 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet.926: %Destroy.type = facet_value %empty_tuple.type, (%Destroy.impl_witness.1dc) [concrete] +// CHECK:STDOUT: %.346: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.926 [concrete] +// CHECK:STDOUT: %Op.specific_fn.393: = specific_function %Op.ea3, @Op.2(%empty_tuple.type) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -672,21 +850,41 @@ fn G() { // CHECK:STDOUT: %.loc9_53.4: init %tuple.type.bcd = tuple_init (%.loc9_53.2, %.loc9_53.3) to %.var [concrete = constants.%tuple] // CHECK:STDOUT: %.loc9_15.1: init %tuple.type.bcd = converted %.loc9_53.1, %.loc9_53.4 [concrete = constants.%tuple] // CHECK:STDOUT: assign %.var, %.loc9_15.1 -// CHECK:STDOUT: %tuple.elem0.loc9_15: ref %empty_tuple.type = tuple_access %.var, element0 -// CHECK:STDOUT: %tuple.elem1.loc9_15: ref %empty_tuple.type = tuple_access %.var, element1 +// CHECK:STDOUT: %tuple.elem0.loc9_15.1: ref %empty_tuple.type = tuple_access %.var, element0 +// CHECK:STDOUT: %tuple.elem1.loc9_15.1: ref %empty_tuple.type = tuple_access %.var, element1 // CHECK:STDOUT: %.loc9_24.1: type = splice_block %.loc9_24.3 [concrete = constants.%empty_tuple.type] { // CHECK:STDOUT: %.loc9_24.2: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc9_24.3: type = converted %.loc9_24.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %y: ref %empty_tuple.type = bind_name y, %tuple.elem0.loc9_15 +// CHECK:STDOUT: %y: ref %empty_tuple.type = bind_name y, %tuple.elem0.loc9_15.1 // CHECK:STDOUT: %.loc9_15.2: init %empty_tuple.type = tuple_init () to %z.var [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc9_27: init %empty_tuple.type = converted %tuple.elem1.loc9_15, %.loc9_15.2 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: assign %z.var, %.loc9_27 +// CHECK:STDOUT: %.loc9_27.1: init %empty_tuple.type = converted %tuple.elem1.loc9_15.1, %.loc9_15.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: assign %z.var, %.loc9_27.1 // CHECK:STDOUT: %.loc9_35.1: type = splice_block %.loc9_35.3 [concrete = constants.%empty_tuple.type] { // CHECK:STDOUT: %.loc9_35.2: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc9_35.3: type = converted %.loc9_35.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %z: ref %empty_tuple.type = bind_name z, %z.var +// CHECK:STDOUT: %impl.elem0.loc9_15: %.b6c = impl_witness_access constants.%Destroy.impl_witness.585, element0 [concrete = constants.%Op.166] +// CHECK:STDOUT: %bound_method.loc9_15.1: = bound_method %.var, %impl.elem0.loc9_15 +// CHECK:STDOUT: %specific_fn.loc9_15: = specific_function %impl.elem0.loc9_15, @Op.2(constants.%tuple.type.bcd) [concrete = constants.%Op.specific_fn.48a] +// CHECK:STDOUT: %bound_method.loc9_15.2: = bound_method %.var, %specific_fn.loc9_15 +// CHECK:STDOUT: %tuple.elem0.loc9_15.2: ref %empty_tuple.type = tuple_access %.var, element0 +// CHECK:STDOUT: %tuple.loc9_15.1: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc9_15.3: %empty_tuple.type = converted %tuple.elem0.loc9_15.2, %tuple.loc9_15.1 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %tuple.elem1.loc9_15.2: ref %empty_tuple.type = tuple_access %.var, element1 +// CHECK:STDOUT: %tuple.loc9_15.2: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc9_15.4: %empty_tuple.type = converted %tuple.elem1.loc9_15.2, %tuple.loc9_15.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %tuple.loc9_15.3: %tuple.type.bcd = tuple_value (%.loc9_15.3, %.loc9_15.4) [concrete = constants.%tuple] +// CHECK:STDOUT: %.loc9_15.5: %tuple.type.bcd = converted %.var, %tuple.loc9_15.3 [concrete = constants.%tuple] +// CHECK:STDOUT: %no_op.loc9_15: init %empty_tuple.type = call %bound_method.loc9_15.2(%.loc9_15.5) +// CHECK:STDOUT: %impl.elem0.loc9_27: %.346 = impl_witness_access constants.%Destroy.impl_witness.1dc, element0 [concrete = constants.%Op.ea3] +// CHECK:STDOUT: %bound_method.loc9_27.1: = bound_method %z.var, %impl.elem0.loc9_27 +// CHECK:STDOUT: %specific_fn.loc9_27: = specific_function %impl.elem0.loc9_27, @Op.2(constants.%empty_tuple.type) [concrete = constants.%Op.specific_fn.393] +// CHECK:STDOUT: %bound_method.loc9_27.2: = bound_method %z.var, %specific_fn.loc9_27 +// CHECK:STDOUT: %tuple.loc9_27: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc9_27.2: %empty_tuple.type = converted %z.var, %tuple.loc9_27 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %no_op.loc9_27: init %empty_tuple.type = call %bound_method.loc9_27.2(%.loc9_27.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -764,13 +962,28 @@ fn G() { // CHECK:STDOUT: %tuple.type: type = tuple_type (%empty_tuple.type, %empty_tuple.type, %empty_tuple.type) [concrete] // CHECK:STDOUT: %pattern_type.8c1: type = pattern_type %tuple.type [concrete] // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] +// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] +// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic] +// CHECK:STDOUT: %Destroy.impl_witness.1dc: = impl_witness imports.%Destroy.impl_witness_table, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.type.a63: type = fn_type @Op.2, @impl(%empty_tuple.type) [concrete] +// CHECK:STDOUT: %Op.ea3: %Op.type.a63 = struct_value () [concrete] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %empty_tuple.type, (%Destroy.impl_witness.1dc) [concrete] +// CHECK:STDOUT: %.346: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.ea3, @Op.2(%empty_tuple.type) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .Destroy = %Core.Destroy // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)] +// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -817,8 +1030,8 @@ fn G() { // CHECK:STDOUT: } // CHECK:STDOUT: %.loc8_38.1: ref %empty_tuple.type = temporary_storage // CHECK:STDOUT: %.loc8_38.2: ref %empty_tuple.type = temporary %.loc8_38.1, %F.call.loc8_38 -// CHECK:STDOUT: %tuple.loc8_38: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_38.3: %empty_tuple.type = converted %F.call.loc8_38, %tuple.loc8_38 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %tuple.loc8_38.1: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_38.3: %empty_tuple.type = converted %F.call.loc8_38, %tuple.loc8_38.1 [concrete = constants.%empty_tuple] // CHECK:STDOUT: %x: %empty_tuple.type = bind_name x, %.loc8_38.3 // CHECK:STDOUT: assign %y.var, %F.call.loc8_43 // CHECK:STDOUT: %.loc8_23.1: type = splice_block %.loc8_23.3 [concrete = constants.%empty_tuple.type] { @@ -832,9 +1045,30 @@ fn G() { // CHECK:STDOUT: } // CHECK:STDOUT: %.loc8_48.1: ref %empty_tuple.type = temporary_storage // CHECK:STDOUT: %.loc8_48.2: ref %empty_tuple.type = temporary %.loc8_48.1, %F.call.loc8_48 -// CHECK:STDOUT: %tuple.loc8_48: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_48.3: %empty_tuple.type = converted %F.call.loc8_48, %tuple.loc8_48 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %tuple.loc8_48.1: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_48.3: %empty_tuple.type = converted %F.call.loc8_48, %tuple.loc8_48.1 [concrete = constants.%empty_tuple] // CHECK:STDOUT: %z: %empty_tuple.type = bind_name z, %.loc8_48.3 +// CHECK:STDOUT: %impl.elem0.loc8_48: %.346 = impl_witness_access constants.%Destroy.impl_witness.1dc, element0 [concrete = constants.%Op.ea3] +// CHECK:STDOUT: %bound_method.loc8_48.1: = bound_method %.loc8_48.1, %impl.elem0.loc8_48 +// CHECK:STDOUT: %specific_fn.loc8_48: = specific_function %impl.elem0.loc8_48, @Op.2(constants.%empty_tuple.type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc8_48.2: = bound_method %.loc8_48.1, %specific_fn.loc8_48 +// CHECK:STDOUT: %tuple.loc8_48.2: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_48.4: %empty_tuple.type = converted %.loc8_48.1, %tuple.loc8_48.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %no_op.loc8_48: init %empty_tuple.type = call %bound_method.loc8_48.2(%.loc8_48.4) +// CHECK:STDOUT: %impl.elem0.loc8_38: %.346 = impl_witness_access constants.%Destroy.impl_witness.1dc, element0 [concrete = constants.%Op.ea3] +// CHECK:STDOUT: %bound_method.loc8_38.1: = bound_method %.loc8_38.1, %impl.elem0.loc8_38 +// CHECK:STDOUT: %specific_fn.loc8_38: = specific_function %impl.elem0.loc8_38, @Op.2(constants.%empty_tuple.type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc8_38.2: = bound_method %.loc8_38.1, %specific_fn.loc8_38 +// CHECK:STDOUT: %tuple.loc8_38.2: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_38.4: %empty_tuple.type = converted %.loc8_38.1, %tuple.loc8_38.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %no_op.loc8_38: init %empty_tuple.type = call %bound_method.loc8_38.2(%.loc8_38.4) +// CHECK:STDOUT: %impl.elem0.loc8_15: %.346 = impl_witness_access constants.%Destroy.impl_witness.1dc, element0 [concrete = constants.%Op.ea3] +// CHECK:STDOUT: %bound_method.loc8_15.1: = bound_method %y.var, %impl.elem0.loc8_15 +// CHECK:STDOUT: %specific_fn.loc8_15: = specific_function %impl.elem0.loc8_15, @Op.2(constants.%empty_tuple.type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc8_15.2: = bound_method %y.var, %specific_fn.loc8_15 +// CHECK:STDOUT: %tuple.loc8_15: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc8_15: %empty_tuple.type = converted %y.var, %tuple.loc8_15 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %no_op.loc8_15: init %empty_tuple.type = call %bound_method.loc8_15.2(%.loc8_15) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/driver/testdata/fail_flush_errors.carbon b/toolchain/driver/testdata/fail_flush_errors.carbon index 83c63427d5de..3210360ebe97 100644 --- a/toolchain/driver/testdata/fail_flush_errors.carbon +++ b/toolchain/driver/testdata/fail_flush_errors.carbon @@ -33,7 +33,7 @@ fn F() { undeclared2; // Add the name into the string table via a declaration rather than an expression. - if (true) { var undeclared3: () = (); } + if (true) { let undeclared3:! () = (); } // CHECK:STDERR: fail_flush_errors.carbon:[[@LINE+4]]:3: error: name `undeclared3` not found [NameNotFound] // CHECK:STDERR: undeclared3; // CHECK:STDERR: ^~~~~~~~~~~ diff --git a/toolchain/lower/handle_call.cpp b/toolchain/lower/handle_call.cpp index 29f1c210fd55..7926f13ce15a 100644 --- a/toolchain/lower/handle_call.cpp +++ b/toolchain/lower/handle_call.cpp @@ -256,7 +256,7 @@ static auto HandleBuiltinCall(FunctionContext& context, SemIR::InstId inst_id, CARBON_FATAL("No callee in function call."); case SemIR::BuiltinFunctionKind::NoOp: - CARBON_FATAL("NoOp is a constant expression and won't reach this."); + return; case SemIR::BuiltinFunctionKind::PrintChar: { auto* i32_type = llvm::IntegerType::getInt32Ty(context.llvm_context()); diff --git a/toolchain/lower/testdata/array/array_in_place.carbon b/toolchain/lower/testdata/array/array_in_place.carbon index aed16fb6c070..88ca78f3e9da 100644 --- a/toolchain/lower/testdata/array/array_in_place.carbon +++ b/toolchain/lower/testdata/array/array_in_place.carbon @@ -29,6 +29,32 @@ fn G() { // CHECK:STDOUT: call void @_CF.Main(ptr %.loc16_47.2.array.index), !dbg !9 // CHECK:STDOUT: %.loc16_47.4.array.index = getelementptr inbounds [2 x { i32, i32, i32 }], ptr %v.var, i32 0, i64 1, !dbg !8 // CHECK:STDOUT: call void @_CF.Main(ptr %.loc16_47.4.array.index), !dbg !10 +// CHECK:STDOUT: %tuple.elem0.loc16_47.1.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %.loc16_47.4.array.index, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: %.loc16_47.7 = load i32, ptr %tuple.elem0.loc16_47.1.tuple.elem, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.elem1.loc16_47.1.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %.loc16_47.4.array.index, i32 0, i32 1, !dbg !8 +// CHECK:STDOUT: %.loc16_47.8 = load i32, ptr %tuple.elem1.loc16_47.1.tuple.elem, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.elem2.loc16_47.1.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %.loc16_47.4.array.index, i32 0, i32 2, !dbg !8 +// CHECK:STDOUT: %.loc16_47.9 = load i32, ptr %tuple.elem2.loc16_47.1.tuple.elem, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.loc16_47.1 = alloca { i32, i32, i32 }, align 8, !dbg !8 +// CHECK:STDOUT: %tuple.loc16_47.11 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_47.1, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: store i32 %.loc16_47.7, ptr %tuple.loc16_47.11, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.loc16_47.12 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_47.1, i32 0, i32 1, !dbg !8 +// CHECK:STDOUT: store i32 %.loc16_47.8, ptr %tuple.loc16_47.12, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.loc16_47.13 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_47.1, i32 0, i32 2, !dbg !8 +// CHECK:STDOUT: store i32 %.loc16_47.9, ptr %tuple.loc16_47.13, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.elem0.loc16_47.2.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %.loc16_47.2.array.index, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: %.loc16_47.11 = load i32, ptr %tuple.elem0.loc16_47.2.tuple.elem, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.elem1.loc16_47.2.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %.loc16_47.2.array.index, i32 0, i32 1, !dbg !8 +// CHECK:STDOUT: %.loc16_47.12 = load i32, ptr %tuple.elem1.loc16_47.2.tuple.elem, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.elem2.loc16_47.2.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %.loc16_47.2.array.index, i32 0, i32 2, !dbg !8 +// CHECK:STDOUT: %.loc16_47.13 = load i32, ptr %tuple.elem2.loc16_47.2.tuple.elem, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.loc16_47.2 = alloca { i32, i32, i32 }, align 8, !dbg !8 +// CHECK:STDOUT: %tuple.loc16_47.24 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_47.2, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: store i32 %.loc16_47.11, ptr %tuple.loc16_47.24, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.loc16_47.25 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_47.2, i32 0, i32 1, !dbg !8 +// CHECK:STDOUT: store i32 %.loc16_47.12, ptr %tuple.loc16_47.25, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.loc16_47.26 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_47.2, i32 0, i32 2, !dbg !8 +// CHECK:STDOUT: store i32 %.loc16_47.13, ptr %tuple.loc16_47.26, align 4, !dbg !8 // CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/array/assign_return_value.carbon b/toolchain/lower/testdata/array/assign_return_value.carbon index 04607a27de70..fd21de7e4449 100644 --- a/toolchain/lower/testdata/array/assign_return_value.carbon +++ b/toolchain/lower/testdata/array/assign_return_value.carbon @@ -36,14 +36,23 @@ fn Run() { // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 8, ptr %t.var), !dbg !10 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 8, ptr %.loc16_28.1.temp), !dbg !11 // CHECK:STDOUT: call void @_CF.Main(ptr %.loc16_28.1.temp), !dbg !11 -// CHECK:STDOUT: %tuple.elem0.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %.loc16_28.1.temp, i32 0, i32 0, !dbg !11 -// CHECK:STDOUT: %.loc16_28.3 = load i32, ptr %tuple.elem0.tuple.elem, align 4, !dbg !11 +// CHECK:STDOUT: %tuple.elem0.loc16_28.1.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %.loc16_28.1.temp, i32 0, i32 0, !dbg !11 +// CHECK:STDOUT: %.loc16_28.3 = load i32, ptr %tuple.elem0.loc16_28.1.tuple.elem, align 4, !dbg !11 // CHECK:STDOUT: %.loc16_28.4.array.index = getelementptr inbounds [2 x i32], ptr %t.var, i32 0, i64 0, !dbg !11 // CHECK:STDOUT: store i32 %.loc16_28.3, ptr %.loc16_28.4.array.index, align 4, !dbg !11 -// CHECK:STDOUT: %tuple.elem1.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %.loc16_28.1.temp, i32 0, i32 1, !dbg !11 -// CHECK:STDOUT: %.loc16_28.6 = load i32, ptr %tuple.elem1.tuple.elem, align 4, !dbg !11 +// CHECK:STDOUT: %tuple.elem1.loc16_28.1.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %.loc16_28.1.temp, i32 0, i32 1, !dbg !11 +// CHECK:STDOUT: %.loc16_28.6 = load i32, ptr %tuple.elem1.loc16_28.1.tuple.elem, align 4, !dbg !11 // CHECK:STDOUT: %.loc16_28.7.array.index = getelementptr inbounds [2 x i32], ptr %t.var, i32 0, i64 1, !dbg !11 // CHECK:STDOUT: store i32 %.loc16_28.6, ptr %.loc16_28.7.array.index, align 4, !dbg !11 +// CHECK:STDOUT: %tuple.elem0.loc16_28.2.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %.loc16_28.1.temp, i32 0, i32 0, !dbg !11 +// CHECK:STDOUT: %.loc16_28.10 = load i32, ptr %tuple.elem0.loc16_28.2.tuple.elem, align 4, !dbg !11 +// CHECK:STDOUT: %tuple.elem1.loc16_28.2.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %.loc16_28.1.temp, i32 0, i32 1, !dbg !11 +// CHECK:STDOUT: %.loc16_28.11 = load i32, ptr %tuple.elem1.loc16_28.2.tuple.elem, align 4, !dbg !11 +// CHECK:STDOUT: %tuple = alloca { i32, i32 }, align 8, !dbg !11 +// CHECK:STDOUT: %tuple1 = getelementptr inbounds nuw { i32, i32 }, ptr %tuple, i32 0, i32 0, !dbg !11 +// CHECK:STDOUT: store i32 %.loc16_28.10, ptr %tuple1, align 4, !dbg !11 +// CHECK:STDOUT: %tuple2 = getelementptr inbounds nuw { i32, i32 }, ptr %tuple, i32 0, i32 1, !dbg !11 +// CHECK:STDOUT: store i32 %.loc16_28.11, ptr %tuple2, align 4, !dbg !11 // CHECK:STDOUT: ret void, !dbg !12 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/array/base.carbon b/toolchain/lower/testdata/array/base.carbon index dd15b8616f6c..33d03ab670d3 100644 --- a/toolchain/lower/testdata/array/base.carbon +++ b/toolchain/lower/testdata/array/base.carbon @@ -21,10 +21,10 @@ fn Run() { // CHECK:STDOUT: ; ModuleID = 'base.carbon' // CHECK:STDOUT: source_filename = "base.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @array.237.loc14_3 = internal constant [1 x i32] [i32 1] -// CHECK:STDOUT: @array.6a2.loc15_3 = internal constant [2 x double] [double 0x4026333333333334, double 2.200000e+00] -// CHECK:STDOUT: @array.1cb.loc16_3 = internal constant [5 x {}] zeroinitializer -// CHECK:STDOUT: @tuple.loc17_3 = internal constant { i32, i32, i32 } { i32 1, i32 2, i32 3 } +// CHECK:STDOUT: @array.237.loc14_3.1 = internal constant [1 x i32] [i32 1] +// CHECK:STDOUT: @array.6a2.loc15_3.1 = internal constant [2 x double] [double 0x4026333333333334, double 2.200000e+00] +// CHECK:STDOUT: @array.1cb.loc16_3.1 = internal constant [5 x {}] zeroinitializer +// CHECK:STDOUT: @tuple.loc17_3.1 = internal constant { i32, i32, i32 } { i32 1, i32 2, i32 3 } // CHECK:STDOUT: // CHECK:STDOUT: define void @main() !dbg !4 { // CHECK:STDOUT: entry: @@ -35,23 +35,23 @@ fn Run() { // CHECK:STDOUT: %e.var = alloca [3 x i32], align 4, !dbg !11 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 4, ptr %a.var), !dbg !7 // CHECK:STDOUT: %.loc14_29.3.array.index = getelementptr inbounds [1 x i32], ptr %a.var, i32 0, i64 0, !dbg !12 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %a.var, ptr align 4 @array.237.loc14_3, i64 4, i1 false), !dbg !7 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %a.var, ptr align 4 @array.237.loc14_3.1, i64 4, i1 false), !dbg !7 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 16, ptr %b.var), !dbg !8 // CHECK:STDOUT: %.loc15_37.2.array.index = getelementptr inbounds [2 x double], ptr %b.var, i32 0, i64 0, !dbg !13 // CHECK:STDOUT: %.loc15_37.4.array.index = getelementptr inbounds [2 x double], ptr %b.var, i32 0, i64 1, !dbg !13 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %b.var, ptr align 8 @array.6a2.loc15_3, i64 16, i1 false), !dbg !8 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %b.var, ptr align 8 @array.6a2.loc15_3.1, i64 16, i1 false), !dbg !8 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 0, ptr %c.var), !dbg !9 // CHECK:STDOUT: %.loc16_45.2.array.index = getelementptr inbounds [5 x {}], ptr %c.var, i32 0, i64 0, !dbg !14 // CHECK:STDOUT: %.loc16_45.4.array.index = getelementptr inbounds [5 x {}], ptr %c.var, i32 0, i64 1, !dbg !14 // CHECK:STDOUT: %.loc16_45.6.array.index = getelementptr inbounds [5 x {}], ptr %c.var, i32 0, i64 2, !dbg !14 // CHECK:STDOUT: %.loc16_45.8.array.index = getelementptr inbounds [5 x {}], ptr %c.var, i32 0, i64 3, !dbg !14 // CHECK:STDOUT: %.loc16_45.10.array.index = getelementptr inbounds [5 x {}], ptr %c.var, i32 0, i64 4, !dbg !14 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %c.var, ptr align 1 @array.1cb.loc16_3, i64 0, i1 false), !dbg !9 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %c.var, ptr align 1 @array.1cb.loc16_3.1, i64 0, i1 false), !dbg !9 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 12, ptr %d.var), !dbg !10 -// CHECK:STDOUT: %tuple.elem0.loc17.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %d.var, i32 0, i32 0, !dbg !15 -// CHECK:STDOUT: %tuple.elem1.loc17.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %d.var, i32 0, i32 1, !dbg !15 -// CHECK:STDOUT: %tuple.elem2.loc17.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %d.var, i32 0, i32 2, !dbg !15 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %d.var, ptr align 4 @tuple.loc17_3, i64 12, i1 false), !dbg !10 +// CHECK:STDOUT: %tuple.elem0.loc17_36.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %d.var, i32 0, i32 0, !dbg !15 +// CHECK:STDOUT: %tuple.elem1.loc17_36.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %d.var, i32 0, i32 1, !dbg !15 +// CHECK:STDOUT: %tuple.elem2.loc17_36.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %d.var, i32 0, i32 2, !dbg !15 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %d.var, ptr align 4 @tuple.loc17_3.1, i64 12, i1 false), !dbg !10 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 12, ptr %e.var), !dbg !11 // CHECK:STDOUT: %tuple.elem0.loc18.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %d.var, i32 0, i32 0, !dbg !16 // CHECK:STDOUT: %.loc18_26.1 = load i32, ptr %tuple.elem0.loc18.tuple.elem, align 4, !dbg !16 @@ -65,6 +65,19 @@ fn Run() { // CHECK:STDOUT: %.loc18_26.7 = load i32, ptr %tuple.elem2.loc18.tuple.elem, align 4, !dbg !16 // CHECK:STDOUT: %.loc18_26.8.array.index = getelementptr inbounds [3 x i32], ptr %e.var, i32 0, i64 2, !dbg !16 // CHECK:STDOUT: store i32 %.loc18_26.7, ptr %.loc18_26.8.array.index, align 4, !dbg !16 +// CHECK:STDOUT: %tuple.elem0.loc17_3.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %d.var, i32 0, i32 0, !dbg !10 +// CHECK:STDOUT: %.loc17_3.2 = load i32, ptr %tuple.elem0.loc17_3.tuple.elem, align 4, !dbg !10 +// CHECK:STDOUT: %tuple.elem1.loc17_3.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %d.var, i32 0, i32 1, !dbg !10 +// CHECK:STDOUT: %.loc17_3.3 = load i32, ptr %tuple.elem1.loc17_3.tuple.elem, align 4, !dbg !10 +// CHECK:STDOUT: %tuple.elem2.loc17_3.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %d.var, i32 0, i32 2, !dbg !10 +// CHECK:STDOUT: %.loc17_3.4 = load i32, ptr %tuple.elem2.loc17_3.tuple.elem, align 4, !dbg !10 +// CHECK:STDOUT: %tuple = alloca { i32, i32, i32 }, align 8, !dbg !10 +// CHECK:STDOUT: %tuple1 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple, i32 0, i32 0, !dbg !10 +// CHECK:STDOUT: store i32 %.loc17_3.2, ptr %tuple1, align 4, !dbg !10 +// CHECK:STDOUT: %tuple2 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple, i32 0, i32 1, !dbg !10 +// CHECK:STDOUT: store i32 %.loc17_3.3, ptr %tuple2, align 4, !dbg !10 +// CHECK:STDOUT: %tuple3 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple, i32 0, i32 2, !dbg !10 +// CHECK:STDOUT: store i32 %.loc17_3.4, ptr %tuple3, align 4, !dbg !10 // CHECK:STDOUT: ret void, !dbg !17 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/basics/numeric_literals.carbon b/toolchain/lower/testdata/basics/numeric_literals.carbon index 51e5f71de9a0..170f54c7b592 100644 --- a/toolchain/lower/testdata/basics/numeric_literals.carbon +++ b/toolchain/lower/testdata/basics/numeric_literals.carbon @@ -32,8 +32,8 @@ fn F() { // CHECK:STDOUT: ; ModuleID = 'numeric_literals.carbon' // CHECK:STDOUT: source_filename = "numeric_literals.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @array.712.loc16_3 = internal constant [4 x i32] [i32 8, i32 9, i32 8, i32 8] -// CHECK:STDOUT: @array.a2f.loc22_3 = internal constant [6 x double] [double 9.000000e-01, double 8.000000e+00, double 8.000000e+01, double 1.000000e+07, double 1.000000e+08, double 1.000000e-08] +// CHECK:STDOUT: @array.712.loc16_3.1 = internal constant [4 x i32] [i32 8, i32 9, i32 8, i32 8] +// CHECK:STDOUT: @array.a2f.loc22_3.1 = internal constant [6 x double] [double 9.000000e-01, double 8.000000e+00, double 8.000000e+01, double 1.000000e+07, double 1.000000e+08, double 1.000000e-08] // CHECK:STDOUT: // CHECK:STDOUT: define void @_CF.Main() !dbg !4 { // CHECK:STDOUT: entry: @@ -44,7 +44,7 @@ fn F() { // CHECK:STDOUT: %.loc21_3.6.array.index = getelementptr inbounds [4 x i32], ptr %ints.var, i32 0, i64 1, !dbg !9 // CHECK:STDOUT: %.loc21_3.9.array.index = getelementptr inbounds [4 x i32], ptr %ints.var, i32 0, i64 2, !dbg !9 // CHECK:STDOUT: %.loc21_3.12.array.index = getelementptr inbounds [4 x i32], ptr %ints.var, i32 0, i64 3, !dbg !9 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %ints.var, ptr align 4 @array.712.loc16_3, i64 16, i1 false), !dbg !7 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %ints.var, ptr align 4 @array.712.loc16_3.1, i64 16, i1 false), !dbg !7 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 48, ptr %floats.var), !dbg !8 // CHECK:STDOUT: %.loc29_3.2.array.index = getelementptr inbounds [6 x double], ptr %floats.var, i32 0, i64 0, !dbg !10 // CHECK:STDOUT: %.loc29_3.4.array.index = getelementptr inbounds [6 x double], ptr %floats.var, i32 0, i64 1, !dbg !10 @@ -52,7 +52,7 @@ fn F() { // CHECK:STDOUT: %.loc29_3.8.array.index = getelementptr inbounds [6 x double], ptr %floats.var, i32 0, i64 3, !dbg !10 // CHECK:STDOUT: %.loc29_3.10.array.index = getelementptr inbounds [6 x double], ptr %floats.var, i32 0, i64 4, !dbg !10 // CHECK:STDOUT: %.loc29_3.12.array.index = getelementptr inbounds [6 x double], ptr %floats.var, i32 0, i64 5, !dbg !10 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %floats.var, ptr align 8 @array.a2f.loc22_3, i64 48, i1 false), !dbg !8 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %floats.var, ptr align 8 @array.a2f.loc22_3.1, i64 48, i1 false), !dbg !8 // CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/builtins/no_op.carbon b/toolchain/lower/testdata/builtins/no_op.carbon index ca04fa29d834..a432ece3c718 100644 --- a/toolchain/lower/testdata/builtins/no_op.carbon +++ b/toolchain/lower/testdata/builtins/no_op.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/none.carbon +// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/destroy.carbon // // AUTOUPDATE // TIP: To test this file alone, run: diff --git a/toolchain/lower/testdata/builtins/types.carbon b/toolchain/lower/testdata/builtins/types.carbon index 5f52f783cf3f..146c47db6f00 100644 --- a/toolchain/lower/testdata/builtins/types.carbon +++ b/toolchain/lower/testdata/builtins/types.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/none.carbon +// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/destroy.carbon // // AUTOUPDATE // TIP: To test this file alone, run: @@ -36,6 +36,9 @@ fn F() { // CHECK:STDOUT: store double 0.000000e+00, ptr %f.var, align 8, !dbg !8 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 1, ptr %b.var), !dbg !9 // CHECK:STDOUT: store i1 false, ptr %b.var, align 1, !dbg !9 +// CHECK:STDOUT: %.loc22_3 = load i1, ptr %b.var, align 1, !dbg !9 +// CHECK:STDOUT: %.loc21_3 = load double, ptr %f.var, align 8, !dbg !8 +// CHECK:STDOUT: %.loc20_3 = load i32, ptr %i.var, align 4, !dbg !7 // CHECK:STDOUT: ret void, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/class/convert.carbon b/toolchain/lower/testdata/class/convert.carbon index 69070a2d3191..9bf55ddb3cc6 100644 --- a/toolchain/lower/testdata/class/convert.carbon +++ b/toolchain/lower/testdata/class/convert.carbon @@ -28,7 +28,7 @@ fn DoIt() { // CHECK:STDOUT: ; ModuleID = 'convert.carbon' // CHECK:STDOUT: source_filename = "convert.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @IntWrapper.val.loc24_3 = internal constant { i32 } { i32 42 } +// CHECK:STDOUT: @IntWrapper.val.loc24_3.1 = internal constant { i32 } { i32 42 } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @"_CConvert.IntWrapper.Main:ImplicitAs.Core"(ptr %self) !dbg !4 { // CHECK:STDOUT: entry: @@ -47,7 +47,7 @@ fn DoIt() { // CHECK:STDOUT: %w.var = alloca { i32 }, align 8, !dbg !12 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 4, ptr %w.var), !dbg !12 // CHECK:STDOUT: %.loc24_31.3.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 @IntWrapper.val.loc24_3, i64 4, i1 false), !dbg !12 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %w.var, ptr align 4 @IntWrapper.val.loc24_3.1, i64 4, i1 false), !dbg !12 // CHECK:STDOUT: %Convert.call = call i32 @"_CConvert.IntWrapper.Main:ImplicitAs.Core"(ptr %w.var), !dbg !14 // CHECK:STDOUT: call void @_CConsume.Main(i32 %Convert.call), !dbg !15 // CHECK:STDOUT: ret void, !dbg !16 diff --git a/toolchain/lower/testdata/class/virtual.carbon b/toolchain/lower/testdata/class/virtual.carbon index 4acd5f76e60a..d33d12240f1d 100644 --- a/toolchain/lower/testdata/class/virtual.carbon +++ b/toolchain/lower/testdata/class/virtual.carbon @@ -149,9 +149,9 @@ base class Base(T:! type) { // CHECK:STDOUT: // CHECK:STDOUT: @"_CIntermediate.Classes.$vtable" = external unnamed_addr constant ptr // CHECK:STDOUT: @"_CDerived.Classes.$vtable" = external unnamed_addr constant ptr -// CHECK:STDOUT: @Base.val.loc7_3 = internal constant {} zeroinitializer -// CHECK:STDOUT: @Intermediate.val.ec2.loc8_3 = internal constant { ptr, {} } { ptr @"_CIntermediate.Classes.$vtable", {} zeroinitializer } -// CHECK:STDOUT: @Derived.val.loc9_3 = internal constant { { ptr, {} } } { { ptr, {} } { ptr @"_CDerived.Classes.$vtable", {} zeroinitializer } } +// CHECK:STDOUT: @Base.val.loc7_3.1 = internal constant {} zeroinitializer +// CHECK:STDOUT: @Intermediate.val.ec2.loc8_3.1 = internal constant { ptr, {} } { ptr @"_CIntermediate.Classes.$vtable", {} zeroinitializer } +// CHECK:STDOUT: @Derived.val.loc9_3.1 = internal constant { { ptr, {} } } { { ptr, {} } { ptr @"_CDerived.Classes.$vtable", {} zeroinitializer } } // CHECK:STDOUT: // CHECK:STDOUT: define void @_CCreate.Create() !dbg !4 { // CHECK:STDOUT: entry: @@ -160,16 +160,16 @@ base class Base(T:! type) { // CHECK:STDOUT: %d.var = alloca { { ptr, {} } }, align 8, !dbg !9 // CHECK:STDOUT: %d2.var = alloca { { ptr, {} } }, align 8, !dbg !10 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 0, ptr %b.var), !dbg !7 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %b.var, ptr align 1 @Base.val.loc7_3, i64 0, i1 false), !dbg !7 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %b.var, ptr align 1 @Base.val.loc7_3.1, i64 0, i1 false), !dbg !7 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 8, ptr %i.var), !dbg !8 // CHECK:STDOUT: %.loc8_44.2.vptr = getelementptr inbounds nuw { ptr, {} }, ptr %i.var, i32 0, i32 0, !dbg !11 // CHECK:STDOUT: %.loc8_44.4.base = getelementptr inbounds nuw { ptr, {} }, ptr %i.var, i32 0, i32 1, !dbg !11 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %i.var, ptr align 8 @Intermediate.val.ec2.loc8_3, i64 8, i1 false), !dbg !8 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %i.var, ptr align 8 @Intermediate.val.ec2.loc8_3.1, i64 8, i1 false), !dbg !8 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 8, ptr %d.var), !dbg !9 // CHECK:STDOUT: %.loc9_49.2.base = getelementptr inbounds nuw { { ptr, {} } }, ptr %d.var, i32 0, i32 0, !dbg !12 // CHECK:STDOUT: %.loc9_48.2.vptr = getelementptr inbounds nuw { ptr, {} }, ptr %.loc9_49.2.base, i32 0, i32 0, !dbg !13 // CHECK:STDOUT: %.loc9_48.4.base = getelementptr inbounds nuw { ptr, {} }, ptr %.loc9_49.2.base, i32 0, i32 1, !dbg !13 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %d.var, ptr align 8 @Derived.val.loc9_3, i64 8, i1 false), !dbg !9 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %d.var, ptr align 8 @Derived.val.loc9_3.1, i64 8, i1 false), !dbg !9 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 8, ptr %d2.var), !dbg !10 // CHECK:STDOUT: ret void, !dbg !14 // CHECK:STDOUT: } @@ -228,7 +228,7 @@ base class Base(T:! type) { // CHECK:STDOUT: source_filename = "member_init.carbon" // CHECK:STDOUT: // CHECK:STDOUT: @"_CBase.MemberInit.$vtable" = unnamed_addr constant [1 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @_CFn.Base.MemberInit to i64), i64 ptrtoint (ptr @"_CBase.MemberInit.$vtable" to i64)) to i32)] -// CHECK:STDOUT: @Base.val.loc13_3 = internal constant { ptr, i32 } { ptr @"_CBase.MemberInit.$vtable", i32 3 } +// CHECK:STDOUT: @Base.val.loc13_3.1 = internal constant { ptr, i32 } { ptr @"_CBase.MemberInit.$vtable", i32 3 } // CHECK:STDOUT: // CHECK:STDOUT: define void @_CFn.Base.MemberInit(ptr %self) !dbg !4 { // CHECK:STDOUT: entry: @@ -253,7 +253,8 @@ base class Base(T:! type) { // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 16, ptr %u.var), !dbg !11 // CHECK:STDOUT: %.loc13_24.2.vptr = getelementptr inbounds nuw { ptr, i32 }, ptr %u.var, i32 0, i32 0, !dbg !15 // CHECK:STDOUT: %.loc13_24.5.m = getelementptr inbounds nuw { ptr, i32 }, ptr %u.var, i32 0, i32 1, !dbg !15 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %u.var, ptr align 8 @Base.val.loc13_3, i64 16, i1 false), !dbg !11 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %u.var, ptr align 8 @Base.val.loc13_3.1, i64 16, i1 false), !dbg !11 +// CHECK:STDOUT: %.loc10_3.2 = load i32, ptr %i.var, align 4, !dbg !9 // CHECK:STDOUT: ret void, !dbg !16 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -294,7 +295,7 @@ base class Base(T:! type) { // CHECK:STDOUT: // CHECK:STDOUT: @"_CBase.Main.$vtable" = unnamed_addr constant [1 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @_CF.Base.Main to i64), i64 ptrtoint (ptr @"_CBase.Main.$vtable" to i64)) to i32)] // CHECK:STDOUT: @"_CDerived.Main.$vtable" = unnamed_addr constant [1 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @_CF.Base.Main to i64), i64 ptrtoint (ptr @"_CDerived.Main.$vtable" to i64)) to i32)] -// CHECK:STDOUT: @Derived.val.loc13_3 = internal constant { { ptr } } { { ptr } { ptr @"_CDerived.Main.$vtable" } } +// CHECK:STDOUT: @Derived.val.loc13_3.1 = internal constant { { ptr } } { { ptr } { ptr @"_CDerived.Main.$vtable" } } // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CF.Base.Main(ptr) // CHECK:STDOUT: @@ -304,7 +305,7 @@ base class Base(T:! type) { // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 8, ptr %v.var), !dbg !7 // CHECK:STDOUT: %.loc13_32.2.base = getelementptr inbounds nuw { { ptr } }, ptr %v.var, i32 0, i32 0, !dbg !8 // CHECK:STDOUT: %.loc13_31.2.vptr = getelementptr inbounds nuw { ptr }, ptr %.loc13_32.2.base, i32 0, i32 0, !dbg !9 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %v.var, ptr align 8 @Derived.val.loc13_3, i64 8, i1 false), !dbg !7 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %v.var, ptr align 8 @Derived.val.loc13_3.1, i64 8, i1 false), !dbg !7 // CHECK:STDOUT: ret void, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -368,7 +369,7 @@ base class Base(T:! type) { // CHECK:STDOUT: // CHECK:STDOUT: @"_CBase.Main.$vtable" = unnamed_addr constant [1 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @_CF.Base.Main to i64), i64 ptrtoint (ptr @"_CBase.Main.$vtable" to i64)) to i32)] // CHECK:STDOUT: @"_CDerived.Main.$vtable" = unnamed_addr constant [1 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @_CF.Derived.Main to i64), i64 ptrtoint (ptr @"_CDerived.Main.$vtable" to i64)) to i32)] -// CHECK:STDOUT: @Derived.val.loc14_3 = internal constant { { ptr } } { { ptr } { ptr @"_CDerived.Main.$vtable" } } +// CHECK:STDOUT: @Derived.val.loc14_3.1 = internal constant { { ptr } } { { ptr } { ptr @"_CDerived.Main.$vtable" } } // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CF.Base.Main(ptr) // CHECK:STDOUT: @@ -380,7 +381,7 @@ base class Base(T:! type) { // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 8, ptr %v.var), !dbg !7 // CHECK:STDOUT: %.loc14_32.2.base = getelementptr inbounds nuw { { ptr } }, ptr %v.var, i32 0, i32 0, !dbg !8 // CHECK:STDOUT: %.loc14_31.2.vptr = getelementptr inbounds nuw { ptr }, ptr %.loc14_32.2.base, i32 0, i32 0, !dbg !9 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %v.var, ptr align 8 @Derived.val.loc14_3, i64 8, i1 false), !dbg !7 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %v.var, ptr align 8 @Derived.val.loc14_3.1, i64 8, i1 false), !dbg !7 // CHECK:STDOUT: %F.call.vtable = load ptr, ptr %v.var, align 8, !dbg !10 // CHECK:STDOUT: %F.call = call ptr @llvm.load.relative.i32(ptr %F.call.vtable, i32 0), !dbg !10 // CHECK:STDOUT: call void %F.call(ptr %v.var), !dbg !10 diff --git a/toolchain/lower/testdata/for/bindings.carbon b/toolchain/lower/testdata/for/bindings.carbon index 1bc71b627b01..51861e0b134a 100644 --- a/toolchain/lower/testdata/for/bindings.carbon +++ b/toolchain/lower/testdata/for/bindings.carbon @@ -32,7 +32,7 @@ fn For() { // CHECK:STDOUT: ; ModuleID = 'bindings.carbon' // CHECK:STDOUT: source_filename = "bindings.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @EmptyRange.val.loc25_3 = internal constant {} zeroinitializer +// CHECK:STDOUT: @EmptyRange.val.loc25_3.1 = internal constant {} zeroinitializer // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CF.Main(i32, ptr) // CHECK:STDOUT: @@ -44,7 +44,7 @@ fn For() { // CHECK:STDOUT: %n.var = alloca i32, align 4, !dbg !9 // CHECK:STDOUT: %.loc27_33.8.temp = alloca { i32, i32 }, align 8, !dbg !8 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 0, ptr %r.var), !dbg !7 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %r.var, ptr align 1 @EmptyRange.val.loc25_3, i64 0, i1 false), !dbg !7 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %r.var, ptr align 1 @EmptyRange.val.loc25_3.1, i64 0, i1 false), !dbg !7 // CHECK:STDOUT: call void @"_CNewCursor.EmptyRange.Main:Iterate.Core.29d34654e802e24e"(ptr %r.var), !dbg !8 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 0, ptr %var), !dbg !8 // CHECK:STDOUT: br label %for.next, !dbg !8 @@ -59,15 +59,25 @@ fn For() { // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 4, ptr %n.var), !dbg !9 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 8, ptr %.loc27_33.8.temp), !dbg !8 // CHECK:STDOUT: call void @_CGet.Optional.Core.29d34654e802e24e(ptr %.loc27_33.8.temp, ptr %.loc27_33.1.temp), !dbg !8 -// CHECK:STDOUT: %tuple.elem0.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %.loc27_33.8.temp, i32 0, i32 0, !dbg !8 -// CHECK:STDOUT: %tuple.elem1.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %.loc27_33.8.temp, i32 0, i32 1, !dbg !8 -// CHECK:STDOUT: %.loc27_33.11 = load i32, ptr %tuple.elem0.tuple.elem, align 4, !dbg !8 -// CHECK:STDOUT: %.loc27_33.12 = load i32, ptr %tuple.elem1.tuple.elem, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.elem0.loc27_33.1.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %.loc27_33.8.temp, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: %tuple.elem1.loc27_33.1.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %.loc27_33.8.temp, i32 0, i32 1, !dbg !8 +// CHECK:STDOUT: %.loc27_33.11 = load i32, ptr %tuple.elem0.loc27_33.1.tuple.elem, align 4, !dbg !8 +// CHECK:STDOUT: %.loc27_33.12 = load i32, ptr %tuple.elem1.loc27_33.1.tuple.elem, align 4, !dbg !8 // CHECK:STDOUT: store i32 %.loc27_33.12, ptr %n.var, align 4, !dbg !9 // CHECK:STDOUT: call void @_CF.Main(i32 %.loc27_33.11, ptr %n.var), !dbg !10 // CHECK:STDOUT: br label %for.next, !dbg !11 // CHECK:STDOUT: // CHECK:STDOUT: for.done: ; preds = %for.next +// CHECK:STDOUT: %tuple.elem0.loc27_33.2.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %.loc27_33.8.temp, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: %.loc27_33.13 = load i32, ptr %tuple.elem0.loc27_33.2.tuple.elem, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.elem1.loc27_33.2.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %.loc27_33.8.temp, i32 0, i32 1, !dbg !8 +// CHECK:STDOUT: %.loc27_33.14 = load i32, ptr %tuple.elem1.loc27_33.2.tuple.elem, align 4, !dbg !8 +// CHECK:STDOUT: %tuple = alloca { i32, i32 }, align 8, !dbg !8 +// CHECK:STDOUT: %tuple1 = getelementptr inbounds nuw { i32, i32 }, ptr %tuple, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: store i32 %.loc27_33.13, ptr %tuple1, align 4, !dbg !8 +// CHECK:STDOUT: %tuple2 = getelementptr inbounds nuw { i32, i32 }, ptr %tuple, i32 0, i32 1, !dbg !8 +// CHECK:STDOUT: store i32 %.loc27_33.14, ptr %tuple2, align 4, !dbg !8 +// CHECK:STDOUT: %.loc27_17 = load i32, ptr %n.var, align 4, !dbg !9 // CHECK:STDOUT: ret void, !dbg !12 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/for/break_continue.carbon b/toolchain/lower/testdata/for/break_continue.carbon index e0a55547d095..c4a1283d91a5 100644 --- a/toolchain/lower/testdata/for/break_continue.carbon +++ b/toolchain/lower/testdata/for/break_continue.carbon @@ -35,7 +35,7 @@ fn For() { // CHECK:STDOUT: ; ModuleID = 'break_continue.carbon' // CHECK:STDOUT: source_filename = "break_continue.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @EmptyRange.val.loc27_3 = internal constant {} zeroinitializer +// CHECK:STDOUT: @EmptyRange.val.loc27_3.1 = internal constant {} zeroinitializer // CHECK:STDOUT: // CHECK:STDOUT: declare i1 @_CF.Main() // CHECK:STDOUT: @@ -49,7 +49,7 @@ fn For() { // CHECK:STDOUT: %var = alloca {}, align 8, !dbg !8 // CHECK:STDOUT: %.loc28_19.1.temp = alloca { i1, i32 }, align 8, !dbg !8 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 0, ptr %r.var), !dbg !7 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %r.var, ptr align 1 @EmptyRange.val.loc27_3, i64 0, i1 false), !dbg !7 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %r.var, ptr align 1 @EmptyRange.val.loc27_3.1, i64 0, i1 false), !dbg !7 // CHECK:STDOUT: call void @"_CNewCursor.EmptyRange.Main:Iterate.Core.b88d1103f417c6d4"(ptr %r.var), !dbg !8 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 0, ptr %var), !dbg !8 // CHECK:STDOUT: br label %for.next, !dbg !8 diff --git a/toolchain/lower/testdata/for/for.carbon b/toolchain/lower/testdata/for/for.carbon index a6bcd751c581..351096df2dd4 100644 --- a/toolchain/lower/testdata/for/for.carbon +++ b/toolchain/lower/testdata/for/for.carbon @@ -36,7 +36,7 @@ fn For() { // CHECK:STDOUT: ; ModuleID = 'for.carbon' // CHECK:STDOUT: source_filename = "for.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @EmptyRange.val.loc27_3 = internal constant {} zeroinitializer +// CHECK:STDOUT: @EmptyRange.val.loc27_3.1 = internal constant {} zeroinitializer // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CF.Main() // CHECK:STDOUT: @@ -50,7 +50,7 @@ fn For() { // CHECK:STDOUT: %var = alloca {}, align 8, !dbg !8 // CHECK:STDOUT: %.loc30_19.1.temp = alloca { i1, i32 }, align 8, !dbg !8 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 0, ptr %r.var), !dbg !7 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %r.var, ptr align 1 @EmptyRange.val.loc27_3, i64 0, i1 false), !dbg !7 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %r.var, ptr align 1 @EmptyRange.val.loc27_3.1, i64 0, i1 false), !dbg !7 // CHECK:STDOUT: call void @_CF.Main(), !dbg !9 // CHECK:STDOUT: call void @"_CNewCursor.EmptyRange.Main:Iterate.Core.b88d1103f417c6d4"(ptr %r.var), !dbg !8 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 0, ptr %var), !dbg !8 diff --git a/toolchain/lower/testdata/function/call/i32.carbon b/toolchain/lower/testdata/function/call/i32.carbon index 80d5914bff63..529809aa1dd4 100644 --- a/toolchain/lower/testdata/function/call/i32.carbon +++ b/toolchain/lower/testdata/function/call/i32.carbon @@ -32,6 +32,7 @@ fn Main() { // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 4, ptr %b.var), !dbg !9 // CHECK:STDOUT: %Echo.call = call i32 @_CEcho.Main(i32 1), !dbg !10 // CHECK:STDOUT: store i32 %Echo.call, ptr %b.var, align 4, !dbg !9 +// CHECK:STDOUT: %.loc18_3 = load i32, ptr %b.var, align 4, !dbg !9 // CHECK:STDOUT: ret void, !dbg !11 // 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 97045f5eb2d1..a4090ea3559e 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 @@ -44,6 +44,19 @@ fn Main() { // CHECK:STDOUT: %.loc18_21.1.temp = alloca { i32, i32, i32 }, align 8, !dbg !13 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 12, ptr %.loc18_21.1.temp), !dbg !13 // CHECK:STDOUT: call void @_CF.Main(ptr %.loc18_21.1.temp, { i32 } { i32 1 }, ptr @tuple.11a.loc18_20.6), !dbg !13 +// CHECK:STDOUT: %tuple.elem0.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %.loc18_21.1.temp, i32 0, i32 0, !dbg !13 +// CHECK:STDOUT: %.loc18_21.3 = load i32, ptr %tuple.elem0.tuple.elem, align 4, !dbg !13 +// CHECK:STDOUT: %tuple.elem1.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %.loc18_21.1.temp, i32 0, i32 1, !dbg !13 +// CHECK:STDOUT: %.loc18_21.4 = load i32, ptr %tuple.elem1.tuple.elem, align 4, !dbg !13 +// CHECK:STDOUT: %tuple.elem2.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %.loc18_21.1.temp, i32 0, i32 2, !dbg !13 +// CHECK:STDOUT: %.loc18_21.5 = load i32, ptr %tuple.elem2.tuple.elem, align 4, !dbg !13 +// CHECK:STDOUT: %tuple.loc18_21 = alloca { i32, i32, i32 }, align 8, !dbg !13 +// CHECK:STDOUT: %tuple.loc18_211 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc18_21, i32 0, i32 0, !dbg !13 +// CHECK:STDOUT: store i32 %.loc18_21.3, ptr %tuple.loc18_211, align 4, !dbg !13 +// CHECK:STDOUT: %tuple.loc18_212 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc18_21, i32 0, i32 1, !dbg !13 +// CHECK:STDOUT: store i32 %.loc18_21.4, ptr %tuple.loc18_212, align 4, !dbg !13 +// CHECK:STDOUT: %tuple.loc18_213 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc18_21, i32 0, i32 2, !dbg !13 +// CHECK:STDOUT: store i32 %.loc18_21.5, ptr %tuple.loc18_213, align 4, !dbg !13 // CHECK:STDOUT: ret void, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/call/var_param.carbon b/toolchain/lower/testdata/function/call/var_param.carbon index 9cce2bd59a64..5532e2b7646a 100644 --- a/toolchain/lower/testdata/function/call/var_param.carbon +++ b/toolchain/lower/testdata/function/call/var_param.carbon @@ -32,6 +32,7 @@ fn Main() { // CHECK:STDOUT: store i32 0, ptr %a.var, align 4, !dbg !9 // CHECK:STDOUT: %.loc17 = load i32, ptr %a.var, align 4, !dbg !10 // CHECK:STDOUT: call void @_CDoNothing.Main(i32 %.loc17), !dbg !11 +// CHECK:STDOUT: %.loc16_3.2 = load i32, ptr %a.var, align 4, !dbg !9 // CHECK:STDOUT: ret void, !dbg !12 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/generic/call.carbon b/toolchain/lower/testdata/function/generic/call.carbon index 9cda80f7df75..901e03cfe955 100644 --- a/toolchain/lower/testdata/function/generic/call.carbon +++ b/toolchain/lower/testdata/function/generic/call.carbon @@ -34,8 +34,8 @@ fn G() { // CHECK:STDOUT: // CHECK:STDOUT: %type = type {} // CHECK:STDOUT: -// CHECK:STDOUT: @C.val.loc20_3 = internal constant {} zeroinitializer -// CHECK:STDOUT: @D.val.loc21_3 = internal constant {} zeroinitializer +// CHECK:STDOUT: @C.val.loc20_3.1 = internal constant {} zeroinitializer +// CHECK:STDOUT: @D.val.loc21_3.1 = internal constant {} zeroinitializer // CHECK:STDOUT: // CHECK:STDOUT: define void @_CG.Main() !dbg !4 { // CHECK:STDOUT: entry: @@ -44,9 +44,9 @@ fn G() { // CHECK:STDOUT: %n.var = alloca i32, align 4, !dbg !9 // CHECK:STDOUT: %m.var = alloca double, align 8, !dbg !10 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 0, ptr %c.var), !dbg !7 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %c.var, ptr align 1 @C.val.loc20_3, i64 0, i1 false), !dbg !7 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %c.var, ptr align 1 @C.val.loc20_3.1, i64 0, i1 false), !dbg !7 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 0, ptr %d.var), !dbg !8 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %d.var, ptr align 1 @D.val.loc21_3, i64 0, i1 false), !dbg !8 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %d.var, ptr align 1 @D.val.loc21_3.1, i64 0, i1 false), !dbg !8 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 4, ptr %n.var), !dbg !9 // CHECK:STDOUT: store i32 0, ptr %n.var, align 4, !dbg !9 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 8, ptr %m.var), !dbg !10 @@ -58,6 +58,8 @@ fn G() { // CHECK:STDOUT: %.loc28 = load double, ptr %m.var, align 8, !dbg !15 // CHECK:STDOUT: call void @_CF.Main.66be507887ceee78(double %.loc28), !dbg !16 // CHECK:STDOUT: call void @_CF.Main.5754c7a55c7cbe4a(%type zeroinitializer), !dbg !17 +// CHECK:STDOUT: %.loc23_3 = load double, ptr %m.var, align 8, !dbg !10 +// CHECK:STDOUT: %.loc22_3.2 = load i32, ptr %n.var, align 4, !dbg !9 // CHECK:STDOUT: ret void, !dbg !18 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/generic/call_basic.carbon b/toolchain/lower/testdata/function/generic/call_basic.carbon index 0a9525b63a29..0b8ba920b351 100644 --- a/toolchain/lower/testdata/function/generic/call_basic.carbon +++ b/toolchain/lower/testdata/function/generic/call_basic.carbon @@ -81,6 +81,10 @@ fn M() { // CHECK:STDOUT: %.loc54 = load double, ptr %p.var, align 8, !dbg !18 // CHECK:STDOUT: %G.call.loc54 = call double @_CG.Main.66be507887ceee78(double %.loc54), !dbg !19 // CHECK:STDOUT: store double %G.call.loc54, ptr %q.var, align 8, !dbg !20 +// CHECK:STDOUT: %.loc49_3 = load double, ptr %q.var, align 8, !dbg !10 +// CHECK:STDOUT: %.loc48_3 = load double, ptr %p.var, align 8, !dbg !9 +// CHECK:STDOUT: %.loc47_3 = load i32, ptr %m.var, align 4, !dbg !8 +// CHECK:STDOUT: %.loc46_3.2 = load i32, ptr %n.var, align 4, !dbg !7 // CHECK:STDOUT: ret void, !dbg !21 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/generic/call_basic_depth.carbon b/toolchain/lower/testdata/function/generic/call_basic_depth.carbon index 704963df661b..f24f05fd0da8 100644 --- a/toolchain/lower/testdata/function/generic/call_basic_depth.carbon +++ b/toolchain/lower/testdata/function/generic/call_basic_depth.carbon @@ -50,6 +50,8 @@ fn M() { // CHECK:STDOUT: %.loc35 = load i32, ptr %n.var, align 4, !dbg !11 // CHECK:STDOUT: %G.call = call i32 @_CG.Main.b88d1103f417c6d4(i32 %.loc35), !dbg !12 // CHECK:STDOUT: store i32 %G.call, ptr %m.var, align 4, !dbg !13 +// CHECK:STDOUT: %.loc32_3 = load i32, ptr %m.var, align 4, !dbg !8 +// CHECK:STDOUT: %.loc31_3.2 = load i32, ptr %n.var, align 4, !dbg !7 // CHECK:STDOUT: ret void, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/generic/call_dedup_ptr.carbon b/toolchain/lower/testdata/function/generic/call_dedup_ptr.carbon index 5497cd990ea0..ca96e80db515 100644 --- a/toolchain/lower/testdata/function/generic/call_dedup_ptr.carbon +++ b/toolchain/lower/testdata/function/generic/call_dedup_ptr.carbon @@ -43,6 +43,9 @@ fn M() { // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 8, ptr %ptr_i8.var), !dbg !9 // CHECK:STDOUT: %.loc26 = load ptr, ptr %ptr_i8.var, align 8, !dbg !14 // CHECK:STDOUT: %F.call.loc26 = call ptr @_CF.Main.e8193710fd35b608(ptr %.loc26), !dbg !15 +// CHECK:STDOUT: %.loc25_3 = load ptr, ptr %ptr_i8.var, align 8, !dbg !9 +// CHECK:STDOUT: %.loc23_3 = load ptr, ptr %ptr_f64.var, align 8, !dbg !8 +// CHECK:STDOUT: %.loc21_3 = load ptr, ptr %ptr_i32.var, align 8, !dbg !7 // CHECK:STDOUT: ret void, !dbg !16 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/generic/call_deref_ptr.carbon b/toolchain/lower/testdata/function/generic/call_deref_ptr.carbon index 8a389a110f15..a8157ad7b9c0 100644 --- a/toolchain/lower/testdata/function/generic/call_deref_ptr.carbon +++ b/toolchain/lower/testdata/function/generic/call_deref_ptr.carbon @@ -56,6 +56,8 @@ fn M() { // CHECK:STDOUT: call void @_CF.Main.b88d1103f417c6d4(ptr %.loc39), !dbg !10 // CHECK:STDOUT: %.loc40 = load ptr, ptr %ptr_f64.var, align 8, !dbg !11 // CHECK:STDOUT: call void @_CF.Main.66be507887ceee78(ptr %.loc40), !dbg !12 +// CHECK:STDOUT: %.loc37_3 = load ptr, ptr %ptr_f64.var, align 8, !dbg !8 +// CHECK:STDOUT: %.loc36_3 = load ptr, ptr %ptr_i32.var, align 8, !dbg !7 // CHECK:STDOUT: ret void, !dbg !13 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/generic/call_different_associated_const.carbon b/toolchain/lower/testdata/function/generic/call_different_associated_const.carbon index 160137c6aa5d..3b15e17af4c2 100644 --- a/toolchain/lower/testdata/function/generic/call_different_associated_const.carbon +++ b/toolchain/lower/testdata/function/generic/call_different_associated_const.carbon @@ -52,6 +52,7 @@ fn H() { // CHECK:STDOUT: entry: // CHECK:STDOUT: %x.var = alloca i1, align 1, !dbg !11 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 1, ptr %x.var), !dbg !11 +// CHECK:STDOUT: %.loc23_3.1 = load i1, ptr %x.var, align 1, !dbg !11 // CHECK:STDOUT: ret void, !dbg !12 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -59,6 +60,7 @@ fn H() { // CHECK:STDOUT: entry: // CHECK:STDOUT: %x.var = alloca i32, align 4, !dbg !14 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 4, ptr %x.var), !dbg !14 +// CHECK:STDOUT: %.loc23_3.1 = load i32, ptr %x.var, align 4, !dbg !14 // CHECK:STDOUT: ret void, !dbg !15 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/generic/call_different_specific.carbon b/toolchain/lower/testdata/function/generic/call_different_specific.carbon index e257886e5793..74c038f211b4 100644 --- a/toolchain/lower/testdata/function/generic/call_different_specific.carbon +++ b/toolchain/lower/testdata/function/generic/call_different_specific.carbon @@ -61,6 +61,8 @@ fn M() { // CHECK:STDOUT: call void @_CF.Main.b88d1103f417c6d4(ptr %.loc44), !dbg !10 // CHECK:STDOUT: %.loc45 = load ptr, ptr %ptr_f64.var, align 8, !dbg !11 // CHECK:STDOUT: call void @_CF.Main.66be507887ceee78(ptr %.loc45), !dbg !12 +// CHECK:STDOUT: %.loc42_3 = load ptr, ptr %ptr_f64.var, align 8, !dbg !8 +// CHECK:STDOUT: %.loc41_3 = load ptr, ptr %ptr_i32.var, align 8, !dbg !7 // CHECK:STDOUT: ret void, !dbg !13 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/generic/call_recursive_basic.carbon b/toolchain/lower/testdata/function/generic/call_recursive_basic.carbon index b0248c20821b..49b226164ec2 100644 --- a/toolchain/lower/testdata/function/generic/call_recursive_basic.carbon +++ b/toolchain/lower/testdata/function/generic/call_recursive_basic.carbon @@ -60,6 +60,10 @@ fn M() { // CHECK:STDOUT: %F.call.loc30 = call ptr @_CF.Main.e8193710fd35b608(ptr %.loc30_5, i32 0), !dbg !16 // CHECK:STDOUT: %.loc31_5 = load ptr, ptr %ptr_f64.var, align 8, !dbg !17 // CHECK:STDOUT: %F.call.loc31 = call ptr @_CF.Main.e8193710fd35b608(ptr %.loc31_5, i32 0), !dbg !18 +// CHECK:STDOUT: %.loc26_3 = load ptr, ptr %ptr_f64.var, align 8, !dbg !10 +// CHECK:STDOUT: %.loc25_3 = load ptr, ptr %ptr_i32.var, align 8, !dbg !9 +// CHECK:STDOUT: %.loc24_3 = load double, ptr %m.var, align 8, !dbg !8 +// CHECK:STDOUT: %.loc23_3.2 = load i32, ptr %n.var, align 4, !dbg !7 // CHECK:STDOUT: ret void, !dbg !19 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/generic/call_recursive_diamond.carbon b/toolchain/lower/testdata/function/generic/call_recursive_diamond.carbon index e7624a1d0538..dff137f2f61c 100644 --- a/toolchain/lower/testdata/function/generic/call_recursive_diamond.carbon +++ b/toolchain/lower/testdata/function/generic/call_recursive_diamond.carbon @@ -79,6 +79,10 @@ fn M() { // CHECK:STDOUT: %A.call.loc53 = call ptr @_CA.Main.e8193710fd35b608(ptr %.loc53_5, i32 0), !dbg !16 // CHECK:STDOUT: %.loc54_5 = load ptr, ptr %ptr_f64.var, align 8, !dbg !17 // CHECK:STDOUT: %A.call.loc54 = call ptr @_CA.Main.e8193710fd35b608(ptr %.loc54_5, i32 0), !dbg !18 +// CHECK:STDOUT: %.loc49_3 = load ptr, ptr %ptr_f64.var, align 8, !dbg !10 +// CHECK:STDOUT: %.loc48_3 = load ptr, ptr %ptr_i32.var, align 8, !dbg !9 +// CHECK:STDOUT: %.loc47_3 = load double, ptr %m.var, align 8, !dbg !8 +// CHECK:STDOUT: %.loc46_3.2 = load i32, ptr %n.var, align 4, !dbg !7 // CHECK:STDOUT: ret void, !dbg !19 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/generic/call_recursive_mutual.carbon b/toolchain/lower/testdata/function/generic/call_recursive_mutual.carbon index 72e95a28764f..332ce1fd9c8a 100644 --- a/toolchain/lower/testdata/function/generic/call_recursive_mutual.carbon +++ b/toolchain/lower/testdata/function/generic/call_recursive_mutual.carbon @@ -62,6 +62,10 @@ fn M() { // CHECK:STDOUT: %F.call.loc38 = call ptr @_CF.Main.e8193710fd35b608(ptr %.loc38_5, i32 0), !dbg !16 // CHECK:STDOUT: %.loc39_5 = load ptr, ptr %ptr_f64.var, align 8, !dbg !17 // CHECK:STDOUT: %F.call.loc39 = call ptr @_CF.Main.e8193710fd35b608(ptr %.loc39_5, i32 0), !dbg !18 +// CHECK:STDOUT: %.loc34_3 = load ptr, ptr %ptr_f64.var, align 8, !dbg !10 +// CHECK:STDOUT: %.loc33_3 = load ptr, ptr %ptr_i32.var, align 8, !dbg !9 +// CHECK:STDOUT: %.loc32_3 = load double, ptr %m.var, align 8, !dbg !8 +// CHECK:STDOUT: %.loc31_3.2 = load i32, ptr %n.var, align 4, !dbg !7 // CHECK:STDOUT: ret void, !dbg !19 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/generic/call_recursive_reorder.carbon b/toolchain/lower/testdata/function/generic/call_recursive_reorder.carbon index facd1949389d..76d136ba0082 100644 --- a/toolchain/lower/testdata/function/generic/call_recursive_reorder.carbon +++ b/toolchain/lower/testdata/function/generic/call_recursive_reorder.carbon @@ -43,6 +43,9 @@ fn M() { // CHECK:STDOUT: %.loc26_5 = load ptr, ptr %ptr_f64.var, align 8, !dbg !13 // CHECK:STDOUT: %.loc26_14 = load ptr, ptr %ptr_bool.var, align 8, !dbg !14 // CHECK:STDOUT: %F.call.loc26 = call i32 @_CF.Main.2fe87eb83f5a4614(ptr %.loc26_5, ptr %.loc26_14, i32 0), !dbg !15 +// CHECK:STDOUT: %.loc23_3 = load ptr, ptr %ptr_bool.var, align 8, !dbg !9 +// CHECK:STDOUT: %.loc22_3 = load ptr, ptr %ptr_f64.var, align 8, !dbg !8 +// CHECK:STDOUT: %.loc21_3 = load ptr, ptr %ptr_i32.var, align 8, !dbg !7 // CHECK:STDOUT: ret void, !dbg !16 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/generic/call_recursive_reorder_more.carbon b/toolchain/lower/testdata/function/generic/call_recursive_reorder_more.carbon index fdb967af63bf..0046458ac2d8 100644 --- a/toolchain/lower/testdata/function/generic/call_recursive_reorder_more.carbon +++ b/toolchain/lower/testdata/function/generic/call_recursive_reorder_more.carbon @@ -121,6 +121,15 @@ fn M() { // CHECK:STDOUT: %.loc50_15 = load ptr, ptr %ptr_bool.var, align 8, !dbg !61 // CHECK:STDOUT: %.loc50_25 = load ptr, ptr %ptr_bool.var, align 8, !dbg !62 // CHECK:STDOUT: %F.call.loc50 = call i32 @_CF.Main.7776e910959584d9(ptr %.loc50_5, ptr %.loc50_15, ptr %.loc50_25, i32 0), !dbg !63 +// CHECK:STDOUT: %.loc30_3 = load ptr, ptr %ptr_bool.var, align 8, !dbg !15 +// CHECK:STDOUT: %.loc29_3 = load ptr, ptr %ptr_i64.var, align 8, !dbg !14 +// CHECK:STDOUT: %.loc28_3 = load ptr, ptr %ptr_i32.var, align 8, !dbg !13 +// CHECK:STDOUT: %.loc27_3 = load ptr, ptr %ptr_i16.var, align 8, !dbg !12 +// CHECK:STDOUT: %.loc25_3 = load i1, ptr %val_bool.var, align 1, !dbg !11 +// CHECK:STDOUT: %.loc24_3 = load double, ptr %val_f64.var, align 8, !dbg !10 +// CHECK:STDOUT: %.loc23_3 = load i64, ptr %val_i64.var, align 4, !dbg !9 +// CHECK:STDOUT: %.loc22_3 = load i32, ptr %val_i32.var, align 4, !dbg !8 +// CHECK:STDOUT: %.loc21_3 = load i16, ptr %val_i16.var, align 2, !dbg !7 // CHECK:STDOUT: ret void, !dbg !64 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/generic/call_recursive_sccs_deep.carbon b/toolchain/lower/testdata/function/generic/call_recursive_sccs_deep.carbon index ca47e56a472c..711068efb1d3 100644 --- a/toolchain/lower/testdata/function/generic/call_recursive_sccs_deep.carbon +++ b/toolchain/lower/testdata/function/generic/call_recursive_sccs_deep.carbon @@ -106,6 +106,10 @@ fn M() { // CHECK:STDOUT: %A.call.loc79 = call ptr @_CA.Main.e8193710fd35b608(ptr %.loc79_5, i32 0), !dbg !16 // CHECK:STDOUT: %.loc80_5 = load ptr, ptr %ptr_f64.var, align 8, !dbg !17 // CHECK:STDOUT: %A.call.loc80 = call ptr @_CA.Main.e8193710fd35b608(ptr %.loc80_5, i32 0), !dbg !18 +// CHECK:STDOUT: %.loc75_3 = load ptr, ptr %ptr_f64.var, align 8, !dbg !10 +// CHECK:STDOUT: %.loc74_3 = load ptr, ptr %ptr_i32.var, align 8, !dbg !9 +// CHECK:STDOUT: %.loc73_3 = load double, ptr %m.var, align 8, !dbg !8 +// CHECK:STDOUT: %.loc72_3.2 = load i32, ptr %n.var, align 4, !dbg !7 // CHECK:STDOUT: ret void, !dbg !19 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/generic/call_specific_in_class.carbon b/toolchain/lower/testdata/function/generic/call_specific_in_class.carbon index a221460893b6..ebff41ae467d 100644 --- a/toolchain/lower/testdata/function/generic/call_specific_in_class.carbon +++ b/toolchain/lower/testdata/function/generic/call_specific_in_class.carbon @@ -76,6 +76,11 @@ fn M() { // CHECK:STDOUT: %F.call.loc42 = call double @_CF.Main.66be507887ceee78(double %.loc42), !dbg !22 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 0, ptr %c.var), !dbg !12 // CHECK:STDOUT: %F.call.loc44 = call %type @_CF.Main.5754c7a55c7cbe4a(%type zeroinitializer), !dbg !23 +// CHECK:STDOUT: %.loc41_3 = load double, ptr %var_f64.var, align 8, !dbg !11 +// CHECK:STDOUT: %.loc39_3.2 = load i32, ptr %var_i32.var, align 4, !dbg !10 +// CHECK:STDOUT: %.loc37_3 = load ptr, ptr %ptr_i8.var, align 8, !dbg !9 +// CHECK:STDOUT: %.loc35_3 = load ptr, ptr %ptr_f64.var, align 8, !dbg !8 +// CHECK:STDOUT: %.loc33_3 = load ptr, ptr %ptr_i32.var, align 8, !dbg !7 // CHECK:STDOUT: ret void, !dbg !24 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/index/array_element_access.carbon b/toolchain/lower/testdata/index/array_element_access.carbon index cd0865bda910..79b7336f4f96 100644 --- a/toolchain/lower/testdata/index/array_element_access.carbon +++ b/toolchain/lower/testdata/index/array_element_access.carbon @@ -53,12 +53,12 @@ fn Run() { // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 8, ptr %a.var), !dbg !13 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 8, ptr %.loc17_28.1.temp), !dbg !14 // CHECK:STDOUT: call void @_CA.Main(ptr %.loc17_28.1.temp), !dbg !14 -// CHECK:STDOUT: %tuple.elem0.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %.loc17_28.1.temp, i32 0, i32 0, !dbg !14 -// CHECK:STDOUT: %.loc17_28.3 = load i32, ptr %tuple.elem0.tuple.elem, align 4, !dbg !14 +// CHECK:STDOUT: %tuple.elem0.loc17_28.1.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %.loc17_28.1.temp, i32 0, i32 0, !dbg !14 +// CHECK:STDOUT: %.loc17_28.3 = load i32, ptr %tuple.elem0.loc17_28.1.tuple.elem, align 4, !dbg !14 // CHECK:STDOUT: %.loc17_28.4.array.index = getelementptr inbounds [2 x i32], ptr %a.var, i32 0, i64 0, !dbg !14 // CHECK:STDOUT: store i32 %.loc17_28.3, ptr %.loc17_28.4.array.index, align 4, !dbg !14 -// CHECK:STDOUT: %tuple.elem1.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %.loc17_28.1.temp, i32 0, i32 1, !dbg !14 -// CHECK:STDOUT: %.loc17_28.6 = load i32, ptr %tuple.elem1.tuple.elem, align 4, !dbg !14 +// CHECK:STDOUT: %tuple.elem1.loc17_28.1.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %.loc17_28.1.temp, i32 0, i32 1, !dbg !14 +// CHECK:STDOUT: %.loc17_28.6 = load i32, ptr %tuple.elem1.loc17_28.1.tuple.elem, align 4, !dbg !14 // CHECK:STDOUT: %.loc17_28.7.array.index = getelementptr inbounds [2 x i32], ptr %a.var, i32 0, i64 1, !dbg !14 // CHECK:STDOUT: store i32 %.loc17_28.6, ptr %.loc17_28.7.array.index, align 4, !dbg !14 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 4, ptr %b.var), !dbg !15 @@ -74,6 +74,18 @@ fn Run() { // CHECK:STDOUT: %.loc20_21.1.array.index = getelementptr inbounds [2 x i32], ptr %.loc20_18.1.temp, i32 0, i32 1, !dbg !18 // CHECK:STDOUT: %.loc20_21.2 = load i32, ptr %.loc20_21.1.array.index, align 4, !dbg !18 // CHECK:STDOUT: store i32 %.loc20_21.2, ptr %d.var, align 4, !dbg !17 +// CHECK:STDOUT: %.loc20_3 = load i32, ptr %d.var, align 4, !dbg !17 +// CHECK:STDOUT: %.loc19_3 = load i32, ptr %c.var, align 4, !dbg !16 +// CHECK:STDOUT: %.loc18_3.2 = load i32, ptr %b.var, align 4, !dbg !15 +// CHECK:STDOUT: %tuple.elem0.loc17_28.2.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %.loc17_28.1.temp, i32 0, i32 0, !dbg !14 +// CHECK:STDOUT: %.loc17_28.10 = load i32, ptr %tuple.elem0.loc17_28.2.tuple.elem, align 4, !dbg !14 +// CHECK:STDOUT: %tuple.elem1.loc17_28.2.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %.loc17_28.1.temp, i32 0, i32 1, !dbg !14 +// CHECK:STDOUT: %.loc17_28.11 = load i32, ptr %tuple.elem1.loc17_28.2.tuple.elem, align 4, !dbg !14 +// CHECK:STDOUT: %tuple = alloca { i32, i32 }, align 8, !dbg !14 +// CHECK:STDOUT: %tuple1 = getelementptr inbounds nuw { i32, i32 }, ptr %tuple, i32 0, i32 0, !dbg !14 +// CHECK:STDOUT: store i32 %.loc17_28.10, ptr %tuple1, align 4, !dbg !14 +// CHECK:STDOUT: %tuple2 = getelementptr inbounds nuw { i32, i32 }, ptr %tuple, i32 0, i32 1, !dbg !14 +// CHECK:STDOUT: store i32 %.loc17_28.11, ptr %tuple2, align 4, !dbg !14 // CHECK:STDOUT: ret void, !dbg !21 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/operators/assignment.carbon b/toolchain/lower/testdata/operators/assignment.carbon index e1131fe4d8fd..a03109bb1afe 100644 --- a/toolchain/lower/testdata/operators/assignment.carbon +++ b/toolchain/lower/testdata/operators/assignment.carbon @@ -30,9 +30,19 @@ fn Main() { // CHECK:STDOUT: store i32 12, ptr %a.var, align 4, !dbg !7 // CHECK:STDOUT: store i32 9, ptr %a.var, align 4, !dbg !9 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 8, ptr %b.var), !dbg !8 -// CHECK:STDOUT: %tuple.elem0.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %b.var, i32 0, i32 0, !dbg !10 -// CHECK:STDOUT: %tuple.elem1.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %b.var, i32 0, i32 1, !dbg !10 +// CHECK:STDOUT: %tuple.elem0.loc17.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %b.var, i32 0, i32 0, !dbg !10 +// CHECK:STDOUT: %tuple.elem1.loc17.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %b.var, i32 0, i32 1, !dbg !10 // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %b.var, ptr align 4 @tuple.loc17_5, i64 8, i1 false), !dbg !11 +// CHECK:STDOUT: %tuple.elem0.loc16.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %b.var, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: %.loc16_3.1 = load i32, ptr %tuple.elem0.loc16.tuple.elem, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.elem1.loc16.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %b.var, i32 0, i32 1, !dbg !8 +// CHECK:STDOUT: %.loc16_3.2 = load i32, ptr %tuple.elem1.loc16.tuple.elem, align 4, !dbg !8 +// CHECK:STDOUT: %tuple = alloca { i32, i32 }, align 8, !dbg !8 +// CHECK:STDOUT: %tuple1 = getelementptr inbounds nuw { i32, i32 }, ptr %tuple, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: store i32 %.loc16_3.1, ptr %tuple1, align 4, !dbg !8 +// CHECK:STDOUT: %tuple2 = getelementptr inbounds nuw { i32, i32 }, ptr %tuple, i32 0, i32 1, !dbg !8 +// CHECK:STDOUT: store i32 %.loc16_3.2, ptr %tuple2, align 4, !dbg !8 +// CHECK:STDOUT: %.loc14_3.2 = load i32, ptr %a.var, align 4, !dbg !7 // CHECK:STDOUT: ret void, !dbg !12 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/operators/increment.carbon b/toolchain/lower/testdata/operators/increment.carbon index e8da4bf042ca..c67b60fb8ebb 100644 --- a/toolchain/lower/testdata/operators/increment.carbon +++ b/toolchain/lower/testdata/operators/increment.carbon @@ -28,6 +28,7 @@ fn IncrSigned() { // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 4, ptr %from.var), !dbg !7 // CHECK:STDOUT: store i32 0, ptr %from.var, align 4, !dbg !7 // CHECK:STDOUT: call void @"_COp.Int.Core:Inc.Core.be1e879c1ad406d8"(ptr %from.var), !dbg !8 +// CHECK:STDOUT: %.loc5_3.2 = load i32, ptr %from.var, align 4, !dbg !7 // CHECK:STDOUT: ret void, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/pointer/address_of_field.carbon b/toolchain/lower/testdata/pointer/address_of_field.carbon index 17534f7d1070..503eb2c787cd 100644 --- a/toolchain/lower/testdata/pointer/address_of_field.carbon +++ b/toolchain/lower/testdata/pointer/address_of_field.carbon @@ -20,7 +20,7 @@ fn F() { // CHECK:STDOUT: ; ModuleID = 'address_of_field.carbon' // CHECK:STDOUT: source_filename = "address_of_field.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @struct.loc16_3 = internal constant { i32, i32 } { i32 1, i32 2 } +// CHECK:STDOUT: @struct.loc16_3.1 = internal constant { i32, i32 } { i32 1, i32 2 } // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CG.Main(ptr) // CHECK:STDOUT: @@ -30,9 +30,18 @@ fn F() { // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 8, ptr %s.var), !dbg !7 // CHECK:STDOUT: %.loc16_46.3.a = getelementptr inbounds nuw { i32, i32 }, ptr %s.var, i32 0, i32 0, !dbg !8 // CHECK:STDOUT: %.loc16_46.6.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.loc16_3, i64 8, i1 false), !dbg !7 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %s.var, ptr align 4 @struct.loc16_3.1, i64 8, i1 false), !dbg !7 // CHECK:STDOUT: %.loc17.b = getelementptr inbounds nuw { i32, i32 }, ptr %s.var, i32 0, i32 1, !dbg !9 // CHECK:STDOUT: call void @_CG.Main(ptr %.loc17.b), !dbg !10 +// CHECK:STDOUT: %.loc16_3.2.a = getelementptr inbounds nuw { i32, i32 }, ptr %s.var, i32 0, i32 0, !dbg !7 +// CHECK:STDOUT: %.loc16_3.3 = load i32, ptr %.loc16_3.2.a, align 4, !dbg !7 +// CHECK:STDOUT: %.loc16_3.4.b = getelementptr inbounds nuw { i32, i32 }, ptr %s.var, i32 0, i32 1, !dbg !7 +// CHECK:STDOUT: %.loc16_3.5 = load i32, ptr %.loc16_3.4.b, align 4, !dbg !7 +// CHECK:STDOUT: %struct = alloca { i32, i32 }, align 8, !dbg !7 +// CHECK:STDOUT: %struct1 = getelementptr inbounds nuw { i32, i32 }, ptr %struct, i32 0, i32 0, !dbg !7 +// CHECK:STDOUT: store i32 %.loc16_3.3, ptr %struct1, align 4, !dbg !7 +// CHECK:STDOUT: %struct2 = getelementptr inbounds nuw { i32, i32 }, ptr %struct, i32 0, i32 1, !dbg !7 +// CHECK:STDOUT: store i32 %.loc16_3.5, ptr %struct2, align 4, !dbg !7 // CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/pointer/address_of_unused.carbon b/toolchain/lower/testdata/pointer/address_of_unused.carbon index 94d3dbf5d2db..3c0270c2cd1a 100644 --- a/toolchain/lower/testdata/pointer/address_of_unused.carbon +++ b/toolchain/lower/testdata/pointer/address_of_unused.carbon @@ -23,6 +23,7 @@ fn F() { // CHECK:STDOUT: %n.var = alloca i32, align 4, !dbg !7 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 4, ptr %n.var), !dbg !7 // CHECK:STDOUT: store i32 0, ptr %n.var, align 4, !dbg !7 +// CHECK:STDOUT: %.loc14_3.2 = load i32, ptr %n.var, align 4, !dbg !7 // CHECK:STDOUT: ret void, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/struct/nested_struct_in_place.carbon b/toolchain/lower/testdata/struct/nested_struct_in_place.carbon index ec7f96a2d19f..dd0de01b40d8 100644 --- a/toolchain/lower/testdata/struct/nested_struct_in_place.carbon +++ b/toolchain/lower/testdata/struct/nested_struct_in_place.carbon @@ -29,6 +29,65 @@ fn G() { // CHECK:STDOUT: call void @_CF.Main(ptr %.loc16_74.1.a), !dbg !9 // CHECK:STDOUT: %.loc16_74.2.b = getelementptr inbounds nuw { { i32, i32, i32 }, { i32, i32, i32 } }, ptr %v.var, i32 0, i32 1, !dbg !8 // CHECK:STDOUT: call void @_CF.Main(ptr %.loc16_74.2.b), !dbg !10 +// CHECK:STDOUT: %tuple.elem0.loc16_74.1.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %.loc16_74.2.b, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: %.loc16_74.5 = load i32, ptr %tuple.elem0.loc16_74.1.tuple.elem, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.elem1.loc16_74.1.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %.loc16_74.2.b, i32 0, i32 1, !dbg !8 +// CHECK:STDOUT: %.loc16_74.6 = load i32, ptr %tuple.elem1.loc16_74.1.tuple.elem, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.elem2.loc16_74.1.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %.loc16_74.2.b, i32 0, i32 2, !dbg !8 +// CHECK:STDOUT: %.loc16_74.7 = load i32, ptr %tuple.elem2.loc16_74.1.tuple.elem, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.loc16_74.1 = alloca { i32, i32, i32 }, align 8, !dbg !8 +// CHECK:STDOUT: %tuple.loc16_74.11 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_74.1, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: store i32 %.loc16_74.5, ptr %tuple.loc16_74.11, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.loc16_74.12 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_74.1, i32 0, i32 1, !dbg !8 +// CHECK:STDOUT: store i32 %.loc16_74.6, ptr %tuple.loc16_74.12, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.loc16_74.13 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_74.1, i32 0, i32 2, !dbg !8 +// CHECK:STDOUT: store i32 %.loc16_74.7, ptr %tuple.loc16_74.13, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.elem0.loc16_74.2.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %.loc16_74.1.a, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: %.loc16_74.9 = load i32, ptr %tuple.elem0.loc16_74.2.tuple.elem, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.elem1.loc16_74.2.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %.loc16_74.1.a, i32 0, i32 1, !dbg !8 +// CHECK:STDOUT: %.loc16_74.10 = load i32, ptr %tuple.elem1.loc16_74.2.tuple.elem, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.elem2.loc16_74.2.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %.loc16_74.1.a, i32 0, i32 2, !dbg !8 +// CHECK:STDOUT: %.loc16_74.11 = load i32, ptr %tuple.elem2.loc16_74.2.tuple.elem, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.loc16_74.2 = alloca { i32, i32, i32 }, align 8, !dbg !8 +// CHECK:STDOUT: %tuple.loc16_74.24 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_74.2, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: store i32 %.loc16_74.9, ptr %tuple.loc16_74.24, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.loc16_74.25 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_74.2, i32 0, i32 1, !dbg !8 +// CHECK:STDOUT: store i32 %.loc16_74.10, ptr %tuple.loc16_74.25, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.loc16_74.26 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_74.2, i32 0, i32 2, !dbg !8 +// CHECK:STDOUT: store i32 %.loc16_74.11, ptr %tuple.loc16_74.26, align 4, !dbg !8 +// CHECK:STDOUT: %.loc16_3.2.a = getelementptr inbounds nuw { { i32, i32, i32 }, { i32, i32, i32 } }, ptr %v.var, i32 0, i32 0, !dbg !7 +// CHECK:STDOUT: %tuple.elem0.loc16_3.1.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %.loc16_3.2.a, i32 0, i32 0, !dbg !7 +// CHECK:STDOUT: %.loc16_3.3 = load i32, ptr %tuple.elem0.loc16_3.1.tuple.elem, align 4, !dbg !7 +// CHECK:STDOUT: %tuple.elem1.loc16_3.1.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %.loc16_3.2.a, i32 0, i32 1, !dbg !7 +// CHECK:STDOUT: %.loc16_3.4 = load i32, ptr %tuple.elem1.loc16_3.1.tuple.elem, align 4, !dbg !7 +// CHECK:STDOUT: %tuple.elem2.loc16_3.1.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %.loc16_3.2.a, i32 0, i32 2, !dbg !7 +// CHECK:STDOUT: %.loc16_3.5 = load i32, ptr %tuple.elem2.loc16_3.1.tuple.elem, align 4, !dbg !7 +// CHECK:STDOUT: %tuple.loc16_3.1 = alloca { i32, i32, i32 }, align 8, !dbg !7 +// CHECK:STDOUT: %tuple.loc16_3.17 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_3.1, i32 0, i32 0, !dbg !7 +// CHECK:STDOUT: store i32 %.loc16_3.3, ptr %tuple.loc16_3.17, align 4, !dbg !7 +// CHECK:STDOUT: %tuple.loc16_3.18 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_3.1, i32 0, i32 1, !dbg !7 +// CHECK:STDOUT: store i32 %.loc16_3.4, ptr %tuple.loc16_3.18, align 4, !dbg !7 +// CHECK:STDOUT: %tuple.loc16_3.19 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_3.1, i32 0, i32 2, !dbg !7 +// CHECK:STDOUT: store i32 %.loc16_3.5, ptr %tuple.loc16_3.19, align 4, !dbg !7 +// CHECK:STDOUT: %.loc16_3.7.b = getelementptr inbounds nuw { { i32, i32, i32 }, { i32, i32, i32 } }, ptr %v.var, i32 0, i32 1, !dbg !7 +// CHECK:STDOUT: %tuple.elem0.loc16_3.2.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %.loc16_3.7.b, i32 0, i32 0, !dbg !7 +// CHECK:STDOUT: %.loc16_3.8 = load i32, ptr %tuple.elem0.loc16_3.2.tuple.elem, align 4, !dbg !7 +// CHECK:STDOUT: %tuple.elem1.loc16_3.2.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %.loc16_3.7.b, i32 0, i32 1, !dbg !7 +// CHECK:STDOUT: %.loc16_3.9 = load i32, ptr %tuple.elem1.loc16_3.2.tuple.elem, align 4, !dbg !7 +// CHECK:STDOUT: %tuple.elem2.loc16_3.2.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %.loc16_3.7.b, i32 0, i32 2, !dbg !7 +// CHECK:STDOUT: %.loc16_3.10 = load i32, ptr %tuple.elem2.loc16_3.2.tuple.elem, align 4, !dbg !7 +// CHECK:STDOUT: %tuple.loc16_3.2 = alloca { i32, i32, i32 }, align 8, !dbg !7 +// CHECK:STDOUT: %tuple.loc16_3.210 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_3.2, i32 0, i32 0, !dbg !7 +// CHECK:STDOUT: store i32 %.loc16_3.8, ptr %tuple.loc16_3.210, align 4, !dbg !7 +// CHECK:STDOUT: %tuple.loc16_3.211 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_3.2, i32 0, i32 1, !dbg !7 +// CHECK:STDOUT: store i32 %.loc16_3.9, ptr %tuple.loc16_3.211, align 4, !dbg !7 +// CHECK:STDOUT: %tuple.loc16_3.212 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_3.2, i32 0, i32 2, !dbg !7 +// CHECK:STDOUT: store i32 %.loc16_3.10, ptr %tuple.loc16_3.212, align 4, !dbg !7 +// CHECK:STDOUT: %struct = alloca { ptr, ptr }, align 8, !dbg !7 +// CHECK:STDOUT: %struct13 = getelementptr inbounds nuw { ptr, ptr }, ptr %struct, i32 0, i32 0, !dbg !7 +// CHECK:STDOUT: store ptr %tuple.loc16_3.1, ptr %struct13, align 8, !dbg !7 +// CHECK:STDOUT: %struct14 = getelementptr inbounds nuw { ptr, ptr }, ptr %struct, i32 0, i32 1, !dbg !7 +// CHECK:STDOUT: store ptr %tuple.loc16_3.2, ptr %struct14, align 8, !dbg !7 // CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/tuple/access/return_value_access.carbon b/toolchain/lower/testdata/tuple/access/return_value_access.carbon index fcf6b505b285..735f8026eba6 100644 --- a/toolchain/lower/testdata/tuple/access/return_value_access.carbon +++ b/toolchain/lower/testdata/tuple/access/return_value_access.carbon @@ -36,9 +36,19 @@ fn Run() { // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 4, ptr %t.var), !dbg !10 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 8, ptr %.loc16_18.1.temp), !dbg !11 // CHECK:STDOUT: call void @_CF.Main(ptr %.loc16_18.1.temp), !dbg !11 -// CHECK:STDOUT: %tuple.elem1.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %.loc16_18.1.temp, i32 0, i32 1, !dbg !11 -// CHECK:STDOUT: %.loc16_19 = load i32, ptr %tuple.elem1.tuple.elem, align 4, !dbg !11 +// CHECK:STDOUT: %tuple.elem1.loc16_19.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %.loc16_18.1.temp, i32 0, i32 1, !dbg !11 +// CHECK:STDOUT: %.loc16_19 = load i32, ptr %tuple.elem1.loc16_19.tuple.elem, align 4, !dbg !11 // CHECK:STDOUT: store i32 %.loc16_19, ptr %t.var, align 4, !dbg !10 +// CHECK:STDOUT: %tuple.elem0.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %.loc16_18.1.temp, i32 0, i32 0, !dbg !11 +// CHECK:STDOUT: %.loc16_18.3 = load i32, ptr %tuple.elem0.tuple.elem, align 4, !dbg !11 +// CHECK:STDOUT: %tuple.elem1.loc16_18.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %.loc16_18.1.temp, i32 0, i32 1, !dbg !11 +// CHECK:STDOUT: %.loc16_18.4 = load i32, ptr %tuple.elem1.loc16_18.tuple.elem, align 4, !dbg !11 +// CHECK:STDOUT: %tuple = alloca { i32, i32 }, align 8, !dbg !11 +// CHECK:STDOUT: %tuple1 = getelementptr inbounds nuw { i32, i32 }, ptr %tuple, i32 0, i32 0, !dbg !11 +// CHECK:STDOUT: store i32 %.loc16_18.3, ptr %tuple1, align 4, !dbg !11 +// CHECK:STDOUT: %tuple2 = getelementptr inbounds nuw { i32, i32 }, ptr %tuple, i32 0, i32 1, !dbg !11 +// CHECK:STDOUT: store i32 %.loc16_18.4, ptr %tuple2, align 4, !dbg !11 +// CHECK:STDOUT: %.loc16_3 = load i32, ptr %t.var, align 4, !dbg !10 // CHECK:STDOUT: ret void, !dbg !12 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/tuple/nested_tuple_in_place.carbon b/toolchain/lower/testdata/tuple/nested_tuple_in_place.carbon index 57455ea00107..348dbc4c3760 100644 --- a/toolchain/lower/testdata/tuple/nested_tuple_in_place.carbon +++ b/toolchain/lower/testdata/tuple/nested_tuple_in_place.carbon @@ -25,10 +25,69 @@ fn G() { // CHECK:STDOUT: entry: // CHECK:STDOUT: %v.var = alloca { { i32, i32, i32 }, { i32, i32, i32 } }, align 8, !dbg !7 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 24, ptr %v.var), !dbg !7 -// CHECK:STDOUT: %tuple.elem0.tuple.elem = getelementptr inbounds nuw { { i32, i32, i32 }, { i32, i32, i32 } }, ptr %v.var, i32 0, i32 0, !dbg !8 -// CHECK:STDOUT: call void @_CF.Main(ptr %tuple.elem0.tuple.elem), !dbg !9 -// CHECK:STDOUT: %tuple.elem1.tuple.elem = getelementptr inbounds nuw { { i32, i32, i32 }, { i32, i32, i32 } }, ptr %v.var, i32 0, i32 1, !dbg !8 -// CHECK:STDOUT: call void @_CF.Main(ptr %tuple.elem1.tuple.elem), !dbg !10 +// CHECK:STDOUT: %tuple.elem0.loc16_56.1.tuple.elem = getelementptr inbounds nuw { { i32, i32, i32 }, { i32, i32, i32 } }, ptr %v.var, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: call void @_CF.Main(ptr %tuple.elem0.loc16_56.1.tuple.elem), !dbg !9 +// CHECK:STDOUT: %tuple.elem1.loc16_56.1.tuple.elem = getelementptr inbounds nuw { { i32, i32, i32 }, { i32, i32, i32 } }, ptr %v.var, i32 0, i32 1, !dbg !8 +// CHECK:STDOUT: call void @_CF.Main(ptr %tuple.elem1.loc16_56.1.tuple.elem), !dbg !10 +// CHECK:STDOUT: %tuple.elem0.loc16_56.2.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.elem1.loc16_56.1.tuple.elem, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: %.loc16_56.3 = load i32, ptr %tuple.elem0.loc16_56.2.tuple.elem, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.elem1.loc16_56.2.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.elem1.loc16_56.1.tuple.elem, i32 0, i32 1, !dbg !8 +// CHECK:STDOUT: %.loc16_56.4 = load i32, ptr %tuple.elem1.loc16_56.2.tuple.elem, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.elem2.loc16_56.1.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.elem1.loc16_56.1.tuple.elem, i32 0, i32 2, !dbg !8 +// CHECK:STDOUT: %.loc16_56.5 = load i32, ptr %tuple.elem2.loc16_56.1.tuple.elem, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.loc16_56.1 = alloca { i32, i32, i32 }, align 8, !dbg !8 +// CHECK:STDOUT: %tuple.loc16_56.11 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_56.1, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: store i32 %.loc16_56.3, ptr %tuple.loc16_56.11, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.loc16_56.12 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_56.1, i32 0, i32 1, !dbg !8 +// CHECK:STDOUT: store i32 %.loc16_56.4, ptr %tuple.loc16_56.12, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.loc16_56.13 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_56.1, i32 0, i32 2, !dbg !8 +// CHECK:STDOUT: store i32 %.loc16_56.5, ptr %tuple.loc16_56.13, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.elem0.loc16_56.3.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.elem0.loc16_56.1.tuple.elem, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: %.loc16_56.7 = load i32, ptr %tuple.elem0.loc16_56.3.tuple.elem, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.elem1.loc16_56.3.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.elem0.loc16_56.1.tuple.elem, i32 0, i32 1, !dbg !8 +// CHECK:STDOUT: %.loc16_56.8 = load i32, ptr %tuple.elem1.loc16_56.3.tuple.elem, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.elem2.loc16_56.2.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.elem0.loc16_56.1.tuple.elem, i32 0, i32 2, !dbg !8 +// CHECK:STDOUT: %.loc16_56.9 = load i32, ptr %tuple.elem2.loc16_56.2.tuple.elem, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.loc16_56.2 = alloca { i32, i32, i32 }, align 8, !dbg !8 +// CHECK:STDOUT: %tuple.loc16_56.24 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_56.2, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: store i32 %.loc16_56.7, ptr %tuple.loc16_56.24, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.loc16_56.25 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_56.2, i32 0, i32 1, !dbg !8 +// CHECK:STDOUT: store i32 %.loc16_56.8, ptr %tuple.loc16_56.25, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.loc16_56.26 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_56.2, i32 0, i32 2, !dbg !8 +// CHECK:STDOUT: store i32 %.loc16_56.9, ptr %tuple.loc16_56.26, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.elem0.loc16_3.1.tuple.elem = getelementptr inbounds nuw { { i32, i32, i32 }, { i32, i32, i32 } }, ptr %v.var, i32 0, i32 0, !dbg !7 +// CHECK:STDOUT: %tuple.elem0.loc16_3.2.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.elem0.loc16_3.1.tuple.elem, i32 0, i32 0, !dbg !7 +// CHECK:STDOUT: %.loc16_3.2 = load i32, ptr %tuple.elem0.loc16_3.2.tuple.elem, align 4, !dbg !7 +// CHECK:STDOUT: %tuple.elem1.loc16_3.1.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.elem0.loc16_3.1.tuple.elem, i32 0, i32 1, !dbg !7 +// CHECK:STDOUT: %.loc16_3.3 = load i32, ptr %tuple.elem1.loc16_3.1.tuple.elem, align 4, !dbg !7 +// CHECK:STDOUT: %tuple.elem2.loc16_3.1.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.elem0.loc16_3.1.tuple.elem, i32 0, i32 2, !dbg !7 +// CHECK:STDOUT: %.loc16_3.4 = load i32, ptr %tuple.elem2.loc16_3.1.tuple.elem, align 4, !dbg !7 +// CHECK:STDOUT: %tuple.loc16_3.1 = alloca { i32, i32, i32 }, align 8, !dbg !7 +// CHECK:STDOUT: %tuple.loc16_3.17 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_3.1, i32 0, i32 0, !dbg !7 +// CHECK:STDOUT: store i32 %.loc16_3.2, ptr %tuple.loc16_3.17, align 4, !dbg !7 +// CHECK:STDOUT: %tuple.loc16_3.18 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_3.1, i32 0, i32 1, !dbg !7 +// CHECK:STDOUT: store i32 %.loc16_3.3, ptr %tuple.loc16_3.18, align 4, !dbg !7 +// CHECK:STDOUT: %tuple.loc16_3.19 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_3.1, i32 0, i32 2, !dbg !7 +// CHECK:STDOUT: store i32 %.loc16_3.4, ptr %tuple.loc16_3.19, align 4, !dbg !7 +// CHECK:STDOUT: %tuple.elem1.loc16_3.2.tuple.elem = getelementptr inbounds nuw { { i32, i32, i32 }, { i32, i32, i32 } }, ptr %v.var, i32 0, i32 1, !dbg !7 +// CHECK:STDOUT: %tuple.elem0.loc16_3.3.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.elem1.loc16_3.2.tuple.elem, i32 0, i32 0, !dbg !7 +// CHECK:STDOUT: %.loc16_3.6 = load i32, ptr %tuple.elem0.loc16_3.3.tuple.elem, align 4, !dbg !7 +// CHECK:STDOUT: %tuple.elem1.loc16_3.3.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.elem1.loc16_3.2.tuple.elem, i32 0, i32 1, !dbg !7 +// CHECK:STDOUT: %.loc16_3.7 = load i32, ptr %tuple.elem1.loc16_3.3.tuple.elem, align 4, !dbg !7 +// CHECK:STDOUT: %tuple.elem2.loc16_3.2.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.elem1.loc16_3.2.tuple.elem, i32 0, i32 2, !dbg !7 +// CHECK:STDOUT: %.loc16_3.8 = load i32, ptr %tuple.elem2.loc16_3.2.tuple.elem, align 4, !dbg !7 +// CHECK:STDOUT: %tuple.loc16_3.2 = alloca { i32, i32, i32 }, align 8, !dbg !7 +// CHECK:STDOUT: %tuple.loc16_3.210 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_3.2, i32 0, i32 0, !dbg !7 +// CHECK:STDOUT: store i32 %.loc16_3.6, ptr %tuple.loc16_3.210, align 4, !dbg !7 +// CHECK:STDOUT: %tuple.loc16_3.211 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_3.2, i32 0, i32 1, !dbg !7 +// CHECK:STDOUT: store i32 %.loc16_3.7, ptr %tuple.loc16_3.211, align 4, !dbg !7 +// CHECK:STDOUT: %tuple.loc16_3.212 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16_3.2, i32 0, i32 2, !dbg !7 +// CHECK:STDOUT: store i32 %.loc16_3.8, ptr %tuple.loc16_3.212, align 4, !dbg !7 +// CHECK:STDOUT: %tuple.loc16_3.3 = alloca { ptr, ptr }, align 8, !dbg !7 +// CHECK:STDOUT: %tuple.loc16_3.313 = getelementptr inbounds nuw { ptr, ptr }, ptr %tuple.loc16_3.3, i32 0, i32 0, !dbg !7 +// CHECK:STDOUT: store ptr %tuple.loc16_3.1, ptr %tuple.loc16_3.313, align 8, !dbg !7 +// CHECK:STDOUT: %tuple.loc16_3.314 = getelementptr inbounds nuw { ptr, ptr }, ptr %tuple.loc16_3.3, i32 0, i32 1, !dbg !7 +// CHECK:STDOUT: store ptr %tuple.loc16_3.2, ptr %tuple.loc16_3.314, align 8, !dbg !7 // CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/tuple/value_formation.carbon b/toolchain/lower/testdata/tuple/value_formation.carbon index 17f0a2c13e6c..3c99b186866f 100644 --- a/toolchain/lower/testdata/tuple/value_formation.carbon +++ b/toolchain/lower/testdata/tuple/value_formation.carbon @@ -61,6 +61,32 @@ fn F() { // CHECK:STDOUT: %tuple.loc18_108 = getelementptr inbounds nuw { ptr, ptr }, ptr %tuple.loc18_10, i32 0, i32 1, !dbg !11 // CHECK:STDOUT: store ptr %tuple.loc18_9, ptr %tuple.loc18_108, align 8, !dbg !11 // CHECK:STDOUT: call void @_CG.Main(ptr %tuple.loc18_10), !dbg !12 +// CHECK:STDOUT: %tuple.elem0.loc17.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %b.var, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: %.loc17_3.1 = load i32, ptr %tuple.elem0.loc17.tuple.elem, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.elem1.loc17.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %b.var, i32 0, i32 1, !dbg !8 +// CHECK:STDOUT: %.loc17_3.2 = load i32, ptr %tuple.elem1.loc17.tuple.elem, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.elem2.loc17.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %b.var, i32 0, i32 2, !dbg !8 +// CHECK:STDOUT: %.loc17_3.3 = load i32, ptr %tuple.elem2.loc17.tuple.elem, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.loc17 = alloca { i32, i32, i32 }, align 8, !dbg !8 +// CHECK:STDOUT: %tuple.loc179 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc17, i32 0, i32 0, !dbg !8 +// CHECK:STDOUT: store i32 %.loc17_3.1, ptr %tuple.loc179, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.loc1710 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc17, i32 0, i32 1, !dbg !8 +// CHECK:STDOUT: store i32 %.loc17_3.2, ptr %tuple.loc1710, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.loc1711 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc17, i32 0, i32 2, !dbg !8 +// CHECK:STDOUT: store i32 %.loc17_3.3, ptr %tuple.loc1711, align 4, !dbg !8 +// CHECK:STDOUT: %tuple.elem0.loc16.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 0, !dbg !7 +// CHECK:STDOUT: %.loc16_3.1 = load i32, ptr %tuple.elem0.loc16.tuple.elem, align 4, !dbg !7 +// CHECK:STDOUT: %tuple.elem1.loc16.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 1, !dbg !7 +// CHECK:STDOUT: %.loc16_3.2 = load i32, ptr %tuple.elem1.loc16.tuple.elem, align 4, !dbg !7 +// CHECK:STDOUT: %tuple.elem2.loc16.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %a.var, i32 0, i32 2, !dbg !7 +// CHECK:STDOUT: %.loc16_3.3 = load i32, ptr %tuple.elem2.loc16.tuple.elem, align 4, !dbg !7 +// CHECK:STDOUT: %tuple.loc16 = alloca { i32, i32, i32 }, align 8, !dbg !7 +// CHECK:STDOUT: %tuple.loc1612 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16, i32 0, i32 0, !dbg !7 +// CHECK:STDOUT: store i32 %.loc16_3.1, ptr %tuple.loc1612, align 4, !dbg !7 +// CHECK:STDOUT: %tuple.loc1613 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16, i32 0, i32 1, !dbg !7 +// CHECK:STDOUT: store i32 %.loc16_3.2, ptr %tuple.loc1613, align 4, !dbg !7 +// CHECK:STDOUT: %tuple.loc1614 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %tuple.loc16, i32 0, i32 2, !dbg !7 +// CHECK:STDOUT: store i32 %.loc16_3.3, ptr %tuple.loc1614, align 4, !dbg !7 // CHECK:STDOUT: ret void, !dbg !13 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/sem_ir/yaml_test.cpp b/toolchain/sem_ir/yaml_test.cpp index 18f91cdfd265..d9f53f5d745b 100644 --- a/toolchain/sem_ir/yaml_test.cpp +++ b/toolchain/sem_ir/yaml_test.cpp @@ -33,7 +33,7 @@ TEST(SemIRTest, Yaml) { new llvm::vfs::InMemoryFileSystem; CARBON_CHECK(fs->addFile( "test.carbon", /*ModificationTime=*/0, - llvm::MemoryBuffer::getMemBuffer("fn F() { var x: () = (); return; }"))); + llvm::MemoryBuffer::getMemBuffer("fn F() { let x: () = (); return; }"))); const auto install_paths = InstallPaths::MakeForBazelRunfiles(Testing::GetExePath()); RawStringOstream print_stream; @@ -66,24 +66,25 @@ TEST(SemIRTest, Yaml) { Pair("specifics", Yaml::Mapping(SizeIs(0))), Pair("struct_type_fields", Yaml::Mapping(SizeIs(1))), Pair("types", Yaml::Mapping(Each(type_builtin))), - Pair("insts", - Yaml::Mapping(AllOf( - Each(Key(inst_id)), - // kind is required, other parts are optional. - Each(Pair(_, Yaml::Mapping(Contains(Pair("kind", _))))), - // A 0-arg instruction. - Contains( - Pair(_, Yaml::Mapping(ElementsAre(Pair("kind", "Return"))))), - // A 1-arg instruction. - Contains(Pair(_, Yaml::Mapping(ElementsAre( - Pair("kind", "TupleType"), - Pair("arg0", inst_block_id), - Pair("type", "type(TypeType)"))))), - // A 2-arg instruction. - Contains(Pair( - _, Yaml::Mapping(ElementsAre(Pair("kind", "Assign"), - Pair("arg0", inst_id), - Pair("arg1", inst_id)))))))), + Pair("insts", Yaml::Mapping(AllOf( + Each(Key(inst_id)), + // kind is required, other parts are optional. + Each(Pair(_, Yaml::Mapping(Contains(Pair("kind", _))))), + // A 0-arg instruction. + Contains(Pair(_, Yaml::Mapping(ElementsAre( + Pair("kind", "Return"))))), + // A 1-arg instruction. + Contains(Pair(_, Yaml::Mapping(ElementsAre( + Pair("kind", "TupleType"), + Pair("arg0", inst_block_id), + Pair("type", "type(TypeType)"))))), + // A 2-arg instruction. + Contains(Pair(_, Yaml::Mapping(ElementsAre( + + Pair("kind", "FunctionDecl"), + Pair("arg0", "function0"), + Pair("arg1", "inst_block_empty"), + Pair("type", type_id)))))))), Pair("constant_values", Yaml::Mapping(AllOf(Each(Pair(inst_id, constant_id))))), Pair("symbolic_constants", Yaml::Mapping(SizeIs(0))), diff --git a/toolchain/testing/testdata/min_prelude/destroy.carbon b/toolchain/testing/testdata/min_prelude/destroy.carbon index 1afd9e0cb7ee..2c37464998be 100644 --- a/toolchain/testing/testdata/min_prelude/destroy.carbon +++ b/toolchain/testing/testdata/min_prelude/destroy.carbon @@ -3,16 +3,11 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // EXTRA-ARGS: --custom-core --exclude-dump-file-prefix=min_prelude/ +// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/parts/destroy.carbon // --- min_prelude/destroy.carbon // A minimal prelude for tests that require destruction. package Core library "prelude"; -// TODO: Uncomment once the interface is used. -// interface Destroy { -// fn Op[self: Self](); -// } -// impl forall [T:! type] T as Destroy { -// fn Op[self: Self]() = "no_op"; -// } +export import library "prelude/parts/destroy"; diff --git a/toolchain/testing/testdata/min_prelude/parts/as.carbon b/toolchain/testing/testdata/min_prelude/parts/as.carbon index 74bc859d9ddc..342a5543bf9d 100644 --- a/toolchain/testing/testdata/min_prelude/parts/as.carbon +++ b/toolchain/testing/testdata/min_prelude/parts/as.carbon @@ -1,11 +1,15 @@ // Part of the Carbon Language project, under the Apache License v2.0 with LLVM // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/parts/destroy.carbon // --- min_prelude/parts/as.carbon package Core library "prelude/parts/as"; +export import library "prelude/parts/destroy"; + interface As(Dest:! type) { fn Convert[self: Self]() -> Dest; } diff --git a/toolchain/testing/testdata/min_prelude/parts/destroy.carbon b/toolchain/testing/testdata/min_prelude/parts/destroy.carbon new file mode 100644 index 000000000000..2ccf9792122a --- /dev/null +++ b/toolchain/testing/testdata/min_prelude/parts/destroy.carbon @@ -0,0 +1,14 @@ +// Part of the Carbon Language project, under the Apache License v2.0 with LLVM +// Exceptions. See /LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +// --- min_prelude/parts/destroy.carbon + +package Core library "prelude/parts/destroy"; + +interface Destroy { + fn Op[self: Self](); +} +impl forall [T:! type] T as Destroy { + fn Op[self: Self]() = "no_op"; +}