mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 22:02:23 +01:00
The design says: > We don’t allow a where constraint unless it applies a restriction to the current type. This means referring to some [designator](https://docs.carbon-lang.dev/docs/design/generics/details.html#kinds-of-where-constraints), like .MemberName, or [.Self](https://docs.carbon-lang.dev/docs/design/generics/details.html#recursive-constraints). -- https://docs.carbon-lang.dev/docs/design/generics/details.html#constraints-must-use-a-designator A nested facet type in a constraint does not constrain the current type, with the exception of the LHS of a nested `where` in an impls constraint. Diagnose this appropriately by not recursing into unrelated parts of nested facet types to look for designators. Before this change, this facet type is accepted: ```carbon fn F(unused T:! Z where C impls (Y where .Y1 = .Y2)) {} ``` But then no calls to `F` work, since the `.Y1` and `.Y2` designators are never resolved to anything from the caller, as they do not depend on `T` in any way.