mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-17 06:48:11 +00:00
When implementing a named constraint, like `impl as N`, any accesses through `Self` in the named constraint need to get the value of the associated constant from the impl's witness table. This isn't possible immediately, since the impl does not even exist until the declaration is complete. We use the same model as for accesses found directly in the impl declaration, but applied to the point where accesses in the named constraint are substituted during identify to point at the impl's self type. To get there, we need LookupImplWitness instructions in the named constraint, when re-evaluated during construction of their enclosing specific, to evaluate to ImplSelfWitness when they are a reference to the type and interface being implemented.