Closed
Description
@useResult
annotation works fine when a callable class' instance is invoked explicitly by calling instance.call(...)
however when the instance is invoked implicitly instance(...)
the anyalazer won't complain.
class Foo {
const Foo();
@useResult
int call() {
return 42;
}
}
void main() {
final foo = const Foo();
foo.call();
foo(); // BAD: return value is silently ignored
}
dart --version
Dart SDK version: 2.16.2 (stable) (Tue Mar 22 13:15:13 2022 +0100) on "windows_x64"