Commit d37f5ab
committed
fix(checker): avoid false overload-cannot-match with ParamSpec args
When an overload uses ParamSpec-flavored *args (P.args) or **kwargs
(P.kwargs), erasing the ParamSpec to Any makes the signature appear to
accept all arguments. This causes a false 'overload will never be
matched' error when combined with a second overload that has explicit
keyword-only parameters.
Skip the can-never-match check when the first overload has
ParamSpec-flavored variadic arguments, since we cannot reliably
determine overlap after erasure.
Fixes #21171
Signed-off-by: bahtya <bahtyar153@qq.com>1 parent 6cbd2cc commit d37f5ab
File tree
2 files changed
+27
-0
lines changed- mypy
- test-data/unit
2 files changed
+27
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
| 231 | + | |
231 | 232 | | |
232 | 233 | | |
233 | 234 | | |
| |||
8954 | 8955 | | |
8955 | 8956 | | |
8956 | 8957 | | |
| 8958 | + | |
| 8959 | + | |
| 8960 | + | |
| 8961 | + | |
| 8962 | + | |
| 8963 | + | |
| 8964 | + | |
| 8965 | + | |
| 8966 | + | |
| 8967 | + | |
8957 | 8968 | | |
8958 | 8969 | | |
8959 | 8970 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2756 | 2756 | | |
2757 | 2757 | | |
2758 | 2758 | | |
| 2759 | + | |
| 2760 | + | |
| 2761 | + | |
| 2762 | + | |
| 2763 | + | |
| 2764 | + | |
| 2765 | + | |
| 2766 | + | |
| 2767 | + | |
| 2768 | + | |
| 2769 | + | |
| 2770 | + | |
| 2771 | + | |
| 2772 | + | |
| 2773 | + | |
| 2774 | + | |
0 commit comments