Add fix-all in file fixes for the 2 additional dart analysis server fix types: USE_NOT_EQ_NULL and USE_EQ_EQ_NULL

Change-Id: Ic8da1d1737145dbd3ddbf5939c327f882a74be24
Reviewed-on: https://dart-review.googlesource.com/57680
Reviewed-by: Jaime Wren <jwren@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jaime Wren <jwren@google.com>
This commit is contained in:
Jaime Wren 2018-05-31 17:19:22 +00:00 committed by commit-bot@chromium.org
parent eb82559db2
commit 7e899d04ab
2 changed files with 40 additions and 4 deletions

View file

@ -250,12 +250,16 @@ class DartFixKind {
'USE_EFFECTIVE_INTEGER_DIVISION',
50,
"Use effective integer division ~/");
static const USE_EQ_EQ_NULL =
const FixKind('USE_EQ_EQ_NULL', 50, "Use == null instead of 'is Null'");
static const USE_EQ_EQ_NULL = const FixKind(
'USE_EQ_EQ_NULL', 50, "Use == null instead of 'is Null'",
appliedTogetherMessage:
"Use == null instead of 'is Null' everywhere in file");
static const USE_IS_NOT_EMPTY = const FixKind(
'USE_NOT_EMPTY', 50, "Use x.isNotEmpty instead of '!x.isEmpty'");
static const USE_NOT_EQ_NULL =
const FixKind('USE_NOT_EQ_NULL', 50, "Use != null instead of 'is! Null'");
static const USE_NOT_EQ_NULL = const FixKind(
'USE_NOT_EQ_NULL', 50, "Use != null instead of 'is! Null'",
appliedTogetherMessage:
"Use != null instead of 'is! Null' everywhere in file");
}
/**

View file

@ -5136,6 +5136,22 @@ main(p) {
''');
}
test_isNotNull_all() async {
await resolveTestUnit('''
main(p, q) {
p is! Null;
q is! Null;
}
''');
await assertHasFixAllFix(
HintCode.TYPE_CHECK_IS_NOT_NULL, DartFixKind.USE_NOT_EQ_NULL, '''
main(p, q) {
p != null;
q != null;
}
''');
}
test_isNull() async {
await resolveTestUnit('''
main(p) {
@ -5149,6 +5165,22 @@ main(p) {
''');
}
test_isNull_all() async {
await resolveTestUnit('''
main(p, q) {
p is Null;
q is Null;
}
''');
await assertHasFixAllFix(
HintCode.TYPE_CHECK_IS_NULL, DartFixKind.USE_EQ_EQ_NULL, '''
main(p, q) {
p == null;
q == null;
}
''');
}
test_makeEnclosingClassAbstract_declaresAbstractMethod() async {
await resolveTestUnit('''
class A {