For tuple in match, _ isn't determined to be Never, but _, _ is #18792
Labels
bug
mypy got something wrong
topic-match-statement
Python 3.10's match statement
topic-reachability
Detecting unreachable code
Bug Report
Consider the following:
This fails with
main.py:9: error: Argument 1 to "assert_never" has incompatible type "tuple[Never, Never]"; expected "Never" [arg-type]
. Fair enough, I suppose! But the following code (with two underscore wildcards instead of a single underscore wildcard)Succeeds with no errors. How is this possible? Destructuring the tuple did not actually change the type of the tuple. Is this a special case? In that case _ should have the special case as well. _, _, _ also succeeds.
There are a number of match-case related tuple-narrowing issues open already, and resolving them may resolve this issue; however, I think this issue is technically a distinct aspect of the problem.
The text was updated successfully, but these errors were encountered: