You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SR-5780 Swift 4 compiler reports ambiguity for method invocation
Issue Description:
When a program has two methods that have the same signature (a single closure parameter), but the closures have a different number of arguments, the compiler still can't infer which method is intended when calling one of the methods.
A workaround does exist by specifying the type of the closure parameters, but that shouldn't be necessary.
See attached playground for a specific example.
The text was updated successfully, but these errors were encountered:
func performAction(closure: (Int) -> Void) {
closure(7)
}
func performAction(closure: (String, Int) -> Void) {
closure("Key", 7)
}
// This should not throw a compiler error because the use is not ambiguous.
performAction { value in
print(value)
}
// Workaround
performAction { (value: Int) in
print(value)
}
Seems like we're just not done removing the code that allowed a single closure argument to match a tuple.
Attachment: Download
Environment
Swift 2.3
Xcode 7.3
Additional Detail from JIRA
md5: d36aff4696e4f55f5c14420fad211c7c
relates to:
Issue Description:
A workaround does exist by specifying the type of the closure parameters, but that shouldn't be necessary.
See attached playground for a specific example.
The text was updated successfully, but these errors were encountered: