[swift-users] Protocol conformance error

Roshan thisisroshansmail at gmail.com
Wed Jan 17 01:29:33 CST 2018


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


More information about the swift-users mailing list