quick fix for STATIC_OPERATOR

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

Change-Id: I41dd40a11e98340dc90f3673c8c6b37e3bf3d7f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370161
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
pq 2024-06-08 19:57:46 +00:00 committed by Commit Queue
parent dd89732126
commit 6424397cbf
3 changed files with 27 additions and 13 deletions

View file

@ -45,8 +45,8 @@
# #
# Stats: # Stats:
# - 42 "needsEvaluation" # - 42 "needsEvaluation"
# - 336 "needsFix" # - 335 "needsFix"
# - 415 "hasFix" # - 416 "hasFix"
# - 516 "noFix" # - 516 "noFix"
AnalysisOptionsErrorCode.INCLUDED_FILE_PARSE_ERROR: AnalysisOptionsErrorCode.INCLUDED_FILE_PARSE_ERROR:
@ -905,35 +905,35 @@ CompileTimeErrorCode.INVALID_ASSIGNMENT:
CompileTimeErrorCode.INVALID_CAST_FUNCTION: CompileTimeErrorCode.INVALID_CAST_FUNCTION:
status: noFix status: noFix
notes: |- notes: |-
Removed i Dart 3.0 Removed in Dart 3.0
CompileTimeErrorCode.INVALID_CAST_FUNCTION_EXPR: CompileTimeErrorCode.INVALID_CAST_FUNCTION_EXPR:
status: noFix status: noFix
notes: |- notes: |-
Removed i Dart 3.0 Removed in Dart 3.0
CompileTimeErrorCode.INVALID_CAST_LITERAL: CompileTimeErrorCode.INVALID_CAST_LITERAL:
status: noFix status: noFix
notes: |- notes: |-
Removed i Dart 3.0 Removed in Dart 3.0
CompileTimeErrorCode.INVALID_CAST_LITERAL_LIST: CompileTimeErrorCode.INVALID_CAST_LITERAL_LIST:
status: noFix status: noFix
notes: |- notes: |-
Removed i Dart 3.0 Removed in Dart 3.0
CompileTimeErrorCode.INVALID_CAST_LITERAL_MAP: CompileTimeErrorCode.INVALID_CAST_LITERAL_MAP:
status: noFix status: noFix
notes: |- notes: |-
Removed i Dart 3.0 Removed in Dart 3.0
CompileTimeErrorCode.INVALID_CAST_LITERAL_SET: CompileTimeErrorCode.INVALID_CAST_LITERAL_SET:
status: noFix status: noFix
notes: |- notes: |-
Removed i Dart 3.0 Removed in Dart 3.0
CompileTimeErrorCode.INVALID_CAST_METHOD: CompileTimeErrorCode.INVALID_CAST_METHOD:
status: noFix status: noFix
notes: |- notes: |-
Removed i Dart 3.0 Removed in Dart 3.0
CompileTimeErrorCode.INVALID_CAST_NEW_EXPR: CompileTimeErrorCode.INVALID_CAST_NEW_EXPR:
status: noFix status: noFix
notes: |- notes: |-
Removed i Dart 3.0 Removed in Dart 3.0
CompileTimeErrorCode.INVALID_CONSTANT: CompileTimeErrorCode.INVALID_CONSTANT:
status: noFix status: noFix
notes: |- notes: |-
@ -3223,9 +3223,7 @@ ParserErrorCode.STATIC_GETTER_WITHOUT_BODY:
notes: |- notes: |-
Add an empty body. Add an empty body.
ParserErrorCode.STATIC_OPERATOR: ParserErrorCode.STATIC_OPERATOR:
status: needsFix status: hasFix
notes: |-
Remove the `static` keyword.
ParserErrorCode.STATIC_SETTER_WITHOUT_BODY: ParserErrorCode.STATIC_SETTER_WITHOUT_BODY:
status: needsFix status: needsFix
notes: |- notes: |-

View file

@ -1472,6 +1472,9 @@ final _builtInNonLintProducers = <ErrorCode, List<ProducerGenerator>>{
ParserErrorCode.STATIC_CONSTRUCTOR: [ ParserErrorCode.STATIC_CONSTRUCTOR: [
RemoveLexeme.keyword, RemoveLexeme.keyword,
], ],
ParserErrorCode.STATIC_OPERATOR: [
RemoveLexeme.keyword,
],
ParserErrorCode.VAR_AND_TYPE: [ ParserErrorCode.VAR_AND_TYPE: [
RemoveTypeAnnotation.fixVarAndType, RemoveTypeAnnotation.fixVarAndType,
RemoveVar.new, RemoveVar.new,

View file

@ -405,6 +405,19 @@ class C {
'''); ''');
} }
Future<void> test_staticOperator() async {
await resolveTestCode('''
class C {
static operator +(int x) => 1;
}
''');
await assertHasFix('''
class C {
operator +(int x) => 1;
}
''');
}
Future<void> test_staticTopLevelDeclaration_enum() async { Future<void> test_staticTopLevelDeclaration_enum() async {
await resolveTestCode(r''' await resolveTestCode(r'''
static enum E { v } static enum E { v }