mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
We have two "levels" of name lookup, and the more primitive level is used by name lookup itself to avoid certain cycles. For example, extension binding, resolution of inheritance clauses, etc. One interesting case is that a protocol extension can impose additional requiremnts on `Self`, and members of the right-hand side type are visible to unqualified lookup. The right-hand side of a `Self` requirement in this case is always a protocol type or class type canonically, but it might be written to refer to a protocol type alias. Before some changes for noncopyable generics, the primitive name lookup mechanism, implemented in directReferencesForTypeRepr() and such, would check if the TypeRepr had already been resolved by resolveType(). If so, it would immediately return the decl. This masked an issue, where the right-hand side of a `Self` requirement was resolved in the parent DeclContext. A more subtle rule is needed; for a protocol extension, we must resolve the right-hand side in the protocol, but disregard the protocol extension's `Self` requirements, because doing so would recursively trigger the same lookup again. Fixes rdar://problem/124498054.
426 B
426 B