Index: packages/matcher/lib/src/util.dart |
diff --git a/packages/matcher/lib/src/util.dart b/packages/matcher/lib/src/util.dart |
index 112819bd724d4d83424320cc10dd9615ded14834..7e7ff058c55d78886f03744ea46148343f193c9c 100644 |
--- a/packages/matcher/lib/src/util.dart |
+++ b/packages/matcher/lib/src/util.dart |
@@ -5,7 +5,7 @@ |
import 'core_matchers.dart'; |
import 'interfaces.dart'; |
-typedef bool _Predicate(value); |
+typedef bool _Predicate<T>(T value); |
/// A [Map] between whitespace characters and their escape sequences. |
const _escapeMap = const { |
@@ -38,8 +38,13 @@ void addStateInfo(Map matchState, Map values) { |
Matcher wrapMatcher(x) { |
if (x is Matcher) { |
return x; |
- } else if (x is _Predicate) { |
+ } else if (x is _Predicate<Object>) { |
+ // x is already a predicate that can handle anything |
return predicate(x); |
+ } else if (x is _Predicate<Null>) { |
+ // x is a unary predicate, but expects a specific type |
+ // so wrap it. |
+ return predicate((a) => (x as dynamic)(a)); |
} else { |
return equals(x); |
} |