Fix several Dart 2 runtime type errors (#834)
Prepare to release 0.12.38+1
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c12c336..25d18a8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.12.38+1
+
+* Fix several Dart 2 runtime type errors.
+
## 0.12.38
* Give `neverCalled` a type that works in Dart 2 semantics.
diff --git a/lib/src/runner/configuration.dart b/lib/src/runner/configuration.dart
index aa0cb8a..21fb890 100644
--- a/lib/src/runner/configuration.dart
+++ b/lib/src/runner/configuration.dart
@@ -393,7 +393,7 @@
/// Returns an unmodifiable copy of [input] or an empty unmodifiable map.
static Map<K, V> _map<K, V>(Map<K, V> input) {
- if (input == null || input.isEmpty) return const {};
+ input ??= {};
return new Map.unmodifiable(input);
}
@@ -576,8 +576,8 @@
///
/// Any overlapping keys in the maps have their configurations merged in the
/// returned map.
- Map<Object, Configuration> _mergeConfigMaps(
- Map<Object, Configuration> map1, Map<Object, Configuration> map2) =>
+ Map<String, Configuration> _mergeConfigMaps(
+ Map<String, Configuration> map1, Map<String, Configuration> map2) =>
mergeMaps(map1, map2,
value: (config1, config2) => config1.merge(config2));
diff --git a/lib/src/runner/configuration/load.dart b/lib/src/runner/configuration/load.dart
index f5ce4e8..3822465 100644
--- a/lib/src/runner/configuration/load.dart
+++ b/lib/src/runner/configuration/load.dart
@@ -371,7 +371,7 @@
(valueList) =>
valueList.every((value) => _packageName.hasMatch(value)));
- return valueNode.value;
+ return new List<String>.from(valueNode.value);
});
}
diff --git a/lib/src/util/one_off_handler.dart b/lib/src/util/one_off_handler.dart
index 7897126..7c00e72 100644
--- a/lib/src/util/one_off_handler.dart
+++ b/lib/src/util/one_off_handler.dart
@@ -2,6 +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.
+import 'dart:async';
import 'package:path/path.dart' as p;
import 'package:shelf/shelf.dart' as shelf;
@@ -33,7 +34,7 @@
}
/// Dispatches [request] to the appropriate handler.
- _onRequest(shelf.Request request) {
+ FutureOr<shelf.Response> _onRequest(shelf.Request request) {
var components = p.url.split(request.url.path);
if (components.isEmpty) return new shelf.Response.notFound(null);
diff --git a/lib/src/util/path_handler.dart b/lib/src/util/path_handler.dart
index 1dbe8a9..aa7e6d8 100644
--- a/lib/src/util/path_handler.dart
+++ b/lib/src/util/path_handler.dart
@@ -2,6 +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.
+import 'dart:async';
import 'package:path/path.dart' as p;
import 'package:shelf/shelf.dart' as shelf;
@@ -34,9 +35,9 @@
node.handler = handler;
}
- _onRequest(shelf.Request request) {
- var handler;
- var handlerIndex;
+ FutureOr<shelf.Response> _onRequest(shelf.Request request) {
+ shelf.Handler handler;
+ int handlerIndex;
var node = _paths;
var components = p.url.split(request.url.path);
for (var i = 0; i < components.length; i++) {
diff --git a/pubspec.yaml b/pubspec.yaml
index 2272a9a..7ec1a7c 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
name: test
-version: 0.12.38
+version: 0.12.38+1
author: Dart Team <misc@dartlang.org>
description: A library for writing dart unit tests.
homepage: https://github.com/dart-lang/test