Skip to content
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-5912] "Unavailable instance method" warning is confusing. #48471

Open
dempseyatgithub opened this issue Sep 17, 2017 · 1 comment
Open

[SR-5912] "Unavailable instance method" warning is confusing. #48471

dempseyatgithub opened this issue Sep 17, 2017 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself regression swift 4.0

Comments

@dempseyatgithub
Copy link

Previous ID SR-5912
Radar None
Original Reporter @dempseyatgithub
Type Bug
Environment

Swift 3 in Xcode 9 GM Seed

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, 4.0Regression
Assignee None
Priority Medium

md5: 52d793f68418f41782fb6da4d6665b70

Issue Description:

When updating from Xcode 8 to Xcode 9, my project began getting warnings of the pattern:

Unavailable instance method ‘compareQueryResult(_:toQueryResult🙂’ was used to satisfy a requirement of protocol ‘ResultComparable’.

@interface DocumentQuery: Query {
   - (ComparisonResult)compareQueryResult:(DocumentResult *)result1 toQueryResult:(DocumentResult *)result2;
}
@end
public protocol ResultComparable
{
    associatedtype ResultType
    func compareQueryResult(_ r1: ResultType, toQueryResult r2: ResultType) -> ComparisonResult
}

The issue was diagnosed by @belkadan on [swift-users]:

The name you’ll get in Swift for these methods is probably 'compareQuery(_:toQuery🙂', because the Swift compiler detects that the “result” is redundant with the type name. In Xcode 8 the compiler didn’t check if you were using the “old" name to satisfy a protocol, but Xcode 9 now does.

Since this is a source-breaking change, he asked me to file an issue at https://bugs.swift.org. Noting that at the very least we the diagnostic should be made better.

@belkadan
Copy link
Contributor

cc @DougGregor, @slavapestov

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself regression swift 4.0
Projects
None yet
Development

No branches or pull requests

3 participants