I'm trying understand generics culture in Swift so I've written a small example. But it does not compile.
Error: Generic parameter 'P' could not be inferred I can't understand for I'm doing wrong.
protocol Protocol_1 {
associatedtype T
}
protocol Protocol_A {}
struct SomeStruct_2: Protocol_A {}
struct SomeStruct_1: Protocol_1 {
typealias T = Protocol_A
}
let struct1 = SomeStruct_1()
testFunction(t: struct1) // *Generic parameter 'P' could not be inferred*
func testFunction<P: Protocol_1>(t: P) where P.T : Protocol_A {
}