Fix check for predicate with typed argument (#152)

In legacy Dart `Null` is a bottom type, so checking against
`Function(Null)` is an arity check. In null safe Dart the only bottom
type is `Never`. Without this fix when running with
`--enable-experiment=non-nullable` and a predicate callback with an
argument type other than `dynamic` or `Object?` the matcher wrapping
would fall through to use `equals` instead of wrapping as a predicate.

Add a regression test that previously fails as long as the test is run
with the experiment enabled. Without the experiment (or when running
with a predicate from opt-out code) the wrapping continued to work.
2 files changed
tree: f20e0c93a6bb3b0e013b4307f4e11b0a7bce651d
  1. lib/
  2. test/
  3. .gitignore
  4. .test_config
  5. .travis.yml
  6. analysis_options.yaml
  7. CHANGELOG.md
  8. LICENSE
  9. pubspec.yaml
  10. README.md
README.md

Support for specifying test expectations, such as for unit tests.

The matcher library provides a third-generation assertion mechanism, drawing inspiration from Hamcrest.

For more information, see Unit Testing with Dart.