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-3943] Swift/ObjC selector matching is flawed when protocol conformance is declared in superclass #46528

Open
swift-ci opened this issue Feb 13, 2017 · 2 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Feb 13, 2017

Previous ID SR-3943
Radar rdar://30489065
Original Reporter hagi (JIRA User)
Type Bug

Attachment: Download

Environment

Noticed in Xcode Version 8.2.1 (8C1002), reproduces in Xcode Version 8.3 beta 2 (8W120l).

macOS Sierra 10.12.3 (16D32)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee @DougGregor
Priority Medium

md5: 4af739a04137d449745b0eddbd5ec941

Issue Description:

Summary:
The Swift compiler (rightfully) complains about selector mismatches of optional protocol methods when the protocol conformance is declared on that class directly, but the error is missing if the protocol conformance is inherited.

Steps to Reproduce:
Please open and run the sample app.

Note that `tableView(:editingStyleForRowAtIndexPath:)` (SubController.swift) has not been migrated correctly, as the second parameter has not been stripped of `IndexPath`.

Strangely enough, you can set a breakpoint and will note that this method is called at runtime.

If you remove the UITableViewDelegate conformance declaration from BaseController.swift and declare it within SubController.swift directly, the compiler shows an error + FixIt as expected.

Expected Results:
The compiler should show the error regardless where the protocol conformance has been declared.

Actual Results:
The compiler shows certain warnings only when protocol conformance is declared on that class directly.

Notes:
This is a follow-up of rdar://27348369 that has been resolved (from my point of view), but seems very similar in nature.

@belkadan
Copy link
Contributor

belkadan commented Feb 13, 2017

@DougGregor, are there known issues in this case?

@DougGregor
Copy link
Member

DougGregor commented Feb 13, 2017

I wasn't aware of other issues in this area. I'll take a look.

@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
Projects
None yet
Development

No branches or pull requests

3 participants