Version 2.11.0-232.0.dev
Merge commit 'b7d4422587ac37e27e31d0578c8501da8ff9352d' into 'dev'
diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json
index e08b11b..fa0a6af 100644
--- a/.dart_tool/package_config.json
+++ b/.dart_tool/package_config.json
@@ -11,7 +11,7 @@
"constraint, update this by running tools/generate_package_config.dart."
],
"configVersion": 2,
- "generated": "2020-10-09T10:15:45.502457",
+ "generated": "2020-10-15T16:28:43.685252",
"generator": "tools/generate_package_config.dart",
"packages": [
{
@@ -454,7 +454,7 @@
{
"name": "observatory_test_package",
"rootUri": "../runtime/observatory/tests/service/observatory_test_package",
- "languageVersion": "2.10"
+ "languageVersion": "2.9"
},
{
"name": "observatory_test_package_2",
@@ -468,6 +468,11 @@
"languageVersion": "2.7"
},
{
+ "name": "package_deps",
+ "rootUri": "../tools/package_deps",
+ "languageVersion": "2.8"
+ },
+ {
"name": "path",
"rootUri": "../third_party/pkg/path",
"packageUri": "lib/",
@@ -495,7 +500,7 @@
"name": "pub",
"rootUri": "../third_party/pkg/pub",
"packageUri": "lib/",
- "languageVersion": "2.9"
+ "languageVersion": "2.11"
},
{
"name": "pub_semver",
@@ -761,4 +766,4 @@
"languageVersion": "2.4"
}
]
-}
+}
\ No newline at end of file
diff --git a/DEPS b/DEPS
index 122c178..403ba49 100644
--- a/DEPS
+++ b/DEPS
@@ -116,7 +116,7 @@
"linter_tag": "0.1.121",
"logging_rev": "1590ba0b648a51e7eb3895c612e4b72f72623b6f",
"markupsafe_rev": "8f45f5cfa0009d2a70589bcda0349b8cb2b72783",
- "markdown_rev": "dbeafd47759e7dd0a167602153bb9c49fb5e5fe7",
+ "markdown_rev": "6f89681d59541ddb1cf3a58efbdaa2304ffc3f51",
"matcher_rev": "9cae8faa7868bf3a88a7ba45eb0bd128e66ac515",
"mime_tag": "0.9.7",
"mockito_rev": "d39ac507483b9891165e422ec98d9fb480037c8b",
diff --git a/pkg/nnbd_migration/test/api_test.dart b/pkg/nnbd_migration/test/api_test.dart
index e137b2a..7205cd2 100644
--- a/pkg/nnbd_migration/test/api_test.dart
+++ b/pkg/nnbd_migration/test/api_test.dart
@@ -4012,6 +4012,74 @@
await _checkSingleFileChanges(content, expected);
}
+ Future<void> test_late_final_hint_instance_field_without_constructor() async {
+ var content = '''
+class C {
+ /*late final*/ int x;
+ f() {
+ x = 1;
+ }
+ int g() => x;
+}
+''';
+ var expected = '''
+class C {
+ late final int x;
+ f() {
+ x = 1;
+ }
+ int g() => x;
+}
+''';
+ await _checkSingleFileChanges(content, expected);
+ }
+
+ Future<void> test_late_final_hint_local_variable() async {
+ var content = '''
+int f(bool b1, bool b2) {
+ /*late final*/ int x;
+ if (b1) {
+ x = 1;
+ }
+ if (b2) {
+ return x;
+ }
+ return 0;
+}
+''';
+ var expected = '''
+int f(bool b1, bool b2) {
+ late final int x;
+ if (b1) {
+ x = 1;
+ }
+ if (b2) {
+ return x;
+ }
+ return 0;
+}
+''';
+ await _checkSingleFileChanges(content, expected);
+ }
+
+ Future<void> test_late_final_hint_top_level_var() async {
+ var content = '''
+/*late final*/ int x;
+f() {
+ x = 1;
+}
+int g() => x;
+''';
+ var expected = '''
+late final int x;
+f() {
+ x = 1;
+}
+int g() => x;
+''';
+ await _checkSingleFileChanges(content, expected);
+ }
+
Future<void> test_late_hint_followed_by_underscore() async {
var content = '''
class _C {}
@@ -4070,28 +4138,6 @@
await _checkSingleFileChanges(content, expected);
}
- Future<void> test_late_final_hint_instance_field_without_constructor() async {
- var content = '''
-class C {
- /*late final*/ int x;
- f() {
- x = 1;
- }
- int g() => x;
-}
-''';
- var expected = '''
-class C {
- late final int x;
- f() {
- x = 1;
- }
- int g() => x;
-}
-''';
- await _checkSingleFileChanges(content, expected);
- }
-
Future<void> test_late_hint_local_variable() async {
var content = '''
int f(bool b1, bool b2) {
@@ -4120,34 +4166,6 @@
await _checkSingleFileChanges(content, expected);
}
- Future<void> test_late_final_hint_local_variable() async {
- var content = '''
-int f(bool b1, bool b2) {
- /*late final*/ int x;
- if (b1) {
- x = 1;
- }
- if (b2) {
- return x;
- }
- return 0;
-}
-''';
- var expected = '''
-int f(bool b1, bool b2) {
- late final int x;
- if (b1) {
- x = 1;
- }
- if (b2) {
- return x;
- }
- return 0;
-}
-''';
- await _checkSingleFileChanges(content, expected);
- }
-
Future<void> test_late_hint_static_field() async {
var content = '''
class C {
@@ -4188,24 +4206,6 @@
await _checkSingleFileChanges(content, expected);
}
- Future<void> test_late_final_hint_top_level_var() async {
- var content = '''
-/*late final*/ int x;
-f() {
- x = 1;
-}
-int g() => x;
-''';
- var expected = '''
-late final int x;
-f() {
- x = 1;
-}
-int g() => x;
-''';
- await _checkSingleFileChanges(content, expected);
- }
-
Future<void> test_leave_downcast_from_dynamic_implicit() async {
var content = 'int f(dynamic n) => n;';
var expected = 'int f(dynamic n) => n;';
diff --git a/tools/VERSION b/tools/VERSION
index 7985532..13bec29 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 11
PATCH 0
-PRERELEASE 231
+PRERELEASE 232
PRERELEASE_PATCH 0
\ No newline at end of file
diff --git a/tools/generate_package_config.dart b/tools/generate_package_config.dart
index 28de041..e20d36681 100644
--- a/tools/generate_package_config.dart
+++ b/tools/generate_package_config.dart
@@ -26,6 +26,7 @@
packageDirectory('sdk/lib/_internal/sdk_library_metadata'),
packageDirectory('sdk/lib/_internal/js_runtime'),
packageDirectory('third_party/pkg/protobuf/protobuf'),
+ packageDirectory('tools/package_deps'),
];
var cfePackageDirs = [
diff --git a/tools/opt_out_files.dart b/tools/opt_out_files.dart
new file mode 100644
index 0000000..6932604
--- /dev/null
+++ b/tools/opt_out_files.dart
@@ -0,0 +1,108 @@
+#!/usr/bin/env dart
+
+// Copyright (c) 2020, 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 'dart:io';
+
+final commentLine = RegExp(r'^///?');
+final scriptLine = RegExp(r'^#\!');
+final languageMarker = RegExp(r"^\s*//\s*@dart\s*=");
+
+void main(List<String> args) {
+ if (args.length < 1) {
+ print('Mark files passed on the command line or under a directory');
+ print(' passed on the command line as opted out of null safety. Does');
+ print(' not mark files under directories containing a pubspec.yaml file');
+ print(' unless the file is specified explicitly in the argument list.');
+ print(' Ignores files not ending in ".dart".');
+ print('Usage: opt_files_out.dart <files or directories>');
+ return;
+ }
+ for (var name in args) {
+ switch (FileSystemEntity.typeSync(name)) {
+ case FileSystemEntityType.directory:
+ markDirectory(Directory(name));
+ break;
+ case FileSystemEntityType.file:
+ markFile(File(name));
+ break;
+ default:
+ print("Ignoring unknown object $name");
+ break;
+ }
+ }
+}
+
+bool isPubSpec(FileSystemEntity entity) =>
+ entity is File && entity.path.endsWith("pubspec.yaml");
+
+void markEntity(FileSystemEntity entity) {
+ if (entity is File) {
+ markFile(entity);
+ } else if (entity is Directory) {
+ markDirectory(entity);
+ } else {
+ print("Ignoring unknown object ${entity.path}");
+ }
+}
+
+void markDirectory(Directory dir) {
+ var children = dir.listSync();
+ if (children.any(isPubSpec)) {
+ print("Skipping files under ${dir.path}");
+ return;
+ }
+ for (var child in children) {
+ markEntity(child);
+ }
+}
+
+void markFile(File file) {
+ if (!file.path.endsWith(".dart")) {
+ return;
+ }
+
+ List<String> lines;
+ try {
+ lines = file.readAsLinesSync();
+ } catch (e) {
+ print("Failed to read file ${file.path}: $e");
+ return;
+ }
+ if (lines.any((line) => line.startsWith(languageMarker))) {
+ print("Skipping already marked file ${file.path}");
+ return;
+ }
+ var marked = markContents(lines);
+ try {
+ file.writeAsStringSync(marked);
+ } catch (e) {
+ print("Failed to write file ${file.path}: $e");
+ return;
+ }
+ print("Marked ${file.path}");
+}
+
+String markContents(List<String> lines) {
+ var buffer = StringBuffer();
+ var marked = false;
+
+ for (var line in lines) {
+ // If the file has not yet been marked, and we have reached the
+ // first non-comment line, insert an opt out marker.
+ if (!marked &&
+ (!commentLine.hasMatch(line)) &&
+ (!scriptLine.hasMatch(line))) {
+ buffer.write('\n// @dart = 2.9\n');
+ marked = true;
+ }
+ buffer.write('$line\n');
+ }
+
+ // In case of empty file, or file of all comments (who does that!?).
+ if (!marked) {
+ buffer.write('\n// @dart = 2.9\n');
+ }
+ return buffer.toString();
+}