File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -5568,7 +5568,8 @@ def visit_match_stmt(self, s: MatchStmt) -> None:
5568
5568
# will be a union of all capture types). This pass ignores
5569
5569
# guard expressions.
5570
5570
pattern_types = [
5571
- self .pattern_checker .accept (p , subject_type , [s .subject ]) for p in s .patterns
5571
+ self .pattern_checker .accept (p , subject_type , [unwrapped_subject ])
5572
+ for p in s .patterns
5572
5573
]
5573
5574
type_maps : list [TypeMap ] = [t .captures for t in pattern_types ]
5574
5575
inferred_types = self .infer_variable_types_from_type_maps (type_maps )
@@ -5579,7 +5580,9 @@ def visit_match_stmt(self, s: MatchStmt) -> None:
5579
5580
current_subject_type = self .expr_checker .narrow_type_from_binder (
5580
5581
named_subject , subject_type
5581
5582
)
5582
- pattern_type = self .pattern_checker .accept (p , current_subject_type , [s .subject ])
5583
+ pattern_type = self .pattern_checker .accept (
5584
+ p , current_subject_type , [unwrapped_subject ]
5585
+ )
5583
5586
with self .binder .frame_context (can_skip = True , fall_through = 2 ):
5584
5587
if b .is_unreachable or isinstance (
5585
5588
get_proper_type (pattern_type .type ), UninhabitedType
Original file line number Diff line number Diff line change 16
16
from mypy .messages import MessageBuilder
17
17
from mypy .nodes import (
18
18
ARG_POS ,
19
- AssignmentExpr ,
20
19
Context ,
21
20
Expression ,
22
21
IndexExpr ,
@@ -881,8 +880,6 @@ def get_var(expr: Expression) -> Var | None:
881
880
return get_var (expr .expr )
882
881
if isinstance (expr , IndexExpr ):
883
882
return get_var (expr .base )
884
- if isinstance (expr , AssignmentExpr ):
885
- return get_var (expr .target )
886
883
if not isinstance (expr , NameExpr ):
887
884
return None
888
885
node = expr .node
You can’t perform that action at this time.
0 commit comments