Skip to content

Commit a6bb11f

Browse files
authored
Rearrange convert: construct FacetAccessType from a facet value before impl lookup instead of after (carbon-language#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.
1 parent 5abd214 commit a6bb11f

36 files changed

+158
-125
lines changed

toolchain/check/convert.cpp

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,19 +1198,24 @@ static auto PerformBuiltinConversion(
11981198
if (sem_ir.types().Is<SemIR::FacetType>(target.type_id) &&
11991199
(sem_ir.types().Is<SemIR::TypeType>(value_type_id) ||
12001200
sem_ir.types().Is<SemIR::FacetType>(value_type_id))) {
1201-
// The value is a type or facet value, so it has a constant value. We get
1202-
// that to unwrap things like NameRef and get to the underlying type or
1203-
// facet value instruction so that we can use `TryGetAs`.
1204-
auto const_value_id = sem_ir.constant_values().GetConstantInstId(value_id);
12051201
// TODO: Runtime facet values should be allowed to convert based on their
12061202
// FacetTypes, but we assume constant values for impl lookup at the moment.
1207-
if (!const_value_id.has_value()) {
1203+
if (!context.constant_values().Get(value_id).is_constant()) {
12081204
context.TODO(loc_id, "conversion of runtime facet value");
1209-
const_value_id = SemIR::ErrorInst::InstId;
1205+
return SemIR::ErrorInst::InstId;
12101206
}
12111207

1212-
if (auto facet_access_type_inst =
1213-
sem_ir.insts().TryGetAs<SemIR::FacetAccessType>(const_value_id)) {
1208+
// Get the canonical type for which we want to attach a new set of witnesses
1209+
// to match the requirements of the target FacetType.
1210+
auto type_inst_id = SemIR::TypeInstId::None;
1211+
if (sem_ir.types().Is<SemIR::FacetType>(value_type_id)) {
1212+
type_inst_id = AddTypeInst<SemIR::FacetAccessType>(
1213+
context, loc_id,
1214+
{.type_id = SemIR::TypeType::TypeId,
1215+
.facet_value_inst_id = value_id});
1216+
} else {
1217+
type_inst_id = context.types().GetAsTypeInstId(value_id);
1218+
12141219
// Shortcut for lossless round trips through a FacetAccessType when
12151220
// converting back to the type of its original facet value.
12161221
//
@@ -1222,9 +1227,19 @@ static auto PerformBuiltinConversion(
12221227
//
12231228
// See also test:
12241229
// facet_access_type_converts_back_to_original_facet_value.carbon
1225-
auto facet_value_inst_id = facet_access_type_inst->facet_value_inst_id;
1226-
if (sem_ir.insts().Get(facet_value_inst_id).type_id() == target.type_id) {
1227-
return facet_value_inst_id;
1230+
//
1231+
// TODO: This instruction is going to become a `SymbolicBindingType`, so
1232+
// we'll need to handle that instead.
1233+
auto const_type_inst_id =
1234+
sem_ir.constant_values().GetConstantTypeInstId(type_inst_id);
1235+
if (auto facet_access_type_inst =
1236+
sem_ir.insts().TryGetAs<SemIR::FacetAccessType>(
1237+
const_type_inst_id)) {
1238+
auto facet_value_inst_id = facet_access_type_inst->facet_value_inst_id;
1239+
if (sem_ir.insts().Get(facet_value_inst_id).type_id() ==
1240+
target.type_id) {
1241+
return facet_value_inst_id;
1242+
}
12281243
}
12291244
}
12301245

@@ -1233,25 +1248,12 @@ static auto PerformBuiltinConversion(
12331248
// type satisfies the requirements of the target `FacetType`, as determined
12341249
// by finding impl witnesses for the target FacetType.
12351250
auto lookup_result = LookupImplWitness(
1236-
context, loc_id, sem_ir.constant_values().Get(const_value_id),
1251+
context, loc_id, sem_ir.constant_values().Get(type_inst_id),
12371252
sem_ir.types().GetConstantId(target.type_id));
12381253
if (lookup_result.has_value()) {
12391254
if (lookup_result.has_error_value()) {
12401255
return SemIR::ErrorInst::InstId;
12411256
} else {
1242-
// We bind the input value to the target `FacetType` with a
1243-
// `FacetValue`, which requires an instruction of type `TypeType`. So if
1244-
// we are converting from a facet value, we get its `type` via an extra
1245-
// `FacetAccessType` instruction.
1246-
auto type_inst_id = SemIR::TypeInstId::None;
1247-
if (sem_ir.types().Is<SemIR::FacetType>(value_type_id)) {
1248-
type_inst_id = AddTypeInst<SemIR::FacetAccessType>(
1249-
context, loc_id,
1250-
{.type_id = SemIR::TypeType::TypeId,
1251-
.facet_value_inst_id = const_value_id});
1252-
} else {
1253-
type_inst_id = context.types().GetAsTypeInstId(const_value_id);
1254-
}
12551257
// Note that `FacetValue`'s type is the same `FacetType` that was used
12561258
// to construct the set of witnesses, ie. the query to
12571259
// `LookupImplWitness()`. This ensures that the witnesses are in the

toolchain/check/testdata/class/generic/member_type.carbon

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ fn Test() -> i32 {
297297
// CHECK:STDOUT: %Outer.ref.loc13_29: %Outer.type = name_ref Outer, file.%Outer.decl [concrete = constants.%Outer.generic]
298298
// CHECK:STDOUT: %int_32.loc13_35: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
299299
// CHECK:STDOUT: %i32.loc13_35: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
300-
// CHECK:STDOUT: %Copy.facet.loc13_38: %Copy.type = facet_value constants.%i32, (constants.%Copy.impl_witness.a32) [concrete = constants.%Copy.facet.c49]
300+
// CHECK:STDOUT: %Copy.facet.loc13_38: %Copy.type = facet_value %i32.loc13_35, (constants.%Copy.impl_witness.a32) [concrete = constants.%Copy.facet.c49]
301301
// CHECK:STDOUT: %.loc13_38: %Copy.type = converted %i32.loc13_35, %Copy.facet.loc13_38 [concrete = constants.%Copy.facet.c49]
302302
// CHECK:STDOUT: %Outer.loc13_38: type = class_type @Outer, @Outer(constants.%Copy.facet.c49) [concrete = constants.%Outer.3a3]
303303
// 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 {
322322
// CHECK:STDOUT: %Outer.ref.loc13_10: %Outer.type = name_ref Outer, file.%Outer.decl [concrete = constants.%Outer.generic]
323323
// CHECK:STDOUT: %int_32.loc13_16: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
324324
// CHECK:STDOUT: %i32.loc13_16: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
325-
// CHECK:STDOUT: %Copy.facet.loc13_19: %Copy.type = facet_value constants.%i32, (constants.%Copy.impl_witness.a32) [concrete = constants.%Copy.facet.c49]
325+
// CHECK:STDOUT: %Copy.facet.loc13_19: %Copy.type = facet_value %i32.loc13_16, (constants.%Copy.impl_witness.a32) [concrete = constants.%Copy.facet.c49]
326326
// CHECK:STDOUT: %.loc13_19: %Copy.type = converted %i32.loc13_16, %Copy.facet.loc13_19 [concrete = constants.%Copy.facet.c49]
327327
// CHECK:STDOUT: %Outer.loc13_19: type = class_type @Outer, @Outer(constants.%Copy.facet.c49) [concrete = constants.%Outer.3a3]
328328
// CHECK:STDOUT: %.loc13_20.2: type = specific_constant @Outer.%Inner.decl, @Outer(constants.%Copy.facet.c49) [concrete = constants.%Inner.d35]

toolchain/check/testdata/facet/call_combined_impl_witness.carbon

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ fn F() {
335335
// CHECK:STDOUT: %T.ref.loc40: %facet_type.b5f = name_ref T, %T.loc33_6.2 [symbolic = %T.loc33_6.1 (constants.%T)]
336336
// CHECK:STDOUT: %A.ref.loc40: type = name_ref A, file.%A.decl [concrete = constants.%A.type]
337337
// CHECK:STDOUT: %AA.ref.loc40: %A.assoc_type = name_ref AA, @A.%assoc0 [concrete = constants.%assoc0.6e7]
338-
// CHECK:STDOUT: %T.as_type.loc40: type = facet_access_type constants.%T [symbolic = %T.as_type.loc33_28.1 (constants.%T.as_type)]
338+
// CHECK:STDOUT: %T.as_type.loc40: type = facet_access_type %T.ref.loc40 [symbolic = %T.as_type.loc33_28.1 (constants.%T.as_type)]
339339
// 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)]
340340
// CHECK:STDOUT: %.loc40_4: %A.type = converted %T.ref.loc40, %A.facet.loc40 [symbolic = %A.facet.loc34 (constants.%A.facet.d1f)]
341341
// 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() {
344344
// CHECK:STDOUT: %T.ref.loc41: %facet_type.b5f = name_ref T, %T.loc33_6.2 [symbolic = %T.loc33_6.1 (constants.%T)]
345345
// CHECK:STDOUT: %B.ref.loc41: type = name_ref B, file.%B.decl [concrete = constants.%B.type]
346346
// CHECK:STDOUT: %BB.ref.loc41: %B.assoc_type = name_ref BB, @B.%assoc0 [concrete = constants.%assoc0.a29]
347-
// CHECK:STDOUT: %T.as_type.loc41: type = facet_access_type constants.%T [symbolic = %T.as_type.loc33_28.1 (constants.%T.as_type)]
347+
// CHECK:STDOUT: %T.as_type.loc41: type = facet_access_type %T.ref.loc41 [symbolic = %T.as_type.loc33_28.1 (constants.%T.as_type)]
348348
// 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)]
349349
// CHECK:STDOUT: %.loc41_4: %B.type = converted %T.ref.loc41, %B.facet.loc41 [symbolic = %B.facet.loc35 (constants.%B.facet.434)]
350350
// 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)]

toolchain/check/testdata/facet/convert_class_type_to_facet_type.carbon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ fn F() {
117117
// CHECK:STDOUT: !entry:
118118
// CHECK:STDOUT: %WalkAnimal.ref: %WalkAnimal.type = name_ref WalkAnimal, file.%WalkAnimal.decl [concrete = constants.%WalkAnimal]
119119
// CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat]
120-
// CHECK:STDOUT: %Animal.facet: %Animal.type = facet_value constants.%Goat, (constants.%Animal.impl_witness) [concrete = constants.%Animal.facet]
120+
// CHECK:STDOUT: %Animal.facet: %Animal.type = facet_value %Goat.ref, (constants.%Animal.impl_witness) [concrete = constants.%Animal.facet]
121121
// CHECK:STDOUT: %.loc23: %Animal.type = converted %Goat.ref, %Animal.facet [concrete = constants.%Animal.facet]
122122
// CHECK:STDOUT: %WalkAnimal.specific_fn: <specific function> = specific_function %WalkAnimal.ref, @WalkAnimal(constants.%Animal.facet) [concrete = constants.%WalkAnimal.specific_fn]
123123
// CHECK:STDOUT: %WalkAnimal.call: init %empty_tuple.type = call %WalkAnimal.specific_fn()

toolchain/check/testdata/facet/convert_facet_value_as_type_knows_original_type.carbon

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,11 @@ fn F[A:! J, B:! A](x: C(A, B)) {
115115
// CHECK:STDOUT: %Feed.ref: %Feed.type = name_ref Feed, file.%Feed.decl [concrete = constants.%Feed]
116116
// CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat]
117117
// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type]
118-
// CHECK:STDOUT: %Animal.facet: %Animal.type = facet_value constants.%Goat, (constants.%Animal.impl_witness) [concrete = constants.%Animal.facet]
118+
// CHECK:STDOUT: %Animal.facet: %Animal.type = facet_value %Goat.ref, (constants.%Animal.impl_witness) [concrete = constants.%Animal.facet]
119119
// CHECK:STDOUT: %.loc14_14: %Animal.type = converted %Goat.ref, %Animal.facet [concrete = constants.%Animal.facet]
120120
// CHECK:STDOUT: %as_type: type = facet_access_type %.loc14_14 [concrete = constants.%Goat]
121121
// CHECK:STDOUT: %.loc14_25: type = converted %.loc14_14, %as_type [concrete = constants.%Goat]
122-
// CHECK:STDOUT: %Eats.facet: %Eats.type = facet_value constants.%Goat, (constants.%Eats.impl_witness) [concrete = constants.%Eats.facet]
122+
// CHECK:STDOUT: %Eats.facet: %Eats.type = facet_value %.loc14_25, (constants.%Eats.impl_witness) [concrete = constants.%Eats.facet]
123123
// CHECK:STDOUT: %.loc14_32: %Eats.type = converted %.loc14_25, %Eats.facet [concrete = constants.%Eats.facet]
124124
// CHECK:STDOUT: %Feed.specific_fn: <specific function> = specific_function %Feed.ref, @Feed(constants.%Eats.facet) [concrete = constants.%Feed.specific_fn]
125125
// 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)) {
172172
// CHECK:STDOUT: %.loc22_15.1: type = splice_block %.loc22_15.3 [concrete = constants.%Goat] {
173173
// CHECK:STDOUT: %Goat.ref.loc22_10: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat]
174174
// CHECK:STDOUT: %Animal.ref.loc22: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type]
175-
// CHECK:STDOUT: %Animal.facet.loc22: %Animal.type = facet_value constants.%Goat, (constants.%Animal.impl_witness) [concrete = constants.%Animal.facet]
175+
// CHECK:STDOUT: %Animal.facet.loc22: %Animal.type = facet_value %Goat.ref.loc22_10, (constants.%Animal.impl_witness) [concrete = constants.%Animal.facet]
176176
// CHECK:STDOUT: %.loc22_15.2: %Animal.type = converted %Goat.ref.loc22_10, %Animal.facet.loc22 [concrete = constants.%Animal.facet]
177177
// CHECK:STDOUT: %as_type.loc22: type = facet_access_type %.loc22_15.2 [concrete = constants.%Goat]
178178
// 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)) {
194194
// CHECK:STDOUT: %.loc26_8: ref %Goat = converted %.loc26_6.1, %.loc26_6.4
195195
// CHECK:STDOUT: %Goat.ref.loc26_21: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat]
196196
// CHECK:STDOUT: %Animal.ref.loc26: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type]
197-
// CHECK:STDOUT: %Animal.facet.loc26: %Animal.type = facet_value constants.%Goat, (constants.%Animal.impl_witness) [concrete = constants.%Animal.facet]
197+
// CHECK:STDOUT: %Animal.facet.loc26: %Animal.type = facet_value %Goat.ref.loc26_21, (constants.%Animal.impl_witness) [concrete = constants.%Animal.facet]
198198
// CHECK:STDOUT: %.loc26_26: %Animal.type = converted %Goat.ref.loc26_21, %Animal.facet.loc26 [concrete = constants.%Animal.facet]
199199
// CHECK:STDOUT: %as_type.loc26: type = facet_access_type %.loc26_26 [concrete = constants.%Goat]
200200
// 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)) {
208208
// CHECK:STDOUT: %.loc27_8: ref %Goat = converted %.loc27_6.1, %.loc27_6.4
209209
// CHECK:STDOUT: %Goat.ref.loc27_21: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat]
210210
// CHECK:STDOUT: %Animal.ref.loc27: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type]
211-
// CHECK:STDOUT: %Animal.facet.loc27: %Animal.type = facet_value constants.%Goat, (constants.%Animal.impl_witness) [concrete = constants.%Animal.facet]
211+
// CHECK:STDOUT: %Animal.facet.loc27: %Animal.type = facet_value %Goat.ref.loc27_21, (constants.%Animal.impl_witness) [concrete = constants.%Animal.facet]
212212
// CHECK:STDOUT: %.loc27_26: %Animal.type = converted %Goat.ref.loc27_21, %Animal.facet.loc27 [concrete = constants.%Animal.facet]
213213
// CHECK:STDOUT: %as_type.loc27: type = facet_access_type %.loc27_26 [concrete = constants.%Goat]
214214
// CHECK:STDOUT: %.loc27_35: type = converted %.loc27_26, %as_type.loc27 [concrete = constants.%Goat]

toolchain/check/testdata/facet/convert_facet_value_to_itself.carbon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ fn F() {
149149
// CHECK:STDOUT: !entry:
150150
// CHECK:STDOUT: %HandleAnimal.ref: %HandleAnimal.type = name_ref HandleAnimal, file.%HandleAnimal.decl [concrete = constants.%HandleAnimal]
151151
// CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat]
152-
// CHECK:STDOUT: %Animal.facet: %Animal.type = facet_value constants.%Goat, (constants.%Animal.impl_witness) [concrete = constants.%Animal.facet]
152+
// CHECK:STDOUT: %Animal.facet: %Animal.type = facet_value %Goat.ref, (constants.%Animal.impl_witness) [concrete = constants.%Animal.facet]
153153
// CHECK:STDOUT: %.loc25: %Animal.type = converted %Goat.ref, %Animal.facet [concrete = constants.%Animal.facet]
154154
// CHECK:STDOUT: %HandleAnimal.specific_fn: <specific function> = specific_function %HandleAnimal.ref, @HandleAnimal(constants.%Animal.facet) [concrete = constants.%HandleAnimal.specific_fn]
155155
// CHECK:STDOUT: %HandleAnimal.call: init %empty_tuple.type = call %HandleAnimal.specific_fn()

toolchain/check/testdata/facet/convert_facet_value_to_narrowed_facet_type.carbon

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -695,13 +695,13 @@ fn CallsWithTypeExplicit(U:! type) {
695695
// CHECK:STDOUT: %w.ref: @HandleTameAnimal2.%W.as_type.loc11_44.1 (%W.as_type) = name_ref w, %w
696696
// 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)]
697697
// 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)]
698-
// 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)]
698+
// 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)]
699699
// 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)]
700700
// 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)]
701701
// 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)]
702702
// 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)]
703703
// 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)]
704-
// 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)]
704+
// 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)]
705705
// 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)]
706706
// 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)]
707707
// 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) {
12531253
// CHECK:STDOUT: !entry:
12541254
// CHECK:STDOUT: %TakesExtraWhereExplicit.ref: %TakesExtraWhereExplicit.type = name_ref TakesExtraWhereExplicit, file.%TakesExtraWhereExplicit.decl [concrete = constants.%TakesExtraWhereExplicit]
12551255
// CHECK:STDOUT: %U.ref: type = name_ref U, %U.loc9_26.2 [symbolic = %U.loc9_26.1 (constants.%U)]
1256-
// CHECK:STDOUT: %facet_value.loc10_28.1: %type = facet_value constants.%U, () [symbolic = %facet_value.loc10_28.2 (constants.%facet_value)]
1256+
// CHECK:STDOUT: %facet_value.loc10_28.1: %type = facet_value %U.ref, () [symbolic = %facet_value.loc10_28.2 (constants.%facet_value)]
12571257
// CHECK:STDOUT: %.loc10: %type = converted %U.ref, %facet_value.loc10_28.1 [symbolic = %facet_value.loc10_28.2 (constants.%facet_value)]
12581258
// CHECK:STDOUT: %TakesExtraWhereExplicit.specific_fn.loc10_3.1: <specific function> = specific_function %TakesExtraWhereExplicit.ref, @TakesExtraWhereExplicit(constants.%facet_value) [symbolic = %TakesExtraWhereExplicit.specific_fn.loc10_3.2 (constants.%TakesExtraWhereExplicit.specific_fn)]
12591259
// CHECK:STDOUT: %TakesExtraWhereExplicit.call: init %empty_tuple.type = call %TakesExtraWhereExplicit.specific_fn.loc10_3.1()

toolchain/check/testdata/facet/convert_interface.carbon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ fn G() { F(Animal); }
104104
// CHECK:STDOUT: !entry:
105105
// CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F]
106106
// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type]
107-
// CHECK:STDOUT: %Eats.facet: %Eats.type = facet_value constants.%Animal.type, (constants.%Eats.impl_witness) [concrete = constants.%Eats.facet]
107+
// CHECK:STDOUT: %Eats.facet: %Eats.type = facet_value %Animal.ref, (constants.%Eats.impl_witness) [concrete = constants.%Eats.facet]
108108
// CHECK:STDOUT: %.loc23: %Eats.type = converted %Animal.ref, %Eats.facet [concrete = constants.%Eats.facet]
109109
// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.ref(%.loc23)
110110
// CHECK:STDOUT: return

0 commit comments

Comments
 (0)