Skip to content

Commit

Permalink
Version 3.5.0-180.0.dev
Browse files Browse the repository at this point in the history
Merge 177ad1a into dev
Dart CI committed May 22, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 8e6839f + 177ad1a commit 7809d6e
Showing 6 changed files with 71 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -2393,9 +2393,7 @@ LintCode.unintended_html_in_doc_comment:
notes: |-
The fix is to encode the angle brackets.
LintCode.unnecessary_await_in_return:
status: needsFix
notes: |-
The fix is to remove the `await`.
status: hasFix
LintCode.unnecessary_brace_in_string_interps:
status: hasFix
LintCode.unnecessary_breaks:
@@ -2698,9 +2696,7 @@ ParserErrorCode.DUPLICATE_PREFIX:
notes: |-
Remove the duplicate.
ParserErrorCode.DUPLICATED_MODIFIER:
status: needsFix
notes: |-
Remove the duplicate.
status: hasFix
ParserErrorCode.EMPTY_ENUM_BODY:
status: noFix
notes: |-
Original file line number Diff line number Diff line change
@@ -571,6 +571,9 @@ final _builtInLintProducers = <String, List<ProducerGenerator>>{
AddAwait.unawaited,
WrapInUnawaited.new,
],
LintNames.unnecessary_await_in_return: [
RemoveAwait.new,
],
LintNames.unnecessary_brace_in_string_interps: [
RemoveInterpolationBraces.new,
],
@@ -1332,6 +1335,9 @@ final _builtInNonLintProducers = <ErrorCode, List<ProducerGenerator>>{
ParserErrorCode.DEFAULT_IN_SWITCH_EXPRESSION: [
ReplaceWithWildcard.new,
],
ParserErrorCode.DUPLICATED_MODIFIER: [
RemoveExtraModifier.new,
],
ParserErrorCode.EXPECTED_TOKEN: [
InsertSemicolon.new,
ReplaceWithArrow.new,
2 changes: 2 additions & 0 deletions pkg/analysis_server/lib/src/services/linter/lint_names.dart
Original file line number Diff line number Diff line change
@@ -157,6 +157,8 @@ class LintNames {
static const String type_literal_in_constant_pattern =
'type_literal_in_constant_pattern';
static const String unawaited_futures = 'unawaited_futures';
static const String unnecessary_await_in_return =
'unnecessary_await_in_return';
static const String unnecessary_brace_in_string_interps =
'unnecessary_brace_in_string_interps';
static const String unnecessary_breaks = 'unnecessary_breaks';
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@ void main() {
defineReflectiveSuite(() {
defineReflectiveTests(RemoveAwaitBulkTest);
defineReflectiveTests(RemoveAwaitTest);
defineReflectiveTests(UnnecessaryAwaitInReturnLintTest);
});
}

@@ -77,3 +78,46 @@ bad() async {
''');
}
}

@reflectiveTest
class UnnecessaryAwaitInReturnLintTest extends FixProcessorLintTest {
@override
FixKind get kind => DartFixKind.REMOVE_AWAIT;

@override
String get lintCode => LintNames.unnecessary_await_in_return;

Future<void> test_arrow() async {
await resolveTestCode(r'''
class A {
Future<int> f() async => await future;
}
final future = Future.value(1);
''');
await assertHasFix(r'''
class A {
Future<int> f() async => future;
}
final future = Future.value(1);
''');
}

Future<void> test_expressionBody() async {
await resolveTestCode(r'''
class A {
Future<int> f() async {
return await future;
}
}
final future = Future.value(1);
''');
await assertHasFix(r'''
class A {
Future<int> f() async {
return future;
}
}
final future = Future.value(1);
''');
}
}
Original file line number Diff line number Diff line change
@@ -51,7 +51,22 @@ class RemoveExtraModifierTest extends FixProcessorTest {
@override
FixKind get kind => DartFixKind.REMOVE_EXTRA_MODIFIER;

test_invalidAsyncConstructorModifier() async {
Future<void> test_duplicatedModifier() async {
await resolveTestCode(r'''
f() {
const const c = '';
c;
}
''');
await assertHasFix('''
f() {
const c = '';
c;
}
''');
}

Future<void> test_invalidAsyncConstructorModifier() async {
await resolveTestCode(r'''
class A {
A() async {}
2 changes: 1 addition & 1 deletion tools/VERSION
Original file line number Diff line number Diff line change
@@ -27,5 +27,5 @@ CHANNEL dev
MAJOR 3
MINOR 5
PATCH 0
PRERELEASE 179
PRERELEASE 180
PRERELEASE_PATCH 0

0 comments on commit 7809d6e

Please sign in to comment.