Fix all strong-mode warnings.
R=kevmoo@google.com
Review URL: https://codereview.chromium.org//1834543002 .
diff --git a/.analysis_options b/.analysis_options
new file mode 100644
index 0000000..a10d4c5
--- /dev/null
+++ b/.analysis_options
@@ -0,0 +1,2 @@
+analyzer:
+ strong-mode: true
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ee00a46..86345fe 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.11.4+5
+
+* Fix all strong-mode warnings.
+
## 0.11.4+4
* Deprecate the name parameter to `isInstanceOf`. All language implementations
diff --git a/lib/src/iterable_matchers.dart b/lib/src/iterable_matchers.dart
index 118575a..7185e92 100644
--- a/lib/src/iterable_matchers.dart
+++ b/lib/src/iterable_matchers.dart
@@ -120,8 +120,8 @@
final List _expectedValues;
_UnorderedEquals(Iterable expected)
- : super(expected.map(equals)),
- _expectedValues = expected.toList();
+ : _expectedValues = expected.toList(),
+ super(expected.map(equals));
Description describe(Description description) => description
.add('equals ')
diff --git a/lib/src/operator_matchers.dart b/lib/src/operator_matchers.dart
index 6824c5b..f0a4c08 100644
--- a/lib/src/operator_matchers.dart
+++ b/lib/src/operator_matchers.dart
@@ -90,24 +90,8 @@
description.addAll('(', ' or ', ')', _matchers);
}
-List<Matcher> _wrapArgs(arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
- Iterable<Matcher> matchers;
- if (arg0 is List) {
- if (arg1 != null ||
- arg2 != null ||
- arg3 != null ||
- arg4 != null ||
- arg5 != null ||
- arg6 != null) {
- throw new ArgumentError('If arg0 is a List, all other arguments must be'
- ' null.');
- }
-
- matchers = arg0;
- } else {
- matchers =
- [arg0, arg1, arg2, arg3, arg4, arg5, arg6].where((e) => e != null);
- }
-
- return matchers.map((e) => wrapMatcher(e)).toList();
-}
+List<Matcher> _wrapArgs(arg0, arg1, arg2, arg3, arg4, arg5, arg6) =>
+ [arg0, arg1, arg2, arg3, arg4, arg5, arg6]
+ .where((e) => e != null)
+ .map((e) => wrapMatcher(e))
+ .toList();
diff --git a/lib/src/util.dart b/lib/src/util.dart
index 8706009..a6b3ab4 100644
--- a/lib/src/util.dart
+++ b/lib/src/util.dart
@@ -7,6 +7,8 @@
import 'core_matchers.dart';
import 'interfaces.dart';
+typedef bool _Predicate(value);
+
/// A [Map] between whitespace characters and their escape sequences.
const _escapeMap = const {
'\n': r'\n',
@@ -38,7 +40,7 @@
Matcher wrapMatcher(x) {
if (x is Matcher) {
return x;
- } else if (x is Function) {
+ } else if (x is _Predicate) {
return predicate(x);
} else {
return equals(x);
diff --git a/pubspec.yaml b/pubspec.yaml
index 47e8e84..2c5ade9 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
name: matcher
-version: 0.11.4+4
+version: 0.11.4+5
author: Dart Team <misc@dartlang.org>
description: Support for specifying test expectations
homepage: https://github.com/dart-lang/matcher