-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[red-knot] Add type inference for loop variables inside comprehension scopes #13251
Conversation
CodSpeed Performance ReportMerging #13251 will not alter performanceComparing Summary
|
3cfa295
to
b3c0e4f
Compare
Just FYI: I think the benchmark is panicking now. I see some |
lots of things are currently broken here 😆 I just figured I'd make a draft PR to show where I'm at (and in case it's obvious to anybody else what the cause of the panics is) |
Haha, okay. I was shocked by the performance regression, so I had to take a quick look at why it was that bad. I was relieved to see that it was probably caused by the benchmark crashing. |
Oh the PR also currently adds a |
2a04e2f
to
ef4caf1
Compare
ef4caf1
to
7160338
Compare
|
All gone now 🎉 |
e28d9d9
to
7d5f125
Compare
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.
Looks great!!
Co-authored-by: Carl Meyer <[email protected]>
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.
All of the tests! Looks excellent, merge away
Thanks very much for the help debugging this! |
Summary
This adds type inference for loop variables inside comprehension scopes. The type-inference tests are passing, but it seems to currently trigger a panic in the corpus tests.
Async comprehensions will require different logic, so for now loop variables in these are inferred as
Unknown
still. In order to distinguish between async comprehension definitions and synchronous comprehensions definitions, a newis_async
field is added toComprehensionDefinitionKind
and various other structs for tracking comprehension definitions.Test Plan
cargo test -p red_knot_python_semantic
andcargo test -p red_knot_workspace