Will existentials ever conform to their protocols?

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@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@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

1 Like