Skip to content

Commit b1b79c1

Browse files
authored
Set deduce_through to false for FacetType, since we don't deduce through it (#6087)
We decided on 2025-04-02 not to do deduction through facet types, because types can implement a generic interface multiple times with different arguments. See: https://docs.google.com/document/d/1Iut5f2TQBrtBNIduF4vJYOKfw7MbS8xH_J01_Q4e6Rk/edit?pli=1&resourcekey=0-mc_vh5UzrzXfU4kO-3tOjA&tab=t.0#heading=h.95phmuvxog9n Then we no longer need the case handling `FacetTypeId` in deduce.cpp. We move the comment over to the definition of the `FacetType::Kind`. The deduce case was for `FacetTypeId`, not `FacetType`, but `FacetType` is the only instruction which holds such an Id.
1 parent 26cb281 commit b1b79c1

File tree

2 files changed

+1
-7
lines changed

2 files changed

+1
-7
lines changed

toolchain/check/deduce.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,6 @@ class DeductionWorklist {
113113
case SemIR::IdKind::None:
114114
case SemIR::IdKind::For<SemIR::ClassId>:
115115
case SemIR::IdKind::For<SemIR::IntKind>:
116-
// Decided on 2025-04-02 not to do deduction through facet types, because
117-
// types can implement a generic interface multiple times with different
118-
// arguments. See:
119-
// https://docs.google.com/document/d/1Iut5f2TQBrtBNIduF4vJYOKfw7MbS8xH_J01_Q4e6Rk/edit?pli=1&resourcekey=0-mc_vh5UzrzXfU4kO-3tOjA&tab=t.0#heading=h.95phmuvxog9n
120-
case SemIR::IdKind::For<SemIR::FacetTypeId>:
121116
break;
122117
case CARBON_KIND(SemIR::InstId inst_id): {
123118
Add(inst_id, SemIR::InstId(arg));

toolchain/sem_ir/typed_insts.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -651,8 +651,7 @@ struct FacetType {
651651
static constexpr auto Kind = InstKind::FacetType.Define<Parse::NodeId>(
652652
{.ir_name = "facet_type",
653653
.is_type = InstIsType::Always,
654-
.constant_kind = InstConstantKind::Always,
655-
.deduce_through = true});
654+
.constant_kind = InstConstantKind::Always});
656655

657656
TypeId type_id;
658657
// TODO: Rename this to facet_type_info_id.

0 commit comments

Comments
 (0)