quick fix for FINAL_CONSTRUCTOR

Change-Id: I9bd7f97eeec41a9efc608bea3911f3443c4d7063
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/368682
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
This commit is contained in:
pq 2024-05-29 22:36:57 +00:00 committed by Commit Queue
parent a76936859e
commit 13fb73dfec
3 changed files with 19 additions and 5 deletions

View file

@ -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: |-

View file

@ -1375,6 +1375,9 @@ final _builtInNonLintProducers = <ErrorCode, List<ProducerGenerator>>{
ParserErrorCode.EXTRANEOUS_MODIFIER: [
RemoveExtraModifier.new,
],
ParserErrorCode.FINAL_CONSTRUCTOR: [
RemoveExtraModifier.new,
],
ParserErrorCode.GETTER_WITH_PARAMETERS: [
RemoveParametersInGetterDeclaration.new,
],

View file

@ -164,6 +164,19 @@ f() {
''');
}
Future<void> test_final_constructor() async {
await resolveTestCode('''
class C {
final C();
}
''');
await assertHasFix('''
class C {
C();
}
''');
}
Future<void> test_invalidAsyncConstructorModifier() async {
await resolveTestCode(r'''
class A {