You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TypeVars on 'self' on an instance method are not bound to the instance type. #5416
When a typevar is applied to 'self' in an instance method, Pyrefly "forgets" that self must be an instance of the class it is defined in. As best I can tell, the same happens for class methods (which is potentially the cause of #5410)
For the below example, pyrefly 1.4.0 reports that it cannot access the attribute baz for class object*. It seems pyrefly is typing self to Self@bin instead of Self@Bar
This is particularly problematic for python<3.11, since typing.Self did not exist and so TypeVars are the only way to annotate the return types of factory functions that may be inherited by child classes.
Activity