Methods with default implementation in internal protocol match public requirement of another protocol

In the following code, we have a public protocol and an internal one defining a method that matches the one in the public protocol. And we have a struct that conforms to both protocols

public protocol MyProtocol {
    func test()
}

protocol MyProtocolImpl {}

extension MyProtocolImpl {
    public func test() {
        print("test")
    }
}


public struct MyStruct: MyProtocol, MyProtocolImpl {
    public init() {
        print("MyStruct initialized")
    }
}

Then in another module

MyStruct().test()

When I tried to type the `test` method, the VSCode plugin does not give me any completion hints, but it does compile and execute without issue. Is this an expected behaviour?

1 Like