Skip to content

Commit 5d3578a

Browse files
pqCommit Queue
authored and
Commit Queue
committed
quick fix for WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER
(`error_fix_status.yaml` to be updated when pending quick fixes are landed.) See: #55917 Change-Id: I042f6dc2171a37d008c6c2c4d1f843e0bcffc46c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371662 Commit-Queue: Phil Quitslund <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
1 parent ff733cc commit 5d3578a

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
#
4646
# Stats:
4747
# - 42 "needsEvaluation"
48-
# - 322 "needsFix"
49-
# - 425 "hasFix"
48+
# - 321 "needsFix"
49+
# - 426 "hasFix"
5050
# - 517 "noFix"
5151

5252
AnalysisOptionsErrorCode.INCLUDED_FILE_PARSE_ERROR:
@@ -3276,9 +3276,7 @@ ParserErrorCode.WITH_BEFORE_EXTENDS:
32763276
notes: |-
32773277
Move the extends clause.
32783278
ParserErrorCode.WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER:
3279-
status: needsFix
3280-
notes: |-
3281-
Replace the `:` with an '='.
3279+
status: hasFix
32823280
ParserErrorCode.WRONG_TERMINATOR_FOR_PARAMETER_GROUP:
32833281
status: needsFix
32843282
notes: |-

pkg/analysis_server/lib/src/services/correction/fix_internal.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1521,6 +1521,9 @@ final _builtInNonLintProducers = <ErrorCode, List<ProducerGenerator>>{
15211521
ParserErrorCode.VAR_RETURN_TYPE: [
15221522
RemoveVar.new,
15231523
],
1524+
ParserErrorCode.WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER: [
1525+
ReplaceColonWithEquals.new,
1526+
],
15241527
StaticWarningCode.DEAD_NULL_AWARE_EXPRESSION: [
15251528
RemoveDeadIfNull.new,
15261529
],

pkg/analysis_server/test/src/services/correction/fix/replace_colon_with_equals_test.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@ class A {
5050
class B extends A {
5151
B({super.a = ''});
5252
}
53+
''');
54+
}
55+
56+
Future<void> test_wrongSeparatorForPositionalParameter() async {
57+
await resolveTestCode('''
58+
void f(int a, [int b : 0]) {}
59+
''');
60+
await assertHasFix('''
61+
void f(int a, [int b = 0]) {}
5362
''');
5463
}
5564
}

0 commit comments

Comments
 (0)