You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixes#19507
This PR adds a check to prevent reassignment of final variables in a
match statement.
Currently, the following passes without an error:
```Python
from typing import Final
FOO: Final = 8
a = 10
match a:
case FOO:
pass
print(FOO) # FOO is reassigned, prints 10
```
MyPy already checks that the type of FOO isn't changed if used like
this. I added a check in the same place that makes sure it's not `Final`
either.
Since this tests the match syntax, I put the test where I did. If it's
not the appropriate place for it I will move it as instructed :)
0 commit comments