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 9f5a02a0ee4..57f6c93638d 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" -# - 355 "needsFix" -# - 396 "hasFix" +# - 354 "needsFix" +# - 397 "hasFix" # - 516 "noFix" AnalysisOptionsErrorCode.INCLUDED_FILE_PARSE_ERROR: @@ -2861,9 +2861,7 @@ ParserErrorCode.FINAL_AND_VAR: notes: |- Remove either `final` or `var`. ParserErrorCode.FINAL_CONSTRUCTOR: - status: needsFix - notes: |- - Remove the `final` keyword. + status: hasFix ParserErrorCode.FINAL_ENUM: 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 7e9dd8b8140..9f0581dcec8 100644 --- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart +++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart @@ -1375,6 +1375,9 @@ final _builtInNonLintProducers = >{ ParserErrorCode.EXTRANEOUS_MODIFIER: [ RemoveExtraModifier.new, ], + ParserErrorCode.FINAL_CONSTRUCTOR: [ + RemoveExtraModifier.new, + ], ParserErrorCode.GETTER_WITH_PARAMETERS: [ RemoveParametersInGetterDeclaration.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 82c02e4e21b..987a9e7d744 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 @@ -164,6 +164,19 @@ f() { '''); } + Future test_final_constructor() async { + await resolveTestCode(''' +class C { + final C(); +} +'''); + await assertHasFix(''' +class C { + C(); +} +'''); + } + Future test_invalidAsyncConstructorModifier() async { await resolveTestCode(r''' class A {