[checks_codegen] Skip private fields and fields referencing private types (#2782)
The generated extension is written to a separate `.checks.dart` library, so it
cannot access private members or private types from other libraries. Generating
a getter for a private member or for a public member whose type mentions a
private type produced code which failed to compile, for example:
_i1.Subject<int> get _privateField =>
has2('_privateField', (v) => v._privateField);
or a return type referencing `_i2._Private`.
Skip private fields and fields whose getter return type references any private
interface element—including in type arguments, function return/parameter/bound
types, record fields, and instantiated class type parameter bounds—before
collecting referenced elements for import resolution.
Also fail with `InvalidGenerationSourceError` when `@CheckExtensions` directly
lists a private class.
Welcome! package:test is the standard testing library for Dart and Flutter. If you have questions about Dart testing, please see the docs for package:test. package:test_api and package:test_core are implementation details and generally not user-facing.
package:checks is a relatively new library for expressing test expectations. It's a more modern version of package:matcher and features a literate API.
| Package | Description | Issues | Version |
|---|---|---|---|
| checks | A framework for checking values against expectations and building custom expectations. | ||
| fake_async | Fake asynchronous events such as timers and microtasks for deterministic testing. | ||
| matcher | Support for specifying test expectations via an extensible Matcher class. Also includes a number of built-in Matcher implementations for common cases. | ||
| test | A full featured library for writing and running Dart tests across platforms. | ||
| test_api | The user facing API for structuring Dart tests and checking expectations. | ||
| test_core | A basic library for writing tests and running them on the VM. | ||
| test_descriptor | An API for defining and verifying files and directory structures. | ||
| test_process | Test processes: starting; validating stdout and stderr; checking exit code. |