-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Starting from version 1.0.0, a union of Generators is (sometimes) treated as if it has no ReturnType #15141
Comments
By the way, did you happen to encounter this regression in an open source project? |
This is in something I'm working on that's technically open source, but not in any convenient way; I don't really want to publicize it anywhere before it's useful. EDIT (May 3): Also, it uses some custom plugins, so I think currently it can't go in mypy_primer anyway. I forgot about that. |
Thanks! I'd love to include it in mypy_primer so we avoid regressions on that project in the future; if you're ever comfortable with that at some point, feel free to post a link to the project here |
Bug Report
Starting from version 1.0.0,
yield from
a union onGenerator
types generates the errorFunction does not return a value [func-returns-value]
, and attempting to use the return reveals that Mypy is, in fact, treating it as if it's None.There are ways around this; it appears that the inference is a little smarter at function boundaries than in-line, so I've just defined a bunch of helper functions to work around it for now.
To Reproduce
(https://mypy-play.net/?mypy=0.991&python=3.11&gist=5c3183a0d4d1c02161211b01654d519f)
(The repro is working with
YieldType
, but in my code it's changingReturnType
. It breaks either way around.)Actual Behavior
On post-1.0.0 versions:
Pre-1.0.0, produces no output.
The text was updated successfully, but these errors were encountered: