From a6bb11f1cf413b1bcb8613df5b56ca8ac344664b Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Mon, 29 Sep 2025 18:49:06 -0400 Subject: [PATCH] Rearrange convert: construct FacetAccessType from a facet value before impl lookup instead of after (#6113) This makes convert more consistent, it always makes a FacetAccessType for a facet value, rather than only doing so after lookup returns. The intention for this is that FacetAccessType will evaluate to SymbolicBindingType in the future, so this will expose that constant value to impl lookup instead of the original facet value, which will avoid impl lookup having to deal with `.Self` or `BindSymbolicName` specifically. --- toolchain/check/convert.cpp | 52 ++++++++++--------- .../testdata/class/generic/member_type.carbon | 4 +- .../facet/call_combined_impl_witness.carbon | 4 +- .../convert_class_type_to_facet_type.carbon | 2 +- ...t_value_as_type_knows_original_type.carbon | 10 ++-- .../convert_facet_value_to_itself.carbon | 2 +- ..._facet_value_to_narrowed_facet_type.carbon | 6 +-- .../testdata/facet/convert_interface.carbon | 2 +- toolchain/check/testdata/for/actual.carbon | 8 +-- toolchain/check/testdata/for/pattern.carbon | 4 +- .../testdata/function/generic/call.carbon | 4 +- .../testdata/function/generic/deduce.carbon | 6 +-- .../generic/deduce_nested_facet_value.carbon | 14 ++--- .../testdata/generic/dependent_param.carbon | 2 +- .../generic/dot_self_symbolic_type.carbon | 2 +- toolchain/check/testdata/impl/compound.carbon | 2 +- .../testdata/impl/fail_impl_as_scope.carbon | 2 +- .../impl/fail_self_type_mismatch.carbon | 2 +- .../check/testdata/impl/forward_decls.carbon | 12 ++--- .../testdata/impl/import_compound.carbon | 2 +- .../check/testdata/impl/import_thunk.carbon | 2 +- .../testdata/impl/import_use_generic.carbon | 2 +- .../check/testdata/impl/interface_args.carbon | 2 +- .../impl/lookup/canonical_query_self.carbon | 18 +++---- ...g_generic_inside_rewrite_constraint.carbon | 4 +- ...pecialization_with_symbolic_rewrite.carbon | 2 +- .../testdata/impl/use_assoc_const.carbon | 10 ++-- .../interface/compound_member_access.carbon | 10 ++-- .../interface/fail_assoc_const_alias.carbon | 48 +++++++++++------ .../interface/fail_member_lookup.carbon | 4 ++ .../check/testdata/interface/generic.carbon | 3 ++ .../testdata/interface/generic_method.carbon | 8 +-- .../primitives/import_symbolic.carbon | 16 +++--- toolchain/check/testdata/struct/import.carbon | 2 +- toolchain/check/testdata/tuple/import.carbon | 2 +- toolchain/sem_ir/constant.h | 8 +++ 36 files changed, 158 insertions(+), 125 deletions(-) diff --git a/toolchain/check/convert.cpp b/toolchain/check/convert.cpp index 20a16bb03412..060aca8c4992 100644 --- a/toolchain/check/convert.cpp +++ b/toolchain/check/convert.cpp @@ -1198,19 +1198,24 @@ static auto PerformBuiltinConversion( if (sem_ir.types().Is(target.type_id) && (sem_ir.types().Is(value_type_id) || sem_ir.types().Is(value_type_id))) { - // The value is a type or facet value, so it has a constant value. We get - // that to unwrap things like NameRef and get to the underlying type or - // facet value instruction so that we can use `TryGetAs`. - auto const_value_id = sem_ir.constant_values().GetConstantInstId(value_id); // TODO: Runtime facet values should be allowed to convert based on their // FacetTypes, but we assume constant values for impl lookup at the moment. - if (!const_value_id.has_value()) { + if (!context.constant_values().Get(value_id).is_constant()) { context.TODO(loc_id, "conversion of runtime facet value"); - const_value_id = SemIR::ErrorInst::InstId; + return SemIR::ErrorInst::InstId; } - if (auto facet_access_type_inst = - sem_ir.insts().TryGetAs(const_value_id)) { + // Get the canonical type for which we want to attach a new set of witnesses + // to match the requirements of the target FacetType. + auto type_inst_id = SemIR::TypeInstId::None; + if (sem_ir.types().Is(value_type_id)) { + type_inst_id = AddTypeInst( + context, loc_id, + {.type_id = SemIR::TypeType::TypeId, + .facet_value_inst_id = value_id}); + } else { + type_inst_id = context.types().GetAsTypeInstId(value_id); + // Shortcut for lossless round trips through a FacetAccessType when // converting back to the type of its original facet value. // @@ -1222,9 +1227,19 @@ static auto PerformBuiltinConversion( // // See also test: // facet_access_type_converts_back_to_original_facet_value.carbon - auto facet_value_inst_id = facet_access_type_inst->facet_value_inst_id; - if (sem_ir.insts().Get(facet_value_inst_id).type_id() == target.type_id) { - return facet_value_inst_id; + // + // TODO: This instruction is going to become a `SymbolicBindingType`, so + // we'll need to handle that instead. + auto const_type_inst_id = + sem_ir.constant_values().GetConstantTypeInstId(type_inst_id); + if (auto facet_access_type_inst = + sem_ir.insts().TryGetAs( + const_type_inst_id)) { + auto facet_value_inst_id = facet_access_type_inst->facet_value_inst_id; + if (sem_ir.insts().Get(facet_value_inst_id).type_id() == + target.type_id) { + return facet_value_inst_id; + } } } @@ -1233,25 +1248,12 @@ static auto PerformBuiltinConversion( // type satisfies the requirements of the target `FacetType`, as determined // by finding impl witnesses for the target FacetType. auto lookup_result = LookupImplWitness( - context, loc_id, sem_ir.constant_values().Get(const_value_id), + context, loc_id, sem_ir.constant_values().Get(type_inst_id), sem_ir.types().GetConstantId(target.type_id)); if (lookup_result.has_value()) { if (lookup_result.has_error_value()) { return SemIR::ErrorInst::InstId; } else { - // We bind the input value to the target `FacetType` with a - // `FacetValue`, which requires an instruction of type `TypeType`. So if - // we are converting from a facet value, we get its `type` via an extra - // `FacetAccessType` instruction. - auto type_inst_id = SemIR::TypeInstId::None; - if (sem_ir.types().Is(value_type_id)) { - type_inst_id = AddTypeInst( - context, loc_id, - {.type_id = SemIR::TypeType::TypeId, - .facet_value_inst_id = const_value_id}); - } else { - type_inst_id = context.types().GetAsTypeInstId(const_value_id); - } // Note that `FacetValue`'s type is the same `FacetType` that was used // to construct the set of witnesses, ie. the query to // `LookupImplWitness()`. This ensures that the witnesses are in the diff --git a/toolchain/check/testdata/class/generic/member_type.carbon b/toolchain/check/testdata/class/generic/member_type.carbon index 4dd025308bd4..74632912931d 100644 --- a/toolchain/check/testdata/class/generic/member_type.carbon +++ b/toolchain/check/testdata/class/generic/member_type.carbon @@ -297,7 +297,7 @@ fn Test() -> i32 { // CHECK:STDOUT: %Outer.ref.loc13_29: %Outer.type = name_ref Outer, file.%Outer.decl [concrete = constants.%Outer.generic] // CHECK:STDOUT: %int_32.loc13_35: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32.loc13_35: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %Copy.facet.loc13_38: %Copy.type = facet_value constants.%i32, (constants.%Copy.impl_witness.a32) [concrete = constants.%Copy.facet.c49] +// CHECK:STDOUT: %Copy.facet.loc13_38: %Copy.type = facet_value %i32.loc13_35, (constants.%Copy.impl_witness.a32) [concrete = constants.%Copy.facet.c49] // CHECK:STDOUT: %.loc13_38: %Copy.type = converted %i32.loc13_35, %Copy.facet.loc13_38 [concrete = constants.%Copy.facet.c49] // CHECK:STDOUT: %Outer.loc13_38: type = class_type @Outer, @Outer(constants.%Copy.facet.c49) [concrete = constants.%Outer.3a3] // CHECK:STDOUT: %.loc13_39: %Outer.F.type.f5d = specific_constant @Outer.%Outer.F.decl, @Outer(constants.%Copy.facet.c49) [concrete = constants.%Outer.F.e06] @@ -322,7 +322,7 @@ fn Test() -> i32 { // CHECK:STDOUT: %Outer.ref.loc13_10: %Outer.type = name_ref Outer, file.%Outer.decl [concrete = constants.%Outer.generic] // CHECK:STDOUT: %int_32.loc13_16: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32.loc13_16: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %Copy.facet.loc13_19: %Copy.type = facet_value constants.%i32, (constants.%Copy.impl_witness.a32) [concrete = constants.%Copy.facet.c49] +// CHECK:STDOUT: %Copy.facet.loc13_19: %Copy.type = facet_value %i32.loc13_16, (constants.%Copy.impl_witness.a32) [concrete = constants.%Copy.facet.c49] // CHECK:STDOUT: %.loc13_19: %Copy.type = converted %i32.loc13_16, %Copy.facet.loc13_19 [concrete = constants.%Copy.facet.c49] // CHECK:STDOUT: %Outer.loc13_19: type = class_type @Outer, @Outer(constants.%Copy.facet.c49) [concrete = constants.%Outer.3a3] // CHECK:STDOUT: %.loc13_20.2: type = specific_constant @Outer.%Inner.decl, @Outer(constants.%Copy.facet.c49) [concrete = constants.%Inner.d35] diff --git a/toolchain/check/testdata/facet/call_combined_impl_witness.carbon b/toolchain/check/testdata/facet/call_combined_impl_witness.carbon index 25504574b4f6..9d302252dbb2 100644 --- a/toolchain/check/testdata/facet/call_combined_impl_witness.carbon +++ b/toolchain/check/testdata/facet/call_combined_impl_witness.carbon @@ -335,7 +335,7 @@ fn F() { // CHECK:STDOUT: %T.ref.loc40: %facet_type.b5f = name_ref T, %T.loc33_6.2 [symbolic = %T.loc33_6.1 (constants.%T)] // 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.1 (constants.%T.as_type)] +// CHECK:STDOUT: %T.as_type.loc40: type = facet_access_type %T.ref.loc40 [symbolic = %T.as_type.loc33_28.1 (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.d1f)] // CHECK:STDOUT: %.loc40_4: %A.type = converted %T.ref.loc40, %A.facet.loc40 [symbolic = %A.facet.loc34 (constants.%A.facet.d1f)] // CHECK:STDOUT: %impl.elem0.loc40: @G.%.loc34_4.2 (%.b2b) = impl_witness_access constants.%A.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc34_4.2 (constants.%impl.elem0.d41)] @@ -344,7 +344,7 @@ fn F() { // CHECK:STDOUT: %T.ref.loc41: %facet_type.b5f = name_ref T, %T.loc33_6.2 [symbolic = %T.loc33_6.1 (constants.%T)] // 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.1 (constants.%T.as_type)] +// CHECK:STDOUT: %T.as_type.loc41: type = facet_access_type %T.ref.loc41 [symbolic = %T.as_type.loc33_28.1 (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.434)] // CHECK:STDOUT: %.loc41_4: %B.type = converted %T.ref.loc41, %B.facet.loc41 [symbolic = %B.facet.loc35 (constants.%B.facet.434)] // CHECK:STDOUT: %impl.elem0.loc41: @G.%.loc35_4.2 (%.1ce) = impl_witness_access constants.%B.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc35_4.2 (constants.%impl.elem0.629)] diff --git a/toolchain/check/testdata/facet/convert_class_type_to_facet_type.carbon b/toolchain/check/testdata/facet/convert_class_type_to_facet_type.carbon index ddedcf8f0f6d..7a39153e8eb3 100644 --- a/toolchain/check/testdata/facet/convert_class_type_to_facet_type.carbon +++ b/toolchain/check/testdata/facet/convert_class_type_to_facet_type.carbon @@ -117,7 +117,7 @@ fn F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %WalkAnimal.ref: %WalkAnimal.type = name_ref WalkAnimal, file.%WalkAnimal.decl [concrete = constants.%WalkAnimal] // CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] -// CHECK:STDOUT: %Animal.facet: %Animal.type = facet_value constants.%Goat, (constants.%Animal.impl_witness) [concrete = constants.%Animal.facet] +// CHECK:STDOUT: %Animal.facet: %Animal.type = facet_value %Goat.ref, (constants.%Animal.impl_witness) [concrete = constants.%Animal.facet] // CHECK:STDOUT: %.loc23: %Animal.type = converted %Goat.ref, %Animal.facet [concrete = constants.%Animal.facet] // CHECK:STDOUT: %WalkAnimal.specific_fn: = specific_function %WalkAnimal.ref, @WalkAnimal(constants.%Animal.facet) [concrete = constants.%WalkAnimal.specific_fn] // CHECK:STDOUT: %WalkAnimal.call: init %empty_tuple.type = call %WalkAnimal.specific_fn() 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 2a45e1ab8788..d670bf196b72 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 @@ -115,11 +115,11 @@ fn F[A:! J, B:! A](x: C(A, B)) { // CHECK:STDOUT: %Feed.ref: %Feed.type = name_ref Feed, file.%Feed.decl [concrete = constants.%Feed] // 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: %Animal.facet: %Animal.type = facet_value constants.%Goat, (constants.%Animal.impl_witness) [concrete = constants.%Animal.facet] +// CHECK:STDOUT: %Animal.facet: %Animal.type = facet_value %Goat.ref, (constants.%Animal.impl_witness) [concrete = constants.%Animal.facet] // CHECK:STDOUT: %.loc14_14: %Animal.type = converted %Goat.ref, %Animal.facet [concrete = constants.%Animal.facet] // CHECK:STDOUT: %as_type: type = facet_access_type %.loc14_14 [concrete = constants.%Goat] // CHECK:STDOUT: %.loc14_25: type = converted %.loc14_14, %as_type [concrete = constants.%Goat] -// CHECK:STDOUT: %Eats.facet: %Eats.type = facet_value constants.%Goat, (constants.%Eats.impl_witness) [concrete = constants.%Eats.facet] +// CHECK:STDOUT: %Eats.facet: %Eats.type = facet_value %.loc14_25, (constants.%Eats.impl_witness) [concrete = constants.%Eats.facet] // CHECK:STDOUT: %.loc14_32: %Eats.type = converted %.loc14_25, %Eats.facet [concrete = constants.%Eats.facet] // CHECK:STDOUT: %Feed.specific_fn: = specific_function %Feed.ref, @Feed(constants.%Eats.facet) [concrete = constants.%Feed.specific_fn] // CHECK:STDOUT: %Feed.call: init %empty_tuple.type = call %Feed.specific_fn() @@ -172,7 +172,7 @@ fn F[A:! J, B:! A](x: C(A, B)) { // CHECK:STDOUT: %.loc22_15.1: type = splice_block %.loc22_15.3 [concrete = constants.%Goat] { // CHECK:STDOUT: %Goat.ref.loc22_10: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] // CHECK:STDOUT: %Animal.ref.loc22: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] -// CHECK:STDOUT: %Animal.facet.loc22: %Animal.type = facet_value constants.%Goat, (constants.%Animal.impl_witness) [concrete = constants.%Animal.facet] +// CHECK:STDOUT: %Animal.facet.loc22: %Animal.type = facet_value %Goat.ref.loc22_10, (constants.%Animal.impl_witness) [concrete = constants.%Animal.facet] // CHECK:STDOUT: %.loc22_15.2: %Animal.type = converted %Goat.ref.loc22_10, %Animal.facet.loc22 [concrete = constants.%Animal.facet] // CHECK:STDOUT: %as_type.loc22: type = facet_access_type %.loc22_15.2 [concrete = constants.%Goat] // CHECK:STDOUT: %.loc22_15.3: type = converted %.loc22_15.2, %as_type.loc22 [concrete = constants.%Goat] @@ -194,7 +194,7 @@ fn F[A:! J, B:! A](x: C(A, B)) { // CHECK:STDOUT: %.loc26_8: ref %Goat = converted %.loc26_6.1, %.loc26_6.4 // CHECK:STDOUT: %Goat.ref.loc26_21: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] // CHECK:STDOUT: %Animal.ref.loc26: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] -// CHECK:STDOUT: %Animal.facet.loc26: %Animal.type = facet_value constants.%Goat, (constants.%Animal.impl_witness) [concrete = constants.%Animal.facet] +// CHECK:STDOUT: %Animal.facet.loc26: %Animal.type = facet_value %Goat.ref.loc26_21, (constants.%Animal.impl_witness) [concrete = constants.%Animal.facet] // CHECK:STDOUT: %.loc26_26: %Animal.type = converted %Goat.ref.loc26_21, %Animal.facet.loc26 [concrete = constants.%Animal.facet] // CHECK:STDOUT: %as_type.loc26: type = facet_access_type %.loc26_26 [concrete = constants.%Goat] // CHECK:STDOUT: %.loc26_35: type = converted %.loc26_26, %as_type.loc26 [concrete = constants.%Goat] @@ -208,7 +208,7 @@ fn F[A:! J, B:! A](x: C(A, B)) { // CHECK:STDOUT: %.loc27_8: ref %Goat = converted %.loc27_6.1, %.loc27_6.4 // CHECK:STDOUT: %Goat.ref.loc27_21: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] // CHECK:STDOUT: %Animal.ref.loc27: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] -// CHECK:STDOUT: %Animal.facet.loc27: %Animal.type = facet_value constants.%Goat, (constants.%Animal.impl_witness) [concrete = constants.%Animal.facet] +// CHECK:STDOUT: %Animal.facet.loc27: %Animal.type = facet_value %Goat.ref.loc27_21, (constants.%Animal.impl_witness) [concrete = constants.%Animal.facet] // 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] diff --git a/toolchain/check/testdata/facet/convert_facet_value_to_itself.carbon b/toolchain/check/testdata/facet/convert_facet_value_to_itself.carbon index 3a55a729de50..f3262e1f383b 100644 --- a/toolchain/check/testdata/facet/convert_facet_value_to_itself.carbon +++ b/toolchain/check/testdata/facet/convert_facet_value_to_itself.carbon @@ -149,7 +149,7 @@ fn F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %HandleAnimal.ref: %HandleAnimal.type = name_ref HandleAnimal, file.%HandleAnimal.decl [concrete = constants.%HandleAnimal] // CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] -// CHECK:STDOUT: %Animal.facet: %Animal.type = facet_value constants.%Goat, (constants.%Animal.impl_witness) [concrete = constants.%Animal.facet] +// CHECK:STDOUT: %Animal.facet: %Animal.type = facet_value %Goat.ref, (constants.%Animal.impl_witness) [concrete = constants.%Animal.facet] // CHECK:STDOUT: %.loc25: %Animal.type = converted %Goat.ref, %Animal.facet [concrete = constants.%Animal.facet] // CHECK:STDOUT: %HandleAnimal.specific_fn: = specific_function %HandleAnimal.ref, @HandleAnimal(constants.%Animal.facet) [concrete = constants.%HandleAnimal.specific_fn] // CHECK:STDOUT: %HandleAnimal.call: init %empty_tuple.type = call %HandleAnimal.specific_fn() diff --git a/toolchain/check/testdata/facet/convert_facet_value_to_narrowed_facet_type.carbon b/toolchain/check/testdata/facet/convert_facet_value_to_narrowed_facet_type.carbon index 1f7783ba2435..2f0e6917d798 100644 --- a/toolchain/check/testdata/facet/convert_facet_value_to_narrowed_facet_type.carbon +++ b/toolchain/check/testdata/facet/convert_facet_value_to_narrowed_facet_type.carbon @@ -695,13 +695,13 @@ fn CallsWithTypeExplicit(U:! type) { // CHECK:STDOUT: %w.ref: @HandleTameAnimal2.%W.as_type.loc11_44.1 (%W.as_type) = name_ref w, %w // CHECK:STDOUT: %W.as_type.loc12_14.1: type = facet_access_type constants.%W [symbolic = %W.as_type.loc11_44.1 (constants.%W.as_type)] // CHECK:STDOUT: %.loc12_14.1: type = converted constants.%W, %W.as_type.loc12_14.1 [symbolic = %W.as_type.loc11_44.1 (constants.%W.as_type)] -// CHECK:STDOUT: %Animal.facet.loc12_14.1: %Animal.type = facet_value constants.%W.as_type, (constants.%Animal.lookup_impl_witness) [symbolic = %Animal.facet.loc12_14.3 (constants.%Animal.facet)] +// CHECK:STDOUT: %Animal.facet.loc12_14.1: %Animal.type = facet_value %.loc12_14.1, (constants.%Animal.lookup_impl_witness) [symbolic = %Animal.facet.loc12_14.3 (constants.%Animal.facet)] // CHECK:STDOUT: %.loc12_14.2: %Animal.type = converted %.loc12_14.1, %Animal.facet.loc12_14.1 [symbolic = %Animal.facet.loc12_14.3 (constants.%Animal.facet)] // CHECK:STDOUT: %facet_value.loc12_14.1: %facet_type.807 = facet_value constants.%W.as_type, (constants.%Eats.lookup_impl_witness, constants.%Tame.lookup_impl_witness) [symbolic = %facet_value.loc12_14.3 (constants.%facet_value)] // CHECK:STDOUT: %.loc12_14.3: %facet_type.807 = converted constants.%W.as_type, %facet_value.loc12_14.1 [symbolic = %facet_value.loc12_14.3 (constants.%facet_value)] // CHECK:STDOUT: %W.as_type.loc12_14.2: type = facet_access_type constants.%W [symbolic = %W.as_type.loc11_44.1 (constants.%W.as_type)] // CHECK:STDOUT: %.loc12_14.4: type = converted constants.%W, %W.as_type.loc12_14.2 [symbolic = %W.as_type.loc11_44.1 (constants.%W.as_type)] -// CHECK:STDOUT: %Animal.facet.loc12_14.2: %Animal.type = facet_value constants.%W.as_type, (constants.%Animal.lookup_impl_witness) [symbolic = %Animal.facet.loc12_14.3 (constants.%Animal.facet)] +// CHECK:STDOUT: %Animal.facet.loc12_14.2: %Animal.type = facet_value %.loc12_14.4, (constants.%Animal.lookup_impl_witness) [symbolic = %Animal.facet.loc12_14.3 (constants.%Animal.facet)] // CHECK:STDOUT: %.loc12_14.5: %Animal.type = converted %.loc12_14.4, %Animal.facet.loc12_14.2 [symbolic = %Animal.facet.loc12_14.3 (constants.%Animal.facet)] // CHECK:STDOUT: %facet_value.loc12_14.2: %facet_type.807 = facet_value constants.%W.as_type, (constants.%Eats.lookup_impl_witness, constants.%Tame.lookup_impl_witness) [symbolic = %facet_value.loc12_14.3 (constants.%facet_value)] // CHECK:STDOUT: %.loc12_14.6: %facet_type.807 = converted constants.%W.as_type, %facet_value.loc12_14.2 [symbolic = %facet_value.loc12_14.3 (constants.%facet_value)] @@ -1253,7 +1253,7 @@ fn CallsWithTypeExplicit(U:! type) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %TakesExtraWhereExplicit.ref: %TakesExtraWhereExplicit.type = name_ref TakesExtraWhereExplicit, file.%TakesExtraWhereExplicit.decl [concrete = constants.%TakesExtraWhereExplicit] // CHECK:STDOUT: %U.ref: type = name_ref U, %U.loc9_26.2 [symbolic = %U.loc9_26.1 (constants.%U)] -// CHECK:STDOUT: %facet_value.loc10_28.1: %type = facet_value constants.%U, () [symbolic = %facet_value.loc10_28.2 (constants.%facet_value)] +// CHECK:STDOUT: %facet_value.loc10_28.1: %type = facet_value %U.ref, () [symbolic = %facet_value.loc10_28.2 (constants.%facet_value)] // CHECK:STDOUT: %.loc10: %type = converted %U.ref, %facet_value.loc10_28.1 [symbolic = %facet_value.loc10_28.2 (constants.%facet_value)] // CHECK:STDOUT: %TakesExtraWhereExplicit.specific_fn.loc10_3.1: = specific_function %TakesExtraWhereExplicit.ref, @TakesExtraWhereExplicit(constants.%facet_value) [symbolic = %TakesExtraWhereExplicit.specific_fn.loc10_3.2 (constants.%TakesExtraWhereExplicit.specific_fn)] // CHECK:STDOUT: %TakesExtraWhereExplicit.call: init %empty_tuple.type = call %TakesExtraWhereExplicit.specific_fn.loc10_3.1() diff --git a/toolchain/check/testdata/facet/convert_interface.carbon b/toolchain/check/testdata/facet/convert_interface.carbon index a9428eff539a..0827b0b119aa 100644 --- a/toolchain/check/testdata/facet/convert_interface.carbon +++ b/toolchain/check/testdata/facet/convert_interface.carbon @@ -104,7 +104,7 @@ fn G() { F(Animal); } // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] // CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] -// CHECK:STDOUT: %Eats.facet: %Eats.type = facet_value constants.%Animal.type, (constants.%Eats.impl_witness) [concrete = constants.%Eats.facet] +// CHECK:STDOUT: %Eats.facet: %Eats.type = facet_value %Animal.ref, (constants.%Eats.impl_witness) [concrete = constants.%Eats.facet] // CHECK:STDOUT: %.loc23: %Eats.type = converted %Animal.ref, %Eats.facet [concrete = constants.%Eats.facet] // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.ref(%.loc23) // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/for/actual.carbon b/toolchain/check/testdata/for/actual.carbon index 44cd86d40e3a..e88f7aa25dd6 100644 --- a/toolchain/check/testdata/for/actual.carbon +++ b/toolchain/check/testdata/for/actual.carbon @@ -331,7 +331,7 @@ fn Read() { // 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.2 [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: %Copy.facet.loc11_75.2: %Copy.type = facet_value constants.%Int.49d0e6.1, (constants.%Copy.lookup_impl_witness.ccc) [symbolic = %Copy.facet.loc11_75.1 (constants.%Copy.facet.cd7)] +// CHECK:STDOUT: %Copy.facet.loc11_75.2: %Copy.type = facet_value %Int.loc11_74, (constants.%Copy.lookup_impl_witness.ccc) [symbolic = %Copy.facet.loc11_75.1 (constants.%Copy.facet.cd7)] // CHECK:STDOUT: %.loc11_75: %Copy.type = converted %Int.loc11_74, %Copy.facet.loc11_75.2 [symbolic = %Copy.facet.loc11_75.1 (constants.%Copy.facet.cd7)] // CHECK:STDOUT: %Optional.loc11_75.2: type = class_type @Optional, @Optional(constants.%Copy.facet.cd7) [symbolic = %Optional.loc11_75.1 (constants.%Optional.671)] // CHECK:STDOUT: %self.param: @IntRange.as.Iterate.impl.Next.%IntRange (%IntRange.349) = value_param call_param0 @@ -427,7 +427,7 @@ fn Read() { // 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.2 [symbolic = %N (constants.%N)] // CHECK:STDOUT: %Int.loc9_85: type = class_type @Int, @Int(constants.%N) [symbolic = %Int.loc9_54.1 (constants.%Int.49d0e6.1)] -// CHECK:STDOUT: %Copy.facet.loc9_85.2: %Copy.type = facet_value constants.%Int.49d0e6.1, (constants.%Copy.lookup_impl_witness.ccc) [symbolic = %Copy.facet.loc9_85.1 (constants.%Copy.facet.cd7)] +// CHECK:STDOUT: %Copy.facet.loc9_85.2: %Copy.type = facet_value %Int.loc9_85, (constants.%Copy.lookup_impl_witness.ccc) [symbolic = %Copy.facet.loc9_85.1 (constants.%Copy.facet.cd7)] // CHECK:STDOUT: %.loc9_85: %Copy.type = converted %Int.loc9_85, %Copy.facet.loc9_85.2 [symbolic = %Copy.facet.loc9_85.1 (constants.%Copy.facet.cd7)] // CHECK:STDOUT: %.loc9_24: type = where_expr %.Self [symbolic = %Iterate_where.type (constants.%Iterate_where.type)] { // CHECK:STDOUT: requirement_base_facet_type constants.%Iterate.type @@ -642,7 +642,7 @@ fn Read() { // 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.2 [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: %Copy.facet.loc15_41: %Copy.type = facet_value constants.%Int.49d0e6.1, (constants.%Copy.lookup_impl_witness.ccc) [symbolic = %Copy.facet.loc11_75.1 (constants.%Copy.facet.cd7)] +// CHECK:STDOUT: %Copy.facet.loc15_41: %Copy.type = facet_value %Int.loc15, (constants.%Copy.lookup_impl_witness.ccc) [symbolic = %Copy.facet.loc11_75.1 (constants.%Copy.facet.cd7)] // CHECK:STDOUT: %.loc15_41: %Copy.type = converted %Int.loc15, %Copy.facet.loc15_41 [symbolic = %Copy.facet.loc11_75.1 (constants.%Copy.facet.cd7)] // CHECK:STDOUT: %Optional.loc15: type = class_type @Optional, @Optional(constants.%Copy.facet.cd7) [symbolic = %Optional.loc11_75.1 (constants.%Optional.671)] // CHECK:STDOUT: %.loc15_42: @IntRange.as.Iterate.impl.Next.%Optional.Some.type (%Optional.Some.type.20f) = specific_constant imports.%Core.import_ref.9103, @Optional(constants.%Copy.facet.cd7) [symbolic = %Optional.Some (constants.%Optional.Some.dff)] @@ -673,7 +673,7 @@ fn Read() { // 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.2 [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: %Copy.facet.loc17: %Copy.type = facet_value constants.%Int.49d0e6.1, (constants.%Copy.lookup_impl_witness.ccc) [symbolic = %Copy.facet.loc11_75.1 (constants.%Copy.facet.cd7)] +// CHECK:STDOUT: %Copy.facet.loc17: %Copy.type = facet_value %Int.loc17, (constants.%Copy.lookup_impl_witness.ccc) [symbolic = %Copy.facet.loc11_75.1 (constants.%Copy.facet.cd7)] // CHECK:STDOUT: %.loc17_41: %Copy.type = converted %Int.loc17, %Copy.facet.loc17 [symbolic = %Copy.facet.loc11_75.1 (constants.%Copy.facet.cd7)] // CHECK:STDOUT: %Optional.loc17: type = class_type @Optional, @Optional(constants.%Copy.facet.cd7) [symbolic = %Optional.loc11_75.1 (constants.%Optional.671)] // CHECK:STDOUT: %.loc17_42: @IntRange.as.Iterate.impl.Next.%Optional.None.type (%Optional.None.type.66e) = specific_constant imports.%Core.import_ref.725b, @Optional(constants.%Copy.facet.cd7) [symbolic = %Optional.None (constants.%Optional.None.016)] diff --git a/toolchain/check/testdata/for/pattern.carbon b/toolchain/check/testdata/for/pattern.carbon index 3d47d92b3503..3c874f3083d2 100644 --- a/toolchain/check/testdata/for/pattern.carbon +++ b/toolchain/check/testdata/for/pattern.carbon @@ -209,7 +209,7 @@ fn Run() { // CHECK:STDOUT: } // CHECK:STDOUT: %EmptyRange.ref: %EmptyRange.type = name_ref EmptyRange, imports.%Main.EmptyRange [concrete = constants.%EmptyRange.generic] // CHECK:STDOUT: %C.ref.loc10_27: type = name_ref C, imports.%Main.C [concrete = constants.%C] -// CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value constants.%C, (constants.%Copy.impl_witness.1de) [concrete = constants.%Copy.facet] +// CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %C.ref.loc10_27, (constants.%Copy.impl_witness.1de) [concrete = constants.%Copy.facet] // CHECK:STDOUT: %.loc10_28: %Copy.type = converted %C.ref.loc10_27, %Copy.facet [concrete = constants.%Copy.facet] // CHECK:STDOUT: %EmptyRange: type = class_type @EmptyRange, @EmptyRange(constants.%Copy.facet) [concrete = constants.%EmptyRange.ab3] // CHECK:STDOUT: %.loc10_29: %EmptyRange.Make.type.f28 = specific_constant imports.%Main.import_ref.8f2f, @EmptyRange(constants.%Copy.facet) [concrete = constants.%EmptyRange.Make.203] @@ -392,7 +392,7 @@ fn Run() { // CHECK:STDOUT: } // CHECK:STDOUT: %EmptyRange.ref: %EmptyRange.type = name_ref EmptyRange, imports.%Main.EmptyRange [concrete = constants.%EmptyRange.generic] // CHECK:STDOUT: %C.ref.loc10_31: type = name_ref C, imports.%Main.C [concrete = constants.%C] -// CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value constants.%C, (constants.%Copy.impl_witness.1de) [concrete = constants.%Copy.facet] +// CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %C.ref.loc10_31, (constants.%Copy.impl_witness.1de) [concrete = constants.%Copy.facet] // CHECK:STDOUT: %.loc10_32: %Copy.type = converted %C.ref.loc10_31, %Copy.facet [concrete = constants.%Copy.facet] // CHECK:STDOUT: %EmptyRange: type = class_type @EmptyRange, @EmptyRange(constants.%Copy.facet) [concrete = constants.%EmptyRange.ab3] // CHECK:STDOUT: %.loc10_33: %EmptyRange.Make.type.f28 = specific_constant imports.%Main.import_ref.8f2f, @EmptyRange(constants.%Copy.facet) [concrete = constants.%EmptyRange.Make.203] diff --git a/toolchain/check/testdata/function/generic/call.carbon b/toolchain/check/testdata/function/generic/call.carbon index 593bd05cd4f5..660afa99db2b 100644 --- a/toolchain/check/testdata/function/generic/call.carbon +++ b/toolchain/check/testdata/function/generic/call.carbon @@ -213,7 +213,7 @@ fn CallSpecific(x: C*) -> C* { // CHECK:STDOUT: %T.ref.loc18: type = name_ref T, %T.loc16_19.2 [symbolic = %T.loc16_19.1 (constants.%T.8b3)] // CHECK:STDOUT: %ptr.loc18: type = ptr_type %T.ref.loc18 [symbolic = %ptr.loc16_33.1 (constants.%ptr.79f)] // CHECK:STDOUT: %x.ref: @CallGenericPtr.%ptr.loc16_33.1 (%ptr.79f) = name_ref x, %x -// CHECK:STDOUT: %Copy.facet.loc18_24.1: %Copy.type = facet_value constants.%ptr.79f, (constants.%Copy.lookup_impl_witness.cb2) [symbolic = %Copy.facet.loc18_24.4 (constants.%Copy.facet.2d1)] +// CHECK:STDOUT: %Copy.facet.loc18_24.1: %Copy.type = facet_value %ptr.loc18, (constants.%Copy.lookup_impl_witness.cb2) [symbolic = %Copy.facet.loc18_24.4 (constants.%Copy.facet.2d1)] // CHECK:STDOUT: %.loc18_24.1: %Copy.type = converted %ptr.loc18, %Copy.facet.loc18_24.1 [symbolic = %Copy.facet.loc18_24.4 (constants.%Copy.facet.2d1)] // CHECK:STDOUT: %Copy.facet.loc18_24.2: %Copy.type = facet_value constants.%ptr.79f, (constants.%Copy.lookup_impl_witness.cb2) [symbolic = %Copy.facet.loc18_24.4 (constants.%Copy.facet.2d1)] // CHECK:STDOUT: %.loc18_24.2: %Copy.type = converted constants.%ptr.79f, %Copy.facet.loc18_24.2 [symbolic = %Copy.facet.loc18_24.4 (constants.%Copy.facet.2d1)] @@ -231,7 +231,7 @@ fn CallSpecific(x: C*) -> C* { // CHECK:STDOUT: %C.ref.loc26: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %ptr.loc26: type = ptr_type %C.ref.loc26 [concrete = constants.%ptr.019] // CHECK:STDOUT: %x.ref: %ptr.019 = name_ref x, %x -// CHECK:STDOUT: %Copy.facet.loc26_24.1: %Copy.type = facet_value constants.%ptr.019, (constants.%Copy.impl_witness.999) [concrete = constants.%Copy.facet.9e3] +// CHECK:STDOUT: %Copy.facet.loc26_24.1: %Copy.type = facet_value %ptr.loc26, (constants.%Copy.impl_witness.999) [concrete = constants.%Copy.facet.9e3] // CHECK:STDOUT: %.loc26_24.1: %Copy.type = converted %ptr.loc26, %Copy.facet.loc26_24.1 [concrete = constants.%Copy.facet.9e3] // CHECK:STDOUT: %Copy.facet.loc26_24.2: %Copy.type = facet_value constants.%ptr.019, (constants.%Copy.impl_witness.999) [concrete = constants.%Copy.facet.9e3] // CHECK:STDOUT: %.loc26_24.2: %Copy.type = converted constants.%ptr.019, %Copy.facet.loc26_24.2 [concrete = constants.%Copy.facet.9e3] diff --git a/toolchain/check/testdata/function/generic/deduce.carbon b/toolchain/check/testdata/function/generic/deduce.carbon index 455ef883b5f5..c984c41f5c37 100644 --- a/toolchain/check/testdata/function/generic/deduce.carbon +++ b/toolchain/check/testdata/function/generic/deduce.carbon @@ -1666,7 +1666,7 @@ fn F() { // CHECK:STDOUT: %DD.ref: %DD.type = name_ref DD, file.%DD.decl [concrete = constants.%DD.generic] // CHECK:STDOUT: %E.ref: type = name_ref E, %E.loc12_14.1 [symbolic = %E.loc12_14.2 (constants.%E)] // CHECK:STDOUT: %DD.loc12_31.1: type = class_type @DD, @DD(constants.%E) [symbolic = %DD.loc12_31.2 (constants.%DD.296)] -// CHECK:STDOUT: %Z.facet.loc12_32.1: %Z.type = facet_value constants.%DD.296, (constants.%Z.lookup_impl_witness) [symbolic = %Z.facet.loc12_32.2 (constants.%Z.facet.bf0)] +// CHECK:STDOUT: %Z.facet.loc12_32.1: %Z.type = facet_value %DD.loc12_31.1, (constants.%Z.lookup_impl_witness) [symbolic = %Z.facet.loc12_32.2 (constants.%Z.facet.bf0)] // CHECK:STDOUT: %.loc12: %Z.type = converted %DD.loc12_31.1, %Z.facet.loc12_32.1 [symbolic = %Z.facet.loc12_32.2 (constants.%Z.facet.bf0)] // CHECK:STDOUT: %CC.loc12_32.1: type = class_type @CC, @CC(constants.%Z.facet.bf0) [symbolic = %CC.loc12_32.2 (constants.%CC.8ff)] // CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type] @@ -1762,11 +1762,11 @@ fn F() { // CHECK:STDOUT: %DD.ref: %DD.type = name_ref DD, file.%DD.decl [concrete = constants.%DD.generic] // CHECK:STDOUT: %EE.ref: type = name_ref EE, file.%EE.decl [concrete = constants.%EE] // CHECK:STDOUT: %DD: type = class_type @DD, @DD(constants.%EE) [concrete = constants.%DD.689] -// CHECK:STDOUT: %Z.facet.loc15_12: %Z.type = facet_value constants.%DD.689, (constants.%Z.impl_witness.fbd) [concrete = constants.%Z.facet.8b7] +// CHECK:STDOUT: %Z.facet.loc15_12: %Z.type = facet_value %DD, (constants.%Z.impl_witness.fbd) [concrete = constants.%Z.facet.8b7] // CHECK:STDOUT: %.loc15_12: %Z.type = converted %DD, %Z.facet.loc15_12 [concrete = constants.%Z.facet.8b7] // CHECK:STDOUT: %CC: type = class_type @CC, @CC(constants.%Z.facet.8b7) [concrete = constants.%CC.3fd] // CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type] -// CHECK:STDOUT: %Z.facet.loc15_14: %Z.type = facet_value constants.%CC.3fd, (constants.%Z.impl_witness.94c) [concrete = constants.%Z.facet.327] +// CHECK:STDOUT: %Z.facet.loc15_14: %Z.type = facet_value %CC, (constants.%Z.impl_witness.94c) [concrete = constants.%Z.facet.327] // CHECK:STDOUT: %.loc15_14: %Z.type = converted %CC, %Z.facet.loc15_14 [concrete = constants.%Z.facet.327] // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/generic/deduce_nested_facet_value.carbon b/toolchain/check/testdata/function/generic/deduce_nested_facet_value.carbon index 284e06181ac0..51961b049e08 100644 --- a/toolchain/check/testdata/function/generic/deduce_nested_facet_value.carbon +++ b/toolchain/check/testdata/function/generic/deduce_nested_facet_value.carbon @@ -71,8 +71,8 @@ fn F() { // CHECK:STDOUT: %facet_type: type = facet_type <@Y & @W> [concrete] // CHECK:STDOUT: %E: %facet_type = bind_symbolic_name E, 0 [symbolic] // CHECK:STDOUT: %pattern_type.50c: type = pattern_type %facet_type [concrete] -// CHECK:STDOUT: %Y.lookup_impl_witness: = lookup_impl_witness %E, @Y [symbolic] // CHECK:STDOUT: %E.as_type: type = facet_access_type %E [symbolic] +// CHECK:STDOUT: %Y.lookup_impl_witness: = lookup_impl_witness %E, @Y [symbolic] // CHECK:STDOUT: %Y.facet.682: %Y.type = facet_value %E.as_type, (%Y.lookup_impl_witness) [symbolic] // CHECK:STDOUT: %CC.6f9: type = class_type @CC, @CC(%Y.facet.682) [symbolic] // CHECK:STDOUT: %Z.impl_witness.3fa: = impl_witness file.%Z.impl_witness_table, @CC.as.Z.impl(%E) [symbolic] @@ -137,7 +137,7 @@ fn F() { // CHECK:STDOUT: } { // CHECK:STDOUT: %CC.ref: %CC.type = name_ref CC, file.%CC.decl [concrete = constants.%CC.generic] // CHECK:STDOUT: %E.ref: %facet_type = name_ref E, %E.loc19_14.1 [symbolic = %E.loc19_14.2 (constants.%E)] -// CHECK:STDOUT: %E.as_type.loc19_29.1: type = facet_access_type constants.%E [symbolic = %E.as_type.loc19_29.2 (constants.%E.as_type)] +// CHECK:STDOUT: %E.as_type.loc19_29.1: type = facet_access_type %E.ref [symbolic = %E.as_type.loc19_29.2 (constants.%E.as_type)] // CHECK:STDOUT: %Y.facet.loc19_29.1: %Y.type = facet_value %E.as_type.loc19_29.1, (constants.%Y.lookup_impl_witness) [symbolic = %Y.facet.loc19_29.2 (constants.%Y.facet.682)] // CHECK:STDOUT: %.loc19_29: %Y.type = converted %E.ref, %Y.facet.loc19_29.1 [symbolic = %Y.facet.loc19_29.2 (constants.%Y.facet.682)] // CHECK:STDOUT: %CC.loc19_29.1: type = class_type @CC, @CC(constants.%Y.facet.682) [symbolic = %CC.loc19_29.2 (constants.%CC.6f9)] @@ -195,8 +195,8 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: generic impl @CC.as.Z.impl(%E.loc19_14.1: %facet_type) { // CHECK:STDOUT: %E.loc19_14.2: %facet_type = bind_symbolic_name E, 0 [symbolic = %E.loc19_14.2 (constants.%E)] -// CHECK:STDOUT: %Y.lookup_impl_witness: = lookup_impl_witness %E.loc19_14.2, @Y [symbolic = %Y.lookup_impl_witness (constants.%Y.lookup_impl_witness)] // CHECK:STDOUT: %E.as_type.loc19_29.2: type = facet_access_type %E.loc19_14.2 [symbolic = %E.as_type.loc19_29.2 (constants.%E.as_type)] +// CHECK:STDOUT: %Y.lookup_impl_witness: = lookup_impl_witness %E.loc19_14.2, @Y [symbolic = %Y.lookup_impl_witness (constants.%Y.lookup_impl_witness)] // CHECK:STDOUT: %Y.facet.loc19_29.2: %Y.type = facet_value %E.as_type.loc19_29.2, (%Y.lookup_impl_witness) [symbolic = %Y.facet.loc19_29.2 (constants.%Y.facet.682)] // CHECK:STDOUT: %CC.loc19_29.2: type = class_type @CC, @CC(%Y.facet.loc19_29.2) [symbolic = %CC.loc19_29.2 (constants.%CC.6f9)] // CHECK:STDOUT: %Z.impl_witness: = impl_witness file.%Z.impl_witness_table, @CC.as.Z.impl(%E.loc19_14.2) [symbolic = %Z.impl_witness (constants.%Z.impl_witness.3fa)] @@ -235,13 +235,13 @@ fn F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %CC.ref: %CC.type = name_ref CC, file.%CC.decl [concrete = constants.%CC.generic] // CHECK:STDOUT: %DD.ref: type = name_ref DD, file.%DD.decl [concrete = constants.%DD] -// CHECK:STDOUT: %Y.facet: %Y.type = facet_value constants.%DD, (constants.%Y.impl_witness) [concrete = constants.%Y.facet.4e8] +// CHECK:STDOUT: %Y.facet: %Y.type = facet_value %DD.ref, (constants.%Y.impl_witness) [concrete = constants.%Y.facet.4e8] // CHECK:STDOUT: %.loc22_9: %Y.type = converted %DD.ref, %Y.facet [concrete = constants.%Y.facet.4e8] // CHECK:STDOUT: %CC: type = class_type @CC, @CC(constants.%Y.facet.4e8) [concrete = constants.%CC.3b3] // CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type] // CHECK:STDOUT: %facet_value: %facet_type = facet_value constants.%DD, (constants.%Y.impl_witness, constants.%W.impl_witness) [concrete = constants.%facet_value] // CHECK:STDOUT: %.loc22_12.1: %facet_type = converted constants.%DD, %facet_value [concrete = constants.%facet_value] -// CHECK:STDOUT: %Z.facet: %Z.type = facet_value constants.%CC.3b3, (constants.%Z.impl_witness.8f8) [concrete = constants.%Z.facet] +// CHECK:STDOUT: %Z.facet: %Z.type = facet_value %CC, (constants.%Z.impl_witness.8f8) [concrete = constants.%Z.facet] // CHECK:STDOUT: %.loc22_12.2: %Z.type = converted %CC, %Z.facet [concrete = constants.%Z.facet] // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -256,8 +256,8 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: specific @CC.as.Z.impl(constants.%E) { // CHECK:STDOUT: %E.loc19_14.2 => constants.%E -// CHECK:STDOUT: %Y.lookup_impl_witness => constants.%Y.lookup_impl_witness // CHECK:STDOUT: %E.as_type.loc19_29.2 => constants.%E.as_type +// CHECK:STDOUT: %Y.lookup_impl_witness => constants.%Y.lookup_impl_witness // CHECK:STDOUT: %Y.facet.loc19_29.2 => constants.%Y.facet.682 // CHECK:STDOUT: %CC.loc19_29.2 => constants.%CC.6f9 // CHECK:STDOUT: %Z.impl_witness => constants.%Z.impl_witness.3fa @@ -269,8 +269,8 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: specific @CC.as.Z.impl(constants.%facet_value) { // CHECK:STDOUT: %E.loc19_14.2 => constants.%facet_value -// CHECK:STDOUT: %Y.lookup_impl_witness => constants.%Y.impl_witness // CHECK:STDOUT: %E.as_type.loc19_29.2 => constants.%DD +// CHECK:STDOUT: %Y.lookup_impl_witness => constants.%Y.impl_witness // CHECK:STDOUT: %Y.facet.loc19_29.2 => constants.%Y.facet.4e8 // CHECK:STDOUT: %CC.loc19_29.2 => constants.%CC.3b3 // CHECK:STDOUT: %Z.impl_witness => constants.%Z.impl_witness.8f8 diff --git a/toolchain/check/testdata/generic/dependent_param.carbon b/toolchain/check/testdata/generic/dependent_param.carbon index 22de7eda6ef7..fa6ade6b5309 100644 --- a/toolchain/check/testdata/generic/dependent_param.carbon +++ b/toolchain/check/testdata/generic/dependent_param.carbon @@ -193,7 +193,7 @@ var n: i32 = Outer(i32).Inner(42).Get(); // CHECK:STDOUT: %Outer.ref: %Outer.type = name_ref Outer, file.%Outer.decl [concrete = constants.%Outer.generic] // 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: %Copy.facet.loc13_23: %Copy.type = facet_value constants.%i32, (constants.%Copy.impl_witness.a32) [concrete = constants.%Copy.facet.c49] +// CHECK:STDOUT: %Copy.facet.loc13_23: %Copy.type = facet_value %i32, (constants.%Copy.impl_witness.a32) [concrete = constants.%Copy.facet.c49] // CHECK:STDOUT: %.loc13_23: %Copy.type = converted %i32, %Copy.facet.loc13_23 [concrete = constants.%Copy.facet.c49] // CHECK:STDOUT: %Outer: type = class_type @Outer, @Outer(constants.%Copy.facet.c49) [concrete = constants.%Outer.3a3] // CHECK:STDOUT: %.loc13_24: %Inner.type.ce0 = specific_constant @Outer.%Inner.decl, @Outer(constants.%Copy.facet.c49) [concrete = constants.%Inner.generic.6c7] diff --git a/toolchain/check/testdata/generic/dot_self_symbolic_type.carbon b/toolchain/check/testdata/generic/dot_self_symbolic_type.carbon index ae3ae470ba6f..0e337756fffd 100644 --- a/toolchain/check/testdata/generic/dot_self_symbolic_type.carbon +++ b/toolchain/check/testdata/generic/dot_self_symbolic_type.carbon @@ -463,7 +463,7 @@ fn H(T:! type) { // CHECK:STDOUT: %DD.ref: type = name_ref DD, @D.%DD.loc14_9.2 [symbolic = %DD (constants.%DD)] // CHECK:STDOUT: %ptr.loc21_14.1: type = ptr_type %DD.ref [symbolic = %ptr.loc21_14.2 (constants.%ptr.79f131.2)] // CHECK:STDOUT: %B.type.loc21_15.1: type = facet_type <@B, @B(constants.%ptr.79f131.2)> [symbolic = %B.type.loc21_15.2 (constants.%B.type.6d756f.2)] -// CHECK:STDOUT: %B.facet.loc21_7.1: @D.G.%B.type.loc21_15.2 (%B.type.6d756f.2) = facet_value constants.%T.336, (constants.%B.lookup_impl_witness.8e3) [symbolic = %B.facet.loc21_7.2 (constants.%B.facet.c0e)] +// CHECK:STDOUT: %B.facet.loc21_7.1: @D.G.%B.type.loc21_15.2 (%B.type.6d756f.2) = facet_value %T.ref, (constants.%B.lookup_impl_witness.8e3) [symbolic = %B.facet.loc21_7.2 (constants.%B.facet.c0e)] // CHECK:STDOUT: %.loc21: @D.G.%B.type.loc21_15.2 (%B.type.6d756f.2) = converted %T.ref, %B.facet.loc21_7.1 [symbolic = %B.facet.loc21_7.2 (constants.%B.facet.c0e)] // CHECK:STDOUT: // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/impl/compound.carbon b/toolchain/check/testdata/impl/compound.carbon index 37839ff16f65..74a1bff947a0 100644 --- a/toolchain/check/testdata/impl/compound.carbon +++ b/toolchain/check/testdata/impl/compound.carbon @@ -289,7 +289,7 @@ fn InstanceCallFail() { // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %empty_tuple.type} [concrete = constants.%struct_type.a] // CHECK:STDOUT: %NonInstance1.ref: type = name_ref NonInstance1, file.%NonInstance1.decl [concrete = constants.%NonInstance1.type] // CHECK:STDOUT: %F1.ref: %NonInstance1.assoc_type = name_ref F1, @NonInstance1.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %NonInstance1.facet: %NonInstance1.type = facet_value constants.%struct_type.a, (constants.%NonInstance1.impl_witness) [concrete = constants.%NonInstance1.facet] +// CHECK:STDOUT: %NonInstance1.facet: %NonInstance1.type = facet_value %struct_type.a, (constants.%NonInstance1.impl_witness) [concrete = constants.%NonInstance1.facet] // CHECK:STDOUT: %.loc12_11: %NonInstance1.type = converted %struct_type.a, %NonInstance1.facet [concrete = constants.%NonInstance1.facet] // CHECK:STDOUT: %impl.elem0: %.ced = impl_witness_access constants.%NonInstance1.impl_witness, element0 [concrete = constants.%struct_type.a.as.NonInstance1.impl.F1] // CHECK:STDOUT: %struct_type.a.as.NonInstance1.impl.F1.call: init %empty_tuple.type = call %impl.elem0() diff --git a/toolchain/check/testdata/impl/fail_impl_as_scope.carbon b/toolchain/check/testdata/impl/fail_impl_as_scope.carbon index 02ee55f57537..073a6362a5b7 100644 --- a/toolchain/check/testdata/impl/fail_impl_as_scope.carbon +++ b/toolchain/check/testdata/impl/fail_impl_as_scope.carbon @@ -426,7 +426,7 @@ class X { // 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.534] -// CHECK:STDOUT: %Z.facet: %Z.type = facet_value constants.%Point, (constants.%Z.impl_witness) [concrete = constants.%Z.facet] +// CHECK:STDOUT: %Z.facet: %Z.type = facet_value %Point.ref.loc28, (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: %.1d8 = impl_witness_access constants.%Z.impl_witness, element0 [concrete = constants.%Point.as.Z.impl.Zero] // CHECK:STDOUT: %Point.as.Z.impl.Zero.call: init %empty_tuple.type = call %impl.elem0() diff --git a/toolchain/check/testdata/impl/fail_self_type_mismatch.carbon b/toolchain/check/testdata/impl/fail_self_type_mismatch.carbon index df9141280976..214d40039031 100644 --- a/toolchain/check/testdata/impl/fail_self_type_mismatch.carbon +++ b/toolchain/check/testdata/impl/fail_self_type_mismatch.carbon @@ -176,7 +176,7 @@ impl i32 as I { // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [concrete = constants.%C.generic] // CHECK:STDOUT: %Bool.call: init type = call constants.%Bool() [concrete = bool] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] -// CHECK:STDOUT: %I.facet: %I.type = facet_value bool, (constants.%I.impl_witness.ef0) [concrete = constants.%I.facet.acb] +// CHECK:STDOUT: %I.facet: %I.type = facet_value %Bool.call, (constants.%I.impl_witness.ef0) [concrete = constants.%I.facet.acb] // CHECK:STDOUT: %.loc32_18: %I.type = converted %Bool.call, %I.facet [concrete = constants.%I.facet.acb] // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%I.type, constants.%I.facet.acb) [concrete = constants.%C.41d] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/impl/forward_decls.carbon b/toolchain/check/testdata/impl/forward_decls.carbon index ff3536dc0a18..b42841471576 100644 --- a/toolchain/check/testdata/impl/forward_decls.carbon +++ b/toolchain/check/testdata/impl/forward_decls.carbon @@ -644,7 +644,7 @@ interface I { // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [concrete = constants.%C] // CHECK:STDOUT: %I.ref: type = name_ref I, %I.decl [concrete = constants.%I.type] // CHECK:STDOUT: %T.ref: %I.assoc_type = name_ref T, @T.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %I.facet: %I.type = facet_value constants.%C, (constants.%I.impl_witness) [concrete = constants.%I.facet] +// CHECK:STDOUT: %I.facet: %I.type = facet_value %C.ref, (constants.%I.impl_witness) [concrete = constants.%I.facet] // CHECK:STDOUT: %.loc9_9.2: %I.type = converted %C.ref, %I.facet [concrete = constants.%I.facet] // CHECK:STDOUT: %impl.elem0: type = impl_witness_access constants.%I.impl_witness, element0 [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } @@ -774,7 +774,7 @@ interface I { // CHECK:STDOUT: %.loc9_16.1: type = splice_block %impl.elem0 [concrete = constants.%empty_tuple.type] { // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [concrete = constants.%C] // CHECK:STDOUT: %I.ref: type = name_ref I, %I.decl [concrete = constants.%I.type] -// CHECK:STDOUT: %I.facet: %I.type = facet_value constants.%C, (constants.%I.impl_witness) [concrete = constants.%I.facet] +// CHECK:STDOUT: %I.facet: %I.type = facet_value %C.ref, (constants.%I.impl_witness) [concrete = constants.%I.facet] // CHECK:STDOUT: %.loc9_11: %I.type = converted %C.ref, %I.facet [concrete = constants.%I.facet] // CHECK:STDOUT: %T.ref: %I.assoc_type = name_ref T, @T.%assoc0 [concrete = constants.%assoc0] // CHECK:STDOUT: %as_type: type = facet_access_type %.loc9_11 [concrete = constants.%C] @@ -887,7 +887,7 @@ interface I { // CHECK:STDOUT: %.loc13_16.1: type = splice_block %impl.elem0 [concrete = ] { // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [concrete = constants.%C] // CHECK:STDOUT: %I.ref: type = name_ref I, %I.decl [concrete = constants.%I.type] -// CHECK:STDOUT: %I.facet: %I.type = facet_value constants.%C, (constants.%I.impl_witness) [concrete = constants.%I.facet] +// CHECK:STDOUT: %I.facet: %I.type = facet_value %C.ref, (constants.%I.impl_witness) [concrete = constants.%I.facet] // CHECK:STDOUT: %.loc13_11: %I.type = converted %C.ref, %I.facet [concrete = constants.%I.facet] // CHECK:STDOUT: %T.ref: %I.assoc_type = name_ref T, @T.%assoc0 [concrete = constants.%assoc0] // CHECK:STDOUT: %as_type: type = facet_access_type %.loc13_11 [concrete = constants.%C] @@ -1250,7 +1250,7 @@ interface I { // CHECK:STDOUT: %.loc8_12.1: type = splice_block %C.loc8 [concrete = constants.%C.cc1] { // CHECK:STDOUT: %C.ref.loc8: %C.type = name_ref C, file.%C.decl.loc6 [concrete = constants.%C.generic] // CHECK:STDOUT: %D.ref.loc8: type = name_ref D, file.%D.decl [concrete = constants.%D] -// CHECK:STDOUT: %I.facet.loc8: %I.type = facet_value constants.%D, (constants.%I.impl_witness) [concrete = constants.%I.facet] +// CHECK:STDOUT: %I.facet.loc8: %I.type = facet_value %D.ref.loc8, (constants.%I.impl_witness) [concrete = constants.%I.facet] // CHECK:STDOUT: %.loc8_12.2: %I.type = converted %D.ref.loc8, %I.facet.loc8 [concrete = constants.%I.facet] // CHECK:STDOUT: %C.loc8: type = class_type @C, @C(constants.%I.facet) [concrete = constants.%C.cc1] // CHECK:STDOUT: } @@ -1278,7 +1278,7 @@ interface I { // CHECK:STDOUT: %.loc14_12.1: type = splice_block %C.loc14 [concrete = constants.%C.cc1] { // CHECK:STDOUT: %C.ref.loc14: %C.type = name_ref C, file.%C.decl.loc6 [concrete = constants.%C.generic] // CHECK:STDOUT: %D.ref.loc14: type = name_ref D, file.%D.decl [concrete = constants.%D] -// CHECK:STDOUT: %I.facet.loc14: %I.type = facet_value constants.%D, (constants.%I.impl_witness) [concrete = constants.%I.facet] +// CHECK:STDOUT: %I.facet.loc14: %I.type = facet_value %D.ref.loc14, (constants.%I.impl_witness) [concrete = constants.%I.facet] // CHECK:STDOUT: %.loc14_12.2: %I.type = converted %D.ref.loc14, %I.facet.loc14 [concrete = constants.%I.facet] // CHECK:STDOUT: %C.loc14: type = class_type @C, @C(constants.%I.facet) [concrete = constants.%C.cc1] // CHECK:STDOUT: } @@ -1729,7 +1729,7 @@ interface I { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl.loc6 [concrete = constants.%F] // CHECK:STDOUT: %C.ref.loc27: type = name_ref C, file.%C.decl.loc9 [concrete = constants.%C] -// CHECK:STDOUT: %X.facet.loc27: %X.type = facet_value constants.%C, (constants.%X.impl_witness) [concrete = constants.%X.facet] +// CHECK:STDOUT: %X.facet.loc27: %X.type = facet_value %C.ref.loc27, (constants.%X.impl_witness) [concrete = constants.%X.facet] // CHECK:STDOUT: %.loc27: %X.type = converted %C.ref.loc27, %X.facet.loc27 [concrete = constants.%X.facet] // CHECK:STDOUT: %F.specific_fn: = specific_function %F.ref, @F(constants.%X.facet) [concrete = constants.%F.specific_fn] // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.specific_fn() diff --git a/toolchain/check/testdata/impl/import_compound.carbon b/toolchain/check/testdata/impl/import_compound.carbon index 82e7c3baa36b..7377b3f73781 100644 --- a/toolchain/check/testdata/impl/import_compound.carbon +++ b/toolchain/check/testdata/impl/import_compound.carbon @@ -326,7 +326,7 @@ fn InstanceCallImportFail() { // CHECK:STDOUT: %struct_type.i: type = struct_type {.i: %empty_tuple.type} [concrete = constants.%struct_type.i] // CHECK:STDOUT: %NonInstance.ref: type = name_ref NonInstance, imports.%Main.NonInstance [concrete = constants.%NonInstance.type] // CHECK:STDOUT: %F.ref: %NonInstance.assoc_type = name_ref F, imports.%Main.import_ref.e3c [concrete = constants.%assoc0] -// CHECK:STDOUT: %NonInstance.facet: %NonInstance.type = facet_value constants.%struct_type.i, (constants.%NonInstance.impl_witness) [concrete = constants.%NonInstance.facet] +// CHECK:STDOUT: %NonInstance.facet: %NonInstance.type = facet_value %struct_type.i, (constants.%NonInstance.impl_witness) [concrete = constants.%NonInstance.facet] // CHECK:STDOUT: %.loc6_11: %NonInstance.type = converted %struct_type.i, %NonInstance.facet [concrete = constants.%NonInstance.facet] // CHECK:STDOUT: %impl.elem0: %.4aa = impl_witness_access constants.%NonInstance.impl_witness, element0 [concrete = constants.%struct_type.i.as.NonInstance.impl.F] // CHECK:STDOUT: %struct_type.i.as.NonInstance.impl.F.call: init %empty_tuple.type = call %impl.elem0() diff --git a/toolchain/check/testdata/impl/import_thunk.carbon b/toolchain/check/testdata/impl/import_thunk.carbon index bfbbaefd2124..f506859f3e1e 100644 --- a/toolchain/check/testdata/impl/import_thunk.carbon +++ b/toolchain/check/testdata/impl/import_thunk.carbon @@ -511,7 +511,7 @@ fn G() { // 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.3f3] -// CHECK:STDOUT: %I.facet: %I.type = facet_value constants.%C.607, (constants.%I.impl_witness.a00) [concrete = constants.%I.facet] +// CHECK:STDOUT: %I.facet: %I.type = facet_value %C, (constants.%I.impl_witness.a00) [concrete = constants.%I.facet] // CHECK:STDOUT: %.loc7_8: %I.type = converted %C, %I.facet [concrete = constants.%I.facet] // CHECK:STDOUT: %impl.elem0: %.2ed = impl_witness_access constants.%I.impl_witness.a00, element0 [concrete = constants.%C.as.I.impl.F.1dded6.2] // CHECK:STDOUT: %.loc7_16.1: %empty_struct_type = struct_literal () diff --git a/toolchain/check/testdata/impl/import_use_generic.carbon b/toolchain/check/testdata/impl/import_use_generic.carbon index c353d36c0144..2685156c09c6 100644 --- a/toolchain/check/testdata/impl/import_use_generic.carbon +++ b/toolchain/check/testdata/impl/import_use_generic.carbon @@ -275,7 +275,7 @@ fn H() -> C({}).(I.F)() {} // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%empty_struct_type) [concrete = constants.%C.7a7] // 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: %I.facet: %I.type = facet_value constants.%C.7a7, (constants.%I.impl_witness.bed) [concrete = constants.%I.facet] +// CHECK:STDOUT: %I.facet: %I.type = facet_value %C, (constants.%I.impl_witness.bed) [concrete = constants.%I.facet] // CHECK:STDOUT: %.loc25_16: %I.type = converted %C, %I.facet [concrete = constants.%I.facet] // CHECK:STDOUT: %impl.elem0: %.100 = impl_witness_access constants.%I.impl_witness.bed, element0 [concrete = constants.%C.as.I.impl.F.09f] // CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @C.as.I.impl.F(constants.%empty_struct_type) [concrete = constants.%C.as.I.impl.F.specific_fn] diff --git a/toolchain/check/testdata/impl/interface_args.carbon b/toolchain/check/testdata/impl/interface_args.carbon index 279e6b359c60..722377e69d95 100644 --- a/toolchain/check/testdata/impl/interface_args.carbon +++ b/toolchain/check/testdata/impl/interface_args.carbon @@ -1233,7 +1233,7 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(constants.%B)> [concrete = constants.%Factory.type.3cb] // CHECK:STDOUT: %.loc5_23: %Factory.assoc_type.579 = specific_constant imports.%Main.import_ref.46c, @Factory(constants.%B) [concrete = constants.%assoc0.153] // CHECK:STDOUT: %Make.ref: %Factory.assoc_type.579 = name_ref Make, %.loc5_23 [concrete = constants.%assoc0.153] -// CHECK:STDOUT: %Factory.facet: %Factory.type.3cb = facet_value constants.%A, (constants.%Factory.impl_witness) [concrete = constants.%Factory.facet] +// CHECK:STDOUT: %Factory.facet: %Factory.type.3cb = facet_value %A.ref, (constants.%Factory.impl_witness) [concrete = constants.%Factory.facet] // CHECK:STDOUT: %.loc5_11: %Factory.type.3cb = converted %A.ref, %Factory.facet [concrete = constants.%Factory.facet] // CHECK:STDOUT: %impl.elem0: %.549 = impl_witness_access constants.%Factory.impl_witness, element0 [concrete = constants.%A.as.Factory.impl.Make] // CHECK:STDOUT: %.loc4: ref %B = splice_block %return {} diff --git a/toolchain/check/testdata/impl/lookup/canonical_query_self.carbon b/toolchain/check/testdata/impl/lookup/canonical_query_self.carbon index 8bb17d98e352..9c78ea2eef10 100644 --- a/toolchain/check/testdata/impl/lookup/canonical_query_self.carbon +++ b/toolchain/check/testdata/impl/lookup/canonical_query_self.carbon @@ -308,23 +308,23 @@ fn G() { // CHECK:STDOUT: %t.ref: @F.%T.as_type.loc22_20.1 (%T.as_type) = name_ref t, %t // CHECK:STDOUT: %T.ref.loc26: %facet_type = name_ref T, %T.loc22_6.2 [symbolic = %T.loc22_6.1 (constants.%T)] // 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.1 (constants.%T.as_type)] +// CHECK:STDOUT: %T.as_type.loc26_18: type = facet_access_type %T.ref.loc26 [symbolic = %T.as_type.loc22_20.1 (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.6ef)] // CHECK:STDOUT: %.loc26_18: %I.type = converted %T.ref.loc26, %I.facet.loc26_18.1 [symbolic = %I.facet.loc26_18.2 (constants.%I.facet.6ef)] // CHECK:STDOUT: %as_type.loc26_24: type = facet_access_type %.loc26_18 [symbolic = %T.as_type.loc22_20.1 (constants.%T.as_type)] // CHECK:STDOUT: %.loc26_24: type = converted %.loc26_18, %as_type.loc26_24 [symbolic = %T.as_type.loc22_20.1 (constants.%T.as_type)] // CHECK:STDOUT: %J.ref.loc26_36: type = name_ref J, file.%J.decl [concrete = constants.%J.type] -// CHECK:STDOUT: %J.facet.loc26_33.1: %J.type = facet_value constants.%T.as_type, (constants.%J.lookup_impl_witness) [symbolic = %J.facet.loc26_33.2 (constants.%J.facet.10a)] +// CHECK:STDOUT: %J.facet.loc26_33.1: %J.type = facet_value %.loc26_24, (constants.%J.lookup_impl_witness) [symbolic = %J.facet.loc26_33.2 (constants.%J.facet.10a)] // CHECK:STDOUT: %.loc26_33: %J.type = converted %.loc26_24, %J.facet.loc26_33.1 [symbolic = %J.facet.loc26_33.2 (constants.%J.facet.10a)] // CHECK:STDOUT: %as_type.loc26_39: type = facet_access_type %.loc26_33 [symbolic = %T.as_type.loc22_20.1 (constants.%T.as_type)] // CHECK:STDOUT: %.loc26_39: type = converted %.loc26_33, %as_type.loc26_39 [symbolic = %T.as_type.loc22_20.1 (constants.%T.as_type)] // CHECK:STDOUT: %I.ref.loc26_51: type = name_ref I, file.%I.decl [concrete = constants.%I.type] -// CHECK:STDOUT: %I.facet.loc26_48: %I.type = facet_value constants.%T.as_type, (constants.%I.lookup_impl_witness) [symbolic = %I.facet.loc26_18.2 (constants.%I.facet.6ef)] +// CHECK:STDOUT: %I.facet.loc26_48: %I.type = facet_value %.loc26_39, (constants.%I.lookup_impl_witness) [symbolic = %I.facet.loc26_18.2 (constants.%I.facet.6ef)] // CHECK:STDOUT: %.loc26_48: %I.type = converted %.loc26_39, %I.facet.loc26_48 [symbolic = %I.facet.loc26_18.2 (constants.%I.facet.6ef)] // CHECK:STDOUT: %as_type.loc26_54: type = facet_access_type %.loc26_48 [symbolic = %T.as_type.loc22_20.1 (constants.%T.as_type)] // CHECK:STDOUT: %.loc26_54: type = converted %.loc26_48, %as_type.loc26_54 [symbolic = %T.as_type.loc22_20.1 (constants.%T.as_type)] // CHECK:STDOUT: %J.ref.loc26_66: type = name_ref J, file.%J.decl [concrete = constants.%J.type] -// CHECK:STDOUT: %J.facet.loc26_63: %J.type = facet_value constants.%T.as_type, (constants.%J.lookup_impl_witness) [symbolic = %J.facet.loc26_33.2 (constants.%J.facet.10a)] +// CHECK:STDOUT: %J.facet.loc26_63: %J.type = facet_value %.loc26_54, (constants.%J.lookup_impl_witness) [symbolic = %J.facet.loc26_33.2 (constants.%J.facet.10a)] // CHECK:STDOUT: %.loc26_63: %J.type = converted %.loc26_54, %J.facet.loc26_63 [symbolic = %J.facet.loc26_33.2 (constants.%J.facet.10a)] // CHECK:STDOUT: %as_type.loc26_67: type = facet_access_type %.loc26_63 [symbolic = %T.as_type.loc22_20.1 (constants.%T.as_type)] // CHECK:STDOUT: %.loc26_67: type = converted %.loc26_63, %as_type.loc26_67 [symbolic = %T.as_type.loc22_20.1 (constants.%T.as_type)] @@ -351,22 +351,22 @@ fn G() { // CHECK:STDOUT: %.loc40_8.1: ref %C = converted %.loc40_6.1, %.loc40_6.4 // CHECK:STDOUT: %C.ref.loc40_24: type = name_ref C, %C.decl [concrete = constants.%C] // CHECK:STDOUT: %I.ref.loc40_29: type = name_ref I, file.%I.decl [concrete = constants.%I.type] -// CHECK:STDOUT: %I.facet.loc40_26: %I.type = facet_value constants.%C, (constants.%I.impl_witness) [concrete = constants.%I.facet.0a4] +// CHECK:STDOUT: %I.facet.loc40_26: %I.type = facet_value %C.ref.loc40_24, (constants.%I.impl_witness) [concrete = constants.%I.facet.0a4] // CHECK:STDOUT: %.loc40_26: %I.type = converted %C.ref.loc40_24, %I.facet.loc40_26 [concrete = constants.%I.facet.0a4] // CHECK:STDOUT: %as_type.loc40_32: type = facet_access_type %.loc40_26 [concrete = constants.%C] // CHECK:STDOUT: %.loc40_32: type = converted %.loc40_26, %as_type.loc40_32 [concrete = constants.%C] // CHECK:STDOUT: %J.ref.loc40_44: type = name_ref J, file.%J.decl [concrete = constants.%J.type] -// CHECK:STDOUT: %J.facet.loc40_41: %J.type = facet_value constants.%C, (constants.%J.impl_witness) [concrete = constants.%J.facet.5ad] +// CHECK:STDOUT: %J.facet.loc40_41: %J.type = facet_value %.loc40_32, (constants.%J.impl_witness) [concrete = constants.%J.facet.5ad] // CHECK:STDOUT: %.loc40_41: %J.type = converted %.loc40_32, %J.facet.loc40_41 [concrete = constants.%J.facet.5ad] // CHECK:STDOUT: %as_type.loc40_47: type = facet_access_type %.loc40_41 [concrete = constants.%C] // CHECK:STDOUT: %.loc40_47: type = converted %.loc40_41, %as_type.loc40_47 [concrete = constants.%C] // CHECK:STDOUT: %I.ref.loc40_59: type = name_ref I, file.%I.decl [concrete = constants.%I.type] -// CHECK:STDOUT: %I.facet.loc40_56: %I.type = facet_value constants.%C, (constants.%I.impl_witness) [concrete = constants.%I.facet.0a4] +// CHECK:STDOUT: %I.facet.loc40_56: %I.type = facet_value %.loc40_47, (constants.%I.impl_witness) [concrete = constants.%I.facet.0a4] // CHECK:STDOUT: %.loc40_56: %I.type = converted %.loc40_47, %I.facet.loc40_56 [concrete = constants.%I.facet.0a4] // CHECK:STDOUT: %as_type.loc40_62: type = facet_access_type %.loc40_56 [concrete = constants.%C] // CHECK:STDOUT: %.loc40_62: type = converted %.loc40_56, %as_type.loc40_62 [concrete = constants.%C] // CHECK:STDOUT: %J.ref.loc40_74: type = name_ref J, file.%J.decl [concrete = constants.%J.type] -// CHECK:STDOUT: %J.facet.loc40_71: %J.type = facet_value constants.%C, (constants.%J.impl_witness) [concrete = constants.%J.facet.5ad] +// CHECK:STDOUT: %J.facet.loc40_71: %J.type = facet_value %.loc40_62, (constants.%J.impl_witness) [concrete = constants.%J.facet.5ad] // CHECK:STDOUT: %.loc40_71: %J.type = converted %.loc40_62, %J.facet.loc40_71 [concrete = constants.%J.facet.5ad] // 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] @@ -383,7 +383,7 @@ fn G() { // CHECK:STDOUT: %.loc46_9.3: init %C = class_init (), %.loc46_9.2 [concrete = constants.%C.val] // CHECK:STDOUT: %.loc46_9.4: ref %C = temporary %.loc46_9.2, %.loc46_9.3 // CHECK:STDOUT: %.loc46_11.1: ref %C = converted %.loc46_9.1, %.loc46_9.4 -// CHECK:STDOUT: %facet_value.loc46_15.1: %facet_type = facet_value constants.%C, (constants.%I.impl_witness, constants.%J.impl_witness) [concrete = constants.%facet_value.d36] +// CHECK:STDOUT: %facet_value.loc46_15.1: %facet_type = facet_value %C.ref.loc46_5, (constants.%I.impl_witness, constants.%J.impl_witness) [concrete = constants.%facet_value.d36] // CHECK:STDOUT: %.loc46_15.1: %facet_type = converted %C.ref.loc46_5, %facet_value.loc46_15.1 [concrete = constants.%facet_value.d36] // CHECK:STDOUT: %facet_value.loc46_15.2: %facet_type = facet_value constants.%C, (constants.%I.impl_witness, constants.%J.impl_witness) [concrete = constants.%facet_value.d36] // CHECK:STDOUT: %.loc46_15.2: %facet_type = converted constants.%C, %facet_value.loc46_15.2 [concrete = constants.%facet_value.d36] diff --git a/toolchain/check/testdata/impl/lookup/lookup_interface_with_enclosing_generic_inside_rewrite_constraint.carbon b/toolchain/check/testdata/impl/lookup/lookup_interface_with_enclosing_generic_inside_rewrite_constraint.carbon index 5dc130a21f3b..59ccc4b82be6 100644 --- a/toolchain/check/testdata/impl/lookup/lookup_interface_with_enclosing_generic_inside_rewrite_constraint.carbon +++ b/toolchain/check/testdata/impl/lookup/lookup_interface_with_enclosing_generic_inside_rewrite_constraint.carbon @@ -687,7 +687,7 @@ fn F() { // CHECK:STDOUT: %.loc21_23.2: type = converted %type.as.BitAndWith.impl.Op.call.loc21_19, %.loc21_23.1 [concrete = constants.%facet_type] // CHECK:STDOUT: %facet_value.loc21_12: %facet_type = facet_value constants.%empty_tuple.type, (constants.%Z1.impl_witness, constants.%Z2.impl_witness) [concrete = constants.%facet_value.c33] // CHECK:STDOUT: %.loc21_12: %facet_type = converted %.loc21_10, %facet_value.loc21_12 [concrete = constants.%facet_value.c33] -// CHECK:STDOUT: %as_type.loc21_24: type = facet_access_type constants.%facet_value.c33 [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %as_type.loc21_24: type = facet_access_type %.loc21_12 [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %Z1.facet.loc21_24: %Z1.type = facet_value %as_type.loc21_24, (constants.%Z1.impl_witness) [concrete = constants.%Z1.facet] // CHECK:STDOUT: %.loc21_24: %Z1.type = converted %.loc21_12, %Z1.facet.loc21_24 [concrete = constants.%Z1.facet] // CHECK:STDOUT: %Outer.loc21_24: type = class_type @Outer, @Outer(constants.%Z1.facet) [concrete = constants.%Outer.63c] @@ -704,7 +704,7 @@ fn F() { // CHECK:STDOUT: %.loc21_48.2: type = converted %type.as.BitAndWith.impl.Op.call.loc21_44, %.loc21_48.1 [concrete = constants.%facet_type] // CHECK:STDOUT: %facet_value.loc21_37: %facet_type = facet_value constants.%empty_tuple.type, (constants.%Z1.impl_witness, constants.%Z2.impl_witness) [concrete = constants.%facet_value.c33] // CHECK:STDOUT: %.loc21_37: %facet_type = converted %.loc21_35, %facet_value.loc21_37 [concrete = constants.%facet_value.c33] -// CHECK:STDOUT: %as_type.loc21_49: type = facet_access_type constants.%facet_value.c33 [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %as_type.loc21_49: type = facet_access_type %.loc21_37 [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %Z1.facet.loc21_49: %Z1.type = facet_value %as_type.loc21_49, (constants.%Z1.impl_witness) [concrete = constants.%Z1.facet] // CHECK:STDOUT: %.loc21_49: %Z1.type = converted %.loc21_37, %Z1.facet.loc21_49 [concrete = constants.%Z1.facet] // CHECK:STDOUT: %Outer.loc21_49: type = class_type @Outer, @Outer(constants.%Z1.facet) [concrete = constants.%Outer.63c] 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 59943dda5d82..a93d056a8cfe 100644 --- a/toolchain/check/testdata/impl/lookup/specialization_with_symbolic_rewrite.carbon +++ b/toolchain/check/testdata/impl/lookup/specialization_with_symbolic_rewrite.carbon @@ -858,7 +858,7 @@ fn F[T:! Ptr](var t: T) -> T.(Ptr.Type) { // CHECK:STDOUT: %T.ref.loc9_29: type = name_ref T, %T.loc9_6.2 [symbolic = %T.loc9_6.1 (constants.%T.8b3)] // CHECK:STDOUT: %Ptr.ref: type = name_ref Ptr, file.%Ptr.decl [concrete = constants.%Ptr.type] // CHECK:STDOUT: %Type.ref: %Ptr.assoc_type = name_ref Type, @Type.%assoc0 [concrete = constants.%assoc0.d28] -// CHECK:STDOUT: %Ptr.facet.loc9_30.2: %Ptr.type = facet_value constants.%T.8b3, (constants.%Ptr.impl_witness.da31d2.2) [symbolic = %Ptr.facet.loc9_30.1 (constants.%Ptr.facet)] +// CHECK:STDOUT: %Ptr.facet.loc9_30.2: %Ptr.type = facet_value %T.ref.loc9_29, (constants.%Ptr.impl_witness.da31d2.2) [symbolic = %Ptr.facet.loc9_30.1 (constants.%Ptr.facet)] // CHECK:STDOUT: %.loc9: %Ptr.type = converted %T.ref.loc9_29, %Ptr.facet.loc9_30.2 [symbolic = %Ptr.facet.loc9_30.1 (constants.%Ptr.facet)] // CHECK:STDOUT: %impl.elem0.loc9: type = impl_witness_access constants.%Ptr.impl_witness.da31d2.2, element0 [symbolic = %ptr (constants.%ptr.79f131.2)] // CHECK:STDOUT: %.Self: %type = bind_symbolic_name .Self [symbolic_self = constants.%.Self.659] diff --git a/toolchain/check/testdata/impl/use_assoc_const.carbon b/toolchain/check/testdata/impl/use_assoc_const.carbon index caa21d55e7f2..8d5f398ce770 100644 --- a/toolchain/check/testdata/impl/use_assoc_const.carbon +++ b/toolchain/check/testdata/impl/use_assoc_const.carbon @@ -851,7 +851,7 @@ fn F() { // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [concrete = constants.%D] // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type] // CHECK:STDOUT: %F.ref: %J.assoc_type = name_ref F, @J.%assoc1 [concrete = constants.%assoc1.572] -// CHECK:STDOUT: %J.facet: %J.type = facet_value constants.%D, (constants.%J.impl_witness) [concrete = constants.%J.facet] +// CHECK:STDOUT: %J.facet: %J.type = facet_value %D.ref, (constants.%J.impl_witness) [concrete = constants.%J.facet] // CHECK:STDOUT: %.loc15_11: %J.type = converted %D.ref, %J.facet [concrete = constants.%J.facet] // CHECK:STDOUT: %impl.elem1: %.7fd = impl_witness_access constants.%J.impl_witness, element1 [concrete = constants.%D.as.J.impl.F] // CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [concrete = constants.%int_4.0c1] @@ -3112,7 +3112,7 @@ fn F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Self.ref: type = name_ref Self, @empty_tuple.type.as.M.impl.%.loc8_7.2 [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %M.ref: type = name_ref M, file.%M.decl [concrete = constants.%M.type] -// CHECK:STDOUT: %M.facet: %M.type = facet_value constants.%empty_tuple.type, (constants.%M.impl_witness) [concrete = constants.%M.facet] +// CHECK:STDOUT: %M.facet: %M.type = facet_value %Self.ref, (constants.%M.impl_witness) [concrete = constants.%M.facet] // CHECK:STDOUT: %.loc10_18: %M.type = converted %Self.ref, %M.facet [concrete = constants.%M.facet] // CHECK:STDOUT: %Z.ref: %M.assoc_type = name_ref Z, @Z.%assoc0 [concrete = constants.%assoc0] // CHECK:STDOUT: %as_type: type = facet_access_type %.loc10_18 [concrete = constants.%empty_tuple.type] @@ -3340,7 +3340,7 @@ fn F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Self.ref: type = name_ref Self, @C.as.M.impl.fc9.%C [concrete = constants.%C.7a7] // CHECK:STDOUT: %M.ref: type = name_ref M, file.%M.decl [concrete = constants.%M.type] -// CHECK:STDOUT: %M.facet: %M.type = facet_value constants.%C.7a7, (constants.%M.impl_witness.622) [concrete = constants.%M.facet.ec9] +// CHECK:STDOUT: %M.facet: %M.type = facet_value %Self.ref, (constants.%M.impl_witness.622) [concrete = constants.%M.facet.ec9] // CHECK:STDOUT: %.loc12_18: %M.type = converted %Self.ref, %M.facet [concrete = constants.%M.facet.ec9] // CHECK:STDOUT: %Z.ref: %M.assoc_type = name_ref Z, @Z.%assoc0 [concrete = constants.%assoc0.105] // CHECK:STDOUT: %as_type: type = facet_access_type %.loc12_18 [concrete = constants.%C.7a7] @@ -3357,7 +3357,7 @@ fn F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Self.ref: type = name_ref Self, @C.as.M.impl.e2b.%C [concrete = constants.%C.3a0] // CHECK:STDOUT: %M.ref: type = name_ref M, file.%M.decl [concrete = constants.%M.type] -// CHECK:STDOUT: %M.facet: %M.type = facet_value constants.%C.3a0, (constants.%M.impl_witness.9f7) [concrete = constants.%M.facet.d46] +// CHECK:STDOUT: %M.facet: %M.type = facet_value %Self.ref, (constants.%M.impl_witness.9f7) [concrete = constants.%M.facet.d46] // CHECK:STDOUT: %.loc18_18: %M.type = converted %Self.ref, %M.facet [concrete = constants.%M.facet.d46] // CHECK:STDOUT: %Z.ref: %M.assoc_type = name_ref Z, @Z.%assoc0 [concrete = constants.%assoc0.105] // CHECK:STDOUT: %as_type: type = facet_access_type %.loc18_18 [concrete = constants.%C.3a0] @@ -3841,7 +3841,7 @@ fn F() { // 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.659] -// CHECK:STDOUT: %Z.facet: %Z.type = facet_value constants.%D, (constants.%Z.impl_witness.4bd) [concrete = constants.%Z.facet] +// CHECK:STDOUT: %Z.facet: %Z.type = facet_value %D.ref.loc12_10, (constants.%Z.impl_witness.4bd) [concrete = constants.%Z.facet] // CHECK:STDOUT: %.loc12_11.2: %Z.type = converted %D.ref.loc12_10, %Z.facet [concrete = constants.%Z.facet] // CHECK:STDOUT: %impl.elem0: type = impl_witness_access constants.%Z.impl_witness.4bd, element0 [concrete = constants.%C.131] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/interface/compound_member_access.carbon b/toolchain/check/testdata/interface/compound_member_access.carbon index 0056de60ab90..80316456ca86 100644 --- a/toolchain/check/testdata/interface/compound_member_access.carbon +++ b/toolchain/check/testdata/interface/compound_member_access.carbon @@ -1324,7 +1324,7 @@ fn Works() { // CHECK:STDOUT: %type.as.BitAndWith.impl.Op.call.loc30_26: init type = call %bound_method.loc30_26(%A.ref.loc30_24, %A.ref.loc30_28) [concrete = constants.%A.type] // CHECK:STDOUT: %.loc30_29.1: type = value_of_initializer %type.as.BitAndWith.impl.Op.call.loc30_26 [concrete = constants.%A.type] // CHECK:STDOUT: %.loc30_29.2: type = converted %type.as.BitAndWith.impl.Op.call.loc30_26, %.loc30_29.1 [concrete = constants.%A.type] -// CHECK:STDOUT: %A.facet.loc30: %A.type = facet_value constants.%C, (constants.%A.impl_witness) [concrete = constants.%A.facet] +// CHECK:STDOUT: %A.facet.loc30: %A.type = facet_value %C.ref.loc30_18, (constants.%A.impl_witness) [concrete = constants.%A.facet] // CHECK:STDOUT: %.loc30_20: %A.type = converted %C.ref.loc30_18, %A.facet.loc30 [concrete = constants.%A.facet] // CHECK:STDOUT: %as_type.loc30: type = facet_access_type %.loc30_20 [concrete = constants.%C] // CHECK:STDOUT: %.loc30_30: type = converted %.loc30_20, %as_type.loc30 [concrete = constants.%C] @@ -1349,7 +1349,7 @@ fn Works() { // CHECK:STDOUT: %type.as.BitAndWith.impl.Op.call.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.as.BitAndWith.impl.Op.call.loc38 [concrete = constants.%A.type] // CHECK:STDOUT: %.loc38_29.2: type = converted %type.as.BitAndWith.impl.Op.call.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] +// CHECK:STDOUT: %A.facet.loc38: %A.type = facet_value %C.ref.loc38_18, (constants.%A.impl_witness) [concrete = constants.%A.facet] // CHECK:STDOUT: %.loc38_20: %A.type = converted %C.ref.loc38_18, %A.facet.loc38 [concrete = constants.%A.facet] // CHECK:STDOUT: %as_type.loc38: type = facet_access_type %.loc38_20 [concrete = constants.%C] // CHECK:STDOUT: %.loc38_30: type = converted %.loc38_20, %as_type.loc38 [concrete = constants.%C] @@ -1491,7 +1491,7 @@ fn Works() { // CHECK:STDOUT: %bound_method.loc13: = bound_method %A.ref.loc13_7, %impl.elem0.loc13_9 [concrete = constants.%type.as.BitAndWith.impl.Op.bound] // CHECK:STDOUT: %type.as.BitAndWith.impl.Op.call.loc13: init type = call %bound_method.loc13(%A.ref.loc13_7, %A.ref.loc13_11) [concrete = constants.%A.type] // CHECK:STDOUT: %G.ref.loc13: %A.assoc_type = name_ref G, @A.%assoc0 [concrete = constants.%assoc0.d52] -// CHECK:STDOUT: %A.facet.loc13: %A.type = facet_value constants.%C, (constants.%A.impl_witness) [concrete = constants.%A.facet] +// CHECK:STDOUT: %A.facet.loc13: %A.type = facet_value %C.ref.loc13, (constants.%A.impl_witness) [concrete = constants.%A.facet] // CHECK:STDOUT: %.loc13: %A.type = converted %C.ref.loc13, %A.facet.loc13 [concrete = constants.%A.facet] // CHECK:STDOUT: %impl.elem0.loc13_4: %.69a = impl_witness_access constants.%A.impl_witness, element0 [concrete = constants.%C.as.A.impl.G] // CHECK:STDOUT: %C.as.A.impl.G.call.loc13: init %empty_tuple.type = call %impl.elem0.loc13_4() @@ -1503,7 +1503,7 @@ fn Works() { // CHECK:STDOUT: %type.as.BitAndWith.impl.Op.call.loc14_12: init type = call %bound_method.loc14_12(%A.ref.loc14_10, %A.ref.loc14_14) [concrete = constants.%A.type] // CHECK:STDOUT: %.loc14_15.1: type = value_of_initializer %type.as.BitAndWith.impl.Op.call.loc14_12 [concrete = constants.%A.type] // CHECK:STDOUT: %.loc14_15.2: type = converted %type.as.BitAndWith.impl.Op.call.loc14_12, %.loc14_15.1 [concrete = constants.%A.type] -// CHECK:STDOUT: %A.facet.loc14: %A.type = facet_value constants.%C, (constants.%A.impl_witness) [concrete = constants.%A.facet] +// CHECK:STDOUT: %A.facet.loc14: %A.type = facet_value %C.ref.loc14, (constants.%A.impl_witness) [concrete = constants.%A.facet] // CHECK:STDOUT: %.loc14_6: %A.type = converted %C.ref.loc14, %A.facet.loc14 [concrete = constants.%A.facet] // CHECK:STDOUT: %A.ref.loc14_20: type = name_ref A, file.%A.decl [concrete = constants.%A.type] // CHECK:STDOUT: %A.ref.loc14_24: type = name_ref A, file.%A.decl [concrete = constants.%A.type] @@ -1521,7 +1521,7 @@ fn Works() { // CHECK:STDOUT: %type.as.BitAndWith.impl.Op.call.loc15: init type = call %bound_method.loc15(%A.ref.loc15_10, %A.ref.loc15_14) [concrete = constants.%A.type] // CHECK:STDOUT: %.loc15_15.1: type = value_of_initializer %type.as.BitAndWith.impl.Op.call.loc15 [concrete = constants.%A.type] // CHECK:STDOUT: %.loc15_15.2: type = converted %type.as.BitAndWith.impl.Op.call.loc15, %.loc15_15.1 [concrete = constants.%A.type] -// CHECK:STDOUT: %A.facet.loc15: %A.type = facet_value constants.%C, (constants.%A.impl_witness) [concrete = constants.%A.facet] +// CHECK:STDOUT: %A.facet.loc15: %A.type = facet_value %C.ref.loc15, (constants.%A.impl_witness) [concrete = constants.%A.facet] // CHECK:STDOUT: %.loc15_6: %A.type = converted %C.ref.loc15, %A.facet.loc15 [concrete = constants.%A.facet] // CHECK:STDOUT: %A.ref.loc15_19: type = name_ref A, file.%A.decl [concrete = constants.%A.type] // CHECK:STDOUT: %G.ref.loc15: %A.assoc_type = name_ref G, @A.%assoc0 [concrete = constants.%assoc0.d52] diff --git a/toolchain/check/testdata/interface/fail_assoc_const_alias.carbon b/toolchain/check/testdata/interface/fail_assoc_const_alias.carbon index 80dc5d18f9fb..1dc7cf2a2565 100644 --- a/toolchain/check/testdata/interface/fail_assoc_const_alias.carbon +++ b/toolchain/check/testdata/interface/fail_assoc_const_alias.carbon @@ -192,6 +192,7 @@ interface C { // CHECK:STDOUT: %assoc0.cd1: %I.assoc_type = assoc_entity element0, @I.%T [concrete] // CHECK:STDOUT: %J.type: type = facet_type <@J> [concrete] // CHECK:STDOUT: %Self.bf6: %J.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.bf6 [symbolic] // CHECK:STDOUT: %J.F.type: type = fn_type @J.F [concrete] // CHECK:STDOUT: %J.F: %J.F.type = struct_value () [concrete] // CHECK:STDOUT: %J.assoc_type: type = assoc_entity_type @J [concrete] @@ -236,6 +237,7 @@ interface C { // CHECK:STDOUT: %return.patt: = return_slot_pattern [concrete] // CHECK:STDOUT: %return.param_patt: = out_param_pattern %return.patt, call_param0 [concrete] // CHECK:STDOUT: } { +// CHECK:STDOUT: %Self.as_type.loc15_13.2: type = facet_access_type @J.%Self [symbolic = %Self.as_type.loc15_13.1 (constants.%Self.as_type)] // CHECK:STDOUT: %U.ref: = name_ref U, [concrete = ] // CHECK:STDOUT: %return.param: ref = out_param call_param0 // CHECK:STDOUT: %return: ref = return_slot %return.param @@ -255,12 +257,18 @@ interface C { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @J.F(@J.%Self: %J.type) { +// CHECK:STDOUT: %Self: %J.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.bf6)] +// CHECK:STDOUT: %Self.as_type.loc15_13.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc15_13.1 (constants.%Self.as_type)] +// CHECK:STDOUT: // CHECK:STDOUT: fn() -> ; // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @T(constants.%Self.7ee) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @J.F(constants.%Self.bf6) {} +// CHECK:STDOUT: specific @J.F(constants.%Self.bf6) { +// CHECK:STDOUT: %Self => constants.%Self.bf6 +// CHECK:STDOUT: %Self.as_type.loc15_13.1 => constants.%Self.as_type +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- alias_to_different_interface_with_requires.carbon // CHECK:STDOUT: @@ -362,11 +370,11 @@ interface C { // CHECK:STDOUT: %return.patt: @J2.F2.%pattern_type (%pattern_type.cad) = return_slot_pattern [concrete] // CHECK:STDOUT: %return.param_patt: @J2.F2.%pattern_type (%pattern_type.cad) = out_param_pattern %return.patt, call_param0 [concrete] // CHECK:STDOUT: } { -// CHECK:STDOUT: %Self.as_type.loc15_14.2: type = facet_access_type constants.%Self.a70 [symbolic = %Self.as_type.loc15_14.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %.loc15_14.1: type = converted constants.%Self.a70, %Self.as_type.loc15_14.2 [symbolic = %Self.as_type.loc15_14.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %.loc15_14.2: %J2.type = converted %.loc15_14.1, constants.%Self.a70 [symbolic = %Self (constants.%Self.a70)] +// CHECK:STDOUT: %Self.as_type.loc15_14.2: type = facet_access_type @J2.%Self [symbolic = %Self.as_type.loc15_14.1 (constants.%Self.as_type)] // CHECK:STDOUT: %Self.as_type.loc15_14.3: type = facet_access_type constants.%Self.a70 [symbolic = %Self.as_type.loc15_14.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %I2.facet.loc15_14.2: %I2.type = facet_value %Self.as_type.loc15_14.3, (constants.%I2.lookup_impl_witness.cb8) [symbolic = %I2.facet.loc15_14.1 (constants.%I2.facet)] +// CHECK:STDOUT: %.loc15_14.1: type = converted constants.%Self.a70, %Self.as_type.loc15_14.3 [symbolic = %Self.as_type.loc15_14.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc15_14.2: %J2.type = converted %.loc15_14.1, constants.%Self.a70 [symbolic = %Self (constants.%Self.a70)] +// CHECK:STDOUT: %I2.facet.loc15_14.2: %I2.type = facet_value %Self.as_type.loc15_14.2, (constants.%I2.lookup_impl_witness.cb8) [symbolic = %I2.facet.loc15_14.1 (constants.%I2.facet)] // CHECK:STDOUT: %.loc15_14.3: %I2.type = converted @J2.%Self, %I2.facet.loc15_14.2 [symbolic = %I2.facet.loc15_14.1 (constants.%I2.facet)] // CHECK:STDOUT: %impl.elem0.loc15_14.2: type = impl_witness_access constants.%I2.lookup_impl_witness.cb8, element0 [symbolic = %impl.elem0.loc15_14.1 (constants.%impl.elem0.dc2)] // CHECK:STDOUT: %U2.ref: type = name_ref U2, %impl.elem0.loc15_14.2 [symbolic = %impl.elem0.loc15_14.1 (constants.%impl.elem0.dc2)] @@ -448,8 +456,8 @@ interface C { // CHECK:STDOUT: constants { // CHECK:STDOUT: %A.type: type = facet_type <@A> [concrete] // CHECK:STDOUT: %Self.0dd: %A.type = bind_symbolic_name Self, 0 [symbolic] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.0dd [symbolic] -// CHECK:STDOUT: %pattern_type.f23: type = pattern_type %Self.as_type [symbolic] +// CHECK:STDOUT: %Self.as_type.bb6: type = facet_access_type %Self.0dd [symbolic] +// CHECK:STDOUT: %pattern_type.f23: type = pattern_type %Self.as_type.bb6 [symbolic] // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete] // CHECK:STDOUT: %A.F.type: type = fn_type @A.F [concrete] // CHECK:STDOUT: %A.F: %A.F.type = struct_value () [concrete] @@ -457,6 +465,7 @@ interface C { // CHECK:STDOUT: %assoc0.2e6: %A.assoc_type = assoc_entity element0, @A.%A.F.decl [concrete] // CHECK:STDOUT: %B.type: type = facet_type <@B> [concrete] // CHECK:STDOUT: %Self.975: %B.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self.as_type.da9: type = facet_access_type %Self.975 [symbolic] // CHECK:STDOUT: %B.G.type: type = fn_type @B.G [concrete] // CHECK:STDOUT: %B.G: %B.G.type = struct_value () [concrete] // CHECK:STDOUT: %B.assoc_type: type = assoc_entity_type @B [concrete] @@ -488,13 +497,13 @@ interface C { // CHECK:STDOUT: %return.patt: %pattern_type.98f = return_slot_pattern [concrete] // CHECK:STDOUT: %return.param_patt: %pattern_type.98f = out_param_pattern %return.patt, call_param1 [concrete] // CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: @A.F.%Self.as_type.loc6_14.1 (%Self.as_type) = value_param call_param0 -// CHECK:STDOUT: %.loc6_14.1: type = splice_block %.loc6_14.2 [symbolic = %Self.as_type.loc6_14.1 (constants.%Self.as_type)] { +// CHECK:STDOUT: %self.param: @A.F.%Self.as_type.loc6_14.1 (%Self.as_type.bb6) = value_param call_param0 +// CHECK:STDOUT: %.loc6_14.1: type = splice_block %.loc6_14.2 [symbolic = %Self.as_type.loc6_14.1 (constants.%Self.as_type.bb6)] { // CHECK:STDOUT: %Self.ref: %A.type = name_ref Self, @A.%Self [symbolic = %Self (constants.%Self.0dd)] -// CHECK:STDOUT: %Self.as_type.loc6_14.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc6_14.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %.loc6_14.2: type = converted %Self.ref, %Self.as_type.loc6_14.2 [symbolic = %Self.as_type.loc6_14.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %Self.as_type.loc6_14.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc6_14.1 (constants.%Self.as_type.bb6)] +// CHECK:STDOUT: %.loc6_14.2: type = converted %Self.ref, %Self.as_type.loc6_14.2 [symbolic = %Self.as_type.loc6_14.1 (constants.%Self.as_type.bb6)] // CHECK:STDOUT: } -// CHECK:STDOUT: %self: @A.F.%Self.as_type.loc6_14.1 (%Self.as_type) = bind_name self, %self.param +// CHECK:STDOUT: %self: @A.F.%Self.as_type.loc6_14.1 (%Self.as_type.bb6) = bind_name self, %self.param // CHECK:STDOUT: %return.param: ref type = out_param call_param1 // CHECK:STDOUT: %return: ref type = return_slot %return.param // CHECK:STDOUT: } @@ -515,6 +524,7 @@ interface C { // CHECK:STDOUT: %return.patt: = return_slot_pattern [concrete] // CHECK:STDOUT: %return.param_patt: = out_param_pattern %return.patt, call_param0 [concrete] // CHECK:STDOUT: } { +// CHECK:STDOUT: %Self.as_type.loc14_13.2: type = facet_access_type @B.%Self [symbolic = %Self.as_type.loc14_13.1 (constants.%Self.as_type.da9)] // CHECK:STDOUT: %F.ref: = name_ref F, [concrete = ] // CHECK:STDOUT: %return.param: ref = out_param call_param0 // CHECK:STDOUT: %return: ref = return_slot %return.param @@ -531,23 +541,29 @@ interface C { // CHECK:STDOUT: // CHECK:STDOUT: generic fn @A.F(@A.%Self: %A.type) { // CHECK:STDOUT: %Self: %A.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.0dd)] -// CHECK:STDOUT: %Self.as_type.loc6_14.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc6_14.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %Self.as_type.loc6_14.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc6_14.1 (constants.%Self.as_type.bb6)] // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type.loc6_14.1 [symbolic = %pattern_type (constants.%pattern_type.f23)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%self.param: @A.F.%Self.as_type.loc6_14.1 (%Self.as_type)) -> type; +// CHECK:STDOUT: fn(%self.param: @A.F.%Self.as_type.loc6_14.1 (%Self.as_type.bb6)) -> type; // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @B.G(@B.%Self: %B.type) { +// CHECK:STDOUT: %Self: %B.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.975)] +// CHECK:STDOUT: %Self.as_type.loc14_13.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc14_13.1 (constants.%Self.as_type.da9)] +// CHECK:STDOUT: // CHECK:STDOUT: fn() -> ; // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @A.F(constants.%Self.0dd) { // CHECK:STDOUT: %Self => constants.%Self.0dd -// CHECK:STDOUT: %Self.as_type.loc6_14.1 => constants.%Self.as_type +// CHECK:STDOUT: %Self.as_type.loc6_14.1 => constants.%Self.as_type.bb6 // CHECK:STDOUT: %pattern_type => constants.%pattern_type.f23 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @B.G(constants.%Self.975) {} +// CHECK:STDOUT: specific @B.G(constants.%Self.975) { +// CHECK:STDOUT: %Self => constants.%Self.975 +// CHECK:STDOUT: %Self.as_type.loc14_13.1 => constants.%Self.as_type.da9 +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- call_with_compound_member_access.carbon // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/fail_member_lookup.carbon b/toolchain/check/testdata/interface/fail_member_lookup.carbon index 6137229ad2c7..5ee306d31b37 100644 --- a/toolchain/check/testdata/interface/fail_member_lookup.carbon +++ b/toolchain/check/testdata/interface/fail_member_lookup.carbon @@ -67,6 +67,7 @@ fn G(U:! Different) -> U.(Interface.T); // CHECK:STDOUT: %.Self: %type = bind_symbolic_name .Self [symbolic_self] // CHECK:STDOUT: %U: %Different.type = bind_symbolic_name U, 0 [symbolic] // CHECK:STDOUT: %pattern_type.fa7: type = pattern_type %Different.type [concrete] +// CHECK:STDOUT: %U.as_type: type = facet_access_type %U [symbolic] // CHECK:STDOUT: %G.type: type = fn_type @G [concrete] // CHECK:STDOUT: %G: %G.type = struct_value () [concrete] // CHECK:STDOUT: } @@ -102,6 +103,7 @@ fn G(U:! Different) -> U.(Interface.T); // CHECK:STDOUT: %U.ref: %Different.type = name_ref U, %U.loc32_6.2 [symbolic = %U.loc32_6.1 (constants.%U)] // CHECK:STDOUT: %Interface.ref: type = name_ref Interface, file.%Interface.decl [concrete = constants.%Interface.type] // CHECK:STDOUT: %T.ref: %Interface.assoc_type = name_ref T, @T.%assoc1 [concrete = constants.%assoc1] +// CHECK:STDOUT: %U.as_type.loc32_25.2: type = facet_access_type %U.ref [symbolic = %U.as_type.loc32_25.1 (constants.%U.as_type)] // CHECK:STDOUT: %.loc32: type = splice_block %Different.ref [concrete = constants.%Different.type] { // CHECK:STDOUT: %.Self: %type = bind_symbolic_name .Self [symbolic_self = constants.%.Self] // CHECK:STDOUT: %Different.ref: type = name_ref Different, file.%Different.decl [concrete = constants.%Different.type] @@ -163,6 +165,7 @@ fn G(U:! Different) -> U.(Interface.T); // CHECK:STDOUT: // CHECK:STDOUT: generic fn @G(%U.loc32_6.2: %Different.type) { // CHECK:STDOUT: %U.loc32_6.1: %Different.type = bind_symbolic_name U, 0 [symbolic = %U.loc32_6.1 (constants.%U)] +// CHECK:STDOUT: %U.as_type.loc32_25.1: type = facet_access_type %U.loc32_6.1 [symbolic = %U.as_type.loc32_25.1 (constants.%U.as_type)] // CHECK:STDOUT: // CHECK:STDOUT: fn() -> ; // CHECK:STDOUT: } @@ -173,5 +176,6 @@ fn G(U:! Different) -> U.(Interface.T); // CHECK:STDOUT: // CHECK:STDOUT: specific @G(constants.%U) { // CHECK:STDOUT: %U.loc32_6.1 => constants.%U +// CHECK:STDOUT: %U.as_type.loc32_25.1 => constants.%U.as_type // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/generic.carbon b/toolchain/check/testdata/interface/generic.carbon index f861e23a526d..e9741832b7f7 100644 --- a/toolchain/check/testdata/interface/generic.carbon +++ b/toolchain/check/testdata/interface/generic.carbon @@ -399,6 +399,7 @@ fn G(T:! Generic(B)) { // CHECK:STDOUT: %G.type: type = fn_type @G [concrete] // CHECK:STDOUT: %G: %G.type = struct_value () [concrete] // CHECK:STDOUT: %Self.a3e: %Generic.type.227 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %T.as_type: type = facet_access_type %T.03b [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -483,11 +484,13 @@ fn G(T:! Generic(B)) { // CHECK:STDOUT: %T.loc10_6.1: %Generic.type.227 = bind_symbolic_name T, 0 [symbolic = %T.loc10_6.1 (constants.%T.03b)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: +// CHECK:STDOUT: %T.as_type.loc18_6.2: type = facet_access_type %T.loc10_6.1 [symbolic = %T.as_type.loc18_6.2 (constants.%T.as_type)] // CHECK:STDOUT: // CHECK:STDOUT: fn() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] // CHECK:STDOUT: %T.ref: %Generic.type.227 = name_ref T, %T.loc10_6.2 [symbolic = %T.loc10_6.1 (constants.%T.03b)] +// CHECK:STDOUT: %T.as_type.loc18_6.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc18_6.2 (constants.%T.as_type)] // 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 94d0aba32b95..e1c9a94e69eb 100644 --- a/toolchain/check/testdata/interface/generic_method.carbon +++ b/toolchain/check/testdata/interface/generic_method.carbon @@ -442,7 +442,7 @@ fn CallIndirect() { // 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.0a4] -// CHECK:STDOUT: %A.facet: %A.type.0a4 = facet_value constants.%Y, (constants.%A.impl_witness) [concrete = constants.%A.facet] +// CHECK:STDOUT: %A.facet: %A.type.0a4 = facet_value %Y.ref, (constants.%A.impl_witness) [concrete = constants.%A.facet] // CHECK:STDOUT: %.loc23_6: %A.type.0a4 = converted %Y.ref, %A.facet [concrete = constants.%A.facet] // CHECK:STDOUT: %.loc23_14.1: %A.assoc_type.296 = specific_constant @A.%assoc0.loc6_41.1, @A(constants.%X) [concrete = constants.%assoc0.5f6] // CHECK:STDOUT: %F.ref: %A.assoc_type.296 = name_ref F, %.loc23_14.1 [concrete = constants.%assoc0.5f6] @@ -538,7 +538,7 @@ fn CallIndirect() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %CallGeneric.ref: %CallGeneric.type = name_ref CallGeneric, file.%CallGeneric.decl [concrete = constants.%CallGeneric] // CHECK:STDOUT: %Y.ref: type = name_ref Y, file.%Y.decl [concrete = constants.%Y] -// CHECK:STDOUT: %A.facet: %A.type.0a4 = facet_value constants.%Y, (constants.%A.impl_witness) [concrete = constants.%A.facet] +// CHECK:STDOUT: %A.facet: %A.type.0a4 = facet_value %Y.ref, (constants.%A.impl_witness) [concrete = constants.%A.facet] // CHECK:STDOUT: %.loc32: %A.type.0a4 = converted %Y.ref, %A.facet [concrete = constants.%A.facet] // CHECK:STDOUT: %CallGeneric.specific_fn: = specific_function %CallGeneric.ref, @CallGeneric(constants.%A.facet) [concrete = constants.%CallGeneric.specific_fn] // CHECK:STDOUT: %CallGeneric.call: init %empty_tuple.type = call %CallGeneric.specific_fn() @@ -1034,7 +1034,7 @@ fn CallIndirect() { // 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.0a4] -// CHECK:STDOUT: %A.facet: %A.type.0a4 = facet_value constants.%tuple.type.a46, (constants.%A.impl_witness.c8b) [concrete = constants.%A.facet.cdd] +// CHECK:STDOUT: %A.facet: %A.type.0a4 = facet_value %.loc24_14, (constants.%A.impl_witness.c8b) [concrete = constants.%A.facet.cdd] // CHECK:STDOUT: %.loc24_23: %A.type.0a4 = converted %.loc24_14, %A.facet [concrete = constants.%A.facet.cdd] // CHECK:STDOUT: %.loc24_31.1: %A.assoc_type.296 = specific_constant @A.%assoc0.loc6_39.1, @A(constants.%X) [concrete = constants.%assoc0.5f6] // CHECK:STDOUT: %F.ref: %A.assoc_type.296 = name_ref F, %.loc24_31.1 [concrete = constants.%assoc0.5f6] @@ -1134,7 +1134,7 @@ fn CallIndirect() { // CHECK:STDOUT: %Y2.ref: type = name_ref Y2, file.%Y2.decl [concrete = constants.%Y2] // CHECK:STDOUT: %.loc33_22: %tuple.type.24b = tuple_literal (%Y1.ref, %Y2.ref) // CHECK:STDOUT: %.loc33_24: type = converted %.loc33_22, constants.%tuple.type.a46 [concrete = constants.%tuple.type.a46] -// CHECK:STDOUT: %A.facet: %A.type.0a4 = facet_value constants.%tuple.type.a46, (constants.%A.impl_witness.c8b) [concrete = constants.%A.facet.cdd] +// CHECK:STDOUT: %A.facet: %A.type.0a4 = facet_value %.loc33_24, (constants.%A.impl_witness.c8b) [concrete = constants.%A.facet.cdd] // CHECK:STDOUT: %.loc33_31: %A.type.0a4 = converted %.loc33_24, %A.facet [concrete = constants.%A.facet.cdd] // CHECK:STDOUT: %CallGeneric.specific_fn: = specific_function %CallGeneric.ref, @CallGeneric(constants.%A.facet.cdd) [concrete = constants.%CallGeneric.specific_fn] // CHECK:STDOUT: %CallGeneric.call: init %empty_tuple.type = call %CallGeneric.specific_fn() diff --git a/toolchain/check/testdata/primitives/import_symbolic.carbon b/toolchain/check/testdata/primitives/import_symbolic.carbon index 6baed52df20b..7388cafe463a 100644 --- a/toolchain/check/testdata/primitives/import_symbolic.carbon +++ b/toolchain/check/testdata/primitives/import_symbolic.carbon @@ -230,7 +230,7 @@ fn F() -> u32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C] // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type] -// CHECK:STDOUT: %I.facet: %I.type = facet_value constants.%C, (constants.%I.impl_witness) [concrete = constants.%I.facet] +// CHECK:STDOUT: %I.facet: %I.type = facet_value %C.ref, (constants.%I.impl_witness) [concrete = constants.%I.facet] // CHECK:STDOUT: %.loc7_13: %I.type = converted %C.ref, %I.facet [concrete = constants.%I.facet] // CHECK:STDOUT: %val.ref: %I.assoc_type = name_ref val, imports.%Main.import_ref.8be [concrete = constants.%assoc0.e13] // CHECK:STDOUT: %as_type: type = facet_access_type %.loc7_13 [concrete = constants.%C] @@ -279,7 +279,7 @@ fn F() -> u32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C] // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type] -// CHECK:STDOUT: %I.facet: %I.type = facet_value constants.%C, (constants.%I.impl_witness) [concrete = constants.%I.facet] +// CHECK:STDOUT: %I.facet: %I.type = facet_value %C.ref, (constants.%I.impl_witness) [concrete = constants.%I.facet] // CHECK:STDOUT: %.loc7_13: %I.type = converted %C.ref, %I.facet [concrete = constants.%I.facet] // CHECK:STDOUT: %val.ref: %I.assoc_type = name_ref val, imports.%Main.import_ref.da1 [concrete = constants.%assoc0.941] // CHECK:STDOUT: %as_type: type = facet_access_type %.loc7_13 [concrete = constants.%C] @@ -327,7 +327,7 @@ fn F() -> u32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C] // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type] -// CHECK:STDOUT: %I.facet: %I.type = facet_value constants.%C, (constants.%I.impl_witness) [concrete = constants.%I.facet] +// CHECK:STDOUT: %I.facet: %I.type = facet_value %C.ref, (constants.%I.impl_witness) [concrete = constants.%I.facet] // CHECK:STDOUT: %.loc7_13: %I.type = converted %C.ref, %I.facet [concrete = constants.%I.facet] // CHECK:STDOUT: %val.ref: %I.assoc_type = name_ref val, imports.%Main.import_ref.696 [concrete = constants.%assoc0.545] // CHECK:STDOUT: %as_type: type = facet_access_type %.loc7_13 [concrete = constants.%C] @@ -382,7 +382,7 @@ fn F() -> u32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C] // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type] -// CHECK:STDOUT: %I.facet: %I.type = facet_value constants.%C, (constants.%I.impl_witness) [concrete = constants.%I.facet] +// CHECK:STDOUT: %I.facet: %I.type = facet_value %C.ref, (constants.%I.impl_witness) [concrete = constants.%I.facet] // CHECK:STDOUT: %.loc7_13: %I.type = converted %C.ref, %I.facet [concrete = constants.%I.facet] // CHECK:STDOUT: %val.ref: %I.assoc_type = name_ref val, imports.%Main.import_ref.de3 [concrete = constants.%assoc0.ece] // CHECK:STDOUT: %as_type: type = facet_access_type %.loc7_13 [concrete = constants.%C] @@ -432,7 +432,7 @@ fn F() -> u32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C] // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type] -// CHECK:STDOUT: %I.facet: %I.type = facet_value constants.%C, (constants.%I.impl_witness) [concrete = constants.%I.facet] +// CHECK:STDOUT: %I.facet: %I.type = facet_value %C.ref, (constants.%I.impl_witness) [concrete = constants.%I.facet] // CHECK:STDOUT: %.loc7_13: %I.type = converted %C.ref, %I.facet [concrete = constants.%I.facet] // CHECK:STDOUT: %val.ref: %I.assoc_type = name_ref val, imports.%Main.import_ref.730 [concrete = constants.%assoc0.6ce] // CHECK:STDOUT: %as_type: type = facet_access_type %.loc7_13 [concrete = constants.%C] @@ -487,7 +487,7 @@ fn F() -> u32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C] // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type] -// CHECK:STDOUT: %I.facet: %I.type = facet_value constants.%C, (constants.%I.impl_witness) [concrete = constants.%I.facet] +// CHECK:STDOUT: %I.facet: %I.type = facet_value %C.ref, (constants.%I.impl_witness) [concrete = constants.%I.facet] // CHECK:STDOUT: %.loc7_13: %I.type = converted %C.ref, %I.facet [concrete = constants.%I.facet] // CHECK:STDOUT: %val.ref: %I.assoc_type = name_ref val, imports.%Main.import_ref.ba4 [concrete = constants.%assoc0.aac] // CHECK:STDOUT: %as_type: type = facet_access_type %.loc7_13 [concrete = constants.%C] @@ -537,7 +537,7 @@ fn F() -> u32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C] // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type] -// CHECK:STDOUT: %I.facet: %I.type = facet_value constants.%C, (constants.%I.impl_witness) [concrete = constants.%I.facet] +// CHECK:STDOUT: %I.facet: %I.type = facet_value %C.ref, (constants.%I.impl_witness) [concrete = constants.%I.facet] // CHECK:STDOUT: %.loc7_13: %I.type = converted %C.ref, %I.facet [concrete = constants.%I.facet] // CHECK:STDOUT: %val.ref: %I.assoc_type = name_ref val, imports.%Main.import_ref.bc2 [concrete = constants.%assoc0.fd8] // CHECK:STDOUT: %as_type: type = facet_access_type %.loc7_13 [concrete = constants.%C] @@ -592,7 +592,7 @@ fn F() -> u32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C] // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type] -// CHECK:STDOUT: %I.facet: %I.type = facet_value constants.%C, (constants.%I.impl_witness) [concrete = constants.%I.facet] +// CHECK:STDOUT: %I.facet: %I.type = facet_value %C.ref, (constants.%I.impl_witness) [concrete = constants.%I.facet] // CHECK:STDOUT: %.loc7_13: %I.type = converted %C.ref, %I.facet [concrete = constants.%I.facet] // CHECK:STDOUT: %val.ref: %I.assoc_type = name_ref val, imports.%Main.import_ref.d18 [concrete = constants.%assoc0.633] // CHECK:STDOUT: %as_type: type = facet_access_type %.loc7_13 [concrete = constants.%C] diff --git a/toolchain/check/testdata/struct/import.carbon b/toolchain/check/testdata/struct/import.carbon index 405352a10462..322431b4904d 100644 --- a/toolchain/check/testdata/struct/import.carbon +++ b/toolchain/check/testdata/struct/import.carbon @@ -323,7 +323,7 @@ fn F() -> {.x: i32} { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C] // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type] -// CHECK:STDOUT: %I.facet: %I.type = facet_value constants.%C, (constants.%I.impl_witness) [concrete = constants.%I.facet] +// CHECK:STDOUT: %I.facet: %I.type = facet_value %C.ref, (constants.%I.impl_witness) [concrete = constants.%I.facet] // CHECK:STDOUT: %.loc7_13: %I.type = converted %C.ref, %I.facet [concrete = constants.%I.facet] // CHECK:STDOUT: %val.ref: %I.assoc_type = name_ref val, imports.%Main.import_ref.1fc [concrete = constants.%assoc0.862] // CHECK:STDOUT: %as_type: type = facet_access_type %.loc7_13 [concrete = constants.%C] diff --git a/toolchain/check/testdata/tuple/import.carbon b/toolchain/check/testdata/tuple/import.carbon index 8d462b3a2f1f..85e08641fd38 100644 --- a/toolchain/check/testdata/tuple/import.carbon +++ b/toolchain/check/testdata/tuple/import.carbon @@ -351,7 +351,7 @@ fn F() -> (i32,) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C] // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type] -// CHECK:STDOUT: %I.facet: %I.type = facet_value constants.%C, (constants.%I.impl_witness) [concrete = constants.%I.facet] +// CHECK:STDOUT: %I.facet: %I.type = facet_value %C.ref, (constants.%I.impl_witness) [concrete = constants.%I.facet] // CHECK:STDOUT: %.loc7_13: %I.type = converted %C.ref, %I.facet [concrete = constants.%I.facet] // CHECK:STDOUT: %val.ref: %I.assoc_type = name_ref val, imports.%Main.import_ref.c77 [concrete = constants.%assoc0.2ff] // CHECK:STDOUT: %as_type: type = facet_access_type %.loc7_13 [concrete = constants.%C] diff --git a/toolchain/sem_ir/constant.h b/toolchain/sem_ir/constant.h index db165b24a200..a03234f90210 100644 --- a/toolchain/sem_ir/constant.h +++ b/toolchain/sem_ir/constant.h @@ -162,6 +162,14 @@ class ConstantValueStore { return GetInstId(GetAttached(inst_id)); } + // Given a type instruction, returns the unique constant instruction that is + // equivalent to it. Returns `None` for a non-constant instruction. + auto GetConstantTypeInstId(TypeInstId inst_id) const -> TypeInstId { + // If the source instruction has type `type`, its constant value will too, + // since the constant value of `type` is itself. + return TypeInstId::UnsafeMake(GetInstId(GetAttached(inst_id))); + } + // Given a symbolic constant, returns the unattached form of that constant. // For any other constant ID, returns the ID unchanged. auto GetUnattachedConstant(ConstantId const_id) const -> ConstantId {