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

avoid_types_on_closure_parameters should only apply for type repeating inferred type #1099

Closed
a14n opened this issue Jul 26, 2018 · 3 comments · May be fixed by #3568
Closed

avoid_types_on_closure_parameters should only apply for type repeating inferred type #1099

a14n opened this issue Jul 26, 2018 · 3 comments · May be fixed by #3568
Assignees
Labels
false-positive P3 A lower priority bug or feature request set-none Does not affect any rules in a defined rule set (e.g., core, recommended, flutter) type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@a14n
Copy link
Contributor

a14n commented Jul 26, 2018

dynamic x;
x = (String a) => a.length; // should be OK
@srawlins srawlins added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) false-positive labels Dec 30, 2018
@pq pq mentioned this issue Feb 5, 2019
@dotdoom
Copy link

dotdoom commented Apr 20, 2020

One common use case is Stream#listen's onError callback with StackTrace:

  stream.listen(
      (event) => ...,
      onError: (dynamic e, StackTrace stackTrace) => ...
//                         ^^^^^^^^^^
//                         avoid_types_on_closure_parameters

@davidmorgan
Copy link
Contributor

+1, along with #2131 I think this would make it match omit_local_variable_types, which seems desirable.

@bwilkerson bwilkerson added P3 A lower priority bug or feature request set-none Does not affect any rules in a defined rule set (e.g., core, recommended, flutter) labels Nov 11, 2022
@srawlins srawlins self-assigned this May 24, 2024
copybara-service bot pushed a commit to dart-lang/sdk that referenced this issue May 25, 2024
Fixes dart-lang/linter#1099
Fixes dart-lang/linter#3330

We just add a check that the (approximate) context type is a function type.

Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: I56fe14ff8852375754fdaf6b92b3c632b7df9c95
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/367982
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
@srawlins
Copy link
Member

Fixed with dart-lang/sdk@f07e042

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
false-positive P3 A lower priority bug or feature request set-none Does not affect any rules in a defined rule set (e.g., core, recommended, flutter) type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants