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-8668] Give a sensible warning for protocol namespace issues #51182

Open
swift-ci opened this issue Aug 30, 2018 · 0 comments
Open

[SR-8668] Give a sensible warning for protocol namespace issues #51182

swift-ci opened this issue Aug 30, 2018 · 0 comments
Labels
compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation improvement

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-8668
Radar None
Original Reporter JamesW (JIRA User)
Type Improvement
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Improvement, DiagnosticsQoI
Assignee None
Priority Medium

md5: 6d6e793fe9774b3d294ff06aadea402e

relates to:

  • SR-11166 Confusing fixit when protocol requirement has masked type name

Issue Description:

Have a module Foo with a public protocol FooProtocol, and a class FooClass:

class FooClass {

}

public protocol FooProtocol: class {

{{ func protocolFunc(_ foo: FooClass)}}

{{}}}

Implement a class in MyModule, where the module also implements its own FooClass:

class FooClass {

}

class MyClass: FooProtocol {

{{ func protocolFunc(_ foo: FooClass) {}}

{{ }}}

{{}}}

Xcode complains that you haven't implemented the protocol function, even though you have. It helpfully points out that the signature of the function you implemented is identical to the one that it wants. It even offers to add the 'missing' function, and if you do it complains that you now have duplicate functions.

The solution is to explicitly namespace FooClass - Foo.FooClass. However, a compiler warning hinting that this was the problem would eliminate many head/desk incidents trying to figure out why a protocol was missing, when it was the exact same protocol Xcode added as a 'fix'.

@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
compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation improvement
Projects
None yet
Development

No branches or pull requests

1 participant