-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
addressed in next versionIssue is fixed and will appear in next published versionIssue is fixed and will appear in next published versionenhancement requestNew feature or requestNew feature or request
Description
Currently, pyright narrows only the subject expression of a match statement. However, there are cases where a subject expression contains a subexpression that could also be narrowed, at least in theory.
- An example is provided in this thread: Match not type guarding TypedDicts pylance-release#4248
- Another example: Narrowing and exhaustiveness errors when matching on a tuple of optionals python/mypy#14731
- Another example:
mypy
unable to narrow type of tuple elements incase
clause in pattern matching python/mypy#12364
Likewise, expressions that utilize the subject as a subexpression could be narrowed, in theory.
I don't yet know if either of these can be implemented in a way that is computationally feasible, but it's worth investigating.
Azureblade3808
Metadata
Metadata
Assignees
Labels
addressed in next versionIssue is fixed and will appear in next published versionIssue is fixed and will appear in next published versionenhancement requestNew feature or requestNew feature or request