Skip to content

Commit 2ebde46

Browse files
pqCommit Queue
authored and
Commit Queue
committed
quick fix for INVALID_USE_OF_COVARIANT
See: #55917 Change-Id: I9e7ad32fb3aaea28c31b6b29af4b2f1233cb9f78 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370360 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Brian Wilkerson <[email protected]> Auto-Submit: Phil Quitslund <[email protected]>
1 parent adc59f6 commit 2ebde46

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -997,9 +997,7 @@ CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_SET:
997997
CompileTimeErrorCode.INVALID_URI:
998998
status: noFix
999999
CompileTimeErrorCode.INVALID_USE_OF_COVARIANT:
1000-
status: needsFix
1001-
notes: |-
1002-
Remove the keyword.
1000+
status: hasFix
10031001
CompileTimeErrorCode.INVALID_USE_OF_NULL_VALUE:
10041002
status: noFix
10051003
CompileTimeErrorCode.INVOCATION_OF_EXTENSION_WITHOUT_CALL:

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,6 +1034,9 @@ final _builtInNonLintProducers = <ErrorCode, List<ProducerGenerator>>{
10341034
CompileTimeErrorCode.INVALID_MODIFIER_ON_CONSTRUCTOR: [
10351035
RemoveLexeme.modifier,
10361036
],
1037+
CompileTimeErrorCode.INVALID_USE_OF_COVARIANT: [
1038+
RemoveLexeme.keyword,
1039+
],
10371040
CompileTimeErrorCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION: [
10381041
RemoveParenthesesInGetterInvocation.new,
10391042
],

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,19 @@ class A {
332332
''');
333333
}
334334

335+
Future<void> test_invalidUseOfCovariant() async {
336+
await resolveTestCode('''
337+
class C {
338+
void m(void p(covariant int)) {}
339+
}
340+
''');
341+
await assertHasFix('''
342+
class C {
343+
void m(void p(int)) {}
344+
}
345+
''');
346+
}
347+
335348
Future<void> test_it() async {
336349
newFile('$testPackageLibPath/a.dart', '''
337350
import augment 'test.dart';

0 commit comments

Comments
 (0)