[dart2js] Migrate test/deferred for null safety migration.
Change-Id: Ic0abaf769d3ac19db1de237486b3e286cda0cb4c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279302
Reviewed-by: Mayank Patke <fishythefish@google.com>
diff --git a/pkg/compiler/test/deferred/closures_test.dart b/pkg/compiler/test/deferred/closures_test.dart
index 7ef8fa8..5d8a27a 100644
--- a/pkg/compiler/test/deferred/closures_test.dart
+++ b/pkg/compiler/test/deferred/closures_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart = 2.7
-
// Ensures that closures are in the output unit of their enclosing element.
import 'package:async_helper/async_helper.dart';
@@ -22,8 +20,8 @@
runTest() async {
OutputCollector collector = new OutputCollector();
await runCompiler(memorySourceFiles: sources, outputProvider: collector);
- String mainOutput = collector.getOutput("", api.OutputType.js);
- String deferredOutput = collector.getOutput("out_1", api.OutputType.jsPart);
+ String mainOutput = collector.getOutput("", api.OutputType.js)!;
+ String deferredOutput = collector.getOutput("out_1", api.OutputType.jsPart)!;
Expect.isTrue(mainOutput.contains("other_method_name() {"));
Expect.isFalse(mainOutput.contains("unique_method_name() {"));
diff --git a/pkg/compiler/test/deferred/constant_emission_test_helper.dart b/pkg/compiler/test/deferred/constant_emission_test_helper.dart
index ff2d561..0141cf8 100644
--- a/pkg/compiler/test/deferred/constant_emission_test_helper.dart
+++ b/pkg/compiler/test/deferred/constant_emission_test_helper.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart = 2.7
-
// Test that the additional runtime type support is output to the right
// Files when using deferred loading.
@@ -34,11 +32,11 @@
Compiler compiler = result.compiler;
DartTypes dartTypes = compiler.frontendStrategy.commonElements.dartTypes;
ProgramLookup lookup = new ProgramLookup(compiler.backendStrategy);
- var closedWorld = compiler.backendClosedWorldForTesting;
+ var closedWorld = compiler.backendClosedWorldForTesting!;
var elementEnvironment = closedWorld.elementEnvironment;
LibraryEntity lookupLibrary(name) {
- return elementEnvironment.lookupLibrary(Uri.parse(name));
+ return elementEnvironment.lookupLibrary(Uri.parse(name))!;
}
OutputUnit Function(MemberEntity) outputUnitForMember =
@@ -50,9 +48,9 @@
for (OutputUnitDescriptor descriptor in outputUnits) {
LibraryEntity library = lookupLibrary(descriptor.uri);
MemberEntity member =
- elementEnvironment.lookupLibraryMember(library, descriptor.member);
+ elementEnvironment.lookupLibraryMember(library, descriptor.member)!;
OutputUnit outputUnit = outputUnitForMember(member);
- fragments[descriptor.name] = lookup.getFragment(outputUnit);
+ fragments[descriptor.name] = lookup.getFragment(outputUnit)!;
}
Map<String, Set<String>> actualOutputUnits = {};
@@ -62,7 +60,7 @@
void processFragment(String fragmentName, Fragment fragment) {
for (Constant constant in fragment.constants) {
String text = constant.value.toStructuredText(dartTypes);
- Set<String> expectedConstantUnit = expectedOutputUnits[text];
+ Set<String>? expectedConstantUnit = expectedOutputUnits[text];
if (expectedConstantUnit == null) {
if (constant.value is DeferredGlobalConstantValue) {
print('ERROR: No expectancy for $constant found in $fragmentName');
diff --git a/pkg/compiler/test/deferred/data/deferred_helper.dart b/pkg/compiler/test/deferred/data/deferred_helper.dart
index b2e8813..9df96ab 100644
--- a/pkg/compiler/test/deferred/data/deferred_helper.dart
+++ b/pkg/compiler/test/deferred/data/deferred_helper.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart = 2.7
-
import 'deferred_lib.dart' deferred as lib;
main() async {
diff --git a/pkg/compiler/test/deferred/data/deferred_lib.dart b/pkg/compiler/test/deferred/data/deferred_lib.dart
index cc5015c..7a88c95 100644
--- a/pkg/compiler/test/deferred/data/deferred_lib.dart
+++ b/pkg/compiler/test/deferred/data/deferred_lib.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart = 2.7
-
class Class {
method() => 'Class.method';
}
diff --git a/pkg/compiler/test/deferred/deferred_constant3_test.dart b/pkg/compiler/test/deferred/deferred_constant3_test.dart
index ab08819..7dda970 100644
--- a/pkg/compiler/test/deferred/deferred_constant3_test.dart
+++ b/pkg/compiler/test/deferred/deferred_constant3_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart = 2.7
-
// Test that the additional runtime type support is output to the right
// Files when using deferred loading.
diff --git a/pkg/compiler/test/deferred/dont_inline_deferred_constants_test.dart b/pkg/compiler/test/deferred/dont_inline_deferred_constants_test.dart
index a7fca88..842b8b3 100644
--- a/pkg/compiler/test/deferred/dont_inline_deferred_constants_test.dart
+++ b/pkg/compiler/test/deferred/dont_inline_deferred_constants_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart = 2.7
-
// Test that the additional runtime type support is output to the right
// Files when using deferred loading.
diff --git a/pkg/compiler/test/deferred/dont_inline_deferred_globals_test.dart b/pkg/compiler/test/deferred/dont_inline_deferred_globals_test.dart
index 1c3ac30..3948747 100644
--- a/pkg/compiler/test/deferred/dont_inline_deferred_globals_test.dart
+++ b/pkg/compiler/test/deferred/dont_inline_deferred_globals_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart = 2.7
-
// Test that the additional runtime type support is output to the right
// Files when using deferred loading.
diff --git a/pkg/compiler/test/deferred/emit_type_checks_test.dart b/pkg/compiler/test/deferred/emit_type_checks_test.dart
index 3442486..b6b1ca1 100644
--- a/pkg/compiler/test/deferred/emit_type_checks_test.dart
+++ b/pkg/compiler/test/deferred/emit_type_checks_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart = 2.7
-
// Test that the additional runtime type support is output to the right
// Files when using deferred loading.
@@ -20,8 +18,9 @@
CompilationResult result = await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES, outputProvider: collector);
Compiler compiler = result.compiler;
- String mainOutput = collector.getOutput('', api.OutputType.js);
- String deferredOutput = collector.getOutput('out_1', api.OutputType.jsPart);
+ String mainOutput = collector.getOutput('', api.OutputType.js)!;
+ String deferredOutput =
+ collector.getOutput('out_1', api.OutputType.jsPart)!;
JsBackendStrategy backendStrategy = compiler.backendStrategy;
String isPrefix =
backendStrategy.namerForTesting.fixedNames.operatorIsPrefix;
diff --git a/pkg/compiler/test/deferred/follow_constant_dependencies_test.dart b/pkg/compiler/test/deferred/follow_constant_dependencies_test.dart
index 2247db3..65d48e8 100644
--- a/pkg/compiler/test/deferred/follow_constant_dependencies_test.dart
+++ b/pkg/compiler/test/deferred/follow_constant_dependencies_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart = 2.7
-
// Test that constants depended on by other constants are correctly deferred.
import 'package:async_helper/async_helper.dart';
@@ -20,7 +18,7 @@
Compiler compiler = result.compiler;
DartTypes dartTypes = compiler.frontendStrategy.commonElements.dartTypes;
- var closedWorld = compiler.backendClosedWorldForTesting;
+ var closedWorld = compiler.backendClosedWorldForTesting!;
var outputUnitForConstant =
closedWorld.outputUnitData.outputUnitForConstant;
var mainOutputUnit = closedWorld.outputUnitData.mainOutputUnit;
@@ -35,11 +33,10 @@
codegenWorldBuilder.compiledConstantsForTesting
.forEach(addConstantWithDependencies);
for (String stringValue in ["cA", "cB", "cC"]) {
- StringConstantValue constant =
- allConstants.firstWhere((dynamic constant) {
+ final constant = allConstants.firstWhere((dynamic constant) {
return constant is StringConstantValue &&
constant.stringValue == stringValue;
- });
+ }) as StringConstantValue;
Expect.notEquals(
null,
outputUnitForConstant(constant),
diff --git a/pkg/compiler/test/deferred/follow_implicit_super_regression_test.dart b/pkg/compiler/test/deferred/follow_implicit_super_regression_test.dart
index d168975..9f26255 100644
--- a/pkg/compiler/test/deferred/follow_implicit_super_regression_test.dart
+++ b/pkg/compiler/test/deferred/follow_implicit_super_regression_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart = 2.7
-
import 'package:async_helper/async_helper.dart';
import 'package:compiler/src/compiler.dart' as dart2js;
import 'package:expect/expect.dart';
@@ -15,7 +13,7 @@
CompilationResult result =
await runCompiler(memorySourceFiles: MEMORY_SOURCE_FILES);
dart2js.Compiler compiler = result.compiler;
- var closedWorld = compiler.backendClosedWorldForTesting;
+ var closedWorld = compiler.backendClosedWorldForTesting!;
var elementEnvironment = closedWorld.elementEnvironment;
lookupLibrary(name) {
@@ -25,10 +23,10 @@
var outputUnitForMember = closedWorld.outputUnitData.outputUnitForMember;
dynamic lib = lookupLibrary("memory:lib.dart");
- var a = elementEnvironment.lookupLibraryMember(lib, "a");
- var b = elementEnvironment.lookupLibraryMember(lib, "b");
- var c = elementEnvironment.lookupLibraryMember(lib, "c");
- var d = elementEnvironment.lookupLibraryMember(lib, "d");
+ var a = elementEnvironment.lookupLibraryMember(lib, "a")!;
+ var b = elementEnvironment.lookupLibraryMember(lib, "b")!;
+ var c = elementEnvironment.lookupLibraryMember(lib, "c")!;
+ var d = elementEnvironment.lookupLibraryMember(lib, "d")!;
Expect.equals(outputUnitForMember(a), outputUnitForMember(b));
Expect.equals(outputUnitForMember(a), outputUnitForMember(c));
Expect.equals(outputUnitForMember(a), outputUnitForMember(d));
diff --git a/pkg/compiler/test/deferred/inline_restrictions_test.dart b/pkg/compiler/test/deferred/inline_restrictions_test.dart
index 955c9b4..78bf40c 100644
--- a/pkg/compiler/test/deferred/inline_restrictions_test.dart
+++ b/pkg/compiler/test/deferred/inline_restrictions_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart = 2.7
-
// Test that we do not accidentally leak code from deferred libraries but do
// allow inlining of empty functions and from main.
@@ -19,25 +17,25 @@
CompilationResult result = await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES, outputProvider: collector);
Compiler compiler = result.compiler;
- var closedWorld = compiler.backendClosedWorldForTesting;
+ var closedWorld = compiler.backendClosedWorldForTesting!;
var env = closedWorld.elementEnvironment;
var outputUnitForMember = closedWorld.outputUnitData.outputUnitForMember;
lookupLibrary(name) => env.lookupLibrary(Uri.parse(name));
dynamic lib1 = lookupLibrary("memory:lib1.dart");
- var inlineMeAway = env.lookupLibraryMember(lib1, "inlineMeAway");
+ var inlineMeAway = env.lookupLibraryMember(lib1, "inlineMeAway")!;
var ou_lib1 = outputUnitForMember(inlineMeAway);
dynamic lib3 = lookupLibrary("memory:lib3.dart");
- var sameContextInline = env.lookupLibraryMember(lib3, "sameContextInline");
+ var sameContextInline = env.lookupLibraryMember(lib3, "sameContextInline")!;
var ou_lib3 = outputUnitForMember(sameContextInline);
// Test that we actually got different output units.
Expect.notEquals(ou_lib1.name, ou_lib3.name);
- String mainOutput = collector.getOutput("", api.OutputType.js);
+ String mainOutput = collector.getOutput("", api.OutputType.js)!;
String lib1Output =
- collector.getOutput("out_${ou_lib1.name}", api.OutputType.jsPart);
- String lib3Output =
+ collector.getOutput("out_${ou_lib1.name}", api.OutputType.jsPart)!;
+ String? lib3Output =
collector.getOutput("out_${ou_lib3.name}", api.OutputType.jsPart);
// Test that inlineMeAway was inlined and its argument thus dropped.
diff --git a/pkg/compiler/test/deferred/load_graph_segmentation2_test.dart b/pkg/compiler/test/deferred/load_graph_segmentation2_test.dart
index 589bb39..e2410a5 100644
--- a/pkg/compiler/test/deferred/load_graph_segmentation2_test.dart
+++ b/pkg/compiler/test/deferred/load_graph_segmentation2_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart = 2.7
-
// Test of the graph segmentation algorithm used by deferred loading
// to determine which elements can be deferred and which libraries
// much be included in the initial download (loaded eagerly).
@@ -18,13 +16,13 @@
CompilationResult result =
await runCompiler(memorySourceFiles: MEMORY_SOURCE_FILES);
Compiler compiler = result.compiler;
- var closedWorld = compiler.backendClosedWorldForTesting;
+ var closedWorld = compiler.backendClosedWorldForTesting!;
var env = closedWorld.elementEnvironment;
var outputUnitForMember = closedWorld.outputUnitData.outputUnitForMember;
var mainOutputUnit = closedWorld.outputUnitData.mainOutputUnit;
dynamic lib = env.lookupLibrary(Uri.parse("memory:lib.dart"));
- var f1 = env.lookupLibraryMember(lib, "f1");
- var f2 = env.lookupLibraryMember(lib, "f2");
+ var f1 = env.lookupLibraryMember(lib, "f1")!;
+ var f2 = env.lookupLibraryMember(lib, "f2")!;
Expect.notEquals(mainOutputUnit, outputUnitForMember(f1));
Expect.equals(mainOutputUnit, outputUnitForMember(f2));
});
diff --git a/pkg/compiler/test/deferred/load_graph_segmentation_test.dart b/pkg/compiler/test/deferred/load_graph_segmentation_test.dart
index f26a03e..6e5d253 100644
--- a/pkg/compiler/test/deferred/load_graph_segmentation_test.dart
+++ b/pkg/compiler/test/deferred/load_graph_segmentation_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart = 2.7
-
// Test of the graph segmentation algorithm used by deferred loading
// to determine which elements can be deferred and which libraries
// much be included in the initial download (loaded eagerly).
@@ -31,10 +29,10 @@
await runCompiler(memorySourceFiles: MEMORY_SOURCE_FILES);
Compiler compiler = result.compiler;
- var closedWorld = compiler.backendClosedWorldForTesting;
+ var closedWorld = compiler.backendClosedWorldForTesting!;
var env = closedWorld.elementEnvironment;
lookupLibrary(name) => env.lookupLibrary(Uri.parse(name));
- var main = env.mainFunction;
+ var main = env.mainFunction!;
Expect.isNotNull(main, "Could not find 'main'");
var outputUnitForMember = closedWorld.outputUnitData.outputUnitForMember;
@@ -45,14 +43,14 @@
var classes = backendStrategy.emitterTask.neededClasses;
var inputElement = classes.where((e) => e.name == 'InputElement').single;
dynamic lib1 = lookupLibrary("memory:lib1.dart");
- var foo1 = env.lookupLibraryMember(lib1, "foo1");
+ var foo1 = env.lookupLibraryMember(lib1, "foo1")!;
dynamic lib2 = lookupLibrary("memory:lib2.dart");
- var foo2 = env.lookupLibraryMember(lib2, "foo2");
+ var foo2 = env.lookupLibraryMember(lib2, "foo2")!;
dynamic lib3 = lookupLibrary("memory:lib3.dart");
- var foo3 = env.lookupLibraryMember(lib3, "foo3");
+ var foo3 = env.lookupLibraryMember(lib3, "foo3")!;
dynamic lib4 = lookupLibrary("memory:lib4.dart");
- var bar1 = env.lookupLibraryMember(lib4, "bar1");
- var bar2 = env.lookupLibraryMember(lib4, "bar2");
+ var bar1 = env.lookupLibraryMember(lib4, "bar1")!;
+ var bar2 = env.lookupLibraryMember(lib4, "bar2")!;
OutputUnit ou_lib1 = outputUnitForMember(foo1);
OutputUnit ou_lib2 = outputUnitForMember(foo2);
@@ -72,10 +70,10 @@
var hunksToLoad =
backendStrategy.emitterTask.emitter.finalizedFragmentsToLoad;
- var hunksLib1 = collectOutputUnits(hunksToLoad["lib1"]);
- var hunksLib2 = collectOutputUnits(hunksToLoad["lib2"]);
- var hunksLib4_1 = collectOutputUnits(hunksToLoad["lib4_1"]);
- var hunksLib4_2 = collectOutputUnits(hunksToLoad["lib4_2"]);
+ var hunksLib1 = collectOutputUnits(hunksToLoad["lib1"]!);
+ var hunksLib2 = collectOutputUnits(hunksToLoad["lib2"]!);
+ var hunksLib4_1 = collectOutputUnits(hunksToLoad["lib4_1"]!);
+ var hunksLib4_2 = collectOutputUnits(hunksToLoad["lib4_2"]!);
Expect.listEquals([ou_lib1_lib2, ou_lib1], hunksLib1);
Expect.listEquals([ou_lib1_lib2, ou_lib2], hunksLib2);
Expect.listEquals([ou_lib4_1], hunksLib4_1);
diff --git a/pkg/compiler/test/deferred/load_mapping_test.dart b/pkg/compiler/test/deferred/load_mapping_test.dart
index f54c811..599935d 100644
--- a/pkg/compiler/test/deferred/load_mapping_test.dart
+++ b/pkg/compiler/test/deferred/load_mapping_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart = 2.7
-
import 'dart:convert';
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
@@ -20,7 +18,7 @@
var deferredMap =
collector.getOutput("deferred_map.json", api.OutputType.deferredMap);
Expect.isNotNull(deferredMap);
- var mapping = jsonDecode(deferredMap);
+ var mapping = jsonDecode(deferredMap!);
// Test structure of mapping.
Expect.equals("<unnamed>", mapping["main.dart"]["name"]);
@@ -39,7 +37,7 @@
options: ['--dump-deferred-graph=deferred_graph.txt'],
outputProvider: collector);
var actual = collector
- .getOutput("deferred_graph.txt", api.OutputType.debug)
+ .getOutput("deferred_graph.txt", api.OutputType.debug)!
.split('\n');
// This program has 5 deferred imports `convert`, `lib1`, `lib2`, `lib4_1`,
diff --git a/pkg/compiler/test/deferred/not_in_main_test.dart b/pkg/compiler/test/deferred/not_in_main_test.dart
index ec682be..dcc340a 100644
--- a/pkg/compiler/test/deferred/not_in_main_test.dart
+++ b/pkg/compiler/test/deferred/not_in_main_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart = 2.7
-
// Test of the graph segmentation algorithm used by deferred loading
// to determine which elements can be deferred and which libraries
// much be included in the initial download (loaded eagerly).
@@ -28,7 +26,7 @@
CompilationResult result = await runCompiler(memorySourceFiles: TEST1);
Compiler compiler = result.compiler;
- var closedWorld = compiler.backendClosedWorldForTesting;
+ var closedWorld = compiler.backendClosedWorldForTesting!;
var env = closedWorld.elementEnvironment;
var outputUnitForMember = closedWorld.outputUnitData.outputUnitForMember;
var mainOutputUnit = closedWorld.outputUnitData.mainOutputUnit;
@@ -36,7 +34,7 @@
dynamic lib1 = lookupLibrary("memory:lib1.dart");
dynamic lib2 = lookupLibrary("memory:lib2.dart");
env.lookupLibraryMember(lib1, "foo1");
- var foo2 = env.lookupLibraryMember(lib2, "foo2");
+ var foo2 = env.lookupLibraryMember(lib2, "foo2")!;
Expect.notEquals(mainOutputUnit, outputUnitForMember(foo2));
}
@@ -45,14 +43,14 @@
CompilationResult result = await runCompiler(memorySourceFiles: TEST2);
Compiler compiler = result.compiler;
- var closedWorld = compiler.backendClosedWorldForTesting;
+ var closedWorld = compiler.backendClosedWorldForTesting!;
var env = closedWorld.elementEnvironment;
var outputUnitForClass = closedWorld.outputUnitData.outputUnitForClass;
var outputUnitForClassType =
closedWorld.outputUnitData.outputUnitForClassType;
lookupLibrary(name) => env.lookupLibrary(Uri.parse(name));
dynamic shared = lookupLibrary("memory:shared.dart");
- var a = env.lookupClass(shared, "A");
+ var a = env.lookupClass(shared, "A")!;
Expect.equals("OutputUnit(1, {import(def: deferred)})",
outputUnitForClass(a).toString());
@@ -64,7 +62,7 @@
CompilationResult result = await runCompiler(memorySourceFiles: TEST3);
Compiler compiler = result.compiler;
- var closedWorld = compiler.backendClosedWorldForTesting;
+ var closedWorld = compiler.backendClosedWorldForTesting!;
var env = closedWorld.elementEnvironment;
var outputUnitForClass = closedWorld.outputUnitData.outputUnitForClass;
var outputUnitForClassType =
@@ -72,7 +70,7 @@
var mainOutputUnit = closedWorld.outputUnitData.mainOutputUnit;
lookupLibrary(name) => env.lookupLibrary(Uri.parse(name));
dynamic shared = lookupLibrary("memory:shared.dart");
- var a = env.lookupClass(shared, "A");
+ var a = env.lookupClass(shared, "A")!;
Expect.equals(mainOutputUnit, outputUnitForClass(a));
Expect.equals(mainOutputUnit, outputUnitForClassType(a));
@@ -82,7 +80,7 @@
CompilationResult result = await runCompiler(memorySourceFiles: TEST4);
Compiler compiler = result.compiler;
- var closedWorld = compiler.backendClosedWorldForTesting;
+ var closedWorld = compiler.backendClosedWorldForTesting!;
var env = closedWorld.elementEnvironment;
var outputUnitForClass = closedWorld.outputUnitData.outputUnitForClass;
var outputUnitForClassType =
@@ -90,7 +88,7 @@
var mainOutputUnit = closedWorld.outputUnitData.mainOutputUnit;
lookupLibrary(name) => env.lookupLibrary(Uri.parse(name));
dynamic shared = lookupLibrary("memory:shared.dart");
- var a = env.lookupClass(shared, "A");
+ var a = env.lookupClass(shared, "A")!;
Expect.equals("OutputUnit(1, {import(def: deferred)})",
outputUnitForClass(a).toString());
@@ -101,14 +99,14 @@
CompilationResult result = await runCompiler(memorySourceFiles: TEST5);
Compiler compiler = result.compiler;
- var closedWorld = compiler.backendClosedWorldForTesting;
+ var closedWorld = compiler.backendClosedWorldForTesting!;
var env = closedWorld.elementEnvironment;
var outputUnitForClass = closedWorld.outputUnitData.outputUnitForClass;
var outputUnitForClassType =
closedWorld.outputUnitData.outputUnitForClassType;
lookupLibrary(name) => env.lookupLibrary(Uri.parse(name));
dynamic shared = lookupLibrary("memory:shared.dart");
- var a = env.lookupClass(shared, "A");
+ var a = env.lookupClass(shared, "A")!;
Expect.equals(
"OutputUnit(4, {import(def2: deferred), import(def3: deferred)})",
outputUnitForClass(a).toString());
diff --git a/pkg/compiler/test/deferred/unneeded_part_js_test.dart b/pkg/compiler/test/deferred/unneeded_part_js_test.dart
index bcb24cc..a20057a 100644
--- a/pkg/compiler/test/deferred/unneeded_part_js_test.dart
+++ b/pkg/compiler/test/deferred/unneeded_part_js_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart = 2.7
-
// Test that no parts are emitted when deferred loading isn't used.
import 'package:async_helper/async_helper.dart';