mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 22:02:23 +01:00
This makes them part of the identified facet type, and we can see the constraints as part of stringify and format output. But this does not do enough to make them useful yet: Any `T impls X` constraint must contain a reference to `.Self` somewhere. And `.Self` references do not get substituted, so neither `T(.Self) impls X` and `T impls X(.Self)` will match against an incoming facet value derived from an `impl T(U) as X` or `impl T as X(U)`, since `U` and `.Self` are never the same thing until `.Self` can be substituted. Now that impl lookup runs into facet values containing `.Self` (a symbolic binding), such as in `C(.Self)`, we were crashing assuming the type of `.Self` is a FacetType, but it can be `type` in the case of `type where C(.Self) impls...`. Instead, use an empty facet type for the type of `.Self` so it is always a facet. This assists with substituting other facets into it, without having to insert an extra FacetAccessType. `MakePeriodSelfFacetValue()` now enforces this requirement. --------- Co-authored-by: Richard Smith <richard@metafoo.co.uk>