Skip to content

Commit

Permalink
Fix no-redef lint for rest_type
Browse files Browse the repository at this point in the history
  • Loading branch information
bergkvist committed Sep 1, 2024
1 parent cb6fa03 commit 4d28adf
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions mypy/checkpattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,11 @@ def visit_sequence_pattern(self, o: SequencePattern) -> PatternType:
if all(used_item != item for used_item in union_items):
rest_items.append(item)

typ = UnionType.make_union(items=union_items)
rest_type = UnionType.make_union(items=rest_items)
return PatternType(type=typ, rest_type=rest_type, captures=union_captures)
return PatternType(
type=UnionType.make_union(items=union_items),
rest_type=UnionType.make_union(items=rest_items),
captures=union_captures
)

if isinstance(current_type, TupleType):
inner_types = current_type.items
Expand Down

0 comments on commit 4d28adf

Please sign in to comment.