Skip to content

Commit 4bf22f4

Browse files
johnniwintherCommit Queue
authored andcommitted
[cfe] Use sound null safety for outline and modular suites
Change-Id: Ideee9917b2e5b819672c7e441d051f9bc57c86c6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366342 Reviewed-by: Jens Johansen <[email protected]> Commit-Queue: Johnni Winther <[email protected]>
1 parent 732d952 commit 4bf22f4

File tree

6,522 files changed

+81328
-82973
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

6,522 files changed

+81328
-82973
lines changed

pkg/front_end/test/fasta/modular_suite.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import 'testing/suite.dart';
1111
Future<FastaContext> createContext(
1212
Chain suite, Map<String, String> environment) {
1313
environment[EnvironmentKeys.compilationMode] = CompileMode.modular.name;
14+
environment[EnvironmentKeys.soundNullSafety] = "true";
1415
return FastaContext.create(suite, environment);
1516
}
1617

pkg/front_end/test/fasta/outline_suite.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
library fasta.test.outline_suite;
66

77
import 'suite_utils.dart' show internalMain;
8+
import 'testing/environment_keys.dart';
89
import 'testing/suite.dart';
910

1011
Future<FastaContext> createContext(
1112
Chain suite, Map<String, String> environment) {
13+
environment[EnvironmentKeys.soundNullSafety] = "true";
1214
return FastaContext.create(suite, environment);
1315
}
1416

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
library;
2+
//
3+
// Problems in library:
4+
//
5+
// pkg/front_end/testcases/agnostic/as.dart:5:20: Error: Constant evaluation error:
6+
// const a = <Null>[] as List<int>;
7+
// ^
8+
// pkg/front_end/testcases/agnostic/as.dart:5:20: Context: Constant value is not strong/weak mode agnostic.
9+
// const a = <Null>[] as List<int>;
10+
// ^
11+
// pkg/front_end/testcases/agnostic/as.dart:5:7: Context: While analyzing:
12+
// const a = <Null>[] as List<int>;
13+
// ^
14+
//
15+
// pkg/front_end/testcases/agnostic/as.dart:6:20: Error: Constant evaluation error:
16+
// const b = <int?>[] as List<int>;
17+
// ^
18+
// pkg/front_end/testcases/agnostic/as.dart:6:20: Context: Constant value is not strong/weak mode agnostic.
19+
// const b = <int?>[] as List<int>;
20+
// ^
21+
// pkg/front_end/testcases/agnostic/as.dart:6:7: Context: While analyzing:
22+
// const b = <int?>[] as List<int>;
23+
// ^
24+
//
25+
import self as self;
26+
import "dart:core" as core;
27+
28+
static const field core::List<core::int> a = invalid-expression "Constant value is not strong/weak mode agnostic.";
29+
static const field core::List<core::int> b = invalid-expression "Constant value is not strong/weak mode agnostic.";
30+
static method main() → void {}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
library;
2+
import self as self;
3+
import "dart:core" as core;
4+
5+
static const field core::List<core::int> a = const <Null>[] as core::List<core::int>;
6+
static const field core::List<core::int> b = const <core::int?>[] as core::List<core::int>;
7+
static method main() → void
8+
;
9+
10+
11+
Extra constant evaluation status:
12+
Evaluated: ListLiteral @ org-dartlang-testcase:///as.dart:5:17 -> ListConstant(const <Null>[])
13+
Evaluated: ListLiteral @ org-dartlang-testcase:///as.dart:6:17 -> ListConstant(const <int?>[])
14+
Extra constant evaluation: evaluated: 4, effectively constant: 2

pkg/front_end/testcases/agnostic/as.dart.weak.modular.expect

Lines changed: 0 additions & 12 deletions
This file was deleted.

