SwiftHamcrest
SwiftHamcrest copied to clipboard
Signature of `anything()`
When I use anything()
in my tests, the compiler sometimes is not able to infer the type of the matcher (e.g. when I use generic convenience methods that will have to pull out objects of an [Any]
before checking the type and then applying the matcher).
This will lead to error messages like
Generic parameter W could not be inferred.
where W
corresponds to the generic type of a matcher.
Shouldn't it be okay for anything()
to return Matcher<Any>
instead of Matcher<T>
. The generic type T
doesn't seem to be used anywhere and I wouldn't have to tell the compiler what to do by adding as Matcher<Any>
to my code.