Commit 7a66caf
committed
Fix literal fingerprint fast-path incorrectly skipping optional arguments
build_literal_fingerprint included optional arguments (ARG_OPT / ARG_NAMED_OPT) in the fingerprint used to detect disjoint overloads.
When two overloads differed only in an optional Literal arg (e.g. as_index: Literal[True] vs Literal[False]), the fast-path treated them as mutually exclusive and skipped the full overlap check - even though a caller can omit the argument entirely, matching both overloads through their other arguments.
Fix by only fingerprinting required arguments (ARG_POS and ARG_NAMED).
Optional arguments can always be omitted by the caller, so they can never prove two overloads are disjoint.
The real-world symptom was pandas-stubs gaining spurious unused-ignore errors: overloads that master correctly flagged as overlapping were silently skipped by the fast-path, making existing type: ignore redundant.1 parent 8125e31 commit 7a66caf
2 files changed
Lines changed: 35 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8977 | 8977 | | |
8978 | 8978 | | |
8979 | 8979 | | |
8980 | | - | |
8981 | | - | |
8982 | | - | |
8983 | | - | |
| 8980 | + | |
| 8981 | + | |
| 8982 | + | |
| 8983 | + | |
| 8984 | + | |
| 8985 | + | |
| 8986 | + | |
| 8987 | + | |
| 8988 | + | |
| 8989 | + | |
8984 | 8990 | | |
8985 | 8991 | | |
8986 | | - | |
| 8992 | + | |
| 8993 | + | |
| 8994 | + | |
8987 | 8995 | | |
8988 | 8996 | | |
8989 | 8997 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6963 | 6963 | | |
6964 | 6964 | | |
6965 | 6965 | | |
| 6966 | + | |
| 6967 | + | |
| 6968 | + | |
| 6969 | + | |
| 6970 | + | |
| 6971 | + | |
| 6972 | + | |
| 6973 | + | |
| 6974 | + | |
| 6975 | + | |
| 6976 | + | |
| 6977 | + | |
| 6978 | + | |
| 6979 | + | |
| 6980 | + | |
| 6981 | + | |
| 6982 | + | |
| 6983 | + | |
| 6984 | + | |
| 6985 | + | |
| 6986 | + | |
| 6987 | + | |
0 commit comments