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:
Chris Lattner
2015-11-15 20:50:05 -08:00
parent 2f04cb13f1
commit c652c62f88
2 changed files with 62 additions and 16 deletions

View File

@@ -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()
}