pkg/front_end/testcases/agnostic/as.dart.weak.outline.expect

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
library;
2+
import self as self;
3+
import "dart:core" as core;
4+
5+
static const field core::List<core::int> a = #C1;
6+
static const field core::List<core::int?> b = #C2;
7+
static const field core::bool c = #C3;
8+
static method main() → dynamic {}
9+
10+
constants {
11+
#C1 = <core::int>[]
12+
#C2 = <core::int?>[]
13+
#C3 = false
14+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
library;
2+
import self as self;
3+
import "dart:core" as core;
4+
5+
static const field core::List<core::int> a = const <core::int>[];
6+
static const field core::List<core::int?> b = const <core::int?>[];
7+
static const field core::bool c = core::identical(self::a, self::b);
8+
static method main() → dynamic
9+
;
10+
11+
12+
Extra constant evaluation status:
13+
Evaluated: ListLiteral @ org-dartlang-testcase:///identical.dart:5:16 -> ListConstant(const <int>[])
14+
Evaluated: ListLiteral @ org-dartlang-testcase:///identical.dart:6:17 -> ListConstant(const <int?>[])
15+
Evaluated: StaticInvocation @ org-dartlang-testcase:///identical.dart:7:11 -> BoolConstant(false)
16+
Extra constant evaluation: evaluated: 3, effectively constant: 3

pkg/front_end/testcases/agnostic/identical.dart.weak.modular.expect

Lines changed: 0 additions & 14 deletions
This file was deleted.

pkg/front_end/testcases/agnostic/identical.dart.weak.outline.expect

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
library;
2+
//
3+
// Problems in library:
4+
//
5+
// pkg/front_end/testcases/agnostic/is.dart:5:20: Error: Constant evaluation error:
6+
// const a = <Null>[] is List<int>;
7+
// ^
8+
// pkg/front_end/testcases/agnostic/is.dart:5:20: Context: Constant value is not strong/weak mode agnostic.
9+
// const a = <Null>[] is List<int>;
10+
// ^
11+
// pkg/front_end/testcases/agnostic/is.dart:5:7: Context: While analyzing:
12+
// const a = <Null>[] is List<int>;
13+
// ^
14+
//
15+
// pkg/front_end/testcases/agnostic/is.dart:6:20: Error: Constant evaluation error:
16+
// const b = <int?>[] is List<int>;
17+
// ^
18+
// pkg/front_end/testcases/agnostic/is.dart:6:20: Context: Constant value is not strong/weak mode agnostic.
19+
// const b = <int?>[] is List<int>;
20+
// ^
21+
// pkg/front_end/testcases/agnostic/is.dart:6:7: Context: While analyzing:
22+
// const b = <int?>[] is List<int>;
23+
// ^
24+
//
25+
import self as self;
26+
import "dart:core" as core;
27+
28+
static const field core::bool a = invalid-expression "Constant value is not strong/weak mode agnostic.";
29+
static const field core::bool b = invalid-expression "Constant value is not strong/weak mode agnostic.";
30+
static method main() → void {}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
library;
2+
import self as self;
3+
import "dart:core" as core;
4+
5+
static const field core::bool a = const <Null>[] is core::List<core::int>;
6+
static const field core::bool b = const <core::int?>[] is core::List<core::int>;
7+
static method main() → void
8+
;
9+
10+
11+
Extra constant evaluation status:
12+
Evaluated: ListLiteral @ org-dartlang-testcase:///is.dart:5:17 -> ListConstant(const <Null>[])
13+
Evaluated: ListLiteral @ org-dartlang-testcase:///is.dart:6:17 -> ListConstant(const <int?>[])
14+
Extra constant evaluation: evaluated: 4, effectively constant: 2

pkg/front_end/testcases/agnostic/is.dart.weak.modular.expect

Lines changed: 0 additions & 11 deletions
This file was deleted.

pkg/front_end/testcases/agnostic/is.dart.weak.outline.expect

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
library;
2+
import self as self;
3+
import "dart:core" as core;
4+
5+
static const field core::List<core::int> a = #C1;
6+
static const field core::List<core::int?> b = #C2;
7+
static const field core::Map<core::List<core::int?>, core::int> c = #C5;
8+
static method main() → dynamic {}
9+
10+
constants {
11+
#C1 = <core::int>[]
12+
#C2 = <core::int?>[]
13+
#C3 = 0
14+
#C4 = 1
15+
#C5 = <core::List<core::int?>, core::int>{#C1:#C3, #C2:#C4}
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
library;
2+
import self as self;
3+
import "dart:core" as core;
4+
5+
static const field core::List<core::int> a = const <core::int>[];
6+
static const field core::List<core::int?> b = const <core::int?>[];
7+
static const field core::Map<core::List<core::int?>, core::int> c = const <core::List<core::int?>, core::int>{self::a: 0, self::b: 1};
8+
static method main() → dynamic
9+
;
10+
11+
12+
Extra constant evaluation status:
13+
Evaluated: ListLiteral @ org-dartlang-testcase:///map.dart:5:16 -> ListConstant(const <int>[])
14+
Evaluated: ListLiteral @ org-dartlang-testcase:///map.dart:6:17 -> ListConstant(const <int?>[])
15+
Evaluated: MapLiteral @ org-dartlang-testcase:///map.dart:7:11 -> MapConstant(const <List<int?>, int>{const <int>[]: 0, const <int?>[]: 1})
16+
Extra constant evaluation: evaluated: 3, effectively constant: 3

pkg/front_end/testcases/agnostic/map.dart.weak.modular.expect

Lines changed: 0 additions & 16 deletions
This file was deleted.

pkg/front_end/testcases/agnostic/map.dart.weak.outline.expect

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
library;
2+
import self as self;
3+
import "dart:core" as core;
4+
5+
static const field core::List<core::int> a = #C1;
6+
static const field core::List<core::int?> b = #C2;
7+
static const field core::Set<core::List<core::int?>> c = #C3;
8+
static method main() → dynamic {}
9+
10+
constants {
11+
#C1 = <core::int>[]
12+
#C2 = <core::int?>[]
13+
#C3 = <core::List<core::int?>>{#C1, #C2}
14+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
library;
2+
import self as self;
3+
import "dart:core" as core;
4+
5+
static const field core::List<core::int> a = const <core::int>[];
6+
static const field core::List<core::int?> b = const <core::int?>[];
7+
static const field core::Set<core::List<core::int?>> c = const <core::List<core::int?>>{self::a, self::b};
8+
static method main() → dynamic
9+
;
10+
11+
12+
Extra constant evaluation status:
13+
Evaluated: ListLiteral @ org-dartlang-testcase:///set.dart:5:16 -> ListConstant(const <int>[])
14+
Evaluated: ListLiteral @ org-dartlang-testcase:///set.dart:6:17 -> ListConstant(const <int?>[])
15+
Evaluated: SetLiteral @ org-dartlang-testcase:///set.dart:7:11 -> SetConstant(const <List<int?>>{const <int>[], const <int?>[]})
16+
Extra constant evaluation: evaluated: 3, effectively constant: 3

pkg/front_end/testcases/agnostic/set.dart.weak.modular.expect

Lines changed: 0 additions & 14 deletions
This file was deleted.

pkg/front_end/testcases/agnostic/set.dart.weak.outline.expect

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
library;
2+
import self as self;
3+
import "dart:core" as core;
4+
import "main_lib.dart" as mai;
5+
6+
import "org-dartlang-testcase:///main_lib.dart";
7+
8+
static method test() → dynamic {
9+
core::Map<<unrelated T extends core::Object? = dynamic>() → mai::A<core::int?>, core::bool> m = #C6;
10+
core::Map<<unrelated T extends core::Object? = dynamic>() → mai::A<core::int?>, core::bool> n = #C6;
11+
}
12+
13+
constants {
14+
#C1 = constructor-tearoff mai::A::•
15+
#C2 = typedef-tearoff <unrelated T extends core::Object? = dynamic>.(#C1<core::int>)
16+
#C3 = true
17+
#C4 = typedef-tearoff <unrelated T extends core::Object? = dynamic>.(#C1<core::int?>)
18+
#C5 = false
19+
#C6 = <<unrelated T extends core::Object? = dynamic>() → mai::A<core::int?>, core::bool>{#C2:#C3, #C4:#C5}
20+
}

0 commit comments

Comments
 (0)