quick fix for `CONST_METHOD`
See: https://github.com/dart-lang/sdk/issues/55917
Change-Id: I2eab04ad9d2947c387b382809808165e1501c7b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369741
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@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 ffe813f..31e6ffa 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
@@ -45,8 +45,8 @@
#
# Stats:
# - 42 "needsEvaluation"
-# - 346 "needsFix"
-# - 405 "hasFix"
+# - 345 "needsFix"
+# - 406 "hasFix"
# - 516 "noFix"
AnalysisOptionsErrorCode.INCLUDED_FILE_PARSE_ERROR:
@@ -2590,9 +2590,7 @@
ParserErrorCode.CONST_FACTORY:
status: hasFix
ParserErrorCode.CONST_METHOD:
- status: needsFix
- notes: |-
- Remove the `const` keyword.
+ status: hasFix
ParserErrorCode.CONSTRUCTOR_WITH_RETURN_TYPE:
status: needsFix
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 67975fa..632db5a 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -1360,6 +1360,9 @@
ParserErrorCode.CONST_FACTORY: [
RemoveConst.new,
],
+ ParserErrorCode.CONST_METHOD: [
+ RemoveConst.new,
+ ],
ParserErrorCode.DEFAULT_IN_SWITCH_EXPRESSION: [
ReplaceWithWildcard.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 f412204..b3127b5 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
@@ -140,6 +140,15 @@
''');
}
+ Future<void> test_constMethod() async {
+ await resolveTestCode('''
+const void m() {}
+''');
+ await assertHasFix('''
+void m() {}
+''');
+ }
+
Future<void> test_covariantTopLevelDeclaration_class() async {
await resolveTestCode(r'''
covariant class C {}