[swift-evolution] Will existentials ever conform to their protocols?

Slava Pestov spestov at apple.com
Wed Jan 18 02:19:18 CST 2017


Yes, there’s already logic to detect and diagnose this case in fact (@objc protocols are self-conforming, except when they contain static members or initializers).

Slava

> On Jan 18, 2017, at 12:10 AM, Anton Zhilin via swift-evolution <swift-evolution at swift.org> wrote:
> 
> There is also a caveat with static members:
> 
> protocol P {
>     static func foo()
> }
> 
> struct S : P {
>     static func foo() { }
> }
> 
> func bar<T: P>(x: T) {
>     T.foo()
> }
> 
> let p = S() as P
> bar(p)  // P.foo() does not exist
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170118/49244642/attachment.html>


More information about the swift-evolution mailing list