[SR-4014] Can't Call Overloaded Method Within Another Overloaded Method #46599
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
diagnostics QoI
Bug: Diagnostics Quality of Implementation
type checker
Area → compiler: Semantic analysis
Attachment: Download
Environment
Xcode Version 8.3 beta 3 (8W132p)
Xcode Version 8.2.1 (8C1002)
macOS Sierra 10.12.3
Additional Detail from JIRA
md5: 076e7ba1d75c403b3cc508d17be38368
relates to:
Issue Description:
It looks like Swift is currently having issues calling overloaded methods within overloaded methods.
Case in point:
I have the following method:
This method has the signature `activity(_ name: String, page: Int, completionHandler: Anilist.API.APIArrayResponseHandler<Activity>`. We will call this the "String version of Activity".
I have this other method which is simply a convenience method to call the above one with an integer as the "name" parameter.
Which like you can see, is just an overload of the method I posted earlier. `activity(id: Int, page: Int, completionHandler: Anilist.API.APIArrayResponseHandler<Activity>`. We will call this "Int version of Activity".
On the line where I try to call the "String version of Activity", Swift complains:
"Cannot convert value of type 'String' to expected argument of type 'Int'"
Basically, this method call wants to call itself recursively and does not see there's a different version in the same scope.
Unfortunately, I have no idea when this broke. I wrote this code in the Xcode 8.0/Swift 3.0 beta days and it used to work fine. If memory serves me right, this error started happening on the final release of Xcode 8.0 and Swift 3.0
I need to note that autocompletion works fine. When typing `self.activity...` within the "Int Version of Activity" autocompletion shows and completes the "String version of Activity" and inserts it there. So this is most likely a compiler bug.
The text was updated successfully, but these errors were encountered: