[Accepted with modification] SE-0299: Extending Static Member Lookup in Generic Contexts

The second review period for SE-0299: Extending Static Member Lookup in Generic Contexts has concluded. The core team has decided to accept this revision proposal, with one more modification suggested by John McCall:

It is reasonable to allow contextual member lookup to consider members from unconstrained protocol extensions of type Self (or more generally, protocol extensions without Self == ConcreteType constraints), because they could be used as part of a larger member chain that gets type context from elswhere in the chain, as in:

extension P {
  static var foo: Self { ... }

extension P where Self == Int {
  var bar: Int { ... }

func f<T: P>(_: T)

f(.foo.bar) // Infers `T == Int` from `bar`

Furthermore, in other contexts, we allow a contextual member to be a subtype of the contextual type, as in:

class Parent {
  static var member: Child = Child()
class Child : Parent {}
func takesParent(p: Parent) {}
takesParent(p: .member)

As such, the proposal should be relaxed, so that Self-typed static members in protocol extensions without a Self same type constraint, or more generally extension members where the return type is a subtype of the Self type within the generic context of the extension, can be considered for contextual member lookup.

Thanks to everyone who participated in the review!