Change wrapMatcher to avoid relying on fuzzy arrows (#58)
diff --git a/lib/src/util.dart b/lib/src/util.dart
index 112819b..7e7ff05 100644
--- a/lib/src/util.dart
+++ b/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 @@
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);
}