[cfe] Add symbolic language versions for testing
Change-Id: I0f8bb91d30fac442d781710b24908cd933d86388
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365142
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
diff --git a/pkg/_fe_analyzer_shared/lib/src/testing/id_generation.dart b/pkg/_fe_analyzer_shared/lib/src/testing/id_generation.dart
index 6be2cf1..7b009f8 100644
--- a/pkg/_fe_analyzer_shared/lib/src/testing/id_generation.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/testing/id_generation.dart
@@ -6,6 +6,8 @@
import 'package:_fe_analyzer_shared/src/testing/id.dart';
import 'package:_fe_analyzer_shared/src/testing/id_testing.dart';
+String _noProcessing(String text) => text;
+
Map<Uri, List<Annotation>> computeAnnotationsPerUri<T>(
Map<Uri, AnnotatedCode> annotatedCode,
Map<String, MemberAnnotations<IdValue>> expectedMaps,
@@ -13,7 +15,8 @@
Map<String, Map<Uri, Map<Id, ActualData<T>>>> actualData,
DataInterpreter<T> dataInterpreter,
{Annotation? Function(Annotation? expected, Annotation? actual)? createDiff,
- bool forceUpdate = false}) {
+ bool forceUpdate = false,
+ String Function(String) postProcessData = _noProcessing}) {
Set<Uri> uriSet = {};
Set<String> actualMarkers = actualData.keys.toSet();
Map<Uri, Map<Id, Map<String, IdValue>>> idValuePerUri = {};
@@ -64,7 +67,10 @@
// Annotations are not computed from synthesized code.
result[uri] = _computeAnnotations(code, expectedMaps.keys, actualMarkers,
idValuePerId, actualDataPerId, dataInterpreter,
- sortMarkers: false, createDiff: createDiff, forceUpdate: forceUpdate);
+ sortMarkers: false,
+ createDiff: createDiff,
+ forceUpdate: forceUpdate,
+ postProcessData: postProcessData);
}
}
return result;
@@ -81,7 +87,8 @@
String defaultSuffix = '*/',
bool sortMarkers = true,
Annotation? Function(Annotation? expected, Annotation? actual)? createDiff,
- bool forceUpdate = false}) {
+ bool forceUpdate = false,
+ required String Function(String) postProcessData}) {
Annotation createAnnotationFromData(
ActualData<T> actualData, Annotation? annotation) {
String getIndentationFromOffset(int offset) {
@@ -142,8 +149,10 @@
annotation?.columnNo ?? -1,
offset,
prefix,
- IdValue.idToString(actualData.id,
- dataInterpreter.getText(actualData.value, indentation)),
+ IdValue.idToString(
+ actualData.id,
+ postProcessData(
+ dataInterpreter.getText(actualData.value, indentation))),
suffix);
}
diff --git a/pkg/_fe_analyzer_shared/lib/src/testing/id_testing.dart b/pkg/_fe_analyzer_shared/lib/src/testing/id_testing.dart
index c545e99..b33dc1b 100644
--- a/pkg/_fe_analyzer_shared/lib/src/testing/id_testing.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/testing/id_testing.dart
@@ -263,6 +263,7 @@
{required Iterable<String> supportedMarkers,
required Uri createTestUri(Uri uri, String fileName),
required void onFailure(String message),
+ String Function(String) preprocessFile = _noProcessing,
bool preserveWhitespaceInAnnotations = false,
bool preserveInfixWhitespaceInAnnotations = false}) {
Uri? entryPoint;
@@ -296,7 +297,8 @@
throw new UnimplementedError();
}
- String annotatedCode = new File.fromUri(mainTestFile!.uri).readAsStringSync();
+ String annotatedCode =
+ preprocessFile(new File.fromUri(mainTestFile!.uri).readAsStringSync());
Map<Uri, AnnotatedCode> code = {
entryPoint!:
new AnnotatedCode.fromText(annotatedCode, commentStart, commentEnd)
@@ -320,7 +322,7 @@
String libFileName = additionalFileData.key;
File libEntity = additionalFileData.value;
Uri libFileUri = createTestUri(libEntity.uri, libFileName);
- String libCode = libEntity.readAsStringSync();
+ String libCode = preprocessFile(libEntity.readAsStringSync());
AnnotatedCode annotatedLibCode =
new AnnotatedCode.fromText(libCode, commentStart, commentEnd);
memorySourceFiles[libFileUri.path] = annotatedLibCode.sourceCode;
@@ -820,6 +822,8 @@
Options.forceUpdate,
];
+String _noProcessing(String s) => s;
+
/// Check code for all tests in [dataDir] using [runTest].
Future<void> runTests<T>(Directory dataDir,
{List<String> args = const <String>[],
@@ -832,7 +836,9 @@
List<String>? skipList,
Map<String, List<String>>? skipMap,
bool preserveWhitespaceInAnnotations = false,
- bool preserveInfixWhitespaceInAnnotations = false}) async {
+ bool preserveInfixWhitespaceInAnnotations = false,
+ String Function(String) preprocessFile = _noProcessing,
+ String Function(String) postProcessData = _noProcessing}) async {
ParsedOptions parsedOptions = ParsedOptions.parse(args, idTestOptions);
MarkerOptions markerOptions =
new MarkerOptions.fromDataDir(dataDir, shouldFindScript: shards == 1);
@@ -903,7 +909,8 @@
onFailure: onFailure,
preserveWhitespaceInAnnotations: preserveWhitespaceInAnnotations,
preserveInfixWhitespaceInAnnotations:
- preserveInfixWhitespaceInAnnotations);
+ preserveInfixWhitespaceInAnnotations,
+ preprocessFile: preprocessFile);
print('Test: ${testData.testFileUri}');
Map<String, TestResult<T>> results = await runTest(markerOptions, testData,
@@ -966,7 +973,8 @@
testData.entryPoint,
actualData,
dataInterpreter!,
- forceUpdate: forceUpdate);
+ forceUpdate: forceUpdate,
+ postProcessData: postProcessData);
annotations.forEach((Uri uri, List<Annotation> annotations) {
AnnotatedCode? code = testData.code[uri];
assert(code != null,
diff --git a/pkg/front_end/test/incremental_suite.dart b/pkg/front_end/test/incremental_suite.dart
index c42a9f9..69248da 100644
--- a/pkg/front_end/test/incremental_suite.dart
+++ b/pkg/front_end/test/incremental_suite.dart
@@ -74,6 +74,7 @@
import 'test_utils.dart';
import 'testing_utils.dart' show checkEnvironment;
import 'utils/io_utils.dart' show computeRepoDir;
+import 'utils/symbolic_language_versions.dart';
import 'utils/values.dart';
void main([List<String> arguments = const []]) => internalMain(createContext,
@@ -772,14 +773,6 @@
return moduleResult;
}
-String doStringReplacements(String input) {
- Version enableNonNullableVersion =
- ExperimentalFlag.nonNullable.experimentEnabledVersion;
- String output = input.replaceAll("%NNBD_VERSION_MARKER%",
- "${enableNonNullableVersion.major}.${enableNonNullableVersion.minor}");
- return output;
-}
-
class ExpressionCompilation {
final bool errors;
final bool warnings;
@@ -1250,7 +1243,7 @@
packagesUri = uri;
}
if (world.enableStringReplacement) {
- data = doStringReplacements(data);
+ data = replaceMarkersWithVersions(data);
}
fs.entityForUri(uri).writeAsStringSync(data);
}
diff --git a/pkg/front_end/test/language_versioning/data/allowed_experiments_with_json/foo/bin/bin_file.dart b/pkg/front_end/test/language_versioning/data/allowed_experiments_with_json/foo/bin/bin_file.dart
index 80e69b3..6e99131 100644
--- a/pkg/front_end/test/language_versioning/data/allowed_experiments_with_json/foo/bin/bin_file.dart
+++ b/pkg/front_end/test/language_versioning/data/allowed_experiments_with_json/foo/bin/bin_file.dart
@@ -3,7 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
/*library:
- languageVersion=2.8,
+ languageVersion=%CURRENT_VERSION_MARKER%,
packageUri=package:collection
*/
diff --git a/pkg/front_end/test/language_versioning/data/allowed_experiments_with_json/foo/lib/foo.dart b/pkg/front_end/test/language_versioning/data/allowed_experiments_with_json/foo/lib/foo.dart
index 68a5188..8e242fa 100644
--- a/pkg/front_end/test/language_versioning/data/allowed_experiments_with_json/foo/lib/foo.dart
+++ b/pkg/front_end/test/language_versioning/data/allowed_experiments_with_json/foo/lib/foo.dart
@@ -2,6 +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.
-/*library: languageVersion=2.8*/
+/*library: languageVersion=%CURRENT_VERSION_MARKER%*/
method2() {}
diff --git a/pkg/front_end/test/language_versioning/data/allowed_experiments_with_json/foo/test/test_file.dart b/pkg/front_end/test/language_versioning/data/allowed_experiments_with_json/foo/test/test_file.dart
index 641941e..e0f7dc8 100644
--- a/pkg/front_end/test/language_versioning/data/allowed_experiments_with_json/foo/test/test_file.dart
+++ b/pkg/front_end/test/language_versioning/data/allowed_experiments_with_json/foo/test/test_file.dart
@@ -3,7 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
/*library:
- languageVersion=2.8,
+ languageVersion=%CURRENT_VERSION_MARKER%,
packageUri=package:collection
*/
diff --git a/pkg/front_end/test/language_versioning/data/allowed_experiments_with_json/main.dart b/pkg/front_end/test/language_versioning/data/allowed_experiments_with_json/main.dart
index 07a2598..14cf9dc 100644
--- a/pkg/front_end/test/language_versioning/data/allowed_experiments_with_json/main.dart
+++ b/pkg/front_end/test/language_versioning/data/allowed_experiments_with_json/main.dart
@@ -2,7 +2,7 @@
// 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.
-/*library: languageVersion=2.8*/
+/*library: languageVersion=%CURRENT_VERSION_MARKER%*/
import 'foo/bin/bin_file.dart';
import 'foo/test/test_file.dart';
diff --git a/pkg/front_end/test/language_versioning/data/both_packages_and_json/foo2/foo.dart b/pkg/front_end/test/language_versioning/data/both_packages_and_json/foo2/foo.dart
index 0f5e6ce..6d1b1ac 100644
--- a/pkg/front_end/test/language_versioning/data/both_packages_and_json/foo2/foo.dart
+++ b/pkg/front_end/test/language_versioning/data/both_packages_and_json/foo2/foo.dart
@@ -1,4 +1,4 @@
-/*library: languageVersion=2.8*/
+/*library: languageVersion=%CURRENT_VERSION_MARKER%*/
String foo() {
return "42";
diff --git a/pkg/front_end/test/language_versioning/data/both_packages_and_json/main.dart b/pkg/front_end/test/language_versioning/data/both_packages_and_json/main.dart
index f5a4c34..bcd1d5b 100644
--- a/pkg/front_end/test/language_versioning/data/both_packages_and_json/main.dart
+++ b/pkg/front_end/test/language_versioning/data/both_packages_and_json/main.dart
@@ -5,11 +5,11 @@
// Set version of this file (not technically in package) explicitly to test as
// much as possibly separately.
-// @dart = 2.4
+// @dart = %VERSION_MARKER0%
import 'package:foo/foo.dart';
-/*library: languageVersion=2.4*/
+/*library: languageVersion=%VERSION_MARKER0%*/
main() {
var result = foo();
diff --git a/pkg/front_end/test/language_versioning/data/issue42661a/.dart_tool/package_config.json b/pkg/front_end/test/language_versioning/data/issue42661a/.dart_tool/package_config.json
index 0286844..97c499a 100644
--- a/pkg/front_end/test/language_versioning/data/issue42661a/.dart_tool/package_config.json
+++ b/pkg/front_end/test/language_versioning/data/issue42661a/.dart_tool/package_config.json
@@ -4,7 +4,7 @@
{
"name": "pack",
"rootUri": "../pack/lib/",
- "languageVersion": "2.7"
+ "languageVersion": "%VERSION_MARKER2%"
}
]
}
\ No newline at end of file
diff --git a/pkg/front_end/test/language_versioning/data/issue42661a/main.dart b/pkg/front_end/test/language_versioning/data/issue42661a/main.dart
index 06c234a..cd739fe 100644
--- a/pkg/front_end/test/language_versioning/data/issue42661a/main.dart
+++ b/pkg/front_end/test/language_versioning/data/issue42661a/main.dart
@@ -1,3 +1,3 @@
-/*library: languageVersion=2.8*/
+/*library: languageVersion=%CURRENT_VERSION_MARKER%*/
import 'pack/web/pack.dart';
diff --git a/pkg/front_end/test/language_versioning/data/issue42661a/pack/web/pack.dart b/pkg/front_end/test/language_versioning/data/issue42661a/pack/web/pack.dart
index 68e26be..c4015da 100644
--- a/pkg/front_end/test/language_versioning/data/issue42661a/pack/web/pack.dart
+++ b/pkg/front_end/test/language_versioning/data/issue42661a/pack/web/pack.dart
@@ -1,4 +1,4 @@
-/*library: languageVersion=2.8*/
+/*library: languageVersion=%CURRENT_VERSION_MARKER%*/
library pack;
part /*error: errors=LanguageVersionMismatchInPart*/ 'package:pack/src/part.dart';
diff --git a/pkg/front_end/test/language_versioning/data/issue42661b/.dart_tool/package_config.json b/pkg/front_end/test/language_versioning/data/issue42661b/.dart_tool/package_config.json
index 00f6b8c..3f6f459 100644
--- a/pkg/front_end/test/language_versioning/data/issue42661b/.dart_tool/package_config.json
+++ b/pkg/front_end/test/language_versioning/data/issue42661b/.dart_tool/package_config.json
@@ -5,7 +5,7 @@
"name": "pack",
"rootUri": "../",
"packageUri": "lib/",
- "languageVersion": "2.7"
+ "languageVersion": "%VERSION_MARKER2%"
}
]
}
\ No newline at end of file
diff --git a/pkg/front_end/test/language_versioning/data/issue42661b/main.dart b/pkg/front_end/test/language_versioning/data/issue42661b/main.dart
index bd8fb96..8969566 100644
--- a/pkg/front_end/test/language_versioning/data/issue42661b/main.dart
+++ b/pkg/front_end/test/language_versioning/data/issue42661b/main.dart
@@ -1,5 +1,5 @@
/*library:
- languageVersion=2.7,
+ languageVersion=%VERSION_MARKER2%,
packageUri=package:pack
*/
diff --git a/pkg/front_end/test/language_versioning/data/issue42661b/web/pack.dart b/pkg/front_end/test/language_versioning/data/issue42661b/web/pack.dart
index 217ed77..36ae572 100644
--- a/pkg/front_end/test/language_versioning/data/issue42661b/web/pack.dart
+++ b/pkg/front_end/test/language_versioning/data/issue42661b/web/pack.dart
@@ -1,5 +1,5 @@
/*library:
- languageVersion=2.7,
+ languageVersion=%VERSION_MARKER2%,
packageUri=package:pack
*/
library pack;
diff --git a/pkg/front_end/test/language_versioning/data/library_with_bad_version.dart b/pkg/front_end/test/language_versioning/data/library_with_bad_version.dart
index 832417f..36bf1ee 100644
--- a/pkg/front_end/test/language_versioning/data/library_with_bad_version.dart
+++ b/pkg/front_end/test/language_versioning/data/library_with_bad_version.dart
@@ -3,11 +3,10 @@
// BSD-style license that can be found in the LICENSE file.
/*error: errors=LanguageVersionTooHigh*/
-// @dart = 3.5
+// @dart = %TOO_HIGH_VERSION_MARKER%
-// If no valid language version is specified, we default to the most reason one.
-// In the tests this is hard-coded to 2.8.
+// If no valid language version is specified, we default to the most recent one.
-/*library: languageVersion=2.8*/
+/*library: languageVersion=%CURRENT_VERSION_MARKER%*/
main() {}
diff --git a/pkg/front_end/test/language_versioning/data/library_with_bad_version_before_good_version.dart b/pkg/front_end/test/language_versioning/data/library_with_bad_version_before_good_version.dart
index 838f46e..49f9a58 100644
--- a/pkg/front_end/test/language_versioning/data/library_with_bad_version_before_good_version.dart
+++ b/pkg/front_end/test/language_versioning/data/library_with_bad_version_before_good_version.dart
@@ -3,13 +3,13 @@
// BSD-style license that can be found in the LICENSE file.
/*error: errors=LanguageVersionTooHigh*/
-// @dart = 3.5
+// @dart = %TOO_HIGH_VERSION_MARKER%
-// @dart = 2.5
+// @dart = %VERSION_MARKER1%
// If the first language version specified is not a valid language version,
-// we default to the most reason one. In the tests this is hard-coded to 2.8.
+// we default to the most recent one.
-/*library: languageVersion=2.8*/
+/*library: languageVersion=%CURRENT_VERSION_MARKER%*/
main() {}
diff --git a/pkg/front_end/test/language_versioning/data/library_with_no_version.dart b/pkg/front_end/test/language_versioning/data/library_with_no_version.dart
index 66a962f..f79fd57 100644
--- a/pkg/front_end/test/language_versioning/data/library_with_no_version.dart
+++ b/pkg/front_end/test/language_versioning/data/library_with_no_version.dart
@@ -3,9 +3,8 @@
// BSD-style license that can be found in the LICENSE file.
// If no language version is specified, and none if given in a
-// .dart_tool/package_config.json file,
-// we default to the most reason one. In the tests this is hard-coded to 2.8.
+// .dart_tool/package_config.json file, we default to the most recent one.
-/*library: languageVersion=2.8*/
+/*library: languageVersion=%CURRENT_VERSION_MARKER%*/
main() {}
diff --git a/pkg/front_end/test/language_versioning/data/library_with_two_versions.dart b/pkg/front_end/test/language_versioning/data/library_with_two_versions.dart
index 5d6342b..6532bdb 100644
--- a/pkg/front_end/test/language_versioning/data/library_with_two_versions.dart
+++ b/pkg/front_end/test/language_versioning/data/library_with_two_versions.dart
@@ -4,9 +4,9 @@
// With several valid versions the first one wins.
-// @dart = 2.5
-// @dart = 2.4
+// @dart = %VERSION_MARKER1%
+// @dart = %VERSION_MARKER0%
-/*library: languageVersion=2.5*/
+/*library: languageVersion=%VERSION_MARKER1%*/
main() {}
diff --git a/pkg/front_end/test/language_versioning/data/library_with_two_versions_2.dart b/pkg/front_end/test/language_versioning/data/library_with_two_versions_2.dart
index f562d28..d9bb3bf 100644
--- a/pkg/front_end/test/language_versioning/data/library_with_two_versions_2.dart
+++ b/pkg/front_end/test/language_versioning/data/library_with_two_versions_2.dart
@@ -4,9 +4,9 @@
// With several versions where the first one is valid, the first one wins.
-// @dart = 2.5
-// @dart = 42.5
+// @dart = %VERSION_MARKER1%
+// @dart = %TOO_HIGH_VERSION_MARKER%
-/*library: languageVersion=2.5*/
+/*library: languageVersion=%VERSION_MARKER1%*/
main() {}
diff --git a/pkg/front_end/test/language_versioning/data/library_with_version.dart b/pkg/front_end/test/language_versioning/data/library_with_version.dart
index 57c3311..ed95539 100644
--- a/pkg/front_end/test/language_versioning/data/library_with_version.dart
+++ b/pkg/front_end/test/language_versioning/data/library_with_version.dart
@@ -2,8 +2,8 @@
// 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.4
+// @dart = %VERSION_MARKER0%
-/*library: languageVersion=2.4*/
+/*library: languageVersion=%VERSION_MARKER0%*/
main() {}
diff --git a/pkg/front_end/test/language_versioning/data/package_default_version/.dart_tool/package_config.json b/pkg/front_end/test/language_versioning/data/package_default_version/.dart_tool/package_config.json
index 00ae89b..34056fc 100644
--- a/pkg/front_end/test/language_versioning/data/package_default_version/.dart_tool/package_config.json
+++ b/pkg/front_end/test/language_versioning/data/package_default_version/.dart_tool/package_config.json
@@ -4,7 +4,7 @@
{
"name": "foo",
"rootUri": "../lib/",
- "languageVersion": "2.5"
+ "languageVersion": "%VERSION_MARKER1%"
}
]
}
\ No newline at end of file
diff --git a/pkg/front_end/test/language_versioning/data/package_default_version/lib/foo.dart b/pkg/front_end/test/language_versioning/data/package_default_version/lib/foo.dart
index f175cd0..c042a05 100644
--- a/pkg/front_end/test/language_versioning/data/package_default_version/lib/foo.dart
+++ b/pkg/front_end/test/language_versioning/data/package_default_version/lib/foo.dart
@@ -2,7 +2,7 @@
// 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.
-/*library: languageVersion=2.5*/
+/*library: languageVersion=%VERSION_MARKER1%*/
import 'foo2.dart';
import 'foo3.dart';
diff --git a/pkg/front_end/test/language_versioning/data/package_default_version/lib/foo2.dart b/pkg/front_end/test/language_versioning/data/package_default_version/lib/foo2.dart
index 8225d13..47f4829 100644
--- a/pkg/front_end/test/language_versioning/data/package_default_version/lib/foo2.dart
+++ b/pkg/front_end/test/language_versioning/data/package_default_version/lib/foo2.dart
@@ -2,9 +2,9 @@
// 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.4
+// @dart = %VERSION_MARKER0%
-/*library: languageVersion=2.4*/
+/*library: languageVersion=%VERSION_MARKER0%*/
foo2() {
print("Hello from foo2!");
diff --git a/pkg/front_end/test/language_versioning/data/package_default_version/lib/foo3.dart b/pkg/front_end/test/language_versioning/data/package_default_version/lib/foo3.dart
index 7f23410..da7c2c1 100644
--- a/pkg/front_end/test/language_versioning/data/package_default_version/lib/foo3.dart
+++ b/pkg/front_end/test/language_versioning/data/package_default_version/lib/foo3.dart
@@ -2,12 +2,12 @@
// 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_tool/package_config.json specifies 2.5, this library tries to go above
-// that, which is fine.
+// .dart_tool/package_config.json specifies %VERSION_MARKER1%, this library
+// tries to go above that, which is fine.
-// @dart = 2.6
+// @dart = %VERSION_MARKER2%
-/*library: languageVersion=2.6*/
+/*library: languageVersion=%VERSION_MARKER2%*/
foo3() {
print("Hello from foo3!");
diff --git a/pkg/front_end/test/language_versioning/data/package_default_version/lib/foo4.dart b/pkg/front_end/test/language_versioning/data/package_default_version/lib/foo4.dart
index c946e69..5303c3b 100644
--- a/pkg/front_end/test/language_versioning/data/package_default_version/lib/foo4.dart
+++ b/pkg/front_end/test/language_versioning/data/package_default_version/lib/foo4.dart
@@ -2,15 +2,15 @@
// 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_tool/package_config.json specifies 2.5, this library tries to go above
-// that, which is fine, except it still has to be within the range of the sdk.
-// The library stays on the .dart_tool/package_config.json specified one (2.5)
-// and an error is issued.
+// .dart_tool/package_config.json specifies %VERSION_MARKER1%, this library
+// tries to go above that, which is fine, except it still has to be within the
+// range of the sdk. The library stays on the .dart_tool/package_config.json
+// specified one (%VERSION_MARKER1%) and an error is issued.
/*error: errors=LanguageVersionTooHigh*/
-// @dart = 2.9
+// @dart = %TOO_HIGH_VERSION_MARKER%
-/*library: languageVersion=2.5*/
+/*library: languageVersion=%VERSION_MARKER1%*/
foo4() {
print("Hello from foo4!");
diff --git a/pkg/front_end/test/language_versioning/data/package_default_version/lib/foo_with_part.dart b/pkg/front_end/test/language_versioning/data/package_default_version/lib/foo_with_part.dart
index 927e5dd..7c4a569 100644
--- a/pkg/front_end/test/language_versioning/data/package_default_version/lib/foo_with_part.dart
+++ b/pkg/front_end/test/language_versioning/data/package_default_version/lib/foo_with_part.dart
@@ -2,7 +2,7 @@
// 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.
-/*library: languageVersion=2.5*/
+/*library: languageVersion=%VERSION_MARKER1%*/
part 'foos_part.dart';
diff --git a/pkg/front_end/test/language_versioning/data/package_default_version/main.dart b/pkg/front_end/test/language_versioning/data/package_default_version/main.dart
index fcd8a99..e76872a 100644
--- a/pkg/front_end/test/language_versioning/data/package_default_version/main.dart
+++ b/pkg/front_end/test/language_versioning/data/package_default_version/main.dart
@@ -5,12 +5,12 @@
// Set version of this file (not technically in package) explicitly to test as
// much as possibly separately.
-// @dart = 2.4
+// @dart = %VERSION_MARKER0%
import 'package:foo/foo.dart';
import 'package:foo/foo_with_part.dart';
-/*library: languageVersion=2.4*/
+/*library: languageVersion=%VERSION_MARKER0%*/
main() {
foo();
diff --git a/pkg/front_end/test/language_versioning/data/package_default_version_is_empty/lib/foo.dart b/pkg/front_end/test/language_versioning/data/package_default_version_is_empty/lib/foo.dart
index 521797b..82bbeba 100644
--- a/pkg/front_end/test/language_versioning/data/package_default_version_is_empty/lib/foo.dart
+++ b/pkg/front_end/test/language_versioning/data/package_default_version_is_empty/lib/foo.dart
@@ -3,7 +3,7 @@
// 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.
-/*library: languageVersion=2.8*/
+/*library: languageVersion=%CURRENT_VERSION_MARKER%*/
import 'foo2.dart';
diff --git a/pkg/front_end/test/language_versioning/data/package_default_version_is_empty/lib/foo2.dart b/pkg/front_end/test/language_versioning/data/package_default_version_is_empty/lib/foo2.dart
index 8542c2a..471dd5b 100644
--- a/pkg/front_end/test/language_versioning/data/package_default_version_is_empty/lib/foo2.dart
+++ b/pkg/front_end/test/language_versioning/data/package_default_version_is_empty/lib/foo2.dart
@@ -3,9 +3,9 @@
// 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.4
+// @dart = %VERSION_MARKER0%
-/*library: languageVersion=2.4*/
+/*library: languageVersion=%VERSION_MARKER0%*/
foo2() {
print("Hello from foo2!");
diff --git a/pkg/front_end/test/language_versioning/data/package_default_version_is_empty/main.dart b/pkg/front_end/test/language_versioning/data/package_default_version_is_empty/main.dart
index cabb316..c7bd80a 100644
--- a/pkg/front_end/test/language_versioning/data/package_default_version_is_empty/main.dart
+++ b/pkg/front_end/test/language_versioning/data/package_default_version_is_empty/main.dart
@@ -5,11 +5,11 @@
// Set version of this file (not technically in package) explicitly to test as
// much as possibly separately.
-// @dart = 2.4
+// @dart = %VERSION_MARKER0%
import 'package:foo/foo.dart';
-/*library: languageVersion=2.4*/
+/*library: languageVersion=%VERSION_MARKER0%*/
main() {
foo();
diff --git a/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong/lib/foo.dart b/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong/lib/foo.dart
index 521797b..82bbeba 100644
--- a/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong/lib/foo.dart
+++ b/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong/lib/foo.dart
@@ -3,7 +3,7 @@
// 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.
-/*library: languageVersion=2.8*/
+/*library: languageVersion=%CURRENT_VERSION_MARKER%*/
import 'foo2.dart';
diff --git a/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong/lib/foo2.dart b/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong/lib/foo2.dart
index 8542c2a..471dd5b 100644
--- a/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong/lib/foo2.dart
+++ b/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong/lib/foo2.dart
@@ -3,9 +3,9 @@
// 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.4
+// @dart = %VERSION_MARKER0%
-/*library: languageVersion=2.4*/
+/*library: languageVersion=%VERSION_MARKER0%*/
foo2() {
print("Hello from foo2!");
diff --git a/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong/main.dart b/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong/main.dart
index cabb316..c7bd80a 100644
--- a/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong/main.dart
+++ b/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong/main.dart
@@ -5,11 +5,11 @@
// Set version of this file (not technically in package) explicitly to test as
// much as possibly separately.
-// @dart = 2.4
+// @dart = %VERSION_MARKER0%
import 'package:foo/foo.dart';
-/*library: languageVersion=2.4*/
+/*library: languageVersion=%VERSION_MARKER0%*/
main() {
foo();
diff --git a/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_2/.dart_tool/package_config.json b/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_2/.dart_tool/package_config.json
index bb60de7..ec58c04 100644
--- a/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_2/.dart_tool/package_config.json
+++ b/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_2/.dart_tool/package_config.json
@@ -5,7 +5,7 @@
"name": "foo",
"rootUri": "../lib/",
"languageVersion": "arglebargle",
- "languageVersion": "2.5"
+ "languageVersion": "%VERSION_MARKER1%"
}
]
}
diff --git a/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_2/lib/foo.dart b/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_2/lib/foo.dart
index c669c23..b7cfee6 100644
--- a/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_2/lib/foo.dart
+++ b/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_2/lib/foo.dart
@@ -3,7 +3,7 @@
// 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.
-/*library: languageVersion=2.8*/
+/*library: languageVersion=%CURRENT_VERSION_MARKER%*/
import 'foo2.dart';
diff --git a/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_2/lib/foo2.dart b/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_2/lib/foo2.dart
index 0e38837..f8518d1 100644
--- a/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_2/lib/foo2.dart
+++ b/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_2/lib/foo2.dart
@@ -3,9 +3,9 @@
// 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.4
+// @dart = %VERSION_MARKER0%
-/*library: languageVersion=2.4*/
+/*library: languageVersion=%VERSION_MARKER0%*/
foo2() {
print("Hello from foo2!");
diff --git a/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_2/main.dart b/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_2/main.dart
index cabb316..c7bd80a 100644
--- a/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_2/main.dart
+++ b/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_2/main.dart
@@ -5,11 +5,11 @@
// Set version of this file (not technically in package) explicitly to test as
// much as possibly separately.
-// @dart = 2.4
+// @dart = %VERSION_MARKER0%
import 'package:foo/foo.dart';
-/*library: languageVersion=2.4*/
+/*library: languageVersion=%VERSION_MARKER0%*/
main() {
foo();
diff --git a/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_3/.dart_tool/package_config.json b/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_3/.dart_tool/package_config.json
index fcb75f5..fa0028d 100644
--- a/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_3/.dart_tool/package_config.json
+++ b/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_3/.dart_tool/package_config.json
@@ -5,7 +5,7 @@
{
"name": "foo",
"rootUri": "../lib/",
- "languageVersion": "2.5",
+ "languageVersion": "%VERSION_MARKER1%",
"languageVersion": "arglebargle"
}
]
diff --git a/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_3/lib/foo.dart b/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_3/lib/foo.dart
index 521797b..82bbeba 100644
--- a/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_3/lib/foo.dart
+++ b/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_3/lib/foo.dart
@@ -3,7 +3,7 @@
// 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.
-/*library: languageVersion=2.8*/
+/*library: languageVersion=%CURRENT_VERSION_MARKER%*/
import 'foo2.dart';
diff --git a/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_3/lib/foo2.dart b/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_3/lib/foo2.dart
index 8542c2a..471dd5b 100644
--- a/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_3/lib/foo2.dart
+++ b/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_3/lib/foo2.dart
@@ -3,9 +3,9 @@
// 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.4
+// @dart = %VERSION_MARKER0%
-/*library: languageVersion=2.4*/
+/*library: languageVersion=%VERSION_MARKER0%*/
foo2() {
print("Hello from foo2!");
diff --git a/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_3/main.dart b/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_3/main.dart
index cabb316..c7bd80a 100644
--- a/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_3/main.dart
+++ b/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_3/main.dart
@@ -5,11 +5,11 @@
// Set version of this file (not technically in package) explicitly to test as
// much as possibly separately.
-// @dart = 2.4
+// @dart = %VERSION_MARKER0%
import 'package:foo/foo.dart';
-/*library: languageVersion=2.4*/
+/*library: languageVersion=%VERSION_MARKER0%*/
main() {
foo();
diff --git a/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_4/lib/foo.dart b/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_4/lib/foo.dart
index 521797b..82bbeba 100644
--- a/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_4/lib/foo.dart
+++ b/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_4/lib/foo.dart
@@ -3,7 +3,7 @@
// 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.
-/*library: languageVersion=2.8*/
+/*library: languageVersion=%CURRENT_VERSION_MARKER%*/
import 'foo2.dart';
diff --git a/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_4/lib/foo2.dart b/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_4/lib/foo2.dart
index 8542c2a..471dd5b 100644
--- a/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_4/lib/foo2.dart
+++ b/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_4/lib/foo2.dart
@@ -3,9 +3,9 @@
// 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.4
+// @dart = %VERSION_MARKER0%
-/*library: languageVersion=2.4*/
+/*library: languageVersion=%VERSION_MARKER0%*/
foo2() {
print("Hello from foo2!");
diff --git a/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_4/main.dart b/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_4/main.dart
index cabb316..c7bd80a 100644
--- a/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_4/main.dart
+++ b/pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_4/main.dart
@@ -5,11 +5,11 @@
// Set version of this file (not technically in package) explicitly to test as
// much as possibly separately.
-// @dart = 2.4
+// @dart = %VERSION_MARKER0%
import 'package:foo/foo.dart';
-/*library: languageVersion=2.4*/
+/*library: languageVersion=%VERSION_MARKER0%*/
main() {
foo();
diff --git a/pkg/front_end/test/language_versioning/data/package_no_default_version/lib/foo.dart b/pkg/front_end/test/language_versioning/data/package_no_default_version/lib/foo.dart
index e731015..07cec70 100644
--- a/pkg/front_end/test/language_versioning/data/package_no_default_version/lib/foo.dart
+++ b/pkg/front_end/test/language_versioning/data/package_no_default_version/lib/foo.dart
@@ -3,10 +3,9 @@
// BSD-style license that can be found in the LICENSE file.
// If no language version is specified, and none if given in a
-// .dart_tool/package_config.json file,
-// we default to the most reason one. In the tests this is hard-coded to 2.8.
+// .dart_tool/package_config.json file, we default to the most recent one.
-/*library: languageVersion=2.8*/
+/*library: languageVersion=%CURRENT_VERSION_MARKER%*/
foo() {
print("Hello from foo!");
diff --git a/pkg/front_end/test/language_versioning/data/package_no_default_version/main.dart b/pkg/front_end/test/language_versioning/data/package_no_default_version/main.dart
index b20c707..554436a 100644
--- a/pkg/front_end/test/language_versioning/data/package_no_default_version/main.dart
+++ b/pkg/front_end/test/language_versioning/data/package_no_default_version/main.dart
@@ -2,11 +2,11 @@
// 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.5
+// @dart = %VERSION_MARKER1%
import 'package:foo/foo.dart';
-/*library: languageVersion=2.5*/
+/*library: languageVersion=%VERSION_MARKER1%*/
main() {
foo();
diff --git a/pkg/front_end/test/language_versioning/data/package_non_package_default_version/.dart_tool/package_config.json b/pkg/front_end/test/language_versioning/data/package_non_package_default_version/.dart_tool/package_config.json
index 1e2be06..796b064 100644
--- a/pkg/front_end/test/language_versioning/data/package_non_package_default_version/.dart_tool/package_config.json
+++ b/pkg/front_end/test/language_versioning/data/package_non_package_default_version/.dart_tool/package_config.json
@@ -5,7 +5,7 @@
"name": "foo",
"rootUri": "../",
"packageUri": "lib/",
- "languageVersion": "2.5"
+ "languageVersion": "%VERSION_MARKER1%"
}
]
}
diff --git a/pkg/front_end/test/language_versioning/data/package_non_package_default_version/lib/foo.dart b/pkg/front_end/test/language_versioning/data/package_non_package_default_version/lib/foo.dart
index 1fe23f3..a255239 100644
--- a/pkg/front_end/test/language_versioning/data/package_non_package_default_version/lib/foo.dart
+++ b/pkg/front_end/test/language_versioning/data/package_non_package_default_version/lib/foo.dart
@@ -2,7 +2,7 @@
// 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.
-/*library: languageVersion=2.5*/
+/*library: languageVersion=%VERSION_MARKER1%*/
foo() {
print("Hello from foo!");
diff --git a/pkg/front_end/test/language_versioning/data/package_non_package_default_version/main.dart b/pkg/front_end/test/language_versioning/data/package_non_package_default_version/main.dart
index 59bf56a..384db67 100644
--- a/pkg/front_end/test/language_versioning/data/package_non_package_default_version/main.dart
+++ b/pkg/front_end/test/language_versioning/data/package_non_package_default_version/main.dart
@@ -7,7 +7,7 @@
// Version comes from the package foo having this file in it's root uri.
/*library:
- languageVersion=2.5,
+ languageVersion=%VERSION_MARKER1%,
packageUri=package:foo
*/
diff --git a/pkg/front_end/test/language_versioning/data/package_non_package_no_default_version/.dart_tool/package_config.json b/pkg/front_end/test/language_versioning/data/package_non_package_no_default_version/.dart_tool/package_config.json
index b6cd952..86ea4ea 100644
--- a/pkg/front_end/test/language_versioning/data/package_non_package_no_default_version/.dart_tool/package_config.json
+++ b/pkg/front_end/test/language_versioning/data/package_non_package_no_default_version/.dart_tool/package_config.json
@@ -4,7 +4,7 @@
{
"name": "foo",
"rootUri": "../lib/",
- "languageVersion": "2.5"
+ "languageVersion": "%VERSION_MARKER1%"
}
]
}
diff --git a/pkg/front_end/test/language_versioning/data/package_non_package_no_default_version/lib/foo.dart b/pkg/front_end/test/language_versioning/data/package_non_package_no_default_version/lib/foo.dart
index 1fe23f3..a255239 100644
--- a/pkg/front_end/test/language_versioning/data/package_non_package_no_default_version/lib/foo.dart
+++ b/pkg/front_end/test/language_versioning/data/package_non_package_no_default_version/lib/foo.dart
@@ -2,7 +2,7 @@
// 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.
-/*library: languageVersion=2.5*/
+/*library: languageVersion=%VERSION_MARKER1%*/
foo() {
print("Hello from foo!");
diff --git a/pkg/front_end/test/language_versioning/data/package_non_package_no_default_version/main.dart b/pkg/front_end/test/language_versioning/data/package_non_package_no_default_version/main.dart
index 5117999..5d6c125 100644
--- a/pkg/front_end/test/language_versioning/data/package_non_package_no_default_version/main.dart
+++ b/pkg/front_end/test/language_versioning/data/package_non_package_no_default_version/main.dart
@@ -4,7 +4,7 @@
import 'package:foo/foo.dart';
-/*library: languageVersion=2.8*/
+/*library: languageVersion=%CURRENT_VERSION_MARKER%*/
main() {
foo();
diff --git a/pkg/front_end/test/language_versioning/data/package_to_high_default_version/.dart_tool/package_config.json b/pkg/front_end/test/language_versioning/data/package_to_high_default_version/.dart_tool/package_config.json
index f144b8e..f75447d 100644
--- a/pkg/front_end/test/language_versioning/data/package_to_high_default_version/.dart_tool/package_config.json
+++ b/pkg/front_end/test/language_versioning/data/package_to_high_default_version/.dart_tool/package_config.json
@@ -4,7 +4,7 @@
{
"name": "foo",
"rootUri": "../lib/",
- "languageVersion": "2.9"
+ "languageVersion": "%TOO_HIGH_VERSION_MARKER%"
}
]
}
diff --git a/pkg/front_end/test/language_versioning/data/package_to_high_default_version/lib/foo.dart b/pkg/front_end/test/language_versioning/data/package_to_high_default_version/lib/foo.dart
index a5a20026..da4baaf 100644
--- a/pkg/front_end/test/language_versioning/data/package_to_high_default_version/lib/foo.dart
+++ b/pkg/front_end/test/language_versioning/data/package_to_high_default_version/lib/foo.dart
@@ -3,7 +3,7 @@
// 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.
-/*library: languageVersion=2.8*/
+/*library: languageVersion=%CURRENT_VERSION_MARKER%*/
import 'foo2.dart';
import 'foo3.dart';
diff --git a/pkg/front_end/test/language_versioning/data/package_to_high_default_version/lib/foo2.dart b/pkg/front_end/test/language_versioning/data/package_to_high_default_version/lib/foo2.dart
index ef19f1d..dd810fc 100644
--- a/pkg/front_end/test/language_versioning/data/package_to_high_default_version/lib/foo2.dart
+++ b/pkg/front_end/test/language_versioning/data/package_to_high_default_version/lib/foo2.dart
@@ -4,9 +4,9 @@
// BSD-style license that can be found in the LICENSE file.
/*error: errors=LanguageVersionTooHigh*/
-// @dart = 2.9
+// @dart = %TOO_HIGH_VERSION_MARKER%
-/*library: languageVersion=2.8*/
+/*library: languageVersion=%CURRENT_VERSION_MARKER%*/
foo2() {
print("Hello from foo2!");
diff --git a/pkg/front_end/test/language_versioning/data/package_to_high_default_version/lib/foo3.dart b/pkg/front_end/test/language_versioning/data/package_to_high_default_version/lib/foo3.dart
index 09e1abf..79cfc8a 100644
--- a/pkg/front_end/test/language_versioning/data/package_to_high_default_version/lib/foo3.dart
+++ b/pkg/front_end/test/language_versioning/data/package_to_high_default_version/lib/foo3.dart
@@ -3,9 +3,9 @@
// 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
+// @dart = %VERSION_MARKER2%
-/*library: languageVersion=2.7*/
+/*library: languageVersion=%VERSION_MARKER2%*/
foo3() {
print("Hello from foo3!");
diff --git a/pkg/front_end/test/language_versioning/data/package_to_high_default_version/main.dart b/pkg/front_end/test/language_versioning/data/package_to_high_default_version/main.dart
index cabb316..c7bd80a 100644
--- a/pkg/front_end/test/language_versioning/data/package_to_high_default_version/main.dart
+++ b/pkg/front_end/test/language_versioning/data/package_to_high_default_version/main.dart
@@ -5,11 +5,11 @@
// Set version of this file (not technically in package) explicitly to test as
// much as possibly separately.
-// @dart = 2.4
+// @dart = %VERSION_MARKER0%
import 'package:foo/foo.dart';
-/*library: languageVersion=2.4*/
+/*library: languageVersion=%VERSION_MARKER0%*/
main() {
foo();
diff --git a/pkg/front_end/test/language_versioning/data/package_with_test_json/foo/bin/bin_file.dart b/pkg/front_end/test/language_versioning/data/package_with_test_json/foo/bin/bin_file.dart
index 54bfce1..84d01e6 100644
--- a/pkg/front_end/test/language_versioning/data/package_with_test_json/foo/bin/bin_file.dart
+++ b/pkg/front_end/test/language_versioning/data/package_with_test_json/foo/bin/bin_file.dart
@@ -3,7 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
/*library:
- languageVersion=2.8,
+ languageVersion=%CURRENT_VERSION_MARKER%,
packageUri=package:foo
*/
diff --git a/pkg/front_end/test/language_versioning/data/package_with_test_json/foo/lib/foo.dart b/pkg/front_end/test/language_versioning/data/package_with_test_json/foo/lib/foo.dart
index 68a5188..8e242fa 100644
--- a/pkg/front_end/test/language_versioning/data/package_with_test_json/foo/lib/foo.dart
+++ b/pkg/front_end/test/language_versioning/data/package_with_test_json/foo/lib/foo.dart
@@ -2,6 +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.
-/*library: languageVersion=2.8*/
+/*library: languageVersion=%CURRENT_VERSION_MARKER%*/
method2() {}
diff --git a/pkg/front_end/test/language_versioning/data/package_with_test_json/foo/test/test_file.dart b/pkg/front_end/test/language_versioning/data/package_with_test_json/foo/test/test_file.dart
index 9f74e21..f9405c8 100644
--- a/pkg/front_end/test/language_versioning/data/package_with_test_json/foo/test/test_file.dart
+++ b/pkg/front_end/test/language_versioning/data/package_with_test_json/foo/test/test_file.dart
@@ -3,7 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
/*library:
- languageVersion=2.8,
+ languageVersion=%CURRENT_VERSION_MARKER%,
packageUri=package:foo
*/
diff --git a/pkg/front_end/test/language_versioning/data/package_with_test_json/main.dart b/pkg/front_end/test/language_versioning/data/package_with_test_json/main.dart
index 27a559d..5e09d45 100644
--- a/pkg/front_end/test/language_versioning/data/package_with_test_json/main.dart
+++ b/pkg/front_end/test/language_versioning/data/package_with_test_json/main.dart
@@ -2,7 +2,7 @@
// 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.
-/*library: languageVersion=2.8*/
+/*library: languageVersion=%CURRENT_VERSION_MARKER%*/
// Test that bin and test files within the root folder of a package are
// associated with the package.
diff --git a/pkg/front_end/test/language_versioning/data/package_without_test_json/foo/bin/bin_file.dart b/pkg/front_end/test/language_versioning/data/package_without_test_json/foo/bin/bin_file.dart
index bd95be3..b44aebb 100644
--- a/pkg/front_end/test/language_versioning/data/package_without_test_json/foo/bin/bin_file.dart
+++ b/pkg/front_end/test/language_versioning/data/package_without_test_json/foo/bin/bin_file.dart
@@ -2,6 +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.
-/*library: languageVersion=2.8*/
+/*library: languageVersion=%CURRENT_VERSION_MARKER%*/
method1() {}
diff --git a/pkg/front_end/test/language_versioning/data/package_without_test_json/foo/lib/foo.dart b/pkg/front_end/test/language_versioning/data/package_without_test_json/foo/lib/foo.dart
index 68a5188..8e242fa 100644
--- a/pkg/front_end/test/language_versioning/data/package_without_test_json/foo/lib/foo.dart
+++ b/pkg/front_end/test/language_versioning/data/package_without_test_json/foo/lib/foo.dart
@@ -2,6 +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.
-/*library: languageVersion=2.8*/
+/*library: languageVersion=%CURRENT_VERSION_MARKER%*/
method2() {}
diff --git a/pkg/front_end/test/language_versioning/data/package_without_test_json/foo/test/test_file.dart b/pkg/front_end/test/language_versioning/data/package_without_test_json/foo/test/test_file.dart
index 8943ce5..1436c93 100644
--- a/pkg/front_end/test/language_versioning/data/package_without_test_json/foo/test/test_file.dart
+++ b/pkg/front_end/test/language_versioning/data/package_without_test_json/foo/test/test_file.dart
@@ -2,6 +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.
-/*library: languageVersion=2.8*/
+/*library: languageVersion=%CURRENT_VERSION_MARKER%*/
method3() {}
diff --git a/pkg/front_end/test/language_versioning/data/package_without_test_json/main.dart b/pkg/front_end/test/language_versioning/data/package_without_test_json/main.dart
index 27a559d..5e09d45 100644
--- a/pkg/front_end/test/language_versioning/data/package_without_test_json/main.dart
+++ b/pkg/front_end/test/language_versioning/data/package_without_test_json/main.dart
@@ -2,7 +2,7 @@
// 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.
-/*library: languageVersion=2.8*/
+/*library: languageVersion=%CURRENT_VERSION_MARKER%*/
// Test that bin and test files within the root folder of a package are
// associated with the package.
diff --git a/pkg/front_end/test/language_versioning/data/parts_agreeing/main.dart b/pkg/front_end/test/language_versioning/data/parts_agreeing/main.dart
index 42a6957..4266a6f 100644
--- a/pkg/front_end/test/language_versioning/data/parts_agreeing/main.dart
+++ b/pkg/front_end/test/language_versioning/data/parts_agreeing/main.dart
@@ -2,11 +2,11 @@
// 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.5
+// @dart = %VERSION_MARKER1%
part 'part.dart';
-/*library: languageVersion=2.5*/
+/*library: languageVersion=%VERSION_MARKER1%*/
main() {
// foo();
diff --git a/pkg/front_end/test/language_versioning/data/parts_agreeing/part.dart b/pkg/front_end/test/language_versioning/data/parts_agreeing/part.dart
index 6a70338..537bc3d 100644
--- a/pkg/front_end/test/language_versioning/data/parts_agreeing/part.dart
+++ b/pkg/front_end/test/language_versioning/data/parts_agreeing/part.dart
@@ -2,7 +2,7 @@
// 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.5
+// @dart = %VERSION_MARKER1%
part of 'main.dart';
diff --git a/pkg/front_end/test/language_versioning/data/parts_agreeing_two_versions/main.dart b/pkg/front_end/test/language_versioning/data/parts_agreeing_two_versions/main.dart
index d1b4908..508d541 100644
--- a/pkg/front_end/test/language_versioning/data/parts_agreeing_two_versions/main.dart
+++ b/pkg/front_end/test/language_versioning/data/parts_agreeing_two_versions/main.dart
@@ -2,12 +2,12 @@
// 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.5
-// @dart = 2.4
+// @dart = %VERSION_MARKER1%
+// @dart = %VERSION_MARKER0%
part 'part.dart';
-/*library: languageVersion=2.5*/
+/*library: languageVersion=%VERSION_MARKER1%*/
main() {
// foo();
diff --git a/pkg/front_end/test/language_versioning/data/parts_agreeing_two_versions/part.dart b/pkg/front_end/test/language_versioning/data/parts_agreeing_two_versions/part.dart
index 6a70338..537bc3d 100644
--- a/pkg/front_end/test/language_versioning/data/parts_agreeing_two_versions/part.dart
+++ b/pkg/front_end/test/language_versioning/data/parts_agreeing_two_versions/part.dart
@@ -2,7 +2,7 @@
// 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.5
+// @dart = %VERSION_MARKER1%
part of 'main.dart';
diff --git a/pkg/front_end/test/language_versioning/data/parts_disagreeing/main.dart b/pkg/front_end/test/language_versioning/data/parts_disagreeing/main.dart
index fd22b71..44be2c1 100644
--- a/pkg/front_end/test/language_versioning/data/parts_disagreeing/main.dart
+++ b/pkg/front_end/test/language_versioning/data/parts_disagreeing/main.dart
@@ -2,11 +2,11 @@
// 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.5
+// @dart = %VERSION_MARKER1%
part /*error: errors=LanguageVersionMismatchInPart*/ 'part.dart';
-/*library: languageVersion=2.5*/
+/*library: languageVersion=%VERSION_MARKER1%*/
main() {
foo();
diff --git a/pkg/front_end/test/language_versioning/data/parts_disagreeing/part.dart b/pkg/front_end/test/language_versioning/data/parts_disagreeing/part.dart
index 35f8505..b383a82 100644
--- a/pkg/front_end/test/language_versioning/data/parts_disagreeing/part.dart
+++ b/pkg/front_end/test/language_versioning/data/parts_disagreeing/part.dart
@@ -2,7 +2,7 @@
// 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.4
+// @dart = %VERSION_MARKER0%
part of 'main.dart';
diff --git a/pkg/front_end/test/language_versioning/data/parts_disagreeing_has_package/.dart_tool/package_config.json b/pkg/front_end/test/language_versioning/data/parts_disagreeing_has_package/.dart_tool/package_config.json
index b6cd952..86ea4ea 100644
--- a/pkg/front_end/test/language_versioning/data/parts_disagreeing_has_package/.dart_tool/package_config.json
+++ b/pkg/front_end/test/language_versioning/data/parts_disagreeing_has_package/.dart_tool/package_config.json
@@ -4,7 +4,7 @@
{
"name": "foo",
"rootUri": "../lib/",
- "languageVersion": "2.5"
+ "languageVersion": "%VERSION_MARKER1%"
}
]
}
diff --git a/pkg/front_end/test/language_versioning/data/parts_disagreeing_has_package/lib/foo.dart b/pkg/front_end/test/language_versioning/data/parts_disagreeing_has_package/lib/foo.dart
index aecb3c7..566027a 100644
--- a/pkg/front_end/test/language_versioning/data/parts_disagreeing_has_package/lib/foo.dart
+++ b/pkg/front_end/test/language_versioning/data/parts_disagreeing_has_package/lib/foo.dart
@@ -2,14 +2,15 @@
// 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.
-// The library and its part is both technically at language version 2.5,
-// but one is explicitly set, the other is not. That's an error.
+// The library and its part is both technically at language version
+// %VERSION_MARKER1%, but one is explicitly set, the other is not. That's an
+// error.
-// @dart = 2.5
+// @dart = %VERSION_MARKER1%
part /*error: errors=LanguageVersionMismatchInPart*/ 'part.dart';
-/*library: languageVersion=2.5*/
+/*library: languageVersion=%VERSION_MARKER1%*/
foo() {
bar();
diff --git a/pkg/front_end/test/language_versioning/data/parts_disagreeing_has_package/main.dart b/pkg/front_end/test/language_versioning/data/parts_disagreeing_has_package/main.dart
index 16f9665..264409c 100644
--- a/pkg/front_end/test/language_versioning/data/parts_disagreeing_has_package/main.dart
+++ b/pkg/front_end/test/language_versioning/data/parts_disagreeing_has_package/main.dart
@@ -5,11 +5,11 @@
// Set version of this file (not technically in package) explicitly to test as
// much as possibly separately.
-// @dart = 2.4
+// @dart = %VERSION_MARKER0%
import 'package:foo/foo.dart';
-/*library: languageVersion=2.4*/
+/*library: languageVersion=%VERSION_MARKER0%*/
main() {
main();
diff --git a/pkg/front_end/test/language_versioning/data/parts_disagreeing_has_package_2/.dart_tool/package_config.json b/pkg/front_end/test/language_versioning/data/parts_disagreeing_has_package_2/.dart_tool/package_config.json
index b6cd952..86ea4ea 100644
--- a/pkg/front_end/test/language_versioning/data/parts_disagreeing_has_package_2/.dart_tool/package_config.json
+++ b/pkg/front_end/test/language_versioning/data/parts_disagreeing_has_package_2/.dart_tool/package_config.json
@@ -4,7 +4,7 @@
{
"name": "foo",
"rootUri": "../lib/",
- "languageVersion": "2.5"
+ "languageVersion": "%VERSION_MARKER1%"
}
]
}
diff --git a/pkg/front_end/test/language_versioning/data/parts_disagreeing_has_package_2/lib/foo.dart b/pkg/front_end/test/language_versioning/data/parts_disagreeing_has_package_2/lib/foo.dart
index e3e8281..90fe463 100644
--- a/pkg/front_end/test/language_versioning/data/parts_disagreeing_has_package_2/lib/foo.dart
+++ b/pkg/front_end/test/language_versioning/data/parts_disagreeing_has_package_2/lib/foo.dart
@@ -2,12 +2,13 @@
// 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.
-// The library and its part is both technically at language version 2.5,
-// but one is explicitly set, the other is not. That's an error.
+// The library and its part is both technically at language version
+// %VERSION_MARKER1%, but one is explicitly set, the other is not. That's an
+// error.
part /*error: errors=LanguageVersionMismatchInPart*/ 'part.dart';
-/*library: languageVersion=2.5*/
+/*library: languageVersion=%VERSION_MARKER1%*/
foo() {
bar();
diff --git a/pkg/front_end/test/language_versioning/data/parts_disagreeing_has_package_2/lib/part.dart b/pkg/front_end/test/language_versioning/data/parts_disagreeing_has_package_2/lib/part.dart
index 7c36bab..4512a61 100644
--- a/pkg/front_end/test/language_versioning/data/parts_disagreeing_has_package_2/lib/part.dart
+++ b/pkg/front_end/test/language_versioning/data/parts_disagreeing_has_package_2/lib/part.dart
@@ -2,7 +2,7 @@
// 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.5
+// @dart = %VERSION_MARKER1%
part of 'foo.dart';
diff --git a/pkg/front_end/test/language_versioning/data/parts_disagreeing_has_package_2/main.dart b/pkg/front_end/test/language_versioning/data/parts_disagreeing_has_package_2/main.dart
index 16f9665..264409c 100644
--- a/pkg/front_end/test/language_versioning/data/parts_disagreeing_has_package_2/main.dart
+++ b/pkg/front_end/test/language_versioning/data/parts_disagreeing_has_package_2/main.dart
@@ -5,11 +5,11 @@
// Set version of this file (not technically in package) explicitly to test as
// much as possibly separately.
-// @dart = 2.4
+// @dart = %VERSION_MARKER0%
import 'package:foo/foo.dart';
-/*library: languageVersion=2.4*/
+/*library: languageVersion=%VERSION_MARKER0%*/
main() {
main();
diff --git a/pkg/front_end/test/language_versioning/data/specified_packages_01/foo2/foo.dart b/pkg/front_end/test/language_versioning/data/specified_packages_01/foo2/foo.dart
index 0f5e6ce..6d1b1ac 100644
--- a/pkg/front_end/test/language_versioning/data/specified_packages_01/foo2/foo.dart
+++ b/pkg/front_end/test/language_versioning/data/specified_packages_01/foo2/foo.dart
@@ -1,4 +1,4 @@
-/*library: languageVersion=2.8*/
+/*library: languageVersion=%CURRENT_VERSION_MARKER%*/
String foo() {
return "42";
diff --git a/pkg/front_end/test/language_versioning/data/specified_packages_01/main.dart b/pkg/front_end/test/language_versioning/data/specified_packages_01/main.dart
index f5a4c34..bcd1d5b 100644
--- a/pkg/front_end/test/language_versioning/data/specified_packages_01/main.dart
+++ b/pkg/front_end/test/language_versioning/data/specified_packages_01/main.dart
@@ -5,11 +5,11 @@
// Set version of this file (not technically in package) explicitly to test as
// much as possibly separately.
-// @dart = 2.4
+// @dart = %VERSION_MARKER0%
import 'package:foo/foo.dart';
-/*library: languageVersion=2.4*/
+/*library: languageVersion=%VERSION_MARKER0%*/
main() {
var result = foo();
diff --git a/pkg/front_end/test/language_versioning/data/specified_packages_02/main.dart b/pkg/front_end/test/language_versioning/data/specified_packages_02/main.dart
index b36e8ea..78efad9 100644
--- a/pkg/front_end/test/language_versioning/data/specified_packages_02/main.dart
+++ b/pkg/front_end/test/language_versioning/data/specified_packages_02/main.dart
@@ -5,11 +5,11 @@
// Set version of this file (not technically in package) explicitly to test as
// much as possibly separately.
-// @dart = 2.4
+// @dart = %VERSION_MARKER0%
import /*error: errors=UntranslatableUri*/ 'package:foo/foo.dart';
-/*library: languageVersion=2.4*/
+/*library: languageVersion=%VERSION_MARKER0%*/
main() {
var result = /*error: errors=MethodNotFound*/ notNamedFoo();
diff --git a/pkg/front_end/test/language_versioning/data/specified_packages_03/foo2/foo.dart b/pkg/front_end/test/language_versioning/data/specified_packages_03/foo2/foo.dart
index 0f5e6ce..6d1b1ac 100644
--- a/pkg/front_end/test/language_versioning/data/specified_packages_03/foo2/foo.dart
+++ b/pkg/front_end/test/language_versioning/data/specified_packages_03/foo2/foo.dart
@@ -1,4 +1,4 @@
-/*library: languageVersion=2.8*/
+/*library: languageVersion=%CURRENT_VERSION_MARKER%*/
String foo() {
return "42";
diff --git a/pkg/front_end/test/language_versioning/data/specified_packages_03/main.dart b/pkg/front_end/test/language_versioning/data/specified_packages_03/main.dart
index f5a4c34..bcd1d5b 100644
--- a/pkg/front_end/test/language_versioning/data/specified_packages_03/main.dart
+++ b/pkg/front_end/test/language_versioning/data/specified_packages_03/main.dart
@@ -5,11 +5,11 @@
// Set version of this file (not technically in package) explicitly to test as
// much as possibly separately.
-// @dart = 2.4
+// @dart = %VERSION_MARKER0%
import 'package:foo/foo.dart';
-/*library: languageVersion=2.4*/
+/*library: languageVersion=%VERSION_MARKER0%*/
main() {
var result = foo();
diff --git a/pkg/front_end/test/language_versioning/data/specified_packages_04/main.dart b/pkg/front_end/test/language_versioning/data/specified_packages_04/main.dart
index b36e8ea..78efad9 100644
--- a/pkg/front_end/test/language_versioning/data/specified_packages_04/main.dart
+++ b/pkg/front_end/test/language_versioning/data/specified_packages_04/main.dart
@@ -5,11 +5,11 @@
// Set version of this file (not technically in package) explicitly to test as
// much as possibly separately.
-// @dart = 2.4
+// @dart = %VERSION_MARKER0%
import /*error: errors=UntranslatableUri*/ 'package:foo/foo.dart';
-/*library: languageVersion=2.4*/
+/*library: languageVersion=%VERSION_MARKER0%*/
main() {
var result = /*error: errors=MethodNotFound*/ notNamedFoo();
diff --git a/pkg/front_end/test/language_versioning/language_versioning_test.dart b/pkg/front_end/test/language_versioning/language_versioning_test.dart
index 201e1a3..40afaa6f 100644
--- a/pkg/front_end/test/language_versioning/language_versioning_test.dart
+++ b/pkg/front_end/test/language_versioning/language_versioning_test.dart
@@ -25,6 +25,8 @@
import 'package:front_end/src/testing/id_testing_utils.dart';
import 'package:kernel/ast.dart' show Component, Library, Version;
+import '../utils/symbolic_language_versions.dart';
+
Future<void> main(List<String> args) async {
// Fix default/max major and minor version so we can test it.
// This config sets it to 2.8.
@@ -40,7 +42,9 @@
skipList: [
// Two language versions specified, the last one is ok and is used here.
"package_default_version_is_wrong_2",
- ]);
+ ],
+ preprocessFile: replaceMarkersWithVersions,
+ postProcessData: replaceVersionsWithMarkers);
}
class TestConfigWithLanguageVersion extends CfeTestConfig {
@@ -50,7 +54,8 @@
@override
CompilerOptions customizeCompilerOptions(
CompilerOptions options, TestData testData) {
- options.currentSdkVersion = "2.8";
+ options.currentSdkVersion =
+ SymbolicLanguageVersion.currentVersion.version.toText();
File f = new File.fromUri(testData.testFileUri.resolve("test.options"));
if (f.existsSync()) {
diff --git a/pkg/front_end/test/patching/data/opt_in/origin.dart b/pkg/front_end/test/patching/data/opt_in/origin.dart
index 1ccedea..8c886f6 100644
--- a/pkg/front_end/test/patching/data/opt_in/origin.dart
+++ b/pkg/front_end/test/patching/data/opt_in/origin.dart
@@ -4,6 +4,6 @@
/*cfe:nnbd.library: nnbd=true*/
-// @dart=2.9999
+// @dart=%NNBD_VERSION_MARKER%
external int method(int? i);
diff --git a/pkg/front_end/test/patching/data/opt_in/patch.dart b/pkg/front_end/test/patching/data/opt_in/patch.dart
index 298cd4a..be342e0 100644
--- a/pkg/front_end/test/patching/data/opt_in/patch.dart
+++ b/pkg/front_end/test/patching/data/opt_in/patch.dart
@@ -2,7 +2,7 @@
// 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.9999
+// @dart=%NNBD_VERSION_MARKER%
// ignore: import_internal_library
import 'dart:_internal';
diff --git a/pkg/front_end/test/patching/data/opt_in_patch/origin.dart b/pkg/front_end/test/patching/data/opt_in_patch/origin.dart
index a50e32d..ea1dee0 100644
--- a/pkg/front_end/test/patching/data/opt_in_patch/origin.dart
+++ b/pkg/front_end/test/patching/data/opt_in_patch/origin.dart
@@ -4,6 +4,6 @@
/*cfe:nnbd.library: nnbd=false*/
-// @dart=2.6
+// @dart=%LEGACY_VERSION_MARKER%
external int method(int i);
diff --git a/pkg/front_end/test/patching/data/opt_in_patch/patch.dart b/pkg/front_end/test/patching/data/opt_in_patch/patch.dart
index 9ee2b59..dbfb203 100644
--- a/pkg/front_end/test/patching/data/opt_in_patch/patch.dart
+++ b/pkg/front_end/test/patching/data/opt_in_patch/patch.dart
@@ -3,7 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
/*cfe:nnbd.error: message=The language version override has to be the same in the library and its patch(es).*/
-// @dart=2.9999
+// @dart=%NNBD_VERSION_MARKER%
// ignore: import_internal_library
import 'dart:_internal';
diff --git a/pkg/front_end/test/patching/data/opt_out/origin.dart b/pkg/front_end/test/patching/data/opt_out/origin.dart
index 1d99ab1..160b9fe 100644
--- a/pkg/front_end/test/patching/data/opt_out/origin.dart
+++ b/pkg/front_end/test/patching/data/opt_out/origin.dart
@@ -4,6 +4,6 @@
/*cfe:nnbd.library: nnbd=false*/
-// @dart=2.6
+// @dart=%LEGACY_VERSION_MARKER%
external int method();
diff --git a/pkg/front_end/test/patching/data/opt_out/patch.dart b/pkg/front_end/test/patching/data/opt_out/patch.dart
index 5056c9b..e273bca 100644
--- a/pkg/front_end/test/patching/data/opt_out/patch.dart
+++ b/pkg/front_end/test/patching/data/opt_out/patch.dart
@@ -2,7 +2,7 @@
// 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.6
+// @dart=%LEGACY_VERSION_MARKER%
// ignore: import_internal_library
import 'dart:_internal';
diff --git a/pkg/front_end/test/patching/data/opt_out_patch/origin.dart b/pkg/front_end/test/patching/data/opt_out_patch/origin.dart
index e90fe24..cfd3da0 100644
--- a/pkg/front_end/test/patching/data/opt_out_patch/origin.dart
+++ b/pkg/front_end/test/patching/data/opt_out_patch/origin.dart
@@ -4,6 +4,6 @@
/*cfe:nnbd.library: nnbd=true*/
-// @dart=2.9999
+// @dart=%NNBD_VERSION_MARKER%
external int method();
diff --git a/pkg/front_end/test/patching/data/opt_out_patch/patch.dart b/pkg/front_end/test/patching/data/opt_out_patch/patch.dart
index 48cfe52..b39ecb7 100644
--- a/pkg/front_end/test/patching/data/opt_out_patch/patch.dart
+++ b/pkg/front_end/test/patching/data/opt_out_patch/patch.dart
@@ -3,7 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
/*cfe:nnbd.error: message=The language version override has to be the same in the library and its patch(es).*/
-// @dart=2.6
+// @dart=%LEGACY_VERSION_MARKER%
// ignore: import_internal_library
import 'dart:_internal';
diff --git a/pkg/front_end/test/patching/patching_test.dart b/pkg/front_end/test/patching/patching_test.dart
index c224e99..8c67a96 100644
--- a/pkg/front_end/test/patching/patching_test.dart
+++ b/pkg/front_end/test/patching/patching_test.dart
@@ -20,6 +20,7 @@
import 'package:front_end/src/testing/id_testing_helper.dart';
import 'package:front_end/src/testing/id_testing_utils.dart';
import 'package:kernel/ast.dart';
+import '../utils/symbolic_language_versions.dart';
Future<void> main(List<String> args) async {
Directory dataDir = new Directory.fromUri(Platform.script.resolve('data'));
@@ -46,7 +47,9 @@
'opt_out',
'opt_out_patch',
]
- });
+ },
+ preprocessFile: replaceMarkersWithVersions,
+ postProcessData: replaceVersionsWithMarkers);
}
class TestConfigWithLanguageVersion extends CfeTestConfig {
@@ -61,7 +64,8 @@
@override
void customizeCompilerOptions(CompilerOptions options, TestData testData) {
- options.currentSdkVersion = "2.9999";
+ options.currentSdkVersion =
+ SymbolicLanguageVersion.nnbdVersion.version.toText();
}
}
diff --git a/pkg/front_end/test/utils/symbolic_language_versions.dart b/pkg/front_end/test/utils/symbolic_language_versions.dart
new file mode 100644
index 0000000..fa29bc5
--- /dev/null
+++ b/pkg/front_end/test/utils/symbolic_language_versions.dart
@@ -0,0 +1,87 @@
+// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
+// 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.
+
+import 'package:kernel/ast.dart';
+
+/// Symbolic language versions for use in testing.
+enum SymbolicLanguageVersion {
+ /// A valid language version the opts out of null safety.
+ legacyVersion("%LEGACY_VERSION_MARKER%", const Version(2, 6)),
+
+ /// A valid language version the opts in to null safety.
+ nnbdVersion("%NNBD_VERSION_MARKER%", const Version(2, 12)),
+
+ /// An invalid language version that is lower than [lowestVersion].
+ // TODO(johnniwinther): Report error on this.
+ tooLowVersion("%TOO_LOW_VERSION_MARKER%", const Version(1, 0)),
+
+ /// The lowest supported language version.
+ lowestVersion("%LOWEST_VERSION_MARKER%", const Version(2, 0)),
+
+ /// A valid language version larger than [lowestVersion] and lower than
+ /// [version1].
+ version0("%VERSION_MARKER0%", const Version(2, 4)),
+
+ /// A valid language version larger than [version0] and lower than
+ /// [version2].
+ version1("%VERSION_MARKER1%", const Version(2, 5)),
+
+ /// A valid language version larger than [version1] and lower than
+ /// [currentVersion].
+ version2("%VERSION_MARKER2%", const Version(2, 6)),
+
+ /// The current language version. This is also the highest supported version.
+ currentVersion("%CURRENT_VERSION_MARKER%", const Version(2, 8)),
+
+ /// An invalid language version that is higher than [currentVersion].
+ tooHighVersion("%TOO_HIGH_VERSION_MARKER%", const Version(2, 9999));
+
+ final String marker;
+ final Version version;
+
+ const SymbolicLanguageVersion(this.marker, this.version);
+}
+
+late final bool _validMarkers = _checkMarkers();
+
+bool _checkMarkers() {
+ return SymbolicLanguageVersion.tooLowVersion.version <
+ SymbolicLanguageVersion.lowestVersion.version &&
+ SymbolicLanguageVersion.lowestVersion.version <
+ SymbolicLanguageVersion.version0.version &&
+ SymbolicLanguageVersion.version0.version <
+ SymbolicLanguageVersion.version1.version &&
+ SymbolicLanguageVersion.version1.version <
+ SymbolicLanguageVersion.version2.version &&
+ SymbolicLanguageVersion.version2.version <
+ SymbolicLanguageVersion.currentVersion.version &&
+ SymbolicLanguageVersion.currentVersion.version <
+ SymbolicLanguageVersion.tooHighVersion.version;
+}
+
+/// Replaces all occurrences of symbolic language markers in [text] with their
+/// corresponding version as text.
+String replaceMarkersWithVersions(String text) {
+ assert(_validMarkers);
+ for (SymbolicLanguageVersion symbolicVersion
+ in SymbolicLanguageVersion.values) {
+ String marker = symbolicVersion.marker;
+ Version version = symbolicVersion.version;
+ text = text.replaceAll(marker, version.toText());
+ }
+ return text;
+}
+
+/// Replaces all occurrences language versions as text in [text] with the
+/// corresponding symbolic language markers.
+String replaceVersionsWithMarkers(String text) {
+ assert(_validMarkers);
+ for (SymbolicLanguageVersion symbolicVersion
+ in SymbolicLanguageVersion.values) {
+ String marker = symbolicVersion.marker;
+ Version version = symbolicVersion.version;
+ text = text.replaceAll(version.toText(), marker);
+ }
+ return text;
+}