quick fix for `DUPLICATED_MODIFIER`
Change-Id: Ibcfbee84b8bcd67cab81741f65e701012f6a4ce9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/367362
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
diff --git a/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml b/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml
index 29483e5..9c5ceec 100644
--- a/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml
+++ b/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml
@@ -2696,9 +2696,7 @@
notes: |-
Remove the duplicate.
ParserErrorCode.DUPLICATED_MODIFIER:
- status: needsFix
- notes: |-
- Remove the duplicate.
+ status: hasFix
ParserErrorCode.EMPTY_ENUM_BODY:
status: noFix
notes: |-
diff --git a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
index a7c863e..9971b78 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -1335,6 +1335,9 @@
ParserErrorCode.DEFAULT_IN_SWITCH_EXPRESSION: [
ReplaceWithWildcard.new,
],
+ ParserErrorCode.DUPLICATED_MODIFIER: [
+ RemoveExtraModifier.new,
+ ],
ParserErrorCode.EXPECTED_TOKEN: [
InsertSemicolon.new,
ReplaceWithArrow.new,
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_extra_modifier_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_extra_modifier_test.dart
index 5d753db..fe2f010 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_extra_modifier_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_extra_modifier_test.dart
@@ -51,7 +51,22 @@
@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 {}