Commit 3fd3ff0
committed
[TypeChecker] Adjust Double<->CGFloat conversion to always preserve its location
Unfortunately current approach of making a conversion independent of location
doesn't work when conversion is required for multiple arguments to the
same call because solver expects that either there are no Double<->CGFloat
conversions, or one of them has already been applied which is not the case.
The reason why locations weren't preserved in the first place is due to
how a solution is applied to AST - AST is mutated first and then, if there
are any conversions, they are applied to the already mutated version of
original AST. This creates a problem for Double<->CGFloat which depends
on an overload choice of injected call and it's impossible to find it based
on the mutated AST. But it turns out that this is only an issue in two
specific cases - conversions against contextual type and after optional injection.
This situations could be mitigated by dropping parts of the locator which are
unimportant for the Double<->CGFloat conversion - anchor in case of contextual
and `OptionalPayload` element(s) in case of optional injection.
Resolves: #593741 parent 14dab87 commit 3fd3ff0
File tree
5 files changed
+73
-30
lines changed- include/swift/Sema
- lib/Sema
- test/Constraints
5 files changed
+73
-30
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3702 | 3702 | | |
3703 | 3703 | | |
3704 | 3704 | | |
| 3705 | + | |
| 3706 | + | |
| 3707 | + | |
| 3708 | + | |
| 3709 | + | |
| 3710 | + | |
3705 | 3711 | | |
3706 | 3712 | | |
3707 | 3713 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6779 | 6779 | | |
6780 | 6780 | | |
6781 | 6781 | | |
6782 | | - | |
6783 | | - | |
6784 | | - | |
6785 | | - | |
| 6782 | + | |
| 6783 | + | |
| 6784 | + | |
| 6785 | + | |
| 6786 | + | |
| 6787 | + | |
| 6788 | + | |
6786 | 6789 | | |
6787 | 6790 | | |
6788 | 6791 | | |
| |||
8992 | 8995 | | |
8993 | 8996 | | |
8994 | 8997 | | |
8995 | | - | |
8996 | | - | |
8997 | | - | |
| 8998 | + | |
| 8999 | + | |
| 9000 | + | |
| 9001 | + | |
| 9002 | + | |
8998 | 9003 | | |
8999 | 9004 | | |
9000 | 9005 | | |
9001 | 9006 | | |
9002 | 9007 | | |
9003 | | - | |
| 9008 | + | |
| 9009 | + | |
| 9010 | + | |
9004 | 9011 | | |
9005 | 9012 | | |
9006 | 9013 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12400 | 12400 | | |
12401 | 12401 | | |
12402 | 12402 | | |
12403 | | - | |
12404 | | - | |
| 12403 | + | |
| 12404 | + | |
12405 | 12405 | | |
12406 | 12406 | | |
12407 | 12407 | | |
12408 | 12408 | | |
12409 | 12409 | | |
12410 | 12410 | | |
12411 | 12411 | | |
12412 | | - | |
12413 | | - | |
12414 | | - | |
12415 | | - | |
12416 | | - | |
12417 | 12412 | | |
12418 | 12413 | | |
12419 | | - | |
| 12414 | + | |
| 12415 | + | |
| 12416 | + | |
| 12417 | + | |
12420 | 12418 | | |
12421 | 12419 | | |
12422 | 12420 | | |
12423 | 12421 | | |
12424 | | - | |
| 12422 | + | |
12425 | 12423 | | |
12426 | 12424 | | |
12427 | 12425 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
424 | 424 | | |
425 | 425 | | |
426 | 426 | | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
427 | 456 | | |
428 | 457 | | |
429 | 458 | | |
430 | 459 | | |
431 | 460 | | |
432 | 461 | | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
| 462 | + | |
| 463 | + | |
442 | 464 | | |
443 | 465 | | |
444 | 466 | | |
| |||
5323 | 5345 | | |
5324 | 5346 | | |
5325 | 5347 | | |
| 5348 | + | |
| 5349 | + | |
| 5350 | + | |
5326 | 5351 | | |
5327 | 5352 | | |
5328 | 5353 | | |
| |||
Lines changed: 11 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
198 | | - | |
| 197 | + | |
| 198 | + | |
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
204 | | - | |
| 204 | + | |
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
210 | | - | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
211 | 218 | | |
0 commit comments