-
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] Emit a diagnostic if the value of a starred expression or a yield from
expression is not iterable
#13240
Conversation
…e type is not iterable
…m` expression is not iterable
CodSpeed Performance ReportMerging #13240 will not alter performanceComparing Summary
|
|
I don't much like the callback or the new iteration-specific returned enum. What I would prefer is a more general inference-context object that gets passed into all inference methods on |
Summary
This PR builds on #13195. It ensures that we emit the
not-iterable
diagnostic on expressions such as the following:The
Type::iterate()
method is refactored slightly so that it's easier for callers of the method to all emit the same diagnostic: it now accepts adiagnostic_fn
callback that emits a diagnostic if the type is not found to be an iterable type.I deliberately haven't tackled comprehensions in this PR, for two reasons:
Test Plan
cargo test