[SR-5780] Swift 4 compiler reports ambiguity for method invocation #48350
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
regression
swift 4.0
type checker
Area → compiler: Semantic analysis
Attachment: Download
Environment
$ uname -a
Darwin charles-mbp.lan 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64
$ swift --version
Apple Swift version 4.0 (swiftlang-900.0.59 clang-900.0.34.2)
Target: x86_64-apple-macosx10.9
Additional Detail from JIRA
md5: 6ceddd383b8e1d645fed68d4847dae68
relates to:
Issue Description:
Possibly related to SR-2423?
The following code (also attached) :
func foo<T>(closure: (T) -> Void) {
}func foo<T, U>(closure: (T, U) -> Void) {
}foo(closure: { (arg1: String, arg2: String) in })
Produces the following output when compiled as swift 4 code using the version of swift provided in Xcode 9 beta 6 (compiling as swift 3 works as expected):
Ambiguity.swift:4:1: error: ambiguous use of 'foo(closure🙂'
foo(closure: { (arg1: String, arg2: String) in })
^``Ambiguity.swift:1:6: note: found this candidate
func foo<T>(closure: (T) -> Void) {
}{{ ^}}
Ambiguity.swift:2:6: note: found this candidate
func foo<T, U>(closure: (T, U) -> Void) {
}{{ ^}}
The text was updated successfully, but these errors were encountered: