quick fix for LITERAL_WITH_NEW

See: https://github.com/dart-lang/sdk/issues/55917

Change-Id: I43629f21645ed330b6a4732ae7f3e9ea616b3a97
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370840
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
This commit is contained in:
pq 2024-06-12 07:48:59 +00:00 committed by Commit Queue
parent d0998d6996
commit f1cf8c22d1
3 changed files with 15 additions and 5 deletions

View file

@ -45,8 +45,8 @@
#
# Stats:
# - 42 "needsEvaluation"
# - 329 "needsFix"
# - 419 "hasFix"
# - 328 "needsFix"
# - 420 "hasFix"
# - 516 "noFix"
AnalysisOptionsErrorCode.INCLUDED_FILE_PARSE_ERROR:
@ -2982,9 +2982,7 @@ ParserErrorCode.LITERAL_WITH_CLASS:
notes: |-
Remove the `List.`.
ParserErrorCode.LITERAL_WITH_NEW:
status: needsFix
notes: |-
Remove the `new`.
status: hasFix
ParserErrorCode.LOCAL_FUNCTION_DECLARATION_MODIFIER:
status: noFix
ParserErrorCode.MEMBER_WITH_CLASS_NAME:

View file

@ -1453,6 +1453,9 @@ final _builtInNonLintProducers = <ErrorCode, List<ProducerGenerator>>{
ParserErrorCode.LATE_PATTERN_VARIABLE_DECLARATION: [
RemoveLate.new,
],
ParserErrorCode.LITERAL_WITH_NEW: [
RemoveLexeme.keyword,
],
ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE: [
AddTypeAnnotation.new,
],

View file

@ -377,6 +377,15 @@ augment class A {}
''');
}
Future<void> test_literalWithNew() async {
await resolveTestCode('''
var f = new <int,int>{};
''');
await assertHasFix('''
var f = <int,int>{};
''');
}
Future<void> test_localFunctionDeclarationModifier_abstract() async {
await resolveTestCode(r'''
class C {