[ty] Fix bug where ty would think that a Callable with a variadic positional parameter could be a subtype of a Callable with a positional-or-keyword parameter by AlexWaygood · Pull Request #23610 · astral-sh/ruff (original) (raw)
and others added 2 commits
…rd params
When a variadic (*args) parameter was matched against
positional-or-keyword parameters from the supertype, those parameters
were collected for keyword checking later. However, if both parameter
iterators were exhausted simultaneously, the loop returned early without
verifying that the keyword portion of those parameters could also be
satisfied. This caused (*args: int) to incorrectly be considered a
subtype of (a: int), even though a can be passed as a keyword
argument which *args cannot accept.
The fix ensures that when unmatched keyword parameters exist, the loop breaks to the keyword-matching code instead of returning early.
https://claude.ai/code/session_015KWJHraC4EMq4ruyp78ESc
carljm added a commit that referenced this pull request
- main:
[ty] Take myself out of the reviewer pool for the next few days (#23618)
[ty] Fix bug where ty would think that a
Callablewith a variadic positional parameter could be a subtype of aCallablewith a positional-or-keyword parameter (#23610) [ruff] Add fix fornone-not-at-end-of-union(RUF036) (#22829) Bump cargo dist to 0.31 (#23614) [pyflakes] Fix false positive for names shadowing re-exports (F811) (#23356) [fastapi] Handle callable class dependencies with__call__method (FAST003) (#23553) [ty] Recurse into tuples and nested tuples when applying special-cased validation ofisinstance()andissubclass()(#23607) Update typing conformance suite commit (#23606) [ty] Detect invalid uses of@finalon non-methods (#23604) [ty] Move the type hierarchy request handlers to individual modules [ty] Wire up the type hierarchy implementation with the LSP [ty] Add routine for mapping from system path to vendored path [ty] Implement internal routines for providing the LSP "type hierarchy" feature [ty] Add some helper methods onClassLiteral[ty] Move some module name helper routines to methods onModuleName[ty] Bump version oflsp-types[ty] Refactor to support building constraint sets differently (#23600) [ty] Dataclass transform: neither frozen nor non-frozen (#23366) [ty] Add snapshot tests for advancedinvalid-assignmentscenarios (#23581) [ty] disallow negative narrowing on SubclassOf types (#23598)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})