Commit 0562c31
committed
[CSSimplify] Look through optionals in contextual type while resolving a closure
Let's look through all optionals associated with contextual
type to make it possible to infer parameter/result type of
the closure faster e.g.:
```swift
func test(_: ((Int) -> Void)?) {
...
}
test { $0 + ... }
```
In this case dropping optionality from contextual type
`((Int) -> Void)?` allows `resolveClosure` to infer type
of `$0` directly (via `getContextualParamAt`) instead of
having to use type variable inference mechanism.1 parent 0572b35 commit 0562c31
1 file changed
+16
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8681 | 8681 | | |
8682 | 8682 | | |
8683 | 8683 | | |
| 8684 | + | |
| 8685 | + | |
| 8686 | + | |
| 8687 | + | |
| 8688 | + | |
| 8689 | + | |
| 8690 | + | |
| 8691 | + | |
| 8692 | + | |
| 8693 | + | |
| 8694 | + | |
| 8695 | + | |
| 8696 | + | |
| 8697 | + | |
| 8698 | + | |
| 8699 | + | |
8684 | 8700 | | |
8685 | 8701 | | |
8686 | 8702 | | |
| |||
0 commit comments