Skip to content

Commit 741e1e2

Browse files
pqCommit Queue
authored and
Commit Queue
committed
quick fix for INVALID_USE_OF_COVARIANT_IN_EXTENSION
See: #55917 Change-Id: I1fac6f8f1bcdb0e2ede3f7766c24ada1ee037f45 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370060 Auto-Submit: Phil Quitslund <[email protected]> Commit-Queue: Phil Quitslund <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Brian Wilkerson <[email protected]>
1 parent 31a9236 commit 741e1e2

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-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-
# - 340 "needsFix"
49-
# - 411 "hasFix"
48+
# - 339 "needsFix"
49+
# - 412 "hasFix"
5050
# - 516 "noFix"
5151

5252
AnalysisOptionsErrorCode.INCLUDED_FILE_PARSE_ERROR:
@@ -2974,9 +2974,7 @@ ParserErrorCode.INVALID_UNICODE_ESCAPE_U_NO_BRACKET:
29742974
ParserErrorCode.INVALID_UNICODE_ESCAPE_U_STARTED:
29752975
status: noFix
29762976
ParserErrorCode.INVALID_USE_OF_COVARIANT_IN_EXTENSION:
2977-
status: needsFix
2978-
notes: |-
2979-
Remove the `covariant`.
2977+
status: hasFix
29802978
ParserErrorCode.LATE_PATTERN_VARIABLE_DECLARATION:
29812979
status: hasFix
29822980
ParserErrorCode.LIBRARY_DIRECTIVE_NOT_FIRST:

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1433,6 +1433,9 @@ final _builtInNonLintProducers = <ErrorCode, List<ProducerGenerator>>{
14331433
ParserErrorCode.INVALID_INSIDE_UNARY_PATTERN: [
14341434
SurroundWithParentheses.new,
14351435
],
1436+
ParserErrorCode.INVALID_USE_OF_COVARIANT_IN_EXTENSION: [
1437+
RemoveExtraModifier.new,
1438+
],
14361439
ParserErrorCode.LATE_PATTERN_VARIABLE_DECLARATION: [
14371440
RemoveLate.new,
14381441
],

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,19 @@ void m() {}
149149
''');
150150
}
151151

152+
Future<void> test_covariantInExtension() async {
153+
await resolveTestCode(r'''
154+
extension E on String {
155+
void f({covariant int a = 0}) {}
156+
}
157+
''');
158+
await assertHasFix('''
159+
extension E on String {
160+
void f({int a = 0}) {}
161+
}
162+
''');
163+
}
164+
152165
Future<void> test_covariantMember() async {
153166
await resolveTestCode(r'''
154167
class C {

0 commit comments

Comments
 (0)