File tree 2 files changed +23
-0
lines changed
lib/src/services/correction
test/src/services/correction/fix/bulk
2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -96,6 +96,7 @@ class BulkFixProcessor {
96
96
LintNames .prefer_equal_for_default_values:
97
97
ReplaceColonWithEquals .newInstance,
98
98
LintNames .prefer_final_fields: MakeFinal .newInstance,
99
+ LintNames .prefer_final_locals: MakeFinal .newInstance,
99
100
LintNames .prefer_for_elements_to_map_fromIterable:
100
101
ConvertMapFromIterableToForLiteral .newInstance,
101
102
LintNames .prefer_generic_function_type_aliases:
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import 'bulk_fix_processor.dart';
10
10
void main () {
11
11
defineReflectiveSuite (() {
12
12
defineReflectiveTests (PreferFinalFieldsTest );
13
+ defineReflectiveTests (PreferFinalLocalsTest );
13
14
});
14
15
}
15
16
@@ -37,3 +38,24 @@ class C {
37
38
''' );
38
39
}
39
40
}
41
+
42
+ @reflectiveTest
43
+ class PreferFinalLocalsTest extends BulkFixProcessorTest {
44
+ @override
45
+ String get lintCode => LintNames .prefer_final_locals;
46
+
47
+ Future <void > test_singleFile () async {
48
+ await resolveTestUnit ('''
49
+ f() {
50
+ var x = 0;
51
+ var y = x;
52
+ }
53
+ ''' );
54
+ await assertHasFix ('''
55
+ f() {
56
+ final x = 0;
57
+ final y = x;
58
+ }
59
+ ''' );
60
+ }
61
+ }
You can’t perform that action at this time.
0 commit comments