-
Notifications
You must be signed in to change notification settings - Fork 297
Narrowed type is not reflected in nested scopes #40
Copy link
Copy link
Labels
metascoping-control-flowissues related to scoping and control flowissues related to scoping and control flowusabilityUsability & readiness issues identified with running Pyrefly on top OSS projectsUsability & readiness issues identified with running Pyrefly on top OSS projects
Milestone
Description
from typing import Callable
class Foo:
_window_function: Callable[[str], int] | None
def foo(self) -> None:
if (window_function := self._window_function):
def bar() -> None:
print(window_function('foo'))
bar()$ pyrefly check g.py
ERROR g.py:9:23-38: Expected a callable, got None [not-callable]
Spotted in Narwhals
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
metascoping-control-flowissues related to scoping and control flowissues related to scoping and control flowusabilityUsability & readiness issues identified with running Pyrefly on top OSS projectsUsability & readiness issues identified with running Pyrefly on top OSS projects