diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json index 9a6403f3d3a..35fc3b9ac1d 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-03-11T09:16:09.767708", + "generated": "2020-04-21T17:36:03.446742", "generator": "tools/generate_package_config.dart", "packages": [ { @@ -66,19 +66,18 @@ "name": "args", "rootUri": "../third_party/pkg/args", "packageUri": "lib/", - "languageVersion": "2.0" + "languageVersion": "2.3" }, { "name": "async", "rootUri": "../third_party/pkg/async", "packageUri": "lib/", - "languageVersion": "2.0" + "languageVersion": "2.2" }, { "name": "async_helper", "rootUri": "../pkg/async_helper", - "packageUri": "lib/", - "languageVersion": "2.7" + "packageUri": "lib/" }, { "name": "bazel_worker", @@ -116,12 +115,6 @@ "packageUri": "lib/", "languageVersion": "2.0" }, - { - "name": "code_transformers", - "rootUri": "../third_party/pkg/code_transformers", - "packageUri": "lib/", - "languageVersion": "1.0" - }, { "name": "collection", "rootUri": "../third_party/pkg/collection", @@ -180,7 +173,7 @@ "name": "dart_style", "rootUri": "../third_party/pkg_tested/dart_style", "packageUri": "lib/", - "languageVersion": "2.3" + "languageVersion": "2.7" }, { "name": "dartdev", @@ -192,7 +185,7 @@ "name": "dartdoc", "rootUri": "../third_party/pkg/dartdoc", "packageUri": "lib/", - "languageVersion": "2.6" + "languageVersion": "2.7" }, { "name": "dartfix", @@ -204,7 +197,7 @@ "name": "dds", "rootUri": "../pkg/dds", "packageUri": "lib/", - "languageVersion": "2.3" + "languageVersion": "2.6" }, { "name": "dev_compiler", @@ -221,8 +214,7 @@ { "name": "expect", "rootUri": "../pkg/expect", - "packageUri": "lib/", - "languageVersion": "2.0" + "packageUri": "lib/" }, { "name": "ffi", @@ -273,12 +265,6 @@ "packageUri": "lib/", "languageVersion": "2.7" }, - { - "name": "func", - "rootUri": "../third_party/pkg/func", - "packageUri": "lib/", - "languageVersion": "1.9" - }, { "name": "gardening", "rootUri": "../tools/gardening", @@ -333,17 +319,11 @@ "packageUri": "lib/", "languageVersion": "2.0" }, - { - "name": "initialize", - "rootUri": "../third_party/pkg/initialize", - "packageUri": "lib/", - "languageVersion": "1.9" - }, { "name": "intl", "rootUri": "../third_party/pkg/intl", "packageUri": "lib/", - "languageVersion": "2.0" + "languageVersion": "2.5" }, { "name": "js", @@ -379,7 +359,7 @@ "name": "linter", "rootUri": "../third_party/pkg/linter", "packageUri": "lib/", - "languageVersion": "2.2" + "languageVersion": "2.6" }, { "name": "logging", @@ -405,12 +385,6 @@ "packageUri": "lib/", "languageVersion": "1.12" }, - { - "name": "metatest", - "rootUri": "../third_party/pkg/metatest", - "packageUri": "lib/", - "languageVersion": "1.8" - }, { "name": "mime", "rootUri": "../third_party/pkg/mime", @@ -453,12 +427,6 @@ "packageUri": "lib/", "languageVersion": "2.0" }, - { - "name": "observable", - "rootUri": "../third_party/pkg/observable", - "packageUri": "lib/", - "languageVersion": "1.19" - }, { "name": "observatory", "rootUri": "../runtime/observatory", @@ -470,12 +438,6 @@ "rootUri": "../runtime/observatory/tests/service/observatory_test_package", "languageVersion": "2.7" }, - { - "name": "observe", - "rootUri": "../third_party/pkg/observe", - "packageUri": "lib/", - "languageVersion": "1.9" - }, { "name": "package_config", "rootUri": "../third_party/pkg_tested/package_config", @@ -494,30 +456,12 @@ "packageUri": "lib/", "languageVersion": "2.1" }, - { - "name": "platform", - "rootUri": "../third_party/pkg/platform", - "packageUri": "lib/", - "languageVersion": "1.24" - }, - { - "name": "plugin", - "rootUri": "../third_party/pkg/plugin", - "packageUri": "lib/", - "languageVersion": "1.0" - }, { "name": "pool", "rootUri": "../third_party/pkg/pool", "packageUri": "lib/", "languageVersion": "2.0" }, - { - "name": "process", - "rootUri": "../third_party/pkg/process", - "packageUri": "lib/", - "languageVersion": "2.0" - }, { "name": "protobuf", "rootUri": "../third_party/pkg/protobuf/protobuf", @@ -534,7 +478,7 @@ "name": "pub_semver", "rootUri": "../third_party/pkg/pub_semver", "packageUri": "lib/", - "languageVersion": "1.0" + "languageVersion": "2.0" }, { "name": "quiver", @@ -548,12 +492,6 @@ "packageUri": "lib/", "languageVersion": "2.0" }, - { - "name": "scheduled_test", - "rootUri": "../third_party/pkg/scheduled_test", - "packageUri": "lib/", - "languageVersion": "1.22" - }, { "name": "sdk_library_metadata", "rootUri": "../sdk/lib/_internal/sdk_library_metadata", @@ -570,13 +508,13 @@ "name": "shelf_packages_handler", "rootUri": "../third_party/pkg/shelf_packages_handler", "packageUri": "lib/", - "languageVersion": "1.22" + "languageVersion": "2.0" }, { "name": "shelf_proxy", "rootUri": "../third_party/pkg/shelf_proxy", "packageUri": "lib/", - "languageVersion": "2.3" + "languageVersion": "2.0" }, { "name": "shelf_static", @@ -596,17 +534,11 @@ "packageUri": "lib/", "languageVersion": "2.3" }, - { - "name": "smoke", - "rootUri": "../third_party/pkg/smoke", - "packageUri": "lib/", - "languageVersion": "1.12" - }, { "name": "source_map_stack_trace", "rootUri": "../third_party/pkg/source_map_stack_trace", "packageUri": "lib/", - "languageVersion": "1.8" + "languageVersion": "2.7" }, { "name": "source_maps", @@ -672,19 +604,19 @@ "name": "test", "rootUri": "../third_party/pkg/test/pkgs/test", "packageUri": "lib/", - "languageVersion": "2.2" + "languageVersion": "2.7" }, { "name": "test_api", "rootUri": "../third_party/pkg/test/pkgs/test_api", "packageUri": "lib/", - "languageVersion": "2.1" + "languageVersion": "2.7" }, { "name": "test_core", "rootUri": "../third_party/pkg/test/pkgs/test_core", "packageUri": "lib/", - "languageVersion": "2.1" + "languageVersion": "2.7" }, { "name": "test_descriptor", @@ -722,12 +654,6 @@ "packageUri": "lib/", "languageVersion": "2.6" }, - { - "name": "tuple", - "rootUri": "../third_party/pkg/tuple", - "packageUri": "lib/", - "languageVersion": "1.6" - }, { "name": "typed_data", "rootUri": "../third_party/pkg/typed_data", @@ -740,12 +666,6 @@ "packageUri": "lib/", "languageVersion": "2.0" }, - { - "name": "utf", - "rootUri": "../third_party/pkg/utf", - "packageUri": "lib/", - "languageVersion": "2.0" - }, { "name": "vm", "rootUri": "../pkg/vm", @@ -762,7 +682,7 @@ "name": "watcher", "rootUri": "../third_party/pkg/watcher", "packageUri": "lib/", - "languageVersion": "2.0" + "languageVersion": "2.2" }, { "name": "web_components", @@ -783,4 +703,4 @@ "languageVersion": "2.0" } ] -} +} \ No newline at end of file diff --git a/pkg/analyzer_cli/pubspec.yaml b/pkg/analyzer_cli/pubspec.yaml index cf57798799f..295f5cf3e19 100644 --- a/pkg/analyzer_cli/pubspec.yaml +++ b/pkg/analyzer_cli/pubspec.yaml @@ -1,6 +1,8 @@ name: analyzer_cli description: Command line interface for the Dart Analyzer. publish_to: none +environment: + sdk: "^2.7.0" dependencies: analyzer: ^0.37.0 args: '>=0.13.0 <2.0.0' diff --git a/pkg/async_helper/lib/async_helper.dart b/pkg/async_helper/lib/async_helper.dart index d5bcc08076a..1f3acb1b329 100644 --- a/pkg/async_helper/lib/async_helper.dart +++ b/pkg/async_helper/lib/async_helper.dart @@ -107,7 +107,10 @@ void asyncExpectThrows(Future f(), [bool check(T error) = _pass, String reason = ""]) { var type = ""; if (T != dynamic && T != Object) type = "<$T>"; - var header = "asyncExpectThrows$type(${reason ?? ''}):"; + // Handle null being passed in from legacy code while also avoiding producing + // an unnecessary null check warning here. + if ((reason as dynamic) == null) reason = ""; + var header = "asyncExpectThrows$type(${reason}):"; // TODO(rnystrom): It might useful to validate that T is not bound to // ExpectException since that won't work. @@ -124,7 +127,7 @@ void asyncExpectThrows(Future f(), } asyncStart(); - result.then((_) { + result.then((_) { throw ExpectException("$header Did not throw."); }).catchError((error, stack) { // A test failure doesn't count as throwing. diff --git a/pkg/async_helper/lib/async_minitest.dart b/pkg/async_helper/lib/async_minitest.dart index 57a05eb1a49..fa5d319cf02 100644 --- a/pkg/async_helper/lib/async_minitest.dart +++ b/pkg/async_helper/lib/async_minitest.dart @@ -310,9 +310,7 @@ final _testToken = Object(); bool _initializedTestNameCallback = false; /// The current combined name of the nesting [group] or [test]. -// TODO(rnystrom): Type this "String?" when this library does not need to be -// NNBD agnostic. -dynamic _currentName = null; +String _currentName = ""; String _pushName(String newName) { // Look up the current test name from the zone created for the test. @@ -322,7 +320,7 @@ String _pushName(String newName) { } var oldName = _currentName; - if (oldName == null) { + if (oldName == "") { _currentName = newName; } else { _currentName = "$oldName $newName"; diff --git a/pkg/async_helper/pubspec.yaml b/pkg/async_helper/pubspec.yaml index df92b533c57..9497752af42 100644 --- a/pkg/async_helper/pubspec.yaml +++ b/pkg/async_helper/pubspec.yaml @@ -7,6 +7,5 @@ description: >- language tests. Third parties are discouraged from using this, and should use the facilities provided in package:test. - dependencies: expect: any diff --git a/pkg/dart2native/pubspec.yaml b/pkg/dart2native/pubspec.yaml index feca449c328..c89834f8b8a 100644 --- a/pkg/dart2native/pubspec.yaml +++ b/pkg/dart2native/pubspec.yaml @@ -1,6 +1,9 @@ name: dart2native publish_to: none +environment: + sdk: "^2.7.0" + # Add the bin/dart2native.dart script to the scripts pub installs. executables: dart2native: diff --git a/pkg/expect/lib/expect.dart b/pkg/expect/lib/expect.dart index 0e993bcd877..4a177ab93a8 100644 --- a/pkg/expect/lib/expect.dart +++ b/pkg/expect/lib/expect.dart @@ -490,7 +490,7 @@ class Expect { * * If the objects are iterables or maps, recurses into them. */ - static void deepEquals(Object expected, Object actual) { + static void deepEquals(dynamic expected, dynamic actual) { // Early exit check for equality. if (expected == actual) return; @@ -560,8 +560,10 @@ class Expect { // TODO(vsm): Make check and reason nullable or change call sites. // Existing tests pass null to set a reason and/or pass them through // via helpers. - check ??= _defaultCheck; - reason ??= ""; + // TODO(rnystrom): Using the strange form below instead of "??=" to avoid + // warnings of unnecessary null checks when analyzed as NNBD code. + if ((check as dynamic) == null) check = _defaultCheck; + if ((reason as dynamic) == null) reason = ""; String msg = reason.isEmpty ? "" : "($reason)"; if (f is! Function()) { // Only throws from executing the function body should count as throwing. @@ -570,7 +572,7 @@ class Expect { } try { f(); - } on Object catch (e, s) { + } catch (e, s) { // A test failure doesn't count as throwing. if (e is ExpectException) rethrow; if (e is T && check(e as dynamic)) return; diff --git a/pkg/expect/lib/minitest.dart b/pkg/expect/lib/minitest.dart index 350b6aa6b9e..0021ada6b96 100644 --- a/pkg/expect/lib/minitest.dart +++ b/pkg/expect/lib/minitest.dart @@ -26,7 +26,7 @@ import 'dart:async'; import 'package:expect/expect.dart'; typedef dynamic _Action(); -typedef void _ExpectationFunction(Object actual); +typedef void _ExpectationFunction(dynamic actual); final List<_Group> _groups = [new _Group()]; @@ -124,7 +124,7 @@ void tearDown(body()) { _groups.last.tearDownFunction = body; } -void expect(Object actual, Object expected, {String reason = ""}) { +void expect(dynamic actual, dynamic expected, {String reason = ""}) { // TODO(rnystrom): Do something useful with reason. if (expected is! _Expectation) { expected = equals(expected); @@ -138,19 +138,19 @@ void fail(String message) { Expect.fail(message); } -Object equals(Object value) => new _Expectation((actual) { +Object equals(dynamic value) => new _Expectation((actual) { Expect.deepEquals(value, actual); }); -Object notEquals(Object value) => new _Expectation((actual) { +Object notEquals(dynamic value) => new _Expectation((actual) { Expect.notEquals(value, actual); }); -Object unorderedEquals(Object value) => new _Expectation((actual) { +Object unorderedEquals(dynamic value) => new _Expectation((actual) { Expect.setEquals(value as Iterable, actual as Iterable); }); -Object predicate(bool fn(Object value), [String description = ""]) => +Object predicate(bool fn(dynamic value), [String description = ""]) => new _Expectation((actual) { Expect.isTrue(fn(actual), description); }); @@ -169,7 +169,7 @@ Object greaterThan(num value) => new _Expectation((actual) { } }); -Object same(Object value) => new _Expectation((actual) { +Object same(dynamic value) => new _Expectation((actual) { Expect.identical(value, actual); }); diff --git a/pkg/expect/pubspec.yaml b/pkg/expect/pubspec.yaml index 5e6beb67310..595d26caf6e 100644 --- a/pkg/expect/pubspec.yaml +++ b/pkg/expect/pubspec.yaml @@ -6,8 +6,5 @@ description: > Third parties are discouraged from using this, and should use the expect() function in the unit test library instead for test assertions. -environment: - sdk: ">=2.0.0 <3.0.0" - dependencies: meta: any diff --git a/pkg/frontend_server/pubspec.yaml b/pkg/frontend_server/pubspec.yaml index c14c3b82220..2effb3bfb73 100644 --- a/pkg/frontend_server/pubspec.yaml +++ b/pkg/frontend_server/pubspec.yaml @@ -3,6 +3,9 @@ name: frontend_server # version: do-not-upload description: A resident kernel compiler +environment: + sdk: "^2.7.0" + dependencies: build_integration: path: ../build_integration diff --git a/pkg/vm/pubspec.yaml b/pkg/vm/pubspec.yaml index ef74ee068d2..27d6379d38c 100644 --- a/pkg/vm/pubspec.yaml +++ b/pkg/vm/pubspec.yaml @@ -3,6 +3,9 @@ name: vm # version: do-not-upload description: VM specific Dart code and helper scripts +environment: + sdk: "^2.7.0" + dependencies: build_integration: path: ../build_integration diff --git a/runtime/observatory/tests/service/observatory_test_package/pubspec.yaml b/runtime/observatory/tests/service/observatory_test_package/pubspec.yaml new file mode 100644 index 00000000000..db61a01f499 --- /dev/null +++ b/runtime/observatory/tests/service/observatory_test_package/pubspec.yaml @@ -0,0 +1,4 @@ +name: observatory_test_package +publish_to: none +environment: + sdk: '^2.7.0' diff --git a/tests/corelib/regexp/regexp_test.dart b/tests/corelib/regexp/regexp_test.dart index 1cb8ac7f8c5..9f42f430b91 100644 --- a/tests/corelib/regexp/regexp_test.dart +++ b/tests/corelib/regexp/regexp_test.dart @@ -32,10 +32,12 @@ void testEscape(str, regexp) { assertEquals("foo:bar:baz", str.split(regexp).join(":")); } -void assertEquals(actual, expected, [message]) => +void assertEquals(actual, expected, [String message = ""]) => Expect.equals(actual, expected, message); -void assertTrue(actual, [message]) => Expect.isTrue(actual, message); -void assertFalse(actual, [message]) => Expect.isFalse(actual, message); +void assertTrue(actual, [String message = ""]) => + Expect.isTrue(actual, message); +void assertFalse(actual, [String message = ""]) => + Expect.isFalse(actual, message); void assertThrows(fn) => Expect.throws(fn); void main() { diff --git a/tests/corelib/uri_test.dart b/tests/corelib/uri_test.dart index bb45fe057be..550fc57dea9 100644 --- a/tests/corelib/uri_test.dart +++ b/tests/corelib/uri_test.dart @@ -470,8 +470,8 @@ void testReplace() { }); var params = uri.queryParametersAll; Expect.equals(2, params.length); - Expect.listEquals(["42", "37"], params["x"]); - Expect.listEquals(["43", "38"], params["y"]); + Expect.listEquals(["42", "37"], params["x"]!); + Expect.listEquals(["43", "38"], params["y"]!); } main() { diff --git a/tests/lib/isolate/function_send_test.dart b/tests/lib/isolate/function_send_test.dart index 4b22fa1a637..38b4698bafc 100644 --- a/tests/lib/isolate/function_send_test.dart +++ b/tests/lib/isolate/function_send_test.dart @@ -191,10 +191,10 @@ void testUnsendable(name, func) { }); Expect.throws(() { noReply.sendPort.send(func); - }, null, "send direct"); + }, (_) => true, "send direct"); Expect.throws(() { noReply.sendPort.send([func]); - }, null, "send wrapped"); + }, (_) => true, "send wrapped"); scheduleMicrotask(() { noReply.close(); asyncEnd(); diff --git a/tools/gardening/pubspec.yaml b/tools/gardening/pubspec.yaml index ca787899c8d..dc6fcca3465 100644 --- a/tools/gardening/pubspec.yaml +++ b/tools/gardening/pubspec.yaml @@ -2,6 +2,8 @@ # gardening by making it a package. name: gardening #version: do-not-upload +environment: + sdk: "^2.7.0" dependencies: args: http: diff --git a/tools/generate_package_config.dart b/tools/generate_package_config.dart index 19e9c94b035..e0ddfb8c71e 100755 --- a/tools/generate_package_config.dart +++ b/tools/generate_package_config.dart @@ -8,9 +8,6 @@ import 'package:path/path.dart' as p; import 'package:pub_semver/pub_semver.dart'; import 'package:yaml/yaml.dart'; -/// Version to use if a package doesn't constrain the language version. -final defaultVersion = Version(2, 7, 0); - final repoRoot = p.dirname(p.dirname(p.fromUri(Platform.script))); final configFilePath = p.join(repoRoot, '.dart_tool/package_config.json'); @@ -75,18 +72,14 @@ Iterable> makePackageConfigs( List packageDirs) sync* { for (var packageDir in packageDirs) { var version = pubspecLanguageVersion(packageDir); - if (version == null) { - print('Warning: Unknown language version for ${p.basename(packageDir)}.'); - version = defaultVersion; - } - var hasLibDirectory = Directory(p.join(packageDir, 'lib')).existsSync(); yield { 'name': p.basename(packageDir), 'rootUri': p.relative(packageDir, from: p.dirname(configFilePath)), if (hasLibDirectory) 'packageUri': 'lib/', - 'languageVersion': '${version.major}.${version.minor}' + if (version != null) + 'languageVersion': '${version.major}.${version.minor}' }; } }