quick fix for FACTORY_TOP_LEVEL_DECLARATION

Change-Id: I77fad91ead543c7be5d532d0c2f5240ec5146635
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369763
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
pq 2024-06-05 14:32:19 +00:00 committed by Commit Queue
parent 1c692c7b71
commit 1e6bc6697a
3 changed files with 15 additions and 5 deletions

View file

@ -45,8 +45,8 @@
#
# Stats:
# - 42 "needsEvaluation"
# - 345 "needsFix"
# - 406 "hasFix"
# - 344 "needsFix"
# - 407 "hasFix"
# - 516 "noFix"
AnalysisOptionsErrorCode.INCLUDED_FILE_PARSE_ERROR:
@ -2831,9 +2831,7 @@ ParserErrorCode.EXTRANEOUS_MODIFIER_IN_EXTENSION_TYPE:
ParserErrorCode.EXTRANEOUS_MODIFIER_IN_PRIMARY_CONSTRUCTOR:
status: needsEvaluation
ParserErrorCode.FACTORY_TOP_LEVEL_DECLARATION:
status: needsFix
notes: |-
Remove the `factory` keyword.
status: hasFix
ParserErrorCode.FACTORY_WITH_INITIALIZERS:
status: needsFix
notes: |-

View file

@ -1382,6 +1382,9 @@ final _builtInNonLintProducers = <ErrorCode, List<ProducerGenerator>>{
ParserErrorCode.EXTRANEOUS_MODIFIER: [
RemoveExtraModifier.new,
],
ParserErrorCode.FACTORY_TOP_LEVEL_DECLARATION: [
RemoveExtraModifier.new,
],
ParserErrorCode.FINAL_ENUM: [
RemoveExtraModifier.new,
],

View file

@ -319,6 +319,15 @@ static enum E { v }
''');
await assertHasFix('''
enum E { v }
''');
}
Future<void> test_topLevel_factoryDeclaration() async {
await resolveTestCode(r'''
factory class C {}
''');
await assertHasFix('''
class C {}
''');
}
}