-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
regression involving subclass and overloaded constructor #3927
Comments
Thanks for the bug report. This was due to an existing bug that was being masked previously. A change related to another bug fix exposed this one. I'll need to investigate how to fix this without breaking other cases. In the meantime, you can work around this issue by providing an explicit return type annotation for def inner() -> Generator[ContainerSub[T_co], None, None]:
for x in self:
yield ContainerSub(lambda: [x]) |
thanks. I didn't know annotating |
… generic class constructor from within that class implementation. This addresses #3927.
This will be fixed in the next release. |
This is addressed in pyright 1.1.272. It will also be included in a future release of pylance. |
Describe the bug
Following code reports error. If we move the
method
to the parent class the error disappears. If we explicitly annotate theinner()
with-> Iterable[ContainerSub[T_co]]
instead of agenerator
the error also disappears. Replacing the__init__
's arg withUnion
instead of overloading can also avoid the error.To Reproduce
Steps to reproduce the behavior.
Expected behavior
Code used to type check before 1.1.262
Screenshots or Code
VS Code extension or command-line
pyright 1.1.270
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: