Commit 575a29c
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 9c7df7a commit 575a29c
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 | |
|---|---|---|---|
| |||
4373 | 4373 | | |
4374 | 4374 | | |
4375 | 4375 | | |
4376 | | - | |
4377 | | - | |
4378 | | - | |
4379 | | - | |
| 4376 | + | |
| 4377 | + | |
| 4378 | + | |
| 4379 | + | |
| 4380 | + | |
| 4381 | + | |
| 4382 | + | |
| 4383 | + | |
| 4384 | + | |
| 4385 | + | |
| 4386 | + | |
| 4387 | + | |
| 4388 | + | |
| 4389 | + | |
| 4390 | + | |
4380 | 4391 | | |
4381 | 4392 | | |
4382 | 4393 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
9173 | 9174 | | |
9174 | 9175 | | |
9175 | 9176 | | |
9176 | | - | |
9177 | | - | |
| 9177 | + | |
| 9178 | + | |
| 9179 | + | |
| 9180 | + | |
9178 | 9181 | | |
9179 | 9182 | | |
| 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 | | |
| |||
851 | 897 | | |
852 | 898 | | |
853 | 899 | | |
854 | | - | |
855 | 900 | | |
856 | 901 | | |
857 | 902 | | |
| |||
865 | 910 | | |
866 | 911 | | |
867 | 912 | | |
| 913 | + | |
868 | 914 | | |
869 | 915 | | |
870 | 916 | | |
| |||
881 | 927 | | |
882 | 928 | | |
883 | 929 | | |
884 | | - | |
885 | | - | |
886 | | - | |
887 | | - | |
888 | | - | |
889 | | - | |
890 | | - | |
891 | | - | |
892 | | - | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
893 | 933 | | |
894 | 934 | | |
895 | 935 | | |
| |||
907 | 947 | | |
908 | 948 | | |
909 | 949 | | |
910 | | - | |
| 950 | + | |
911 | 951 | | |
912 | | - | |
913 | | - | |
914 | | - | |
915 | | - | |
916 | | - | |
917 | | - | |
918 | | - | |
919 | | - | |
920 | | - | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
921 | 955 | | |
922 | 956 | | |
923 | 957 | | |
| |||
| 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