Skip to content
This repository was archived by the owner on Nov 20, 2024. It is now read-only.

fix issue 1518 #1531

Merged
merged 1 commit into from
Apr 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/src/rules/unnecessary_await_in_return.dart
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class _Visitor extends SimpleAstVisitor<void> {
}
if (returnType != null &&
returnType.isDartAsyncFuture &&
type.isAssignableTo(returnType)) {
type.isSubtypeOf(returnType)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me but I'll defer to @bwilkerson for the final call since he may be aware of other implications.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems reasonable to me, and the tests appear to show that it's the right test, but I haven't spent any time to try to prove to myself that it's correct. I say, go for it.

rule.reportLintForToken((expression as AwaitExpression).awaitKeyword);
}
}
Expand Down
7 changes: 7 additions & 0 deletions test/rules/unnecessary_await_in_return.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,10 @@ class A {
}
}
}

// https://github.com/dart-lang/linter/issues/1518
class B {
Future<num> foo() async => 1;
Future<int> bar() async => await foo(); // OK
Future<num> buzz() async => await bar(); // LINT
}