[ConstraintSystem] Use binding as a source of type variable assignment

Since `binding` has all of the required information now it's possible
to use its `locator` as a source of type variable assignment
(`Bind` constraint) in `TypeVariableBinding::attempt` which helps
to improve diagnostics.
This commit is contained in:
Pavel Yaskevich
2019-12-12 11:36:32 -08:00
parent 382013f788
commit 87beea3c40
7 changed files with 18 additions and 20 deletions

View File

@@ -85,7 +85,7 @@ sr590(())
sr590((1, 2))
// SR-2657: Poor diagnostics when function arguments should be '@escaping'.
private class SR2657BlockClass<T> { // expected-note 3 {{generic parameters are always considered '@escaping'}}
private class SR2657BlockClass<T> { // expected-note 4 {{generic parameters are always considered '@escaping'}}
let f: T
init(f: T) { self.f = f }
}
@@ -94,7 +94,7 @@ func takesAny(_: Any) {}
func foo(block: () -> (), other: () -> Int) {
let _ = SR2657BlockClass(f: block)
// expected-error@-1 {{converting non-escaping value to 'T' may allow it to escape}}
// expected-error@-1 {{converting non-escaping parameter 'block' to generic parameter 'T' may allow it to escape}}
let _ = SR2657BlockClass<()->()>(f: block)
// expected-error@-1 {{converting non-escaping parameter 'block' to generic parameter 'T' may allow it to escape}}
let _: SR2657BlockClass<()->()> = SR2657BlockClass(f: block)