Skip to content

False positive for unnecessary_lambdas #58009

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

Closed
kentcb opened this issue Sep 3, 2019 · 2 comments
Closed

False positive for unnecessary_lambdas #58009

kentcb opened this issue Sep 3, 2019 · 2 comments
Labels
devexp-linter Issues with the analyzer's support for the linter package legacy-area-analyzer Use area-devexp instead.

Comments

@kentcb
Copy link

kentcb commented Sep 3, 2019

Describe the issue
Possibly related to #57957, the following triggers the linter:

expect(() => builder.build(), ...);

However, expect takes a dynamic, not necessarily a Function, so changing to a tear-off changes the behavior to evaluate before invoking expect.

Expected behavior
No lint.

@a14n
Copy link
Contributor

a14n commented Sep 3, 2019

Assuming expect takes dynamic as first parameter and builder.build is a method (not a getter) there are no differences between expect(() => builder.build(), ...); and expect(builder.build, ...);

@kentcb
Copy link
Author

kentcb commented Sep 3, 2019

You're totally right - I forgot to remove the parentheses when converting to tear-off. Classic. That'll teach me for not just using the IDE. Thanks.

@kentcb kentcb closed this as completed Sep 3, 2019
@devoncarew devoncarew added devexp-linter Issues with the analyzer's support for the linter package legacy-area-analyzer Use area-devexp instead. labels Nov 18, 2024
@devoncarew devoncarew transferred this issue from dart-archive/linter Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devexp-linter Issues with the analyzer's support for the linter package legacy-area-analyzer Use area-devexp instead.
Projects
None yet
Development

No branches or pull requests

3 participants