-
-
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
Fix false negatives involving Unions and generators or coroutines #14224
Conversation
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks good! Just one question about tests.
@@ -925,3 +925,21 @@ async def f() -> AsyncGenerator[int, None]: | |||
|
|||
[builtins fixtures/async_await.pyi] | |||
[typing fixtures/typing-async.pyi] | |||
|
|||
[case testAwaitUnion] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this also fix type checking yield in generators? If yes, can you add a test case for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it does, will do!
Diff from mypy_primer, showing the effect of this PR on open source code: Tanjun (https://github.com/FasterSpeeding/Tanjun)
- tanjun/dependencies/owners.py:173: error: Returning Any from function declared to return "bool" [no-any-return]
- tanjun/dependencies/owners.py:183: error: Returning Any from function declared to return "bool" [no-any-return]
- tanjun/clients.py:2313: error: Returning Any from function declared to return "Snowflake" [no-any-return]
pandas (https://github.com/pandas-dev/pandas)
+ pandas/io/formats/format.py:1233: error: Incompatible types in "yield" (actual type "Union[str, WriteBuffer[str], StringIO]", expected type "Union[WriteBuffer[str], StringIO]") [misc]
steam.py (https://github.com/Gobot1234/steam.py)
+ steam/state.py:1076: error: Incompatible types in assignment (expression has type "Union[GroupMember, None, ClanMember]", variable has type "Union[GroupMember, ClanMember]") [assignment]
+ steam/ext/commands/bot.py:616: error: No return value expected [return-value]
|
Fixes #14223