Skip to content

Commit f79ed93

Browse files
fishythefishCommit Queue
authored and
Commit Queue
committed
[dart2js] Remove remaining language version overrides
Now that dart2js only takes migrated files as input, all tests should use the current language version. Change-Id: I6c84850f5786aeac04154b67bd7a3c19083c8bba Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345344 Reviewed-by: Nate Biggs <[email protected]> Commit-Queue: Mayank Patke <[email protected]>
1 parent 307c6d1 commit f79ed93

File tree

655 files changed

+1960
-4266
lines changed

Some content is hidden

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

655 files changed

+1960
-4266
lines changed

pkg/compiler/lib/src/ir/visitors.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class DartTypeConverter extends ir.DartTypeVisitor<DartType> {
5454

5555
DartType _convertNullability(
5656
DartType baseType, ir.DartType nullabilitySource) {
57-
final nullability = nullabilitySource.nullability;
57+
final nullability = nullabilitySource.declaredNullability;
5858
switch (nullability) {
5959
case ir.Nullability.nonNullable:
6060
return baseType;
@@ -68,7 +68,8 @@ class DartTypeConverter extends ir.DartTypeVisitor<DartType> {
6868
// nullability of the bound. We don't need a nullability wrapper in this
6969
// case.
7070
if (nullabilitySource is ir.TypeParameterType ||
71-
nullabilitySource is ir.StructuralParameterType) {
71+
nullabilitySource is ir.StructuralParameterType ||
72+
nullabilitySource is ir.ExtensionType) {
7273
return baseType;
7374
}
7475

pkg/compiler/lib/src/util/memory_compiler.dart

Lines changed: 5 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ Future<api.CompilationResult> runCompiler(
9595
bool showDiagnostics = true,
9696
Uri? librariesSpecificationUri,
9797
Uri? packageConfig,
98-
void beforeRun(Compiler compiler)?,
99-
bool unsafeToTouchSourceFiles = false}) async {
98+
void beforeRun(Compiler compiler)?}) async {
10099
if (entryPoint == null) {
101100
entryPoint = Uri.parse('memory:main.dart');
102101
}
@@ -109,8 +108,7 @@ Future<api.CompilationResult> runCompiler(
109108
environment: environment,
110109
showDiagnostics: showDiagnostics,
111110
librariesSpecificationUri: librariesSpecificationUri,
112-
packageConfig: packageConfig,
113-
unsafeToTouchSourceFiles: unsafeToTouchSourceFiles);
111+
packageConfig: packageConfig);
114112
if (beforeRun != null) {
115113
beforeRun(compiler);
116114
}
@@ -130,8 +128,7 @@ Compiler compilerFor(
130128
Map<String, String>? environment,
131129
bool showDiagnostics = true,
132130
Uri? librariesSpecificationUri,
133-
Uri? packageConfig,
134-
bool unsafeToTouchSourceFiles = false}) {
131+
Uri? packageConfig}) {
135132
retainDataForTesting = true;
136133
librariesSpecificationUri ??= sdkLibrariesSpecificationUri;
137134

@@ -148,41 +145,6 @@ Compiler compilerFor(
148145
// Create a local in case we end up cloning memorySourceFiles.
149146
Map<String, dynamic> sources = memorySourceFiles;
150147

151-
// If soundNullSafety is not requested, then we prepend the opt out string to
152-
// the memory files.
153-
// TODO(48820): After migrating all tests we should no longer have to infer
154-
// a mode in the memory compiler. The logic to update options and to update
155-
// sources to opt-out should be removed.
156-
if (!options.contains(Flags.soundNullSafety)) {
157-
bool addUnsoundFlag = false;
158-
if (!unsafeToTouchSourceFiles) {
159-
// Map may be immutable so copy.
160-
sources = {};
161-
memorySourceFiles.forEach((k, v) => sources[k] = v);
162-
addUnsoundFlag = true;
163-
}
164-
165-
for (var key in sources.keys) {
166-
if (sources[key] is String && key.endsWith('.dart')) {
167-
RegExp optOutStr = RegExp(r"\/\/\s*@dart\s*=\s*2\.(\d+)");
168-
final match = optOutStr.firstMatch(sources[key]);
169-
if (match == null) {
170-
if (!unsafeToTouchSourceFiles) {
171-
sources[key] = '// @dart=2.7\n' + sources[key];
172-
}
173-
} else {
174-
// If the file version is prior to 2.12, we treat it as unsound
175-
if (int.parse(match.group(1)!) < 12) {
176-
addUnsoundFlag = true;
177-
}
178-
}
179-
}
180-
}
181-
if (addUnsoundFlag && !options.contains(Flags.noSoundNullSafety)) {
182-
options = [Flags.noSoundNullSafety, ...options];
183-
}
184-
}
185-
186148
MemorySourceFileProvider provider;
187149
provider = MemorySourceFileProvider(sources);
188150
diagnosticHandler = createCompilerDiagnostics(diagnosticHandler, provider,
@@ -193,15 +155,10 @@ Compiler compilerFor(
193155
outputProvider = const NullCompilerOutput();
194156
}
195157

196-
options.add('${Flags.entryUri}=$entryPoint');
158+
options = [...options, '${Flags.entryUri}=$entryPoint'];
197159

198160
CompilerOptions compilerOptions = CompilerOptions.parse(options,
199-
librariesSpecificationUri: librariesSpecificationUri,
200-
// Unsound platform dill files are no longer packaged in the SDK and must
201-
// be read from the build directory during tests.
202-
platformBinaries: options.contains(Flags.noSoundNullSafety)
203-
? buildPlatformBinariesUri
204-
: null)
161+
librariesSpecificationUri: librariesSpecificationUri)
205162
..environment = environment ?? {}
206163
..packageConfig = packageConfig;
207164

pkg/compiler/pubspec.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,3 @@ dev_dependencies:
3535
modular_test: any
3636
sourcemap_testing: any
3737
testing: any
38-
vm: any

pkg/compiler/test/codegen/builtin_equals_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import '../helpers/compiler_helper.dart';
88

99
const String TEST = r"""
1010
foo() {
11-
String s = Object().toString();
12-
Object o = Object().toString();
11+
String? s = Object()?.toString();
12+
Object? o = Object()?.toString();
1313
return s == 'foo'
1414
&& s == null
1515
&& null == s

pkg/compiler/test/codegen/codegen_2_shard0_test.dart

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

pkg/compiler/test/codegen/codegen_2_shard1_test.dart

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

pkg/compiler/test/codegen/codegen_test_helper.dart

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import 'dart:io';
66
import 'package:async_helper/async_helper.dart';
77
import 'package:compiler/src/closure.dart';
88
import 'package:compiler/src/common.dart';
9-
import 'package:compiler/src/commandline_options.dart';
109
import 'package:compiler/src/compiler.dart';
1110
import 'package:compiler/src/elements/entities.dart';
1211
import 'package:compiler/src/js_model/element_map.dart';
@@ -17,11 +16,9 @@ import '../equivalence/id_equivalence.dart';
1716
import '../equivalence/id_equivalence_helper.dart';
1817

1918
const List<String> skip = [];
20-
const List<String> skip2 = [];
2119

2220
main(List<String> args) {
2321
runTests(args);
24-
runTests2(args);
2522
}
2623

2724
runTests(List<String> args, [int? shardIndex]) {
@@ -30,16 +27,7 @@ runTests(List<String> args, [int? shardIndex]) {
3027
shards: 2,
3128
directory: 'data',
3229
skip: skip,
33-
options: [Flags.soundNullSafety]);
34-
}
35-
36-
runTests2(List<String> args, [int? shardIndex]) {
37-
runTestsCommon(args,
38-
shardIndex: shardIndex,
39-
shards: 2,
40-
directory: 'data_2',
41-
skip: skip2,
42-
options: []);
30+
options: const []);
4331
}
4432

4533
runTestsCommon(List<String> args,

pkg/compiler/test/codegen/data/late_field_read_check_optimization.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
// @dart = 2.17
6-
75
/*member: main:ignore*/
86
void main() {
97
final x1 = XX();

pkg/compiler/test/codegen/data/shift_right_unsigned.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
// @dart = 2.14
6-
75
/*member: main:ignore*/
86
void main() {
97
for (var a in [false, true]) {

pkg/compiler/test/codegen/data/tdiv1.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
// @dart = 2.12
6-
75
/*member: main:ignore*/
86
void main() {
97
for (var a in [false, true]) {

pkg/compiler/test/codegen/data_2/marker.options

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

pkg/compiler/test/codegen/data_2/tdiv1.dart

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

pkg/compiler/test/codegen/data_2/unused_empty_map.dart

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

0 commit comments

Comments
 (0)