Skip to content

Commit

Permalink
Merge pull request #1017 from scheglov/fix-prefer_iterable_whereType-…
Browse files Browse the repository at this point in the history
…realTarget

Fix 'prefer_iterable_whereType' to use 'realTarget'.
  • Loading branch information
scheglov authored Jun 7, 2018
2 parents 6a846b6 + c387384 commit ab7de1c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/src/rules/prefer_iterable_whereType.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class _Visitor extends SimpleAstVisitor<void> {
void visitMethodInvocation(MethodInvocation node) {
if (node.methodName.name != 'where') return;
if (!DartTypeUtilities.implementsInterface(
node.target.bestType, 'Iterable', 'dart.core')) {
node.realTarget.bestType, 'Iterable', 'dart.core')) {
return;
}

Expand Down
1 change: 1 addition & 0 deletions test/rules/prefer_iterable_whereType.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ main() {
return e is String;
});
l.whereType<String>(); // OK
[]..add(0)..where((e) => true); // OK
}

bool p(e) => e is String;
Expand Down

0 comments on commit ab7de1c

Please sign in to comment.