mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Implement ...where .Self impls... (#5238)
* Also remove facet type deduction, since we decided against it on [2025-04-02](https://docs.google.com/document/d/1Iut5f2TQBrtBNIduF4vJYOKfw7MbS8xH_J01_Q4e6Rk/edit?pli=1&resourcekey=0-mc_vh5UzrzXfU4kO-3tOjA&tab=t.0#heading=h.95phmuvxog9n). --------- Co-authored-by: Josh L <josh11b@users.noreply.github.com> Co-authored-by: Dana Jansens <danakj@orodu.net>
This commit is contained in:
co-authored by
Josh L
Dana Jansens
parent
87f0e9723f
commit
4af0c8f8d1
@@ -121,7 +121,10 @@ static auto PushOperand(Context& context, Worklist& worklist,
|
||||
}
|
||||
case CARBON_KIND(SemIR::FacetTypeId facet_type_id): {
|
||||
const auto& facet_type_info = context.facet_types().Get(facet_type_id);
|
||||
for (auto interface : facet_type_info.impls_constraints) {
|
||||
for (auto interface : facet_type_info.extend_constraints) {
|
||||
push_specific(interface.specific_id);
|
||||
}
|
||||
for (auto interface : facet_type_info.self_impls_constraints) {
|
||||
push_specific(interface.specific_id);
|
||||
}
|
||||
for (auto rewrite : facet_type_info.rewrite_constraints) {
|
||||
@@ -242,12 +245,22 @@ static auto PopOperand(Context& context, Worklist& worklist,
|
||||
auto lhs_id = context.constant_values().Get(worklist.Pop());
|
||||
new_constraint = {.lhs_const_id = lhs_id, .rhs_const_id = rhs_id};
|
||||
}
|
||||
new_facet_type_info.impls_constraints.resize(
|
||||
old_facet_type_info.impls_constraints.size(),
|
||||
new_facet_type_info.self_impls_constraints.resize(
|
||||
old_facet_type_info.self_impls_constraints.size(),
|
||||
SemIR::SpecificInterface::None);
|
||||
for (auto [old_constraint, new_constraint] : llvm::reverse(
|
||||
llvm::zip(old_facet_type_info.self_impls_constraints,
|
||||
new_facet_type_info.self_impls_constraints))) {
|
||||
new_constraint = {
|
||||
.interface_id = old_constraint.interface_id,
|
||||
.specific_id = pop_specific(old_constraint.specific_id)};
|
||||
}
|
||||
new_facet_type_info.extend_constraints.resize(
|
||||
old_facet_type_info.extend_constraints.size(),
|
||||
SemIR::SpecificInterface::None);
|
||||
for (auto [old_constraint, new_constraint] :
|
||||
llvm::reverse(llvm::zip(old_facet_type_info.impls_constraints,
|
||||
new_facet_type_info.impls_constraints))) {
|
||||
llvm::reverse(llvm::zip(old_facet_type_info.extend_constraints,
|
||||
new_facet_type_info.extend_constraints))) {
|
||||
new_constraint = {
|
||||
.interface_id = old_constraint.interface_id,
|
||||
.specific_id = pop_specific(old_constraint.specific_id)};
|
||||
|
||||
Reference in New Issue
Block a user