Describe the bug
That var variable is referenced.
To Reproduce
N/A
Expected behavior
N/A
Screenshots or Code

def test():
var = 0
lambda var=var: ...
VS Code extension or command-line
coc-pyright with pyright 1.1.54
Additional context
FWIW, It is a common pattern of binding a variable to a argument to avoid lazy binding
https://github.com/satwikkansal/wtfpython#-the-sticky-output-function
>>> fns = [lambda x, i=i: x + i for i in range(10)]
>>> [fn(0) for fn in fns]
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
Thanks for the bug report. This will be fixed in the next version of Pyright and Pylance.
This is now implemented in Pyright 1.1.55, which I just published. It will also be included in the next release of Pylance.
Most helpful comment
This is now implemented in Pyright 1.1.55, which I just published. It will also be included in the next release of Pylance.