Commit cb876cb
committed
[CSSimplify] CGFloat-Double: Rank narrowing correctly when result is injected into an optional
If result of `CGFloat` -> `Double` conversion is injected into an optional
it should be ranked based on depth just like when locator is fully simplified.
For example:
```swift
func test(v: CGFloat?) {
_ = v ?? 2.0 / 3.0
}
```
In this expression division should be performed on `Double` and result
narrowed down (based on the rule that narrowing conversion should always
be delayed) but `Double` -> `CGFloat?` was given an incorrect score and
instead of picking `?? (_: T?, _: T) -> T` overload, the solver would
use `?? (_: T?, _: T?) -> T?`.1 parent b7e7493 commit cb876cb
1 file changed
+13
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14690 | 14690 | | |
14691 | 14691 | | |
14692 | 14692 | | |
14693 | | - | |
14694 | | - | |
14695 | | - | |
| 14693 | + | |
| 14694 | + | |
| 14695 | + | |
| 14696 | + | |
| 14697 | + | |
| 14698 | + | |
| 14699 | + | |
| 14700 | + | |
| 14701 | + | |
| 14702 | + | |
| 14703 | + | |
| 14704 | + | |
| 14705 | + | |
14696 | 14706 | | |
14697 | 14707 | | |
14698 | 14708 | | |
| |||
0 commit comments