mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user