-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[ty] Infer slightly more precise types for comprehensions #20111
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,12 +33,6 @@ def _(): | |
| def _(): | ||
| assert_never(None) # error: [type-assertion-failure] | ||
|
|
||
| def _(): | ||
| assert_never([]) # error: [type-assertion-failure] | ||
|
|
||
| def _(): | ||
| assert_never({}) # error: [type-assertion-failure] | ||
|
|
||
|
Comment on lines
-36
to
-41
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| def _(): | ||
| assert_never(()) # error: [type-assertion-failure] | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # Generator expressions | ||
|
|
||
| ```py | ||
| # revealed: GeneratorType[@Todo(generator expression yield type), @Todo(generator expression send type), @Todo(generator expression return type)] | ||
| reveal_type((x for x in range(42))) | ||
| ``` |
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.
asserting the full error message here is now slightly more complicated because Todo types are rendered differently in release builds, and our mdtest regex that usually deals with that didn't seem able to handle a Todo type nested inside two pairs of square brackets. It didn't seem essential for us to assert the full error message here, so I just simplified the test