Open
Description
I've tried it on a synthetic example, but it didn't work. I assume it's related to generics.
So here is a copy from the codebase:
void fn() {
test('empty report', () async {
await ExportsCheckstyleReporter(output).report(
[],
const ExportsReportParams(congratulate: true, isAbsolutePath: true), // <-- try replacing ExportsReportParams with ExportsCheckstyleReporter **by typing**
);
verifyNever(() => output.write(captureAny()));
});
}
class ExportsReportParams {
final bool congratulate;
final bool isAbsolutePath;
final bool addSectionHeader;
const ExportsReportParams({
required this.congratulate,
required this.isAbsolutePath,
this.addSectionHeader = false,
});
}
abstract class FileReport {
/// The path to the target file.
final String path;
/// The path to the target file relative to the package root.
final String relativePath;
const FileReport({required this.path, required this.relativePath});
}
abstract class Reporter<Report extends FileReport, Params> {
Future<void> report(Iterable<Report> reports, Params additionalParams);
const Reporter();
}
abstract class CheckstyleReporter<T extends FileReport, P>
extends Reporter<T, P> {
static const id = 'checkstyle';
@protected
final IOSink output;
const CheckstyleReporter(this.output);
}
class ExportsCheckstyleReporter
extends CheckstyleReporter<Never, ExportsReportParams> {
const ExportsCheckstyleReporter(super.output);
@override
Future<void> report(
Iterable<Never> reports,
ExportsReportParams additionalParams,
) async {
}
}
Replacing ExportsReportParams
with ExportsCheckstyleReporter
leads to the analyzer not showing any new errors.
Screen.Recording.2024-03-01.at.13.50.50.mov
If you try to paste the whole void fn()
snipped into a file, you'll also get 0 errors.