PR #8735 adds supports for @_implements
, which serves some niche but important purposes in the standard library.
Currently, we're running into some potential source breakage with conditional conformances for which @_implements
would be perfect. However, it seems like this attribute simply doesn't work inside extensions. By which I mean, the following compiles:
protocol P {
func f(x:Int, y:Int) -> Int;
}
struct S : P {
@_implements(P, f(x:y:))
func g(x:Int, y:Int) -> Int {
return 5
}
}
...but adding the following doesn't:
protocol Q {
func f(x:Int, y:Int) -> Int;
}
extension S : Q { // Error: Type 'S' does not conform to protocol 'Q'
@_implements(Q, f(x:y:))
func h(x:Int, y:Int) -> Int {
return 6
}
}
Any pointers on how to fix this?
[Edit: reported as SR-6981, but it'd still be nice to get some pointers as to whether/how it can be fixed.]