Migrate const_finder tests to be null safe (flutter/engine#37683)

* Bump language version of package:const_finder_fixtures in preparation of
running with sound null safety be default.

* Fix null safety errors.

* Migrate test files to be null safe.

* Fix analyzer warnings.
This commit is contained in:
Siva
2022-11-16 19:16:47 -08:00
committed by GitHub
parent 66d288c164
commit 8c34a481d0
5 changed files with 10 additions and 10 deletions

View File

@@ -4,12 +4,12 @@
{
"name": "const_finder_fixtures",
"rootUri": "../lib/",
"languageVersion": "2.9"
"languageVersion": "2.12"
},
{
"name": "const_finder_fixtures_package",
"rootUri": "../pkg/",
"languageVersion": "2.9"
"languageVersion": "2.12"
}
]
}

View File

@@ -10,8 +10,8 @@
class Box {
const Box(this.content1, this.content2);
final Object content1;
final Object content2;
final Object? content1;
final Object? content2;
}
const Box box1_0 = Box(null, null);

View File

@@ -40,7 +40,7 @@ void main() {
}
class IgnoreMe {
const IgnoreMe([this.target]);
const IgnoreMe(this.target);
final Target target;
@@ -68,7 +68,7 @@ class StaticConstInitializer {
void useOne(int index) {
targets[index].hit();
targetSet.skip(index).first.hit();
targetMap[index].hit();
targetMap[index]!.hit();
}
}

View File

@@ -31,7 +31,7 @@ void main() {
}
class IgnoreMe {
const IgnoreMe([this.target]);
const IgnoreMe(this.target);
final Target target;

View File

@@ -7,7 +7,7 @@ class Target {
final String stringValue;
final int intValue;
final Target targetValue;
final Target? targetValue;
void hit() {
print('$stringValue $intValue');
@@ -15,7 +15,7 @@ class Target {
}
class ExtendsTarget extends Target {
const ExtendsTarget(String stringValue, int intValue, Target targetValue)
const ExtendsTarget(String stringValue, int intValue, Target? targetValue)
: super(stringValue, intValue, targetValue);
}
@@ -27,7 +27,7 @@ class ImplementsTarget implements Target {
@override
final int intValue;
@override
final Target targetValue;
final Target? targetValue;
@override
void hit() {