Commit 67308e6
committed
Sema: Fix crash-on-invalid with incorrect use of variadic generic type
Applying generic arguments to a variadic generic type uses the
PackMatcher to build a mapping between generic parameters and
arguments.
The PackMatcher is symmetric, so there was an unexpected failure
mode that wasn't handled: if the variadic generic type had some
non-pack parameters, but the argument list was a single pack
expansion type, the match would succeed, grouping all of the
generic parameters into a single match.
This is non-sensical, so we need to explicitly check for this
case and diagnose it. This requires a new diagnostic, since
otherwise the general diagnostic we emit for variadic generic
type mismatches doesn't make sense, since it's complaining
about there being too few generic parameters.
Fixes rdar://116713961 / #69012.1 parent b013e11 commit 67308e6
File tree
6 files changed
+98
-27
lines changed- include/swift/AST
- lib/Sema
- test
- Generics
- Macros
6 files changed
+98
-27
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4411 | 4411 | | |
4412 | 4412 | | |
4413 | 4413 | | |
4414 | | - | |
4415 | | - | |
4416 | | - | |
4417 | | - | |
| 4414 | + | |
| 4415 | + | |
| 4416 | + | |
| 4417 | + | |
| 4418 | + | |
| 4419 | + | |
| 4420 | + | |
| 4421 | + | |
| 4422 | + | |
| 4423 | + | |
| 4424 | + | |
| 4425 | + | |
| 4426 | + | |
| 4427 | + | |
| 4428 | + | |
4418 | 4429 | | |
4419 | 4430 | | |
4420 | 4431 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
9306 | 9307 | | |
9307 | 9308 | | |
9308 | 9309 | | |
9309 | | - | |
9310 | | - | |
| 9310 | + | |
| 9311 | + | |
| 9312 | + | |
| 9313 | + | |
9311 | 9314 | | |
9312 | 9315 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
667 | 668 | | |
668 | 669 | | |
669 | 670 | | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
670 | 716 | | |
671 | 717 | | |
672 | 718 | | |
| |||
834 | 880 | | |
835 | 881 | | |
836 | 882 | | |
837 | | - | |
838 | 883 | | |
839 | 884 | | |
840 | 885 | | |
| |||
848 | 893 | | |
849 | 894 | | |
850 | 895 | | |
| 896 | + | |
851 | 897 | | |
852 | 898 | | |
853 | 899 | | |
| |||
864 | 910 | | |
865 | 911 | | |
866 | 912 | | |
867 | | - | |
868 | | - | |
869 | | - | |
870 | | - | |
871 | | - | |
872 | | - | |
873 | | - | |
874 | | - | |
875 | | - | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
876 | 916 | | |
877 | 917 | | |
878 | 918 | | |
| |||
890 | 930 | | |
891 | 931 | | |
892 | 932 | | |
893 | | - | |
| 933 | + | |
894 | 934 | | |
895 | | - | |
896 | | - | |
897 | | - | |
898 | | - | |
899 | | - | |
900 | | - | |
901 | | - | |
902 | | - | |
903 | | - | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
904 | 938 | | |
905 | 939 | | |
906 | 940 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
655 | 656 | | |
656 | 657 | | |
657 | 658 | | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
658 | 666 | | |
659 | 667 | | |
660 | 668 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
0 commit comments