[swift-users] Protocol conformance error

Nevin Brackett-Rozinsky nevin.brackettrozinsky at gmail.com
Wed Jan 17 02:29:07 CST 2018


Because it would break this:

func foo<T: C, U: A> (c: T, a: U) { c.test(a) }

Nevin


On Wed, Jan 17, 2018 at 2:29 AM, Roshan via swift-users <
swift-users at swift.org> wrote:

> Hi,
>
> Here is some sample code that gives a protocol conformance error in a
> playground:
>
> protocol A {}
> protocol B: A {}
>
> protocol C {
>     func test(x: A)
> }
>
> class M: C {
>     func test(x: B) {}
> }
>
> Is there a reason why the compiler doesn't infer that ((B) -> ())
> matches ((A) -> ()) because of inheritance?
>
> --
> Warm regards
> Roshan
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20180117/173096be/attachment.html>


More information about the swift-users mailing list