Skip to content

Commit 4cd8a8c

Browse files
committed
fix: modify current_type if not uninhabited
1 parent 78fb78b commit 4cd8a8c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mypy/checkpattern.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ def visit_or_pattern(self, o: OrPattern) -> PatternType:
158158
for pattern in o.patterns:
159159
pattern_type = self.accept(pattern, current_type)
160160
pattern_types.append(pattern_type)
161-
current_type = pattern_type.rest_type
161+
if not is_uninhabited(pattern_type.type):
162+
current_type = pattern_type.rest_type
162163

163164
#
164165
# Collect the final type

0 commit comments

Comments
 (0)