bulk fix for avoid_types_on_closure_parameters

Change-Id: Id080559bc2a18fd8ce4c8eb59412c4461d8dac39
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156340
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
This commit is contained in:
pq 2020-07-29 19:45:25 +00:00 committed by commit-bot@chromium.org
parent b4a7c68989
commit e12a536edb
2 changed files with 20 additions and 0 deletions

View file

@ -41,6 +41,8 @@ class BulkFixProcessor {
LintNames.avoid_return_types_on_setters: RemoveTypeAnnotation.newInstance,
LintNames.avoid_single_cascade_in_expression_statements:
ReplaceCascadeWithDot.newInstance,
LintNames.avoid_types_on_closure_parameters:
RemoveTypeAnnotation.newInstance,
LintNames.prefer_contains: ConvertToContains.newInstance,
LintNames.prefer_equal_for_default_values:
ReplaceColonWithEquals.newInstance,

View file

@ -11,6 +11,7 @@ void main() {
defineReflectiveSuite(() {
defineReflectiveTests(RemoveDynamicTypeAnnotationTest);
defineReflectiveTests(RemoveSetterReturnTypeAnnotationTest);
defineReflectiveTests(RemoveTypeAnnotationOnClosureParamsTest);
});
}
@ -57,3 +58,20 @@ set s2(int s2) {}
''');
}
}
@reflectiveTest
class RemoveTypeAnnotationOnClosureParamsTest extends BulkFixProcessorTest {
@override
String get lintCode => LintNames.avoid_types_on_closure_parameters;
Future<void> test_singleFile() async {
await resolveTestUnit('''
var x = ({Future<int> defaultValue}) => null;
var y = (Future<int> defaultValue) => null;
''');
await assertHasFix('''
var x = ({defaultValue}) => null;
var y = (defaultValue) => null;
''');
}
}