Commit 9588d51
committed
[CSOptimizer] Fix a conditional that ignores function type parameters to look through optionals
Since parameters that have function types don't participate in
ranking, function types that are wrapped in optionals should be
excluded as well, because it's possible to overload on that and
such overloads with optional types would gain an undue advantage.
For example:
```
func test(_: (() -> Void)?) {}
func test(_: () -> Void) {}
func compute(handler: () -> Void) {
test(handler)
}
```
Without this change the second overload would be ignored and
the first one would be an exact match.
Resolves: rdar://1572343171 parent e2ad4a9 commit 9588d51
File tree
2 files changed
+9
-1
lines changed- lib/Sema
- test/SILOptimizer
2 files changed
+9
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1598 | 1598 | | |
1599 | 1599 | | |
1600 | 1600 | | |
1601 | | - | |
| 1601 | + | |
1602 | 1602 | | |
1603 | 1603 | | |
1604 | 1604 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
352 | 352 | | |
353 | 353 | | |
354 | 354 | | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
0 commit comments