-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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-10699] Unhelpful error message: type 'MyClass' cannot conform to protocol 'MyProtocol' because it has requirements that cannot be satisfied #53096
Comments
@swift-ci create |
error: type 'DeviceManagerImpl' cannot conform to protocol 'DeviceManagerProtocol' because it has requirements that cannot be satisfied DeviceManagerProtocol
DeviceManagerImpl
|
@HeminWon: I’m not sure what the issue here is. The cited error message is identical, but the code you posted doesn’t seem to have this problem. It compiles just fine, at least after changing the two |
use NSError fixed |
Attachment: Download
Additional Detail from JIRA
md5: 6f4cb02ddc607bea48238689b9e57b8b
Issue Description:
The error message in the following case could be improved:
The Objective-C bridging header contains or imports an Objective-C protocol.
That protocol uses a class forward declaration.
The forward-declared class is not contained or imported in the bridging header.
A Swift class tries to declare conformance to the protocol.
Bridging header:
Meanwhile, in Swift:
This leads to the error message:
If the bridging header imports a lot of files it can be very hard to find out which parameter of which method in the protocol is not being imported. It would be really nice if the error message included the offending type name or method/symbol that cannot be satisfied.
Bonus points for stating that it cannot be satisfied because the type used is a forward declaration.
The attached sample project contains the above code.
Tested with: Xcode 10.2 (10E125) using Swift 5.0, as well as with the current snapshot:
swift-DEVELOPMENT-SNAPSHOT-2019-05-12-a-osx.pkg
The text was updated successfully, but these errors were encountered: