pyright
pyright copied to clipboard
reportUnusedVariable considers variable as used after reassignment
Describe the bug
Pyright considers a variable to be used if it has been used at least once, even if it is later reassigned to without use.
Code or Screenshots
def f() -> None:
a = 1
# I would expect the left-hand side `a` to be flagged as unused here (PyCharm does so)
a = 2 * a
# pyright: reportUnusedVariable=error
pyright <path-to-file>
results in 0 errors, 0 warnings, 0 informations
.
VS Code extension or command-line pyright 1.1.377 on the command-line.