Skip to content

Commit 54815d7

Browse files
authored
Make Subst recurse through named constraints in a FacetTypeInfo (#6367)
These were accidentally omitted when adding the fields to FacetTypeInfo.
1 parent 2ad2648 commit 54815d7

File tree

6 files changed

+100
-75
lines changed

6 files changed

+100
-75
lines changed

toolchain/check/subst.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,12 @@ static auto PushOperand(Context& context, Worklist& worklist,
139139
for (auto interface : facet_type_info.self_impls_constraints) {
140140
push_specific(interface.specific_id);
141141
}
142+
for (auto interface : facet_type_info.extend_named_constraints) {
143+
push_specific(interface.specific_id);
144+
}
145+
for (auto interface : facet_type_info.self_impls_named_constraints) {
146+
push_specific(interface.specific_id);
147+
}
142148
for (auto rewrite : facet_type_info.rewrite_constraints) {
143149
worklist.Push(rewrite.lhs_id);
144150
worklist.Push(rewrite.rhs_id);
@@ -243,6 +249,26 @@ static auto PopOperand(Context& context, Worklist& worklist,
243249
auto lhs_id = worklist.Pop();
244250
new_constraint = {.lhs_id = lhs_id, .rhs_id = rhs_id};
245251
}
252+
new_facet_type_info.self_impls_named_constraints.resize(
253+
old_facet_type_info.self_impls_named_constraints.size(),
254+
SemIR::SpecificNamedConstraint::None);
255+
for (auto [old_constraint, new_constraint] : llvm::reverse(
256+
llvm::zip(old_facet_type_info.self_impls_named_constraints,
257+
new_facet_type_info.self_impls_named_constraints))) {
258+
new_constraint = {
259+
.named_constraint_id = old_constraint.named_constraint_id,
260+
.specific_id = pop_specific(old_constraint.specific_id)};
261+
}
262+
new_facet_type_info.extend_named_constraints.resize(
263+
old_facet_type_info.extend_named_constraints.size(),
264+
SemIR::SpecificNamedConstraint::None);
265+
for (auto [old_constraint, new_constraint] : llvm::reverse(
266+
llvm::zip(old_facet_type_info.extend_named_constraints,
267+
new_facet_type_info.extend_named_constraints))) {
268+
new_constraint = {
269+
.named_constraint_id = old_constraint.named_constraint_id,
270+
.specific_id = pop_specific(old_constraint.specific_id)};
271+
}
246272
new_facet_type_info.self_impls_constraints.resize(
247273
old_facet_type_info.self_impls_constraints.size(),
248274
SemIR::SpecificInterface::None);

0 commit comments

Comments
 (0)