-
Notifications
You must be signed in to change notification settings - Fork 277
Labels
narrowingIssues with narrowing - root cause is usually narrowing, flow handling, or bothIssues with narrowing - root cause is usually narrowing, flow handling, or bothscoping-control-flowissues related to scoping and control flowissues related to scoping and control flow
Milestone
Description
Short reproduction of the issue:
# test.py
def f(i):
return a if (a := round(i)) - 1 else a + 1
print(f"result is {f(1.0)}") This executes correctly:
$ python test.py
result is 2
But pyrefly raises an error (using v0.52.0):
$ pyrefly check test.py
ERROR `a` is uninitialized [unbound-name]
--> test.py:3:40
|
3 | return a if (a := round(i)) - 1 else a + 1
| ^
|
INFO 1 error
Sandbox Link
(Only applicable for extension issues) IDE Information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
narrowingIssues with narrowing - root cause is usually narrowing, flow handling, or bothIssues with narrowing - root cause is usually narrowing, flow handling, or bothscoping-control-flowissues related to scoping and control flowissues related to scoping and control flow