File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 2929def getAlternatives (n ):
3030 if isinstance (n , ast .If ):
3131 return [n .body ]
32- if isinstance (n , ast .Try ):
32+ elif isinstance (n , ast .Try ):
3333 return [n .body + n .orelse ] + [[hdl ] for hdl in n .handlers ]
34+ elif sys .version_info >= (3 , 10 ) and isinstance (n , ast .Match ):
35+ return [mc .body for mc in n .cases ]
3436
3537
3638FOR_TYPES = (ast .For , ast .AsyncFor )
Original file line number Diff line number Diff line change @@ -81,3 +81,14 @@ def test_match_double_star(self):
8181 case {'foo': k1, **rest}:
8282 print(f'{k1=} {rest=}')
8383 ''' )
84+
85+ def test_defined_in_different_branches (self ):
86+ self .flakes ('''
87+ def f(x):
88+ match x:
89+ case 1:
90+ def y(): pass
91+ case _:
92+ def y(): print(1)
93+ return y
94+ ''' )
You can’t perform that action at this time.
0 commit comments