Canonicalize the self in ImplSelfWitness (#7898)

We perform the same canonicalization as in LookupImplWitness, which
makes the output of eval more consistent across witness types, and
enables more straightforward constant comparisons between them when
needed.
This commit is contained in:
Dana Jansens authored and GitHub committed 2026-10-06 23:04:20 +00:00
1 parent f83518bfd7
commit bf91a8b4dd
13 files changed
+81 -72

No files matched your search

+2 -2
View File
@@ -268,8 +268,8 @@ static auto BuildImplDecl(Context& context, Parse::AnyImplDeclId node_id,
// are applied to the impl.
//
// We can use ImplSelfWitness for this because it contains a
// SpecificInterfaceId operand, and it has a constant_kind of `Always` so it
// never evaluates to some other type of inst.
// SpecificInterfaceId operand, and it always evaluates an inst of the same
// kind so we don't lose the operand.
//
// TODO: We could avoid the extra indirection through a SpecificInterfaceId if
// we introduced a new instruction with a SpecificId operand instead of