SE-0299 Extending Static Member Lookup in Generic Contexts

Isn't this one more inconsistency then? Until now this syntax:

let x = Type.member

has been pretty much equivalent to this when the member returns a Type:

let x: Type = .member

But for some reason, for static members of a protocol type only the later will work.

You can change all my examples to use the second form and they still behave the same.

Except for the last one. That rule successfully scrubs the FixedWidthInteger.bitWidth example because of the protocol's Self-requirement. But what happens with this?

func squared<T: FixedWidthInteger>(_ x: T) -> T? { ... }
let squaredBitWidth = squared(.bitWidth)
5 Likes