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:
55685568 # will be a union of all capture types). This pass ignores
55695569 # guard expressions.
55705570 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
55725573 ]
55735574 type_maps : list [TypeMap ] = [t .captures for t in pattern_types ]
55745575 inferred_types = self .infer_variable_types_from_type_maps (type_maps )
@@ -5579,7 +5580,9 @@ def visit_match_stmt(self, s: MatchStmt) -> None:
55795580 current_subject_type = self .expr_checker .narrow_type_from_binder (
55805581 named_subject , subject_type
55815582 )
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+ )
55835586 with self .binder .frame_context (can_skip = True , fall_through = 2 ):
55845587 if b .is_unreachable or isinstance (
55855588 get_proper_type (pattern_type .type ), UninhabitedType
Original file line number Diff line number Diff line change 1616from mypy .messages import MessageBuilder
1717from mypy .nodes import (
1818 ARG_POS ,
19- AssignmentExpr ,
2019 Context ,
2120 Expression ,
2221 IndexExpr ,
@@ -881,8 +880,6 @@ def get_var(expr: Expression) -> Var | None:
881880 return get_var (expr .expr )
882881 if isinstance (expr , IndexExpr ):
883882 return get_var (expr .base )
884- if isinstance (expr , AssignmentExpr ):
885- return get_var (expr .target )
886883 if not isinstance (expr , NameExpr ):
887884 return None
888885 node = expr .node
You can’t perform that action at this time.
0 commit comments