mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
When sorting through a list of candidates in a call overload set, introduce the
notion of a "near miss" for an argument type mismatch. This allows us to prune
the candidate set down in some cases. For example, in the testcase in
rdar://22243469 we are able to go from:
t.swift:6:3: error: cannot invoke 'process' with an argument list of type '(() throws -> ())'
process {
^
t.swift:6:3: note: overloads for 'process' exist with these partially matching parameter lists: (UInt, fn: () -> Void), (UInt)
down to:
t.swift:6:3: note: expected an argument list of type '(UInt, () -> Void)'
This paves the way for producing a better error in cases like this, but there are
other bits of weirdness that need to be untangled first.
This commit is contained in:
@@ -54,7 +54,7 @@ func dangerous() throws {}
|
||||
|
||||
func test() {
|
||||
process { // expected-error {{cannot invoke 'process' with an argument list of type '(() throws -> ())'}}
|
||||
// expected-note @-1 {{overloads for 'process' exist with these partially matching parameter lists: (UInt, () -> Void), (UInt)}}
|
||||
// expected-note @-1 {{expected an argument list of type '(UInt, () -> Void)'}}
|
||||
try dangerous()
|
||||
test()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user