Bug description
a = 'a'
b = 'b'
s = 'a'
match s:
case a if a in "crab":
pass
case b if b in "song":
pass
Configuration
Command used
Pylint output
************* Module hi
hi.py:6:9: E1901: The name capture `case a` makes the remaining patterns unreachable. Use a dotted name (for example an enum) to fix this. (bare-name-capture-pattern)
Expected behavior
I would expect there to be no error from pylint since there is no syntax error thrown by the python interpreter with the same code.
>>> a = 'a'
>>> b = 'b'
>>> s = 'a'
>>> match s:
... case a if a in "crab":
... pass
... case b if b in "song":
... pass
...
>>>
Pylint version
pylint 4.0.0
astroid 4.0.1
Python 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
OS / Environment
Windows 11
Command Prompt
Python version 3.10.11
Additional dependencies