quick fix for WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER

(`error_fix_status.yaml` to be updated when pending quick fixes are landed.)

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

Change-Id: I042f6dc2171a37d008c6c2c4d1f843e0bcffc46c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371662
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
pq 2024-06-14 19:03:50 +00:00 committed by Commit Queue
parent ff733cc81a
commit 5d3578a2a9
3 changed files with 15 additions and 5 deletions

View file

@ -45,8 +45,8 @@
#
# Stats:
# - 42 "needsEvaluation"
# - 322 "needsFix"
# - 425 "hasFix"
# - 321 "needsFix"
# - 426 "hasFix"
# - 517 "noFix"
AnalysisOptionsErrorCode.INCLUDED_FILE_PARSE_ERROR:
@ -3276,9 +3276,7 @@ ParserErrorCode.WITH_BEFORE_EXTENDS:
notes: |-
Move the extends clause.
ParserErrorCode.WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER:
status: needsFix
notes: |-
Replace the `:` with an '='.
status: hasFix
ParserErrorCode.WRONG_TERMINATOR_FOR_PARAMETER_GROUP:
status: needsFix
notes: |-

View file

@ -1521,6 +1521,9 @@ final _builtInNonLintProducers = <ErrorCode, List<ProducerGenerator>>{
ParserErrorCode.VAR_RETURN_TYPE: [
RemoveVar.new,
],
ParserErrorCode.WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER: [
ReplaceColonWithEquals.new,
],
StaticWarningCode.DEAD_NULL_AWARE_EXPRESSION: [
RemoveDeadIfNull.new,
],

View file

@ -50,6 +50,15 @@ class A {
class B extends A {
B({super.a = ''});
}
''');
}
Future<void> test_wrongSeparatorForPositionalParameter() async {
await resolveTestCode('''
void f(int a, [int b : 0]) {}
''');
await assertHasFix('''
void f(int a, [int b = 0]) {}
''');
}
}