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

[wildcards] Consider reporting UNUSED_CATCH_STACK for stack wildcard params #55738

Open
Tracked by #55681
pq opened this issue May 15, 2024 · 3 comments
Open
Tracked by #55681

[wildcards] Consider reporting UNUSED_CATCH_STACK for stack wildcard params #55738

pq opened this issue May 15, 2024 · 3 comments
Labels
analyzer-quick-fix area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug type-question A question about expected behavior or functionality

Comments

@pq
Copy link
Member

pq commented May 15, 2024

Follow-up from: #55721 (comment), It'd be nice to have a fix (or at least assist) that removes the unnecessary stack catch in code like:

try { } catch(e, _) {
  print(e);
}

producing:

try { } catch(e) {
  print(e);
}

@bwilkerson: if this is a fix, I guess we'd want a diagnostic for what's essentially dead code?

@pq pq added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. analyzer-quick-fix P2 A bug or feature request we're likely to work on labels May 15, 2024
@srawlins srawlins added the type-enhancement A request for a change that isn't a bug label May 24, 2024
@pq
Copy link
Member Author

pq commented Aug 27, 2024

Question: do we want to start reporting UNUSED_CATCH_STACK for the wildcard case?

For example:

try { } catch(e, _) {
  print(e);
}

/cc @kallentu @bwilkerson

@pq pq added the type-question A question about expected behavior or functionality label Aug 27, 2024
@pq pq changed the title Quick fix: remove unnecessary stack catch [wildcards] Consider reporting UNUSED_CATCH_STACK for stack wildcard params Aug 27, 2024
@bwilkerson
Copy link
Member

That seems reasonable to me. There's no value that I can see to having a wildcard as a stack-trace parameter.

@pq
Copy link
Member Author

pq commented Aug 27, 2024

Note that as we're ignoring underscores today this may cause new diagnostics for folks. (Something to consider.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-quick-fix area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug type-question A question about expected behavior or functionality
Projects
None yet
Development

No branches or pull requests

3 participants