microsoft / pyright

Static Type Checker for Python
Other
13.04k stars 1.39k forks source link

Fixed bug in type narrowing logic for sequence pattern matching when … #8365

Closed erictraut closed 1 month ago

erictraut commented 1 month ago

…a "star" entry in the pattern captures a TypeVarTuple. The resulting type should be Unknown rather than the unpacked TypeVarTuple.

Fixed bug that results in a false positive when assigning type tuple[Any, ...] to tuple[*TS]. This should be allowed because tuple[Any, ...] is a gradual form that is assignable to all tuple types.

This addresses #8357.

github-actions[bot] commented 1 month ago

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