mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Let's keep track of type mismatch between type deduced
for the body of the closure vs. what is requested
contextually, it makes it much easier to diagnose
problems like:
```swift
func foo(_: () -> Int) {}
foo { "hello" }
```
Because we can pin-point problematic area of the source
when the rest of the system is consistent.
Resolves: rdar://problem/40537960
5 lines
219 B
Swift
5 lines
219 B
Swift
// RUN: %target-typecheck-verify-swift
|
|
|
|
let b: () -> Void = withoutActuallyEscaping({ print("hello crash") }, do: { $0() })
|
|
// expected-error@-1 {{cannot convert value of type '()' to closure result type '() -> Void'}}
|