From 13fb73dfece5ee9741fb10ab2fbdf25481f1be9e Mon Sep 17 00:00:00 2001 From: pq Date: Wed, 29 May 2024 22:36:57 +0000 Subject: [PATCH] quick fix for `FINAL_CONSTRUCTOR` Change-Id: I9bd7f97eeec41a9efc608bea3911f3443c4d7063 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/368682 Auto-Submit: Phil Quitslund Reviewed-by: Brian Wilkerson Commit-Queue: Brian Wilkerson Commit-Queue: Phil Quitslund --- .../src/services/correction/error_fix_status.yaml | 8 +++----- .../lib/src/services/correction/fix_internal.dart | 3 +++ .../correction/fix/remove_extra_modifier_test.dart | 13 +++++++++++++ 3 files changed, 19 insertions(+), 5 deletions(-) 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 {