Commit 0652bb7
committed
Always infer AsyncSequence.Failure from AsyncIteratorProtocol.Failure
The newly-introduced associated type `AsyncSequence.Failure` must
always be equivalent to the `Failure` type of the
`AsyncIteratorProtocol`. If the `AsyncSequence` type itself defines a
nested `Failure` type (say, for another purpose), associated type inference
would pick it and reject the `AsyncSequence`, causing a source compatibility
problem.
Work around the issue in two ways. First, always infer the type
witness for `AsyncSequence.Failure` from the type witness for
`AsyncIteratorProtocol.Failure`, so they can't be out of sync. This
means that we'll never even consider a nested `Failure` type in the
`AsyncSequence`-conforming type. This hack only applies prior to Swift 6.
Second, when we have inferred a `Failure` type and there is already
something else called `Failure` within that same nominal type, don't
print the inferred typelias into a module interface because it will
cause a conflict.
Fixes rdar://123543633.1 parent 34dd632 commit 0652bb7
File tree
4 files changed
+124
-18
lines changed- lib
- AST
- Sema
- test
- Concurrency
- ModuleInterface
4 files changed
+124
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6374 | 6374 | | |
6375 | 6375 | | |
6376 | 6376 | | |
| 6377 | + | |
| 6378 | + | |
| 6379 | + | |
| 6380 | + | |
| 6381 | + | |
| 6382 | + | |
| 6383 | + | |
| 6384 | + | |
| 6385 | + | |
| 6386 | + | |
| 6387 | + | |
| 6388 | + | |
| 6389 | + | |
| 6390 | + | |
| 6391 | + | |
| 6392 | + | |
| 6393 | + | |
| 6394 | + | |
| 6395 | + | |
| 6396 | + | |
| 6397 | + | |
| 6398 | + | |
| 6399 | + | |
| 6400 | + | |
| 6401 | + | |
| 6402 | + | |
6377 | 6403 | | |
6378 | 6404 | | |
6379 | 6405 | | |
| |||
6413 | 6439 | | |
6414 | 6440 | | |
6415 | 6441 | | |
| 6442 | + | |
| 6443 | + | |
| 6444 | + | |
| 6445 | + | |
| 6446 | + | |
| 6447 | + | |
| 6448 | + | |
| 6449 | + | |
6416 | 6450 | | |
6417 | 6451 | | |
6418 | 6452 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
389 | 389 | | |
390 | 390 | | |
391 | 391 | | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
392 | 421 | | |
393 | 422 | | |
394 | 423 | | |
395 | 424 | | |
396 | 425 | | |
397 | 426 | | |
398 | 427 | | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
399 | 435 | | |
400 | 436 | | |
401 | 437 | | |
| |||
1816 | 1852 | | |
1817 | 1853 | | |
1818 | 1854 | | |
1819 | | - | |
1820 | | - | |
1821 | | - | |
1822 | | - | |
1823 | | - | |
1824 | | - | |
1825 | | - | |
1826 | | - | |
1827 | | - | |
1828 | | - | |
1829 | | - | |
1830 | 1855 | | |
1831 | 1856 | | |
1832 | 1857 | | |
1833 | 1858 | | |
1834 | 1859 | | |
1835 | 1860 | | |
1836 | 1861 | | |
1837 | | - | |
| 1862 | + | |
| 1863 | + | |
1838 | 1864 | | |
1839 | 1865 | | |
1840 | 1866 | | |
| |||
2537 | 2563 | | |
2538 | 2564 | | |
2539 | 2565 | | |
2540 | | - | |
2541 | | - | |
| 2566 | + | |
2542 | 2567 | | |
2543 | 2568 | | |
2544 | 2569 | | |
| |||
2582 | 2607 | | |
2583 | 2608 | | |
2584 | 2609 | | |
2585 | | - | |
| 2610 | + | |
2586 | 2611 | | |
2587 | 2612 | | |
2588 | 2613 | | |
| |||
2683 | 2708 | | |
2684 | 2709 | | |
2685 | 2710 | | |
2686 | | - | |
2687 | | - | |
| 2711 | + | |
| 2712 | + | |
2688 | 2713 | | |
2689 | 2714 | | |
2690 | 2715 | | |
| |||
2727 | 2752 | | |
2728 | 2753 | | |
2729 | 2754 | | |
2730 | | - | |
| 2755 | + | |
2731 | 2756 | | |
2732 | 2757 | | |
2733 | 2758 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
0 commit comments