Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UseResult generates false positive when value used in optional function argument #49023

Closed
osa1 opened this issue May 16, 2022 · 1 comment
Closed
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.

Comments

@osa1
Copy link
Member

osa1 commented May 16, 2022

Tried with SDK 7fa9a67. Repro:

import 'package:meta/meta.dart';

class A {
  A();

  @UseResult('')
  A rebuild() {
    return this;
  }
}

void main() {
  test(a: A().rebuild());
}

void test({A? a}) {
  print(a);
}

Generates this warning:

   info - protobuf_test.dart:13:15 - The value of 'rebuild' should be used. Try using the result by invoking a member, passing it to a function, or returning
          it from this function. - unused_result
@asashour
Copy link
Contributor

@lrhn lrhn added the area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. label May 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.
Projects
None yet
Development

No branches or pull requests

3 participants