New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SR-6981] @_implements doesn't work in extensions #49529
Comments
Given that |
The intended use here is for conditional implementations of == in the standard library, so we wouldn’t be stretching very far. I can see that the diagnostics are hardcoded but this isn’t going to be a problem for the intended use as it requires very little additional code to have the diagnostics cooperate here. The workaround I could devise today requires a public underscored protocol, so being able to eliminate that from the ABI would be nice (TM). |
Sorry, the diagnostics I'm talking about are when the member that uses |
That's what I'm talking about as well 🙂 |
Comment by Graydon Hoare (JIRA) Seems plausible to me; probably just an oversight in the implementation. |
Comment by Zsolt Kovacs (JIRA) @xwu it seems like this issue got fixed at one point as this compiles now: protocol Q {
func f(x:Int, y:Int) -> Int
}
struct S {}
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
}
} |
Additional Detail from JIRA
md5: c2eb03bd88ab046fae58ebe4fa85ad8f
Issue Description:
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 standard library types) 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:…but adding the following doesn’t:
This makes
@_implements
unusable for conditional conformances 🙁The text was updated successfully, but these errors were encountered: