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

[Wildcard Variables] Update UNUSED_CATCH_STACK reporting #55721

Closed
Tracked by #55680
pq opened this issue May 14, 2024 · 2 comments
Closed
Tracked by #55680

[Wildcard Variables] Update UNUSED_CATCH_STACK reporting #55721

pq opened this issue May 14, 2024 · 2 comments
Assignees
Labels
analyzer-warning Issues with the analyzer's Warning codes area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. feature-wildcard-variables Implementation of the wildcard variables feature P2 A bug or feature request we're likely to work on

Comments

@pq
Copy link
Member

pq commented May 14, 2024

Like UNUSED_LOCAL_VARIABLEs, we'll want to flag binding __s in UNUSED_CATCH_STACK.

For example we do not report on the __ below

try {

} catch(e, __) { }

(but should).

/fyi @kallentu

@pq pq self-assigned this May 14, 2024
@pq pq added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. analyzer-warning Issues with the analyzer's Warning codes feature-wildcard-variables Implementation of the wildcard variables feature P2 A bug or feature request we're likely to work on labels May 14, 2024
@pq pq changed the title [Wildcard Variable] Update UNUSED_CATCH_STACK reporting to flag multiple _s [Wildcard Variables] Update UNUSED_CATCH_STACK reporting to flag multiple _s May 14, 2024
@pq pq changed the title [Wildcard Variables] Update UNUSED_CATCH_STACK reporting to flag multiple _s [Wildcard Variables] Update UNUSED_CATCH_STACK reporting May 14, 2024
@kallentu
Copy link
Member

Documenting some thoughts from a chat @pq and I had:

Once we flag the binding __s, we'll report UNUSED_CATCH_STACK which has a quick fix to remove the catch stack trace parameter.

try {
} catch(e, _) { 
  // ..
  // e used somewhere 
}

In this scenario with a wildcard, the stack trace isn't used, but could we not write the above as the following code? It's a small thing, but maybe it's nice to have a quick fix for this?

try {
} catch(e) { 
  // ..
  // e used somewhere 
}

@lrhn mentioned this in #55723 (comment), but shrug I feel like it'd be nice.

@lrhn
Copy link
Member

lrhn commented May 15, 2024

If there is a quick-fix to remove the unnecessary , _, then it's probably fine to warn about it.
I don't expect many people to see analyzer warnings, and not have access to the quick-fixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-warning Issues with the analyzer's Warning codes area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. feature-wildcard-variables Implementation of the wildcard variables feature P2 A bug or feature request we're likely to work on
Projects
None yet
Development

No branches or pull requests

3 participants