`Protocol 'TestProtocol' as a type cannot conform to the protocol itself` not appear Swift 5.7

Before Swift 5.7

protocol TestProtocol {}

struct A: TestProtocol {}
struct B: TestProtocol {}

func somethings<T: TestProtocol>(source: T) -> TestProtocol {
        return source
    }

let a = somethings(source: A())
let b = somethings(source: a) // ⛔️ Protocol 'TestProtocol' as a type cannot conform to the protocol itself

Swift 5.7

let a = somethings(source: A())
let b = somethings(source: a) // ✅ OK

why no error?

1 Like