Remove some unnecessary ignores in test code

Change-Id: I55e332132b9f3e435d79dd03a7aa7459d796599a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274800
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
Brian Wilkerson 2022-12-10 00:19:30 +00:00 committed by Commit Queue
parent c010e4ffbd
commit bb7e2c9b95
4 changed files with 21 additions and 19 deletions

View file

@ -123,6 +123,7 @@ suggestions
await _check_locations(
declaration: 'enum MyEnum { foo01 }',
codeAtCompletion: 'MyEnu^',
referencesDeclaration: false,
validator: (response, context) {
if (isProtocolVersion2) {
// No enum constants.
@ -356,6 +357,7 @@ suggestions
required String declaration,
String declarationForContextType = '',
required String codeAtCompletion,
bool referencesDeclaration = true,
required void Function(
CompletionResponseForTesting response,
_Context context,
@ -398,7 +400,7 @@ void f() {
$declaration
''');
newFile('$testPackageLibPath/context_type.dart', '''
import 'a.dart'; // ignore: unused_import
import 'a.dart';${referencesDeclaration ? '' : ' // ignore: unused_import'}
$declarationForContextType
''');
if (isProtocolVersion1) {

View file

@ -44,24 +44,26 @@ void f() {
await resolveTestCode('''
// Copyright header.
// ignore_for_file: foo
// ignore_for_file: referenced_before_declaration
// Some other header.
/// some comment
void f() {
a = 2;
var a = 1;
}
''');
await assertHasFix('''
// Copyright header.
// ignore_for_file: foo, unused_local_variable
// ignore_for_file: referenced_before_declaration, unused_local_variable
// Some other header.
/// some comment
void f() {
a = 2;
var a = 1;
}
''');
@ -149,14 +151,14 @@ void f() {
Future<void> test_existingIgnore() async {
await resolveTestCode('''
void f() {
// ignore: foo
var a = 1;
// ignore: undefined_identifier
var a = b;
}
''');
await assertHasFix('''
void f() {
// ignore: foo, unused_local_variable
var a = 1;
// ignore: undefined_identifier, unused_local_variable
var a = b;
}
''');
}

View file

@ -2200,12 +2200,12 @@ AssignmentExpression
extension E on ({int foo, String bar}) {
int get foo => 0;
}
void f(({int foo, String bar}) r) {
r.foo += 0;
}
''', [
error(CompileTimeErrorCode.UNDEFINED_SETTER, 105, 3),
error(CompileTimeErrorCode.UNDEFINED_SETTER, 104, 3),
]);
final node = findNode.assignment('+= 0');
@ -2245,12 +2245,12 @@ AssignmentExpression
extension E on ({int foo, String bar}) {
int get foo => 0;
}
void f(({int foo, String bar}) r) {
r.foo = 0;
}
''', [
error(CompileTimeErrorCode.UNDEFINED_SETTER, 105, 3),
error(CompileTimeErrorCode.UNDEFINED_SETTER, 104, 3),
]);
final node = findNode.assignment('= 0');
@ -2291,12 +2291,12 @@ extension E on ({int foo, String bar}) {
int get foo => 0;
set foo(int _) {}
}
void f(({int foo, String bar}) r) {
r.foo += 0;
}
''', [
error(CompileTimeErrorCode.UNDEFINED_SETTER, 125, 3),
error(CompileTimeErrorCode.UNDEFINED_SETTER, 124, 3),
]);
final node = findNode.assignment('+= 0');
@ -2337,12 +2337,12 @@ extension E on ({int foo, String bar}) {
int get foo => 0;
set foo(int _) {}
}
void f(({int foo, String bar}) r) {
r.foo = 0;
}
''', [
error(CompileTimeErrorCode.UNDEFINED_SETTER, 125, 3),
error(CompileTimeErrorCode.UNDEFINED_SETTER, 124, 3),
]);
final node = findNode.assignment('= 0');
@ -3060,7 +3060,6 @@ AssignmentExpression
test_simpleIdentifier_importPrefix_hasSuperSetter_simple() async {
await assertErrorsInCode('''
// ignore:unused_import
import 'dart:math' as x;
class A {
@ -3073,7 +3072,7 @@ class B extends A {
}
}
''', [
error(CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT, 109, 1),
error(CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT, 85, 1),
]);
var assignment = findNode.assignment('x = 2');

View file

@ -63,7 +63,6 @@ class C {
test_assignment_in_method_hasSuperField() async {
await assertErrorsInCode('''
// ignore:unused_import
import 'dart:math' as p;
class A {
@ -76,7 +75,7 @@ class B extends A {
}
}
''', [
error(CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT, 109, 1),
error(CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT, 85, 1),
]);
}