-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Regression in 1.1.405 involving loops #11321
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
A clear and concise description of the behavior you are seeing and the expected behavior along with steps to reproduce it.
Pyright seems to be confused about variable type when modifying said variable inside the loop.
In this example, lines should infer as list[str].
Code or Screenshots
lines = ["ab", "bc", "ac", "ca"] # lines: list[str]
while lines: # lines: list[str] | list[str | Unknown]
print(lines) # lines: list[str] | list[Unknown]
lines = [x for x in lines[1:]] # x: str | UnknownWorking fine in 1.1.404
Broken in 1.1.405
Still broken in 1.1.408 (latest version as of today)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working