Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion mypy/checkpattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,8 @@ def visit_sequence_pattern(self, o: SequencePattern) -> PatternType:
star_expr = None

for t in current_type.items:
match_type, rest_type, captures = self.accept(o, t)
with self.msg.filter_errors():
match_type, rest_type, captures = self.accept(o, t)
match_types.append(match_type)
rest_types.append(rest_type)
if not is_uninhabited(match_type):
Expand Down
12 changes: 12 additions & 0 deletions test-data/unit/check-python310.test
Original file line number Diff line number Diff line change
Expand Up @@ -4019,3 +4019,15 @@ def enum_then_dummy_class(arg: DummyClass | Literal[MyEnum.RELEVANT]):
case _:
pass # E: Statement is unreachable
[builtins fixtures/tuple.pyi]

[case testMatchSequencePatternUnionTupleNoUnreachable]
# flags: --warn-unreachable
def f(value: tuple[None, int] | tuple[int, None] | tuple[int, int]) -> None:
match value:
case (None, int(y)):
pass
case (int(x), None):
pass
case (int(x), int(y)):
pass
[builtins fixtures/tuple.pyi]
Loading