Skip to content

Commit 6950464

Browse files
cdce8pPierre-Sassoulas
authored andcommitted
Add simplified test cases for inference of pattern variables
1 parent 2239a74 commit 6950464

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ Release date: TBA
6666

6767
Closes #4668
6868

69+
* Fix crash when inferring variables assigned in match patterns
70+
71+
Closes #4685
72+
6973

7074
What's New in Pylint 2.9.3?
7175
===========================

tests/functional/p/pattern_matching.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,17 @@ def __init__(self, x, y):
2222
print(new_point)
2323
case new_var:
2424
print(new_var)
25+
26+
27+
# Test inference of variables assigned in patterns doesn't crash pylint
28+
var = 42
29+
match var:
30+
case (1, *rest3):
31+
if rest3 != 2:
32+
pass
33+
case {1: _, **rest4}:
34+
if rest4 != 2:
35+
pass
36+
case c:
37+
if c != 2:
38+
pass

0 commit comments

Comments
 (0)