Skip to content

[wildcards] Consider quick fix: convert UNUSED_CATCH_CLAUSE to wildcard #55980

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
Tracked by #55681
pq opened this issue Jun 11, 2024 · 2 comments
Closed
Tracked by #55681

[wildcards] Consider quick fix: convert UNUSED_CATCH_CLAUSE to wildcard #55980

pq opened this issue Jun 11, 2024 · 2 comments
Assignees
Labels
devexp-quick-fix Issues with analysis server (quick) fixes feature-wildcard-variables Implementation of the wildcard variables feature legacy-area-analyzer Use area-devexp instead. P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug

Comments

@pq
Copy link
Member

pq commented Jun 11, 2024

Specifically,

f() {
  try {
  } on String catch (exception) {
  }
}

might be fixed to:

f() {
  try {
  } on String catch (_) {
  }
}

in addition to the current fix which removes the clause altogether:

f() {
  try {
  } on String {
  }
}

Question: does such a fix add value?

@kallentu @bwilkerson

@pq pq added legacy-area-analyzer Use area-devexp instead. devexp-quick-fix Issues with analysis server (quick) fixes P2 A bug or feature request we're likely to work on feature-wildcard-variables Implementation of the wildcard variables feature labels Jun 11, 2024
@pq pq self-assigned this Jun 11, 2024
@srawlins srawlins added the type-enhancement A request for a change that isn't a bug label Jun 21, 2024
@pq pq changed the title Quick fix: convert UNUSED_CATCH_CLAUSE to wildcard [wildcards] Consider quick fix: convert UNUSED_CATCH_CLAUSE to wildcard Aug 27, 2024
@bwilkerson
Copy link
Member

The two fixes seem to me to be semantically equivalent. The code will be executed if a String is thrown, and in neither case can the user refer to either the thrown object or the stack trace.

I would want an unnecessary_catch_clause warning on the longer version.

@pq
Copy link
Member Author

pq commented Aug 27, 2024

I would want an unnecessary_catch_clause warning on the longer version.

In that case we don't want a fix to get us to it. My feeling too. Thanks!

@pq pq closed this as completed Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devexp-quick-fix Issues with analysis server (quick) fixes feature-wildcard-variables Implementation of the wildcard variables feature legacy-area-analyzer Use area-devexp instead. P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

3 participants