Commit e1bb74b
authored
[ty] Match variadic argument to variadic parameter (#20511)
## Summary
Closes: astral-sh/ty#1236
This PR fixes a bug where the variadic argument wouldn't match against
the variadic parameter in certain scenarios.
This was happening because I didn't realize that the `all_elements`
iterator wouldn't keep on returning the variable element (which is
correct, I just didn't realize it back then).
I don't think we can use the `resize` method here because we don't know
how many parameters this variadic argument is matching against as this
is where the actual parameter matching occurs.
## Test Plan
Expand test cases to consider a few more combinations of arguments and
parameters which are variadic.1 parent edeb458 commit e1bb74b
File tree
6 files changed
+150
-67
lines changed- crates/ty_python_semantic
- resources/mdtest/call
- src/types
- call
- infer
6 files changed
+150
-67
lines changedLines changed: 90 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
642 | 642 | | |
643 | 643 | | |
644 | 644 | | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 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 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
645 | 735 | | |
646 | 736 | | |
647 | 737 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | 44 | | |
46 | 45 | | |
47 | 46 | | |
| |||
51 | 50 | | |
52 | 51 | | |
53 | 52 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
| 53 | + | |
59 | 54 | | |
60 | 55 | | |
61 | 56 | | |
| |||
203 | 198 | | |
204 | 199 | | |
205 | 200 | | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
225 | 205 | | |
226 | 206 | | |
227 | 207 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2135 | 2135 | | |
2136 | 2136 | | |
2137 | 2137 | | |
| 2138 | + | |
2138 | 2139 | | |
2139 | 2140 | | |
2140 | 2141 | | |
2141 | 2142 | | |
2142 | 2143 | | |
2143 | 2144 | | |
2144 | | - | |
2145 | 2145 | | |
2146 | 2146 | | |
2147 | | - | |
2148 | | - | |
2149 | | - | |
| 2147 | + | |
| 2148 | + | |
| 2149 | + | |
| 2150 | + | |
| 2151 | + | |
| 2152 | + | |
| 2153 | + | |
| 2154 | + | |
| 2155 | + | |
| 2156 | + | |
| 2157 | + | |
2150 | 2158 | | |
2151 | 2159 | | |
2152 | 2160 | | |
2153 | 2161 | | |
2154 | 2162 | | |
2155 | | - | |
| 2163 | + | |
| 2164 | + | |
| 2165 | + | |
| 2166 | + | |
| 2167 | + | |
2156 | 2168 | | |
2157 | 2169 | | |
2158 | 2170 | | |
| |||
2163 | 2175 | | |
2164 | 2176 | | |
2165 | 2177 | | |
2166 | | - | |
| 2178 | + | |
| 2179 | + | |
| 2180 | + | |
| 2181 | + | |
| 2182 | + | |
| 2183 | + | |
| 2184 | + | |
| 2185 | + | |
| 2186 | + | |
| 2187 | + | |
| 2188 | + | |
| 2189 | + | |
| 2190 | + | |
| 2191 | + | |
| 2192 | + | |
| 2193 | + | |
| 2194 | + | |
| 2195 | + | |
2167 | 2196 | | |
2168 | 2197 | | |
2169 | 2198 | | |
| |||
2433 | 2462 | | |
2434 | 2463 | | |
2435 | 2464 | | |
2436 | | - | |
| 2465 | + | |
2437 | 2466 | | |
2438 | 2467 | | |
2439 | 2468 | | |
2440 | | - | |
2441 | 2469 | | |
2442 | 2470 | | |
2443 | 2471 | | |
| |||
2465 | 2493 | | |
2466 | 2494 | | |
2467 | 2495 | | |
2468 | | - | |
2469 | 2496 | | |
2470 | | - | |
2471 | | - | |
2472 | | - | |
2473 | | - | |
2474 | | - | |
2475 | | - | |
2476 | | - | |
2477 | | - | |
2478 | | - | |
2479 | | - | |
2480 | | - | |
2481 | | - | |
2482 | | - | |
2483 | | - | |
2484 | | - | |
2485 | | - | |
2486 | | - | |
2487 | | - | |
2488 | | - | |
2489 | | - | |
2490 | | - | |
2491 | | - | |
2492 | | - | |
| 2497 | + | |
| 2498 | + | |
2493 | 2499 | | |
2494 | 2500 | | |
2495 | 2501 | | |
2496 | 2502 | | |
2497 | | - | |
2498 | | - | |
| 2503 | + | |
| 2504 | + | |
2499 | 2505 | | |
2500 | 2506 | | |
2501 | 2507 | | |
| |||
2711 | 2717 | | |
2712 | 2718 | | |
2713 | 2719 | | |
2714 | | - | |
2715 | | - | |
2716 | | - | |
| 2720 | + | |
| 2721 | + | |
2717 | 2722 | | |
2718 | 2723 | | |
2719 | 2724 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
874 | 874 | | |
875 | 875 | | |
876 | 876 | | |
877 | | - | |
| 877 | + | |
878 | 878 | | |
879 | 879 | | |
880 | 880 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1733 | 1733 | | |
1734 | 1734 | | |
1735 | 1735 | | |
1736 | | - | |
| 1736 | + | |
1737 | 1737 | | |
1738 | 1738 | | |
1739 | 1739 | | |
| |||
5831 | 5831 | | |
5832 | 5832 | | |
5833 | 5833 | | |
5834 | | - | |
| 5834 | + | |
5835 | 5835 | | |
5836 | 5836 | | |
5837 | 5837 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
970 | 970 | | |
971 | 971 | | |
972 | 972 | | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
973 | 981 | | |
974 | 982 | | |
975 | 983 | | |
| |||
0 commit comments