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
autocomplete not inferring loop variable in for..in loop #13710
Comments
Apologies that this bug is meta. I'm using "package:analyzer_experimental". So the analyzer is analyzing itself... :) |
additional info, chasing now the type hierarchy shows that NodeList does (eventually) implement Iterable<VariableDeclaration>: class NodeList<E extends ASTNode> extends ListWrapper<E> { ... } might be be something with generics? |
hmmm, here's another strange case: for (int i = 0; i < fields.variables.length; i++) { field is inferred (black color) and has completions. field.name.name also works (hover shows "String get name"). But "name" is purple and doesn't complete. |
Added this to the M8 milestone. |
Removed Type-Defect label. |
Removed this from the Later milestone. |
Removed Oldschool-Milestone-Later label. |
assumed stale |
Code is like this:
void _transformFields(..., FieldDeclaration member, ...) {
final fields = member.fields; // correctly inferred as VariableDeclarationList
// tooltip shows fields.variables is a NodeList<VariableDeclaration>
for (var field in fields.variables) {
field. // only shows generic Object completions.
However, if I change my code to:
for (VariableDeclaration field in fields.variables) {
now "field." gives completions
The text was updated successfully, but these errors were encountered: