-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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] Infer precise types for len()
calls
#14599
Conversation
|
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.
Thank you!! A few comments.
crates/red_knot_python_semantic/resources/mdtest/expression/len.md
Outdated
Show resolved
Hide resolved
crates/red_knot_python_semantic/resources/mdtest/expression/len.md
Outdated
Show resolved
Hide resolved
5420238
to
27db683
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.
Thanks!
crates/red_knot_python_semantic/resources/mdtest/expression/len.md
Outdated
Show resolved
Hide resolved
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.
This looks quite close! Thanks for your patience with all the review comments.
I think it makes sense to leave the diagnostics as TODO here, because it will be a lot easier to emit these diagnostics once #14760 lands (we won't have to return some indicator such that inference emits the diagnostic, we'll be able to just emit it directly where we find the issue.)
crates/red_knot_python_semantic/resources/mdtest/expression/len.md
Outdated
Show resolved
Hide resolved
crates/red_knot_python_semantic/resources/mdtest/expression/len.md
Outdated
Show resolved
Hide resolved
crates/red_knot_python_semantic/resources/mdtest/expression/len.md
Outdated
Show resolved
Hide resolved
crates/red_knot_python_semantic/resources/mdtest/expression/len.md
Outdated
Show resolved
Hide resolved
crates/red_knot_python_semantic/resources/mdtest/expression/len.md
Outdated
Show resolved
Hide resolved
@MichaReiser Ok, let's discuss those details elsewhere. The only part that's relevant here is to say that I think accumulators will be super useful in type checking and make a lot of things much simpler and easier, so I think we really want/need it, even if it requires more work on handling suppressions. |
Looks like all comments in this review were addressed.
Thanks! And great find on the string-literal-unpacking issue. Merging. |
Summary
Resolves #14598.
Test Plan
Markdown tests.