-
Notifications
You must be signed in to change notification settings - Fork 281
Closed
Labels
typecheckingusabilityUsability & readiness issues identified with running Pyrefly on top OSS projectsUsability & readiness issues identified with running Pyrefly on top OSS projects
Description
Describe the Bug
Minimal repro:
# Pattern: Class variable overridden in subclass, methods called from subclass
class Request:
def __init__(self, url: str) -> None:
self.url: str = url
class FormRequest(Request):
@classmethod
def from_response(cls, response: str) -> FormRequest:
return cls(response)
class BaseTest:
request_class = Request
class MyTest(BaseTest):
request_class = FormRequest
def test_from_response(self) -> None:
# FP: pyrefly resolves self.request_class as type[Request]
# (from the base class), ignoring the override in this class
req = self.request_class.from_response(
"http://example.com/form",
)No other type checker count this as an error
Sandbox Link
(Only applicable for extension issues) IDE Information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
typecheckingusabilityUsability & readiness issues identified with running Pyrefly on top OSS projectsUsability & readiness issues identified with running Pyrefly on top OSS projects