Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit d422023

Browse files
authored
Migrate const_finder tests to be null safe (#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.
1 parent cb403c1 commit d422023

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

tools/const_finder/test/fixtures/.dart_tool/package_config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
{
55
"name": "const_finder_fixtures",
66
"rootUri": "../lib/",
7-
"languageVersion": "2.9"
7+
"languageVersion": "2.12"
88
},
99
{
1010
"name": "const_finder_fixtures_package",
1111
"rootUri": "../pkg/",
12-
"languageVersion": "2.9"
12+
"languageVersion": "2.12"
1313
}
1414
]
1515
}

tools/const_finder/test/fixtures/lib/box.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
class Box {
1212
const Box(this.content1, this.content2);
13-
final Object content1;
14-
final Object content2;
13+
final Object? content1;
14+
final Object? content2;
1515
}
1616

1717
const Box box1_0 = Box(null, null);

tools/const_finder/test/fixtures/lib/consts.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ void main() {
4040
}
4141

4242
class IgnoreMe {
43-
const IgnoreMe([this.target]);
43+
const IgnoreMe(this.target);
4444

4545
final Target target;
4646

@@ -68,7 +68,7 @@ class StaticConstInitializer {
6868
void useOne(int index) {
6969
targets[index].hit();
7070
targetSet.skip(index).first.hit();
71-
targetMap[index].hit();
71+
targetMap[index]!.hit();
7272
}
7373
}
7474

tools/const_finder/test/fixtures/lib/consts_and_non.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ void main() {
3131
}
3232

3333
class IgnoreMe {
34-
const IgnoreMe([this.target]);
34+
const IgnoreMe(this.target);
3535

3636
final Target target;
3737

tools/const_finder/test/fixtures/lib/target.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ class Target {
77

88
final String stringValue;
99
final int intValue;
10-
final Target targetValue;
10+
final Target? targetValue;
1111

1212
void hit() {
1313
print('$stringValue $intValue');
1414
}
1515
}
1616

1717
class ExtendsTarget extends Target {
18-
const ExtendsTarget(String stringValue, int intValue, Target targetValue)
18+
const ExtendsTarget(String stringValue, int intValue, Target? targetValue)
1919
: super(stringValue, intValue, targetValue);
2020
}
2121

@@ -27,7 +27,7 @@ class ImplementsTarget implements Target {
2727
@override
2828
final int intValue;
2929
@override
30-
final Target targetValue;
30+
final Target? targetValue;
3131

3232
@override
3333
void hit() {

0 commit comments

Comments
 (0)