I was unable to find a post that discussed this exact issue, I think this might be a bug, but I'm unsure:
// Error: Type 'SomeClass' does not conform to protocol 'SomeProtocol'
class SomeClass: SomeProtocol { }
protocol SomeProtocol: SomeClass {
var someProperty: Int { get }
}
// Note: Candidate would match if 'SomeClass' conformed to 'SomeProtocol'
extension SomeProtocol {
var someProperty: Int { 0 }
}
Also, if I throw a base-class into the mix, there is no issue:
class SomeBaseClass { }
class SomeClass: SomeBaseClass, SomeProtocol { }
// No error if the protocol is constrained to the base class.
protocol SomeProtocol: SomeBaseClass {
var someProperty: Int { get }
}
extension SomeProtocol {
var someProperty: Int { 0 }
}
This isn't really causing me a problem as I can work around it, I'm just curious, the note in particular reads very strangely, since it basically says this default implementation would match if the class conformed to the protocol, but afaict the class does conform to the protocol.