swift icon indicating copy to clipboard operation
swift copied to clipboard

[SR-2026] Misleading Warning About Not-Actually-Ambiguous Method

Open jadengeller opened this issue 10 years ago • 1 comments

Previous ID SR-2026
Radar None
Original Reporter @jadengeller
Type Bug

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

md5: 3bbc53f4c5b03e8892f0567af954c4e0

Issue Description:

Even when one method is marked NS_SWIFT_UNAVAILABLE, Swift reports an ambiguous use when the methods are referred to be their Objective-C names. Once the user guesses the import name (in this case, drop WithBlock), the misleading error goes away.

https://gist.github.com/JadenGeller/68753b2a02c0e4bd0d49c48c4b0a1dac

jadengeller avatar Jul 08 '16 05:07 jadengeller

NS_SWIFT_UNAVAILABLE just makes the method unavailable; it doesn't hide it. Since we also use unavailable methods to show where renames happen, it becomes ambiguous. This is important if there are multiple methods with the same base name but different argument labels, but is more problematic when everything matches up.

In the mean time, you can use NS_REFINED_FOR_SWIFT to move the non-throwing method out of the way completely.

belkadan avatar Jul 08 '16 17:07 belkadan